Add compunits range adapter to objfile
[external/binutils.git] / gold / ChangeLog-0815
1 2015-12-17  Peter Collingbourne  <pcc@google.com>
2
3         PR gold/18780
4         * arm.cc (Target_arm::do_make_data_plt): Choose PLT generator based
5         on value of --long-plt flag.
6         (Output_data_plt_arm_standard::do_get_plt_entry_size): Moved to
7         Output_data_plt_arm_short.
8         (Output_data_plt_arm_standard::do_fill_plt_entry): Likewise.
9         (Output_data_plt_arm_standard::plt_entry): Likewise.
10         (Output_data_plt_arm_standard::do_fill_first_plt_entry): Fix
11         variable reference.
12         (Output_data_plt_arm_short): New class.
13         (Output_data_plt_arm_short::do_fill_plt_entry): Error out on too large
14         PLT offsets instead of asserting.
15         (Output_data_plt_arm_long): New class.
16         * options.h (General_options): Define --long-plt flag.
17
18 2015-12-16  Roland McGrath  <mcgrathr@google.com>
19
20         PR ld/17473
21         * binary.cc: Move #include "safe-ctype.h" to be last #include.
22
23 2015-12-13  Cary Coutant  <ccoutant@gmail.com>
24
25         * object.h (Object::get_output_view): remove const from return type.
26         (Object::do_get_output_view): Likewise.
27         (Sized_relobj_file::do_get_output_view): Likewise.
28         * reloc.cc (Sized_relobj_file::do_get_output_view): Likewise.
29
30 2015-12-11  Cary Coutant  <ccoutant@gmail.com>
31
32         * target.h (Target::calls_non_split): Add prelocs, reloc_count
33         parameters.
34         (Target::do_calls_non_split): Likewise.
35         * target.cc (Target::do_calls_non_split): Likewise.
36         * reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Adjust
37         call to Target::calls_non_split.
38         * i386.cc (Target_i386::do_calls_non_split): Add prelocs, reloc_count
39         parameters.
40         * powerpc.cc (Target_powerpc::do_calls_non_split): Likewise.
41         * x86_64.cc (Target_x86_64::do_calls_non_split): Likewise.
42
43 2015-12-11  Cary Coutant  <ccoutant@gmail.com>
44
45         * object.cc (Sized_relobj_file::Sized_relobj_file): Initialize
46         output_views_.
47         * object.h (Object::get_output_view): New function.
48         (Object::do_get_output_view): New function.
49         (Sized_relobj_file::do_get_output_view): New function.
50         (Sized_relobj_file::output_views_): New data member.
51         * reloc.cc: (Sized_relobj_file::do_relocate): Store pointer to
52         output views in class object.
53         (Sized_relobj_file::do_get_output_view): New function.
54
55 2015-12-10  H.J. Lu  <hongjiu.lu@intel.com>
56
57         PR ld/19317
58         * symtab.cc (Symbol_table::add_from_relobj): Don't complain
59         plugin needed to handle slim lto object for relocatable link.
60
61 2015-12-09  Alan Modra  <amodra@gmail.com>
62
63         * powerpc.cc (Target_powerpc::Relocate::relocate): New constant
64         d_offset.  Use throughout.
65         (Target_powerpc::relocate_relocs): Likewise.
66
67 2015-12-09  Alan Modra  <amodra@gmail.com>
68
69         * powerpc.cc (Target_powerpc::Relocate::relocate): Edit ELFv2
70         entry code.
71         (Target_powerpc::relocate_relocs): Edit relocs to suit.
72
73 2015-12-09  Alan Modra  <amodra@gmail.com>
74
75         * object.h (struct Relocate_info): Add "rr".
76         * reloc.h (Relocatable_relocs::set_strategy): New accessor.
77         * reloc.cc (Sized_relobj_file::do_relocate_sections): Init
78         relinfo.rr for relocate_section and relocate_relocs.
79         * powerpc.cc (relocate): Add rel_type and preloc parameters.
80         Delete rela and r_type params, instead recalculate these from
81         preloc.
82         (relocate_relocs): Delete Relocatable_relocs* param, instead
83         use relinfo->rr.
84         * aarch64.cc: Likewise.
85         * arm.cc: Likewise.
86         * i386.cc: Likewise.
87         * mips.cc: Likewise.
88         * s390.cc: Likewise.
89         * sparc.cc: Likewise.
90         * target.h: Likewise.
91         * tilegx.cc: Likewise.
92         * x86_64.cc: Likewise.
93         * testsuite/testfile.cc: Likewise.
94         * target-reloc.h (relocate_section): Adjust to suit.
95         (apply_relocation, relocate_relocs): Likewise.
96
97 2015-12-07  Alan Modra  <amodra@gmail.com>
98
99         * powerpc.cc (add_2_2_12, ld_2_12, lis_2): Define.
100         (Target_powerpc::Scan::local, global): Handle R_PPC64_ENTRY.
101         (Target_powerpc::Relocate::relocate): Edit code at R_PPC64_ENTRY.
102
103 2015-12-03  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
104
105         * object.cc (Sized_relobj::do_for_all_local_got_entries): Use
106         Local_got_entry_key for searching in local_got_offsets_.
107         * object.h (class Local_got_entry_key): New class.
108         (Relobj::local_has_got_offset): New overloaded method.
109         (Relobj::local_got_offset): Likewise.
110         (Relobj::set_local_got_offset): Likewise.
111         (Relobj::do_local_has_got_offset): Add addend argument.
112         (Relobj::do_local_got_offset): Likewise.
113         (Relobj::do_set_local_got_offset): Likewise.
114         (Sized_relobj::do_local_has_got_offset): Add addend argument, and use
115         Local_got_entry_key for searching through local_got_offsets_.
116         (Sized_relobj::do_local_got_offset): Likewise.
117         (Sized_relobj::do_set_local_got_offset): Likewise.
118         (Sized_relobj::Local_got_offsets): Change type of the key from
119         unsigned int to Local_got_entry_key, and add hash and equal_to.
120         * output.cc (Got_entry::write): Take addend into account for
121         calculating value of the local symbol for GOT.
122         (Output_data_got::add_local): New definition of overloaded method.
123         (Output_data_got::add_local_with_rel): Likewise.
124         (Output_data_got::add_local_pair_with_rel): Likewise.
125         * output.h (Output_data_got::add_local): New declaration of overloaded
126         method.
127
128 2015-11-25  Cary Coutant  <ccoutant@gmail.com>
129
130         PR gold/19291
131         * object.cc (Sized_relobj_file::write_local_symbols): If relocatable,
132         subtract section address from symbol value.
133
134 2015-11-25  Alan Modra  <amodra@gmail.com>
135
136         * powerpc.cc (Output_data_got_powerpc::Output_data_got_powerpc): Align
137         to 256 byte boundary.
138
139 2015-11-19  Alan Modra  <amodra@gmail.com>
140
141         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): Correct
142         GOT16 and TOC16 relocs to RELATIVE_REF.
143
144 2015-11-14  Cary Coutant  <ccoutant@gmail.com>
145
146         PR gold/19244
147         PR gold/18548
148         * symtab.cc (Symbol_table::do_define_in_output_data): Check for forced
149         local symbols only for predefined symbols.
150
151 2015-11-11  Alan Modra  <amodra@gmail.com>
152             Peter Bergner <bergner@vnet.ibm.com>
153
154         * powerpc.cc (Powerpc_relocate_functions::addr16_dq): New function.
155         (Powerpc_relocate_functions::addr16dx_ha): Likewise.
156         (Target_powerpc::Scan::local): Handle R_POWERPC_REL16DX_HA.
157         (Target_powerpc::Scan::global): Likewise.
158         (Target_powerpc::Relocate::relocate): Likewise.
159
160 2015-11-09  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
161
162         * layout.h (Layout::is_debug_info_section): Recognize .pdr debug
163         sections.
164
165 2015-11-09  Cary Coutant  <ccoutant@gmail.com>
166             Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
167
168         * copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
169         with type, offset, addend.
170         (Copy_relocs::save): Likewise.
171         * copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
172         (Copy_relocs::save): Likewise.
173         * aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
174         and r_addend to Copy_relocs::copy_reloc.
175         * arm.cc (Target_arm::copy_reloc): Likewise.
176         * i386.cc (Target_i386::copy_reloc): Likewise.
177         * mips.cc (Target_mips::copy_reloc): Likewise.
178         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
179         * s390.cc (Target_s390::copy_reloc): Likewise.
180         * sparc.cc (Target_sparc::copy_reloc): Likewise.
181         * tilegx.cc (Target_tilegx::copy_reloc): Likewise.
182         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
183
184 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
185
186         PR gold/19119
187         PR gold/19172
188         PR gold/19197
189         Revert commit 6457197210144f50a696097c0d308d81d46d5510:
190         2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
191                 * options.h (General_options): Remove "obsolete" from -m.
192                 * parameters.cc (set_parameters_target): Check if input target
193                 is compatible with output emulation set by "-m emulation".
194
195 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
196
197         PR gold/19163
198         * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
199         certain relocations if --no-apply-dynamic-relocs is set.
200         * options.h (--apply-dynamic-relocs): New aarch64-specific option.
201
202 2015-11-03  Alan Modra  <amodra@gmail.com>
203
204         * po/POTFILES.in: Regenerate.
205
206 2015-10-30  Nick Clifton  <nickc@redhat.com>
207
208         * po/zh_CN.po: New (simplified) Chinese translation.
209
210 2015-10-29  H.J. Lu  <hongjiu.lu@intel.com>
211
212         PR gold/19184
213         * incremental.cc (Got_plt_view_info): Add got_entry_size.
214         (Local_got_offset_visitor::visit): Replace got_entry_size_
215         with info_.got_entry_size.
216         (Local_got_offset_visitor::got_entry_size_): Removed.
217         (Global_got_offset_visitor::visit): Replace got_entry_size_
218         with info_.got_entry_size.
219         (Global_got_offset_visitor::got_entry_size_): Removed.
220         (Output_section_incremental_inputs::write_got_plt): Initialize
221         view_info.got_entry_size.
222         * target.h (Sized_target::got_entry_size): New virtual function.
223         * x86_64.cc (Target_x86_64::got_entry_size): New function.
224
225 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
226
227         * testsuite/binary_test.cc: Add __attribute__((aligned(1))).
228         * testsuite/script_test_12a.c: Likewise.
229         * testsuite/script_test_1a.cc: Likewise.
230         * testsuite/script_test_2.cc: Likewise.
231
232 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
233
234         * testsuite/debug_msg.sh: Accept more fuzz in line numbers.
235
236 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
237
238         PR gold/18959
239         * stringpool.cc (Stringpool_template::new_key_offset): Align all
240         strings, even zero-length.
241         (Stringpool_template::set_string_offsets): Likewise.
242
243 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
244
245         * s390.cc: New file.
246         * Makefile.am (TARGETSOURCES): Add s390.cc.
247         (ALL_TARGETOBJS): Add s390.o.
248         * Makefile.in: Regenerate.
249         * configure.ac: Add s390 support.
250         * configure: Regenerate.
251         * configure.tgt: Add s390-*-* and s390x-*-*.
252         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
253         support.
254
255 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
256
257         * archive.cc (Archive::sym64name): New const.
258         (Archive::setup): Add support for SYM64 armap.
259         (Archive::read_armap): Likewise.
260         (Archive::interpret_header): Likewise.
261         (Archive::const_iterator::read_next_header): Likewise.
262         * archive.h (Archive::sym64name): New const.
263         (Archive::read_armap): Add mapsize template parameter.
264
265 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
266
267         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
268         target-specific entry size.
269         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
270         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
271         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
272         hash_entry_size.
273         * target.h (Target::hash_entry_size): New method.
274         (Target::Target_info::hash_entry_size): New data member.
275
276         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
277         * arm.cc (Target_arm::arm_info): Likewise.
278         (Target_arm_nacl::arm_nacl_info): Likewise.
279         * i386.cc (Target_i386::i386_info): Likewise.
280         (Target_i386_nacl::i386_nacl_info): Likewise.
281         (Target_iamcu::iamcu_info): Likewise.
282         * mips.cc (Target_mips::mips_info): Likewise.
283         (Target_mips_nacl::mips_nacl_info): Likewise.
284         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
285         * sparc.cc (Target_sparc::sparc_info): Likewise.
286         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
287         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
288         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
289         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
290
291 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
292
293         PR gold/19177
294         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
295         and R_386_GOT32X relocations without base register.
296
297 2015-10.27  Han Shen  <shenhan@google.com>
298
299         PR gold/19042 - unsupported reloc 311/312.
300
301         * aarch64.cc (Target_aarch64::Scan::local): Add support for
302         reloc 311/312.
303
304 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
305
306         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
307         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
308         as R_X86_64_GOTPCREL.
309         (Target_x86_64<size>::Scan::local): Likewise.
310         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
311         Likewise.
312         (Target_x86_64<size>::Scan::global): Likewise.
313         (Target_x86_64<size>::Relocate::relocate): Likewise.
314         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
315         Likewise.
316
317 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
318
319         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
320         R_386_GOT32X the same as R_386_GOT32.
321         (Target_i386::Scan::local): Likewise.
322         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
323         (Target_i386::Scan::global): Likewise.
324         (Target_i386::Relocate::relocate): Likewise.
325         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
326         Likewise.
327
328 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
329
330         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
331         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
332         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
333         x86_64_mov_to_lea1.o.
334         * testsuite/Makefile.in: Regenerated.
335
336 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
337
338         PR gold/19119
339         * options.h (General_options): Remove "obsolete" from -m.
340         * parameters.cc (set_parameters_target): Check if input target
341         is compatible with output emulation set by "-m emulation".
342
343 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
344
345         PR gold/19118
346         * i386.cc (Target_iamcu): New class.
347         (Target_selector_iamcu): Likewise.
348         (Target_iamcu::iamcu_info): New variable.
349         (target_selector_iamcu): Likewise.
350
351 2015-10-07  Andreas Schwab  <schwab@suse.de>
352
353         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
354
355 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
356
357         PR gold/18855
358         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
359         parameter.
360         (Sparc_relocate_functions::gdop_lox10): Likewise.
361         (Target_sparc::Relocate::relocate): Use addend when computing
362         symbol value for R_SPARC_GOTDATA_OP*.
363
364 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
365
366         PR gold/18930
367         PR gold/18886
368         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
369         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
370
371 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
372
373         PR gold/18886
374         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
375         shared libraries into normal FUNC symbols.
376         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
377         symbols aren't from shared libraries.
378
379 2015-09-02  Alan Modra  <amodra@gmail.com>
380
381         PR 18878
382         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
383         (Target_powerpc::Branch_info::make_stub): Determine whether long
384         branch stub is for save/restore function.
385         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
386         (Stub_table): Add need_save_res_.
387         (Stub_table:clear_stubs): Clear need_save_res_.
388         (Stub_table:set_address_and_size): Add save/restore section size.
389         (Stub_table::add_long_branch_entry): Add save_res param.  Set
390         need_save_res_, but don't add space for save/restore stubs.
391         (Stub_table::find_long_branch_entry): Return offset to local copy
392         of save/restore func.
393         (Stub_table::do_write): Don't output save/restore stubs.  Instead
394         copy the save/restore functions.
395         (Output_data_save_res:contents): New accessor.
396         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
397
398 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
399
400         PR gold/18847
401         * script-sections.cc (Memory_region::set_address): New method.
402         (Script_sections::find_memory_region): Add explicit_only parameter.
403         (Output_section_definition::set_section_addresses): Handle case where
404         script specifies both address and vma region.
405         * script-sections.h (Script_sections::find_memory_region): Add
406         explicit_only parameter.
407
408 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
409
410         PR gold/18859
411         * object.cc (Input_objects::add_object): Store objects in a map,
412         indexed by soname; update as-needed flag when necessary.
413         * object.h (Object::clear_as_needed): New method.
414         (Input_objects::so_names_): Change from set to map.
415
416 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
417
418         PR gold/14746
419         * expression.cc (Expression::Expression_eval_info): Add
420         is_valid_pointer field.
421         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
422         Adjust all callers.
423         (Addr_expression::value_from_output_section): Check whether address
424         is valid.
425         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
426         if evaluation failed due to address that is not yet valid.
427         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
428         parameter.
429
430 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
431
432         PR gold/18866
433         PR gold/18703
434         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
435
436 2015-08-20  Alan Modra  <amodra@gmail.com>
437
438         PR gold/18846
439         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
440         Subtract os->address() from addend.
441         * powerpc.cc (relocate_relocs): Likewise.
442
443 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
444
445         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
446         lazy_stub_normal_1, lazy_stub_normal_1_n64,
447         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
448         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
449         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
450         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
451         of 'addu/daddu'.
452
453 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
454
455         * configure: Regenerated.
456
457 2015-07-26  Doug Kwan  <dougkwan@google.com>
458
459         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
460         disassembler output format.
461
462 2015-07-23  Ian Coolidge  <icoolidge@google.com>
463         Plumb --pic-veneer option for gold.
464
465         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
466         generation.
467         * options.h (General_options): Add --pic-veneer option.
468
469 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
470
471         PR gold/18663
472         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
473         script_test_1a.cc script_test_1b.cc.
474         (script_test_11_r.o): Replace script_test_11.o with
475         script_test_11a.o script_test_11b.o.
476         (script_test_11.o): Removed.
477         (script_test_11a.o): New.
478         (script_test_11b.o): Likewise.
479         * testsuite/Makefile.in: Regenerated.
480         * testsuite/script_test_1.h: New file.
481         * testsuite/script_test_1b.cc: Likewise.
482         * testsuite/script_test_11.h: Likewise.
483         * testsuite/script_test_11b.c: Likewise.
484         * testsuite/script_test_1.cc: Renamed to ...
485         * testsuite/script_test_1a.cc: This.
486         Include "script_test_1.h".
487         (main): Call check_int and check_ptr.
488         * testsuite/script_test_11.c: Renamed to ...
489         * testsuite/script_test_11a.c: This.
490         Include "script_test_11.h".
491         (main): Call ptr_equal.
492
493 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
494
495         PR gold/18628
496         * testsuite/ifuncdep2.c (global): Change protected to hidden.
497         * testsuite/ifuncmod1.c (global): Likewise.
498         * testsuite/ifuncmod5.c (global): Likewise.
499
500 2015-07-22  Alan Modra  <amodra@gmail.com>
501
502         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
503
504 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
505
506         PR gold/18548
507         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
508         forced local symbol even when oldsym != NULL.
509         (Symbol_table::do_define_in_output_segment): Likewise.
510         (Symbol_table::do_define_as_constant): Likewise.
511
512 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
513
514         PR gold/18698
515         * archive.cc (Library_base::should_include_member): Don't use entry
516         point for relocatable links, or if target is not yet valid.
517         * parameters.cc (Parameters::entry): Check target_valid().
518
519 2015-07-20  Han Shen  <shenhan@google.com>
520
521         Optimize erratum 843419 fix.
522
523         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
524         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
525         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
526         (E843419_stub): New sub-class of Erratum_stub.
527         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
528         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
529         (AArch64_relobj::create_erratum_stub): Add 1 argument.
530         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
531
532 2015-07-20  Han Shen  <shenhan@google.com>
533
534         Fix arm elf header flags wrt hardfp bit.
535
536         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
537
538 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
539
540         PR gold/18689
541         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
542         from input group section for relocatable link.
543         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
544         (check_DATA): Add pr18689.stdout.
545         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
546         (pr18689.stdout): New rule.
547         (pr18689a.o): Likewise.
548         (pr18689b.o): Likewise.
549         (pr18689.o): Likewise.
550         * testsuite/pr18689.c: New file.
551         * testsuite/pr18689.sh: Likewise.
552         * testsuite/Makefile.in: Regenerated.
553
554 2015-07-20  Yiran Wang  <yiran@google.com>
555         Cary Coutant  <ccoutant@gmail.com>
556
557         PR gold/15574
558         * resolve.cc (Symbol_table): Remove warning about references
559         from shared objects to hidden symbols.
560         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
561         * testsuite/Makefile.in: Regenerate.
562         * testsuite/hidden_test.sh: Check dynamic symbol table; update
563         expected error messages.
564
565 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
566
567         * compressed_output.cc (Output_compressed_section::set_final_data_size):
568         Make --compress-debug-sections=zlib the same as
569         --compress-debug-sections=zlib-gabi.
570         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
571         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
572         ".zdebug_".
573         * testsuite/Makefile.in: Regenerated.
574
575 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
576
577         PR gold/18322
578         * compressed_output.cc (zlib_compress): Add argument for
579         compression header size.  Set header size to compression header
580         size if it isn't 0.  Don't write out the zlib header here.
581         (Output_compressed_section::set_final_data_size): Support
582         zlib-gnu and zlib-gabi compressions.  Pass compression header
583         size to zlib_compress and write out compression header.  Set
584         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
585         clear the SHF_COMPRESSED bit
586         * options.h (compress_debug_sections): Add zlib-gnu and
587         zlib-gabi.
588         * output.h (Output_section::set_flags): New.
589         * testsuite/Makefile.am (check_PROGRAMS): Add
590         flagstest_compress_debug_sections_none,
591         flagstest_compress_debug_sections_gnu and
592         flagstest_compress_debug_sections_gabi.
593         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
594         flagstest_compress_debug_sections.stdout,
595         flagstest_compress_debug_sections.cmp,
596         flagstest_compress_debug_sections.check,
597         flagstest_compress_debug_sections_gnu.stdout,
598         flagstest_compress_debug_sections_gnu.cmp,
599         flagstest_compress_debug_sections_gnu.check,
600         flagstest_compress_debug_sections_gabi.stdout,
601         flagstest_compress_debug_sections_gabi.cmp and
602         flagstest_compress_debug_sections_gabi.check.
603         (flagstest_compress_debug_sections_none): New.
604         (flagstest_compress_debug_sections_none.stdout): Likewise.
605         (flagstest_compress_debug_sections.stdout): Likewise.
606         (flagstest_compress_debug_sections.check): Likewise.
607         (flagstest_compress_debug_sections.cmp): Likewise.
608         (flagstest_compress_debug_sections_gnu): Likewise.
609         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
610         (flagstest_compress_debug_sections_gnu.check): Likewise.
611         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
612         (flagstest_compress_debug_sections_gabi): Likewise.
613         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
614         (flagstest_compress_debug_sections_gnu.check): Likewise.
615         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
616         * testsuite/Makefile.in: Regenerated.
617
618 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
619
620         PR gold/18321
621         * compressed_output.h (decompress_input_section): Add arguments
622         for ELF class, big endian and sh_flags.
623         * compressed_output.cc (decompress_input_section): Likewise.
624         Support the SHF_COMPRESSED section.
625         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
626         functions.
627         * plugin.h (Pluginobj): Likewise.
628         * layout.cc (Layout::get_output_section_flags): Also clear the
629         SHF_COMPRESSED bit.
630         * object.h (Compressed_section_info): Add flag to store sh_flags.
631         (Object): Add pure virtual elfsize and is_big_endian member
632         functions.
633         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
634         prefix here.
635         (build_compressed_section_map): Check SHF_COMPRESSED for
636         uncompressed size.  Store sh_flags in Compressed_section_info.
637         Pass size, big_endian and sh_flags to decompress_input_section.
638         Skip the ".debug"/".zdebug" prefix when passing section name to
639         need_decompressed_section.
640         (Sized_relobj_file<size, big_endian>::do_find_special_section):
641         Don't check ".zdebug_*" sections.
642         (Object::decompressed_section_contents): Pass ELF class, big
643         endian and sh_flags to decompress_input_section.
644         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
645         Likewise.
646         * testsuite/Makefile.am (check_DATA): Add
647         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
648         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
649         gdb_index_test_2_gabi.stdout.
650         (debug_msg_cdebug_gabi.o): New.
651         (odr_violation1_cdebug_gabi.o): Likewise.
652         (odr_violation2_cdebug_gabi.o): Likewise.
653         (debug_msg_cdebug_gabi.err): Likewise.
654         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
655         (gdb_index_test_cdebug_gabi.o): Likewise.
656         (gdb_index_test_2_gabi): Likewise.
657         (gdb_index_test_2_gabi.stdout): Likewise.
658         * testsuite/gdb_index_test_2_gabi.sh: New file.
659         * testsuite/Makefile.in: Regenerated.
660
661 2015-07-09  Han Shen  <shenhan@google.com>
662
663         Use "gold_info" instead of "gold_warning" for erratum fix.
664
665         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
666         'gold_info'.
667         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
668
669 2015-07-09  Han Shen  <shenhan@google.com>
670
671         Drop missing symbol warning for arm/aarch64.
672
673         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
674         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
675         symbol warning.
676
677 2015-07-07  Han Shen  <shenhan@google.com>
678
679         Make gold aarch64 accept long form of mapping symbols.
680
681         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
682         of mapping symbols.
683
684 2015-06-29  Doug Kwan  <dougkwan@google.com>
685
686         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
687         at address expected by test.
688         * testsuite/arm_cortex_a8_b.s: Ditto.
689         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
690         * testsuite/arm_cortex_a8_bl.s: Ditto.
691         * testsuite/arm_cortex_a8_blx.s: Ditto.
692         * testsuite/arm_cortex_a8_local.s: Ditto.
693         * testsuite/arm_fix_v4bx.s: Ditto.
694         * testsuite/arm_unaligned_reloc.s: Ditto.
695         * testsuite/thumb_bl_out_of_range.s: Ditto.
696         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
697         * testsuite/thumb_blx_out_of_range.s: Ditto.
698
699 2015-06-29  Han Shen  <shenhan@google.com>
700
701         Patch for erratum 843419 internal error.
702
703         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
704         (Erratum_stub::update_erratum_insn): New method.
705         (Stub_table::relocate_stubs): Modified to place relocated insn.
706         (AArch64_relobj::fix_errata): Modified gold_assert.
707
708 2015-06-12  Han Shen  <shenhan@google.com>
709
710         Fix erratum 835769.
711
712         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
713         defintion outside class definition.
714         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
715         (AArch64_insn_utilities::aarch64_op31): New member.
716         (AArch64_insn_utilities::aarch64_ra): New member.
717         (AArch64_insn_utilities::aarch64_mac): New member.
718         (AArch64_insn_utilities::aarch64_mlxl): New member.
719         (ST_E_835769): New global enum member.
720         (Stub_table::relocate_stubs): Add 835769 handler.
721         (Stub_template_repertoire::Stub_template_repertoire): Install new
722         stub type.
723         (AArch64_relobj::scan_errata): This func is renamed from
724         scan_erratum_843419.
725         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
726         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
727         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
728         (Target_aarch64::scan_erratum_835769_span): New method.
729         (Target_aarch64::create_erratum_stub): New method.
730         (Target_aarch64::is_erratum_835769_sequence): New method.
731         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
732         code into create_erratum_stub.
733         * options.h (fix_cortex_a53_835769): New option.
734
735 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
736
737         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
738         outside class body.
739         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
740
741 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
742
743         PR gold/17731
744         * layout.cc (corresponding_uncompressed_section_name): New function.
745         (Layout::choose_output_section): Call it.
746         * layout.h (corresponding_uncompressed_section_name): New function.
747         * script-sections.cc (Input_section_info::set_section_name): Check
748         for compressed debug section (.zdebug style).
749
750 2015-06-11  Jing Yu  <jingyu@google.com>
751
752         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
753         * testsuite/Makefile.in: Regenerate.
754
755 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
756
757         * gold.h (is_cident): Correct typo.
758
759 2015-06-10  Han Shen  <shenhan@google.com>
760         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
761
762         Now fixing for 843419 is fully functional.
763
764         The first part of the erratum fix CL is here -
765         https://sourceware.org/ml/binutils/2015-04/msg00229.html
766
767         * aarch64.cc(global enum): New constants representing stub types.
768         (Stub_template): New POD struct.
769         (Stub_template_repertoire): New class.
770         (Stub_base): New class.
771         (Erratum_stub): New class.
772         (Reloc_stub): Refactored to be a subclass of Stub_base.
773         (Reloc_stub::Stub_type): Removed.
774         (Reloc_stub::offset): Moved to Stub_base.
775         (Reloc_stub::set_offset): Moved to Stub_base.
776         (Reloc_stub::destination_address): Moved to Stub_base.
777         (Reloc_stub::set_destination_address): Moved to Stub_base.
778         (Reloc_stub::reset_destination_address): Moved to Stub_base.
779         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
780         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
781         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
782         (Reloc_stub::write): Moved to Stub_base.
783         (Reloc_stub::invalid_offset): Moved to Stub_base.
784         (Reloc_stub::invalid_address): Moved to Stub_base.
785         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
786         (Reloc_stub::stub_insns_): Moved to Stub_base.
787         (Reloc_stub::offset_): Moved to Stub_base.
788         (Reloc_stub::destination_address_): Moved to Stub_base.
789         (Stub_table::The_aarch64_relobj): New typedef.
790         (Stub_table::The_erratum_stub): New typedef.
791         (Stub_table::The_erratum_stub_less): New typedef.
792         (Stub_table::The_erratum_stub_set): New typedef.
793         (Stub_table::The_erratum_stub_set_iter): New typedef.
794         (Stub_table::empty): Added emptiness testing for erratum stubs.
795         (Stub_table::add_erratum_stub): New method to add an erratum stub.
796         (Stub_table::find_erratum_stub): New method.
797         (Stub_table::find_erratum_stubs_for_input_section): New method.
798         (Stub_table::erratum_stub_address): New method.
799         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
800         (Stub_table::do_addralign): Modified to handle erratum stubs.
801         (Stub_table::erratum_stubs_): New member.
802         (Stub_table::erratum_stub_size_): New member.
803         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
804         (Stub_table::do_write): Modified to handle erratum stubs.
805         (AArch64_relobj::The_erratum_stub): New typedef.
806         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
807         (AArch64_relobj::fix_errata): New method.
808         (Target_aarch64::The_reloc_stub_type): Removed.
809         (Target_aarch64::The_erratum_stub): New typede.
810         (AArch64_relocate_functions::construct_b): New method.
811
812 2015-06-08  Nick Clifton  <nickc@redhat.com>
813
814         * po/fr.po: New French Translation.
815
816 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
817
818         PR gold/18288
819         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
820         callers. Don't use STT_COMMON to check for common symbols.
821         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
822         symbol that's not in a common section.
823         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
824         common symbols.
825
826 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
827
828         PR gold/18200
829         * Makefile.am (diststuff): Add target.
830         * Makefile.in: Regenerate.
831
832 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
833
834         PR gold/17498
835         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
836         temporary locals in merge sections.
837         * options.cc (General_options::parse_discard_all): New method.
838         (General_options::parse_discard_locals): New method.
839         (General_options::parse_discard_none): New method.
840         (General_options::General_options): Initialize discard_locals_.
841         * options.h (--discard-all): Convert to special option.
842         (--discard-locals): Likewise.
843         (--discard-none): New option.
844         (General_options::discard_all): New method.
845         (General_options::discard_locals): New method.
846         (General_options::discard_sec_merge): New method.
847         (General_options::Discard_locals): New enum.
848         (General_options::discard_locals_): New data member.
849
850 2015-06-03  Cary Coutant  <cary@google.com>
851
852         * script-sections.cc (Script_sections::Script_sections): Initialize
853         segments_created_.
854         (Script_sections::create_note_and_tls_segments): Set flag when
855         segments are created.
856         (Script_sections::expected_segment_count): Count PT_INTERP.
857         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
858         segments are created.
859         * script-sections.h (Script_sections::segments_created_): New data
860         member.
861
862 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
863
864         PR gold/15370
865         * script-sections.cc
866         (Output_section_element_input::set_section_addresses): When there
867         are several patterns with no sort spec, put all sections in the same
868         bin.
869         * testsuite/Makefile.am (script_test_12): New testcase.
870         (script_test_12i): New testcase.
871         * testsuite/Makefile.in: Regenerate.
872         * testsuite/script_test_12.t: New test linker script.
873         * testsuite/script_test_12i.t: New test linker script.
874         * testsuite/script_test_12a.c: New test source file.
875         * testsuite/script_test_12b.c: New test source file.
876
877 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
878
879         * nacl.h (Sniff_file): Switch parameters to get_view to get an
880         aligned view.
881
882 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
883
884         PR gold/17819
885         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
886         separate task to schedule the build id computation.
887         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
888         add Output_file and offset.
889         (Hash_task::run): Get and release the input views.
890         (Hash_task::is_runnable): Always return NULL (always runnable).
891         (Layout::queue_build_id_tasks): Remove.
892         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
893         parameters; use them instead of class members.
894         (Build_id_task_runner::run): New function.
895         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
896         to write_build_id.
897         * layout.h (Layout::queue_build_id_tasks): Remove.
898         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
899         parameters.
900         (Layout::array_of_hashes_): Remove.
901         (Layout::size_of_array_of_hashes_): Remove.
902         (Layout::input_view_): Remove.
903         (Build_id_task_runner): New class.
904         (Close_task_runner::Close_task_runner): Add array_of_hashes and
905         size_of_hashes parameters.
906         (Close_task_runner::array_of_hashes_): New data member.
907         (Close_task_runner::size_of_hashes_): New data member.
908         * testsuite/Makefile.am
909         (flagstest_compress_debug_sections_and_build_id_tree): New test.
910         * testsuite/Makefile.in: Regenerate.
911
912 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
913
914         * merge.cc (get_input_merge_map): Update for data structure change.
915         (get_or_make_input_merge_map): Update for data structure change.
916         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
917         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
918
919 2015-05-16  Alan Modra  <amodra@gmail.com>
920
921         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
922         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
923         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
924         (lis_0): Rename from lis_0_0.
925
926 2015-04-29  Cary Coutant  <cary@google.com>
927             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
928
929         * gc.h (Garbage_collection::is_section_garbage): Change Object*
930         to Relobj*.
931         (Garbage_collection::add_reference): Likewise.
932         (Garbage_collection::gc_process_relocs): Likewise. Don't push
933         object/shndx pair onto *secvec for dynamic objects. Don't follow
934         relocations pointing to dynamic objects for GC.
935         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
936         (Icf::unfold_section): Likewise.
937         (Icf::is_section_folded): Likewise.
938         (Icf::get_folded_section): Likewise.
939         * icf.h: (Icf::get_folded_section): Likewise.
940         (Icf::unfold_section): Likewise.
941         (Icf::is_section_folded): Likewise.
942         (Icf::section_has_function_pointers): Likewise.
943         (Icf::set_section_has_function_pointers): Likewise.
944         * object.h (Section_id): Likewise.
945         (Const_section_id): Likewise.
946         * output.cc (Output_section::update_section_layout): Likewise.
947         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
948         Likewise.
949         * plugin.cc (update_section_order): Likewise.
950         (unique_segment_for_sections): Likewise.
951         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
952         (Target_powerpc::do_gc_add_reference): Likewise.
953         (Target_powerpc::gc_process_relocs): Likewise.
954         (Target_powerpc::do_gc_add_reference): Likewise.
955         * symtab.cc (Symbol_table::is_section_folded): Likewise.
956         (Symbol_table::gc_mark_symbol): Likewise.
957         * symtab.h: (Symbol_table::is_section_folded): Likewise.
958         * target.h: (Sized_target::gc_add_reference): Likewise.
959         (Sized_target::do_gc_add_reference): Likewise.
960
961 2015-04-29  Nick Clifton  <nickc@redhat.com>
962
963         * po/fi.po: Updated Finnish translation.
964
965 2015-04-28  Alan Modra  <amodra@gmail.com>
966
967         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
968         than unsigned int for find_global_entry result temp.  Compare
969         against invalid_address.
970         (Target_powerpc::do_plt_address_for_global): Likewise.
971         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
972         on plt call stub existence for debug info.  Do assert for plt
973         and global entry stub existence if an alloc section.
974
975 2015-04-28  Alan Modra  <amodra@gmail.com>
976
977         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
978         on missing global entry stub due to bogus debug info.
979
980 2015-04-27  Han Shen  <shenhan@google.com>
981
982         * options.h (--fix-cortex-a53-843419): Rename option.
983         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
984         option.
985         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
986
987 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
988
989         PR gold/18327
990         * output.cc (Output_section::is_input_address_mapped): Assume a missing
991         entry is mapped.
992         * testsuite/Makefile.am: Add the eh_test test.
993         * testsuite/Makefile.in: Regenerate.
994         * testsuite/eh_test_a.cc: New test.
995         * testsuite/eh_test_b.cc: New test.
996
997 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
998
999         * options.h (--weak-unresolved-symbols): New option.
1000         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
1001         binding to weak with new option.
1002         * symtab.h (is_weak_undefined): Check for new option.
1003         (is_strong_undefined): Check for new option.
1004         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
1005         * testsuite/Makefile.in: Regenerate.
1006         * testsuite/weak_unresolved_symbols_test.cc: New file.
1007
1008 2015-04-20  Ian Coolidge  <icoolidge@google.com>
1009
1010         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
1011         GNU_UNIQUE.
1012
1013 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1014
1015         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
1016         push_back.
1017         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
1018         * object.cc (Sized_relobj_file::do_layout): Use push_back.
1019         * powerpc.cc (process_gc_mark): Use push_back.
1020         (Target_powerpc::do_gc_mark_symbol): Use push_back.
1021         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
1022
1023 2015-04-16  Han Shen  <shenhan@google.com>
1024
1025         * aarch64.cc (AArch64_insn_utilities): New utility class.
1026         (AArch64_relobj::Mapping_symbol_position): New struct.
1027         (AArch64_relobj::Mapping_symbol_info): New typedef.
1028         (AArch64_relobj::do_count_local_symbols): New function overriding
1029         parent's implementation.
1030         (AArch64_relobj::mapping_symbol_info_): New member
1031         (AArch64_relobj::scan_erratum_843419): New method.
1032         (Target_aarch64::scan_erratum_843419_span): New method.
1033         (Target_aarch64::is_erratum_843419_sequence): New method.
1034         * options.h (fix_cortex_a53): New option.
1035
1036 2015-04-09  Cary Coutant  <ccoutant@google.com>
1037
1038         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
1039         in a PIE link.
1040         * testsuite/Makefile.am (tls_pie_test.sh): New test.
1041         * testsuite/Makefile.in: Regenerate.
1042         * testsuite/tls_pie_test.sh: New.
1043
1044 2015-04-09  Cary Coutant  <ccoutant@google.com>
1045
1046         * debug.h (DEBUG_LOCATION): New.
1047         (DEBUG_ALL): Include DEBUG_LOCATION.
1048         (debug_string_to_enum): Add DEBUG_LOCATION.
1049         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
1050         output to print correct context.
1051         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
1052         up to 4 more locations at the beginning of the function.
1053         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
1054         result before sorting list of line numbers.
1055         * testsuite/debug_msg.sh: Allow range of line numbers for
1056         canonical results on optimized code.
1057
1058 2015-04-07  HC Yen <hc.yen@mediatek.com>
1059
1060         Add AArch32 support for gold linker.
1061         * arm.cc: Add V8 arch combine table.
1062
1063 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1064
1065         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
1066
1067 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1068
1069         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
1070         to find by using the return value of insert.
1071
1072 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1073
1074         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
1075         constructor call.
1076
1077 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
1078
1079         PR gold/17641
1080         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
1081         (Target_x86_64::Scan::local): Don't create GOT entry, when we
1082         can convert mov to lea.
1083         (Target_x86_64::Scan::global): Ditto.
1084         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
1085         %reg to lea foo(%rip), %reg if possible.
1086         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
1087         * testsuite/x86_64_mov_to_lea1.s: New.
1088         * testsuite/x86_64_mov_to_lea2.s: Ditto.
1089         * testsuite/x86_64_mov_to_lea3.s: Ditto.
1090         * testsuite/x86_64_mov_to_lea4.s: Ditto.
1091         * testsuite/x86_64_mov_to_lea.sh: Ditto.
1092
1093 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
1094
1095         * configure: Regenerated.
1096
1097 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
1098
1099         PR gold/17640
1100         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
1101         (Target_i386::Scan::local): Don't create GOT entry, when we
1102         can convert GOT to GOTOFF.
1103         (Target_i386::Scan::global): Ditto.
1104         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
1105         lea foo@GOTOFF(%reg), %reg if possible.
1106         * testsuite/Makefile.am (i386_mov_to_lea): New test.
1107         * testsuite/i386_mov_to_lea1.s: New.
1108         * testsuite/i386_mov_to_lea2.s: Ditto.
1109         * testsuite/i386_mov_to_lea3.s: Ditto.
1110         * testsuite/i386_mov_to_lea4.s: Ditto.
1111         * testsuite/i386_mov_to_lea5.s: Ditto.
1112         * testsuite/i386_mov_to_lea.sh: Ditto.
1113
1114 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
1115
1116         * Makefile.am (ZLIB): New.
1117         (ZLIBINC): Likewise.
1118         (AM_CFLAGS): Add $(ZLIBINC).
1119         (AM_CXXFLAGS): Likewise.
1120         (ldadd_varldadd_var): Add $(ZLIB).
1121         (incremental_dump_LDADD): Likewise.
1122         (dwp_LDADD): Likewise.
1123         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
1124         <zlib.h>.
1125         (zlib_compress): Don't check HAVE_ZLIB_H.
1126         (zlib_decompress): Likewise.
1127         * options.h (compress_debug_sections): Likewise.
1128         * configure.ac (AM_CONDITIONAL): Removed.
1129         * testsuite/Makefile.am (ZLIB): New.
1130         (LDADD): Add $(ZLIB).
1131         Don't check HAVE_ZLIB.
1132         * Makefile.in: Regenerated.
1133         * config.in: Likewise.
1134         * configure: Likewise.
1135         * testsuite/Makefile.in: Likewise.
1136
1137 2015-03-30  Jing Yu  <jingyu@google.com>
1138
1139         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
1140         TLSLD_ADD_DTPREL_LO12_NC.
1141         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
1142         _TLS_MODULE_BASE_ point to the start of tls segment.
1143         (Target_aarch64::optimize_tls_reloc): Add cases for
1144         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
1145         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
1146         (Target_aarch64::Scan::local): Likewise.
1147         (Target_aarch64::Scan::global): Likewise.
1148         (Target_aarch64::Relocate::relocate): Likewise.
1149         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
1150         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
1151         relocations.
1152
1153 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1154
1155         * merge.cc (Object_merge_map::add_mapping): call
1156         Object_merge_map::Input_merge_map::add_mapping.
1157         (Object_merge_map::Input_merge_map::add_mapping): New.
1158         (Output_merge_data::do_add_input_section): Call
1159         get_or_make_input_merge_map before a loop.
1160         (Output_merge_string<Char_type>::finalize_merged_data): Call
1161         get_or_make_input_merge_map before a loop.
1162         * merge.h (Object_merge_map): Make Input_merge_map public.
1163         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
1164         (Relobj::get_or_create_merge_map): New.
1165         * object.h (Relobj::get_or_create_merge_map): New.
1166
1167 2015-03-24  Alan Modra  <amodra@gmail.com>
1168
1169         PR 18147
1170         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
1171         relocation errors for branches to strong undefined symbols.
1172
1173 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1174
1175         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
1176         (Object_merge_map::is_merge_section_for): Remove.
1177         (Object_merge_map::find_merge_section): New.
1178         * merge.h (Object_merge_map::is_merge_section_for): Remove.
1179         (Object_merge_map::find_merge_section): New.
1180         (Object_merge_map::get_input_merge_map): Add a const version.
1181         * object.cc (Relobj::is_merge_section_for): Remove.
1182         (Relobj::find_merge_section): New.
1183         * object.h (Relobj::is_merge_section_for): Remove.
1184         (Relobj::find_merge_section): New.
1185         * output.cc
1186         (Output_section::Input_section::is_merge_section_for): Remove.
1187         (Output_section::add_merge_input_section): Don't call
1188         add_merge_input_section.
1189         (Output_section::find_merge_section): Return const. Use
1190         object->find_merge_section.
1191         (Output_section::build_lookup_maps): Don't build a map for
1192         merge sections.
1193         (Output_section::is_input_address_mapped): Return false if
1194         section is not found.
1195         (Output_section::find_starting_output_address): Use
1196         find_merge_section instead of is_merge_section_for.
1197         (Output_section::add_script_input_section):  Don't build a map for
1198         merge sections.
1199         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
1200         (Output_section_lookup_maps::find_merge_section): Remove.
1201         (Output_section_lookup_maps::add_merge_input_section) Remove.
1202         (Output_section::find_merge_section): Return const.
1203
1204 2015-03-22  Cary Coutant  <cary@google.com>
1205
1206         PR gold/18106
1207         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
1208         non-SIB form of lea, with nop after the call.
1209
1210 2015-03-21  Cary Coutant  <cary@google.com>
1211
1212         PR gold/14217
1213         * output.cc (Output_segment::is_first_section_relro): Don't ignore
1214         .tdata section.
1215         (Output_segment::set_section_addresses): Don't align size of relro
1216         segment for .tbss.
1217
1218 2015-03-21  Cary Coutant  <cary@google.com>
1219
1220         PR gold/18010
1221         * stringpool.cc (Stringpool_template): Don't optimize if section
1222         alignment is greater than sizeof(char).
1223
1224 2015-03-21  Cary Coutant  <cary@google.com>
1225
1226         PR gold/18048
1227         * script-c.h (script_include_directive): Add first_token parameter.
1228         * script.cc (script_include_directive): Add first_token parameter, and
1229         pass it to read_script_file.
1230         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
1231         (PARSING_MEMORY_DEF): New tokens.
1232         (top): Add new productions for INCLUDE files.
1233         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1234         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1235         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1236         (section_cmd): Pass PARSING_SECTION_CMDS.
1237         (file_or_sections_cmd): Remove.
1238         (memory_def): Pass PARSING_MEMORY_DEF.
1239         * testsuite/Makefile.am (memory_test_2): New test.
1240         * testsuite/Makefile.in: Regenerate.
1241         * testsuite/memory_test_inc.t: New script file.
1242         * testsuite/memory_test_inc_1.t.src: New script file.
1243         * testsuite/memory_test_inc_2.t.src: New script file.
1244         * testsuite/memory_test_inc_3.t.src: New script file.
1245
1246 2015-03-21  Cary Coutant  <cary@google.com>
1247
1248         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1249         (Sized_relobj_dwo::setup): Build compressed section map.
1250         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1251         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1252         section map.
1253         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1254         compressed_sections_ field.
1255         (build_compressed_section_map): Take Object instead of
1256         Sized_relobj_file parameter; add decompress_if_needed parameter.
1257         (Sized_relobj_file::do_find_special_sections): Store compressed
1258         section map in parent Object.
1259         (Sized_relobj_file::do_decompressed_section_contents): Move
1260         implementation to Object::decompressed_section_contents.
1261         (Sized_relobj_file::do_discard_decompressed_sections): Move
1262         implementation to Object::discard_decompressed_sections.
1263         * object.h (build_compressed_section_map): Declare.
1264         (Object::Object): Add compressed_sections_ field.
1265         (Object::section_is_compressed): Move implementation here.
1266         (Object::decompressed_section_contents): De-virtualize.
1267         (Object::discard_decompressed_sections): De-virtualize.
1268         (Object::do_section_is_compressed): Delete.
1269         (Object::do_decompressed_section_contents): Delete.
1270         (Object::set_compressed_sections): New method.
1271         (Object::compressed_sections): New method.
1272         (Object::compressed_sections_): New data member.
1273         (Compressed_section_info, Compressed_section_map): Move to top of file.
1274         (Sized_relobj_file::do_section_is_compressed): Delete.
1275         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1276         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1277         (Sized_relobj_file::compressed_sections_): Move to Object class.
1278
1279 2015-03-21  Cary Coutant  <ccoutant@google.com>
1280
1281         PR gold/18152
1282         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1283         deferred objects.
1284
1285 2015-03-11  Cary Coutant  <ccoutant@google.com>
1286
1287         * options.cc (General_options::finalize): Don't allow -z relro
1288         with incremental linking.
1289         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1290         (incremental_test_2): Likewise.
1291         (incremental_test_3): Likewise.
1292         (incremental_test_4): Likewise.
1293         (incremental_test_5): Likewise.
1294         (incremental_test_6): Likewise.
1295         (incremental_copy_test): Likewise.
1296         (incremental_common_test_1): Likewise.
1297         (incremental_comdat_test_1): Likewise.
1298         * testsuite/Makefile.in: Regenerate.
1299
1300 2015-03-09  Cary Coutant  <ccoutant@google.com>
1301
1302         PR gold/14675
1303         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1304         return enum indicating whether .eh_frame section is empty, optimizable,
1305         unrecognized, or an end marker. Adjust explicit instantiations.
1306         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1307         (Eh_frame::add_ehframe_input_section): Change return type.
1308         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1309         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1310         to the .eh_frame output section until we see the end marker.
1311         (Layout::finalize_eh_frame_section): New.
1312         * layout.h: (Layout::finalize_eh_frame_section): New.
1313
1314 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1315
1316         * output.cc (Relobj::initialize_input_to_output_map<size>):
1317         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1318
1319 2015-03-04  Cary Coutant  <ccoutant@google.com>
1320
1321         * parameters.cc (Parameters::set_target_once): Call
1322         Target::select_as_default_target just once from here...
1323         (set_parameters_target): ...instead of from here.
1324
1325 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1326
1327         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1328         Output_section_data instead of a Merge_map.
1329         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1330         (Eh_frame::read_cie): Use add_merge_mapping instead of
1331         Merge_map::add_mapping.
1332         (Eh_frame::read_fde): Ditto.
1333         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1334         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1335         merge_map_->get_output_offset.
1336         (Eh_frame::do_is_merge_section_for): Delete.
1337         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1338         instead of a Merge_map.
1339         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1340         Merge_map.
1341         (Eh_frame::do_is_merge_section_for): Delete.
1342         (Eh_frame::merge_map_): Delete.
1343         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1344         and use a Output_section_data instead of a Merge_map.
1345         (Object_merge_map::add_mapping): Ditto.
1346         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1347         (Object_merge_map::is_merge_section_for): Pass in and use a
1348         Output_section_data instead of a Merge_map.
1349         (Merge_map): Delete.
1350         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1351         of merge_map_.get_output_offset.
1352         (Output_merge_base::do_is_merge_section_for): Delete.
1353         (Output_merge_data::do_add_input_section): Use
1354         object->add_merge_mapping instead of add_mapping.
1355         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1356         * merge.h (Merge_map): Delete forward declaration.
1357         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1358         instead of a Merge_map.
1359         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1360         (Object_merge_map::is_merge_section_for): Pass in and use a
1361         Output_section_data instead of a Merge_map.
1362         (Input_merge_map::Object_merge_map::merge_map): Replace with
1363         output_data.
1364         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1365         Output_section_data instead of a Merge_map.
1366         (Merge_map): Delete.
1367         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1368         (Output_merge_base::do_is_merge_section_for): Delete.
1369         (Output_merge_base::add_mapping): Delete.
1370         (Output_merge_base::merge_map_): Delete.
1371         * object.cc (Relobj::initialize_input_to_output_map): New.
1372         (Relobj::initialize_input_to_output_map): New.
1373         (Relobj::merge_output_offset): New.
1374         (Relobj::is_merge_section_for): New.
1375         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1376         bits.
1377         * object.h (Relobj::merge_map): Delete.
1378         (initialize_input_to_output_map): New.
1379         (set_merge_map): Delete.
1380         (add_merge_mapping): New.
1381         (merge_output_offset): New.
1382         (is_merge_section_for): New.
1383         * output.cc (Output_section::Input_section::is_merge_section_for):
1384         Use object->is_merge_section_for.
1385         * output.h (Output_section_data::is_merge_section_for): Delete.
1386         (Output_section_data::do_is_merge_section_for): Delete.
1387         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1388         Use object->initialize_input_to_output_map.
1389         (Merged_symbol_value<size>::value_from_output_section): Use
1390         object->merge_output_offset.
1391
1392 2015-03-02  Peter Collingbourne  <pcc@google.com>
1393             Cary Coutant  <ccoutant@google.com>
1394
1395         * output.cc (Output_section::add_merge_input_section): Do not
1396         attempt to merge sections with an entsize of 0.
1397
1398 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1399
1400         * attributes.h (class Output_attributes_section_data ): Add
1401         do_print_to_mapfile function.
1402
1403 2015-02-24  Alan Modra  <amodra@gmail.com>
1404
1405         PR 18010
1406         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1407         complain if value is not a multiple of four.
1408         (Target_powerpc::Relocate::relocate): Correct handling of
1409         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1410
1411 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1412
1413         * configure.ac (default_size): Set to 32 for x32.
1414         * configure: Regenerated.
1415
1416 2015-02-18  Alan Modra  <amodra@gmail.com>
1417
1418         PR 17954
1419         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1420         visibility.
1421
1422 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1423
1424         * gc.h (Garbage_collection::add_reference): Don't use find.
1425
1426 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1427
1428         * object.cc (write_local_symbols): avoid std::vector copy.
1429
1430 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1431
1432         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1433
1434 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1435
1436         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1437         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1438
1439 2015-02-16  Cary Coutant  <ccoutant@google.com>
1440
1441         PR gold/13577
1442         PR gold/16992
1443         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1444         DF_SYMBOLIC if --dynamic-list option is used.
1445         * options.cc (General_options::finalize): --dynamic-list is not
1446         mutually exclusive with -Bsymbolic.
1447         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1448         listed in --dynamic-list.
1449         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1450         -Bsymbolic-functions.
1451         * testsuite/Makefile.in: Regenerate.
1452
1453 2015-02-16  Cary Coutant  <ccoutant@google.com>
1454
1455         PR gold/17971
1456         * incremental.cc: Remove redundant include of "output.h".
1457
1458 2015-02-12  Jing Yu  <jingyu@google.com>
1459
1460         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1461         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1462         New relocation.
1463         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1464         TLSLE_MOVW_* relocations.
1465         (Target_aarch64::Scan::global): Likewise.
1466         (Target_aarch64::Relocate::relocate): Likewise.
1467         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1468         for new TLSLE_MOVW_* relocations.
1469
1470 2015-02-11  Will Newton  <will.newton@linaro.org>
1471
1472         PR gold/13321
1473         * arm.cc (Target_arm::make_plt_section): Create an ARM
1474         state mapping symbol at the start of the PLT.
1475
1476 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1477
1478         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1479         Replace two_file_shared_2.so with two_file_shared_1.so.
1480         * testsuite/Makefile.in: Regenerated.
1481
1482 2015-02-09  Alan Modra  <amodra@gmail.com>
1483
1484         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1485         plugin_test_thin.a and defsym_test.
1486         * testsuite/Makefile.in: Regenerate.
1487
1488 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1489
1490         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1491         body.
1492
1493 2015-02-04  Peter Collingbourne  <pcc@google.com>
1494
1495         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1496         forwarding symbols when computing symbol resolution info for plugins.
1497         * plugin.h (Plugin_manager::symtab): New method.
1498         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1499
1500 2015-02-03  Cary Coutant  <ccoutant@google.com>
1501             Peter Collingbourne  <pcc@google.com>
1502
1503         PR gold/15660
1504         * archive.cc (Thin_archive_object_unlocker): New class.
1505         (Archive::include_member): Unlock external members of thin archives.
1506         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1507         (plugin_test_2): Likewise.
1508         (plugin_test_3): Likewise.
1509         (plugin_test_4): Likewise.
1510         (plugin_test_5): Likewise.
1511         (plugin_test_6): Likewise.
1512         (plugin_test_7): Likewise.
1513         (plugin_test_8): Likewise.
1514         (plugin_test_9): Likewise.
1515         (plugin_test_10): Likewise.
1516         (plugin_test_11): New test case.
1517         * testsuite/Makefile.in: Regenerate.
1518         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1519         file to decide whether to claim file.
1520         (all_symbols_read_hook): Likewise.
1521         * testsuite/plugin_test_1.sh: Adjust expected output.
1522         * testsuite/plugin_test_2.sh: Likewise.
1523         * testsuite/plugin_test_3.sh: Likewise.
1524         * testsuite/plugin_test_6.sh: Likewise.
1525         * testsuite/plugin_test_tls.sh: Likewise.
1526         * testsuite/plugin_test_11.sh: New testcase.
1527
1528 2015-02-03  Cary Coutant  <ccoutant@google.com>
1529
1530         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1531         file descriptors when debugging enabled. Add debug output.
1532         (Descriptors::release): Add debug output.
1533         (Descriptors::close_some_descriptor): Likewise.
1534         (Descriptors::close_all): Likewise.
1535         * fileread.cc (File_read::lock): Likewise.
1536         (File_read::unlock): Likewise.
1537
1538 2015-02-02  Cary Coutant  <ccoutant@google.com>
1539
1540         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1541         executable output file.
1542
1543 2015-01-22  Han Shen  <shenhan@google.com>
1544
1545         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1546         (Target_arm::do_plt_address_for_global): New method.
1547         (Target_arm::do_plt_address_for_local): New method.
1548         (Target_arm::rel_irelative_section): New method.
1549         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1550         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1551         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1552         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1553         (Target_arm::Scan::check_non_pic): Add ifunc support.
1554         (Target_arm::Scan::local): Add ifunc support.
1555         (Target_arm::Scan::global): Add ifunc support.
1556         (Target_arm::make_plt_section): New method.
1557         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1558         (Target_arm::make_local_ifunc_plt_entry): New method.
1559         (Target_arm::got_irelative_): New member.
1560         (Target_arm::rel_irelative_): New member.
1561         (Target_arm::got_section): Add creation for got_irelative_.
1562         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1563         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1564         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1565         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1566         (Output_data_plt_arm::IRelative_data): New type.
1567         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1568         (Output_data_plt_arm::add_entry): Add more parameters.
1569         (Output_data_plt_arm::add_relocation): New method.
1570         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1571         (Output_data_plt_arm::rel_irelative): New method.
1572         (Output_data_plt_arm::entry_count): Modified.
1573         (Output_data_plt_arm::address_for_global): New method.
1574         (Output_data_plt_arm::address_for_local): New method.
1575         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1576         (Output_data_plt_arm::insert_irelative_data): New method.
1577         (Output_data_plt_arm::irelative_rel_): New member.
1578         (Output_data_plt_arm::got_): New member.
1579         (Output_data_plt_arm::got_irelative_): New member.
1580         (Output_data_plt_arm::irelative_count_): New member.
1581         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1582         (Output_data_plt_arm::irelative_data_vec_): New member.
1583         (Output_data_plt_arm::do_write): Write out irelative entries.
1584         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1585         more parameters to ctor.
1586         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1587         more parameters to ctor.
1588         * output.h (Output_data_reloc::add_local_relative): New method.
1589         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1590
1591 2015-01-29  Alan Modra  <amodra@gmail.com>
1592
1593         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1594         and GOT_TLSGD to LE optimization.
1595
1596 2015-01-28  Cary Coutant  <ccoutant@google.com>
1597
1598         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1599         for undef TLS symbols.
1600         (Target_x86_64::Relocate::relocate_tls): Likewise.
1601         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1602
1603 2015-01-25  Cary Coutant  <ccoutant@google.com>
1604
1605         * output.cc (Output_segment::set_section_addresses): Fix calculation
1606         of size of relro segment.
1607
1608 2015-01-22  Alan Modra  <amodra@gmail.com>
1609
1610         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1611         condition for need of ifunc plt entry.
1612         (Target_powerpc::Scan::global <got relocs>): Likewise.
1613
1614 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1615
1616         * mips.cc (reloc_high): Add r_sym.
1617         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1618         reloc_high constructor.
1619         (Mips_relocate_functions::relgot16_local): Likewise.
1620         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1621         r_type to decide whether LO16 matches HI16.
1622         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1623         rello16 and relgot16_local.
1624
1625 2015-01-09  Cary Coutant  <ccoutant@google.com>
1626
1627         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1628         unless alignment is larger than page size.
1629
1630 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1631             Cary Coutant  <ccoutant@google.com>
1632
1633         PR gold/17729
1634         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1635         (DEFAULT_TARGET_X32): Set for x32.
1636         * x86_64.cc (cmp_insn_32): New.
1637         (lea_r10_insn_32): Likewise.
1638         (lea_r11_insn_32): Likewise.
1639         (cmp_insn_64): Likewise.
1640         (lea_r10_insn_64): Likewise.
1641         (lea_r11_insn_64): Likewise.
1642         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1643         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1644         (check_DATA): Add split_x32 files.
1645         (split_x32_[1234n].o): New targets.
1646         (split_x32_[124]): New targets.
1647         (split_x32_[1234r].stdout): New targets.
1648         * testsuite/split_x32.sh: New file.
1649         * testsuite/split_x32_1.s: Likewise.
1650         * testsuite/split_x32_2.s: Likewise.
1651         * testsuite/split_x32_3.s: Likewise.
1652         * testsuite/split_x32_4.s: Likewise.
1653         * testsuite/split_x32_n.s: Likewise.
1654         * configure: Regenerated.
1655         * testsuite/Makefile.in: Likewise.
1656
1657 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1658
1659         PR gold/17809
1660         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1661         x32.
1662
1663 2015-01-02  Alan Modra  <amodra@gmail.com>
1664
1665         * version.cc (print_version): Just print current year.
1666         * dwp.cc (print_version): Likewise.
1667
1668 2015-01-01  Alan Modra  <amodra@gmail.com>
1669
1670         Update year range in copyright notice of all files.
1671
1672 2014-12-25  Alan Modra  <amodra@gmail.com>
1673
1674         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1675         new enums.
1676         (Target_arm::merge_object_attributes, ): Likewise.
1677
1678 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1679
1680         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1681         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1682         AEABI_VFP_args_vfp to check that.
1683         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1684         value and replace hardcoded values by enum values.
1685
1686 2014-12-22  Cary Coutant  <ccoutant@google.com>
1687
1688         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1689
1690 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1691
1692         PR gold/14608
1693         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1694         to "return i * i * 3;".
1695
1696 2014-12-16  Cary Coutant  <ccoutant@google.com>
1697
1698         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1699         (Mapfile::print_output_data): Use current_data_size() to avoid
1700         assert for sections requiring postprocessing; if address is not valid,
1701         print 0.
1702         (Mapfile::print_output_section): Use current_data_size(); print note
1703         that addresses and sizes are before compression.
1704
1705 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1706
1707         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1708         Cast current_group_size to unsigned long when reporting error.
1709
1710 2014-12-10  Jing Yu  <jingyu@google.com>
1711
1712         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1713         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1714         Update error message.
1715         (Target_aarch64::do_relax): Use absolute value of option
1716         stub_group_size. Replace local variable with class member
1717         stub_group_size_.
1718
1719 2014-12-04  Alan Modra  <amodra@gmail.com>
1720
1721         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1722         addend of PLTREL24 reloc when not generating a plt stub.  Make
1723         max_branch_offset an "Address".
1724         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1725         (Target_powerpc::Relocate::relocate): Likewise.
1726
1727 2014-12-04  Alan Modra  <amodra@gmail.com>
1728
1729         PR 17670
1730         * symtab.cc (Symbol::set_undefined): Remove assertion.
1731         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1732         on symbols defined in discarded sections, instead return false.
1733         Rearrange params, update all callers.
1734         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1735         branches to syms in discarded sections.
1736         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1737         undefined and flag as discarded.
1738         (Target_powerpc::Relocate::relocate): Localize variable.
1739
1740 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1741
1742         PR gold/17675
1743         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1744         * testsuite/Makefile.in: Regenerated.
1745
1746 2014-12-03  Alan Modra  <amodra@gmail.com>
1747
1748         PR 17566
1749         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1750         when adding dynamic relocations against section symbols.
1751
1752 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1753
1754         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1755         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1756         * options.h (General_options): New -z option (global).
1757
1758 2014-12-01  Cary Coutant  <ccoutant@google.com>
1759
1760         PR gold/17578
1761         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1762         is given.
1763         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1764         given but some inputs require executable stack.
1765
1766 2014-11-26  Cary Coutant  <ccoutant@google.com>
1767
1768         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1769         .debug_str_offsets; strip .debug_gnu_pubnames and
1770         .debug_gnu_pubtypes.
1771         (lines_only_debug_sections): Strip all four new sections.
1772
1773 2014-11-26  Jing Yu  <jingyu@google.com>
1774
1775         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1776         register to be x0 when to relax TLSDESC_LD64_LO12.
1777
1778 2014-11-26  Alan Modra  <amodra@gmail.com>
1779
1780         * powerpc.cc (struct Stub_table_owner): New.
1781         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1782         unsigned int vector.  Update all references.
1783         (powerpc_relobj::set_stub_table): Take an unsigned int param
1784         rather than a Stub_table.  Update callers.
1785         (Powerpc_relobj::clear_stub_table): New function.
1786         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1787         stub_group_size_ vars.
1788         (Target_powerpc::new_stub_table): Delete.
1789         (max_branch_delta): New function, extracted from..
1790         (Target_powerpc::Relocate::relocate): ..here..
1791         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1792         status on whether stub created successfully.
1793         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1794         default sizing to..
1795         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1796         reduce on relax failure.
1797         (Target_powerpc::group_sections): Add "no_size_errors" param.
1798         Use stub_group_size_.  Set up group info in a temp vector,
1799         before building Stub_table vector.  Account for input sections
1800         possibly already converted to relaxed sections.
1801         (Stub_table::init): Delete.  Merge into..
1802         (Stub_table::Stub_table): ..here.
1803         (Stub_table::can_reach_stub): New function.
1804         (Stub_table::add_plt_call_entry): Add "from" parameter and
1805         return true iff stub could be reached.
1806         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1807         param too.
1808         (Stub_table::clear_stubs): Add "all" param.
1809
1810 2014-11-26  Alan Modra  <amodra@gmail.com>
1811
1812         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1813         (Target_powerpc::group_sections): Use it.
1814
1815 2014-11-25  Cary Coutant  <ccoutant@google.com>
1816
1817         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1818         (Binary_to_elf::write_symbol): Add st_size parameter.
1819         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1820
1821 2014-11-25  Cary Coutant  <ccoutant@google.com>
1822
1823         PR gold/17639
1824         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1825         (Sized_relobj_file::do_layout): Handle deferred sections properly
1826         during GC pass 1. Don't add reloc sections to deferred list twice.
1827         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1828         (Sized_relobj_file::is_deferred_layout_): New data member.
1829
1830 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1831
1832         PR gold/17619
1833         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1834         Check PC-relative offset overflow in PLT entry.
1835
1836 2014-11-21  Alan Modra  <amodra@gmail.com>
1837
1838         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1839         for undefined weaks.
1840
1841 2014-11-20  Alan Modra  <amodra@gmail.com>
1842
1843         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1844         from --stub-group-size parameter divided by 1024.
1845         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1846         template parameter.  Update all uses.
1847         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1848         has_stub_value.  Set for long branches.  Don't report overflow for
1849         branch to undefined weak symbols.  Print info message on
1850         overflowing branch to stub.
1851
1852 2014-11-20  Alan Modra  <amodra@gmail.com>
1853
1854         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1855
1856 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1857
1858         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1859         entry for R_X86_64_GOTPLT64.
1860         (Target_x86_64<size>::Relocate::relocate): Update comments for
1861         R_X86_64_GOTPLT64.
1862
1863 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1864
1865         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1866         * plugin.h: add lock definition
1867
1868 2014-10-29  Han Shen  <shenhan@google.com>
1869             Jing Yu   <jingyu@google.com>
1870
1871         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1872         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1873         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1874         Symbol::TLS_REF.
1875         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1876         method.
1877         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1878         (Target_aarch64::tls_ld_to_le): New method.
1879         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1880         for 64bit targets.
1881         (Output_data_plt_aarch64::irelative_rel_): New data member.
1882         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1883         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1884         (Output_data_plt_aarch64::add_relocation): New method.
1885         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1886         offset. Add got_irelative size to got size.
1887         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1888         type string with the new typename.
1889         (AArch64_relocate_functions::update_adr): Replace parameter x with
1890         immed.
1891         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1892         (AArch64_relocate_functions::reloc_common): New method.
1893         (AArch64_relocate_funcsions::rela_general): Extract common part out
1894         into reloc_common method.
1895         (AArch64_relocate_functions::rela_general): Likewise.
1896         (AArch64_relocate_functions::pcrela_general): Likewise.
1897         (AArch64_relocate_functions::adr): New method.
1898         (AArch64_relocate_functions::adrp): Calculate immed before calling
1899         update_adr.
1900         (AArch64_relocate_functions::adrp): Likewise.
1901         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1902         comparing x to 0. Calculate immed from ~x when x < 0.
1903         (Target_aarch64::optimize_tls_reloc): Add new cases for
1904         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1905         TLSLD_MOVW_DTPREL_G0_NC.
1906         (Target_aarch64::possible_function_pointer_reloc): Implement this
1907         method.
1908         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1909         comment.
1910         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1911         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1912         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1913         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1914         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1915         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1916         (Target_aarch64::make_plt_entry): Call add_entry with two more
1917         parameters.
1918         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1919         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1920         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1921         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1922         (Target_aarch64::Relocate::relocate_tls): Add cases for
1923         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1924         TLSLD_MOVW_DTPREL_G0_NC.
1925         * testsuite/icf_safe_so_test.cc: Correct test comment.
1926         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1927
1928 2014-10-22  Alan Modra  <amodra@gmail.com>
1929
1930         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1931         thread_starter.
1932
1933 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1934
1935         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1936
1937 2014-10-17  Cary Coutant  <ccoutant@google.com>
1938
1939         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1940         Add "typename" keyword.
1941
1942 2014-10-15  Han Shen  <shenhan@google.com>
1943             Jing Yu   <jingyu@google.com>
1944
1945         Patch for gold aarch64 backend to support relaxation.
1946         * aarch64-reloc.def: Change format.
1947         * aarch64.cc (class Reloc_stub): New class.
1948         (class Stub_table): New class.
1949         (class AArch64_relobj): New class.
1950         (class AArch64_input_section): New class.
1951         (class AArch64_output_section): New class.
1952         (Target_aarch64::new_stub_table): New method.
1953         (Target_aarch64::new_aarch64_input_section): New method.
1954         (Target_aarch64::find_aarch64_input_section): New method.
1955         (Target_aarch64::scan_section_for_stubs): New method.
1956         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1957         (Target_aarch64::relocate_stub): New method.
1958         (Target_aarch64::current_target): New method.
1959         (Target_aarch64::do_make_elf_object): New method.
1960         (Target_aarch64::do_may_relax): New method.
1961         (Target_aarch64::do_relax): New method.
1962         (Target_aarch64::group_sections): New method.
1963         (Target_aarch64::scan_reloc_for_stub): New method.
1964         (Target_aarch64::do_make_output_section): New method.
1965         (Target_aarch64::stub_tables_): New data member.
1966         (Target_aarch64::aarch64_input_section_map_): New data member.
1967         (AArch64_relocate_functions::maybe_apply_stub): New method.
1968
1969 2014-09-30  Cary Coutant  <ccoutant@google.com>
1970
1971         PR gold/17432
1972         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1973
1974 2014-09-30  Kito Cheng  <kito@0xlab.org>
1975
1976         PR gold/13597
1977         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1978         hash table before sysv-style hash table.
1979
1980 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1981
1982         * options.h (--pic-executable): Add negative to alias to -no-pie.
1983
1984 2014-09-26  Cary Coutant  <ccoutant@google.com>
1985
1986         PR gold/16773
1987         * object.cc (Sized_relobj_file): Compute value of section symbols
1988         for TLS sections the same as TLS symbols.
1989
1990 2014-09-25  Cary Coutant  <ccoutant@google.com>
1991
1992         PR gold/17432
1993         * resolve.cc (Symbol_table::resolve): Override common placeholder
1994         symbols, but adjust sizes.
1995         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1996         symbols to common lists.
1997
1998 2014-09-24  Alan Modra  <amodra@gmail.com>
1999
2000         * po/POTFILES.in: Regenerate.
2001
2002 2014-09-23  Taiju Tsuiki  <tzik@google.com>
2003             Cary Coutant  <ccoutant@google.com>
2004
2005         PR gold/14860
2006         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
2007         on input_sections_blocker.
2008         * layout.cc (Write_sections_task::locks): Unblock
2009         input_sections_blocker_.
2010         * layout.h (Write_sections_task::Write_sections_task): Add
2011         input_sections_blocker.
2012         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
2013         to DEPENDENCIES.
2014         * testsuite/Makefile.in: Regenerate.
2015
2016 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
2017
2018         * testsuite/Makefile.am (plugin_test_10): New test.
2019         * testsuite/Makefile.in: Regenerate
2020         * testsuite/plugin_common_test_2.c (c1): Align to 8.
2021         * testsuite/plugin_test_10.sh: New file.
2022
2023 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
2024
2025         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
2026         * resolve.cc (Symbol_table::resolve): Don't override common symbols
2027         during the replacement phase.
2028
2029 2014-09-17  Han Shen  <shenhan@google.com>
2030             Jing Yu  <jingyu@google.com>
2031
2032         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
2033         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
2034         * aarch64.cc (Target_aarch64): Add data members
2035         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
2036         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
2037         constructor.
2038         (Target_aarch64::do_reloc_symbol_index): New method.
2039         (Target_aarch64::do_reloc_addend): New method.
2040         (Target_aarch64::add_tlsdesc_info): New method.
2041         (Target_aarch64::do_dynsym_value): New method.
2042         (Target_aarch64::do_make_data_plt): Add new parameters: got,
2043         got_irelative. Pass them to Output_data_plt_aarch64_standard.
2044         (Target_aarch64::make_data_plt): Add new parameters: got,
2045         got_irelative. Pass them to do_make_data_plt.
2046         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
2047         (Target_aarch64::Relocate:tls_gd_to_le): New method.
2048         (Target_aarch64::Relocate:tls_ie_to_le): New method.
2049         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
2050         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
2051         (Target_aarch64::got_tlsdesc_section): New method.
2052         (Target_aarch64::make_local_ifunc_plt_entry): New method.
2053         (Target_aarch64::define_tls_base_symbol): New method.
2054         (Target_aarch64::reserve_tlsdesc_entries): New method.
2055         (Target_aarch64::got_mod_index_entry): New method.
2056         (Target_aarch64::rela_tlsdesc_section): New method.
2057         (Target_aarch64::rela_irelative_section): New method.
2058         (Target_aarch64::Tlsdesc_info): New struct.
2059         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
2060         relocations and tlsdesc relocations.
2061         (Target_aarch64::optimize_tls_reloc): Implement method.
2062         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
2063         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
2064         in constructor.
2065         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
2066         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
2067         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
2068         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
2069         (Output_data_plt_aarch64::rela_tlsdesc): New method.
2070         (Output_data_plt_aarch64::rela_irelative): New method.
2071         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
2072         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
2073         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
2074         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
2075         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
2076         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
2077         (Output_data_plt_aarch64_standard): New member variables:
2078         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
2079         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
2080         New parameter: got, got_irelative.
2081         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
2082         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
2083         (Output_data_plt_aarch64::do_write): Replace got_address with
2084         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
2085         (AArch64_relocate_functions::update_movnz): New method.
2086         (AArch64_relocate_functions): Correct format.
2087         (AArch64_relocate_functions::movnz): New method.
2088         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
2089         before the switch. Add new cases to switch.
2090         Check ie_to_le relaxation on tlsie relocations. Add code handling
2091         tlsgd tlsdesc cases.
2092         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
2093         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
2094         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
2095         Call reloc_name_in_error_message to print unsupported reloc.
2096         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
2097         make_data_plt.
2098         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
2099         relocs. Fill in some more dynamic tags.
2100         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
2101         Skip call tls_get_addr when tlsgd is relaxed.
2102         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
2103         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
2104         tlsdesc->ie relaxation.
2105
2106 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2107
2108         * mips.cc (Target_mips_nacl): New class.
2109         (Target_selector_mips_nacl): New class.
2110         (target_selector_mips32): Rename from target_selector_mips32be and use
2111         Target_selector_mips_nacl instead of Target_selector_mips.
2112         (target_selector_mips32el): Rename from target_selector_mips32 and use
2113         Target_selector_mips_nacl instead of Target_selector_mips.
2114         (target_selector_mips64): Rename from target_selector_mips64be and use
2115         Target_selector_mips_nacl instead of Target_selector_mips.
2116         (target_selector_mips64el): Rename from target_selector_mips64 and use
2117         Target_selector_mips_nacl instead of Target_selector_mips.
2118         (Target_mips::mips_info): Add const attribute.
2119
2120 2014-09-02  Cary Coutant  <ccoutant@google.com>
2121
2122         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
2123         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
2124         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
2125         (Sized_incr_dynobj::do_section_name): Likewise.
2126         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
2127         (Sized_incr_dynobj::do_section_name): Likewise.
2128         * object.h (Object::section_name): Likewise.
2129         (Object::do_section_name): Likewise.
2130         (Sized_relobj_file::do_section_name): Likewise.
2131         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
2132         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
2133
2134 2014-09-02  Cary Coutant  <ccoutant@google.com>
2135
2136         PR gold/17005
2137         * ehframe.cc (Fde::write): Add output_offset parameter.
2138         (Cie::write): Likewise.
2139         (Eh_frame::set_final_data_size): Account for offset within output
2140         section.
2141         (Eh_frame::do_sized_write): Likewise.
2142         * ehframe.h (Fde::write): Add output_offset parameter.
2143         (Cie::write): Likewise.
2144         * output.cc (Output_section::Input_section_sort_entry): Remove
2145         section_has_name_; add output_section_name parameter. Use
2146         output section name for non-input sections.
2147         (Output_section::Input_section_sort_entry::section_has_name): Remove.
2148         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
2149         (Output_section::Input_section_sort_compare): Remove logic for
2150         sections without names.
2151         (Output_section::Input_section_sort_init_fini_compare): Likewise.
2152         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
2153         Likewise.
2154         (Output_section::Input_section_sort_section_name_compare): Likewise.
2155
2156 2014-08-29 Han Shen <shenhan@google.com>
2157            Jing Yu <jingyu@google.com>
2158
2159         * aarch64-reloc-property.cc
2160         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
2161         reference reloc property in the table.
2162         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
2163         3 other entries.
2164         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2165         2 new overloaded methods.
2166         (Output_data_got_aarch64::do_write): Add code to write out
2167         static relocs.
2168         (class Output_data_got_aarch64::Static_reloc): New class to wrap
2169         static relocs.
2170         (Output_data_got_aarch64::static_relocs): New vector to
2171         hold static relocs.
2172         (Target_aarch64::TCB_SIZE): New const static memeber.
2173         (Target_aarch64::tcb_size): New method.
2174         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
2175         (Target_aarch64::Relocate::relocate_tls): New method.
2176         (Target_aarch64::Scan::local): Add code handling new reloc types.
2177         (Target_aarch64::Scan::global): Add code handling new reloc types.
2178
2179 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
2180
2181         * options.h (-no-pie): Add option.
2182
2183 2014-08-08  Jing Yu  <jingyu@google.com>
2184             Han Shen  <shenhan@google.com>
2185
2186         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
2187         (DEFFILES): add aarch64-reloc.def.
2188         (TARGETSOURCES): Add aarch64-reloc-property.cc.
2189         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
2190         * Makefile.in: Regenerate.
2191         * aarch64-reloc-property.cc: New file.
2192         * aarch64-reloc-property.h: New file.
2193         * aarch64-reloc.def: New file.
2194         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
2195         with tab to make the format consistent.
2196         (Output_data_got_aarch64::symbol_table_): New method.
2197         (Target_aarch64::do_plt_address_for_global): New method.
2198         (Target_aarch64::do_plt_address_for_local): New method.
2199         (Target_aarch64::do_select_as_default_target): New method.
2200         (Target_aarch64::do_make_data_plt): New method.
2201         (Target_aarch64::make_data_plt): New method.
2202         (Output_data_plt_aarch64::has_irelative_section): New method.
2203         (Output_data_plt_aarch64::address_for_global): New method.
2204         (Output_data_plt_aarch64::address_for_local): New method.
2205         (Output_data_plt_aarch64::irelative_rel_): New parameter.
2206         (Output_data_plt_aarch64::add_entry): Implement contents.
2207         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
2208         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
2209         the got_pov entry to plt0.
2210         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
2211         Implement contents.
2212         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
2213         (AArch64_howto): New struct.
2214         (aarch64_howto[]): New static const array.
2215         (AArch64_relocate_functions): New class.
2216         (Target_aarch64::Scan::get_reference_flags): Remove method.
2217         (Target_aarch64::Scan::local): Implement to support a few relocations.
2218         (Target_aarch64::Scan::global): Implement to support a few relocations.
2219         (Target_aarch64::make_plt_section): Implement contents.
2220         (Target_aarch64::make_plt_entry): Implement contents.
2221         (Target_aarch64::do_finalize_sections): Implement contents.
2222         (Target_aarch64::Relocate::relocate): Implement a few relocations.
2223         (Target_aarch64::relocate_section): Implement contents.
2224
2225 2014-08-06  Alan Modra  <amodra@gmail.com>
2226
2227         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2228
2229 2014-08-06  Alan Modra  <amodra@gmail.com>
2230
2231         PR 13227
2232         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2233
2234 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2235
2236         * object.cc (Relobj::is_section_name_included): Add
2237         ".rodata.nptl_version" to not garbage collect this section.
2238
2239 2014-07-08  Cary Coutant  <ccoutant@google.com>
2240
2241         * expression.cc (struct Expression::Expression_eval_info): Add
2242         new fields type_pointer, vis_pointer, and nonvis_pointer.
2243         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2244         nonvis_pointer parameters. Adjust all calls.
2245         (Symbol_expression::value): Update type, visibility, and nonvis bits
2246         in caller.
2247         * script.cc (Symbol_assignment::sized_finalize): Update type,
2248         visibility, and remaining st_other bits for new symbol.
2249         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2250         vis_pointer, and nonvis_pointer parameters.
2251         * symtab.h (Symbol::set_type): New method.
2252
2253         * testsuite/Makefile.am (defsym_test): New test.
2254         * testsuite/Makefile.in: Regenerate.
2255         * testsuite/defsym_test.c: New file.
2256         * testsuite/defsym_test.sh: New file.
2257
2258 2014-07-08  Cary Coutant  <ccoutant@google.com>
2259
2260         PR gold/15639
2261         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2262         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2263         (Sized_dynobj::base_read_symbols): ...new method.
2264         * object.h (Sized_relobj_file::base_read_symbols): New method.
2265         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2266         (Sized_relobj_file::base_read_symbols): ...new method.
2267         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2268         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2269         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2270
2271 2014-07-04  Alan Modra  <amodra@gmail.com>
2272
2273         * po/POTFILES.in: Regenerate.
2274
2275 2014-07-02  Jing Yu  <jingyu@google.com>
2276
2277         * aarch64.cc: New file
2278         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2279         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2280         * Makefile.in: Regenerate.
2281         * configure.tgt: Add entries for aarch64*.
2282         * configure.ac:  Likewise.
2283         * configure: Likewise.
2284
2285 2014-06-27  Alan Modra  <amodra@gmail.com>
2286
2287         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2288
2289 2014-06-24  Cary Coutant  <ccoutant@google.com>
2290
2291         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2292         sections.
2293         (Dwo_file::sized_read_unit_index): Likewise.
2294
2295 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2296
2297         * mips.cc: New file.
2298         * Makefile.am (TARGETSOURCES): Add mips.cc
2299         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2300         * configure.tgt: Add entries for mips*.
2301         * configure.ac: Likewise.
2302         * Makefile.in: Regenerate.
2303         * configure: Likewise.
2304
2305 2014-06-09  Cary Coutant  <ccoutant@google.com>
2306
2307         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2308         unit_length is within section bounds.
2309
2310 2014-06-09  Cary Coutant  <ccoutant@google.com>
2311
2312         PR gold/16980
2313         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2314         map.
2315
2316 2014-06-07  Alan Modra  <amodra@gmail.com>
2317
2318         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2319
2320 2014-06-06  Cary Coutant  <ccoutant@google.com>
2321
2322         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2323         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2324         (Dwarf_pubnames_table::read_header): Likewise.
2325         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2326         .debug_gnu_pubtypes.
2327
2328 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2329
2330         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2331         * Makefile.in, configure: Regenerate.
2332
2333 2014-06-03  Alan Modra  <amodra@gmail.com>
2334
2335         * powerpc.cc (addis_12_2): Define.
2336         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2337
2338 2014-06-03  Alan Modra  <amodra@gmail.com>
2339
2340         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2341         st_other output.
2342
2343 2014-06-02  Alan Modra  <amodra@gmail.com>
2344
2345         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2346         Only ignore relocs on ELFv1.
2347         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2348
2349 2014-05-30  Cary Coutant  <ccoutant@google.com>
2350
2351         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2352         * testsuite/Makefile.in: Regenerate.
2353         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2354
2355 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2356
2357         PR gold/16945
2358         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2359         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2360
2361 2014-05-15  Alan Modra  <amodra@gmail.com>
2362
2363         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2364         Compare FDE contents with DW_CFA_nop rather than 0.
2365
2366 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2367
2368         * symtab.h (may_need_copy_reloc): Remove check for position independent
2369         code.
2370         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2371         position independence before pc absolute may_need_copy_reloc call.
2372         Add check for executable output befor pc relative may_need_copy_reloc
2373         call.
2374         * i386.cc: Ditto.
2375         * arm.cc: Ditto.
2376         * sparc.cc: Ditto.
2377         * tilegx.cc: Ditto.
2378         * powerpc.cc: Add check for no position independence before
2379         may_need_copy_reloc calls.
2380         * testsuite/pie_copyrelocs_test.cc: New file.
2381         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2382         * Makefile.am (pie_copyrelocs_test): New test.
2383         * Makefile.in: Regenerate.
2384
2385 2014-05-08  Martin Liška  <mliska@suse.cz>
2386
2387         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2388
2389 2014-05-06  Cary Coutant  <ccoutant@google.com>
2390
2391         PR gold/16900
2392         * i386.cc (Output_data_got_plt_i386): New class.
2393         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2394         parameter. Change all callers.
2395         (Output_data_plt_i386::layout_): Remove.
2396         (Output_data_plt_i386::got_plt_): Change type.
2397         (Target_i386::got_plt_): Change type. Change all references.
2398         (Target_i386::got_section): Create instance of new class.
2399         (Output_data_got_plt_i386::do_write): New function.
2400         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2401         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2402         parameter. Change all callers.
2403         (Output_data_plt_x86_64::layout_): Remove.
2404         (Output_data_plt_x86_64::got_plt_): Change type.
2405         (Target_x86_64::got_plt_): Change type. Change all references.
2406         (Target_x86_64::got_section): Create instance of new class.
2407         (Output_data_got_plt_x86_64::do_write): New function.
2408         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2409         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2410         class.
2411
2412 2014-05-05  Cary Coutant  <ccoutant@google.com>
2413
2414         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2415         if we have pubnames/pubtypes.
2416
2417 2014-05-02  Cary Coutant  <ccoutant@google.com>
2418
2419         * defstd.cc (in_segment): Define __ehdr_start here...
2420         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2421         output segment when known.
2422         * resolve.cc (Symbol::override_base_with_special): Remember
2423         the original binding.
2424         * symtab.cc (Symbol::set_output_segment): New function.
2425         (Symbol::set_undefined): New function.
2426         * symtab.h (Symbol::is_weak_undefined): Check original undef
2427         binding.
2428         (Symbol::is_strong_undefined): New function.
2429         (Symbol::set_output_segment): New function.
2430         (Symbol::set_undefined): New function.
2431         * target-reloc.h (is_strong_undefined): Remove.
2432         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2433         Check for hidden undefs.
2434         (relocate_section): Call Symbol::is_strong_undefined.
2435
2436         * testsuite/Makefile.am (ehdr_start_test_1)
2437         (ehdr_start_test_2, ehdr_start_test_3)
2438         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2439         * testsuite/Makefile.in: Regenerate.
2440         * testsuite/ehdr_start_def.cc: New source file.
2441         * testsuite/ehdr_start_test.cc: New source file.
2442         * testsuite/ehdr_start_test.t: New linker script.
2443         * testsuite/ehdr_start_test_4.sh: New shell script.
2444
2445 2014-04-23  Cary Coutant  <ccoutant@google.com>
2446
2447         PR gold/16870
2448         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2449
2450 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2451
2452         * layout.cc (Layout::include_section): Allow a target to decide
2453         whether to include a section.
2454         * target.h (Target::should_include_section): New function.
2455         (Target::do_should_include_section): New function.
2456
2457 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2458
2459         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2460         inline into ...
2461         (Copy_relocs::emit): ... here.
2462         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2463         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2464         (Copy_reloc_entry::entries_): Change from private to protected.
2465
2466 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2467
2468         * icf.cc (get_section_contents): Replace copies of reloc
2469         vectors with const references.
2470
2471 2014-04-02  Cary Coutant  <ccoutant@google.com>
2472
2473         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2474         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2475         * configure: Regenerate.
2476         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2477         -fno-use-linker-plugin.
2478         (LINK1, CXXLINK1): Add it to the link command.
2479         * testsuite/Makefile.in: Regenerate.
2480
2481 2014-03-12  Alan Modra  <amodra@gmail.com>
2482
2483         * Makefile.in: Regenerate.
2484
2485 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2486
2487         * symtab.h (Symbol::set_nonvis): New function.
2488
2489 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2490
2491         * symtab.cc (Sized_symbol<32>::init_output_data):
2492         Instantiate the template.
2493         (Sized_symbol<64>::init_output_data): Likewise.
2494
2495 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2496
2497         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2498         adjust dynamic symbol value.
2499         * target.h (Target::adjust_dyn_symbol): New function.
2500         (Target::do_adjust_dyn_symbol): New function.
2501
2502 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2503
2504         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2505         Get the value of DYNAMIC_CUSTOM dynamic entry.
2506         * output.h (Output_data_dynamic::add_custom): New function.
2507         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2508         dynamic entry.
2509         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2510         * target.h (Target::dynamic_tag_custom_value): New function.
2511         (Target::do_dynamic_tag_custom_value): New function.
2512
2513 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2514
2515         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2516         dynsym indexes.
2517         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2518         (Target::do_has_custom_set_dynsym_indexes): New function.
2519         (Target::set_dynsym_indexes): New function.
2520         (Target::do_set_dynsym_indexes): New function.
2521
2522 2014-03-07  Alan Modra  <amodra@gmail.com>
2523
2524         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2525         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2526         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2527         (Powerpc_relocate_functions::has_overflow_bitfield,
2528         overflowed): Use the above.
2529         (Target_powerpc::Relocate::relocate): Correct overflow checking
2530         for a number of relocations.  Modify overflow test for 16-bit
2531         fields in instructions to signed/unsigned according to whether
2532         the field takes a signed or unsigned value.
2533
2534 2014-03-05  Alan Modra  <amodra@gmail.com>
2535
2536         Update copyright years.
2537
2538 2014-03-05  Alan Modra  <amodra@gmail.com>
2539
2540         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2541         R_PPC64_ADDR64_LOCAL.
2542         (Target_powerpc::Relocate::relocate): Likewise.
2543
2544 2014-03-03  Alan Modra  <amodra@gmail.com>
2545
2546         * dwp.cc (print_version): Update copyright year to current.
2547
2548 2014-02-10  Alan Modra  <amodra@gmail.com>
2549
2550         * po/gold.pot: Regenerate.
2551
2552 2014-02-06  Cary Coutant  <ccoutant@google.com>
2553
2554         Fix problem where -u is ignored when a weak undef is seen.
2555
2556         * archive.cc (Library_base::should_include_member): Reorder
2557         code to check for -u option if a weak undef has already been seen.
2558         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2559         * testsuite/Makefile.in: Regenerate.
2560         * testsuite/weak_undef_file3.cc: New file.
2561         * testsuite/weak_undef_file4.cc: New file.
2562         * testsuite/weak_undef_test_2.cc: New file.
2563
2564 2014-02-05  Cary Coutant  <ccoutant@google.com>
2565
2566         Fix issues with gold undefined symbol diagnostics.
2567
2568         PR binutils/15435
2569         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2570         check to here.
2571         * target-reloc.h (is_strong_undefined): New function.
2572         (relocate_section): Move undef vtable symbol check from here.
2573         Check for is_strong_undefined.
2574
2575 2014-02-05  Cary Coutant  <ccoutant@google.com>
2576
2577         Fix problems with the --dynamic-list option.
2578
2579         PR gold/13577
2580         * options.cc (General_options::parse_dynamic_list):
2581         Set have_dynamic_list_.
2582         (General_options::General_options): Initialize have_dynamic_list_.
2583         (General_options::finalize): Turn off -Bsymbolic and
2584         -Bsymbolic-functions if --dynamic-list provided.
2585         * options.h (General_options::have_dynamic_list): New function.
2586         (General_options::have_dynamic_list_): New data member.
2587         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2588         correctly.
2589
2590         PR gold/16530
2591         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2592         in --dynamic-list, mark it.
2593
2594         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2595         (dynamic_list_2): New test case.
2596         * testsuite/Makefile.in: Regenerate.
2597         * testsuite/dynamic_list_2.cc: New file.
2598         * testsuite/dynamic_list_2.t: New file.
2599         * testsuite/dynamic_list_lib1.cc: New file.
2600         * testsuite/dynamic_list_lib2.cc: New file.
2601         * testsuite/gc_dynamic_list_test.c: New file.
2602         * testsuite/gc_dynamic_list_test.sh: New file.
2603         * testsuite/gc_dynamic_list_test.t: New file.
2604
2605 2014-01-28  Cary Coutant  <ccoutant@google.com>
2606
2607         Add .gdb_index version 7 support.
2608
2609         * dwarf_reader.cc: include <utility> (for make_pair).
2610         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2611         debug sections.
2612         (Dwarf_ranges_table::read_ranges_table): Likewise.
2613         (Dwarf_pubnames_table::read_section): Check for GNU-style
2614         sections, and for compressed debug sections.
2615         (Dwarf_pubnames_table::read_header): Compute end address of table.
2616         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2617         for end of list by offset, not by offset == 0.
2618         (Dwarf_info_reader::do_read_string_table): Check for compressed
2619         debug sections.
2620         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2621         Initialize new data members.
2622         (Dwarf_pubnames_table::next_name): return flag_byte.
2623         (Dwarf_pubnames_table::end_of_table_): New data member.
2624         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2625         * gdb-index.cc (gdb_index_version): Update to version 7.
2626         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2627         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2628         read skeleton type unit DIEs.
2629         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2630         (Gdb_index::do_write): Write flag_byte.
2631         * gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2632         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2633         * testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2634         * testsuite/gdb_index_test_comm.sh: Likewise.
2635
2636 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2637
2638         * version.cc (print_version): Update copyright year to 2014.
2639
2640 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2641
2642         * stringpool.cc (Stringpool_template::reserve): Add
2643         HAVE_UNORDERED_MAP case.
2644         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2645
2646 2013-12-18  Cary Coutant  <ccoutant@google.com>
2647
2648         * configure.ac: Check for <unordered_set> and <unordered_map>.
2649         * config.in: Regenerate.
2650         * configure: Regenerate.
2651         * system.h: Use <unordered_set> and <unordered_map> if available.
2652
2653 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2654
2655         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2656         with $(INSTALL_PROGRAM_ENV).
2657         * Makefile.in: Regenerate.
2658
2659 2013-11-22  Cary Coutant  <ccoutant@google.com>
2660
2661         * configure.ac: Add check for which library is needed for
2662         dlopen.
2663         * configure: Regenerate.
2664
2665 2013-11-22  Cary Coutant  <ccoutant@google.com>
2666
2667         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2668         assembler.
2669         * testsuite/Makefile.in: Regenerate.
2670
2671 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2672
2673         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2674         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2675         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2676         (Target_x86_64<size>::Scan::local): Likewise.
2677         (Target_x86_64<size>::Scan::global): Likewise.
2678         (Target_x86_64<size>::Relocate::relocate): Likewise.
2679         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2680         Likewise.
2681         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2682         R_X86_64_PC32_BND.
2683
2684         * testsuite/Makefile.am (check_PROGRAMS): Add
2685         exception_x86_64_bnd_test.
2686         (exception_x86_64_bnd_test_SOURCES): New macro.
2687         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2688         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2689         (exception_x86_64_bnd_test_LDADD): Likewise.
2690         (exception_x86_64_bnd_1.o): New rule.
2691         (exception_x86_64_bnd_2.o): Likewise.
2692         * testsuite/Makefile.in: Regenerated.
2693
2694 2013-11-15  Alan Modra  <amodra@gmail.com>
2695
2696         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2697         accessor.
2698         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2699         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2700         symval_for_branch lookup to ELFv1.
2701         (Stub_table::add_plt_call_entry): Use unsigned int off.
2702         (Output_data_glink::Address, invalid_address): New.
2703         (Output_data_glink::add_eh_frame): Move out of line.  Add
2704         support for ELFv2.
2705         (Output_data_glink::add_global_entry, find_global_entry,
2706         global_entry_address): New functions.
2707         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2708         ge_size): New variables.
2709         (Output_data_glink::set_final_data_size): Add global entry
2710         stub sizing.
2711         (Output_data_glink::do_write): Write global entry stubs.
2712         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2713         parameter.  Return true for ELFv2.  Adjust callers.
2714         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2715         ELFv1.  Similarly for ifunc and dynamic relocation processing
2716         specific to ELFv1.  Recognize that symbols are defined on
2717         their plt entries for ELFv2.
2718         (Target_powerpc::symval_for_branch): Assert if called for
2719         ELFv2 or ppc32.
2720         (Target_powerpc::Relocate::relocate): Use global entry plt
2721         stub for symbol value if such exists on ELFv2.
2722         (Target_powerpc::Relocate::relocate): Don't call
2723         symval_for_branch when ELFv2.  Do adjust for local entry
2724         offset when ELFv2.
2725         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2726         plt stub for ELFv2.
2727         (Target_powerpc::do_plt_address_for_global): Similarly.
2728
2729 2013-11-14  Cary Coutant  <ccoutant@google.com>
2730
2731         Revert patch -- this did not fix the problem, and there is
2732         no race there.
2733
2734         2013-11-14  Cary Coutant  <ccoutant@google.com>
2735
2736             PR gold/14860
2737             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2738             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2739             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2740             updating fde_offsets_.
2741             (Eh_frame_hdr::lock_): New data member.
2742
2743 2013-11-14  Cary Coutant  <ccoutant@google.com>
2744
2745         * dwp.cc (Dwo_file_entry): New type.
2746         (File_list): Use Dwo_file_entry.
2747         (Dwo_file::verify): New function.
2748         (Dwo_file::verify_dwo_list): New function.
2749         (Dwo_file::sized_verify_dwo_list): New function.
2750         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2751         list.
2752         (Dwp_options): New enum type.
2753         (dwp_options): Add --verify-only.
2754         (usage): Likewise.
2755         (main): Likewise.
2756         * dwp.h (gold_info): Add declaration.
2757
2758 2013-11-14  Cary Coutant  <ccoutant@google.com>
2759
2760         PR gold/14860
2761         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2762         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2763         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2764         updating fde_offsets_.
2765         (Eh_frame_hdr::lock_): New data member.
2766
2767 2013-11-06  Cary Coutant  <ccoutant@google.com>
2768
2769         PR gold/15758
2770         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2771         before reloc sections.
2772
2773 2013-11-04  Alan Modra  <amodra@gmail.com>
2774
2775         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2776         (Symbol::needs_dynamic_reloc): Test new flag.
2777         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2778         (Target_powerpc::Scan::get_reference_flags): Add target param.
2779         Return FUNC_DESC_ABI for 64-bit ELFv1.
2780         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2781         call.
2782         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2783         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2784
2785 2013-10-31  Cary Coutant  <ccoutant@google.com>
2786
2787         Restore support for dwp v2 DWARF package file format.
2788
2789         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2790         tu_length parameter.  Adjust all callers.
2791         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2792         * dwp.cc: Include dwarf.h.
2793         (Section_bounds): New struct type.
2794         (Unit_set): New struct type.
2795         (Dwo_file::Dwo_file): Initialize new data member.
2796         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2797         Combine and rename to...
2798         (Dwo_file::read_unit_index): ...this.
2799         (Dwo_file::sized_read_compunit_index)
2800         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2801         (Dwo_file::sized_read_unit_index): ...this.
2802         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2803         parameters; add section_id parameter.
2804         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2805         (Dwo_file::add_unit_set): ...this.
2806         (Dwo_file::shndx_map_): Remove.
2807         (Dwo_file::sect_offsets_): New data member.
2808         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2809         (Dwp_output_file::add_section): Rename to...
2810         (Dwp_output_file::add_contribution): ...this.
2811         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2812         (Dwp_output_file::add_tu_set): Likewise.
2813         (Dwp_output_file::Contribution): New type.
2814         (Dwp_output_file::Section::contributions): New data member.
2815         (Dwp_output_file::Cu_or_tu_set): Remove.
2816         (Dwp_output_file::Section::Section): New ctor.
2817         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2818         (Dwp_output_file::Dwp_index::Section_table): New type.
2819         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2820         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2821         parameter.
2822         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2823         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2824         (Dwp_output_file::Dwp_index::section_table): New member function.
2825         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2826         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2827         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2828         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2829         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2830         (Dwp_output_file::Dwp_index::section_table_): New data member.
2831         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2832         (Dwp_output_file::add_output_section): New member function.
2833         (Dwp_output_file::write_new_section): New member function.
2834         (Dwp_output_file::write_contributions): New member function.
2835         (Dwp_output_file::section_id_map_): New data member.
2836         (class Dwo_id_info_reader): Remove.
2837         (class Unit_reader): New class.
2838         (get_dwarf_section_name): New function.
2839         (Dwo_file::read_executable): Adjust initializations of class data.
2840         (Dwo_file::read): Add support for v2 package file format.
2841         (Dwo_file::read_unit_index): Likewise.
2842         (Dwo_file::sized_read_unit_index): Likewise.
2843         (Dwo_file::copy_section): Likewise.
2844         (Dwo_file::add_unit_set): Likewise.
2845         (Dwp_output_file::add_output_section): Likewise.
2846         (Dwp_output_file::add_contribution): Likewise.
2847         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2848         for empty slot.
2849         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2850         file format.
2851         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2852         slot.
2853         (Dwp_output_file::initialize): Remove unused function.
2854         (Dwp_output_file::finalize): Add support for v2 package file format.
2855         (Dwp_output_file::write_index): Likewise.
2856         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2857         function prototype.
2858
2859 2013-10-31  Cary Coutant  <ccoutant@google.com>
2860
2861         * configure.ac: Fix check for -fmerge-constants.
2862         * configure.ac: Regenerate.
2863
2864 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2865
2866         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2867         Correct 9-byte nop sequence to match what the assembler generates.
2868
2869 2013-10-30  Alan Modra  <amodra@gmail.com>
2870
2871         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2872         ppc64_local_entry_offset, ppc64_local_entry_offset,
2873         do_read_symbols): New functions.
2874         (Powerpc_relobj::e_flags_, st_other_): New vars.
2875         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2876         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2877         (Powerpc_relobj::e_flags_): New var.
2878         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2879         and adjust for ELFv2.
2880         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2881         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2882         (Powerpc_dynobj::do_find_special_sections): Likewise.
2883         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2884         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2885         to ELFv2 local entry.
2886         (Target_powerpc::do_relax): No thread safe barriers needed for
2887         ELFv2.
2888         (Output_data_plt_powerpc::initial_plt_entry_size_,
2889         plt_entry_size): Delete.  Replace all uses with
2890         first_plt_entry_offset() and plt_entry_size().
2891         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2892         reserved_size parm.  Update callers.
2893         (Output_data_plt_powerpc::entry_count): Update.
2894         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2895         and use Target_powerpc::first_plt_entry_offset().
2896         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2897         rename to plt_entry_size.
2898         (Output_data_plt_powerpc::add_ifunc_entry,
2899         add_local_ifunc_entry): Adjust reloc for ELFv2.
2900         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2901         (glink_eh_frame_fde_64v2): New.
2902         (Stub_table::plt_call_size): Support ELFv2 sizing.
2903         (Output_data_glink::add_eh_frame): Use the new FDE.
2904         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2905         (Stub_table::do_write): Write ELFv2 stubs and glink.
2906         (Target_powerpc::Relocate::relocate): Replaces nop after call
2907         with ld 2,24(1) and adjust local offset destination for ELFv2.
2908
2909 2013-10-30  Alan Modra  <amodra@gmail.com>
2910
2911         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2912         (Target_powerpc::Scan::global, local): Likewise.
2913         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2914         on all ppc64 @h and @ha relocs.
2915
2916 2013-10-14  Alan Modra  <amodra@gmail.com>
2917
2918         * output.h (Output_data_got::add_constant): Tidy.
2919         (Output_data_got::add_constant_pair): New function.
2920         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2921         methods used so as to first call reserve_ent().
2922
2923 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2924
2925         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2926         add_got_entry and add_got_entry_pair.
2927
2928         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2929         (HAVE_PUBNAMES): Likewise.
2930         * configure: Regenerate.
2931
2932         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2933         * testsuite/Makefile.in: Regenerate.
2934
2935         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2936         Remove const from declaration.
2937         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2938         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2939         * output.h (Output_file_header): Remove const from member target_
2940         and corresponding constructor argument.
2941         * output.cc (Output_file_header::Output_file_header): Update prototype.
2942         (Output_file_header::do_sized_write): Use this->target_ in place
2943         of parameters()->target().
2944
2945         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2946
2947         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2948         * configure: Regenerate.
2949         * Makefile.in: Regenerate.
2950         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2951         * testsuite/merge_string_literals_2.c: Likewise.
2952         * testsuite/Makefile.am
2953         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2954         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2955         literal -fmerge-constants.
2956         * testsuite/Makefile.in: Regenerate.
2957
2958         * i386.cc (Target_i386): Remove unused member dynbss_.
2959         * arm.cc (Target_arm): Likewise.
2960         * powerpc.cc (Target_powerpc): Likewise.
2961         * sparc.cc (Target_sparc): Likewise.
2962         * tilegx.cc (Target_tilegx): Likewise.
2963         * x86_64.cc (Target_x86_64): Likewise.
2964         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2965         type_signature_, type_offset_.
2966         * plugin.h (Plugin_hook): Remove unused member layout_.
2967         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2968         mapfile_.
2969         (Read_member): Remove unused members input_objects_, symtab_,
2970         mapfile_, layout_.
2971         (Check_library): Remove unused member symtab_.
2972         * archive.h (Lib_group): Remove unused member lib_.
2973         * archive.cc (Lib_group::Lib_group): Update initializer.
2974         * incremental.h (Incremental_binary): Remove unused member target_.
2975         (Incremental_script_entry): Removed unused member script_.
2976         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2977         * icf.h (Icf): Remove unused member num_tracked_relocs.
2978
2979         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2980         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2981         its only use.
2982         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2983
2984         * archive.h: Use struct rather than class for forward declaration
2985         of Read_symbols_data.
2986
2987 2013-10-07  Cary Coutant  <ccoutant@google.com>
2988
2989         PR gold/16010
2990         * testsuite/Makefile.am (icf_test): Fix dependencies.
2991         (icf_safe_test): Likewise.
2992         (icf_safe_so_test): Likewise.
2993         (large_symbol_alignment): Add empty _LDADD rule.
2994         * testsuite/Makefile.in: Regenerate.
2995
2996 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2997
2998         PR gold/15927
2999         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
3000         relocation for R_X86_64_32 on x32.
3001
3002 2013-08-27  Roland McGrath  <mcgrathr@google.com>
3003
3004         * output.cc (Output_segment::set_section_addresses): Take new
3005         Target* argument.  If target->isolate_execinstr() and the segment
3006         is executable and starts at a target->abi_pagesize() boundary,
3007         pad its end out to a target->abi_pagesize() boundary with code fill.
3008         * output.h (Output_segment::set_section_addresses): Update decl.
3009         * layout.h (Layout::check_output_data_for_reset_values): Take new
3010         argument RELAX_OUTPUTS.
3011         (Layout): New member relax_output_list_.
3012         (Layout::add_relax_output): New method.
3013         * layout.cc (Layout::Layout): Update constructor.
3014         (Layout::reset_relax_output): New method.
3015         (Layout::clean_up_after_relaxation): Call it.
3016         (Layout::prepare_for_relaxation): Update caller.
3017         (Layout::set_segment_offsets): Update callers of set_section_addresses.
3018         Call reset_relax_output before re-processing segments for
3019         isolate_execinstr case.
3020         (Layout::write_data): Handle relax_output_list_.
3021         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
3022         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
3023
3024 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
3025
3026         PR binutils/15834
3027         * object.h: Fix typos.
3028
3029 2013-08-16  Roland McGrath  <mcgrathr@google.com>
3030
3031         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
3032         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
3033
3034 2013-08-07  Cary Coutant  <ccoutant@google.com>
3035
3036         Revert support for v2 DWP files:
3037
3038         2013-03-01  Cary Coutant  <ccoutant@google.com>
3039
3040             Add dwp support for v2 DWARF package file format.
3041             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3042             tu_length parameter.  Adjust all callers.
3043             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3044             * dwp.cc: Include dwarf.h.
3045             (Section_bounds): New struct type.
3046             (Unit_set): New struct type.
3047             (Dwo_file::Dwo_file): Initialize new data member.
3048             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3049             Combine and rename to...
3050             (Dwo_file::read_unit_index): ...this.
3051             (Dwo_file::sized_read_compunit_index)
3052             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3053             (Dwo_file::sized_read_unit_index): ...this.
3054             (Dwo_file::copy_section): Remove section_name, is_str_offsets
3055             parameters; add section_id parameter.
3056             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3057             (Dwo_file::add_unit_set): ...this.
3058             (Dwo_file::shndx_map_): Remove.
3059             (Dwo_file::sect_offsets_): New data member.
3060             (Dwp_output_file::Dwp_output_file): Initialize new data members.
3061             (Dwp_output_file::add_section): Rename to...
3062             (Dwp_output_file::add_contribution): ...this.
3063             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3064             (Dwp_output_file::add_tu_set): Likewise.
3065             (Dwp_output_file::Contribution): New type.
3066             (Dwp_output_file::Section::contributions): New data member.
3067             (Dwp_output_file::Cu_or_tu_set): Remove.
3068             (Dwp_output_file::Section::Section): New ctor.
3069             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3070             (Dwp_output_file::Dwp_index::Section_table): New type.
3071             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3072             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3073             parameter.
3074             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3075             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3076             (Dwp_output_file::Dwp_index::section_table): New member function.
3077             (Dwp_output_file::Dwp_index::section_table_end): New member function.
3078             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3079             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3080             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3081             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3082             (Dwp_output_file::Dwp_index::section_table_): New data member.
3083             (Dwp_output_file::Dwp_index::section_mask_): New data member.
3084             (Dwp_output_file::add_output_section): New member function.
3085             (Dwp_output_file::write_new_section): New member function.
3086             (Dwp_output_file::write_contributions): New member function.
3087             (Dwp_output_file::section_id_map_): New data member.
3088             (class Dwo_id_info_reader): Remove.
3089             (class Unit_reader): New class.
3090             (get_dwarf_section_name): New function.
3091             (Dwo_file::read_executable): Adjust initializations of class data.
3092             (Dwo_file::read): Add support for v2 package file format.
3093             (Dwo_file::read_unit_index): Likewise.
3094             (Dwo_file::sized_read_unit_index): Likewise.
3095             (Dwo_file::copy_section): Likewise.
3096             (Dwo_file::add_unit_set): Likewise.
3097             (Dwp_output_file::add_output_section): Likewise.
3098             (Dwp_output_file::add_contribution): Likewise.
3099             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3100             for empty slot.
3101             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3102             file format.
3103             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3104             slot.
3105             (Dwp_output_file::initialize): Remove unused function.
3106             (Dwp_output_file::finalize): Add support for v2 package file format.
3107             (Dwp_output_file::write_index): Likewise.
3108             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3109             function prototype.
3110
3111 2013-07-31  Cary Coutant  <ccoutant@google.com>
3112
3113         * object.cc (Sized_relobj::do_output_section_address): New function.
3114         (Sized_relobj): Instantiate explicitly.
3115         * object.h (Object::output_section_address): New function.
3116         (Object::do_output_section_address): New function.
3117         (Sized_relobj::do_output_section_address): New function.
3118         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
3119
3120 2013-07-30  Cary Coutant  <ccoutant@google.com>
3121             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
3122
3123         * parameters.cc (Parameters::entry): Return target-specific entry
3124         symbol name.
3125         * target.h (Target::entry_symbol_name): New function.
3126         (Target_info::entry_symbol_name): New data member.
3127
3128         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
3129         * i386.cc (Target_i386::i386_info): Likewise.
3130         (Target_i386_nacl::i386_nacl_info): Likewise.
3131         * sparc.cc (Target_sparc::sparc_info): Likewise.
3132         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
3133         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
3134         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
3135         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3136
3137 2013-07-22  Sterling Augustine  <saugustine@google.com>
3138
3139         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
3140         Convert parameter shndx to local variable. Add parameters symtab
3141         and symtab_size.  Scan over section names.  Find relocation
3142         section corresponding to current section.  Create and initialize
3143         reloc_mapper_ and reloc_type_.
3144         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
3145         unit_length to off_t.  Initialize member unit_length_.  Fill in field
3146         cu_offset_.
3147         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
3148         Initialize new fields unit_length_ and cu_offset_.
3149         (Dwarf_pubnames_table::read_section): Update prototype.
3150         (Dwarf_pubnames_table::cu_offset): New member function.
3151         (Dwarf_pubnames_table::subsection_size): Likewise.
3152         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
3153         New fields.
3154         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
3155         member functions public.
3156         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
3157         Update comment.  Rework logic.  Move repeated parts to...
3158         (Gdb_index_info_reader::read_pubtable): ...here. New function.
3159         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
3160         pubtypes_table_, and stmt_list_offset.
3161         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3162         Gdb_index::find_pubtype_offset,
3163         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
3164         (Gdb_index::pubnames_read): Update prototype and rework logic.
3165         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
3166         Forward declare.
3167         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3168         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
3169         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
3170         Gdb_index::map_pubtable_to_dies):
3171         Declare functions.
3172         (Gdb_index::pubnames_read): Update declaration.
3173         (Gdb_index::Pubname_offset_map): New type.
3174         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
3175         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
3176         Gdb_index::stmt_list_offset): Declare.
3177         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
3178         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
3179         Gdb_index::pubtypes_offset_): Remove.
3180
3181 2013-07-19  Roland McGrath  <mcgrathr@google.com>
3182
3183         * options.h (General_options): Add -Trodata-segment option.
3184         * parameters.cc (Parameters::check_rodata_segment): New function.
3185         (Parameters::set_target_once): Call it.
3186         * parameters.h (Parameters): Declare it (private member function).
3187         * layout.cc (load_seg_unusable_for_headers): New function, broken
3188         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
3189         then validate rodata segment rather than text segment.
3190         (relaxation_loop_body): Call that.
3191         (is_text_segment): New function.  Don't admit a non-executable
3192         segment if TARGET->isolate_execinstr().
3193         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
3194
3195 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
3196
3197         PR gold/15070
3198         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
3199         * nacl.h (Sniff_file::View::View): Request aligned view.
3200
3201 2013-07-11  Cary Coutant  <ccoutant@google.com>
3202
3203         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
3204         correct BRLT entry size.
3205
3206 2013-07-03  Alan Modra  <amodra@gmail.com>
3207
3208         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
3209         comment.
3210
3211 2013-07-01  Cary Coutant  <ccoutant@google.com>
3212
3213         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
3214         reloc_type_.
3215         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
3216         (Dwarf_ranges_table::lookup_reloc): New function.
3217         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
3218         reloc_type_.
3219         (Dwarf_ranges_table::lookup_reloc): New function.
3220         (Dwarf_ranges_table::reloc_type_): New data member.
3221
3222 2013-06-27  Jing Yu  <jingyu@google.com>
3223
3224         PR gold/15662
3225         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
3226         function.
3227         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
3228         (Target_powerpc::do_relax): Call the above.
3229
3230 2013-06-27  Cary Coutant  <ccoutant@google.com>
3231
3232         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3233         on garbage collected .opd section.
3234
3235 2013-06-27  Alan Modra  <amodra@gmail.com>
3236
3237         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3238         is non-zero.
3239         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3240         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3241
3242 2013-06-14  Cary Coutant  <ccoutant@google.com>
3243
3244         * resolve.cc (Symbol::override_base): Don't override st_type
3245         from plugin placeholder symbols.
3246         (Symbol_table::resolve): Likewise.
3247         (Symbol_table::should_override): Don't complain about TLS mismatch
3248         if the TO symbol is a plugin placeholder.
3249         * testsuite/Makefile.am (plugin_test_tls): New test.
3250         * testsuite/Makefile.in: Regenerate.
3251         * testsuite/plugin_test_tls.sh: New test script.
3252         * testsuite/two_file_test_2_tls.cc: New test source.
3253         * testsuite/two_file_test_tls.cc: New test source.
3254
3255 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3256
3257         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3258         the maximum segment alignment is larger than the page size.
3259         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3260         correctly aligns the symbols with large alignemnt.
3261         * testsuite/Makefile.in: Regenerate.
3262         * testsuite/large_symbol_alignment.cc: New file.
3263
3264 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3265             Sriraman Tallam  <tmsriram@google.com>
3266
3267         * options.h (sort_section): New option.
3268         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3269         Rename from Input_section_sort_section_name_special_ordering_compare.
3270         (Input_section_sort_section_name_compare): New struct.
3271         * output.cc (Output_section::Input_section_sort_section_name_compare::
3272         operator()): New function.
3273         (Output_section::sort_attached_input_sections): Use new sort function
3274         for .text if --sort-section=name is specified.
3275         * layout.cc (Layout::make_output_section):
3276         Add sorting by name when --sort-section=name is specified.
3277         * testsuite/Makefile.am (text_section_grouping): Test option
3278         --sort-section=name.
3279         * testsuite/Makefile.in: Regenerate.
3280         * testsuite/section_sorting_name.cc: New file.
3281         * testsuite/section_sorting_name.sh: New file.
3282
3283 2013-05-21  Cary Coutant  <ccoutant@google.com>
3284
3285         * symtab.h (Symbol::is_cxx_vtable): New function.
3286         * target-reloc.h (relocate_section): Check for vtable symbol.
3287         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3288         * testsuite/Makefile.in: Regenerate.
3289         * testsuite/missing_key_func.cc: New test source.
3290         * testsuite/missing_key_func.sh: New test script.
3291
3292 2013-05-21  Cary Coutant  <ccoutant@google.com>
3293
3294         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3295         type of enclosing symbol.
3296         (Relocate_info::location): Check symbol type when describing symbol.
3297         * object.h (Symbol_location_info): Remove unused line_number;
3298         add enclosing_symbol_type.
3299         * testsuite/debug_msg.sh: Adjust expected output.
3300
3301 2013-05-13  Cary Coutant  <ccoutant@google.com>
3302
3303         * configure.ac: Export DEFAULT_TARGET.
3304         * configure: Regenerate.
3305         * Makefile.in: Regenerate.
3306         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3307         * testsuite/Makefile.in: Regenerate.
3308         * testsuite/debug_msg.sh: Delete duplicate tests.
3309         Don't check undef_int error message match for powerpc where the
3310         source file and line number aren't available.
3311
3312 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3313
3314         * options.h (General_options): Add --rosegment-gap option.
3315         * options.cc (finalize): --rosegment-gap implies --rosegment.
3316         * layout.cc (set_segment_offsets): Let user option override
3317         target->rosegment_gap().
3318
3319 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3320
3321         * options.h (General_options): Remove leading space from help
3322         messages for -nostdlib and --rosegment.
3323
3324 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3325
3326         PR ld/15365
3327         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3328
3329 2013-05-03  Alan Modra  <amodra@gmail.com>
3330
3331         * merge.cc (Output_merge_string::do_add_input_section): Correct
3332         scan for number of strings.  Rename vars to avoid shadowing.
3333         Include missing terminator in input_size_.
3334
3335 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3336
3337         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3338         Restore empty string handling.
3339
3340 2013-05-01  Cary Coutant  <ccoutant@google.com>
3341
3342         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3343         uninitialized warning.
3344
3345 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3346
3347         * output.cc (Output_section::add_merge_input_section): Allow
3348         to merge sections if the alignment is more than character size.
3349         * merge.h (Output_merge_string::Output_merge_string): Remove
3350         assert.
3351         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3352         only not-null strings. Check the alignment of strings.
3353         * stringpool.h
3354         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3355         alignment as the argument.
3356         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3357         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3358         Align non-zero length strings according to the addralign_.
3359         (Stringpool_template<Stringpool_char>::set_string_offsets):
3360         Updating offsets according to the given alignment.
3361         * testsuite/Makefile.am (text_section_grouping): Test if string
3362         literals are getting merged.
3363         * testsuite/Makefile.in: Regenerate.
3364         * testsuite/merge_string_literals_1.c: New file.
3365         * testsuite/merge_string_literals_2.c: Ditto.
3366         * testsuite/merge_string_literals.sh: Ditto.
3367
3368 2013-04-26  Ian Lance Taylor  <iant@google.com>
3369
3370         * target-reloc.h (relocate_section): If the reloc offset is out of
3371         range, pass VIEW as NULL to relocate.relocate.
3372         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3373         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3374         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3375         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3376         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3377         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3378
3379 2013-04-26  Geoff Pike  <gpike@chromium.org>
3380
3381         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3382         * layout.cc (Hash_task): New class.
3383         (Layout::queue_build_id_tasks): New function.
3384         (Layout::write_build_id): Handle single-thread portion of build ID
3385         computation.  (In some cases, all of it is single-threaded.)  Replace
3386         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3387         functionality in fewer lines of code.
3388         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3389         * options.h (General_options): make "--build-id" default to tree
3390         rather than sha1.  Add two new options related to --build-id=tree:
3391         --build-id-chunk-size-for-treehash and
3392         --build-id-min-file-size-for-treehash.
3393         * Makefile.am: add testing of --build-id=tree and related new options
3394         (these tests will be invoked by "make check").
3395         * Makefile.in: Regenerate.
3396
3397 2013-04-25  Alan Modra  <amodra@gmail.com>
3398
3399         * configure.tgt: Add powerpcle and powerpc64le.
3400
3401 2013-04-22  Alan Modra  <amodra@gmail.com>
3402
3403         PR gold/15355
3404         * layout.cc (Layout::segment_precedes): Allow more than one
3405         segment with the same type and flags.
3406
3407 2013-04-15  Cary Coutant  <ccoutant@google.com>
3408
3409         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3410         allocate space in file for BSS sections.
3411
3412 2013-04-15  Cary Coutant  <ccoutant@google.com>
3413
3414         * script-sections.cc (Orphan_output_section): Reset address
3415         to zero after each orphaned section for relocatable links.
3416
3417 2013-04-15  Cary Coutant  <ccoutant@google.com>
3418
3419         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3420         section starting address for relocatable link.
3421         * testsuite/Makefile.am (script_test_11): New test.
3422         * testsuite/Makefile.in: Regenerate.
3423         * testsuite/script_test_11.c: New source file.
3424         * testsuite/script_test_11.t: New linker script.
3425
3426 2013-04-13  Alan Modra  <amodra@gmail.com>
3427
3428         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3429         owner when sections are not adjacent and exceed group size.
3430         (Target_powerpc::group_sections): Handle corner case.
3431         (Target_powerpc::Branch_info::make_stub): Handle case where
3432         stub table doesn't exist due to branches in non-exec sections.
3433         (Target_powerpc::Relocate::relocate): Likewise.
3434
3435 2013-04-11  Alan Modra  <amodra@gmail.com>
3436
3437         PR gold/15354
3438         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3439         .branch_lt to match bfd ld.  Adjust comments throughout file.
3440
3441 2013-04-04  Ian Lance Taylor  <iant@google.com>
3442
3443         GCC PR c++/56840
3444         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3445         sections before checking whether they are included in the link.
3446
3447 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3448
3449         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3450         object before calling the plugin claim_file handler.  Pass the elf
3451         object of the archive to the plugin. Delete the elf object if the
3452         plugin claims the file.
3453
3454 2013-03-21  Alan Modra  <amodra@gmail.com>
3455
3456         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3457         segment when omagic.
3458
3459 2013-03-21  Alan Modra  <amodra@gmail.com>
3460
3461         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3462         comparison warning.
3463         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3464         uninitialized" warning.
3465
3466 2013-03-20  Alan Modra  <amodra@gmail.com>
3467
3468         * symtab.h (Symbol::clear_version): New function.
3469         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3470         is_needed by weak references.  Clear version for symbols defined
3471         in as-needed objects that are not needed.
3472
3473 2013-03-15  Alan Modra  <amodra@gmail.com>
3474
3475         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3476         static and public.  Add report_err param.  Return false for data refs.
3477         (Target_powerpc::rela_dyn_section): New overloaded function.
3478         (Target_powerpc::plt_, iplt_): Elucidate.
3479         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3480         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3481         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3482         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3483         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3484         push_branch and make_plt_entry for ifunc syms when
3485         reloc_needs_plt_for_ifunc.
3486         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3487         for ifunc unless reloc_needs_plt_for_ifunc.
3488
3489 2013-03-15  Alan Modra  <amodra@gmail.com>
3490
3491         * gc.h (gc_process_relocs): Don't look through function descriptors.
3492         * icf.cc (get_section_contents): Do so here instead.
3493
3494 2013-03-13  Alan Modra  <amodra@gmail.com>
3495
3496         * powerpc.cc (is_branch_reloc): Forward declare.
3497         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3498         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3499         false for 64-bit, true for 32-bit non-branch relocs.
3500         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3501         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3502         nm output.
3503         (icf_safe_test): Generate linker map file as well as nm output.
3504         (icf_safe_so_test): Likewise.
3505         * testsuite/Makefile.in: Regenerate.
3506         * testsuite/icf_test.sh: Parse linker map file to determine
3507         section folding.
3508         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3509         * testsuite/icf_safe_so_test.sh: Likewise.
3510         (X86_32_or_ARM_specific_safe_fold): Merge into..
3511         (arch_specific_safe_fold): ..this.
3512         (X86_64_specific_safe_fold): Delete unused function.
3513
3514 2013-03-12  Alan Modra  <amodra@gmail.com>
3515
3516         * gc.h (gc_process_relocs): Look through function descriptors
3517         to determine shndx, symvalue and addend used by ICF.  Tidy
3518         variable duplication.
3519
3520 2013-03-11  Alan Modra  <amodra@gmail.com>
3521
3522         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3523         * layout.cc (Layout_task_runner::run): ..to here.
3524         * symtab.h (struct Symbol_location): Extract from..
3525         (class Symbol_table): ..here.
3526         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3527         * target.h (class Target): Add function_location and
3528         do_function_location functions.
3529         (class Sized_target): Add do_function_location.
3530         * object.h (class Sized_relobj_file): Move find_shdr..
3531         (class Object): ..to here.
3532         * object.cc: Likewise.  Update to suit.  Instantiate.
3533         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3534         * powerpc.cc (class Powerpc_dynobj): New.
3535         (Target_powerpc::do_function_location): New function.
3536         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3537         (Powerpc_dynobj::do_read_symbols): New function.
3538         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3539
3540 2013-03-08  Ian Lance Taylor  <iant@google.com>
3541
3542         * options.cc (General_options::string_to_object_format): Accept
3543         "default".
3544
3545 2013-03-08  Alan Modra  <amodra@gmail.com>
3546
3547         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3548         pointer to Post_fde.
3549         (struct Post_fde): Move definition to here..
3550         * ehframe.cc (struct Post_fde): ..from here.
3551         (Cie::write): Don't alloc Post_fde.
3552         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3553
3554 2013-03-07  Alan Modra  <amodra@gmail.com>
3555
3556         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3557         relocation referencing .LC0.
3558         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3559
3560 2013-03-07  Alan Modra  <amodra@gmail.com>
3561
3562         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3563         always_inline.  Add assembly for powerpc to avoid GOT.
3564
3565 2013-03-07  Alan Modra  <amodra@gmail.com>
3566
3567         * testsuite/script_test_10.sh: Don't test .bss section
3568         header number.
3569
3570 2013-03-06  Alan Modra  <amodra@gmail.com>
3571
3572         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3573         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3574         all callers.  Handle folded sections.
3575         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3576         to Powerpc_relobj.
3577         (Global_symbol_visitor_opd::operator()): Likewise.
3578
3579 2013-03-04  Alan Modra  <amodra@gmail.com>
3580
3581         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3582         * testsuite/Makefile.in: Regenerate.
3583
3584 2013-03-01  Cary Coutant  <ccoutant@google.com>
3585
3586         Add dwp support for v2 DWARF package file format.
3587         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3588         tu_length parameter.  Adjust all callers.
3589         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3590         * dwp.cc: Include dwarf.h.
3591         (Section_bounds): New struct type.
3592         (Unit_set): New struct type.
3593         (Dwo_file::Dwo_file): Initialize new data member.
3594         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3595         Combine and rename to...
3596         (Dwo_file::read_unit_index): ...this.
3597         (Dwo_file::sized_read_compunit_index)
3598         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3599         (Dwo_file::sized_read_unit_index): ...this.
3600         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3601         parameters; add section_id parameter.
3602         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3603         (Dwo_file::add_unit_set): ...this.
3604         (Dwo_file::shndx_map_): Remove.
3605         (Dwo_file::sect_offsets_): New data member.
3606         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3607         (Dwp_output_file::add_section): Rename to...
3608         (Dwp_output_file::add_contribution): ...this.
3609         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3610         (Dwp_output_file::add_tu_set): Likewise.
3611         (Dwp_output_file::Contribution): New type.
3612         (Dwp_output_file::Section::contributions): New data member.
3613         (Dwp_output_file::Cu_or_tu_set): Remove.
3614         (Dwp_output_file::Section::Section): New ctor.
3615         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3616         (Dwp_output_file::Dwp_index::Section_table): New type.
3617         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3618         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3619         parameter.
3620         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3621         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3622         (Dwp_output_file::Dwp_index::section_table): New member function.
3623         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3624         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3625         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3626         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3627         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3628         (Dwp_output_file::Dwp_index::section_table_): New data member.
3629         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3630         (Dwp_output_file::add_output_section): New member function.
3631         (Dwp_output_file::write_new_section): New member function.
3632         (Dwp_output_file::write_contributions): New member function.
3633         (Dwp_output_file::section_id_map_): New data member.
3634         (class Dwo_id_info_reader): Remove.
3635         (class Unit_reader): New class.
3636         (get_dwarf_section_name): New function.
3637         (Dwo_file::read_executable): Adjust initializations of class data.
3638         (Dwo_file::read): Add support for v2 package file format.
3639         (Dwo_file::read_unit_index): Likewise.
3640         (Dwo_file::sized_read_unit_index): Likewise.
3641         (Dwo_file::copy_section): Likewise.
3642         (Dwo_file::add_unit_set): Likewise.
3643         (Dwp_output_file::add_output_section): Likewise.
3644         (Dwp_output_file::add_contribution): Likewise.
3645         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3646         for empty slot.
3647         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3648         file format.
3649         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3650         slot.
3651         (Dwp_output_file::initialize): Remove unused function.
3652         (Dwp_output_file::finalize): Add support for v2 package file format.
3653         (Dwp_output_file::write_index): Likewise.
3654         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3655         function prototype.
3656
3657 2013-03-01  Cary Coutant  <ccoutant@google.com>
3658
3659         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3660         function into class definition in header file.
3661         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3662         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3663         New function.
3664         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3665
3666 2013-02-28  Alan Modra  <amodra@gmail.com>
3667
3668         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3669         * target.cc (Target::do_plt_fde_location): New function.
3670         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3671         accessor function, and constructor param.
3672         (struct Post_fde, Post_fdes): Declare.
3673         (Cie::write): Add post_fdes param.
3674         * ehframe.cc (Fde::write): Use plt_fde_location.
3675         (struct Post_fde): Define.
3676         (Cie::write): Stash FDEs added post merge mapping.
3677         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3678         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3679         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3680         other FDEs.
3681         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3682         (Target_powerpc::has_glink): New function.
3683         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3684         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3685         glink_eh_frame_fde_32, default_fde): New data.
3686         (Stub_table::eh_frame_added_): New var.
3687         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3688         Make const.
3689         (Stub_table::add_eh_frame): New function.
3690         (Output_data_glink::add_eh_frame): New function.
3691         (Target_powerpc::make_glink_section): Call add_eh_frame.
3692
3693 2013-02-15  Ian Lance Taylor  <iant@google.com>
3694
3695         * options.h (DEFINE_uint64_alias): Define.
3696         (class General_options): Add -Ttext-segment as an alias for
3697         -Ttext.
3698
3699 2013-02-15  Alan Modra  <amodra@gmail.com>
3700
3701         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3702         (Stub_table::do_write): ..here, two places.
3703         (Stub_table::plt_call_size): Use it here too.
3704
3705 2013-02-11  Ian Lance Taylor  <iant@google.com>
3706
3707         * descriptors.cc (Descriptors::close_all): New function.
3708         * descriptors.h (class Descriptors): Declare close_all.
3709         (close_all_descriptors): New inline function.
3710         * plugin.cc: Include "descriptors.h".
3711         (Plugin_manager::cleanup): Call close_all_descriptors.
3712
3713 2013-02-06  Alan Modra  <amodra@gmail.com>
3714
3715         * README: Update coding style link.
3716
3717 2013-01-28  Cary Coutant  <ccoutant@google.com>
3718
3719         * dwp.cc (File_list): New typedef.
3720         (Dwo_name_info_reader): New class.
3721         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3722         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3723         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3724         (Dwo_file::read_executable): New function.
3725         (Dwo_file::read): Move common setup code to ...
3726         (Dwo_file::make_object): ... here.
3727         (dwp_options): Add --exec/-e.
3728         (usage): Likewise.
3729         (main): Likewise.
3730
3731 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3732
3733         * layout.cc (Layout::layout): Check for option text_reorder.
3734         (Layout::make_output_section): Ditto.
3735         * options.h (text_reorder): New option.
3736         * output.cc (Input_section_sort_compare): Remove special ordering
3737         of section names.
3738         (Output_section::
3739          Input_section_sort_section_name_special_ordering_compare::
3740          operator()): New function.
3741         (Output_section::sort_attached_input_sections): Use new sort function
3742         for .text.
3743         * output.h (Input_section_sort_section_name_special_ordering_compare):
3744         New struct.
3745         * testsuite/Makefile.am (text_section_grouping): Test option
3746         --no-text-reorder
3747         * testsuite/Makefile.in: Regenerate.
3748         * testsuite/text_section_grouping.sh: Check order of functions without
3749         default text reordering.
3750
3751 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3752
3753         * options.h (General_options): Change default to true for new_dtags.
3754
3755 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3756
3757         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3758         when enable_new_dtags is false.  Only add DT_RUNPATH when
3759         enable_new_dtags is true.
3760
3761 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3762
3763         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3764         used in declaration and definition consistent.
3765         (Target_powerpc::symval_for_branch): Ditto.
3766
3767 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3768
3769         * testsuite/plugin_final_layout.cc: Fix comment.
3770
3771 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3772
3773         * layout.cc (Layout::layout): Do not do default sorting for
3774         text sections when section ordering is specified.
3775         (make_output_section): Ditto.
3776         * testsuite/plugin_final_layout.cc: Name the function sections
3777         to catch reordering issues.
3778
3779 2013-01-15  Alan Modra  <amodra@gmail.com>
3780
3781         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3782         plt-thread-safe.
3783
3784 2013-01-15  Alan Modra  <amodra@gmail.com>
3785
3786         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3787         * testsuite/Makefile.in: Regenerate.
3788
3789 2013-01-14  Alan Modra  <amodra@gmail.com>
3790
3791         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3792         * testsuite/Makefile.in: Regenerate.
3793
3794 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3795
3796         PR bfd/14430
3797         Fix mingw gold build with plugins enabled
3798         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3799         * configure.ac: Export DLOPEN_LIBS and add headers check.
3800         * plugin.cc: Handle non-dlfcn case.
3801         * Makefile.in: Regenerate.
3802         * config.in: Regenerate.
3803         * configure: Regenerate.
3804         * testsuite/Makefile.in: Regenerate.
3805
3806 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3807
3808         * output.h (sort_attached_input_sections): Change to be public.
3809         * script-sections.cc
3810         (Output_section_definition::set_section_addresses): Sort
3811         attached input sections according to section order before linker
3812         script assigns section addresses.
3813         (Orphan_output_section::set_section_addresses): Sort
3814         attached input sections according to section order before linker
3815         script assigns section addresses.
3816         * Makefile.am (final_layout.sh): Use a simple linker script to
3817         check if section ordering still works.
3818         * Makefile.in: Regenerate.
3819
3820 2013-01-09  Ben Cheng  <bccheng@google.com>
3821
3822         * arm.cc (Target_arm::attributes_accept_div): New function.
3823         (Target_arm::attributes_forbid_div): New function.
3824         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3825         attribute using the same new functions as what bfd/elf32_arm.c
3826         does.
3827
3828 2013-01-07  Cary Coutant  <ccoutant@google.com>
3829
3830         PR gold/14993
3831         * output.cc (Output_section::add_input_section): For incremental
3832         updates, don't track input sections that are allocated from patch
3833         space.
3834
3835 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3836             Ian Lance Taylor  <iant@google.com>
3837
3838         PR gold/14897
3839         * configure.ac (--enable-ld): Removed.
3840         (install_as_default): Set to yes only for --enable-gold=default
3841         or --disable-ld.
3842         * configure: Regenerated.
3843
3844 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3845
3846         * options.h (General_options): Add -fuse-ld= for GCC linker
3847         option compatibility.
3848
3849 2013-01-04  Cary Coutant  <ccoutant@google.com>
3850
3851         * configure.ac: Fix typo restoring CXXFLAGS.
3852         * configure: Regenerate.
3853
3854 2013-01-04  Cary Coutant  <ccoutant@google.com>
3855
3856         * testsuite/Makefile.am (CXXLINK_S): New macro.
3857         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3858         * testsuite/Makefile.in: Regenerate.
3859
3860 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3861
3862         * version.cc (print_version): Update copyright year to 2013.
3863
3864 2012-12-20  Ian Lance Taylor  <iant@google.com>
3865
3866         * layout.cc (Layout::special_ordering_of_input_section): New
3867         function.
3868         (Layout::layout): If input section requires special ordering, must
3869         sort input sections.
3870         (Layout::make_output_section): May sort .text input sections.
3871         (Layout::is_section_name_prefix_grouped): Remove.
3872         * layout.h (class Layout): Declare
3873         special_ordering_of_input_section.  Don't declare
3874         is_section_name_prefix_grouped.
3875         * output.cc (Output_section::add_input_section): Revert last
3876         change.
3877         (Output_section::Input_section_sort::match_file_name): Don't crash
3878         if called on output section data.
3879         (Output_section::Input_section_sort_compare): Sort based on
3880         special ordering.
3881         (Output_section::Input_section_sort_section_order_index_compare):
3882         Revert last patch.
3883         (Output_section::sort_attached_input_sections): Likewise.
3884
3885 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3886
3887         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3888         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3889         * output.cc (Output_section::add_input_section): Check if section
3890         name contains special prefix.  Keep input sections to sort such
3891         sections.
3892         (Output_section::Input_section_sort_section_order_index_compare
3893          ::operator()): Group sections according to prefixes.
3894         (Output_section::sort_attached_input_sections): Add condition to
3895         Input_section_entry constructor call.
3896         * testsuite/Makefile.am (text_section_grouping): New test.
3897         * testsuite/Makefile.in: Regenerate.
3898         * testsuite/text_section_grouping.cc: New file.
3899         * testsuite/text_section_grouping.sh: New file.
3900
3901 2012-12-17  Nick Clifton  <nickc@redhat.com>
3902
3903         * Makefile.am: Add copyright notice.
3904         * NEWS: Likewise.
3905         * README: Likewise.
3906         * configure.ac: Likewise.
3907         * ftruncate.c: Likewise.
3908         * Makefile.in: Regenerate.
3909
3910 2012-12-14  Cary Coutant  <ccoutant@google.com>
3911
3912         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3913         --no-as-needed flag.
3914         (exception_separate_shared_12_test): Likewise.
3915         (incremental_copy_test): Likewise.
3916         * testsuite/Makefile.in: Regenerate.
3917
3918 2012-12-14  Cary Coutant  <ccoutant@google.com>
3919
3920         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3921         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3922
3923 2012-12-12  Alan Modra  <amodra@gmail.com>
3924
3925         * powerpc.cc (class Track_tls): New.
3926         (class Relocate, class Scan): Inherit Track_tls.
3927         (Target_powerpc::Scan::local, global): Track tls optimization
3928         and avoid creating plt entry for __tls_get_addr if all uses
3929         are optimized away.
3930         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3931
3932 2012-12-12  Alan Modra  <amodra@gmail.com>
3933
3934         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3935         Replace no_toc_optimize with toc_optimize.
3936         * output.h (Output_section::input_sections): Provide non-const variant.
3937         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3938         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3939         accessors.
3940         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3941         (class Sort_toc_sections): New.
3942         (Target_powerpc::do_finalize_sections): Sort toc sections.
3943         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3944
3945 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3946
3947         * testsuite/binary_unittest.cc (read_all): New function.
3948         (Sized_binary_test): Use it instead of ::read.
3949         * fileread.cc (do_read): Don't assume pread always reads the whole
3950         amount in a single call.
3951
3952 2012-12-10  Alan Modra  <amodra@gmail.com>
3953
3954         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3955         Set EM_PPC64 or EM_PPC here.
3956         (Target_selector_powerpc::do_recognize): Delete.
3957
3958 2012-12-10  Alan Modra  <amodra@gmail.com>
3959
3960         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3961         stub_table_.
3962         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3963
3964 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3965
3966         * testsuite/binary_unittest.cc (Sized_binary_test):
3967         Use open_descriptor rather than ::open.
3968
3969 2012-12-07  Alan Modra  <amodra@gmail.com>
3970
3971         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3972         typedef and invalid_address constant.
3973         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3974         instantiate constants.
3975
3976 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3977
3978         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3979         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3980         * aclocal.m4: Regenerate.
3981         * configure: Regenerate.
3982         * Makefile.in: Regenerate.
3983         * testsuite/Makefile.in: Regenerate.
3984
3985 2012-12-07  Alan Modra  <amodra@gmail.com>
3986
3987         * options.h (General_options): Add no_toc_optimize.
3988         * powerpc.cc (ok_lo_toc_insn): New function.
3989         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3990
3991 2012-12-06  Alan Modra  <amodra@gmail.com>
3992
3993         * options.h (General_options): Add plt_align, plt_static_chain,
3994         plt_thread_safe.  Update stub_group_size help text.
3995         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3996         for new plt_thread_safe_ var.
3997         (use_plt_offset): Correct comments.
3998         (Target_powerpc::do_relax): Look for thread creation symbols to
3999         determine default plt_thread_safe value.  Clear plt call stubs
4000         as well as branch stubs each iteration.
4001         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
4002         insn constants.
4003         (l, hi, ha, write_insn): Move earlier.
4004         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
4005         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
4006         plt stubs too.
4007         (Stub_table::update_size): Adjust.
4008         (Stub_table::prev_size, set_prev_size): Delete.
4009         (Stub_table::stub_align): Let --plt-align affect result.
4010         (Stub_table::plt_call_size): Calculate sizes for various stubs.
4011         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
4012         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
4013         (Stub_table::do_write): Support more stub variants.
4014
4015 2012-12-04  Alan Modra  <amodra@gmail.com>
4016
4017         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
4018         (Target_powerpc::do_define_standard_symbols): New function.
4019
4020 2012-12-03  Alan Modra  <amodra@gmail.com>
4021
4022         * output.h: Formatting, whitespace.
4023
4024 2012-12-03  Alan Modra  <amodra@gmail.com>
4025
4026         * layout.h (Layout::get_executable_sections): Declare.
4027         * layout.cc (Layout::get_executable_sections): New function.
4028         * arm.cc (Target_arm::group_sections): Use it.
4029         (Arm_output_section::group_sections): Delete now redundant test.
4030         * output.cc (Output_reloc::Output_reloc): Add is_relative.
4031         param to handle relative relocs.
4032         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
4033         (Output_data_reloc::add_absolute): Adjust.
4034         (Output_data_reloc::add_relative): New function.
4035         (Output_data::reset_data_size): New function.
4036         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
4037         (Output_section::set_addralign): New function.
4038         (Output_section::checkpoint_set_addralign): New function.
4039         (Output_section::clear_section_offsets_need_adjustment): New function.
4040         (Output_section::input_sections): Make public.
4041         * powerpc.cc (class Output_data_brlt_powerpc): New.
4042         (class Stub_table, class Stub_control): New.
4043         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
4044         stub_table_, set_stub_table, stub_table): New vectors and accessor
4045         functions.
4046         (Target_powerpc::do_may_relax, do_relax, push_branch,
4047         new_stub_table, stub_tables, brlt_section, group_sections,
4048         add_branch_lookup_table, find_branch_lookup_table,
4049         write_branch_lookup_table, make_brlt_section): New functions.
4050         (Target_powerpc::struct Sort_sections, class Branch_info): New.
4051         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
4052         branch_info_): New vars.
4053         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
4054         make call stubs here.
4055         (Output_data_glink): Remove all call stub handling from this class.
4056         (Target_powerpc::Scan::local, global): Save interesting branch
4057         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
4058         (Target_powerpc::do_finalize_sections): Only make reg save/restore
4059         functions on final link.
4060         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
4061         Handle long branch destinations too.
4062         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
4063         do_plt_address_for_local): Adjust lookup of plt call stubs.
4064
4065 2012-11-30  Alan Modra  <amodra@gmail.com>
4066
4067         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
4068         relocs against protected symbols when building 32-bit shared libs.
4069
4070 2012-11-30  Alan Modra  <amodra@gmail.com>
4071
4072         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
4073         param.  Call got_section() to make .got.  Update all callers
4074         and their callers and so on.
4075
4076 2012-11-30  Alan Modra  <amodra@gmail.com>
4077
4078         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
4079         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
4080         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
4081         value if it already exists.
4082
4083 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
4084
4085         PR gold/14858
4086         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
4087
4088 2012-11-14  Roland McGrath  <mcgrathr@google.com>
4089
4090         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
4091         than bfc instruction for data sandboxing.
4092
4093 2012-11-08  Alan Modra  <amodra@gmail.com>
4094
4095         * po/POTFILES.in: Regenerate.
4096
4097 2012-11-05  Alan Modra  <amodra@gmail.com>
4098
4099         * configure.ac: Apply 2012-09-10 change to config.in here.
4100         * configure: Regenerate.
4101
4102 2012-11-05  Alan Modra  <amodra@gmail.com>
4103
4104         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
4105         (struct Opd_ent): Use "Address" rather than "Offset".
4106         (Output_data_got_powerpc::got_base_offset): Return Valtype.
4107         (Target_powerpc::got_section): Make public.
4108         (Target_powerpc::scan_relocs): Move code setting symbols..
4109         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
4110         Create _SDA_BASE_ only when referenced.
4111
4112 2012-11-02  Roland McGrath  <mcgrathr@google.com>
4113
4114         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
4115         from last change.
4116
4117 2012-11-01  Roland McGrath  <mcgrathr@google.com>
4118
4119         * target.h (Sized_target::relocate_relocs): Use Elf_Off
4120         for offset_in_output_section parameter.
4121         (Sized_target::relocate_special_relocatable): Likewise.
4122         * arm.cc (Target_arm::relocate_relocs): Likewise.
4123         (Target_arm::relocate_special_relocatable): Likewise.
4124         * i386.cc (Target_i386::relocate_relocs): Likewise.
4125         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
4126         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
4127         * target-reloc.h (relocate_relocs): Likewise.
4128         * testsuite/testfile.cc (Target_test): Likewise.
4129         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
4130         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
4131
4132         * system.h: Move inclusion of <clocale> to after <libintl.h> in
4133         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
4134
4135         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
4136         parameter, which is unused in the [!F_SETFD] case.
4137
4138         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
4139         SYMNDX to off_t before comparing it to this->data_size().
4140         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
4141         * incremental.cc (Output_section_incremental_inputs::do_write):
4142         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
4143
4144         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
4145
4146 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
4147
4148         * gold.cc (Target_arm::do_adjust_elf_header): Add the
4149         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
4150         in EABI_VER5.
4151
4152 2012-10-29  Cary Coutant  <ccoutant@google.com>
4153
4154         * dwp.cc (usage): Add file and exit status parameters;
4155         add --help and --version options.
4156         (print_version): New function.
4157         (main): Add --help and --version options.
4158
4159 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4160
4161         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
4162         final_layout_sequence.txt.
4163         * testsuite/Makefile.in: Regenerated.
4164
4165 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4166
4167         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
4168         COMPILE generated by automake.
4169         (LINK1): Likewise.
4170         (CXXCOMPILE1): Likewise.
4171         (CXXLINK1): Likewise.
4172         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
4173         (LINK): Likewise.
4174         (CXXCOMPILE): Likewise.
4175         (CXXLINK): Likewise.
4176         * testsuite/Makefile.in: Regenerated.
4177
4178 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4179
4180         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
4181         on bad fwrite return.
4182
4183 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4184
4185         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
4186         on val.
4187
4188 2012-10-23  Cary Coutant  <ccoutant@google.com>
4189
4190         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
4191         * testsuite/Makefile.in: Regenerate.
4192         * testsuite/dwp_test.h: New source file.
4193         * testsuite/dwp_test_1.cc: New source file.
4194         * testsuite/dwp_test_1.s: New source file.
4195         * testsuite/dwp_test_1.sh: New source file.
4196         * testsuite/dwp_test_1b.cc: New source file.
4197         * testsuite/dwp_test_1b.s: New source file.
4198         * testsuite/dwp_test_2.cc: New source file.
4199         * testsuite/dwp_test_2.s: New source file.
4200         * testsuite/dwp_test_2.sh: New source file.
4201         * testsuite/dwp_test_main.cc: New source file.
4202         * testsuite/dwp_test_main.s: New source file.
4203
4204 2012-10-23  Cary Coutant  <ccoutant@google.com>
4205
4206         * dwp.h: New header file.
4207         * dwp.cc: New source file.
4208         * gold.h: Move shared declarations to system.h.
4209         * system.h: New header file.
4210         * Makefile.am: Add dwp.
4211         * Makefile.in: Regenerate.
4212
4213 2012-10-23  Cary Coutant  <ccoutant@google.com>
4214
4215         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
4216         Dwarf_info_reader::read_from_pointer.
4217         (Dwarf_pubnames_table::read_header): Likewise.
4218         (Dwarf_pubnames_table::next_name): Likewise.
4219         (Dwarf_die::read_attributes): Likewise.
4220         (Dwarf_die::skip_attributes): Likewise.
4221         (Dwarf_info_reader::read_from_pointer): New function template.
4222         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
4223         (Dwarf_pubnames_table): Likewise.
4224         (Dwarf_info_reader::read_from_pointer): New function template.
4225         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
4226         Dwarf_pubnames_table ctor.
4227
4228 2012-10-23  Cary Coutant  <ccoutant@google.com>
4229
4230         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4231         abbrev_shndx.
4232         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4233         abbrev_shndx_.
4234         (Dwarf_info_reader::set_abbrev_shndx): New method.
4235         (Dwarf_info_reader::abbrev_shndx_): New data member.
4236
4237 2012-10-23  Cary Coutant  <ccoutant@google.com>
4238
4239         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4240         from object, not parameters.
4241         (Dwarf_info_reader::parse): Likewise.
4242         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4243         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4244         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4245         methods.
4246
4247 2012-10-23  Cary Coutant  <ccoutant@google.com>
4248
4249         * fileread.cc (Input_file::Input_file): New constructor.
4250         * fileread.h (class Input_file): Add new constructor.
4251
4252 2012-10-18  Alan Modra  <amodra@gmail.com>
4253
4254         PR gold/14727
4255         * object.cc (Relobj::is_section_name_included): Also match
4256         .sdata personality section.
4257
4258 2012-10-18  Alan Modra  <amodra@gmail.com>
4259
4260         * target-reloc.h (class Default_comdat_behavior): New, package up..
4261         (get_comdat_behaviour): ..this.
4262         (relocate_section): Add Relocate_comdat_behavior template arg,
4263         adjust code to suit.
4264         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4265         (Target_arm::scan_reloc_section): Likewise.
4266         * i386.cc (Target_i386::relocate_section): Likewise.
4267         * sparc.cc (Target_sparc::relocate_section): Likewise.
4268         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4269         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4270         * powerpc.cc (class Relocate_comdat_behavior): New.
4271         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4272         gold::relocate_section with new template arg.
4273
4274 2012-10-18  Alan Modra  <amodra@gmail.com>
4275
4276         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4277         dynamic relocs for GOT_TPREL got entries, without symbol if
4278         resolving locally.
4279         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4280         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4281         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4282
4283 2012-10-17  Alan Modra  <amodra@gmail.com>
4284
4285         PR gold/14726
4286         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4287
4288 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4289
4290         * layout.cc (Layout::include_section): Keep sections marked
4291         SHF_EXCLUDE when doing relocatable links.
4292
4293 2012-10-16  Alan Modra  <amodra@gmail.com>
4294
4295         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4296         (Target_powerpc::do_finalize_sections): Call it.
4297         (Output_data_save_res): New class and supporting functions.
4298         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4299         normal symbols defined in object files.
4300
4301 2012-10-12  Alan Modra  <amodra@gmail.com>
4302
4303         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4304         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4305         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4306         section if scan_opd_relocs not yet called.
4307         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4308
4309 2012-10-12  Alan Modra  <amodra@gmail.com>
4310
4311         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4312         add_local_ifunc_entry): Revert last change.
4313         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4314
4315 2012-10-05  Alan Modra  <amodra@gmail.com>
4316
4317         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4318         do_plt_address_for_global): New functions.
4319         (Output_data_got_powerpc::do_write): Don't segfault when linking
4320         statically.
4321         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4322         add_local_ifunc_entry): Return true on adding entry..
4323         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4324         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4325         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4326         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4327         set up symbols here.
4328         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4329         syms here.  Do so even when no .iplt.  Don't segfault when linking
4330         statically.
4331         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4332         new variants without reloc param.
4333         (Glink_sym_ent::Glink_sym_ent): Likewise.
4334         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4335         reloc when refs will resolve to plt call stub.
4336         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4337         R_PPC_PLTREL24 to resolve locally.
4338         (Target_powerpc::Scan::global): Correct ifunc handling.
4339         (Target_powerpc::Relocate::relocate): Correct local sym glink
4340         lookup.  Don't destroy "value" when we have a plt call stub,
4341         and when checking plt call validity.
4342         (Target_powerpc::do_dynsym_value): Simplify.
4343
4344 2012-10-05  Alan Modra  <amodra@gmail.com>
4345
4346         * i386.cc (Output_data_plt_i386::address_for_global,
4347         address_for_local): Add plt offset to returned value.  Adjust uses.
4348         * sparc.cc (Output_data_plt_sparc::address_for_global,
4349         address_for_local): Likewise.
4350         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4351         address_for_local): Likewise.
4352         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4353         address_for_local): Likewise.
4354         * target.h (Target::plt_address_for_global, plt_address_for_local):
4355         Update comment.
4356         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4357         (Output_data_got::Got_entry::write): Nor here.
4358         * output.h: Comment fix.
4359
4360 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4361
4362         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4363         global_offset_table_ value for larget got.
4364         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4365
4366 2012-09-29  Alan Modra  <amodra@gmail.com>
4367
4368         * powerpc.cc (Target_powerpc::iplt_): New output section.
4369         (Target_powerpc::iplt_section, make_iplt_section,
4370         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4371         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4372         Target_powerpc::plt_entry_count): Count iplt entries too.
4373         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4374         reloc section in constructor.  New params.
4375         (Target_powerpc::make_plt_section): Create reloc section here instead.
4376         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4377         functions.
4378         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4379         (Output_data_glink::add_entry, find_entry): New functions to
4380         deal with local syms.
4381         (Glink_sym_ent): Add support for local syms.
4382         (Output_data_glink::do_write): Handle ifunc plt entries.
4383         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4384         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4385         (Target_powerpc::Relocate::relocate): Likewise.
4386         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4387
4388 2012-09-25  Alan Modra  <amodra@gmail.com>
4389
4390         * object.h (Sized_relobj_file::adjust_local_symbol,
4391         do_adjust_local_symbol): New functions.
4392         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4393         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4394         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4395         and irregular opd entry spacing.
4396         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4397         (Global_symbol_visitor_opd): New functor.
4398         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4399         on deleted opd entries.
4400
4401 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4402
4403         * tilegx.cc: New file.
4404         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4405         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4406         * configure.tgt: Add entries for tilegx*.
4407         * configure.ac: Likewise.
4408         * Makefile.in: Rebuild.
4409         * configure: Likewise.
4410         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4411         tilegx.
4412
4413 2012-09-13  Alan Modra  <amodra@gmail.com>
4414
4415         * target-reloc.h (scan_relocs): Call scan.local for relocs
4416         against symbols in discarded sections.  Pass is_discarded
4417         param.
4418         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4419         Add is_discarded param.
4420         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4421         is_discarded to flag opd entry as discarded.  Don't emit dyn
4422         relocs on such entries.
4423         (Target_powerpc::Scan::global): Similarly detect and handle
4424         such opd entries.
4425         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4426         opd_ent_.  Update all uses.
4427         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4428         (Target_powerpc::relocate_section): Zero out discarded opd
4429         entry relocs.
4430
4431 2012-09-12  Ian Lance Taylor  <iant@google.com>
4432
4433         PR gold/14570
4434         * output.cc: Rename Output_data_got template parameter from size
4435         to got_size for all functions.  Compile all variants of
4436         Output_data_got.
4437         (Output_data_got::Got_entry::write): Correct use of size for
4438         symbol value.  Use local_is_tls rather than casting to
4439         Sized_relobj_file.
4440         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4441         (class Sized_relobj_file): Add do_local_is_tls.
4442         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4443
4444 2012-09-11  Alan Modra  <amodra@gmail.com>
4445
4446         PR gold/14566
4447         * layout.cc (Layout::set_segment_offsets): When using
4448         common-page-size alignment, ensure we are on a new max-page-size
4449         page.
4450         * output.cc (Output_segment::set_section_addresses): Use
4451         abi_pagesize, not common_pagesize for relro boundary.
4452         (Output_segment::set_offset): Likewise.
4453
4454 2012-09-11  Alan Modra  <amodra@gmail.com>
4455
4456         * output.h (Output_data_got::add_global_tls, add_local_tls,
4457         add_local_tls_pair): New functions.
4458         (Output_data_got::add_local_pair_with_rel): Remove second
4459         reloc param.  Expand comment.
4460         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4461         use_plt_or_tls_offset_, similarly for constructor param.
4462         (Output_data_got::Got_entry::write): Add got_index param.
4463         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4464         add_local_tls_pair): New functions.
4465         (Output_data_got::Got_entry::write): Handle tls symbols
4466         with use_plt_or_tls_offset_ set specially.
4467         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4468         (Output_data_got::do_write): Replace iterator with index, pass
4469         index to entry write function.
4470         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4471         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4472         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4473         call.
4474         * i386.cc (Target_i386::Scan::local): Likewise.
4475         * sparc.cc (Target_sparc::Scan::local): Likewise.
4476         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4477         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4478         do_tls_offset_for_global): New functions.
4479         (Target_powerpc::Scan::local): Correct TLS relocations and got
4480         entry values.
4481         (Target_powerpc::Scan::global): Don't emit unnecessary
4482         dynamic relocations on TLS GOT entries.
4483
4484 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4485
4486         * config.in: Disable sanity check for kfreebsd.
4487
4488 2012-09-10  Sterling Augustine  <saugustine@google.com>
4489
4490         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4491         (Gdb_index::pubtypes_read): New parameter.
4492         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4493         to calls.
4494         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4495         pubtypes_object_.
4496
4497 2012-09-09  Alan Modra  <amodra@gmail.com>
4498
4499         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4500         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4501         * gc.h (gc_process_relocs): Call target gc_add_reference.
4502         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4503         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4504         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4505         unnecessary cast.
4506         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4507         to cater for when we don't need code offset.  Update use.
4508         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4509         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4510         set_opd_valid): New functions.
4511         (Target_powerpc::do_gc_add_reference): New function.
4512         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4513         stashed refs.
4514         (Target_powerpc::do_gc_mark_symbol): New function.
4515
4516 2012-09-06  Cary Coutant  <ccoutant@google.com>
4517
4518         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4519         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4520         (Dwarf_die::skip_attributes): Likewise.
4521         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4522         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4523         (main): Call it.
4524         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4525
4526 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4527
4528         * testsuite/script_test_3.t: Add .got.plt output section
4529         statement.
4530         * testsuite/script_test_4.t: Likewise.
4531
4532 2012-09-05  Alan Modra  <amodra@gmail.com>
4533
4534         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4535         update all uses and lose "enum" when using type.
4536
4537 2012-09-05  Alan Modra  <amodra@gmail.com>
4538
4539         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4540         * configure: Regenerate.
4541         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4542         (plugin_final_layout.stdout): Likewise.
4543         (memory_test): Set page sizes to 0x1000.
4544         * testsuite/Makefile.in: Regenerate.
4545         * testsuite/discard_locals_test.sh: Add FIXME comment.
4546         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4547         * testsuite/pr14265.t: Add .got output section statement.
4548         * testsuite/script_test_2.t: Likewise.
4549         * testsuite/script_test_3.t: Likewise.
4550         * testsuite/script_test_4.t: Likewise.
4551         * testsuite/script_test_5.t: Likewise.
4552         * testsuite/script_test_6.t: Likewise.
4553         * testsuite/script_test_7.t: Likewise.
4554         * testsuite/script_test_9.t: Likewise.
4555
4556 2012-09-05  Alan Modra  <amodra@gmail.com>
4557
4558         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4559         (Powerpc_relocate_functions::Status): New typedef.
4560         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4561         (Target_powerpc::Scan::local): Handle REL64.
4562         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4563         for REL32 and REL64.
4564         (Target_powerpc::symval_for_branch): New function, extracted from..
4565         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4566         checks.  Report overflow errors.
4567
4568 2012-09-05  Alan Modra  <amodra@gmail.com>
4569
4570         * object.h (Sized_relobj_file::emit_relocs): Delete.
4571         (Sized_relobj_file::emit_relocs_reltype): Delete.
4572         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4573         relocate_relocs for --emit-relocs.
4574         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4575         * output.h: Update comment.
4576         (Output_segment::first_section): New function.
4577         (Output_segment::first_section_load_address): Use first_section.
4578         * output.cc (Output_segment::first_section): New function extracted..
4579         (Output_segment::first_section_load_address): ..from here.  Delete.
4580         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4581         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4582         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4583         adjust call to target.h function.
4584         * i386.cc (Target_i386): Likewise.
4585         * sparc.cc (Target_sparc): Likewise.
4586         * x86_64.cc (Target_x86_64): Likewise.
4587         * powerpc.cc (Target_powerpc): Likewise.
4588         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4589         first tls section has section symbol for optimised local dynamic
4590         output relocs.
4591         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4592         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4593         optimised tls code.
4594         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4595         Rename to relocate_relocs.  Update error message.
4596
4597 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4598
4599         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4600         --just-symbols.
4601
4602 2012-08-31  Alan Modra  <amodra@gmail.com>
4603
4604         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4605         (Powerpc_relobj::toc_base_offset): New stub function.
4606         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4607         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4608         (Target_powerpc::Relocate::enum skip_tls): New.
4609         (Target_powerpc::call_tls_get_addr_): New var.
4610         (Target_powerpc::is_branch_reloc): Move to file scope.
4611         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4612         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4613         New functions.
4614         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4615         (powerpc_info): Correct common_pagesize for ppc64.
4616         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4617         (Powerpc_relocate_functions): Add overflow check enums and functions.
4618         Add non-shift version of rela, rela_ua.  Delete all rel public
4619         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4620         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4621         addr16_ha3, addr14 functions.
4622         (Output_data_got_powerpc::add_constant_pair): New function.
4623         (Output_data_got_powerpc::got_base_offset): Likewise.
4624         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4625         (instruction constants): Sort, add some more.
4626         (Output_data_glink::do_write): Add and use Address typedef.  Use
4627         object->toc_base_offset() stub for 64-bit.
4628         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4629         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4630         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4631         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4632         Always treat .opd relocs as against locally defined symbol.
4633         Correct condition for RELATIVE relocs.
4634         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4635         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4636         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4637         calculations.  Handle TLS relocs, and more.  Add overflow
4638         checking and adjust for Powerpc_relocate_functions changes.
4639         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4640         Reinstate --emit-relocs code with FIXME.
4641
4642 2012-08-30  Alan Modra  <amodra@gmail.com>
4643
4644         * layout.cc (Layout::set_segment_offsets): Set p_align to
4645         abi_pagesize, not common_pagesize.
4646         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4647         to determine whether file header can go in segment.
4648
4649 2012-08-30  Alan Modra  <amodra@gmail.com>
4650
4651         * output.h (Output_reloc::Output_reloc <output section>): Add
4652         is_relative param.  Adjust calls.
4653         (Output_reloc::add_output_section_relative): New functions.
4654         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4655         is_relative.
4656         (Output_reloc::symbol_value): Handle SECTION_CODE.
4657
4658 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4659
4660         * gold.cc (queue_middle_tasks): Call layout again when unique
4661         segments for sections is desired.
4662         * layout.cc (Layout::Layout): Initialize new members.
4663         (Layout::get_output_section_flags): New function.
4664         (Layout::choose_output_section): Call get_output_section_flags.
4665         (Layout::layout): Make output section for mapping to a unique segment.
4666         (Layout::insert_section_segment_map): New function.
4667         (Layout::attach_allocated_section_to_segment): Make unique segment for
4668         output sections marked so.
4669         (Layout::segment_precedes): Check for unique segments when sorting.
4670         * layout.h (Layout::Unique_segment_info): New struct.
4671         (Layout::Section_segment_map): New typedef.
4672         (Layout::insert_section_segment_map): New function.
4673         (Layout::get_output_section_flags): New function.
4674         (Layout::is_unique_segment_for_sections_specified): New function.
4675         (Layout::set_unique_segment_for_sections_specified): New function.
4676         (Layout::unique_segment_for_sections_specified_): New member.
4677         (Layout::section_segment_map_): New member.
4678         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4679         Rename is_gc_pass_one to is_pass_one.
4680         Rename is_gc_pass_two to is_pass_two.
4681         Rename is_gc_or_icf to is_two_pass.
4682         Check for which pass based on whether symbols data is present.
4683         Make it two pass when unique segments for sections is desired.
4684         * output.cc (Output_section::Output_section): Initialize new
4685         members.
4686         * output.h (Output_section::is_unique_segment): New function.
4687         (Output_section::set_is_unique_segment): New function.
4688         (Output_section::is_unique_segment_): New member.
4689         (Output_section::extra_segment_flags): New function.
4690         (Output_section::set_extra_segment_flags): New function.
4691         (Output_section::extra_segment_flags_): New member.
4692         (Output_section::segment_alignment): New function.
4693         (Output_section::set_segment_alignment): New function.
4694         (Output_section::segment_alignment_): New member.
4695         (Output_segment::Output_segment): Initialize is_unique_segment_.
4696         (Output_segment::is_unique_segment): New function.
4697         (Output_segment::set_is_unique_segment): New function.
4698         (Output_segment::is_unique_segment_): New member.
4699         * plugin.cc (allow_unique_segment_for_sections): New function.
4700         (unique_segment_for_sections): New function.
4701         (Plugin::load): Add new functions to transfer vector.
4702         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4703         * Makefile.in: Regenerate.
4704         * testsuite/plugin_final_layout.sh: Check if unique segment
4705         functionality works.
4706         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4707         are available.
4708         (allow_unique_segment_for_sections): New global.
4709         (unique_segment_for_sections): New global.
4710         (claim_file_hook): Call allow_unique_segment_for_sections.
4711         (all_symbols_read_hook): Call unique_segment_for_sections.
4712
4713 2012-08-22  Cary Coutant  <ccoutant@google.com>
4714
4715         * layout.cc (Layout::include_section): Don't assert on GROUP
4716         sections with --emit-relocs.
4717
4718 2012-08-21  Cary Coutant  <ccoutant@google.com>
4719
4720         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4721         if --export-dynamic-symbol names an undef symbol.
4722
4723 2012-08-18  Alan Modra  <amodra@gmail.com>
4724
4725         * powerpc.cc: Formatting and white space.
4726         (Powerpc_relobj): Rename got2_section_ to special_.
4727         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4728         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4729         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4730         (Target_powerpc): Add Address typedef and invalid_address.  Use
4731         throughout.
4732         (Target_powerpc::is_branch_reloc): New function.
4733         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4734         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4735         for dst_mask, value and addend.
4736         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4737         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4738         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4739         uint16_t for 24-bit offset.  Use get_output_section_offset and
4740         check return.
4741         (Target_powerpc::Scan::local): Handle more relocs.
4742         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4743         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4744         Plug in toc restoring insn after plt calls.  Translate branches
4745         to function descriptor symbols to corresponding entry point.
4746         (Target_powerpc::relocate_for_relocatable): Check return from
4747         get_output_section_offset.
4748         * symtab.h: Comment typo.
4749
4750 2012-08-14  Ian Lance Taylor  <iant@google.com>
4751
4752         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4753         unsupported_relocal_local to call unsupported_reloc_global.
4754
4755 2012-08-14  Nick Clifton  <nickc@redhat.com>
4756
4757         PR ld/14265
4758         * script-sections.cc (Sections_element::output_section_name): Add
4759         keep return parameter.
4760         (Output_section_element::match_name): Add keep return parameter.
4761         Return the value of the keep_ member.
4762         * script-sections.h (class Output_section): Update
4763         output_section_name prototype.
4764         * layout.cc (Layout::keep_input_section): New public member
4765         function.
4766         (Layout::choose_output_section): Pass keep parameter to
4767         output_section_name.
4768         * layout.h (class Layout): Add keep_input_section.
4769         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4770         sections.
4771         * testsuite/Makefile.am: Add a test.
4772         * testsuite/Makefile.in: Regenerate.
4773         * testsuite/pr14265.c: Source file for the test.
4774         * testsuite/pr14265.t: Linker script for the test.
4775         * testsuite/pr14265.sh: Shell script for the test.
4776
4777 2012-08-14  Alan Modra  <amodra@gmail.com>
4778
4779         * target.h (Target::output_section_name): New function.
4780         (Target::do_output_section_name): New function.
4781         * layout.cc (Layout::choose_output_section): Call the above.
4782         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4783
4784 2012-08-14  Alan Modra  <amodra@gmail.com>
4785
4786         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4787         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4788         for replace_constant call.
4789         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4790         (Output_data_glink::do_print_to_mapfile): New function.
4791         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4792         (Target_powerpc::Relocate::relocate): Likewise.
4793
4794 2012-08-14  Alan Modra  <amodra@gmail.com>
4795
4796         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4797         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4798         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4799         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4800         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4801         here.
4802         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4803         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4804         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4805         here.
4806         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4807         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4808
4809 2012-08-12  Alan Modra  <amodra@gmail.com>
4810
4811         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4812         (glink insn constants): Use uint32_t.
4813         (Output_data_glink::add_entry): Use insert, not [] operator.
4814
4815 2012-08-11  Alan Modra  <amodra@gmail.com>
4816
4817         * object.h (Sized_relobj_file::find_shdr): New function.
4818         (Sized_relobj_file::find_special_sections): New function.
4819         * object.cc (Sized_relobj_file::find_shdr): New function.
4820         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4821         (Sized_relobj_file::find_special_sections): New function, split out..
4822         (Sized_relobj_file::do_read_symbols): ..from here.
4823         * output.h (Output_data_got::replace_constant): New function.
4824         (Output_data_got::num_entries): New function.
4825         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4826         (Output_data_got::got_offset): Protected rather than private.
4827         (Output_data_got::replace_got_entry): New function.
4828         * output.cc (Output_data_got::replace_got_entry): New function.
4829         * powerpc.cc (class Powerpc_relobj): New.
4830         (class Powerpc_relocate_functions): Delete all psymval variants or
4831         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4832         Implement _ha functions using corresponding _hi function.
4833         (Powerpc_relobj::find_special_sections): New function.
4834         (Target_powerpc::do_make_elf_object): New function.
4835         (class Output_data_got_powerpc): New.
4836         (class Output_data_glink): New.
4837         (class Powerpc_scan_relocatable_reloc): New.
4838         Many more changes througout file.
4839
4840 2012-08-09  Nick Clifton  <nickc@redhat.com>
4841
4842         * po/vi.po: Updated Vietnamese translation.
4843
4844 2012-08-07  Ian Lance Taylor  <iant@google.com>
4845
4846         * layout.cc (Layout::add_target_dynamic_tags): If
4847         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4848         plt_rel.
4849
4850 2012-07-30  Nick Clifton  <nickc@redhat.com>
4851
4852         * po/gold.pot: Updated template.
4853         * po/es.po: Updated Spanish translation.
4854
4855 2012-07-18  Cary Coutant  <ccoutant@google.com>
4856
4857         PR gold/14344
4858         * configure.ac: Add check for -gpubnames support.
4859         * configure: Regenerate.
4860         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4861         support; force -gno-pubnames.
4862         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4863         support.
4864         (gdb_index_test_4): New test.
4865         * testsuite/Makefile.in: Regenerate.
4866         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4867         * testsuite/gdb_index_test_2.sh: Likewise.
4868         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4869         * testsuite/gdb_index_test_4.sh: New script.
4870         * testsuite/gdb_index_test_comm.sh: New script with common code;
4871         don't look for space after colon.
4872
4873 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4874
4875         * gold.cc (queue_middle_tasks): Update function order only after
4876         deferred objects due to plugins are processed.
4877
4878 2012-07-11  Ian Lance Taylor  <iant@google.com>
4879
4880         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4881         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4882         (Target_arm::scan_reloc_for_stub): Likewise.
4883         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4884         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4885         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4886         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4887         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4888
4889 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4890             Ian Lance Taylor  <iant@google.com>
4891
4892         PR gold/14309
4893         * configure.ac: Test whether std::tr1::hash<off_t> works.
4894         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4895         needed.
4896         * output.h (class Output_fill): Add virtual destructor.
4897         * configure, config.in: Rebuild.
4898
4899 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4900
4901         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4902
4903 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4904
4905         * plugin.cc (Plugin::load): Handle position independent executables.
4906
4907 2012-06-06  Cary Coutant  <ccoutant@google.com>
4908
4909         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4910         add .debug_macro.
4911         (lines_only_debug_sections): Likewise.
4912         (gdb_fast_lookup_sections): New static array.
4913         (is_gdb_debug_section): Rename formal parameter.
4914         (is_lines_only_debug_section): Likewise.
4915         (is_gdb_fast_lookup_section): New function.
4916         (Layout::include_section): Check for ".zdebug_" prefix; pass
4917         section name suffix to is_gdb_debug_section, et al.; check for
4918         fast-lookup sections when building .gdb_index.
4919         * options.h (--strip-debug-gdb): Update GDB version number.
4920
4921 2012-06-06  Cary Coutant  <ccoutant@google.com>
4922
4923         * configure.ac: Add check for fallocate.
4924         * configure: Regenerate.
4925         * config.in: Regenerate.
4926
4927         * options.h (class General_options): Add --mmap-output-file and
4928         --posix-fallocate options.
4929         * output.cc: (posix_fallocate): Remove; replace with...
4930         (gold_fallocate): New function.
4931         (Output_file::map_no_anonymous): Call gold_fallocate.
4932         (Output_file::map): Check --mmap-output-file option.
4933
4934 2012-06-05  Jing Yu  <jingyu@google.com>
4935
4936         * gold.h (textdomain): Add do {} to empty while(0).
4937         (bindtextdomain): Likewise.
4938
4939 2012-06-04  Cary Coutant  <ccoutant@google.com>
4940
4941         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4942         has_dynsym_index.
4943
4944 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4945
4946         * symtab.cc (Symbol_table::define_special_symbol):
4947         Initialize *poldsym to prevent uninitialized variable errors.
4948
4949 2012-05-23  Cary Coutant  <ccoutant@google.com>
4950
4951         * layout.cc (Layout::section_name_mapping): Add rules to handle
4952         exact match on .data.rel.ro.local or .data.rel.ro.
4953         (Layout::output_section_name): Check for exact matches.
4954
4955 2012-05-23  Cary Coutant  <ccoutant@google.com>
4956
4957         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4958         more carefully.
4959
4960 2012-05-22  Cary Coutant  <ccoutant@google.com>
4961
4962         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4963         object before exporting symbol.
4964
4965 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4966
4967         * testsuite/tls_test.cc: Include "config.h" first.
4968         * testsuite/tls_test_c.c: Likewise.
4969
4970 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4971             Nick Clifton  <nickc@redhat.com>
4972
4973         PR 14072
4974         * configure.in: Add check that sysdep.h has been included before
4975         any system header files.
4976         * configure: Regenerate.
4977         * config.in: Regenerate.
4978
4979 2012-05-14  Cary Coutant  <ccoutant@google.com>
4980
4981         * layout.cc (Layout::make_output_section): Mark .tdata section
4982         as RELRO.
4983         * testsuite/relro_test.cc: Add a TLS variable.
4984
4985 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4986
4987         PR gold/14091
4988         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4989         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4990         R_X86_64_64.
4991
4992 2012-05-08  Cary Coutant  <ccoutant@google.com>
4993
4994         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4995         (lines_only_debug_sections): Likewise.
4996
4997 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4998
4999         * nacl.cc: New file.
5000         * nacl.h: New file.
5001         * Makefile.am (CCFILES, HFILES): Add them.
5002         * Makefile.in: Regenerate.
5003         * i386.cc (Output_data_plt_i386_nacl): New class.
5004         (Output_data_plt_i386_nacl_exec): New class.
5005         (Output_data_plt_i386_nacl_dyn): New class.
5006         (Target_i386_nacl): New class.
5007         (Target_selector_i386_nacl): New class.
5008         (target_selector_i386): Use it instead of Target_selector_i386.
5009         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
5010         (Target_x86_64_nacl): New class.
5011         (Target_selector_x86_64_nacl): New class.
5012         (target_selector_x86_64, target_selector_x32): Use it instead of
5013         Target_selector_x86_64.
5014         * arm.cc (Output_data_plt_arm_nacl): New class.
5015         (Target_arm_nacl): New class.
5016         (Target_selector_arm_nacl): New class.
5017         (target_selector_arm, target_selector_armbe): Use it instead of
5018         Target_selector_arm.
5019
5020         * target-select.cc (select_target): Take new Input_file* and off_t
5021         arguments, pass them on to recognize method of selector.
5022         * object.cc (make_elf_sized_object): Update caller.
5023         * parameters.cc (parameters_force_valid_target): Likewise.
5024         * incremental.cc (make_sized_incremental_binary): Likewise.
5025         * target-select.h: Update decl.
5026         (Target_selector::recognize): Take new Input_file* argument,
5027         pass it on to do_recognize.
5028         (Target_selector::do_recognize): Take new Input_file* argument.
5029         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
5030         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
5031         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
5032         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
5033
5034         * target.h (Target::Target_info): New members isolate_execinstr
5035         and rosegment_gap.
5036         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
5037         * arm.cc (Target_arm::arm_info): Update initializer.
5038         * i386.cc (Target_i386::i386_info): Likewise.
5039         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
5040         * sparc.cc (Target_sparc::sparc_info): Likewise.
5041         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5042         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
5043         * layout.cc (Layout::attach_allocated_section_to_segment):
5044         Take new const Target* argument.  If target->isolate_execinstr(), act
5045         like --rosegment.
5046         (Layout::find_first_load_seg): Take new const Target* argument;
5047         if target->isolate_execinstr(), reject PF_X segments.
5048         (Layout::relaxation_loop_body): Update caller.
5049         (Layout::set_segment_offsets): If target->isolate_execinstr(),
5050         reset file offset to zero when we hit LOAD_SEG, and then do a second
5051         loop over the segments before LOAD_SEG to reassign offsets after
5052         addresses have been determined.  Handle target->rosegment_gap().
5053         (Layout::attach_section_to_segment): Take new const Target* argument;
5054         pass it to attach_allocated_section_to_segment.
5055         (Layout::make_output_section): Update caller.
5056         (Layout::attach_sections_to_segments): Take new const Target* argument;
5057         pass it to attach_section_to_segment.
5058         * gold.cc (queue_middle_tasks): Update caller.
5059         * layout.h (Layout): Update method decls with new arguments.
5060
5061         * arm.cc (Target_arm::Target_arm): Take optional argument for the
5062         Target_info pointer to use.
5063         (Target_arm::do_make_data_plt): New virtual method.
5064         (Target_arm::make_data_plt): New method that calls it.
5065         (Target_arm::make_plt_entry): Use it.
5066         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
5067         for the section alignment.
5068         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
5069         method.
5070         (Output_data_plt_arm::first_plt_entry_offset): Call it.
5071         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
5072         method.
5073         (Output_data_plt_arm::get_plt_entry_size): Call it.
5074         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
5075         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
5076         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
5077         method.
5078         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
5079         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
5080         method instead of sizeof(plt_entry).
5081         (Output_data_plt_arm::add_entry): Likewise.
5082         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
5083         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
5084         than static method.
5085         (Target_arm::plt_entry_size): Likewise.
5086         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
5087         Move to ...
5088         (Output_data_plt_arm_standard): ... here, new class.
5089         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
5090         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
5091         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
5092
5093         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5094         Take additional argument for the PLT entry size.
5095         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
5096         Use get_plt_entry_size method rather than plt_entry_size variable.
5097         (Output_data_plt_x86_64::reserve_slot): Likewise.
5098         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
5099         (Output_data_plt_x86_64::add_entry): Likewise.
5100         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
5101         (Output_data_plt_x86_64::address_for_global): Likewise.
5102         (Output_data_plt_x86_64::address_for_local): Likewise.
5103         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5104         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
5105         Make method non-static.
5106         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
5107         method.
5108         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
5109         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
5110         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
5111         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
5112         virtual method.
5113         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
5114         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
5115         virtual method.
5116         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
5117         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
5118         virtual method.
5119         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
5120         (Output_data_plt_x86_64::plt_entry_size)
5121         (Output_data_plt_x86_64::first_plt_entry)
5122         (Output_data_plt_x86_64::plt_entry)
5123         (Output_data_plt_x86_64::tlsdesc_plt_entry)
5124         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
5125         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
5126         (Output_data_plt_x86_64_standard): ... here, new class.
5127         (Target_x86_64::Target_x86_64): Take optional argument for the
5128         Target_info pointer to use.
5129         (Target_x86_64::do_make_data_plt): New virtual method.
5130         (Target_x86_64::make_data_plt): New method to call it.
5131         (Target_x86_64::init_got_plt_for_update): Use that.
5132         Call this->plt_->add_eh_frame method here.
5133         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
5134         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
5135         rather than static method.
5136         (Target_x86_64::plt_entry_size): Likewise.
5137         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
5138         rather than plt_entry_size variable.  Move guts of PLT filling to...
5139         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
5140         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
5141         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
5142
5143         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
5144         additional argument for the section alignment.
5145         Don't do add_eh_frame_for_plt here.
5146         (Output_data_plt_i386::first_plt_entry_offset): Make the method
5147         non-static.  Use get_plt_entry_size method rather than plt_entry_size
5148         variable.
5149         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
5150         method.
5151         (Output_data_plt_i386::get_plt_entry_size): Call it.
5152         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
5153         (Output_data_plt_i386::add_eh_frame): New method to call it.
5154         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
5155         method.
5156         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
5157         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
5158         method.
5159         (Output_data_plt_i386::fill_plt_entry): New method to call it.
5160         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
5161         method instead of plt_entry_size.
5162         (Output_data_plt_i386::plt_entry_size)
5163         (Output_data_plt_i386::plt_eh_frame_fde_size)
5164         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
5165         (Output_data_plt_i386_standard): ... here, new class.
5166         (Output_data_plt_i386_exec): New class.
5167         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
5168         (Output_data_plt_i386_exec::first_plt_entry): ... here.
5169         (Output_data_plt_i386::exec_plt_entry): Move to ...
5170         (Output_data_plt_i386_exec::plt_entry): ... here.
5171         (Output_data_plt_i386_dyn): New class.
5172         (Output_data_plt_i386::first_plt_entry): Move to ...
5173         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
5174         (Output_data_plt_i386::dyn_plt_entry): Move to ...
5175         (Output_data_plt_i386_dyn::plt_entry): ... here.
5176         (Target_i386::Target_i386): Take optional argument for the Target_info
5177         pointer to use.
5178         (Target_i386::do_make_data_plt): New virtual method.
5179         (Target_i386::make_data_plt): New method to call it.
5180         (Target_i386::make_plt_section): Use that.
5181         Call this->plt_->add_eh_frame method here.
5182         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
5183         rather than plt_entry_size variable.
5184         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
5185         (Output_data_plt_i386::address_for_local): Likewise.
5186         (Output_data_plt_i386::do_write): Likewise.
5187         Move guts of PLT filling to...
5188         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
5189         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
5190         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
5191         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
5192
5193 2012-05-01  Cary Coutant  <ccoutant@google.com>
5194
5195         * dwarf_reader.cc (Dwarf_die::read_attributes)
5196         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5197         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
5198         * reduced_debug_output.cc
5199         (Output_reduced_debug_info_section::get_die_end): Remove
5200         DW_FORM_GNU_ref_index.  Add default case.
5201
5202 2012-04-26  Mark Wielaard  <mjw@redhat.com>
5203
5204         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
5205         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5206         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
5207         DW_AT_high_pc as offset from DW_AT_low_pc.
5208
5209         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
5210         * testsuite/Makefile.in: Regenerate.
5211         * testsuite/gdb_index_test_3.c: New test source file.
5212         * testsuite/gdb_index_test_3.sh: New test source file.
5213
5214 2012-04-25  Ian Lance Taylor  <iant@google.com>
5215
5216         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
5217         pointer.
5218         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
5219         as a class, not a struct.
5220         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
5221         (Target_arm::apply_cortex_a8_workaround): Likewise.
5222         * gc.h: Declare Reloc_types as a struct, not a class.
5223         * object.h: Declare Symbols_data as a struct.
5224         * reloc.h: Declare Read_relocs_data as a struct.
5225         * target.h: Declare Relocate_info as a struct.
5226
5227 2012-04-24  David S. Miller  <davem@davemloft.net>
5228
5229         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
5230         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
5231         and R_SPARC_WPLT30.
5232
5233 2012-04-24  Cary Coutant  <ccoutant@google.com>
5234
5235         * incremental-dump.cc (find_input_containing_global): Replace
5236         magic number with symbolic constant.
5237         (dump_incremental_inputs): Update version number.
5238         * incremental.cc (Output_section_incremental_inputs): Update version
5239         number; import symbolic constants from Incremental_inputs_reader.
5240         (Incremental_inputs::create_data_sections): Align relocations
5241         section correctly for 64-bit targets.
5242         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5243         constants; add padding.
5244         (Output_section_incremental_inputs::write_header): Add assert for
5245         header_size.
5246         (Output_section_incremental_inputs::write_input_files): Add assert
5247         for input_entry_size.
5248         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5249         add assert for object_info_size, input_section_entry_size,
5250         global_sym_entry_size.
5251         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5252         for data structure sizes; use them.
5253         (Incremental_input_entry_reader): Import symbolic constants from
5254         Incremental_inputs_reader; use them.
5255
5256 2012-04-23  David S. Miller  <davem@davemloft.net>
5257
5258         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5259         and elf_flags_set_.
5260         (Target_sparc::Target_sparc): Initialize new fields.
5261         (Target_sparc::do_make_elf_object): New function.
5262         (Target_sparc::do_adjust_elf_header): New function.
5263
5264 2012-04-23  Cary Coutant  <ccoutant@google.com>
5265
5266         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5267         CU range table of gdb index.
5268
5269 2012-04-20  David S. Miller  <davem@davemloft.net>
5270
5271         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5272         instead of false.
5273
5274 2012-04-16  David S. Miller  <davem@davemloft.net>
5275
5276         * sparc.cc (Target_sparc::got_address): New function.
5277         (Sparc_relocate_functions::gdop_hix22): New function.
5278         (Sparc_relocate_functions::gdop_lox10): New function.
5279         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5280         relocs.
5281         (Target_sparc::Scan::local): Likewise if the global symbol is not
5282         preemptible and is not IFUNC.
5283         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5284         transformations for local and non-preemptible non-IFUNC global
5285         symbols.
5286
5287         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5288         writing out 64-bit part of ranges.
5289
5290         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5291         -fpic and -fpie respectively.
5292         * Makefile.in: Regenerate.
5293
5294         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5295         (Target_sparc::Target_sparc): Initialize new field.
5296         (Target_sparc::do_plt_section_for_global): New function.
5297         (Target_sparc::do_plt_section_for_local): New function.
5298         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5299         (Target_sparc::make_plt_section): New function, broken out of
5300         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5301         (Target_sparc::make_plt_entry): Call make_plt_section.
5302         (Target_sparc::make_local_ifunc_plt_entry): New function.
5303         (Target_sparc::rela_ifunc_section): New function.
5304         (Target_sparc::plt_section): Remove const.
5305         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5306         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5307         and ifunc_count_ fields.
5308         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5309         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5310         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5311         (Output_data_plt_sparc::rela_ifunc): New function.
5312         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5313         (Output_data_plt_sparc::has_ifunc_section): New function.
5314         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5315         (Output_data_plt_sparc::address_for_global): New function.
5316         (Output_data_plt_sparc::address_for_local): New function.
5317         (Output_data_plt_sparc::plt_index_to_offset): New function.
5318         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5319         and entry_count.
5320         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5321         entry_count.
5322         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5323         R_SPARC_JMP_IREL to switch.
5324         (Target_sparc::Scan::check_non_pic): Likewise.
5325         (Target_sparc::Scan::local): Handle IFUNC symbols.
5326         (Target_sparc::Scan::local): Likewise.
5327         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5328         and plt_address_for_local.
5329         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5330         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5331
5332         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5333         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5334         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5335         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5336         global relocs too.
5337         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5338         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5339         calls.
5340         * sparc.cc (Target_sparc::Scan::global): Likewise.
5341         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5342
5343 2012-04-16  Cary Coutant  <ccoutant@google.com>
5344
5345         * archive.cc (Library_base::should_include_member): Check for
5346         --export-dynamic-symbol.
5347         * options.h (class General_options): Add --export-dynamic-symbol.
5348         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5349         --export-dynamic-symbol.
5350         (Symbol_table::gc_mark_undef_symbols): Likewise.
5351         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5352
5353 2012-04-12  David S. Miller  <davem@davemloft.net>
5354
5355         * sparc.cc (Reloc::wdisp10): New relocation method.
5356         (Reloc::h34): Likewise.
5357         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5358         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5359         R_SPARC_WDISP10.
5360         (Target_sparc::Scan::local): Likewise.
5361         (Target_sparc::Scan::global): Likewise.
5362         (Target_sparc::Relocate::relocate): Likewise.
5363
5364 2012-04-09  Cary Coutant  <ccoutant@google.com>
5365
5366         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5367         low_pc == 0.
5368
5369 2012-04-06  Ian Lance Taylor  <iant@google.com>
5370
5371         * timer.cc: #include <unistd.h>.
5372
5373 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5374
5375         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5376         * config.in: Regenerate.
5377         * configure: Regenerate.
5378
5379 2012-04-05  Nick Clifton  <nickc@redhat.com>
5380
5381         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5382         (AM_LC_MESSAGES): Add.
5383         * aclocal.m4: Regenerate.
5384         * config.in: Regenerate.
5385         * configure: Regenerate.
5386
5387 2012-03-21  Cary Coutant  <ccoutant@google.com>
5388
5389         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5390         * Makefile.in: Regenerate.
5391         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5392         (Sized_elf_reloc_mapper::symbol_section): New function.
5393         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5394         (make_elf_reloc_mapper): New function.
5395         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5396         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5397         (Dwarf_abbrev_table::do_get_abbrev): New function.
5398         (Dwarf_ranges_table::read_ranges_table): New function.
5399         (Dwarf_ranges_table::read_range_list): New function.
5400         (Dwarf_pubnames_table::read_section): New function.
5401         (Dwarf_pubnames_table::read_header): New function.
5402         (Dwarf_pubnames_table::next_name): New function.
5403         (Dwarf_die::Dwarf_die): New function.
5404         (Dwarf_die::read_attributes): New function.
5405         (Dwarf_die::skip_attributes): New function.
5406         (Dwarf_die::set_name): New function.
5407         (Dwarf_die::set_linkage_name): New function.
5408         (Dwarf_die::attribute): New function.
5409         (Dwarf_die::string_attribute): New function.
5410         (Dwarf_die::int_attribute): New function.
5411         (Dwarf_die::uint_attribute): New function.
5412         (Dwarf_die::ref_attribute): New function.
5413         (Dwarf_die::child_offset): New function.
5414         (Dwarf_die::sibling_offset): New function.
5415         (Dwarf_info_reader::check_buffer): New function.
5416         (Dwarf_info_reader::parse): New function.
5417         (Dwarf_info_reader::do_parse): New function.
5418         (Dwarf_info_reader::do_read_string_table): New function.
5419         (Dwarf_info_reader::lookup_reloc): New function.
5420         (Dwarf_info_reader::get_string): New function.
5421         (Dwarf_info_reader::visit_compilation_unit): New function.
5422         (Dwarf_info_reader::visit_type_unit): New function.
5423         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5424         Sized_elf_reloc_mapper.
5425         (Sized_dwarf_line_info::symbol_section): Remove function.
5426         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5427         (Sized_dwarf_line_info::read_line_mappings): Remove object
5428         parameter, adjust callers.
5429         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5430         * dwarf_reader.h: Include <sys/types.h>.
5431         (class Track_relocs): Remove forward declaration.
5432         (class Elf_reloc_mapper): New class.
5433         (class Sized_elf_reloc_mapper): New class.
5434         (class Dwarf_abbrev_table): New class.
5435         (class Dwarf_range_list): New class.
5436         (class Dwarf_ranges_table): New class.
5437         (class Dwarf_pubnames_table): New class.
5438         (class Dwarf_die): New class.
5439         (class Dwarf_info_reader): New class.
5440         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5441         (Sized_dwarf_line_info::symbol_section): Remove member function.
5442         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5443         base class.
5444         * gdb-index.cc: New source file.
5445         * gdb-index.h: New source file.
5446         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5447         and .debug_types sections, call Layout::add_to_gdb_index.
5448         (Sized_relobj_incr::do_section_name): Implement.
5449         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5450         return type; Implement.
5451         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5452         return type.
5453         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5454         parameter list and return type.
5455         (Sized_incr_dynobj::do_section_contents): Likewise.
5456         * layout.cc: Include gdb-index.h.
5457         (Layout::Layout): Initialize gdb_index_data_.
5458         (Layout::init_fixed_output_section): Check for .gdb_index section.
5459         (Layout::add_to_gdb_index): New function. Instantiate.
5460         * layout.h: Add forward declaration for class Gdb_index.
5461         (Layout::add_to_gdb_index): New member function.
5462         (Layout::gdb_index_data_): New data member.
5463         * main.cc: Include gdb-index.h.
5464         (main): Print statistics for gdb index.
5465         * object.cc (Object::section_contents): Move code into
5466         do_section_contents.
5467         (need_decompressed_section): Check for sections needed when building
5468         gdb index.
5469         (build_compressed_section_map): Likewise.
5470         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5471         gdb index.
5472         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5473         sections; call Layout::add_to_gdb_index.
5474         (Sized_relobj_file::do_decompressed_section_contents): Call
5475         do_section_contents directly.
5476         * object.h (Object::do_section_contents): Adjust parameter list and
5477         return type.
5478         (Object::do_decompressed_section_contents): Call do_section_contents
5479         directly.
5480         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5481         return type.
5482         * options.h (class General_options): Add --gdb-index option.
5483         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5484         list and return type.
5485         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5486         * reloc.h (Track_relocs::checkpoint): New function.
5487         (Track_relocs::reset): New function.
5488
5489         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5490         New test cases.
5491         * testsuite/Makefile.in: Regenerate.
5492         * testsuite/gdb_index_test.cc: New test source file.
5493         * testsuite/gdb_index_test_1.sh: New test source file.
5494         * testsuite/gdb_index_test_2.sh: New test source file.
5495
5496 2012-03-19  Doug Kwan  <dougkwan@google.com>
5497
5498         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5499         (Target_arm::do_finalize_sections): Remove code which defines
5500         __exidx_start and __exidx_end.  Make symbol table parameter
5501         anonymous as it is not used.
5502         * gold.cc (queue_middle_tasks): Call target hook to define any
5503         target-specific symbols.
5504         * target.h (Target::define_standard_symbols): New method.
5505         (Target::do_define_standard_symbols): Same.
5506         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5507         * testsuite/Makefile.in: Regenerate.
5508         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5509         and __exidx_end.
5510         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5511         relocations are generated for __exidx_start and __exidx_end.
5512
5513 2012-03-16  Doug Kwan  <dougkwan@google.com>
5514
5515         * testsuite/Makefile.am: Disable test initpri3b.
5516         * testsuite/Makefile.in: Regenerate.
5517
5518 2012-03-15  Doug Kwan  <dougkwan@google.com>
5519
5520         * arm.cc (Target_arm::got_section): Make .got section read-only
5521         if -z now is given.
5522
5523 2012-03-15  Ian Lance Taylor  <iant@google.com>
5524
5525         PR gold/13850
5526         * layout.cc (Layout::make_output_section): Correctly mark
5527         SHT_INIT_ARRAY, et. al., as relro.
5528
5529 2012-03-14  Doug Kwan  <dougkwan@google.com>
5530
5531         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5532         dynamic relocations for protected symbols in shared objects.
5533
5534 2012-03-13  Ian Lance Taylor  <iant@google.com>
5535
5536         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5537         keep the larger alignment.
5538
5539 2012-03-12  Cary Coutant  <ccoutant@google.com>
5540
5541         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5542         handling of DW_LNE_define_file.
5543
5544 2012-03-12  Cary Coutant  <ccoutant@google.com>
5545
5546         * reduced_debug_output.cc
5547         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5548         codes to switch.
5549
5550 2012-02-29  Cary Coutant  <ccoutant@google.com>
5551
5552         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5553
5554 2012-02-29  Cary Coutant  <ccoutant@google.com>
5555
5556         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5557         Call Object::decompressed_section_contents.
5558         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5559         New dtor.
5560         (Sized_dwarf_line_info::buffer_start_): New data member.
5561         * merge.cc (Output_merge_data::do_add_input_section): Call
5562         Object::decompressed_section_contents.
5563         (Output_merge_string::do_add_input_section): Likewise.
5564         * object.cc (need_decompressed_section): New function.
5565         (build_compressed_section_map): Decompress sections needed later.
5566         (Sized_relobj_file::do_decompressed_section_contents): New function.
5567         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5568         * object.h (Object::decompressed_section_contents): New function.
5569         (Object::discard_decompressed_sections): New function.
5570         (Object::do_decompressed_section_contents): New function.
5571         (Object::do_discard_decompressed_sections): New function.
5572         (Compressed_section_info): New type.
5573         (Compressed_section_map): Include decompressed section contents.
5574         (Sized_relobj_file::do_decompressed_section_contents): New function.
5575         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5576
5577 2012-02-16  Cary Coutant  <ccoutant@google.com>
5578
5579         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5580         * testsuite/Makefile.in: Regenerate.
5581
5582 2012-02-14  Cary Coutant  <ccoutant@google.com>
5583
5584         * options.cc (General_options::finalize): Disallow -pie and -static.
5585
5586 2012-02-03  Doug Kwan  <dougkwan@google.com>
5587
5588         * arm.cc (Arm_relocate_functions::abs8,
5589         Arm_relocate_functions::abs16): Use
5590         Bits::has_signed_unsigned_overflow32.
5591         (Arm_relocate_functions::thm_abs8): Correct range of
5592         overflow check.
5593         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5594         in assertions.
5595
5596 2012-02-02  Doug Kwan  <dougkwan@google.com>
5597
5598         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5599         position independent outputs, not just shared objects.
5600
5601 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5602
5603         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5604         * configure: Regenerated.
5605
5606 2012-01-27  Ian Lance Taylor  <iant@google.com>
5607
5608         * reloc.h (Bits): New class with static functions, copied from
5609         namespace utils in arm.cc.
5610         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5611         instead.
5612
5613 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5614
5615         * incremental.cc (write_info_blocks): Correct relocation offset.
5616
5617 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5618
5619         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5620         (Relocate::tls_gd_to_le): Likewise.
5621
5622 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5623
5624         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5625
5626 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5627
5628         * configure.ac: Check if -mcmodel=medium works.
5629         * configure: Regenerated.
5630
5631 2012-01-24  Cary Coutant  <ccoutant@google.com>
5632
5633         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5634         definition and ...
5635         (read_unsigned_LEB_128_x): ... this new function.
5636         (read_signed_LEB_128): Replaced with inline definition and ...
5637         (read_signed_LEB_128_x): ... this new function.
5638         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5639         (read_unsigned_LEB_128): Add inline definition.
5640         (read_signed_LEB_128_x): New function.
5641         (read_signed_LEB_128): Add inline definition.
5642         * testsuite/Makefile.am (leb128_unittest): New unit test.
5643         * testsuite/Makefile.in: Regenerate.
5644         * testsuite/leb128_unittest.cc: New unit test.
5645
5646 2012-01-23  Ian Lance Taylor  <iant@google.com>
5647
5648         PR gold/13617
5649         * i386.cc (Target_i386::do_code_fill): When using a jmp
5650         instruction, pad with nop instructions.
5651         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5652
5653 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5654
5655         * x86_64.cc (gc_process_relocs): Add typename on types used in
5656         template.
5657         (scan_relocs): Likewise.
5658         (relocate_section): Likewise.
5659         (apply_relocation): Likewise.
5660
5661 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5662
5663         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5664         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5665         under x32.
5666
5667 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5668
5669         * x86_64.cc: Initial support for x32.
5670
5671 2012-01-03  Cary Coutant  <ccoutant@google.com>
5672
5673         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5674         Use abstract base class for GOT.
5675         * output.h (class Output_data_got_base): New abstract base class.
5676         (class Output_data_got): Derive from new base class, adjust ctors.
5677         (Output_data_got::reserve_slot): Make virtual; rename to
5678         do_reserve_slot; Adjust callers.
5679         * target.h (Sized_target::init_got_plt_for_update): Return
5680         pointer to abstract base class.
5681         * x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5682
5683 2011-12-18  Ian Lance Taylor  <iant@google.com>
5684
5685         * object.h (Relobj::local_symbol_value): New function.
5686         (Relobj::local_plt_offset): New function.
5687         (Relobj::local_has_got_offset): New function.
5688         (Relobj::local_got_offset): New function.
5689         (Relobj::set_local_got_offset): New function.
5690         (Relobj::do_local_symbol_value): New pure virtual function.
5691         (Relobj::do_local_plt_offset): Likewise.
5692         (Relobj::do_local_has_got_offset): Likewise.
5693         (Relobj::do_local_got_offset): Likewise.
5694         (Relobj::do_set_local_got_offset): Likewise.
5695         (Sized_relobj::do_local_has_got_offset): Rename from
5696         local_has_got_offset.
5697         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5698         (Sized_relobj::do_set_local_got_offset): Rename from
5699         set_local_got_offset.
5700         (Sized_relobj_file::do_local_plt_offset): Rename from
5701         local_plt_offset.
5702         (Sized_relobj_file::do_local_symbol_value): New function.
5703         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5704         local_plt_offset.
5705         * output.cc (Output_data_got::Got_entry::write): Change object to
5706         Relobj.  Use local_symbol_value.
5707         (Output_data_got::add_global_with_rel): Change rel_dyn to
5708         Output_data_reloc_generic*.  Use add_global_generic.
5709         (Output_data_got::add_global_with_rela): Remove.  Change all
5710         callers to use add_global_with_rel.
5711         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5712         Output_data_reloc_generic*.  Use add_global_generic.
5713         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5714         callers to use add_global_pair_with_rel.
5715         (Output_data_got::add_local): Change object to Relobj*.
5716         (Output_data_got::add_local_plt): Likewise.
5717         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5718         change rel_dyn to Output_data_reloc_generic*.  Use
5719         add_local_generic.
5720         (Output_data_got::add_local_with_rela): Remove.  Change all
5721         callers to use all_local_with_rel.
5722         (Output_data_got::add_local_pair_with_rel): Change object to
5723         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5724         add_output_section_generic.
5725         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5726         callers to use add_local_pair_with_rel.
5727         (Output_data_got::reserve_local): Change object to Relobj*.
5728         * output.h: (class Output_data_reloc_generic): Add pure virtual
5729         declarations for add_global_generic, add_local_generic,
5730         add_output_section_generic.
5731         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5732         functions for Output_data_reloc_generic.  Update declarations for
5733         changes listed in output.cc.
5734         (class Output_data_got): Change template parameter to got_size.
5735         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5736         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5737         function.
5738         (Sized_relobj_incr::do_local_plt_offset): New function.
5739         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5740         add_global_generic.
5741
5742 2011-12-17  Cary Coutant  <ccoutant@google.com>
5743
5744         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5745         * resolve.cc (Symbol_table::resolve): Likewise.
5746         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5747         arrays.
5748         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5749
5750 2011-12-16  Ian Lance Taylor  <iant@google.com>
5751
5752         * output.h (Output_data_reloc_generic::add): Only call
5753         add_dynamic_reloc if this is a dynamic reloc section.
5754
5755 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5756
5757         PR gold/13505
5758         * target-reloc.h (apply_relocation): Replace <64, false> with
5759         <size, big_endian>.
5760
5761 2011-11-25  Nick Clifton  <nickc@redhat.com>
5762
5763         * po/it.po: New Italian translation.
5764
5765 2011-11-17  Sterling Augustine  <saugustine@google.com>
5766
5767         * script.cc (script_include_directive): Implement.
5768         (read_script_file): New local variables name and search_path. Update
5769         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5770         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5771         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5772
5773 2011-11-11  Sterling Augustine  <saugustine@google.com>
5774
5775         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5776         (file_or_sections_cmd): Likewise.
5777
5778 2011-11-11  Doug Kwan  <dougkwan@google.com>
5779
5780         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5781         if --just-symbols is given.
5782
5783 2011-11-10  Doug Kwan  <dougkwan@google.com>
5784
5785         PR gold/13362
5786         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5787         when processing data relocs.
5788         * reloc.h (Relocate_functions::rel_unaligned): New method.
5789         (Relocate_functions::pcrel_unaligned): Ditto.
5790         (Relocate_functions::rel32_unaligned): Ditto.
5791         (Relocate_functions::pcrel32_unaligned): Ditto.
5792
5793 2011-11-09  Doug Kwan  <dougkwan@google.com>
5794
5795         PR gold/13362
5796         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5797         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5798         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5799         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5800         (Relocate_functions::rel_unaligned): New.
5801         (Relocate_functions::rel32_unaligned): New.
5802         * target-reloc.h (relocate_for_relocatable): Add code to handle
5803         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5804         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5805         arm_unaligned_reloc_r): New targets.
5806         * testsuite/Makefile.in: Regenerate.
5807         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5808         linking.
5809
5810 2011-11-02  Ian Lance Taylor  <iant@google.com>
5811
5812         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5813         NATIVE_LINKER.
5814         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5815         * options.cc (General_options::finalize): Use library search path
5816         from configure script if specified.  If not native and no sysroot,
5817         only search TOOLLIBDIR.
5818         * options.h (Search_directory::Search_directory): Change name to
5819         const std::string&.
5820         (General_options::add_to_library_path_with_sysroot): Change arg to
5821         const std::string&.
5822         * configure, Makefile.in, config.in: Rebuild.
5823
5824 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5825
5826         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5827         we are working around the ARM1176 Erratum.
5828         * options.h (General_options::fix_arm1176): Add option.
5829         * testsuite/Makefile.am: Add testcases, and keep current ones
5830         working.
5831         * testsuite/Makefile.in: Regenerate.
5832         * testsuite/arm_fix_1176.s: New file.
5833         * testsuite/arm_fix_1176.sh: Likewise.
5834
5835 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5836
5837         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5838         may_use_blx_.
5839         (Target_arm::may_use_blx): Remove method.
5840         (Target_arm::set_may_use_blx): Likewise.
5841         (Target_arm::may_use_v4t_interworking): New method.
5842         (Target_arm::may_use_v5t_interworking): Likewise.
5843         (Target_arm::may_use_blx_): Remove member variable.
5844         (Arm_relocate_functions::arm_branch_common): Check for v5T
5845         interworking.
5846         (Arm_relocate_functions::thumb_branch_common): Likewise.
5847         (Reloc_stub::stub_type_for_reloc): Likewise.
5848         (Target_arm::do_finalize_sections): Correct interworking checks.
5849         * testsuite/Makefile.am: Add new tests.
5850         * testsuite/Makefile.in: Regenerate.
5851         * testsuite/arm_farcall_arm_arm.s: New test.
5852         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5853         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5854         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5855         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5856         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5857         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5858         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5859
5860 2011-10-31  Cary Coutant  <ccoutant@google.com>
5861
5862         PR gold/13023
5863         * expression.cc (Expression::eval_with_dot): Add
5864         is_section_dot_assignment parameter.
5865         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5866         absolute and assigning to dot within a section.
5867         * script-sections.cc
5868         (Output_section_element_assignment::set_section_addresses): Pass
5869         dot_section to set_if_absolute.
5870         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5871         as is_section_dot_assignment flag to eval_with_dot.
5872         (Output_section_element_dot_assignment::set_section_addresses):
5873         Likewise.
5874         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5875         parameter.  Also set value if relative to dot_section; set the
5876         symbol's output_section.
5877         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5878         parameter.  Adjust all callers.
5879         (Expression::eval_maybe_dot): Likewise.
5880         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5881         Adjust all callers.
5882         * testsuite/script_test_2.t: Test assignment of an absolute value
5883         to dot within an output section element.
5884
5885 2011-10-31  Cary Coutant  <ccoutant@google.com>
5886
5887         * options.h (class General_options): Add --[no-]gnu-unique options.
5888         * symtab.cc (Symbol_table::sized_write_globals): Convert
5889         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5890
5891 2011-10-31  Cary Coutant  <ccoutant@google.com>
5892
5893         PR gold/13359
5894         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5895         unnecessary assertion.
5896         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5897
5898 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5899
5900         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5901         gc_mark_symbol.
5902         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5903         gc_mark_symbol.
5904         Change to just keep the section associated with symbol.
5905         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5906         they are externally visible and --export-dynamic is turned on.
5907         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5908
5909 2011-10-19  Ian Lance Taylor  <iant@google.com>
5910
5911         PR gold/13163
5912         * script-sections.cc
5913         (Output_section_element_dot_assignment::needs_output_section): New
5914         function.
5915
5916 2011-10-19  Ian Lance Taylor  <iant@google.com>
5917
5918         PR gold/13204
5919         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5920         --section-start option was seen.
5921         * options.h (General_options::any_section_start): New function.
5922
5923 2011-10-18  David S. Miller  <davem@davemloft.net>
5924
5925         PR binutils/13301
5926         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5927         member to track relocation locations that have moved during TLS
5928         reloc optimizations.
5929         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5930         (Target_sparc::Relocate::relocate): Adjust view down by 4
5931         bytes if it matches reloc_adjust_addr_.
5932         (Target_sparc::Relocate::relocate_tls): Always move the
5933         __tls_get_addr call delay slot instruction forward 4 bytes when
5934         performing relaxation.
5935
5936 2011-10-18  Cary Coutant  <ccoutant@google.com>
5937
5938         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5939         (Output_file::map_no_anonymous): Check for non-zero
5940         return code from posix_fallocate.
5941
5942 2011-10-17  Cary Coutant  <ccoutant@google.com>
5943
5944         PR gold/13245
5945         * plugin.cc (is_visible_from_outside): Check for symbols
5946         referenced from dynamic objects.
5947         * resolve.cc (Symbol_table::resolve): Don't count references
5948         from dynamic objects as references from real ELF files.
5949         * testsuite/plugin_test_2.sh: Adjust expected result.
5950
5951 2011-10-17  Cary Coutant  <ccoutant@google.com>
5952
5953         * gold.cc: Include timer.h.
5954         (queue_middle_tasks): Stamp time.
5955         (queue_final_tasks): Likewise.
5956         * main.cc (main): Store timer in parameters.  Print timers
5957         for each pass.
5958         * parameters.cc (Parameters::Parameters): Initialize timer_.
5959         (Parameters::set_timer): New function.
5960         (set_parameters_timer): New function.
5961         * parameters.h (Parameters::set_timer): New function.
5962         (Parameters::timer): New function.
5963         (Parameters::timer_): New data member.
5964         (set_parameters_timer): New function.
5965         * timer.cc (Timer::stamp): New function.
5966         (Timer::get_pass_time): New function.
5967         * timer.h (Timer::stamp): New function.
5968         (Timer::get_pass_time): New function.
5969         (Timer::pass_times_): New data member.
5970
5971 2011-10-17  Cary Coutant  <ccoutant@google.com>
5972
5973         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5974         task for members of lib groups.
5975
5976 2011-10-17  Cary Coutant  <ccoutant@google.com>
5977
5978         PR gold/13288
5979         * fileread.cc (File_read::find_view): Add assert.
5980         (File_read::make_view): Move bounds check (replace with assert)...
5981         (File_read::find_or_make_view): ... to here.
5982
5983 2011-10-12  Cary Coutant  <ccoutant@google.com>
5984
5985         * output.cc (Output_file::open_base_file): Handle case where
5986         ::read returns less than requested size.
5987
5988 2011-10-10  Cary Coutant  <ccoutant@google.com>
5989
5990         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5991         Initialize defined_count_.
5992         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5993         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5994         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5995         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5996         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5997         * incremental.h (Sized_relobj_incr::defined_count_): New data
5998         member.
5999         (Sized_incr_dynobj::defined_count_): New data member.
6000         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
6001         Return zeroes instead of internal error.
6002
6003 2011-10-10  Cary Coutant  <ccoutant@google.com>
6004
6005         PR gold/13249
6006         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
6007         (Output_reloc::symbol_value): Return PLT offset if flag is set.
6008         * output.h (class Output_reloc): Add use_plt_offset flag.
6009         (Output_reloc::type_): Adjust size of bit field.
6010         (Output_reloc::use_plt_offset_): New bit field.
6011         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
6012         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
6013         flag.  Adjust all callers.
6014         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
6015         creating RELATIVE relocations.
6016
6017 2011-10-10  Nick Clifton  <nickc@redhat.com>
6018
6019         * po/es.po: Updated Spanish translation.
6020         * po/fi.po: Updated Finnish translation.
6021
6022 2011-10-03   Diego Novillo  <dnovillo@google.com>
6023
6024         * options.cc (parse_uint): Fix dereference of RETVAL.
6025
6026 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
6027
6028         * layout.h (section_order_map_): New member.
6029         (get_section_order_map): New member function.
6030         * output.cc (Output_section::add_input_section): Check for patterns
6031         only when --section-ordering-file is specified.
6032         * gold.cc (queue_middle_tasks): Delay updating order of sections till
6033         output_sections have been formed.
6034         * layout.cc (Layout_Layout): Initialize section_order_map_.
6035         * plugin.cc (update_section_order): Store order in order_map. Do not
6036         update the order.
6037         * testsuite/Makefile.am: Add test case for plugin_final_layout.
6038         * testsuite/Makefile.in: Regenerate.
6039         * testsuite/plugin_section_order.c: New file.
6040         * testsuite/plugin_final_layout.cc: New file.
6041         * testsuite/plugin_final_layout.sh: New file.
6042
6043 2011-09-29  Cary Coutant  <ccoutant@google.com>
6044
6045         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6046         Check for NULL.
6047         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
6048         symbols during incremental update.
6049         (Symbol_table::add_from_dynobj): Likewise.
6050
6051 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6052             Ian Lance Taylor  <iant@google.com>
6053
6054         * symtab.cc (Symbol_table::define_special_symbol): Always
6055         canonicalize version string.
6056
6057 2011-09-26  Cary Coutant  <ccoutant@google.com>
6058
6059         * gold.cc (queue_initial_tasks): Move option checks ...
6060         * options.cc (General_options::finalize): ... to here. Disable
6061         some options; make others fatal.
6062
6063 2011-09-26  Cary Coutant  <ccoutant@google.com>
6064
6065         gcc PR lto/47247
6066         * plugin.cc (get_symbols_v2): New function.
6067         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
6068         (is_referenced_from_outside): New function.
6069         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
6070         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
6071         (get_symbols): Pass version parameter.
6072         (get_symbols_v2): New function.
6073         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
6074         parameter.
6075         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
6076         (onload): Add LDPT_GET_SYMBOLS_V2.
6077         (all_symbols_read_hook): Use get_symbols_v2; check for
6078         LDPR_PREVAILING_DEF_IRONLY_EXP.
6079         * testsuite/plugin_test_3.sh: Update expected results.
6080
6081 2011-09-23  Simon Baldwin  <simonb@google.com>
6082
6083         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
6084         configuration options.
6085         * configure: Regenerate.
6086         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
6087         * Makefile.in: Regenerate.
6088         * testsuite/Makefile.in: Regenerate.
6089
6090 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
6091
6092         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
6093
6094 2011-09-19  Cary Coutant  <ccoutant@google.com>
6095
6096         * incremental.cc (can_incremental_update): Fix typo in comment.
6097         * incremental.h (can_incremental_update): Likewise.
6098
6099 2011-09-18  Cary Coutant  <ccoutant@google.com>
6100
6101         * incremental.cc (can_incremental_update): New function.
6102         * incremental.h (can_incremental_update): New function.
6103         * layout.cc (Layout::init_fixed_output_section): Call it.
6104         (Layout::make_output_section): Don't allow patch space in .eh_frame.
6105         * object.cc (Sized_relobj_file::do_layout): Call
6106         can_incremental_update.
6107
6108 2011-09-13  Cary Coutant  <ccoutant@google.com>
6109
6110         * configure.ac: Check for glibc support for gnu_indirect_function
6111         support with static linking, setting automake conditional
6112         IFUNC_STATIC.
6113         * Makefile.in: Regenerate.
6114         * configure: Regenerate.
6115
6116         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
6117         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
6118         for IFUNC_STATIC.
6119         * testsuite/Makefile.in: Regenerate.
6120
6121 2011-09-13  Cary Coutant  <ccoutant@google.com>
6122
6123         * incremental.cc (Sized_relobj_incr::do_layout): Call
6124         report_comdat_group for kept comdat sections.
6125         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
6126         * testsuite/Makefile.in: Regenerate.
6127         * testsuite/incr_comdat_test_1.cc: New source file.
6128         * testsuite/incr_comdat_test_2_v1.cc: New source file.
6129         * testsuite/incr_comdat_test_2_v2.cc: New source file.
6130         * testsuite/incr_comdat_test_2_v3.cc: New source file.
6131
6132 2011-09-13  Ian Lance Taylor  <iant@google.com>
6133
6134         * object.cc (Sized_relobj_file::do_layout): Remove unused local
6135         variable external_symbols_offset.
6136
6137 2011-09-12  Ian Lance Taylor  <iant@google.com>
6138
6139         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
6140         triggered if object has no symbols.
6141
6142 2011-09-09  David S. Miller  <davem@davemloft.net>
6143
6144         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
6145         (Output_fill_debug_line::do_write): Likewise.
6146
6147 2011-08-29  Cary Coutant  <ccoutant@google.com>
6148
6149         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
6150         casts to match formatting specs.
6151         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
6152
6153 2011-08-26  Cary Coutant  <ccoutant@google.com>
6154
6155         * layout.cc (Free_list::allocate): Provide guarantee of minimum
6156         remaining hole size when allocating.
6157         (Layout::make_output_section): Set fill methods for debug sections.
6158         * layout.h (Free_list::Free_list_node): Move from private to
6159         public.
6160         (Free_list::set_min_hole_size): New function.
6161         (Free_list::begin, Free_list::end): New functions.
6162         (Free_list::min_hole_): New data member.
6163         * output.cc: Include dwarf.h.
6164         (Output_fill_debug_info::do_minimum_hole_size): New function.
6165         (Output_fill_debug_info::do_write): New function.
6166         (Output_fill_debug_line::do_minimum_hole_size): New function.
6167         (Output_fill_debug_line::do_write): New function.
6168         (Output_section::Output_section): Initialize new data member.
6169         (Output_section::set_final_data_size): Ensure patch space is larger
6170         than minimum hole size.
6171         (Output_section::do_write): Fill holes in debug sections.
6172         * output.h (Output_fill): New class.
6173         (Output_fill_debug_info): New class.
6174         (Output_fill_debug_line): New class.
6175         (Output_section::set_free_space_fill): New function.
6176         (Output_section::free_space_fill_): New data member.
6177         * testsuite/Makefile.am (incremental_test_3): Add
6178         --incremental-patch option.
6179         (incremental_test_4): Likewise.
6180         (incremental_test_5): Likewise.
6181         (incremental_test_6): Likewise.
6182         (incremental_copy_test): Likewise.
6183         (incremental_common_test_1): Likewise.
6184         * testsuite/Makefile.in: Regenerate.
6185
6186 2011-08-26  Nick Clifton  <nickc@redhat.com>
6187
6188         * po/es.po: Updated Spanish translation.
6189
6190 2011-08-01  Cary Coutant  <ccoutant@google.com>
6191
6192         * testsuite/Makefile.am (justsyms_exec): New testcase.
6193         * testsuite/Makefile.in: Regenerate.
6194         * testsuite/justsyms_exec.c: New source file.
6195         * testsuite/justsyms_lib.c: New source file.
6196
6197 2011-08-01  Cary Coutant  <ccoutant@google.com>
6198
6199         * layout.cc (Layout::set_segment_offsets): Don't realign text
6200         segment if -Ttext was specified.
6201         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
6202         file type.
6203         * object.h (Sized_relobj_file::e_type): New function.
6204         (Sized_relobj_file::e_type_): New data member.
6205         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
6206         base address for ET_EXEC files.
6207         * target.cc (Target::do_make_elf_object_implementation): Allow
6208         ET_EXEC files with --just-symbols option.
6209
6210 2011-07-28  Cary Coutant  <ccoutant@google.com>
6211
6212         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
6213         Add thread_number parameter.
6214         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
6215         * workqueue-threads.cc
6216         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
6217         current thread if its thread number is greater than desired thread
6218         count.
6219         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
6220         Add thread_number parameter.
6221         (Workqueue::should_cancel_thread): Likewise.
6222         (Workqueue::find_runnable_or_wait): Pass thread_number to
6223         should_cancel_thread.
6224         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
6225         parameter.
6226
6227 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
6228
6229         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
6230         only after checking if it cannot be forced local.
6231         * symtab.h (is_externally_visible): Check if the symbol is not forced
6232         local.
6233
6234 2011-07-15  Ian Lance Taylor  <iant@google.com>
6235
6236         * options.h (class General_options): Add --print-output-format.
6237         Move -EL next to -EB, for  better --help output.
6238         * target-select.cc: Include <cstdio>, "options.h", and
6239         "parameters.h".
6240         (Target_selector::do_target_bfd_name): New function.
6241         (print_output_format): New function.
6242         * target-select.h (class Target_selector): Update declarations.
6243         (Target_selector::target_bfd_name): New function.
6244         (print_output_format): Declare.
6245         * main.cc: Include "target-select.h".
6246         (main): Handle --print-output-format.
6247         * gold.cc: Include "target-select.h".
6248         (queue_initial_tasks): Handle --print-output-format when there are
6249         no input files.
6250         * parameters.cc (parameters_force_valid_target): Give a better
6251         error message if -EB/-EL does not match target.
6252         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6253         function.
6254
6255 2011-07-15  Ian Lance Taylor  <iant@google.com>
6256
6257         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6258         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6259         (Output_data_plt_i386::do_write): Write address of .dynamic
6260         section to first entry in .got.plt section.
6261         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6262         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6263         Initialize layout_.
6264         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6265         section to first entry in .got.plt section.
6266         * layout.h (Layout::dynamic_section): New function.
6267
6268 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6269
6270         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6271         to claim_file call.
6272         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6273         input_section_position_, and input_section_glob_.
6274         (read_layout_from_file): Call function section_ordering_specified.
6275         * layout.h (is_section_ordering_specified): New function.
6276         (section_ordering_specified): New function.
6277         (section_ordering_specified_): New boolean member.
6278         * main.cc(main): Call load_plugins after layout object is defined.
6279         * output.cc (Output_section::add_input_section): Use
6280         function section_ordering_specified to check if section ordering is
6281         needed.
6282         * output.cc (Output_section::add_relaxed_input_section): Use
6283         function section_ordering_specified to check if section ordering is
6284         needed.
6285         (Output_section::update_section_layout): New function.
6286         (Output_section::sort_attached_input_sections): Check if input section
6287         must be reordered.
6288         * output.h (Output_section::update_section_layout): New function.
6289         * plugin.cc (get_section_count): New function.
6290         (get_section_type): New function.
6291         (get_section_name): New function.
6292         (get_section_contents): New function.
6293         (update_section_order): New function.
6294         (allow_section_ordering): New function.
6295         (Plugin::load): Add the new interfaces to the transfer vector.
6296         (Plugin_manager::load_plugins): New parameter.
6297         (Plugin_manager::all_symbols_read): New parameter.
6298         (Plugin_manager::claim_file): New parameter. Save the elf object for
6299         unclaimed objects.
6300         (Plugin_manager::get_elf_object): New function.
6301         (Plugin_manager::get_view): Change to directly use the bool to check
6302         if get_view is called from claim_file_hook.
6303         * plugin.h (input_objects): New function
6304         (Plugin__manager::load_plugins): New parameter.
6305         (Plugin_manager::claim_file): New parameter.
6306         (Plugin_manager::get_elf_object): New function.
6307         (Plugin_manager::in_claim_file_handler): New function.
6308         (Plugin_manager::in_claim_file_handler_): New member.
6309         (layout): New function.
6310         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6311         handler with an extra parameter. Make the elf object before calling
6312         claim_file handler.
6313         * testsuite/plugin_test.c (get_section_count): New function pointer.
6314         (get_section_type): New function pointer.
6315         (get_section_name): New function pointer.
6316         (get_section_contents): New function pointer.
6317         (update_section_order): New function pointer.
6318         (allow_section_ordering): New function pointer.
6319         (onload): Check if the new interfaces exist.
6320
6321 2011-07-13  Ian Lance Taylor  <iant@google.com>
6322
6323         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6324         relro section.
6325         * x86_64.cc (Target_x86_64::got_section): Likewise.
6326         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6327         (relro_now_test_SOURCES): New variable.
6328         (relro_now_test_DEPENDENCIES): New variable.
6329         (relro_now_test_LDFLAGS): New variable.
6330         (relro_now_test_LDADD): New variable.
6331         (relro_now_test.so): New target.
6332         * testsuite/Makefile.in: Rebuild.
6333
6334 2011-07-12  Ian Lance Taylor  <iant@google.com>
6335
6336         PR gold/12980
6337         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6338         GLOB_DAT relocation rather than a RELATIVE relocation for a
6339         protected symbol when creating a shared library.
6340         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6341         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6342         * testsuite/protected_main_1.cc (main): Test that protected
6343         function has same address.
6344
6345 2011-07-11  Ian Lance Taylor  <iant@google.com>
6346
6347         PR gold/12979
6348         * options.h (class General_options): Add -Bgroup.
6349         * options.cc (General_options::finalize): If -Bgroup is set,
6350         default to --unresolved-symbols=report-all.
6351         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6352         * target-reloc.h (issue_undefined_symbol_error): Handle
6353         --unresolved-symbols=report-all.
6354
6355 2011-07-08  Ian Lance Taylor  <iant@google.com>
6356
6357         PR gold/11985
6358         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6359         if linker script discards key sections.
6360         (Layout::create_dynamic_symtab): Likewise.
6361         (Layout::assign_local_dynsym_offsets): Likewise.
6362         (Layout::sized_create_version_sections): Likewise.
6363         (Layout::create_interp): Likewise.
6364         (Layout::finish_dynamic_section): Likewise.
6365         (Layout::set_dynamic_symbol_size): Likewise.
6366
6367 2011-07-08  Ian Lance Taylor  <iant@google.com>
6368
6369         PR gold/12386
6370         * options.h (class General_options): Add --unresolved-symbols.
6371         * target-reloc.h (issue_undefined_symbol_error): Check
6372         --unresolved-symbols.  Add comments.
6373
6374 2011-07-08  Ian Lance Taylor  <iant@google.com>
6375
6376         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6377         expression more complex.
6378
6379 2011-07-08  Ian Lance Taylor  <iant@google.com>
6380
6381         PR gold/11317
6382         * target-reloc.h (issue_undefined_symbol_error): New inline
6383         function, broken out of relocate_section.
6384         (relocate_section): Call issue_undefined_symbol_error.
6385         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6386         there is no TLS segment if we are about to issue an undefined
6387         symbol error.
6388         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6389
6390 2011-07-08  Ian Lance Taylor  <iant@google.com>
6391
6392         PR gold/12279
6393         * resolve.cc (Symbol_table::should_override): Add fromtype
6394         parameter.  Change all callers.  Give error when linking together
6395         TLS and non-TLS symbol.
6396         (Symbol_table::should_override_with_special): Add fromtype
6397         parameter.  Change all callers.
6398         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6399         there is no TLS segment if we have reported some errors.
6400         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6401
6402 2011-07-08  Ian Lance Taylor  <iant@google.com>
6403
6404         PR gold/12372
6405         * target.h (Target::plt_address_for_global): New function.
6406         (Target::plt_address_for_local): New function.
6407         (Target::plt_section_for_global): Remove.
6408         (Target::plt_section_for_local): Remove.
6409         (Target::do_plt_address_for_global): New virtual function.
6410         (Target::do_plt_address_for_local): New virtual function.
6411         (Target::do_plt_section_for_global): Remove.
6412         (Target::do_plt_section_for_local): Remove.
6413         (Target::register_global_plt_entry): Add Symbol_table and Layout
6414         parameters.
6415         * output.cc (Output_data_got::Got_entry::write): Use
6416         plt_address_for_global and plt_address_for_local.
6417         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6418         address of output section.
6419         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6420         got_irelative_, and irelative_count_ fields.  Update
6421         declarations.
6422         (Output_data_plt_i386::has_irelative_section): New function.
6423         (Output_data_plt_i386::entry_count): Add irelative_count_.
6424         (Output_data_plt_i386::set_final_data_size): Likewise.
6425         (class Target_i386): Add got_irelative_ and rel_irelative_
6426         fields.  Update declarations.
6427         (Target_i386::Target_i386): Initialize new fields.
6428         (Target_i386::do_plt_address_for_global): New function replacing
6429         do_plt_section_for_global.
6430         (Target_i386::do_plt_address_for_local): New function replacing
6431         do_plt_section_for_local.
6432         (Target_i386::got_section): Create got_irelative_.
6433         (Target_i386::rel_irelative_section): New function.
6434         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6435         fields.  Don't define __rel_iplt_{start,end}.
6436         (Output_data_plt_i386::add_entry): Add symtab and layout
6437         parameters.  Change all callers.  Use different PLT and GOT for
6438         IFUNC symbols.
6439         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6440         layout parameters.  Change all callers.  Use different PLT and
6441         GOT.
6442         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6443         (Output_data_plt_i386::rel_irelative): New function.
6444         (Output_data_plt_i386::address_for_global): New function.
6445         (Output_data_plt_i386::address_for_local): New function.
6446         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6447         IRELATIVE GOT when changing IFUNC GOT entries.
6448         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6449         reloc.
6450         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6451         if we didn't create an IRELATIVE GOT.
6452         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6453         plt_address_for_local.
6454         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6455         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6456         got_irelative_, and irelative_count_ fields.  Update
6457         declarations.
6458         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6459         Initialize new fields.  Remove symtab parameter.  Change all
6460         callers.
6461         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6462         irelative_count_.
6463         (Output_data_plt_x86_64::has_irelative_section): New function.
6464         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6465         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6466         fields.  Update declarations.
6467         (Target_x86_64::Target_x86_64): Initialize new fields.
6468         (Target_x86_64::do_plt_address_for_global): New function replacing
6469         do_plt_section_for_global.
6470         (Target_x86_64::do_plt_address_for_local): New function replacing
6471         do_plt_section_for_local.
6472         (Target_x86_64::got_section): Create got_irelative_.
6473         (Target_x86_64::rela_irelative_section): New function.
6474         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6475         all callers.  Don't create __rel_iplt_{start,end}.
6476         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6477         parameters.  Change all callers.  Use different PLT and GOT for
6478         IFUNC symbols.
6479         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6480         layout parameters.  Change all callers.  Use different PLT and
6481         GOT.
6482         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6483         parameters.  Change all callers.  Use different PLT and GOT for
6484         IFUNC symbols.
6485         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6486         (Output_data_plt_x86_64::rela_irelative): New function.
6487         (Output_data_plt_x86_64::address_for_global): New function.
6488         (Output_data_plt_x86_64::address_for_local): New function.
6489         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6490         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6491         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6492         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6493         parameters.
6494         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6495         reloc.
6496         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6497         symbols if we didn't create an IRELATIVE GOT.
6498         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6499         plt_address_for_local.
6500         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6501         * testsuite/ifuncvar1.c: New test file.
6502         * testsuite/ifuncvar2.c: New test file.
6503         * testsuite/ifuncvar3.c: New test file.
6504         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6505         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6506         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6507         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6508         * testsuite/Makefile.in: Rebuild.
6509
6510 2011-07-07  Cary Coutant  <ccoutant@google.com>
6511
6512         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6513         (two_file_test_1_ndebug.o): Likewise.
6514         (two_file_test_1b_ndebug.o): Likewise.
6515         (two_file_test_2_ndebug.o): Likewise.
6516         (two_file_test_main_ndebug.o): Likewise.
6517         (incremental_test_2): Link with no-debug versions.
6518
6519 2011-07-06  Cary Coutant  <ccoutant@google.com>
6520
6521         * incremental.cc
6522         (Output_section_incremental_inputs::write_info_blocks): Check for
6523         hidden and internal symbols.
6524
6525 2011-07-06  Cary Coutant  <ccoutant@google.com>
6526
6527         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6528         Check disposition for startup file.
6529         (Incremental_inputs::report_command_line): Ignore
6530         --incremental-startup-unchanged option.
6531         * options.cc (General_options::parse_incremental_startup_unchanged):
6532         New function.
6533         (General_options::General_options): Initialize new data member.
6534         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6535         (General_options): Add --incremental-startup-unchanged option.
6536         (General_options::incremental_startup_disposition): New function.
6537         (General_options::incremental_startup_disposition_): New data member.
6538
6539 2011-07-06  Cary Coutant  <ccoutant@google.com>
6540
6541         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6542         input file index to Script_info ctor.
6543         (Sized_incremental_binary::do_file_has_changed): Find the
6544         command-line argument for files named in scripts.
6545         * incremental.h (Script_info::Script_info): New ctor
6546         with input file index.
6547         (Script_info::input_file_index): New function.
6548         (Script_info::input_file_index_): New data member.
6549         (Incremental_binary::get_library): Add const.
6550         (Incremental_binary::get_script_info): Add const.
6551         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6552         * testsuite/Makefile.am (incremental_test_5): New test case.
6553         (incremental_test_6): New test case.
6554         * testsuite/Makefile.in: Regenerate.
6555
6556 2011-07-06  Cary Coutant  <ccoutant@google.com>
6557
6558         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6559         debug output when command lines differ.
6560
6561 2011-07-06  Cary Coutant  <ccoutant@google.com>
6562
6563         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6564         --incremental-patch option.
6565         * layout.cc (Free_list::allocate): Extend allocation beyond original
6566         end if enabled.
6567         (Layout::make_output_section): Mark sections that should get
6568         patch space.
6569         * options.cc (parse_percent): New function.
6570         * options.h (parse_percent): New function.
6571         (DEFINE_percent): New macro.
6572         (General_options): Add --incremental-patch option.
6573         * output.cc (Output_section::Output_section): Initialize new data
6574         members.
6575         (Output_section::add_input_section): Print section name when out
6576         of patch space.
6577         (Output_section::add_output_section_data): Likewise.
6578         (Output_section::set_final_data_size): Add patch space when
6579         doing --incremental-full.
6580         (Output_section::do_reset_address_and_file_offset): Remove patch
6581         space.
6582         (Output_segment::set_section_list_addresses): Print debug output
6583         only if --incremental-update.
6584         * output.h (Output_section::set_is_patch_space_allowed): New function.
6585         (Output_section::is_patch_space_allowed_): New data member.
6586         (Output_section::patch_space_): New data member.
6587         * parameters.cc (Parameters::incremental_full): New function.
6588         * parameters.h (Parameters::incremental_full): New function
6589         * testsuite/Makefile.am (incremental_test_2): Add test for
6590         --incremental-patch option.
6591         * testsuite/Makefile.in: Regenerate.
6592         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6593         (t18): Remove function body.
6594
6595 2011-07-05  Doug Kwan  <dougkwan@google.com>
6596
6597         PR gold/12771
6598         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6599         Arm_Address type for relocation result.
6600         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6601         overflow check.
6602         (Arm_relocate_functions::abs32): Use unaligned access.
6603         (Arm_relocate_functions::rel32): Ditto.
6604         (Arm_relocate_functions::prel31): Ditto.
6605         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6606         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6607         static data relocations.
6608         * testsuite/Makefile.in: Regnerate.
6609         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6610
6611 2011-07-05  Ian Lance Taylor  <iant@google.com>
6612
6613         PR gold/12392
6614         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6615         symbols if necessary.
6616         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6617
6618 2011-07-05  Ian Lance Taylor  <iant@google.com>
6619
6620         PR gold/12952
6621         * resolve.cc (Symbol::override_base_with_special): Simply override
6622         version with special symbol version, ignoring previous version.
6623
6624 2011-07-05  Ian Lance Taylor  <iant@google.com>
6625
6626         * object.cc (Sized_relobj_file::include_section_group): Add
6627         information to comment about signature location.
6628
6629 2011-07-02  Ian Lance Taylor  <iant@google.com>
6630
6631         PR gold/12957
6632         * options.h (class General_options): Add -f and -F.
6633         * options.cc (General_options::finalize): Fatal error if -f/-F
6634         are used without -shared.
6635         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6636
6637 2011-07-02  Ian Lance Taylor  <iant@google.com>
6638
6639         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6640
6641 2011-07-01  Ian Lance Taylor  <iant@google.com>
6642
6643         PR gold/12525
6644         PR gold/12952
6645         * resolve.cc (Symbol::override_base_with_special): Don't override
6646         the version if the overriding symbol has a different name.
6647         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6648         all callers.  If we give an error about an undefined version,
6649         define the base version if necessary.
6650         * dynobj.h (class Versions): Update declaration.
6651         * testsuite/weak_alias_test_5.cc: New file.
6652         * testsuite/weak_alias_test.script: New file.
6653         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6654         and versioned_alias have the right value, and call t2.
6655         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6656         weak_alias_test_5.so.
6657         (weak_alias_test_LDADD): Likewise.
6658         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6659         * testsuite/Makefile.in: Rebuild.
6660
6661 2011-07-01  Ian Lance Taylor  <iant@google.com>
6662
6663         PR gold/12525
6664         * options.h (class General_options): Support -z notext.
6665         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6666         -Wl,-z,notext.
6667         (two_file_shared_nonpic.so): Likewise.
6668         (two_file_shared_mixed.so): Likewise.
6669         (two_file_shared_mixed_1.so): Likewise.
6670         (weak_undef_lib_nonpic.so): Likewise.
6671         (alt/weak_undef_lib_nonpic.so): Likewise.
6672         (tls_test_shared_nonpic.so): Likewise.
6673         * testsuite/Makefile.in: Rebuild.
6674
6675 2011-07-01  Ian Lance Taylor  <iant@google.com>
6676
6677         PR gold/12525
6678         * configure.ac: Test whether static linking works, setting
6679         the automake conditional HAVE_STATIC.
6680         * testsuite/Makefile.am: Disable tests using -static if
6681         HAVE_STATIC is not true.
6682         * configure, testsuite/Makefile.in: Rebuild.
6683
6684 2011-07-01  Ian Lance Taylor  <iant@google.com>
6685
6686         PR gold/12525
6687         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6688         Assert if we see DW_EH_PE_indirect.
6689         * target.h (Target::ehframe_datarel_base): New function.
6690         (Target::do_ehframe_datarel_base): New target function.
6691         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6692         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6693         function.
6694
6695 2011-07-01  Ian Lance Taylor  <iant@google.com>
6696
6697         PR gold/12571
6698         * options.h (class General_options): Add
6699         --ld-generated-unwind-info.
6700         * ehframe.cc (Fde::write): Add address parameter.  Change all
6701         callers.  If associated with PLT, fill in address and size.
6702         (Cie::set_output_offset): Only add merge mapping if there is an
6703         object.
6704         (Cie::write): Add address parameter.  Change all callers.
6705         (Eh_frame::add_ehframe_for_plt): New function.
6706         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6707         input_offset_ fields into union u_, with new plt field.
6708         (Fde::Fde): Adjust for new union field.
6709         (Fde::Fde) [Output_data version]: New constructor.
6710         (Fde::add_mapping): Only add merge mapping if there is an object.
6711         (class Cie): Update declarations.
6712         (class Eh_frame): Declare add_ehframe_for_plt.
6713         * layout.cc (Layout::layout_eh_frame): Break out code into
6714         make_eh_frame_section, and call it.
6715         (Layout::make_eh_frame_section): New function.
6716         (Layout::add_eh_frame_for_plt): New function.
6717         * layout.h (class Layout): Update declarations.
6718         * merge.cc (Merge_map::add_mapping): Add assertion.
6719         * i386.cc: Include "dwarf.h".
6720         (class Output_data_plt_i386): Make first_plt_entry,
6721         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6722         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6723         and plt_eh_frame_fde.
6724         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6725         boundary.  Call add_eh_frame_for_plt if appropriate.
6726         * x86_64.cc: Include "dwarf.h".
6727         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6728         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6729         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6730         and plt_eh_frame_fde.
6731         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6732         appropriate.
6733
6734 2011-06-29  Ian Lance Taylor  <iant@google.com>
6735
6736         PR gold/12629
6737         * object.cc (Sized_relobj_file::layout_section): Change shdr
6738         parameter to be const.
6739         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6740         out of do_layout.
6741         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6742         appropriate.  Call layout_eh_frame_section.
6743         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6744         sections.
6745         * object.h (class Sized_relobj_file): Update declarations.
6746
6747 2011-06-29  Ian Lance Taylor  <iant@google.com>
6748
6749         PR gold/12652
6750         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6751         modifier.
6752         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6753
6754 2011-06-29  Ian Lance Taylor  <iant@google.com>
6755
6756         PR gold/12675
6757         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6758         SHT_X86_64_UNWIND.
6759         * layout.cc (Layout::layout_eh_frame): Likewise.
6760
6761 2011-06-29  Ian Lance Taylor  <iant@google.com>
6762
6763         PR gold/12695
6764         * layout.cc (Layout::symtab_section_shndx): New function.
6765         * layout.h (class Layout): Declare symtab_section_shndx.
6766         * output.cc (Output_section::write_header): Call it.
6767
6768 2011-06-29  Ian Lance Taylor  <iant@google.com>
6769
6770         PR gold/12818
6771         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6772         symbols which are not used in a relocation.
6773
6774 2011-06-28  Ian Lance Taylor  <iant@google.com>
6775
6776         PR gold/12898
6777         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6778         script create indistinguishable segments.
6779         (Layout::set_segment_offsets): Use stable_sort when sorting
6780         segments.  Pass this to Compare_segments constructor.
6781         * layout.h (class Layout): Make segment_precedes non-static.
6782         (class Compare_segments): Change from struct to class.  Add
6783         layout_ field.  Add constructor.
6784         * script-sections.cc
6785         (Script_sections::attach_sections_using_phdrs_clause): Rename
6786         local orphan to is_orphan.  Don't report failure to put empty
6787         section in segment.  On attachment failure, report name of
6788         section, and attach to first PT_LOAD segment.
6789
6790 2011-06-28  Ian Lance Taylor  <iant@google.com>
6791
6792         PR gold/12934
6793         * target-select.cc (Target_selector::Target_selector): Add
6794         emulation parameter.  Change all callers.
6795         (select_target_by_bfd_name): Rename from select_target_by_name.
6796         Change all callers.
6797         (select_target_by_emulation): New function.
6798         (supported_emulation_names): New function.
6799         * target-select.h (class Target_selector): Add emulation_ field.
6800         Update declarations.
6801         (Target_selector::recognize_by_bfd_name): Rename from
6802         recognize_by_name.  Change all callers.
6803         (Target_selector::supported_bfd_names): Rename from
6804         supported_names.  Change all callers.
6805         (Target_selector::recognize_by_emulation): New function.
6806         (Target_selector::supported_emulations): New function.
6807         (Target_selector::emulation): New function.
6808         (Target_selector::do_recognize_by_bfd_name): Rename from
6809         do_recognize_by_name.  Change all callers.
6810         (Target_selector::do_supported_bfd_names): Rename from
6811         do_supported_names.  Change all callers.
6812         (Target_selector::do_recognize_by_emulation): New function.
6813         (Target_selector::do_supported_emulations): New function.
6814         (select_target_by_bfd_name): Change name in declaration.
6815         (select_target_by_emulation): Declare.
6816         (supported_emulation_names): Declare.
6817         * parameters.cc (parameters_force_valid_target): Try to find
6818         target based on emulation from -m option.
6819         * options.h (class General_options): Change doc string for -m.
6820         * options.cc (help): Print emulations.
6821         (General_options::parse_V): Likewise.
6822         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6823         Add emulation parameter.  Change all callers.
6824
6825 2011-06-28  Ian Lance Taylor  <iant@google.com>
6826
6827         * target.h (class Target): Add osabi_ field.
6828         (Target::osabi): New function.
6829         (Target::set_osabi): New function.
6830         (Target::Target): Initialize osabi_.
6831         (Target::do_adjust_elf_header): Make pure virtual.
6832         (Sized_target::do_adjust_elf_header): Declare.
6833         * target.cc (Sized_target::do_adjust_elf_header): New function.
6834         (class Sized_target): Instantiate all versions.
6835         * freebsd.h (class Target_freebsd): Remove.
6836         (Target_selector_freebsd::do_recognize): Call set_osabi on
6837         Target.
6838         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6839         (Target_selector_freebsd::set_osabi): Remove.
6840         * i386.cc (class Target_i386): Inherit from Sized_target rather
6841         than Target_freebsd.
6842         * x86_64.cc (class Target_x86_64): Likewise.
6843
6844 2011-06-28  Ian Lance Taylor  <iant@google.com>
6845
6846         * target.h (Target::can_check_for_function_pointers): Rewrite.
6847         Make non-virtual.
6848         (Target::can_icf_inline_merge_sections): Likewise.
6849         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6850         (Target::Target_info): Add can_icf_inline_merge_sections field.
6851         (Target::do_can_check_for_function_pointers): New virtual
6852         function.
6853         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6854         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6855         from can_check_for_function_pointers, move in file.
6856         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6857         section_may_have_icf_unsafe_poineters, move in file.
6858         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6859         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6860         Rename from can_check_for_function_pointers, move in file.
6861         (Target_i386::can_icf_inline_merge_sections): Remove.
6862         (Target_i386::i386_info): Initialize
6863         can_icf_inline_merge_sections.
6864         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6865         Initialize can_icf_inline_merge_sections.
6866         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6867         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6868         Rename from can_check_for_function_pointers, move in file.
6869         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6870         (Target_x86_64::x86_64_info): Initialize
6871         can_icf_inline_merge_sections.
6872         * testsuite/testfile.cc (Target_test::test_target_info):
6873         Likewise.
6874         * icf.cc (get_section_contents): Correct formatting.
6875
6876 2011-06-27  Ian Lance Taylor  <iant@google.com>
6877
6878         * symtab.cc (Symbol::versioned_name): New function.
6879         (Symbol_table::add_to_final_symtab): Use versioned_name when
6880         appropriate.
6881         (Symbol_table::sized_write_symbol): Likewise.
6882         * symtab.h (class Symbol): Declare versioned_name.
6883         * stringpool.h (class Stringpool_template): Add variant of add
6884         which takes a std::basic_string.
6885         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6886         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6887         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6888         (ver_test_12.o): New target.
6889         * testsuite/Makefile.in: Rebuild.
6890
6891 2011-06-27  Doug Kwan  <dougkwan@google.com>
6892
6893         * arm.cc (Arm_relocate_functions::thm_jump8,
6894         Arm_relocate_functions::thm_jump11): Use a wider signed
6895         type to compute offset.
6896         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6897         arm_thm_jump8.
6898         * testsuite/Makefile.in: Regenerate.
6899         * testsuite/arm_branch_in_range.sh: Check test results of
6900         arm_thm_jump11 and arm_thm_jump8.
6901         * testsuite/arm_thm_jump11.s: New test source file.
6902         * testsuite/arm_thm_jump11.t: New linker script.
6903         * testsuite/arm_thm_jump8.s: New test source file.
6904         * testsuite/arm_thm_jump8.t: New linker script.
6905
6906 2011-06-24  Ian Lance Taylor  <iant@google.com>
6907
6908         * layout.cc: Include "object.h".
6909         (ctors_sections_in_init_array): New static variable.
6910         (Layout::is_ctors_in_init_array): New function.
6911         (Layout::layout): Add entry to ctors_sections_in_init_array if
6912         appropriate.
6913         * layout.h (class Layout): Declare is_ctors_in_init_array.
6914         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6915         is_ctors_reverse_view is set.
6916         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6917         all callers.  Set is_ctors_reverse_view field of View_size.
6918         (Sized_relobj_file::reverse_words): New function.
6919         * object.h (Sized_relobj_file::View_size): Add
6920         is_ctors_reverse_view field.
6921         (class Sized_relobj_file): Update declarations.
6922         * testsuite/initpri3.c: New test.
6923         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6924         initpri3b.
6925         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6926         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6927         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6928         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6929         * testsuite/Makefile.in: Rebuild.
6930
6931 2011-06-24  Cary Coutant  <ccoutant@google.com>
6932
6933         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6934         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6935         (debug_msg_cdebug.err): New targets.
6936         * testsuite/Makefile.in: Regenerate.
6937         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6938         Fix checks for link with shared library.
6939
6940 2011-06-24  Doug Kwan  <dougkwan@google.com>
6941
6942         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6943         skip empty text sections.
6944         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6945
6946 2011-06-22  Ian Lance Taylor  <iant@google.com>
6947
6948         PR gold/12910
6949         * options.h (class General_options): Add --ctors-in-init-array.
6950         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6951         friends as SHT_PROGBITS for merging sections.
6952         (Layout::layout): Remove special handling of .init_array and
6953         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6954         and .dtors if ctors_in_init_array.
6955         (Layout::make_output_section): Force correct section types for
6956         .init_array and friends.  Don't sort if doing relocatable link,
6957         Don't sort .ctors and .dtors if ctors_in_init_array.
6958         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6959         (Layout::output_section_name): Add relobj parameter.  Change all
6960         callers.  Handle .ctors. and .dtors. in code rather than table.
6961         Handle .ctors and .dtors if ctors_in_init_array.
6962         (Layout::match_file_name): New function, moved from output.cc.
6963         * layout.h (class Layout): Update declarations.
6964         * output.cc: Include "layout.h".
6965         (Input_section_sort_entry::get_priority): New function.
6966         (Input_section_sort_entry::match_file_name): Just call
6967         Layout::match_file_name.
6968         (Output_section::Input_section_sort_init_fini_compare::operator()):
6969         Handle .ctors and .dtors.  Sort by explicit priority rather than
6970         by name.
6971         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6972         * testsuite/initpri2.c: New test.
6973         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6974         (check_PROGRAMS): Add initpri2.
6975         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6976         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6977         * configure, testsuite/Makefile.in: Rebuild.
6978
6979 2011-06-19  Ian Lance Taylor  <iant@google.com>
6980
6981         PR gold/12880
6982         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6983         .interp section to a PT_INTERP segment even if we have seen a
6984         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6985         clause in a linker script.
6986         (Layout::finalize): Don't create a .interp section if we've
6987         already create a PT_INTERP segment.
6988         (Layout::create_interp): Always call choose_output_section (revert
6989         patch of 2011-06-17).  Don't create PT_INTERP segment.
6990         * script-sections.cc
6991         (Script_sections::create_note_and_tls_segments): Add a .interp
6992         section to a PT_INTERP segment even if we have seen a
6993         --dynamic-linker option.
6994
6995 2011-06-18  Ian Lance Taylor  <iant@google.com>
6996
6997         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6998         merely because a non-PT_LOAD segment has a dynamic reloc.
6999
7000 2011-06-18  Ian Lance Taylor  <iant@google.com>
7001
7002         * layout.cc (Layout::finish_dynamic_section): Don't create
7003         DT_FLAGS entry if not needed.
7004
7005 2011-06-18  Ian Lance Taylor  <iant@google.com>
7006
7007         PR gold/12745
7008         * layout.cc (Layout::layout_eh_frame): Correct handling of
7009         writable .eh_frame section.
7010
7011 2011-06-17  Ian Lance Taylor  <iant@google.com>
7012
7013         PR gold/12893
7014         * resolve.cc (Symbol_table::resolve): Don't give an error if a
7015         symbol is redefined with the exact same object and value.
7016
7017 2011-06-17  Ian Lance Taylor  <iant@google.com>
7018
7019         PR gold/12880
7020         * layout.h (class Layout): Add interp_segment_ field.
7021         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
7022         (Layout::attach_allocated_section_to_segment): If making shared
7023         library, put .interp section in PT_INTERP segment.
7024         (Layout::finalize): Also call create_interp if -dynamic-linker
7025         option was used.
7026         (Layout::create_interp): Assert that there is no PT_INTERP
7027         segment.  If not using a SECTIONS clause, use make_output_section.
7028         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
7029         * script-sections.cc
7030         (Script_sections::create_note_and_tls_segments): If making shared
7031         library, put .interp section in PT_INTERP segment.
7032
7033 2011-06-17  Ian Lance Taylor  <iant@google.com>
7034
7035         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
7036         when making a shared library.
7037
7038 2011-06-17  Ian Lance Taylor  <iant@google.com>
7039
7040         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
7041         parameter.  Change all callers.  Don't issue warning about PC32
7042         against locally defined symbol.
7043
7044 2011-06-16  Ian Lance Taylor  <iant@google.com>
7045
7046         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
7047         occurs in same object.
7048
7049 2011-06-14  Alan Modra  <amodra@gmail.com>
7050
7051         * po/POTFILES.in: Regenerate.
7052
7053 2011-06-09  Ian Lance Taylor  <iant@google.com>
7054
7055         * script-sections.cc
7056         (Orphan_output_section::set_section_addresses): For a relocatable
7057         link set address to 0.
7058
7059 2011-06-09  Cary Coutant  <ccoutant@google.com>
7060
7061         PR gold/12804
7062         * gold.cc (queue_initial_tasks): Warn if --incremental is
7063         used with --compress-debug-sections.
7064         * object.cc (Sized_relobj_file::do_layout): Report
7065         uncompressed size of compressed input sections.
7066
7067 2011-06-08  Cary Coutant  <ccoutant@google.com>
7068
7069         PR gold/12804
7070         * testsuite/two_file_test_2_v1.cc: Change initialization of
7071         v2 to keep it in .data.
7072
7073 2011-06-07  Cary Coutant  <ccoutant@google.com>
7074
7075         * common.cc (Symbol_table::do_allocate_commons_list): Call
7076         gold_fallback.
7077         * errors.cc (Errors::fatal): Adjust call to gold_exit.
7078         (Errors::fallback): New function.
7079         (gold_fallback): New function.
7080         * errors.h (Errors::fallback): New function.
7081         * gold.cc (gold_exit): Change status parameter to enum; adjust
7082         all callers.
7083         (queue_initial_tasks): Call gold_fallback.
7084         * gold.h: Include cstdlib.
7085         (Exit_status): New enum type.
7086         (gold_exit): Change status parameter to enum.
7087         (gold_fallback): New function.
7088         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
7089         (Layout::create_symtab_sections): Likewise.
7090         (Layout::create_shdrs): Likewise.
7091         * main.cc (main): Adjust call to gold_exit.
7092         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
7093         (Output_data_got::add_got_entry_pair): Likewise.
7094         (Output_section::add_input_section): Likewise.
7095         (Output_section::add_output_section_data): Likewise.
7096         (Output_segment::set_section_list_addresses): Likewise.
7097         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
7098
7099 2011-06-07  Cary Coutant  <ccoutant@google.com>
7100
7101         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
7102         for incremental links.
7103         * output.cc (Output_segment::set_section_list_addresses): Remove
7104         FIXME and test for TLS or BSS.
7105
7106 2011-06-07  Cary Coutant  <ccoutant@google.com>
7107
7108         * testsuite/Makefile.am: Add incremental_copy_test,
7109         incremental_common_test_1.
7110         * testsuite/Makefile.in: Regenerate.
7111         * testsuite/common_test_1_v1.c: New source file.
7112         * testsuite/common_test_1_v2.c: New source file.
7113         * testsuite/copy_test_v1.cc: New source file.
7114
7115 2011-06-07  Cary Coutant  <ccoutant@google.com>
7116
7117         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
7118         update, allocate common from bss section's free list.
7119         * incremental-dump.cc (dump_incremental_inputs): Print flag for
7120         linker-defined symbols.
7121         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
7122         Skip GOT and PLT entries that are no longer referenced.
7123         (Output_section_incremental_inputs::write_info_blocks): Mark
7124         linker-defined symbols.
7125         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
7126         * output.cc (Output_section::allocate): New function.
7127         * output.h (Output_section::allocate): New function.
7128         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
7129         linker-defined symbols.
7130         (Symbol::override_base_with_special): Copy is_predefined_ flag.
7131         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
7132         (Symbol::init_base_output_data): Likewise.
7133         (Symbol::init_base_output_segment): Likewise.
7134         (Symbol::init_base_constant): Likewise.
7135         (Sized_symbol::init_output_data): Likewise.
7136         (Sized_symbol::init_output_segment): Likewise.
7137         (Sized_symbol::init_constant): Likewise.
7138         (Symbol_table::do_define_in_output_data): Likewise.
7139         (Symbol_table::do_define_in_output_segment): Likewise.
7140         (Symbol_table::do_define_as_constant): Likewise.
7141         * symtab.h (Symbol::is_predefined): New function.
7142         (Symbol::init_base_output_data): Add is_predefined parameter.
7143         (Symbol::init_base_output_segment): Likewise.
7144         (Symbol::init_base_constant): Likewise.
7145         (Symbol::is_predefined_): New data member.
7146         (Sized_symbol::init_output_data): Add is_predefined parameter.
7147         (Sized_symbol::init_output_segment): Likewise.
7148         (Sized_symbol::init_constant): Likewise.
7149         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
7150
7151 2011-06-07  Cary Coutant  <ccoutant@google.com>
7152
7153         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
7154         instead of emit_copy_reloc.
7155         (Copy_relocs::emit_copy_reloc): Refactor.
7156         (Copy_relocs::make_copy_reloc): New function.
7157         (Copy_relocs::add_copy_reloc): Remove.
7158         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
7159         section.
7160         (Copy_relocs::make_copy_reloc): New function.
7161         (Copy_relocs::add_copy_reloc): Remove.
7162         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
7163         unchanged input files.
7164         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
7165         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
7166         Reserve BSS space for COPY relocations.
7167         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7168         (Output_section_incremental_inputs::write_info_blocks): Record
7169         whether a symbol is copied from a shared object.
7170         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
7171         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
7172         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
7173         (Incremental_input_entry_reader::get_output_symbol_index): Add
7174         is_copy parameter.
7175         (Incremental_binary::emit_copy_relocs): New function.
7176         (Incremental_binary::do_emit_copy_relocs): New function.
7177         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7178         new data member.
7179         (Sized_incremental_binary::add_copy_reloc): New function.
7180         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7181         (Sized_incremental_binary::Copy_reloc): New struct.
7182         (Sized_incremental_binary::Copy_relocs): New typedef.
7183         (Sized_incremental_binary::copy_relocs_): New data member.
7184         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
7185         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
7186         * target.h (Sized_target::emit_copy_reloc): New function.
7187         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
7188
7189 2011-06-02  Cary Coutant  <ccoutant@google.com>
7190
7191         PR gold/12163
7192         * archive.cc (Archive::Archive): Initialize new data member.
7193         (Archive::include_all_members): Return if archive has already been
7194         included.
7195         * archive.h (Archive::include_all_members_): New data member.
7196
7197 2011-06-02  Nick Clifton  <nickc@redhat.com>
7198
7199         * dynobj.h: Fix spelling mistake in comment.
7200         * output.cc: Likewise.
7201
7202 2011-05-31  Doug Kwan  <dougkwan@google.com>
7203             Asier Llano
7204
7205         PR gold/12826
7206         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
7207         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
7208         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
7209         redundant arm_exidx_test.so.
7210         * testsuite/Makefile.in: Regenerate.
7211         (check_SCRIPTS): Add pr12826.sh
7212         (check_DATA): Add pr12826.stdout
7213         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
7214         * testsuite/pr12826.sh: New file.
7215         * testsuite/pr12826_1.s: Ditto.
7216         * testsuite/pr12826_1.s: Ditto.
7217
7218 2011-05-30  Ian Lance Taylor  <iant@google.com>
7219
7220         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
7221         sections.
7222
7223 2011-05-29  Ian Lance Taylor  <iant@google.com>
7224
7225         PR gold/12804
7226         * testsuite/Makefile.am: Use different file name for two_file_test
7227         temporary file for each incremental test.
7228         * testsuite/Makefile.in: Rebuild.
7229
7230 2011-05-29  Ian Lance Taylor  <iant@google.com>
7231
7232         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7233         binary input file is empty.
7234
7235 2011-05-27  Ian Lance Taylor  <iant@google.com>
7236
7237         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7238         (ver_test_9.so): Likewise.
7239         * testsuite/Makefile.in: Rebuild.
7240
7241 2011-05-26 Cary Coutant  <ccoutant@google.com>
7242
7243         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7244         * incremental.cc (Incremental_inputs::report_input_section): Fix
7245         comment, indentation.
7246         (Incremental_inputs::report_comdat_group): New function.
7247         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7248         of data for incremental input file entry.
7249         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7250         group count, COMDAT group signatures.
7251         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7252         an unchanged input file.
7253         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7254         Initialize new data member.
7255         (Incremental_object_entry::add_comdat_group): New function.
7256         (Incremental_object_entry::get_comdat_group_count): New function.
7257         (Incremental_object_entry::get_comdat_signature_key): New function.
7258         (Incremental_object_entry::groups_): New data member.
7259         (Incremental_inputs::report_comdat_group): New function.
7260         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7261         data for incremental input file entry.
7262         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7263         (Incremental_input_entry_reader::get_input_section): Adjust size of
7264         data for incremental input file entry.
7265         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7266         (Incremental_input_entry_reader::get_comdat_group_signature): New
7267         function.
7268         * object.cc (Sized_relobj::include_section_group): Report kept
7269         COMDAT groups for incremental links.
7270
7271 2011-05-24  David Meyer  <pdox@google.com>
7272
7273         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7274         with name parameter.  Add found_name parameter.
7275         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7276         * dirsearch.h (class Dirsearch): Update declaration.
7277
7278 2011-05-24  Ian Lance Taylor  <iant@google.com>
7279
7280         * archive.cc (Library_base::should_include_member): Pull in object
7281         from archive if it defines the entry symbol.
7282         * parameters.cc (Parameters::entry): New function.
7283         * parameters.h (class Parameters): Declare entry.
7284         * output.h (class Output_file_header): Remove entry_ field.
7285         * output.cc (Output_file_header::Output_file_header): Remove entry
7286         parameter.  Change all callers.
7287         (Output_file_header::entry): Use parameters->entry.
7288         * gold.cc (queue_middle_tasks): Likewise.
7289         * plugin.cc (Plugin_hook::run): Likewise.
7290
7291 2011-05-24 Cary Coutant  <ccoutant@google.com>
7292
7293         * gold.cc (queue_initial_tasks): Pass incremental base filename
7294         to Output_file::open_base_file; don't print error message.
7295         * incremental-dump.cc (main): Adjust call to
7296         Output_file::open_for_modification.
7297         * incremental-dump.cc (main): Likewise.
7298         * incremental.cc (Incremental_inputs::report_command_line):
7299         Ignore --incremental-base option when comparing command lines.
7300         Ignore parameter when given as separate argument.
7301         * options.h (class General_options): Add --incremental-base.
7302         * output.cc (Output_file::Output_file):
7303         (Output_file::open_base_file): Add base_name and writable parameters;
7304         read base file into new file; print error message here.
7305         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7306         callers.
7307         * output.h (Output_file::open_for_modification): Rename to...
7308         (Output_file::open_base_file): ...this; add base_name and
7309         writable parameters; adjust all callers.
7310         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7311         callers.
7312         * testsuite/Makefile.am (incremental_test_4): Test
7313         --incremental-base.
7314         * testsuite/Makefile.in: Regenerate.
7315
7316 2011-05-24 Cary Coutant  <ccoutant@google.com>
7317
7318         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7319         incremental_test_4.
7320         * testsuite/Makefile.in: Regenerate.
7321         * testsuite/two_file_test_1_v1.cc: New test source file.
7322         * testsuite/two_file_test_1b_v1.cc: New test source file.
7323         * testsuite/two_file_test_2_v1.cc: New test source file.
7324
7325 2011-05-24 Cary Coutant  <ccoutant@google.com>
7326
7327         * dynobj.h (Dynobj::do_dynobj): New function.
7328         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7329         flag and soname for shared objects.
7330         * incremental.cc (Incremental_inputs::report_object): Make
7331         either Incremental_object_entry or Incremental_dynobj_entry; add
7332         soname to string table.
7333         (Incremental_inputs::report_input_section): Add assertion.
7334         (Output_section_incremental_inputs::set_final_data_size): Adjust
7335         type of input file entry for shared libraries; adjust size of
7336         shared library info entry.
7337         (Output_section_incremental_inputs::write_input_files): Write
7338         as_needed flag for shared libraries.
7339         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7340         of input file entry for shared libraries; write soname.
7341         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7342         soname from incremental info.
7343         * incremental.h (enum Incremental_input_flags): Add
7344         INCREMENTAL_INPUT_AS_NEEDED.
7345         (Incremental_input_entry::Incremental_input_entry): Initialize new
7346         data member.
7347         (Incremental_input_entry::set_as_needed): New function.
7348         (Incremental_input_entry::as_needed): New function.
7349         (Incremental_input_entry::do_dynobj_entry): New function.
7350         (Incremental_input_entry::as_needed_): New data member.
7351         (Incremental_object_entry::Incremental_object_entry): Don't check
7352         for shared library.
7353         (Incremental_object_entry::do_type): Likewise.
7354         (class Incremental_dynobj_entry): New class.
7355         (Incremental_input_entry_reader::as_needed): New function.
7356         (Incremental_input_entry_reader::get_soname): New function.
7357         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7358         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7359         size of shared library info entry.
7360         * layout.cc (Layout::finish_dynamic_section): Don't test for
7361         incremental link when adding DT_NEEDED entries.
7362         * object.h (Object::Object): Initialize new data member.
7363         (Object::dynobj): New function.
7364         (Object::set_as_needed): New function.
7365         (Object::as_needed): New function.
7366         (Object::do_dynobj): New function.
7367         (Object::as_needed_): New data member.
7368
7369 2011-05-24 Cary Coutant  <ccoutant@google.com>
7370
7371         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7372         info; adjust display of GOT entries.
7373         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7374         vector of input objects; remove file_status_.
7375         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7376         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7377         got_plt reader; call target hooks to reserve GOT entries.
7378         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7379         of input file info header and GOT info entry.
7380         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7381         relocation info.
7382         (Got_plt_view_info::got_descriptor): Remove.
7383         (Got_plt_view_info::sym_index): New data member.
7384         (Got_plt_view_info::input_index): New data member.
7385         (Local_got_offset_visitor::visit): Write input file index.
7386         (Global_got_offset_visitor::visit): Write 0 for input file index.
7387         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7388         with sym_index and input_index.
7389         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7390         incremental info GOT entry; replace got_descriptor with input_index.
7391         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7392         map from input file index to object.
7393         (Sized_relobj_incr::do_layout): Replace direct data member reference
7394         with accessor function.
7395         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7396         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7397         Adjust size of input file info header.
7398         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7399         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7400         (Incremental_input_entry_reader::get_input_section): Adjust size of
7401         input file info header.
7402         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7403         of incremental info GOT entry.
7404         (Incremental_got_plt_reader::get_got_desc): Remove.
7405         (Incremental_got_plt_reader::get_got_symndx): New function.
7406         (Incremental_got_plt_reader::get_got_input_index): New function.
7407         (Sized_incremental_binary::Sized_incremental_binary): Remove
7408         file_status_; add input_objects_.
7409         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7410         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7411         (Sized_incremental_binary::file_is_unchanged): Remove.
7412         (Sized_incremental_binary::set_input_object): New function.
7413         (Sized_incremental_binary::input_object): New function.
7414         (Sized_incremental_binary::file_status_): Remove.
7415         (Sized_incremental_binary::input_objects_): New data member.
7416         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7417         references.
7418         (Sized_relobj_incr::invalid_address): Move to base class.
7419         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7420         class.
7421         (Sized_relobj_incr::do_output_section_offset): Likewise.
7422         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7423         (Sized_relobj_incr::section_offsets_): Likewise.
7424         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7425         function.
7426         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7427         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7428         with accessor function.
7429         (Sized_relobj_file::do_layout): Likewise.
7430         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7431         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7432         (Sized_relobj_file::compute_final_local_value): Replace refs to
7433         section_offsets_ with accessor function.
7434         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7435         * object.h (Relobj::Relobj): Initialize new data members.
7436         (Relobj::add_dyn_reloc): New function.
7437         (Relobj::first_dyn_reloc): New function.
7438         (Relobj::dyn_reloc_count): New function.
7439         (Relobj::first_dyn_reloc_): New data member.
7440         (Relobj::dyn_reloc_count_): New data member.
7441         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7442         references.
7443         (Sized_relobj::Address): New typedef.
7444         (Sized_relobj::invalid_address): Move here from child class.
7445         (Sized_relobj::Sized_relobj): Initialize new data members.
7446         (Sized_relobj::sized_relobj): New function.
7447         (Sized_relobj::is_output_section_offset_invalid): Move here from
7448         child class.
7449         (Sized_relobj::get_output_section_offset): Likewise.
7450         (Sized_relobj::local_has_got_offset): Likewise.
7451         (Sized_relobj::local_got_offset): Likewise.
7452         (Sized_relobj::set_local_got_offset): Likewise.
7453         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7454         (Sized_relobj::clear_got_offsets): New function.
7455         (Sized_relobj::section_offsets): Move here from child class.
7456         (Sized_relobj::do_output_section_offset): Likewise.
7457         (Sized_relobj::do_set_section_offset): Likewise.
7458         (Sized_relobj::Local_got_offsets): Likewise.
7459         (Sized_relobj::local_got_offsets_): Likewise.
7460         (Sized_relobj::section_offsets_): Likewise.
7461         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7462         references.
7463         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7464         class.
7465         (Sized_relobj_file::sized_relobj): New function
7466         (Sized_relobj_file::local_has_got_offset): Move to base class.
7467         (Sized_relobj_file::local_got_offset): Likewise.
7468         (Sized_relobj_file::set_local_got_offset): Likewise.
7469         (Sized_relobj_file::get_output_section_offset): Likewise.
7470         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7471         (Sized_relobj_file::do_output_section_offset): Likewise.
7472         (Sized_relobj_file::do_set_section_offset): Likewise.
7473         (Sized_relobj_file::Local_got_offsets): Likewise.
7474         (Sized_relobj_file::local_got_offsets_): Likewise.
7475         (Sized_relobj_file::section_offsets_): Likewise.
7476         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7477         (all constructors).
7478         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7479         (Output_reloc::get_symbol_index): Likewise.
7480         (Output_reloc::local_section_offset): Likewise.
7481         (Output_reloc::get_address): Likewise.
7482         (Output_reloc::symbol_value): Likewise.
7483         (Output_data_got::reserve_slot): Move to class definition.
7484         (Output_data_got::reserve_local): New function.
7485         (Output_data_got::reserve_slot_for_global): Remove.
7486         (Output_data_got::reserve_global): New function.
7487         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7488         (all constructors, two instantiations).
7489         (Output_reloc::get_relobj): New function (two instantiations).
7490         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7491         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7492         (Output_data_reloc::add_global): Adjust type of relobj.
7493         (Output_data_reloc::add_global_relative): Likewise.
7494         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7495         (Output_data_reloc::add_local): Likewise.
7496         (Output_data_reloc::add_local_relative): Likewise.
7497         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7498         (Output_data_reloc::add_local_section): Likewise.
7499         (Output_data_reloc::add_output_section): Likewise.
7500         (Output_data_reloc::add_absolute): Likewise.
7501         (Output_data_reloc::add_target_specific): Likewise.
7502         (Output_data_got::reserve_slot): Move definition here.
7503         (Output_data_got::reserve_local): New function.
7504         (Output_data_got::reserve_global): New function.
7505         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7506         section_offsets_ with accessor function.
7507         (Sized_relobj_file::write_sections): Likewise.
7508         (Sized_relobj_file::do_relocate_sections): Likewise.
7509         * target.h (Sized_target::reserve_local_got_entry): New function.
7510         (Sized_target::reserve_global_got_entry): New function.
7511         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7512         (Target_x86_64::reserve_global_got_entry): New function.
7513         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7514
7515 2011-05-23 Cary Coutant  <ccoutant@google.com>
7516
7517         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7518         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7519         bit when checking got_type.
7520         * incremental.cc (Sized_incremental_binary::setup_readers):
7521         Store symbol table and string table locations; initialize bit vector
7522         of file status flags.
7523         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7524         unchanged files.
7525         (Sized_incremental_binary::do_process_got_plt): New function.
7526         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7527         (Output_section_incremental_inputs::set_final_data_size): Record
7528         file index for each input file.
7529         (Output_section_incremental_inputs::write_got_plt): Store file index
7530         instead of input entry offset for each GOT entry.
7531         * incremental.h
7532         (Incremental_input_entry::Incremental_input_entry): Initialize new
7533         data member.
7534         (Incremental_input_entry::set_offset): Store file index.
7535         (Incremental_input_entry::get_file_index): New function.
7536         (Incremental_input_entry::file_index_): New data member.
7537         (Incremental_binary::process_got_plt): New function.
7538         (Incremental_binary::do_process_got_plt): New function.
7539         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7540         data members.
7541         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7542         (Sized_incremental_binary::set_file_is_unchanged): New function.
7543         (Sized_incremental_binary::file_is_unchanged): New function.
7544         (Sized_incremental_binary::do_process_got_plt): New function.
7545         (Sized_incremental_binary::file_status_): New data member.
7546         (Sized_incremental_binary::main_symtab_loc_): New data member.
7547         (Sized_incremental_binary::main_strtab_loc_): New data member.
7548         * output.cc (Output_data_got::Got_entry::write): Add case
7549         RESERVED_CODE.
7550         (Output_data_got::add_global): Call add_got_entry.
7551         (Output_data_got::add_global_plt): Likewise.
7552         (Output_data_got::add_global_with_rel): Likewise.
7553         (Output_data_got::add_global_with_rela): Likewise.
7554         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7555         (Output_data_got::add_global_pair_with_rela): Likewise.
7556         (Output_data_got::add_local): Call add_got_entry.
7557         (Output_data_got::add_local_plt): Likewise.
7558         (Output_data_got::add_local_with_rel): Likewise.
7559         (Output_data_got::add_local_with_rela): Likewise.
7560         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7561         (Output_data_got::add_local_pair_with_rela): Likewise.
7562         (Output_data_got::reserve_slot): New function.
7563         (Output_data_got::reserve_slot_for_global): New function.
7564         (Output_data_got::add_got_entry): New function.
7565         (Output_data_got::add_got_entry_pair): New function.
7566         (Output_section::add_output_section_data): Edit FIXME.
7567         * output.h
7568         (Output_section_data_build::Output_section_data_build): New
7569         constructor with size parameter.
7570         (Output_data_space::Output_data_space): Likewise.
7571         (Output_data_got::Output_data_got): Initialize new data member; new
7572         constructor with size parameter.
7573         (Output_data_got::add_constant): Call add_got_entry.
7574         (Output_data_got::reserve_slot): New function.
7575         (Output_data_got::reserve_slot_for_global): New function.
7576         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7577         (Output_data_got::add_got_entry): New function.
7578         (Output_data_got::add_got_entry_pair): New function.
7579         (Output_data_got::free_list_): New data member.
7580         * target.h (Sized_target::init_got_plt_for_update): New function.
7581         (Sized_target::register_global_plt_entry): New function.
7582         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7583         Initialize new data member; call init; add constructor with PLT count.
7584         (Output_data_plt_x86_64::init): New function.
7585         (Output_data_plt_x86_64::add_relocation): New function.
7586         (Output_data_plt_x86_64::reserve_slot): New function.
7587         (Output_data_plt_x86_64::free_list_): New data member.
7588         (Target_x86_64::init_got_plt_for_update): New function.
7589         (Target_x86_64::register_global_plt_entry): New function.
7590         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7591         incremental updates.
7592         (Output_data_plt_x86_64::add_relocation): New function.
7593         * testsuite/object_unittest.cc (Object_test): Set default options.
7594
7595 2011-05-16  Ian Lance Taylor  <iant@google.com>
7596
7597         * options.h (class General_options): Make -i a synonym for -r.
7598
7599 2011-05-16  Ian Lance Taylor  <iant@google.com>
7600
7601         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7602
7603 2011-05-10 Cary Coutant  <ccoutant@google.com>
7604
7605         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7606         strip_all (-s).
7607
7608 2011-05-06  Ian Lance Taylor  <iant@google.com>
7609
7610         * layout.cc (Layout::layout): If the output section flags change,
7611         update the ordering.
7612
7613 2011-04-25 Cary Coutant  <ccoutant@google.com>
7614
7615         * incremental-dump.cc (dump_incremental_inputs): Print local
7616         symbol info for each input file.
7617         * incremental.cc
7618         (Output_section_incremental_inputs::set_final_data_size): Add local
7619         symbol info to input file entries in incremental info.
7620         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7621         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7622         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7623         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7624         implementation.
7625         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7626         (Sized_incr_relobj::do_relocate): Write the local symbols.
7627         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7628         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7629         Adjust size of input file header.
7630         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7631         (Incremental_inputs_reader::get_local_symbol_count): New function.
7632         (Incremental_inputs_reader::get_input_section): Adjust size of input
7633         file header.
7634         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7635         (Sized_incr_relobj::This): New typedef.
7636         (Sized_incr_relobj::sym_size): New const data member.
7637         (Sized_incr_relobj::Local_symbol): New struct.
7638         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7639         (Sized_incr_relobj::do_local_symbol_offset): New function.
7640         (Sized_incr_relobj::local_symbol_count_): New data member.
7641         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7642         (Sized_incr_relobj::local_symbol_index_): New data member.
7643         (Sized_incr_relobj::local_symbol_offset_): New data member.
7644         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7645         (Sized_incr_relobj::local_symbols_): New data member.
7646         * object.h (Relobj::output_local_symbol_count): New function.
7647         (Relobj::local_symbol_offset): New function.
7648         (Relobj::do_output_local_symbol_count): New function.
7649         (Relobj::do_local_symbol_offset): New function.
7650         (Sized_relobj::do_output_local_symbol_count): New function.
7651         (Sized_relobj::do_local_symbol_offset): New function.
7652
7653 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7654
7655         * descriptors.cc (set_close_on_exec): New function.
7656         (Descriptors::open): Use set_close_on_exec.
7657         * output.cc (S_ISLNK): Define if not defined.
7658
7659 2011-04-22 Cary Coutant  <ccoutant@google.com>
7660
7661         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7662         global symbol map.
7663         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7664         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7665         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7666         relocations.
7667         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7668         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7669         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7670         * incremental.h
7671         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7672         function.
7673         (Incremental_binary::apply_incremental_relocs): New function.
7674         (Incremental_binary::do_apply_incremental_relocs): New function.
7675         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7676         data member.
7677         (Sized_incremental_binary::add_global_symbol): New function.
7678         (Sized_incremental_binary::global_symbol): New function.
7679         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7680         (Sized_incremental_binary::symbol_map_): New data member.
7681         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7682         * target.h (Sized_target::apply_relocation): New function.
7683         * target-reloc.h (apply_relocation): New function.
7684         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7685
7686 2011-04-22  Doug Kwan  <dougkwan@google.com>
7687
7688         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7689         flag of a SHT_ARM_EXIDX section.
7690         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7691         * testsuite/Makefile.in: Regenerate.
7692         * testsuite/arm_exidx_test.s: New file.
7693         * testsuite/arm_exidx_test.sh: Same.
7694
7695 2011-04-20 Cary Coutant  <ccoutant@google.com>
7696
7697         PR gold/12689
7698         * archive.h (Incremental_archive_entry::Archive_member):
7699         Initialize arg_serial_ (second constructor).
7700
7701 2011-04-17  Ian Lance Taylor  <iant@google.com>
7702
7703         * object.cc (Relocate_info::location): Simplify location string.
7704         * errors.cc (Errors::error_at_location): Don't print program
7705         name.
7706         (Errors::warning_at_location): Likewise.
7707         (Errors::undefined_symbol): Likewise.
7708         * testsuite/debug_msg.sh: Update accordingly.
7709
7710 2011-04-14 Cary Coutant  <ccoutant@google.com>
7711
7712         * layout.cc (Layout::symtab_section_offset): New function.
7713         * layout.h (Layout::symtab_section_offset): New function.
7714         * reloc.cc (Sized_relobj::do_relocate): Call it.
7715
7716 2011-04-12  Ian Lance Taylor  <iant@google.com>
7717
7718         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7719         with MREMAP_MAYMOVE.
7720         * output.h (class Output_file): Add map_is_allocated_ field.
7721         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7722         not available, provide stubs.  If mremap is not available, #define
7723         it to gold_mremap.
7724         (MREMAP_MAYMOVE): Define if not defined.
7725         (Output_file::Output_file): Initialize map_is_allocated_.
7726         (Output_file::resize): Check map_is_allocated_.
7727         (Output_file::map_anonymous): If mmap fails, use malloc.
7728         (Output_file::unmap): Don't do anything for an anonymous map.
7729         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7730         is not available, provide stubs.
7731         (File_read::View::~View): Use free rather than delete[].
7732         (File_read::make_view): Use malloc rather than new[].  If mmap
7733         fails, use malloc.
7734         (File_read::find_or_make_view): Use malloc rather than new[].
7735         * gold.h: Remove HAVE_REMAP code.
7736         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7737         exists.  Rename mremap to gold_mremap.  If mmap is not available
7738         don't do anything.
7739         * configure, config.in: Rebuild.
7740
7741 2011-04-11  Ian Lance Taylor  <iant@google.com>
7742
7743         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7744         initialize local variable v.
7745
7746 2011-04-11  Cary Coutant  <ccoutant@google.com>
7747
7748         * archive.cc (Archive::include_member): Adjust call to
7749         report_object.
7750         (Add_archive_symbols::run): Track argument serial numbers.
7751         (Lib_group::include_member): Likewise.
7752         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7753         * archive.h (Incremental_archive_entry::Archive_member):
7754         Initialize arg_serial_.
7755         (Archive_member::arg_serial_): New data member.
7756         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7757         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7758         incremental link.
7759         (Sized_dynobj::do_for_all_local_got_entries): New function.
7760         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7761         function.
7762         * fileread.cc (get_mtime): New function.
7763         * fileread.h (get_mtime): New function.
7764         * gold.cc (queue_initial_tasks): Check for incremental update.
7765         (process_incremental_input): New function.
7766         (queue_middle_tasks): Don't force valid target for incremental
7767         update.
7768         * incremental-dump.cc (find_input_containing_global): Adjust
7769         size of symbol info entry.
7770         (dump_incremental_inputs): Dump argument serial number and
7771         in_system_directory flag; bias shndx by 1; print symbol names
7772         when dumping per-file symbol lists; use new symbol info readers.
7773         * incremental.cc
7774         (Output_section_incremental_inputs:update_data_size): New function.
7775         (Sized_incremental_binary::setup_readers): Setup input readers
7776         for each input file; build maps for files added from libraries
7777         and scripts.
7778         (Sized_incremental_binary::check_input_args): New function.
7779         (Sized_incremental_binary::do_check_inputs): Build map of argument
7780         serial numbers to input arguments.
7781         (Sized_incremental_binary::do_file_has_changed): Rename
7782         do_file_is_unchanged to this; compare file modification times.
7783         (Sized_incremental_binary::do_init_layout): New function.
7784         (Sized_incremental_binary::do_reserve_layout): New function.
7785         (Sized_incremental_binary::do_get_input_reader): Remove.
7786         (Sized_incremental_binary::get_symtab_view): New function.
7787         (Incremental_checker::can_incrementally_link_output_file): Remove.
7788         (Incremental_inputs::report_command_line): Exclude --debug options.
7789         (Incremental_inputs::report_archive_begin): Add parameter; track
7790         argument serial numbers; don't put input file entry for archive
7791         before archive members.
7792         (Incremental_inputs::report_archive_end): Put input file entry
7793         for archive after archive members.
7794         (Incremental_inputs::report_object): Add parameter; track argument
7795         serial numbers and in_system_directory flag.
7796         (Incremental_inputs::report_script): Add parameter; track argument
7797         serial numbers.
7798         (Output_section_incremental_inputs::set_final_data_size): Adjust
7799         size of symbol info entry; check for forwarding symbols.
7800         (Output_section_incremental_inputs::write_input_files): Write
7801         in_system_directory flag and argument serial number.
7802         (Output_section_incremental_inputs::write_info_blocks): Map section
7803         indices between incremental info and original input file; store
7804         input section index for each symbol.
7805         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7806         change operator() to visit().
7807         (class Global_got_offset_visitor): Likewise.
7808         (class Global_symbol_visitor_got_plt):
7809         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7810         classes.
7811         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7812         (Sized_incr_relobj::do_read_symbols): New function.
7813         (Sized_incr_relobj::do_layout): New function.
7814         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7815         (Sized_incr_relobj::do_add_symbols): New function.
7816         (Sized_incr_relobj::do_should_include_member): New function.
7817         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7818         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7819         (Sized_incr_relobj::do_section_size): New function.
7820         (Sized_incr_relobj::do_section_name): New function.
7821         (Sized_incr_relobj::do_section_contents): New function.
7822         (Sized_incr_relobj::do_section_flags): New function.
7823         (Sized_incr_relobj::do_section_entsize): New function.
7824         (Sized_incr_relobj::do_section_address): New function.
7825         (Sized_incr_relobj::do_section_type): New function.
7826         (Sized_incr_relobj::do_section_link): New function.
7827         (Sized_incr_relobj::do_section_info): New function.
7828         (Sized_incr_relobj::do_section_addralign): New function.
7829         (Sized_incr_relobj::do_initialize_xindex): New function.
7830         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7831         (Sized_incr_relobj::do_read_relocs): New function.
7832         (Sized_incr_relobj::do_gc_process_relocs): New function.
7833         (Sized_incr_relobj::do_scan_relocs): New function.
7834         (Sized_incr_relobj::do_count_local_symbols): New function.
7835         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7836         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7837         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7838         (Sized_incr_relobj::do_relocate): New function.
7839         (Sized_incr_relobj::do_set_section_offset): New function.
7840         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7841         (Sized_incr_dynobj::do_read_symbols): New function.
7842         (Sized_incr_dynobj::do_layout): New function.
7843         (Sized_incr_dynobj::do_add_symbols): New function.
7844         (Sized_incr_dynobj::do_should_include_member): New function.
7845         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7846         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7847         (Sized_incr_dynobj::do_section_size): New function.
7848         (Sized_incr_dynobj::do_section_name): New function.
7849         (Sized_incr_dynobj::do_section_contents): New function.
7850         (Sized_incr_dynobj::do_section_flags): New function.
7851         (Sized_incr_dynobj::do_section_entsize): New function.
7852         (Sized_incr_dynobj::do_section_address): New function.
7853         (Sized_incr_dynobj::do_section_type): New function.
7854         (Sized_incr_dynobj::do_section_link): New function.
7855         (Sized_incr_dynobj::do_section_info): New function.
7856         (Sized_incr_dynobj::do_section_addralign): New function.
7857         (Sized_incr_dynobj::do_initialize_xindex): New function.
7858         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7859         (make_sized_incremental_object): New function.
7860         (Incremental_library::copy_unused_symbols): New function.
7861         (Incremental_library::do_for_all_unused_symbols): New function.
7862         * incremental.h (enum Incremental_input_flags): New type.
7863         (class Incremental_checker): Remove.
7864         (Incremental_input_entry::Incremental_input_entry): Add argument
7865         serial number.
7866         (Incremental_input_entry::arg_serial): New function.
7867         (Incremental_input_entry::set_is_in_system_directory): New function.
7868         (Incremental_input_entry::is_in_system_directory): New function.
7869         (Incremental_input_entry::arg_serial_): New data member.
7870         (Incremental_input_entry::is_in_system_directory_): New data member.
7871         (class Script_info): Move here from script.h.
7872         (Script_info::Script_info): Add filename parameter.
7873         (Script_info::filename): New function.
7874         (Script_info::filename_): New data member.
7875         (Incremental_script_entry::Incremental_script_entry): Add argument
7876         serial number.
7877         (Incremental_object_entry::Incremental_object_entry): Likewise.
7878         (Incremental_object_entry::add_input_section): Build list of input
7879         sections with map to original shndx.
7880         (Incremental_object_entry::get_input_section_index): New function.
7881         (Incremental_object_entry::shndx_): New data member.
7882         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7883         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7884         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7885         serial number.
7886         (Incremental_inputs::report_archive_begin): Likewise.
7887         (Incremental_inputs::report_object): Likewise.
7888         (Incremental_inputs::report_script): Likewise.
7889         (class Incremental_global_symbol_reader): New class.
7890         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7891         and store flags and input file type.
7892         (Incremental_input_entry_reader::arg_serial): New function.
7893         (Incremental_input_entry_reader::type): Extract type from flags.
7894         (Incremental_input_entry_reader::is_in_system_directory): New function.
7895         (Incremental_input_entry_reader::get_input_section_count): Call
7896         accessor function for type.
7897         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7898         function for type; adjust size of global symbol entry.
7899         (Incremental_input_entry_reader::get_global_symbol_count): Call
7900         accessor function for type.
7901         (Incremental_input_entry_reader::get_object_count): Likewise.
7902         (Incremental_input_entry_reader::get_object_offset): Likewise.
7903         (Incremental_input_entry_reader::get_member_count): Likewise.
7904         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7905         (Incremental_input_entry_reader::get_member_offset): Likewise.
7906         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7907         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7908         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7909         (Incremental_input_entry_reader::get_global_symbol_reader): New
7910         function.
7911         (Incremental_input_entry_reader::get_output_symbol_index): New
7912         function.
7913         (Incremental_input_entry_reader::type_): Remove.
7914         (Incremental_input_entry_reader::flags_): New data member.
7915         (Incremental_inputs_reader::input_file_offset): New function.
7916         (Incremental_inputs_reader::input_file_index): New function.
7917         (Incremental_inputs_reader::input_file): Call input_file_offset.
7918         (Incremental_inputs_reader::input_file_at_offset): New function.
7919         (Incremental_relocs_reader::get_r_type): Reformat.
7920         (Incremental_relocs_reader::get_r_shndx): Reformat.
7921         (Incremental_relocs_reader::get_r_offset): Reformat.
7922         (Incremental_relocs_reader::data): New function.
7923         (Incremental_binary::Incremental_binary): Initialize new data members.
7924         (Incremental_binary::check_inputs): Add cmdline parameter.
7925         (Incremental_binary::file_is_unchanged): Remove.
7926         (Input_reader::arg_serial): New function.
7927         (Input_reader::get_unused_symbol_count): New function.
7928         (Input_reader::get_unused_symbol): New function.
7929         (Input_reader::do_arg_serial): New function.
7930         (Input_reader::do_get_unused_symbol_count): New function.
7931         (Input_reader::do_get_unused_symbol): New function.
7932         (Incremental_binary::input_file_count): New function.
7933         (Incremental_binary::get_input_reader): Change signature to use
7934         index instead of filename.
7935         (Incremental_binary::file_has_changed): New function.
7936         (Incremental_binary::get_input_argument): New function.
7937         (Incremental_binary::get_library): New function.
7938         (Incremental_binary::get_script_info): New function.
7939         (Incremental_binary::init_layout): New function.
7940         (Incremental_binary::reserve_layout): New function.
7941         (Incremental_binary::output_file): New function.
7942         (Incremental_binary::do_check_inputs): New function.
7943         (Incremental_binary::do_file_is_unchanged): Remove.
7944         (Incremental_binary::do_file_has_changed): New function.
7945         (Incremental_binary::do_init_layout): New function.
7946         (Incremental_binary::do_reserve_layout): New function.
7947         (Incremental_binary::do_input_file_count): New function.
7948         (Incremental_binary::do_get_input_reader): Change signature.
7949         (Incremental_binary::input_args_map_): New data member.
7950         (Incremental_binary::library_map_): New data member.
7951         (Incremental_binary::script_map_): New data member.
7952         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7953         new data members.
7954         (Sized_incremental_binary::output_section): New function.
7955         (Sized_incremental_binary::inputs_reader): Add const.
7956         (Sized_incremental_binary::symtab_reader): Add const.
7957         (Sized_incremental_binary::relocs_reader): Add const.
7958         (Sized_incremental_binary::got_plt_reader): Add const.
7959         (Sized_incremental_binary::get_symtab_view): New function.
7960         (Sized_incremental_binary::Inputs_reader): New typedef.
7961         (Sized_incremental_binary::Input_entry_reader): New typedef.
7962         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7963         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7964         (Sized_incremental_binary::do_file_has_changed): New function.
7965         (Sized_incremental_binary::do_init_layout): New function.
7966         (Sized_incremental_binary::do_reserve_layout): New function.
7967         (Sized_input_reader::Inputs_reader): Remove.
7968         (Sized_input_reader::Input_entry_reader): Remove.
7969         (Sized_input_reader::do_arg_serial): New function.
7970         (Sized_input_reader::do_get_unused_symbol_count): New function.
7971         (Sized_input_reader::do_get_unused_symbol): New function.
7972         (Sized_incremental_binary::do_input_file_count): New function.
7973         (Sized_incremental_binary::do_get_input_reader): Change signature;
7974         use index instead of filename.
7975         (Sized_incremental_binary::section_map_): New data member.
7976         (Sized_incremental_binary::input_entry_readers_): New data member.
7977         (class Sized_incr_relobj): New class.
7978         (class Sized_incr_dynobj): New class.
7979         (make_sized_incremental_object): New function.
7980         (class Incremental_library): New class.
7981         * layout.cc (Free_list::num_lists): New static data member.
7982         (Free_list::num_nodes): New static data member.
7983         (Free_list::num_removes): New static data member.
7984         (Free_list::num_remove_visits): New static data member.
7985         (Free_list::num_allocates): New static data member.
7986         (Free_list::num_allocate_visits): New static data member.
7987         (Free_list::init): New function.
7988         (Free_list::remove): New function.
7989         (Free_list::allocate): New function.
7990         (Free_list::dump): New function.
7991         (Free_list::print_stats): New function.
7992         (Layout_task_runner::run): Resize output file for incremental updates.
7993         (Layout::Layout): Initialize new data members.
7994         (Layout::set_incremental_base): New function.
7995         (Layout::init_fixed_output_section): New function.
7996         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7997         incremental updates.
7998         (Layout::create_gold_note): Do not create gold note section for
7999         incremental updates.
8000         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
8001         for incremental updates.
8002         (Layout::set_section_offsets): For incremental updates, allocate space
8003         from free list.
8004         (Layout::create_symtab_sections): Layout with offsets relative to
8005         start of section; for incremental updates, allocate space from free
8006         list.
8007         (Layout::create_shdrs): For incremental updates, allocate space from
8008         free list.
8009         (Layout::finish_dynamic_section): For incremental updates, do not
8010         check --as-needed (fixed in subsequent patch).
8011         * layout.h (class Free_list): New class.
8012         (Layout::set_incremental_base): New function.
8013         (Layout::incremental_base): New function.
8014         (Layout::init_fixed_output_section): New function.
8015         (Layout::allocate): New function.
8016         (Layout::incremental_base_): New data member.
8017         (Layout::free_list_): New data member.
8018         * main.cc (main): Print Free_list statistics.
8019         * object.cc (Relobj::finalize_incremental_relocs): Add
8020         clear_counts parameter; clear counts only when clear_counts is set.
8021         (Sized_relobj::Sized_relobj): Initialize new base class.
8022         (Sized_relobj::do_layout): Don't report special sections.
8023         (Sized_relobj::do_for_all_local_got_entries): New function.
8024         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
8025         symtab_off to all symbol table offsets.
8026         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
8027         * object.h (class Got_offset_list): Move to top of file.
8028         (Object::Object): Allow case where input_file == NULL.
8029         (Object::~Object): Likewise.
8030         (Object::input_file): Assert that input_file != NULL.
8031         (Object::lock): Allow case where input_file == NULL.
8032         (Object::unlock): Likewise.
8033         (Object::is_locked): Likewise.
8034         (Object::token): Likewise.
8035         (Object::release): Likewise.
8036         (Object::is_incremental): New function.
8037         (Object::get_mtime): New function.
8038         (Object::for_all_local_got_entries): New function.
8039         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
8040         (Object::set_is_in_system_directory): New function.
8041         (Object::is_in_system_directory): New function.
8042         (Object::do_is_incremental): New function.
8043         (Object::do_get_mtime): New function.
8044         (Object::do_for_all_local_got_entries): New function.
8045         (Object::is_in_system_directory_): New data member.
8046         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
8047         (class Sized_relobj_base): New class.
8048         (class Sized_relobj): Derive from Sized_relobj_base.
8049         (class Sized_relobj::Symbols): Redeclare from base class.
8050         (class Sized_relobj::local_got_offset_list): Remove.
8051         (class Sized_relobj::Output_sections): Redeclare from base class.
8052         (class Sized_relobj::do_for_all_local_got_entries): New function.
8053         (class Sized_relobj::write_local_symbols): Add offset parameter.
8054         (class Sized_relobj::local_symbol_offset_): Update comment.
8055         (class Sized_relobj::local_dynsym_offset_): Update comment.
8056         * options.cc (Input_arguments::add_file): Remove const.
8057         * options.h (Input_file_argument::Input_file_argument):
8058         Initialize arg_serial_ (all constructors).
8059         (Input_file_argument::set_arg_serial): New function.
8060         (Input_file_argument::arg_serial): New function.
8061         (Input_file_argument::arg_serial_): New data member.
8062         (Input_arguments::Input_arguments): Initialize file_count_.
8063         (Input_arguments::add_file): Remove const.
8064         (Input_arguments::number_of_input_files): New function.
8065         (Input_arguments::file_count_): New data member.
8066         (Command_line::number_of_input_files): Call
8067         Input_arguments::number_of_input_files.
8068         * output.cc (Output_segment_headers::Output_segment_headers):
8069         Set current size.
8070         (Output_section::Input_section::current_data_size): New function.
8071         (Output_section::Output_section): Initialize new data members.
8072         (Output_section::add_input_section): Don't do merge sections for
8073         an incremental link; allocate space from free list for an
8074         incremental update.
8075         (Output_section::add_output_section_data): Allocate space from
8076         free list for an incremental update.
8077         (Output_section::update_data_size): New function.
8078         (Output_section::set_fixed_layout): New function.
8079         (Output_section::reserve): New function.
8080         (Output_segment::set_section_addresses): Remove const.
8081         (Output_segment::set_section_list_addresses): Remove const; allocate
8082         space from free list for an incremental update.
8083         (Output_segment::set_offset): Adjust size of RELRO segment for an
8084         incremental update.
8085         * output.h (Output_data::current_data_size): Move here from
8086         child classes.
8087         (Output_data::pre_finalize_data_size): New function.
8088         (Output_data::update_data_size): New function.
8089         (Output_section_headers::update_data_size): new function.
8090         (Output_section_data_build::current_data_size): Move to Output_data.
8091         (Output_data_strtab::update_data_size): New function.
8092         (Output_section::current_data_size): Move to Output_data.
8093         (Output_section::set_fixed_layout): New function.
8094         (Output_section::has_fixed_layout): New function.
8095         (Output_section::reserve): New function.
8096         (Output_section::update_data_size): New function.
8097         (Output_section::has_fixed_layout_): New data member.
8098         (Output_section::free_list_): New data member.
8099         (Output_segment::set_section_addresses): Remove const.
8100         (Output_segment::set_section_list_addresses): Remove const.
8101         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
8102         New function.
8103         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
8104         New function.
8105         * readsyms.cc (Read_symbols::do_read_symbols): Add library
8106         parameter when calling Add_symbols constructor; store argument
8107         serial number for members of a lib group.
8108         (Add_symbols::locks): Allow case where token == NULL.
8109         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
8110         (Read_member::~Read_member): New function.
8111         (Read_member::is_runnable): New function.
8112         (Read_member::locks): New function.
8113         (Read_member::run): New function.
8114         (Check_script::~Check_script): New function.
8115         (Check_script::is_runnable): New function.
8116         (Check_script::locks): New function.
8117         (Check_script::run): New function.
8118         (Check_library::~Check_library): New function.
8119         (Check_library::is_runnable): New function.
8120         (Check_library::locks): New function.
8121         (Check_library::run): New function.
8122         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
8123         (Add_symbols::library_): New data member.
8124         (class Read_member): New class.
8125         (class Check_script): New class.
8126         (class Check_library): New class.
8127         * reloc.cc (Read_relocs::is_runnable): Allow case where
8128         token == NULL.
8129         (Read_relocs::locks): Likewise.
8130         (Scan_relocs::locks): Likewise.
8131         (Relocate_task::locks): Likewise.
8132         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
8133         to clear counters.
8134         (Sized_relobj::incremental_relocs_scan): Fix comment.
8135         (Sized_relobj::do_relocate): Pass output file offset to
8136         write_local_symbols.
8137         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
8138         from class declaration.
8139         * script.cc (read_input_script): Allocate Script_info; pass
8140         argument serial number to report_script.
8141         * script.h (class Script_info): Move to incremental.h.
8142         * symtab.cc (Symbol_table::add_from_incrobj): New function.
8143         * symtab.h (Symbol_table::add_from_incrobj): New function.
8144         (Symbol_table::set_file_offset): New function.
8145
8146 2011-04-05  Cary Coutant  <ccoutant@google.com>
8147
8148         * incremental-dump.cc (dump_incremental_inputs): Change signature
8149         to take a Sized_incremental_binary; change caller.  Use readers
8150         in Sized_incremental_binary.
8151         * incremental.cc
8152         (Sized_incremental_binary::find_incremental_inputs_sections):
8153         Rename do_find_incremental_inputs_sections to this.
8154         (Sized_incremental_binary::setup_readers): New function.
8155         (Sized_incremental_binary::do_check_inputs): Check
8156         has_incremental_info_ flag; move setup code to setup_readers;
8157         use input readers.
8158         (Sized_incremental_binary::do_file_is_unchanged): New function.
8159         (Sized_incremental_binary::do_get_input_reader): New function.
8160         * incremental.h (class Incremental_binary): Move to end of file.
8161         (Incremental_binary::file_is_unchanged): New function.
8162         (Incremental_binary::do_file_is_unchanged): New function.
8163         (Incremental_binary::Input_reader): New class.
8164         (Incremental_binary::get_input_reader): New function.
8165         (class Sized_incremental_binary): Move to end of file.
8166         (Sized_incremental_binary::Sized_incremental_binary): Setup the
8167         input section reader classes.
8168         (Sized_incremental_binary::has_incremental_info): New function.
8169         (Sized_incremental_binary::inputs_reader): New function.
8170         (Sized_incremental_binary::symtab_reader): New function.
8171         (Sized_incremental_binary::relocs_reader): New function.
8172         (Sized_incremental_binary::got_plt_reader): New function.
8173         (Sized_incremental_binary::do_file_is_unchanged): New function.
8174         (Sized_incremental_binary::Sized_input_reader): New class.
8175         (Sized_incremental_binary::get_input_reader): New function.
8176         (Sized_incremental_binary::find_incremental_inputs_sections):
8177         Rename do_find_incremental_inputs_sections to this.
8178         (Sized_incremental_binary::setup_readers): New function.
8179         (Sized_incremental_binary::has_incremental_info_): New data member.
8180         (Sized_incremental_binary::inputs_reader_): New data member.
8181         (Sized_incremental_binary::symtab_reader_): New data member.
8182         (Sized_incremental_binary::relocs_reader_): New data member.
8183         (Sized_incremental_binary::got_plt_reader_): New data member.
8184         (Sized_incremental_binary::current_input_file_): New data member.
8185
8186 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
8187
8188         PR gold/12640
8189         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
8190         violation.
8191
8192 2011-03-30  Cary Coutant  <ccoutant@google.com>
8193
8194         * archive.cc (Archive::include_member): Adjust call to report_object.
8195         (Add_archive_symbols::run): Add script_info to call to
8196         report_archive_begin.
8197         (Lib_group::include_member): Adjust call to report_object.
8198         (Add_lib_group_symbols::run): Adjust call to report_object.
8199         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
8200         blocks.  Add object count for script input files.
8201         * incremental.cc (Incremental_inputs::report_archive_begin): Add
8202         script_info parameter; change all callers.
8203         (Incremental_inputs::report_object): Add script_info parameter;
8204         change all callers.
8205         (Incremental_inputs::report_script): Store backpointer to
8206         incremental info entry.
8207         (Output_section_incremental_inputs::set_final_data_size): Record
8208         additional information for scripts.
8209         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8210         * incremental.h (Incremental_script_entry::add_object): New function.
8211         (Incremental_script_entry::get_object_count): New function.
8212         (Incremental_script_entry::get_object): New function.
8213         (Incremental_script_entry::objects_): New data member; adjust
8214         constructor.
8215         (Incremental_inputs::report_archive_begin): Add script_info parameter.
8216         (Incremental_inputs::report_object): Add script_info parameter.
8217         (Incremental_inputs_reader::get_object_count): New function.
8218         (Incremental_inputs_reader::get_object_offset): New function.
8219         * options.cc (Input_arguments::add_file): Return reference to
8220         new input argument.
8221         * options.h (Input_argument::set_script_info): New function.
8222         (Input_argument::script_info): New function.
8223         (Input_argument::script_info_): New data member; adjust all
8224         constructors.
8225         (Input_file_group::add_file): Return reference to new input argument.
8226         (Input_file_lib::add_file): Likewise.
8227         (Input_arguments::add_file): Likewise.
8228         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
8229         * script.cc (Parser_closure::Parser_closure): Add script_info
8230         parameter; adjust all callers.
8231         (Parser_closure::script_info): New function.
8232         (Parser_closure::script_info_): New data member.
8233         (read_input_script): Report scripts earlier to incremental info.
8234         (script_add_file): Set script_info in Input_argument.
8235         (script_add_library): Likewise.
8236         * script.h (Script_options::Script_info): Rewrite class.
8237
8238 2011-03-29  Cary Coutant  <ccoutant@google.com>
8239
8240         * archive.cc (Library_base::should_include_member): Move
8241         method here from class Archive.
8242         (Archive::Archive): Initialize base class.
8243         (Archive::should_include_member): Move to base class.
8244         (Archive::do_for_all_unused_symbols): New function.
8245         (Add_archive_symbols::run): Remove redundant access to
8246         incremental_inputs.
8247         (Lib_group::Lib_group): Initialize base class.
8248         (Lib_group::do_filename): New function.
8249         (Lib_group::include_member): Pass pointer to Lib_group to
8250         report_object.
8251         (Lib_group::do_for_all_unused_symbols): New function.
8252         (Add_lib_group_symbols::run): Report archive information for
8253         incremental links.
8254         * archive.h (class Library_base): New base class.
8255         (class Archive): Derive from Library_base.
8256         (Archive::filename): Move to base class.
8257         (Archive::set_incremental_info): Likewise.
8258         (Archive::incremental_info): Likewise.
8259         (Archive::Should_include): Likewise.
8260         (Archive::should_include_member): Likewise.
8261         (Archive::Armap_entry): Remove.
8262         (Archive::Unused_symbol_iterator): Remove.
8263         (Archive::unused_symbols_begin): Remove.
8264         (Archive::unused_symbols_end): Remove.
8265         (Archive::do_filename): New function.
8266         (Archive::do_get_mtime): New function.
8267         (Archive::do_for_all_unused_symbols): New function.
8268         (Archive::task_): Move to base class.
8269         (Archive::incremental_info_): Likewise.
8270         (class Lib_group): Derive from Library_base.
8271         (Lib_group::do_filename): New function.
8272         (Lib_group::do_get_mtime): New function.
8273         (Lib_group::do_for_all_unused_symbols): New function.
8274         (Lib_group::task_): Move to base class.
8275         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8276         function.
8277         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8278         function.
8279         * incremental.cc (Incremental_inputs::report_archive_begin):
8280         Use Library_base; call library's get_mtime; add incremental inputs
8281         entry before members.
8282         (class Unused_symbol_visitor): New class.
8283         (Incremental_inputs::report_archive_end): Use Library_base; use
8284         visitor class to record unused symbols; don't add incremental inputs
8285         entry after members.
8286         (Incremental_inputs::report_object): Use Library_base.
8287         * incremental.h
8288         (Incremental_archive_entry::Incremental_archive_entry): Remove
8289         unused Archive parameter.
8290         (Incremental_inputs::report_archive_begin): Use Library_base.
8291         (Incremental_inputs::report_archive_end): Likewise.
8292         (Incremental_inputs::report_object): Likewise.
8293         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8294         function.
8295         * object.h (Object::for_all_global_symbols): New function.
8296         (Object::do_for_all_global_symbols): New function.
8297         (Sized_relobj::do_for_all_global_symbols): New function.
8298         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8299         function.
8300         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8301         function.
8302
8303 2011-03-27  Ian Lance Taylor  <iant@google.com>
8304
8305         * archive.cc (Archive::interpret_header): Return -1 if something
8306         goes wrong.  Change callers accordingly.
8307
8308 2011-03-25  Cary Coutant  <ccoutant@google.com>
8309
8310         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8311         * testsuite/Makefile.in: Regenerate.
8312
8313 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8314
8315         * plugin.cc (get_view): New.
8316         (Plugin::load): Pass get_view to the plugin.
8317         (Plugin_manager::get_view): New.
8318
8319 2011-03-21  Ian Lance Taylor  <iant@google.com>
8320
8321         * testsuite/final_layout.sh: Rewrite to not use dc.
8322         * testsuite/relro_test.sh: Fail if dc is not present.
8323
8324 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8325
8326         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8327         Change == to -eq.
8328         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8329         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8330         Change == to -eq.
8331         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8332         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8333
8334 2011-03-14  Ian Lance Taylor  <iant@google.com>
8335
8336         * script-sections.cc (Sort_output_sections::script_compare):
8337         Rename from is_before, change return type.
8338         (Sort_output_sections::operator()): Adjust accordingly.
8339
8340 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8341
8342         PR gold/12572
8343         * testsuite/odr_violation2.cc: Add comment to make all error line
8344         numbers double digits.
8345         * testsuite/debug_msg.sh: Adjust expected errors.
8346
8347 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8348
8349         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8350         but mark earlier ones as non-canonical
8351         (offset_to_iterator): Update search target and example
8352         (do_addr2line): Return extra lines in a vector*
8353         (format_file_lineno): Extract from do_addr2line
8354         (one_addr2line): Add vector* out-param
8355         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8356         when a lineno entry appeared last for its instruction
8357         (Dwarf_line_info): Add vector* out-param
8358         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8359         * symtab.cc (Odr_violation_compare): Include the lineno in the
8360         comparison again.
8361         (linenos_from_loc): New. Combine the canonical line for an
8362         address with its other lines.
8363         (True_if_intersect): New. Helper functor to make
8364         std::set_intersection a query.
8365         (detect_odr_violations): Compare sets of lines instead of just
8366         one line for each function. This became less deterministic, but
8367         has fewer false positives.
8368         * symtab.h: Declarations.
8369         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8370         mix an optimized and non-optimized object in the same binary
8371         (odr_violation2.so): Same.
8372         * testsuite/Makefile.in: Regenerate from Makefile.am.
8373         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8374         * testsuite/debug_msg.sh: Update line numbers and add
8375         assertions.
8376         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8377         non-optimized context.
8378         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8379         isn't inlined, and use OdrDerived in an optimized context.
8380         * testsuite/odr_header1.h: Defines OdrDerived, where
8381         optimization will change the
8382         first-instruction-in-the-destructor's file and line number.
8383         * testsuite/odr_header2.h: Defines OdrBase.
8384
8385 2011-03-09  Ian Lance Taylor  <iant@google.com>
8386
8387         * fileread.cc (File_read::clear_views): Don't delete the whole
8388         file view.
8389
8390 2011-03-08  Ian Lance Taylor  <iant@google.com>
8391
8392         PR gold/12525
8393         * fileread.cc: #include <climits>.
8394         (GOLD_IOV_MAX): Define.
8395         (File_read::read_multiple): Limit number of entries by iov_max.
8396         * fileread.h (class File_read): Always set max_readv_entries to
8397         128.
8398
8399 2011-03-07  Ian Lance Taylor  <iant@google.com>
8400
8401         PR gold/12525
8402         * options.h (class General_options): Add -dy and -dn.
8403
8404 2011-03-02  Cary Coutant  <ccoutant@google.com>
8405
8406         * testsuite/script_test_9.t: Add TLS segment.
8407
8408 2011-03-02  Simon Baldwin  <simonb@google.com>
8409
8410         * configure.ac: Add check for gnu_indirect_function support in
8411         the toolchain building binutils.
8412         * configure: Rebuild.
8413
8414 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8415
8416         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8417         plugin only symbols.
8418         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8419         in plugin files as not needed in the symbol table.
8420
8421 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8422
8423         * output.cc (Output_section::add_input_section): Delay fill
8424         generation for section ordering.
8425
8426 2011-02-09  Ian Lance Taylor  <iant@google.com>
8427
8428         PR gold/12316
8429         * object.h (class Sized_relobj): Remove clear_local_symbols.
8430         * reloc.cc (Sized_relobj::do_relocate): Don't call
8431         clear_local_symbols.
8432
8433 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8434
8435         * plugin.cc (is_visible_from_outside): Return true for symbols
8436         in the -u option.
8437
8438 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8439
8440         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8441         filename.
8442
8443 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8444
8445         * icf.h (is_section_foldable_candidate): Change type of parameter
8446         to std::string.
8447         * icf.cc (Icf::find_identical_sections): Change type of local variable
8448         section_name to be std::string.
8449         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8450
8451 2011-01-25  Ian Lance Taylor  <iant@google.com>
8452
8453         * script.cc (script_add_extern): Rewrite to use
8454         add_symbol_reference.
8455
8456 2011-01-25  Doug Kwan  <dougkwan@google.com>
8457
8458         * icf.cc (get_section_contents): Always lock section's object.
8459
8460 2011-01-24  Ian Lance Taylor  <iant@google.com>
8461
8462         * options.h (class General_options): Accept
8463         --no-detect-odr-violations.
8464
8465 2011-01-24  Ian Lance Taylor  <iant@google.com>
8466
8467         * version.cc (version_string): Bump to 1.11.
8468
8469 2011-01-24  Ian Lance Taylor  <iant@google.com>
8470
8471         * plugin.cc (class Plugin_rescan): Define new class.
8472         (Plugin_manager::claim_file): Set any_claimed_.
8473         (Plugin_manager::save_archive): New function.
8474         (Plugin_manager::save_input_group): New function.
8475         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8476         necessary.
8477         (Plugin_manager::new_undefined_symbol): New function.
8478         (Plugin_manager::rescan): New function.
8479         (Plugin_manager::rescannable_defines): New function.
8480         (Plugin_manager::add_input_file): Set any_added_.
8481         * plugin.h (class Plugin_manager): define new fields rescannable_,
8482         undefined_symbols_, any_claimed_, and any_added_.  Declare
8483         Plugin_rescan as friend.  Declare new functions.
8484         (Plugin_manager::Rescannable): Define type.
8485         (Plugin_manager::Rescannable_list): Define type.
8486         (Plugin_manager::Undefined_symbol_list): Define type.
8487         (Plugin_manager::Plugin_manager): Initialize new fields.
8488         * archive.cc (Archive::defines_symbol): New function.
8489         (Add_archive_symbols::run): Pass archive to plugins if any.
8490         * archive.h (class Archive): Declare defines_symbol.
8491         * readsyms.cc (Input_group::~Input_group): New function.
8492         (Finish_group::run): Pass input_group to plugins if any.
8493         * readsyms.h (class Input_group): Declare destructor.
8494         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8495         any.
8496
8497 2011-01-10  Ian Lance Taylor  <iant@google.com>
8498
8499         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8500         section as relro.
8501         (Layout::set_segment_offsets): Reset increase_relro before calling
8502         set_section_addresses a second time.
8503
8504 2011-01-04  Cary Coutant  <ccoutant@google.com>
8505
8506         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8507         sections before NOBITS sections.
8508
8509 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8510
8511         * version.cc (print_version): Update copyright to 2011.
8512
8513 2010-12-23  Cary Coutant  <ccoutant@google.com>
8514
8515         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8516         of OS to this->add.  Add OD parameter to second form of the function.
8517
8518 2010-12-20  Ian Lance Taylor  <iant@google.com>
8519
8520         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8521         second of two consecutive entries with same offset.
8522
8523 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8524
8525         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8526         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8527         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8528         to avoid unneeded links against $(LDADD).
8529         * testsuite/Makefile.in: Regenerate.
8530
8531 2010-12-15  Ian Lance Taylor  <iant@google.com>
8532
8533         PR gold/12324
8534         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8535         for R_X86_64_32 and R_X86_64_PC32.
8536         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8537         ver_matching_def_pic.o.
8538         (ver_matching_def_pic.o): New target.
8539
8540 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8541
8542         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8543         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8544         Move definition before File_read::View member definitions.
8545         (File_read::View::~View): Initialize and hold lock before
8546         updating current_mapped_bytes.
8547
8548 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8549
8550         * dwarf_reader.cc: Remove outdated comment.
8551         * gold-threads.cc: Fix typo in error message.
8552         * archive.cc: Fix typos in comments.
8553         * archive.h: Likewise.
8554         * arm-reloc-property.cc: Likewise.
8555         * arm-reloc-property.h: Likewise.
8556         * arm-reloc.def: Likewise.
8557         * arm.cc: Likewise.
8558         * attributes.h: Likewise.
8559         * cref.cc: Likewise.
8560         * ehframe.cc: Likewise.
8561         * fileread.h: Likewise.
8562         * gold.h: Likewise.
8563         * i386.cc: Likewise.
8564         * icf.cc: Likewise.
8565         * incremental.h: Likewise.
8566         * int_encoding.cc: Likewise.
8567         * layout.h: Likewise.
8568         * main.cc: Likewise.
8569         * merge.h: Likewise.
8570         * object.cc: Likewise.
8571         * object.h: Likewise.
8572         * options.cc: Likewise.
8573         * readsyms.cc: Likewise.
8574         * reduced_debug_output.cc: Likewise.
8575         * reloc.cc: Likewise.
8576         * script-sections.cc: Likewise.
8577         * sparc.cc: Likewise.
8578         * symtab.h: Likewise.
8579         * target-reloc.h: Likewise.
8580         * target.cc: Likewise.
8581         * target.h: Likewise.
8582         * timer.cc: Likewise.
8583         * timer.h: Likewise.
8584         * x86_64.cc: Likewise.
8585
8586 2010-12-09  Cary Coutant  <ccoutant@google.com>
8587
8588         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8589         stack.
8590         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8591         parameter; change all callers.
8592         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8593         * options.h (warn_execstack): New option.
8594
8595 2010-12-07  Doug Kwan  <dougkwan@google.com>
8596
8597         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8598         like function call relocations.
8599
8600 2010-12-07  Ian Lance Taylor  <iant@google.com>
8601
8602         * archive.cc (Archive::get_elf_object_for_member): Permit
8603         punconfigured to be NULL.
8604         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8605         (Archive::include_member): Pass NULL to get_elf_object_for_member
8606         if we searched for the archive and this is the first included
8607         object.
8608
8609 2010-12-01  Ian Lance Taylor  <iant@google.com>
8610
8611         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8612         track_relocs_type_ field.
8613         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8614         Set track_relocs_type_.
8615         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8616         contents when using RELA relocs.
8617         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8618         reloc_map_.
8619         * reloc.cc (Track_relocs::next_addend): New function.
8620         * reloc.h (class Track_relocs): Declare next_addend.
8621
8622 2010-12-01  Ian Lance Taylor  <iant@google.com>
8623
8624         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8625         virtual destructor.
8626
8627 2010-12-01  Ian Lance Taylor  <iant@google.com>
8628
8629         * README: Update compilers known to work and fail.
8630
8631 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8632
8633         * configure.in: For --enable-gold, handle value `default' instead of
8634         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8635         not the default.
8636         * configure: Regenerate.
8637
8638 2010-11-18  Doug Kwan  <dougkwan@google.com>
8639
8640         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8641         and right_alignment to be zero.  Store result alignment only if it is
8642         greater than existing alignment.
8643
8644 2010-11-16  Cary Coutant  <ccoutant@google.com>
8645
8646         PR gold/12220
8647         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8648         Check for ".zdebug_line".
8649
8650 2010-11-16  Doug Kwan  <dougkwan@google.com>
8651             Cary Coutant  <ccoutant@google.com>
8652
8653         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8654         by reference; adjust all callers.
8655         * output.cc (Output_segment::set_section_addresses): Adjust references
8656         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8657         list is empty.
8658         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8659         end at page boundary.
8660
8661 2010-11-16  Cary Coutant  <ccoutant@google.com>
8662
8663         PR gold/12220
8664         * layout.cc (Layout::choose_output_section): Transform names of
8665         compressed sections even when using a script with a SECTIONS clause.
8666         (Layout::output_section_name): Remove code to transform
8667         compressed debug section names.
8668         * output.cc (Output_section::add_input_section): Use uncompressed
8669         section size when tracking input sections.
8670
8671 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8672
8673         * symtab.h (Symbol::NON_PIC_REF): Remove.
8674         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8675         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8676         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8677         (Symbol::use_plt_offset): Take a flags argument and pass it
8678         directly to needs_dynamic_reloc.  Restrict check for undefined
8679         weak symbols to function calls.
8680         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8681         (Target_arm::Scan::global): Use it.
8682         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8683         (Target_arm::Relocate::relocate): Likewise.
8684         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8685         parameter with an r_type parameter.  Use get_reference_flags
8686         to get the flags.
8687         (Target_arm::Relocate::relocate): Update accordingly.
8688         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8689         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8690         (Target_i386::Scan::global): Likewise.
8691         (Target_i386::Relocate::relocate): Likewise.
8692         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8693         parameter with an r_type parameter.  Use get_reference_flags
8694         to get the flags.
8695         (Target_i386::Relocate::relocate): Update accordingly.
8696         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8697         (Target_powerpc::Scan::global): Use it.
8698         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8699         (Target_powerpc::Relocate::relocate): Likewise.
8700         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8701         (Target_sparc::Scan::global): Use it.
8702         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8703         (Target_sparc::Relocate::relocate): Likewise.
8704         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8705         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8706         (Target_x86_64::Scan::global): Likewise.
8707         (Target_x86_64::Relocate::relocate): Likewise.
8708
8709 2010-11-08  Doug Kwan  <dougkwan@google.com>
8710             Cary Coutant  <ccoutant@google.com>
8711
8712         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8713         (Arm_exidx_merge_section::section_contents_): New data member.
8714         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8715         (Arm_input_section::~Arm_input_section): De-allocate memory.
8716         (Arm_input_section::original_contents_): New data member.
8717         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8718         in parameters instead of calling Object::section_contents without
8719         locking.
8720         (Arm_output_section::group_section): New parameter TASK.  Pass it
8721         to callees that need locking objects.
8722         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8723         to lock EXIDX input sections.  Fix a formatting issue.  Call
8724         Arm_exidx_merged_section::build_contents to create merged section
8725         contents.
8726         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8727         to lock object of stub table owner.
8728         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8729         TEXT_SIZE to initialize data member TEXT_SIZE_.
8730         (Arm_exidx_input_section::addralign): Fix typo in comment.
8731         (Arm_exidx_input_section::text_size): New method.
8732         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8733         that require locking objects.  Lock objects before scanning for stubs
8734         and updating local symbols.
8735         (Arm_input_section<big_endian>::init): Copy contents of original
8736         input section.
8737         (Arm_input_section<big_endian>::do_write): Use saved contents of
8738         original input section instead of calling Object::section_contents
8739         without locking.
8740         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8741         size without calling Object::section_size().
8742         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8743         for size.  Allocate a buffer for merged EXIDX entries.
8744         (Arm_exidx_merged_section::build_contents): New method.
8745         (Arm_exidx_merged_section::do_write): Move merge section contents
8746         building code to Arm_exidx_merged_section::build_contetns.  Write
8747         out contetns in buffer instead of building it on the fly.
8748         (Arm_relobj::make_exidx_input_section): Also pass text section size
8749         to Arm_exidx_input_section constructor.
8750         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8751         (Arm_dynobj::do_read_symbols): Fix memory leak.
8752         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8753         * target.h: (class Task): Add forward declaration.
8754         (Target::relax): Add new parameter TASK and pass it to
8755         Target::do_relax().
8756         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8757
8758 2010-11-05  Cary Coutant  <ccoutant@google.com>
8759
8760         PR gold/10708
8761         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8762         object when reading from the file.
8763         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8764         second layout pass.
8765         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8766         when reading section contents.
8767         (get_section_contents): Likewise.
8768         (icf::find_identical_sections): Likewise.
8769         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8770         object when reading from the file.
8771         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8772         the object when doing deferred section layout.
8773
8774 2010-11-03  Nick Clifton  <nickc@redhat.com>
8775
8776         PR gold/12001
8777         * script.h (class Symbol_assignment: name): New member.  Returns
8778         the name of the symbol.
8779         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8780         Returns true if the given symbol name is on the list of
8781         assignments wating to be processed.
8782         * archive.cc (should_incldue_member): If the symbol is undefined,
8783         check to see if it is on the list of symbols pending assignment.
8784
8785 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8786
8787         * script-sections.cc (Script_sections::find_memory_region): Check
8788         for a NULL output section pointer.
8789
8790 2010-10-29  Doug Kwan  <dougkwan@google.com>
8791
8792         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8793         Output_section::add_relaxed_input_section.
8794         * output.cc (Output_section::add_relaxed_input_section): Add new
8795         arguments LAYOUT and NAME.  Set section order index.
8796         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8797         Copy section order index.
8798         * output.h (Output_section::add_relaxed_input_section): Add new
8799         arguments LAYOUT and NAME.
8800
8801 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8802
8803         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8804         NATIVE_OR_CROSS_LINKER.
8805         * testsuite/Makefile.in: Regenerate.
8806
8807 2010-10-20  Doug Kwan  <dougkwan@google.com>
8808
8809         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8810         without SHF_LINK_ORDER flags.
8811         * layout.cc (Layout::choose_output_section): Do not filter
8812         SHF_LINK_ORDER flag in a relocatable link.
8813
8814 2010-10-17  Cary Coutant  <ccoutant@google.com>
8815
8816         * output.h (Output_segment::set_section_addresses): Change function
8817         signature.  Update all callers.
8818         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8819         sections.
8820         (Output_segment::set_section_addresses): Align after last TLS
8821         section.  Add padding before last relro section instead of after.
8822
8823 2010-10-17  Doug Kwan  <dougkwan@google.com>
8824
8825         * arm.cc (Target_arm::got_section): Use correct order and set
8826         GOT output section to be writable.
8827
8828 2010-10-14  Cary Coutant  <ccoutant@google.com>
8829
8830         * debug.h (DEBUG_INCREMENTAL): New flag.
8831         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8832         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8833         mode.
8834         * incremental.cc (report_command_line): Ignore all forms of
8835         --incremental.
8836         * layout.cc (Layout::Layout): Check parameters for incremental link
8837         mode.
8838         * options.cc (General_options::parse_incremental): New function.
8839         (General_options::parse_no_incremental): New function.
8840         (General_options::parse_incremental_full): New function.
8841         (General_options::parse_incremental_update): New function.
8842         (General_options::incremental_mode_): New data member.
8843         (General_options::finalize): Check incremental_mode_.
8844         * options.h (General_options): Update help text for --incremental.
8845         Add --no-incremental, --incremental-full, --incremental-update.
8846         (General_options::Incremental_mode): New enum type.
8847         (General_options::incremental_mode): New function.
8848         (General_options::incremental_mode_): New data member.
8849         * parameters.cc (Parameters::incremental_mode_): New data member.
8850         (Parameters::set_options): Set incremental_mode_.
8851         (Parameters::set_incremental_full): New function.
8852         (Parameters::incremental): New function.
8853         (Parameters::incremental_update): New function.
8854         (set_parameters_incremental_full): New function.
8855         * parameters.h (Parameters::set_incremental_full): New function.
8856         (Parameters::incremental): New function.
8857         (Parameters::incremental_update): New function.
8858         (Parameters::incremental_mode_): New data member.
8859         (set_parameters_incremental_full): New function.
8860         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8861         incremental link mode.
8862         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8863         (Sized_relobj::do_relocate_sections): Likewise.
8864         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8865         option.
8866         * testsuite/Makefile.in: Regenerate.
8867         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8868
8869 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8870
8871         * script-sections.h (class Script_sections): Make
8872         Sections_elements typedef public.
8873         * script-sections.cc (class Sort_output_sections): Add elements_
8874         field.  Add constructor which sets it; change all callers.
8875         (Sort_output_sections::is_before): New function.
8876         (Sort_output_sections::operator()): Call is_before.
8877         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8878         conditional.
8879         * testsuite/script_test_10.sh: New test. Test script section
8880         order.
8881         * testsuite/script_test_10.t: Likewise.
8882         * testsuite/script_test_10.s: Likewise.
8883         * testsuite/Makefile.am: Wrap the cross linker tests and the
8884         common tests into NATIVE_OR_CROSS_LINKER.
8885         (check_SCRIPTS): Add script_test_10.sh.
8886         (check_DATA): Add script_test_10.stdout.
8887         (script_test_10.o, script_test_10): New targets.
8888         (script_test_10.stdout): New target.
8889         * configure, testsuite/Makefile.in: Regenerate.
8890
8891 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8892
8893         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8894         error for the deprecated relocations.
8895         (Target_arm::Scan::global): Likewise.
8896         (Target_arm::Relocate::relocate): Likewise.
8897
8898 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8899
8900         * fileread.cc (Input_file::find_file): Initialize *found_name
8901         and *namep when using the fallback search for case 4.
8902
8903 2010-10-11  Cary Coutant  <ccoutant@google.com>
8904
8905         * options.h (class General_options): Redefine -z lazy as an alias for
8906         the negation of -z now.
8907
8908 2010-10-11  Ian Lance Taylor  <iant@google.com>
8909
8910         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8911         binding.
8912
8913 2010-10-06  Nick Clifton  <nickc@redhat.com>
8914
8915         * script-sections.cc(class Memory_region): Remove
8916         current_lma_offset_ field.  Rename current_vma_offset_ to
8917         current_offset_.  Add last_section_ field.
8918         (Memory_region::get_current_vma_address): Rename to
8919         get_current_address.
8920         (Memory_region::get_current_lma_address): Delete.
8921         (Memory_region::increment_vma_offset): Rename to
8922         increment_offset.
8923         (Memory_region::increment_lma_offset): Delete.
8924         (Memory_region::attributes_compatible): New method.  Returns
8925         true if the provided section is compatible with the region.
8926         (Memory_region::get_last_section): New method.  Returns the last
8927         section to use the region.
8928         (Memory_region::set_last_section): New method.  Stores the last
8929         section to use the region.
8930         (Script_sections::block_in_region): New method.  Returns true if
8931         a block of memory is contained within a region.
8932         (Script_sections::find_memory_region): New method.  Locates a
8933         memory region to be used to set a VMA or LMA address.
8934         (Output_section_definition::set_section_addresses): Add code to
8935         check for addresses set by memory regions.
8936         (Output_segment::set_section_addresses): Remove memory region
8937         walking code.
8938         (Script_sections::create_segment): Add a warning if a header
8939         segment is created outside of any region.
8940         * script-sections.h (class Script_sections): Add prototypes for
8941         find_memory_region and block_in_region methods.
8942         * testsuite/memory_test.s: Use .long instead of .word.
8943         * testsuite/memory_test.t: Add some more output sections.
8944         * testsuite/memory_test.sh: Update expected output.
8945
8946 2010-10-02  Doug Kwan  <dougkwan@google.com>
8947
8948         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8949         defintion to symtab.h
8950         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8951         declaration to defintion.
8952
8953 2010-10-01  Nick Clifton  <nickc@redhat.com>
8954
8955         * expression.cc (eval): Replace dummy argument with NULL.
8956         (eval_maybe_dot): Check for a NULL result section pointer.
8957         (Symbol_expression::value): Likewise.
8958         (Dot_expression::value): Likewise.
8959         (BINARY_EXPRESSION): Likewise.
8960         (Max_expression::value): Likewise.
8961         (Min_expression::value): Likewise.
8962         (Absolute_expression::value): Likewise.
8963         (Addr_expression::value_from_output_section): Likewise.
8964         (Loaddddr_expression::value_from_output_section): Likewise.
8965         (Segment_start_expression::value): Likewise.
8966         * script-sections.cc
8967         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8968         argument with NULL.
8969         (Sections_elememt_dot_assignment::set_section_addresses):
8970         Likewise.
8971         (Output_data_expression::do_write_to_buffer): Likewise.
8972         (Output_section_definition::finalize_symbols): Likewise.
8973         (Output_section_definition::set_section_addresses): Likewise.
8974
8975 2010-09-30  Doug Kwan  <dougkwan@google.com>
8976
8977         * testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8978
8979 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8980
8981         * target.h (Target::can_icf_inline_merge_sections): New virtual
8982         function.
8983         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8984         virtual function.
8985         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8986         virtual function.
8987         * icf.cc (get_section_contents): Inline merge sections only when
8988         target allows it.
8989
8990 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8991
8992         * configure: Regenerate.
8993
8994 2010-09-17  Ian Lance Taylor  <iant@google.com>
8995
8996         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8997         * testsuite/Makefile.am (memory_test.o): New target.
8998         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8999         memory_test.t.
9000         * testsuite/Makefile.in: Rebuild.
9001
9002 2010-09-17  Doug Kwan  <dougkwan@google.com>
9003
9004         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
9005         defintion if relocation uses GOT entries of the symbol.
9006         * testsuite/icf_safe_test.sh: Fix test.
9007         * testsuite/icf_safe_so_test.sh: Fix test.
9008
9009 2010-09-16  Cary Coutant  <ccoutant@google.com>
9010
9011         * script_sections.cc (class Memory_region): Remove "NULL" from
9012         vector initializations.
9013
9014 2010-09-15  Cary Coutant  <ccoutant@google.com>
9015
9016         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
9017         Resolve forwarding symbols.
9018
9019 2010-09-15  Doug Kwan  <dougkwan@google.com>
9020
9021         * testsuite/script_test_3.t: Add ARM special sections.
9022         * testsuite/script_test_4.t: Same.
9023         * testsuite/script_test_5.t: Same.
9024         * testsuite/script_test_6.t: Same.
9025         * testsuite/script_test_7.t: Same.
9026         * testsuite/script_test_7.t: Same.
9027         * testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
9028
9029 2010-09-14  Cary Coutant  <ccoutant@google.com>
9030
9031         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
9032         (Target_x86_64::Relocate::relocate_tls): Replace check for
9033         saw_tls_block_reloc_ with test for executable section.
9034
9035 2010-09-12  Cary Coutant  <ccoutant@google.com>
9036
9037         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
9038         position-independent executables to shared libraries need dynamic
9039         relocations.
9040         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
9041         position-independent executables.
9042         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
9043         * testsuite/Makefile.in: Regenerate.
9044
9045 2010-09-10  Nick Clifton  <nickc@redhat.com>
9046
9047         PR gold/11997
9048         * testsuite/memory_test.t: Discard any sections that are not
9049         needed.
9050
9051 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
9052
9053         PR gold/11996
9054         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
9055         "This::" to work around a bug in gcc 4.2.
9056
9057         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
9058
9059 2010-09-09  Rafael Espindola  <espindola@google.com>
9060
9061         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
9062         sections with different PF_X flags in the same segment.
9063         (Layout::find_first_load_seg): Search all segments to find the first
9064         one.
9065         * options.h (rosegment): New.
9066
9067 2010-09-08  Rafael Espindola  <espindola@google.com>
9068
9069         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
9070
9071 2010-09-08  Doug Kwan  <dougkwan@google.com>
9072
9073         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
9074         (Arm_relobj::do_relocate_sections): Add new parameter for output
9075         file to match the parent.
9076         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
9077         of local symbols instead of input values.  Update code to track
9078         changes in gold::relocate_section.
9079         * object.cc (Sized_relobj::compute_final_local_value): New methods.
9080         (Sized_relobj::compute_final_local_value_internal): New methods.
9081         (Sized_relobj::do_finalize_local_symbols): Move code from loop
9082         body into private version of Sized_relobj::compute_final_local_value.
9083         Call the inline method.
9084         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
9085         merged symbol value if there is one.
9086         (Symbol_value::has_output_value): New method defintiion.
9087         (Sized_relobj::Compute_final_local_value_status): New enum type.
9088         (Sized_relobj::compute_final_local_value): New methods.
9089         (Sized_relobj::compute_final_local_value_internal): New methods.
9090         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
9091         and arm_cortex_a8.sh.
9092         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
9093         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
9094         New tests.
9095         * Makefile.in: Regenerate.
9096         * testsuite/arm_bl_out_of_range.s: Update test.
9097         * testsuite/thumb_bl_out_of_range.s: Ditto.
9098         * testsuite/thumb_blx_out_of_range.s: Ditto.
9099         * testsuite/arm_branch_out_of_range.sh: New file.
9100         * testsuite/arm_cortex_a8.sh: Ditto.
9101         * testsuite/arm_cortex_a8_b.s: Ditto.
9102         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
9103         * testsuite/arm_cortex_a8_b_local.s: Ditto.
9104         * testsuite/arm_cortex_a8_bl.s: Ditto.
9105         * testsuite/arm_cortex_a8_blx.s: Ditto.
9106         * testsuite/arm_cortex_a8_local.s: Ditto.
9107         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
9108         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
9109
9110 2010-09-08  Rafael Espindola  <espindola@google.com>
9111
9112         * Makefile.am (memory_test.stdout): Run readelf with -W.
9113         * Makefile.in: Regenerate.
9114         * testsuite/memory_test.sh: Make the regexps accept both 32 and
9115         64 bit output.
9116
9117 2010-09-08  Rafael Espindola  <espindola@google.com>
9118
9119         * script-sections.cc (Script_sections::add_memory_region): Convert
9120         field precision to int.
9121         * script.cc (script_set_section_region, script_set_section_region):
9122         Convert field precision to int.
9123
9124 2010-09-08  Rafael Espindola  <espindola@google.com>
9125
9126         * arm.cc (do_finalize_sections): Create the __exidx_start and
9127         __exdix_end symbols even when the section is missing.
9128
9129 2010-09-08  Nick Clifton  <nickc@redhat.com>
9130
9131         * README: Remove claim that MEMORY is not supported.
9132         * expression.cc (script_exp_function_origin)
9133         (script_exp_function_length): Move from here to ...
9134         * script.cc: ... here.
9135         (script_set_section_region, script_add_memory)
9136         (script_parse_memory_attr, script_include_directive): New
9137         functions.
9138         * script-sections.cc
9139         (class Memory_region): New class.
9140         (class Output_section_definition): Add set_memory_region,
9141         set_section_vma, set_section_lma and get_section_name methods.
9142         (class Script_Sections): Add add_memory_region,
9143         find_memory_region, find_memory_region_origin,
9144         find_memory_region_length and set_memory_region methods.
9145         Have set_section_addresses method walk the list of set memory
9146         regions.
9147         Extend the print methos to display memory regions.
9148         * script-sections.h: Add prototypes for new methods.
9149         Add enum for MEMORY region attributes.
9150         * yyscript.y: Add support for parsing MEMORY regions.
9151         * script-c.h: Add prototypes for new functions.
9152         * testsuite/Makefile.am: Add test of MEMORY region functionality.
9153         * testsuite/Makefile.in: Regenerate.
9154         * testsuite/memory_test.sh: New script.
9155         * testsuite/memory_test.s: New assembler source file.
9156         * testsuite/memory_test.t: New linker script.
9157
9158 2010-08-27  Doug Kwan  <dougkwan@google.com>
9159
9160         * resolve.cc (Symbol_table::should_override): Let a weak
9161         reference override an existing dynamic weak reference.
9162         * testsuite/Makefile.am: Add new test dyn_weak_ref.
9163         * testsuite/Makefile.in: Regenerate.
9164         * testsuite/dyn_weak_ref.sh: New file.
9165         * testsuite/dyn_weak_ref_1.c: Ditto.
9166         * testsuite/dyn_weak_ref_2.c: Ditto.
9167
9168 2010-08-27  Ian Lance Taylor  <iant@google.com>
9169
9170         * incremental.h (class Incremental_input_entry): Add virtual
9171         destructor.
9172
9173 2010-08-27  Ian Lance Taylor  <iant@google.com>
9174
9175         * testsuite/start_lib_test_3.c: Mark t3 as used.
9176
9177 2010-08-27  Nick Clifton  <nickc@redhat.com>
9178
9179         * options.cc (version_script): Fix small typo in previous
9180         whitespace tidyup.
9181
9182 2010-08-25  Nick Clifton  <nickc@redhat.com>
9183
9184         * archive.cc: Formatting fixes: Remove whitespace between
9185         typename and following asterisk.  Remove whitespace between
9186         function name and opening parenthesis.
9187         * archive.h: Likewise.
9188         * arm.cc: Likewise.
9189         * attributes.cc: Likewise.
9190         * attributes.h: Likewise.
9191         * common.cc: Likewise.
9192         * copy-relocs.cc: Likewise.
9193         * dirsearch.h: Likewise.
9194         * dynobj.cc: Likewise.
9195         * ehframe.cc: Likewise.
9196         * ehframe.h: Likewise.
9197         * expression.cc: Likewise.
9198         * fileread.cc: Likewise.
9199         * fileread.h: Likewise.
9200         * gc.h: Likewise.
9201         * gold-threads.cc: Likewise.
9202         * gold.cc: Likewise.
9203         * i386.cc: Likewise.
9204         * icf.h: Likewise.
9205         * incremental-dump.cc: Likewise.
9206         * incremental.cc: Likewise.
9207         * layout.cc: Likewise.
9208         * layout.h: Likewise.
9209         * main.cc: Likewise.
9210         * merge.cc: Likewise.
9211         * merge.h: Likewise.
9212         * object.cc: Likewise.
9213         * object.h: Likewise.
9214         * options.cc: Likewise.
9215         * options.h: Likewise.
9216         * output.cc: Likewise.
9217         * output.h: Likewise.
9218         * plugin.cc: Likewise.
9219         * plugin.h: Likewise.
9220         * powerpc.cc: Likewise.
9221         * reloc.cc: Likewise.
9222         * script-c.h: Likewise.
9223         * script-sections.cc: Likewise.
9224         * script.cc: Likewise.
9225         * stringpool.cc: Likewise.
9226         * symtab.cc: Likewise.
9227         * symtab.h: Likewise.
9228         * target.cc: Likewise.
9229         * timer.cc: Likewise.
9230         * timer.h: Likewise.
9231         * version.cc: Likewise.
9232         * x86_64.cc: Likewise.
9233
9234 2010-08-24  Nick Clifton  <nickc@redhat.com>
9235
9236         PR 11899
9237         * layout.cc (segment_precedes): Sort segments by their physical
9238         addresses, if they have been set.
9239
9240 2010-08-23  Cary Coutant  <ccoutant@google.com>
9241
9242         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9243         symbols data.
9244         (Lib_group::include_member): Unlock object after deleting its
9245         symbols data.
9246         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9247         the bug fixed here.
9248
9249 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9250             Cary Coutant  <ccoutant@google.com>
9251
9252         * archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9253         constructor, and set_blocker.
9254         * archive.cc (Add_lib_group_symbols::is_runnable): Also check
9255         readsyms_blocker_.
9256         * readsyms.cc (Read_symbols::do_lib_group): Also pass
9257         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9258         * testsuite/Makefile.am (start_lib_test): New test case.
9259         * testsuite/Makefile.in: Regenerate.
9260         * testsuite/start_lib_test_main.c: New file.
9261         * testsuite/start_lib_test_1.c: New file.
9262         * testsuite/start_lib_test_2.c: New file.
9263         * testsuite/start_lib_test_3.c: New file.
9264
9265 2010-08-19  Ian Lance Taylor  <iant@google.com>
9266
9267         * Makefile.in: Rebuild with automake 1.11.1.
9268         * aclocal.m4: Likewise.
9269         * testsuite/Makefile.in: Likewise.
9270
9271 2010-08-19  Ian Lance Taylor  <iant@google.com>
9272
9273         PR 10893
9274         * i386.cc (class Output_data_plt_i386): Update declarations.
9275         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9276         local_ifuncs_ fields.
9277         (Target_i386::do_plt_section_for_global): New function.
9278         (Target_i386::do_plt_section_for_local): New function.
9279         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9280         parameter; change all callers.  Initialize global_ifuncs_ and
9281         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9282         __rel_iplt_end.
9283         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9284         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9285         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9286         symbols.
9287         (Target_i386::make_plt_section): New function, broken out of
9288         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9289         (Target_i386::make_plt_entry): Call make_plt_section.
9290         (Target_i386::make_local_ifunc_plt_entry): New function.
9291         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9292         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9293         R_386_IRELATIVE to switch.
9294         (Target_i386::Scan::global): Likewise.
9295         (Target_i386::Relocate::relocate): Likewise.
9296         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9297         switch.
9298         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9299         (Target_x86_64::do_plt_section_for_global): New function.
9300         (Target_x86_64::do_plt_section_for_local): New function.
9301         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9302         parameter; change all callers.  If doing a static link define
9303         __rela_iplt_start and __rela_iplt_end.
9304         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9305         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9306         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9307         to point to .plt.
9308         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9309         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9310         switch.
9311         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9312         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9313         R_X86_64_IRELATIVE to switch.
9314         (Target_x86_64::Scan::global): Likewise.
9315         (Target_x86_64::Relocate::relocate): Likewise.
9316         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9317         switch.
9318         * target.h (class Target): Add plt_section_for_global and
9319         plt_section_for_local functions.  Add do_plt_section_for_global
9320         and do_plt_section_for_local virtual functions.
9321         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9322         clarifying comments.
9323         (Symbol::use_plt_offset): Handle IFUNC symbol.
9324         * object.cc (Sized_relobj::Sized_relobj): Initialize
9325         local_plt_offsets_.
9326         (Sized_relobj::local_has_plt_offset): New function.
9327         (Sized_relobj::local_plt_offset): New function.
9328         (Sized_relobj::set_local_plt_offset): New function.
9329         (Sized_relobj::do_count): Handle IFUNC symbol.
9330         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9331         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9332         is_ifunc_symbol functions.
9333         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9334         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9335         local_plt_offsets_ field.
9336         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9337         * output.h (class Output_section_data): Add non-const
9338         output_section function.
9339         (class Output_data_got): Update declarations.
9340         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9341         Add use_plt_offset parameter to global and local constructors.
9342         Change all callers.  Change local_sym_index_ field to 31 bits.
9343         Change GSYM_CODE and CONSTANT_CODE accordingly.
9344         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9345         doing a static link don't set sh_link field.
9346         (Output_data_got::Got_entry::write): Use PLT offset if
9347         appropriate.
9348         (Output_data_got::add_global_plt): New function.
9349         (Output_data_got::add_local_plt): New function.
9350         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9351         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9352         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9353         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9354         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9355         IFUNC conditional.
9356         * testsuite/ifunc-sel.h: New file.
9357         * testsuite/ifuncmain1.c: New file.
9358         * testsuite/ifuncmain1vis.c: New file.
9359         * testsuite/ifuncmod1.c: New file.
9360         * testsuite/ifuncdep2.c: New file.
9361         * testsuite/ifuncmain2.c: New file.
9362         * testsuite/ifuncmain3.c: New file.
9363         * testsuite/ifuncmod3.c: New file.
9364         * testsuite/ifuncmain4.c: New file.
9365         * testsuite/ifuncmain5.c: New file.
9366         * testsuite/ifuncmod5.c: New file.
9367         * testsuite/ifuncmain6pie.c: New file.
9368         * testsuite/ifuncmod6.c: New file.
9369         * testsuite/ifuncmain7.c: New file.
9370         * configure, testsuite/Makefile.in: Rebuild.
9371
9372 2010-08-18  Ian Lance Taylor  <iant@google.com>
9373
9374         * incremental.cc
9375         (Output_section_incremental_inputs::write_input_files): Add cast
9376         to avoid signed/unsigned comparison warning.
9377         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9378
9379 2010-08-12  Cary Coutant  <ccoutant@google.com>
9380
9381         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9382
9383 2010-08-13  Ian Lance Taylor  <iant@google.com>
9384
9385         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9386
9387 2010-08-12  Cary Coutant  <ccoutant@google.com>
9388             Doug Kwan  <dougkwan@google.com>
9389
9390         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9391         defintion overrides non-weak undef, remember that the original undef
9392         is not weak.
9393         * symtab.cc (Symbol_table::sized_write_global): For undef without
9394         an original weak binding, set binding to global in output.
9395         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9396         * testsuite/Makefile.in: Regenerate.
9397         * testsuite/strong_ref_weak_def.sh: New file.
9398         * testsuite/strong_ref_weak_def_1.c: Ditto.
9399         * testsuite/strong_ref_weak_def_2.c: Ditto.
9400
9401 2010-08-12  Cary Coutant  <ccoutant@google.com>
9402
9403         * testsuite/incremental_test.sh: Rewrite.
9404         * testsuite/incremental_test_1.c: Rewrite.
9405         * testsuite/incremental_test_2.c: Rewrite.
9406
9407 2010-08-12  Cary Coutant  <ccoutant@google.com>
9408
9409         * arm.cc (Target_arm::got_size): Add const.
9410         (Target_arm::got_entry_count): New function.
9411         (Target_arm::plt_entry_count): New function.
9412         (Target_arm::first_plt_entry_offset): New function.
9413         (Target_arm::plt_entry_size): New function.
9414         (Output_data_plt_arm::entry_count): New function.
9415         (Output_data_plt_arm::first_plt_entry_offset): New function.
9416         (Output_data_plt_arm::get_plt_entry_size): New function.
9417         * i386.cc (Target_i386::got_size): Add const.
9418         (Target_i386::got_entry_count): New function.
9419         (Target_i386::plt_entry_count): New function.
9420         (Target_i386::first_plt_entry_offset): New function.
9421         (Target_i386::plt_entry_size): New function.
9422         (Output_data_plt_i386::entry_count): New function.
9423         (Output_data_plt_i386::first_plt_entry_offset): New function.
9424         (Output_data_plt_i386::get_plt_entry_size): New function.
9425         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9426         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9427         * incremental.cc: Include target.h.
9428         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9429         parameter.  Adjust all callers.  Find incremental_got_plt section.
9430         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9431         section.
9432         (Output_section_incremental_inputs::set_final_data_size): Calculate
9433         size of incremental_got_plt section.
9434         (Output_section_incremental_inputs::do_write): Write the
9435         incremental_got_plt section.
9436         (Got_plt_view_info): New struct.
9437         (Local_got_offset_visitor): New class.
9438         (Global_got_offset_visitor): New class.
9439         (Global_symbol_visitor_got_plt): New class.
9440         (Output_section_incremental_inputs::write_got_plt): New function.
9441         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9442         Add parameter.  Adjust all callers.
9443         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9444         (Incremental_inputs::got_plt_section): New function.
9445         (Incremental_inputs::got_plt_section_): New data member.
9446         (Incremental_got_plt_reader): New class.
9447         * layout.cc (Layout::create_incremental_info_sections): Add the
9448         incremental_got_plt section.
9449         * object.h (Got_offset_list::get_list): New function.
9450         (Got offset_list::for_all_got_offsets): New function.
9451         (Sized_relobj::local_got_offset_list): New function.
9452         * powerpc.cc (Target_powerpc::got_size): Add const.
9453         (Target_powerpc::got_entry_count): New function.
9454         (Target_powerpc::plt_entry_count): New function.
9455         (Target_powerpc::first_plt_entry_offset): New function.
9456         (Target_powerpc::plt_entry_size): New function.
9457         (Output_data_plt_powerpc::entry_count): New function.
9458         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9459         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9460         * sparc.cc (Target_sparc::got_size): Add const.
9461         (Target_sparc::got_entry_count): New function.
9462         (Target_sparc::plt_entry_count): New function.
9463         (Target_sparc::first_plt_entry_offset): New function.
9464         (Target_sparc::plt_entry_size): New function.
9465         (Output_data_plt_sparc::entry_count): New function.
9466         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9467         (Output_data_plt_sparc::get_plt_entry_size): New function.
9468         * symtab.h (Symbol::got_offset_list): New function.
9469         (Symbol_table::for_all_symbols): New function.
9470         * target.h (Sized_target::got_entry_count): New function.
9471         (Sized_target::plt_entry_count): New function.
9472         (Sized_target::plt_entry_size): New function.
9473         * x86_64.cc (Target_x86_64::got_size): Add const.
9474         (Target_x86_64::got_entry_count): New function.
9475         (Target_x86_64::plt_entry_count): New function.
9476         (Target_x86_64::first_plt_entry_offset): New function.
9477         (Target_x86_64::plt_entry_size): New function.
9478         (Output_data_plt_x86_64::entry_count): New function.
9479         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9480         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9481
9482 2010-08-12  Cary Coutant  <ccoutant@google.com>
9483
9484         * archive.cc: Include incremental.h.
9485         (Archive::Archive): Initialize incremental_info_.
9486         (Archive::include_member): Record archive members in incremental info.
9487         (Add_archive_symbols::run): Record begin and end of an archive in
9488         incremental info.
9489         (Lib_group::include_member): Record objects in incremental info.
9490         * archive.h (Incremental_archive_entry): Forward declaration.
9491         (Archive::set_incremental_info): New member function.
9492         (Archive::incremental_info): New member function.
9493         (Archive::Unused_symbol_iterator): New class.
9494         (Archive::unused_symbols_begin): New member function.
9495         (Archive::unused_symbols_end): New member function.
9496         (Archive::incremental_info_): New data member.
9497         * incremental-dump.cc (find_input_containing_global): New function.
9498         (dump_incremental_inputs): Dump new incremental info sections.
9499         * incremental.cc: Include symtab.h.
9500         (Output_section_incremental_inputs): New class.
9501         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9502         new incremental info sections.
9503         (Sized_incremental_binary::do_check_inputs): Likewise.
9504         (Incremental_inputs::report_archive): Remove.
9505         (Incremental_inputs::report_archive_begin): New function.
9506         (Incremental_inputs::report_archive_end): New function.
9507         (Incremental_inputs::report_object): New function.
9508         (Incremental_inputs::finalize_inputs): Remove.
9509         (Incremental_inputs::report_input_section): New function.
9510         (Incremental_inputs::report_script): Rewrite.
9511         (Incremental_inputs::finalize): Do nothing but finalize string table.
9512         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9513         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9514         (Incremental_inputs::create_data_sections): New function.
9515         (Incremental_inputs::relocs_entsize): New function.
9516         (Output_section_incremental_inputs::set_final_data_size): New function.
9517         (Output_section_incremental_inputs::do_write): New function.
9518         (Output_section_incremental_inputs::write_header): New function.
9519         (Output_section_incremental_inputs::write_input_files): New function.
9520         (Output_section_incremental_inputs::write_info_blocks): New function.
9521         (Output_section_incremental_inputs::write_symtab): New function.
9522         * incremental.h (Incremental_script_entry): Forward declaration.
9523         (Incremental_object_entry): Forward declaration.
9524         (Incremental_archive_entry): Forward declaration.
9525         (Incremental_inputs): Forward declaration.
9526         (Incremental_inputs_header_data): Remove.
9527         (Incremental_inputs_header): Remove.
9528         (Incremental_inputs_header_write): Remove.
9529         (Incremental_inputs_entry_data): Remove.
9530         (Incremental_inputs_entry): Remove.
9531         (Incremental_inputs_entry_write): Remove.
9532         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9533         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9534         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9535         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9536         Likewise.
9537         (Incremental_input_entry): New class.
9538         (Incremental_script_entry): New class.
9539         (Incremental_object_entry): New class.
9540         (Incremental_archive_entry): New class.
9541         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9542         (Incremental_inputs::report_inputs): Remove.
9543         (Incremental_inputs::report_archive): Remove.
9544         (Incremental_inputs::report_archive_begin): New function.
9545         (Incremental_inputs::report_archive_end): New function.
9546         (Incremental_inputs::report_object): Change prototype.
9547         (Incremental_inputs::report_input_section): New function.
9548         (Incremental_inputs::report_script): Change prototype.
9549         (Incremental_inputs::get_reloc_count): New function.
9550         (Incremental_inputs::set_reloc_count): New function.
9551         (Incremental_inputs::create_data_sections): New function.
9552         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9553         (Incremental_inputs::inputs_section): New function.
9554         (Incremental_inputs::symtab_section): New function.
9555         (Incremental_inputs::relocs_section): New function.
9556         (Incremental_inputs::get_stringpool): Add const.
9557         (Incremental_inputs::command_line): Add const.
9558         (Incremental_inputs::inputs): Remove.
9559         (Incremental_inputs::command_line_key): New function.
9560         (Incremental_inputs::input_file_count): New function.
9561         (Incremental_inputs::input_files): New function.
9562         (Incremental_inputs::relocs_entsize): New function.
9563         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9564         (Incremental_inputs::finalize_inputs): Remove.
9565         (Incremental_inputs::Input_info): Remove.
9566         (Incremental_inputs::lock_): Remove.
9567         (Incremental_inputs::inputs_): Change type.
9568         (Incremental_inputs::inputs_map_): Remove.
9569         (Incremental_inputs::current_object_entry_): New data member.
9570         (Incremental_inputs::inputs_section_): New data member.
9571         (Incremental_inputs::symtab_section_): New data member.
9572         (Incremental_inputs::relocs_section_): New data member.
9573         (Incremental_inputs::reloc_count_): New data member.
9574         (Incremental_inputs_reader): New class.
9575         (Incremental_symtab_reader): New class.
9576         (Incremental_relocs_reader): New class.
9577         * layout.cc (Layout::finalize): Move finalization of incremental info
9578         and creation of incremental info sections to follow finalization of
9579         symbol table.  Set offsets for postprocessing sections.
9580         (Layout::create_incremental_info_sections): Call
9581         Incremental_inputs::create_data_sections.  Add incremental symtab
9582         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9583         sections to layout after input sections.
9584         * layout.h (struct Timespec): Forward declaration.
9585         (Layout::incremental_inputs): Add const.
9586         (Layout::create_incremental_info_sections): Add parameter.
9587         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9588         * object.cc: Include incremental.h.
9589         (Relobj::finalize_incremental_relocs): New function.
9590         (Sized_relobj::do_layout): Record input sections in incremental info.
9591         * object.h (Object::output_section): New function.
9592         (Object::output_section_offset): Moved from Relobj.
9593         (Object::get_incremental_reloc_base): New function.
9594         (Object::get_incremental_reloc_count): New function.
9595         (Object::do_output_section): New function.
9596         (Object::do_output_section_offset): Moved from Relobj.
9597         (Object::do_get_incremental_reloc_base): New function.
9598         (Object::do_get_incremental_reloc_count): New function.
9599         (Object::Object): Initialize new data members.
9600         (Relobj::output_section): Renamed do_output_section and moved to
9601         protected.
9602         (Relobj::output_section_offset): Moved to Object.
9603         (Relobj::do_get_incremental_reloc_base): New function.
9604         (Relobj::do_get_incremental_reloc_count): New function.
9605         (Relobj::allocate_incremental_reloc_counts): New function.
9606         (Relobj::count_incremental_reloc): New function.
9607         (Relobj::finalize_incremental_relocs): New function.
9608         (Relobj::next_incremental_reloc_index): New function.
9609         (Relobj::reloc_counts_): New data member.
9610         (Relobj::reloc_bases_): New data member.
9611         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9612         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9613         (Sized_relobj::incremental_relocs_scan): New function.
9614         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9615         (Sized_relobj::incremental_relocs_write): New function.
9616         (Sized_relobj::incremental_relocs_write_reltype): New function.
9617         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9618         incremental link.
9619         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9620         archives and object files elsewhere.
9621         (Add_symbols::run): Report object files here.
9622         (Finish_group::run): Report end of archive at end of group.
9623         * reloc.cc: Include layout.h, incremental.h.
9624         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9625         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9626         (Sized_relobj::incremental_relocs_scan): New function.
9627         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9628         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9629         (Sized_relobj::incremental_relocs_write): New function.
9630         (Sized_relobj::incremental_relocs_write_reltype): New function.
9631         * script.cc (read_input_script): Rewrite test for incremental link.
9632         Change call to Incremental_inputs::report_script.
9633         * symtab.h (Symbol_table::first_global_index): New function.
9634         (Symbol_table::output_count): New function.
9635
9636 2010-08-12  Doug Kwan  <dougkwan@google.com>
9637
9638         * arm.cc (Target_arm::merge_object_attributes): Check command line
9639         options --no-wchar-size-warning and --no-enum-size-warning.
9640         * options.h (General_options): Add ld-compatible options
9641         --no-enum-size-warning and --no-wchar-size-warning.
9642
9643 2010-08-04  Ian Lance Taylor  <iant@google.com>
9644
9645         * x86_64.cc (Target_x86_64::Scan::local): Use
9646         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9647         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9648         (Target_x86_64::Scan::global): Likewise.
9649         (Target_x86_64::Relocate::relocate): Likewise.
9650         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9651         Likewise.
9652
9653 2010-08-03  Cary Coutant  <ccoutant@google.com>
9654
9655         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9656         to reserve space in merged_strings vector. Keep total input size
9657         for stats.
9658         (Output_merge_string::do_print_merge_stats): Print total input size.
9659         * merge.h (Output_merge_string): Add input_size_ field.
9660         * stringpool.cc (Stringpool_template::string_length): Move
9661         implementations out of Stringpool_template class and place in
9662         stringpool.h.
9663         * stringpool.h (string_length): Move out of Stringpool_template.
9664
9665 2010-08-03  Ian Lance Taylor  <iant@google.com>
9666
9667         PR 11712
9668         * layout.cc (relaxation_loop_body): If address of load segment is
9669         set, adjust address to include headers if possible.
9670
9671 2010-08-03  Ian Lance Taylor  <iant@google.com>
9672
9673         * version.cc (version_string): Bump to 1.10.
9674
9675 2010-08-03  Ian Lance Taylor  <iant@google.com>
9676
9677         PR 11805
9678         * layout.h (enum Output_section_order): Define.
9679         (class Layout): Update declarations.
9680         * layout.cc (Layout::get_output_section): Add order parameter.
9681         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9682         is_first_non_relro parameters.  Change all callers.
9683         (Layout::choose_output_section): Likewise.
9684         (Layout::add_output_section_data): Likewise.
9685         (Layout::make_output_section): Likewise.  Set order.
9686         (Layout::default_section_order): New function.
9687         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9688         * output.cc (Output_section::Output_section): Initialize order_.
9689         Don't initialize deleted fields.
9690         (Output_segment::Output_segment): Don't initialize deleted
9691         fields.
9692         (Output_segment::add_output_section_to_load): New function
9693         replacing add_output_section.  Change all callers to call this or
9694         add_output_section_to_nonload.
9695         (Output_segment::add_output_section_to_nonload): New function.
9696         (Output_segment::remove_output_section): Rewrite.
9697         (Output_segment::add_initial_output_data): Likewise.
9698         (Output_segment::has_any_data_sections): Likewise.
9699         (Output_segment::is_first_section_relro): Likewise.
9700         (Output_segment::maximum_alignment): Likewise.
9701         (Output_segment::has_dynamic_reloc): New function replacing
9702         dynamic_reloc_count.  Change all callers.
9703         (Output_segment::has_dynamic_reloc_list): New function replacing
9704         dynamic_reloc_count_list.  Change all callers.
9705         (Output_segment::set_section_addresses): Rewrite.
9706         (Output_segment::set_offset): Rewrite.
9707         (Output_segment::find_first_and_last_list): Remove.
9708         (Output_segment::set_tls_offsets): Rewrite.
9709         (Output_segment::first_section_load_address): Likewise.
9710         (Output_segment::output_section_count): Likewise.
9711         (Output_segment::section_with_lowest_load_address): Likewise.
9712         (Output_segment::write_section_headers): Likewise.
9713         (Output_segment::print_sections_to_map): Likewise.
9714         * output.h (class Output_data): Remove dynamic_reloc_count_
9715         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9716         (Output_data::add_dynamic_reloc): Rewrite.
9717         (Output_data::has_dynamic_reloc): New function.
9718         (Output_data::dynamic_reloc_count): Remove.
9719         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9720         is_last_relro_, is_first_non_relro_, is_interp_,
9721         is_dynamic_linker_section_ fields.  Add order and set_order
9722         functions.  Remove is_relro_local, set_is_relro_local,
9723         is_last_relro, set_is_last_relro, is_first_non_relro,
9724         set_is_first_non_relro functions, is_interp, set_is_interp,
9725         is_dynamic_linker_section, and set_is_dynamic_linker_section
9726         functions.
9727         (class Output_segment): Change Output_data_list from std::list to
9728         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9729         output_bss_ fields.  Update declarations.
9730
9731 2010-08-02  Ian Lance Taylor  <iant@google.com>
9732
9733         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9734         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9735         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9736
9737 2010-08-02  Ian Lance Taylor  <iant@google.com>
9738
9739         PR 11855
9740         * script.cc (Script_options::Script_options): Initialize
9741         symbol_definitions_ and symbol_references_.
9742         (Script_options::add_symbol_assignment): Update
9743         symbol_definitions_ and symbol_references_.
9744         (Script_options::add_symbol_reference): New function.
9745         (script_symbol): New function.
9746         * script.h (class Script_options): Add symbol_definitions_ and
9747         symbol_references_ fields.
9748         (Script_options::referenced_const_iterator): New type.
9749         (Script_options::referenced_begin): New function.
9750         (Script_options::referenced_end): New function.
9751         (Script_options::is_referenced): New function.
9752         (Script_options::any_unreferenced): New function.
9753         * script-c.h (script_symbol): Declare.
9754         * yyscript.y (exp): Call script_symbol.
9755         * symtab.cc: Include "script.h".
9756         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9757         Change all callers.  Check symbols referenced by scripts.
9758         (Symbol_table::add_undefined_symbols_from_command_line): Add
9759         layout parameter.  Change all callers.
9760         (Symbol_table::do_add_undefined_symbols_from_command_line):
9761         Likewise.  Break out loop body.  Check symbols referenced by
9762         scripts.
9763         (Symbol_table::add_undefined_symbol_from_command_line): New
9764         function broken out of
9765         do_add_undefined_symbols_from_command_line.
9766         * symtab.h (class Symbol_table): Update declarations.
9767         * archive.cc: Include "layout.h".
9768         (Archive::should_include_member): Add layout parameter.  Change
9769         all callers.  Check for symbol mentioned in expression.
9770         * archive.h (class Archive): Update declaration.
9771         * object.cc (Sized_relobj::do_should_include_member): Add layout
9772         parameter.
9773         * object.h (Object::should_include_member): Add layout parameter.
9774         Change all callers.
9775         (Object::do_should_include_member): Add layout parameter.
9776         (class Sized_relobj): Update declaration.
9777         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9778         parameter.
9779         * dynobj.h (class Sized_dynobj): Update declaration.
9780         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9781         layout parameter.
9782         * plugin.h (class Sized_pluginobj): Update declaration.
9783
9784 2010-08-02  Ian Lance Taylor  <iant@google.com>
9785
9786         PR 11866
9787         * output.cc (Output_segment::set_offset): Search for the first and
9788         last sections rather than assuming that the list is in order.
9789         (Output_segment::find_first_and_last_list): New function.
9790         * output.h (class Output_segment): Update declarations.
9791         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9792         (relro_strip_test_SOURCES): New variable.
9793         (relro_strip_test_DEPENDENCIES): New variable.
9794         (relro_strip_test_LDFLAGS): New variable.
9795         (relro_strip_test_LDADD): New variable.
9796         (relro_strip_test.so): New target.
9797
9798 2010-08-02  Ian Lance Taylor  <iant@google.com>
9799
9800         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9801         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9802         (Target_i386::got_tlsdesc_section): New function.
9803         (Target_i386::got_section): Create space for GOT entries for
9804         TLSDESC relocations.
9805         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9806         R_386_TLS_GOTDESC.
9807         (Target_i386::Scan::global): Likewise.
9808         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9809         using TLSDESC GOT.
9810         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9811         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9812         (Target_x86_64::got_tlsdesc_section): New function.
9813         (Target_x86_64::got_section): Create space for GOT entries for
9814         TLSDESC relocations.
9815         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9816         R_386_TLS_GOTDESC.
9817         (Target_x86_64::Scan::global): Likewise.
9818         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9819         using TLSDESC GOT.
9820
9821 2010-08-02  Ian Lance Taylor  <iant@google.com>
9822
9823         * testsuite/final_layout.sh: Use dc to convert from hex to
9824         decimal.
9825
9826 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9827
9828         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9829         paramter to the call to gold::gc_process_relocs.
9830         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9831         paramter to the call to gold::gc_process_relocs.
9832         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9833         parameter to the call to gold::gc_process_relocs.
9834         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9835         template parameter to the call to gold::gc_process_relocs.
9836         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9837         paramter to the call to gold::gc_process_relocs.
9838         * gc.h (get_embedded_addend_size): New function.
9839         (gc_process_relocs): Save the size of the reloc for use by ICF.
9840         * icf.cc (get_section_contents): Get the addend from the text section
9841         for SHT_REL relocation sections.
9842         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9843         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9844         * int_encoding.h (read_from_pointer): New overloaded function.
9845         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9846         * testsuite/icf_sht_rel_addend_test.sh: New file.
9847         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9848         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9849
9850 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9851
9852         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9853         * Makefile.in: Regenerate.
9854         * testsuite/Makefile.in: Regenerate.
9855
9856 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9857
9858         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9859         * testsuite/debug_msg.cc: Likewise.
9860         * testsuite/odr_violation1.cc
9861         * testsuite/odr_violation2.cc
9862
9863 2010-07-21  Cary Coutant  <ccoutant@google.com>
9864
9865         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9866         string, and length fields.
9867         (Output_merge_string::Merged_strings_list): New type.
9868         (Output_merge_string::Merged_strings_lists): New typedef.
9869         (Output_merge_string): Replace merged_strings_ with
9870         merged_strings_lists_.
9871         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9872         Merged_strings_list per input object and section.  Don't store pointer
9873         to the string.  Don't store length with each merged string entry.
9874         (Output_merge_string::finalize_merged_data): Loop over list of merged
9875         strings lists.  Recompute length of each merged string.
9876
9877 2010-07-15  Cary Coutant  <ccoutant@google.com>
9878
9879         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9880         here.
9881
9882 2010-07-14  Ian Lance Taylor  <iant@google.com>
9883
9884         * descriptors.cc (Descriptors::open): Report correct name in error
9885         message.
9886
9887 2010-07-13  Doug Kwan  <dougkwan@google.com>
9888
9889         * arm.cc (Arm_input_section::Arm_input_section): For a
9890         SHT_ARM_EXIDX section, always keeps the input sections.
9891         (Arm_input_section::set_exidx_section_link): New method.
9892         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9893         has_errors_ to false.
9894         (Arm_exidx_input_section::has_errors,
9895         Arm_exidx_input_section::set_has_errors): New methods.
9896         (Arm_exidx_input_section::has_errors_): New data member.
9897         (Arm_relobj::get_exidx_shndx_list): New method.
9898         (Arm_output_section::append_text_sections_to_list): Do not skip
9899         section without SHF_EXECINSTR.
9900         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9901         errors.
9902         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9903         section header.  Make error messages more verbose.  Check for
9904         a non-executable section linked to an EXIDX section.
9905         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9906         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9907         check that there is no deferred EXIDX section if we exit early.
9908         Instead of not making an EXIDX section in case of an error, make one
9909         and set the has_errors flag of it.
9910         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9911         in a relocatable link.
9912         (Target_arm::do_relax): Look for the EXIDX output section instead of
9913         assuming that it is called .ARM.exidx.
9914         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9915         section list.  Do not check for SHF_EXECINSTR section flags but
9916         skip any input section with errors.
9917         * output.cc (Output_section::Output_section): Initialize
9918         always_keeps_input_sections_ to false.
9919         (Output_section::add_input_section): Check for
9920         always_keeps_input_sections_.
9921         *  output.h (Output_section::always_keeps_input_sections,
9922         Output_section::set_always_keeps_input_sections): New methods.
9923         (Output_section::always_keeps_input_sections): New data member.
9924
9925 2010-07-13  Rafael Espindola  <espindola@google.com>
9926
9927         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9928         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9929
9930 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9931             Ian Lance Taylor  <iant@google.com>
9932
9933         * output.h (Output_section_lookup_maps::add_merge_section):
9934         Correct check of whether value was inserted.
9935         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9936         (Output_section_lookup_maps::add_relaxed_input_section):
9937         Likewise.
9938         * arm.cc (Target_arm::got_section): Remove used local os.
9939         * i386.cc (Target_i386::got_section): Likewise.
9940         * x86_64.cc (Target_x86_64::got_section): Likewise.
9941         * sparc.cc (Target_sparc::got_section): Likewise.
9942         (Target_sparc::relocate): Remove unused local have_got_offset.
9943         * powerpc.cc (Target_powerpc::relocate): Likewise.
9944
9945 2010-07-13  Ian Lance Taylor  <iant@google.com>
9946
9947         * compressed_output.cc (zlib_decompress): Fix signature in
9948         !HAVE_ZLIB_H case.
9949
9950         * archive.cc (Archive::include_member): Unlock an external member
9951         of a thin archive.  Don't bother to delete an object we know is
9952         NULL.
9953
9954 2010-07-12  Cary Coutant  <ccoutant@google.com>
9955
9956         * compressed_output.cc (zlib_decompress): New function.
9957         (get_uncompressed_size): New function.
9958         (decompress_input_section): New function.
9959         * compressed_output.h (get_uncompressed_size): New function.
9960         (decompress_input_section): New function.
9961         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9962         Handle compressed debug sections.
9963         * layout.cc (is_compressed_debug_section): New function.
9964         (Layout::output_section_name): Map compressed section names to
9965         canonical names.
9966         * layout.h (is_compressed_debug_section): New function.
9967         (is_debug_info_section): Recognize compressed debug sections.
9968         * merge.cc: Include compressed_output.h.
9969         (Output_merge_data::do_add_input_section): Handle compressed
9970         debug sections.
9971         (Output_merge_string::do_add_input_section): Handle compressed
9972         debug sections.
9973         * object.cc: Include compressed_output.h.
9974         (Sized_relobj::Sized_relobj): Initialize new data members.
9975         (build_compressed_section_map): New function.
9976         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9977         * object.h (Object::section_is_compressed): New method.
9978         (Object::do_section_is_compressed): New method.
9979         (Sized_relobj::Compressed_section_map): New type.
9980         (Sized_relobj::do_section_is_compressed): New method.
9981         (Sized_relobj::compressed_sections_): New data member.
9982         * output.cc (Output_section::add_input_section): Handle compressed
9983         debug sections.
9984         * reloc.cc: Include compressed_output.h.
9985         (Sized_relobj::write_sections): Handle compressed debug sections.
9986
9987 2010-07-08  Cary Coutant  <ccoutant@google.com>
9988
9989         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9990         weak when resolving to a dynamic def.
9991         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9992         for weak undef/dynamic def cases. Adjust callers.
9993         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9994         undef_binding_weak_.
9995         (Symbol_table::sized_write_globals): Adjust symbol binding.
9996         (Symbol_table::sized_write_symbol): Add binding parameter.
9997         * symtab.h (Symbol::set_undef_binding): New method.
9998         (Symbol::is_undef_binding_weak): New method.
9999         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
10000         (Symbol_table::should_override): Add new parameter.
10001         (Symbol_table::sized_write_symbol): Add new parameter.
10002
10003         * testsuite/weak_undef_file1.cc: Add new test case.
10004         * testsuite/weak_undef_file2.cc: Fix header comment.
10005         * testsuite/weak_undef_test.cc: Add new test case.
10006
10007 2010-06-29  Doug Kwan  <dougkwan@google.com>
10008
10009         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
10010         Initialize USE_SYMBOL_.
10011         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
10012         definition.
10013         (Arm_reloc_property::uses_symbol_): New data member declaration.
10014         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
10015         uses symbol value and symbol is undefined but not weakly undefined.
10016
10017 2010-06-28  Rafael Espindola  <espindola@google.com>
10018
10019         * plugin.cc (Plugin::load): Use dlerror.
10020
10021 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
10022
10023         * symtab.cc (detect_odr_violations): When reporting an ODR
10024         violation, report an object where the symbol is defined.
10025
10026 2010-06-25  Doug Kwan  <dougkwan@google.com>
10027
10028         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
10029         (Target_arm::section_may_have_icf_unsafe_pointers): New method
10030         definition.
10031         (Target_arm::Scan::local_reloc_may_be_function_pointer,
10032         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
10033         target hook to detect function points.
10034         (Target_arm::Scan::possible_function_pointer_reloc): New method.
10035         * icf.h (Icf::check_section_for_function_pointers): Change type of
10036         parameter SECTION_NAME to const reference to std::string.  Use
10037         target hook to determine if section may have unsafe pointers.
10038         * target.h (Target::section_may_have_icf_unsafe_pointers): New
10039         method definition.
10040
10041 2010-06-21  Rafael Espindola  <espindola@google.com>
10042
10043         * fileread.cc (Input_file::find_fie): New
10044         (Input_file::open): Use Input_file::find_fie.
10045         * fileread.h (Input_file::find_fie): New
10046         * plugin.cc (set_extra_library_path): New.
10047         (Plugin::load): Add set_extra_library_path to the transfer vector.
10048         (Plugin_manager::set_extra_library_path): New.
10049         (Plugin_manager::add_input_file): Use the extra search path if set.
10050         (set_extra_library_path(): New.
10051         * plugin.h (Plugin_manager): Add set_extra_library_path and
10052         extra_search_path_.
10053
10054 2010-06-19  Cary Coutant  <ccoutant@google.com>
10055
10056         * layout.cc (gdb_sections): Add .debug_types.
10057         (lines_only_debug_sections): Likewise.
10058
10059 2010-06-18  Rafael Espindola  <espindola@google.com>
10060
10061         * plugin.cc (add_input_file,add_input_library)
10062         (Plugin_manager::add_input_file): Make filename arguments const.
10063         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
10064         const.
10065
10066 2010-06-16  Doug Kwan  <dougkwan@google.com>
10067
10068         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
10069         .ARM.attributes section if we have not merged any input
10070         attributes sections.
10071
10072 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10073
10074         * arm.cc: Allow combining objects with no EABI version
10075         information.
10076
10077 2010-06-15  Rafael Espindola  <espindola@google.com>
10078
10079         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
10080
10081 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10082
10083         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
10084         (struct iovec): Correct !HAVE_READV definition.
10085
10086 2010-06-10  Cary Coutant  <ccoutant@google.com>
10087
10088         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
10089         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
10090         reloc sections.
10091         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
10092
10093         PR 11683
10094         * symtab.h (Symbol::is_placeholder): New member function.
10095         * target-reloc.h (relocate_section): Check for placeholder symbols.
10096
10097         * testsuite/Makefile.am (plugin_test_8): New test.
10098         (plugin_test_9): New test.
10099         * testsuite/Makefile.in: Regenerate.
10100
10101 2010-06-09  Nick Clifton  <nickc@redhat.com>
10102
10103         * yyscript.y (input_list_element): Allow strings prefixed with
10104         the '-' character.  Treat these as libraries.
10105         * script.cc (script_add_library): New function.  Adds a library
10106         specified by "-l<name>" found in an input script.
10107         * script-c.h: Add prototype for script_add_library.
10108
10109 2010-06-07  Doug Kwan  <dougkwan@google.com>
10110
10111         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
10112         Restrict stub-group size to be within long conditional branch
10113         range when working around cortex-A8 erratum.
10114
10115 2010-06-07  Damien Diederen  <dd@crosstwine.com>
10116
10117         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
10118         #ifdef typo.
10119
10120 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
10121
10122         PR gold/11658
10123         * output.cc
10124         (Output_section::Input_section_sort_entry::compare_section_ordering):
10125         Change to return non-zero correctly.
10126         (Output_section::Input_section_sort_section_order_index_compare
10127         ::operator()): Change to fix ambiguity in comparisons.
10128
10129 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
10130
10131         * gold.h (is_wildcard_string): New function.
10132         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
10133         (Layout::layout_eh_frame): Ditto.
10134         (Layout::find_section_order_index): New method.
10135         (Layout::read_layout_from_file): New method.
10136         * layout.h (Layout::find_section_order_index): New method.
10137         (Layout::read_layout_from_file): New method.
10138         (Layout::input_section_position_): New private member.
10139         (Layout::input_section_glob_): New private member.
10140         * main.cc (main): Call read_layout_from_file here.
10141         * options.h (--section-ordering-file): New option.
10142         * output.cc (Output_section::input_section_order_specified_): New
10143         member.
10144         (Output_section::Output_section): Initialize new member.
10145         (Output_section::add_input_section): Add new parameter.
10146         Keep input sections when --section-ordering-file is used.
10147         (Output_section::set_final_data_size): Sort input sections when
10148         section ordering file is specified.
10149         (Output_section::Input_section_sort_entry): Add new parameter.
10150         Check sorting type.
10151         (Output_section::Input_section_sort_entry::compare_section_ordering):
10152         New method.
10153         (Output_section::Input_section_sort_compare::operator()): Change to
10154         consider section_order_index.
10155         (Output_section::Input_section_sort_init_fini_compare::operator()):
10156         Change to consider section_order_index.
10157         (Output_section::Input_section_sort_section_order_index_compare
10158         ::operator()): New method.
10159         (Output_section::sort_attached_input_sections): Change to sort
10160         according to section order when specified.
10161         (Output_section::add_input_section<32, true>): Add new parameter.
10162         (Output_section::add_input_section<64, true>): Add new parameter.
10163         (Output_section::add_input_section<32, false>): Add new parameter.
10164         (Output_section::add_input_section<64, false>): Add new parameter.
10165         * output.h (Output_section::add_input_section): Add new parameter.
10166         (Output_section::input_section_order_specified): New
10167         method.
10168         (Output_section::set_input_section_order_specified): New method.
10169         (Input_section::Input_section): Initialize section_order_index_.
10170         (Input_section::section_order_index): New method.
10171         (Input_section::set_section_order_index): New method.
10172         (Input_section::section_order_index_): New member.
10173         (Input_section::Input_section_sort_section_order_index_compare): New
10174         struct.
10175         (Output_section::input_section_order_specified_): New member.
10176         * script-sections.cc (is_wildcard_string): Delete and move modified
10177         method to gold.h.
10178         (Output_section_element_input::Output_section_element_input): Modify
10179         call to is_wildcard_string.
10180         (Output_section_element_input::Input_section_pattern
10181         ::Input_section_pattern): Ditto.
10182         (Output_section_element_input::Output_section_element_input): Ditto.
10183         * testsuite/Makefile.am (final_layout): New test case.
10184         * testsuite/Makefile.in: Regenerate.
10185         * testsuite/final_layout.cc: New file.
10186         * testsuite/final_layout.sh: New file.
10187
10188 2010-06-01  Rafael Espindola  <espindola@google.com>
10189
10190         * plugin.cc (Plugin::load): Pass the output name to the plugin.
10191
10192 2010-06-01  Rafael Espindola  <espindola@google.com>
10193
10194         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
10195         visibility of symbols.
10196
10197 2010-05-27  Doug Kwan  <dougkwan@google.com>
10198
10199         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
10200         from start of output section instead of address for a local symbol
10201         in a merged or relaxed section when doing a relocatable link.
10202
10203 2010-05-26  Rafael Espindola  <espindola@google.com>
10204
10205         PR 11604
10206         * object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
10207         adding sections the garbage collector removed.
10208         * testsuite/Makefile.am: Add test.
10209         * testsuite/Makefile.in: Regenerate.
10210         * testsuite/plugin_test_7.sh: New.
10211         * testsuite/plugin_test_7_1.c: New.
10212         * testsuite/plugin_test_7_2.c: New.
10213
10214 2010-05-26  Rafael Espindola  <espindola@google.com>
10215
10216         * script-sections.cc (Output_section_definition::set_section_addresses):
10217         Check for --section-start.
10218
10219 2010-05-26  Doug Kwan  <dougkwan@google.com>
10220
10221         * arm.cc (Arm_scan_relocatable_relocs): New class.
10222         (Target_arm::relocate_special_relocatable): New method.
10223         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
10224         (Arm_relocate_functions::thumb_branch_common): Same.
10225         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
10226         instead of Default_scan_relocatable_relocs.
10227         * target-reloc.h (relocate_for_relocatable): Let target handle
10228         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
10229         * target.h (Sized_target::relocate_special_relocatable): New method.
10230
10231 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10232
10233         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10234
10235 2010-05-23  Doug Kwan  <dougkwan@google.com>
10236
10237         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10238         instead of a cast.
10239         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10240         with a direct branch, not a conditional branch, to a stub.
10241         * merge.cc (Output_merge_base::record_input_section): New method
10242         defintion.
10243         (Output_merge_data::do_add_input_section): Record input section if
10244         keeps-input-sections flag is set.
10245         (Output_merge_string::do_add_input_section): Ditto.
10246         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10247         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10248         INPUT_SECTIONS_.
10249         (Output_merge_base::keeps_input_sections,
10250         Output_merge_base::set_keeps_input_sections,
10251         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10252         method definitions.
10253         (Output_merge_base::Input_sections): New type declaration.
10254         (Output_merge_base::input_sections_begin,
10255         Output_merge_base::input_sections_end,
10256         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10257         (Output_merge_base::bool keeps_input_sections_,
10258         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10259         Output_merge_base::input_sections_): New data members.
10260         (Output_merge_data::do_set_keeps_input_sections): New method
10261         defintion.
10262         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10263         * output.cc (Output_section::Input_section::relobj): Move method
10264         defintion from class declaration to here and handle merge sections.
10265         (Output_section::Input_section::shndx): Ditto.
10266         (Output_section::Output_section): Remove initializations of removed
10267         data members and initialize new data member LOOKUP_MAPS_.
10268         (Output_section::add_input_section): Set keeps-input-sections flag
10269         for a newly created merge output section as appropriate.  Adjust code
10270         to use Output_section_lookup_maps class.
10271         (Output_section::add_relaxed_input_section): Adjst code for lookup
10272         maps code refactoring.
10273         (Output_section::add_merge_input_section): Add a new parameter
10274         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10275         class.  If adding input section to a newly created merge output
10276         section fails, remove the new merge section.
10277         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10278         Adjust code for use of the Output_section_lookup_maps class.
10279         (Output_section::find_merge_section): Ditto.
10280         (Output_section::build_lookup_maps): New method defintion.
10281         (Output_section::find_relaxed_input_section): Adjust code to use
10282         Output_section_lookup_maps class.
10283         (Output_section::get_input_sections): Export merge sections.  Adjust
10284         code to use Output_section_lookup_maps class.
10285         (Output_section:::add_script_input_section): Adjust code to use
10286         Output_section_lookup_maps class.  Update lookup maps for merge
10287         sections also.
10288         (Output_section::discard_states): Use Output_section_lookup_maps.
10289         (Output_section::restore_states): Same.
10290         * output.h (Merge_section_properties): Move class defintion out of
10291         Output_section.
10292         (Output_section_lookup_maps): New class.
10293         (Output_section::Input_section::is_merge_section): New method
10294         defintion.
10295         (Output_section::Input_section::relobj): Move defintion out of class
10296         defintion.  Declare method only.
10297         (Output_section::Input_section::shndx): Ditto.
10298         (Output_section::Input_section::output_merge_base): New method defintion.
10299         (Output_section::Input_section::u2_.pomb): New union field.
10300         (Output_section::Merge_section_by_properties_map,
10301         Output_section::Output_section_data_by_input_section_map,
10302         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10303         Remove types.
10304         (Output_section::add_merge_input_section): Add new parameter
10305         KEEPS_INPUT_SECTIONS.
10306         (Output_section::build_lookup_maps): New method declaration.
10307         (Output_section::merge_section_map_,
10308         Output_section::merge_section_by_properties_map_,
10309         Output_section::relaxed_input_section_map_,
10310         Output_section::is_relaxed_input_section_map_valid_): Remove data
10311         members.
10312         (Output_section::lookup_maps_): New data member.
10313
10314 2010-05-21  Doug Kwan  <dougkwan@google.com>
10315
10316         PR gold/11619
10317         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10318         avoid a compilation error.
10319
10320 2010-05-19  Rafael Espindola  <espindola@google.com>
10321
10322         * script-sections.cc (Output_section_definition::allocate_to_segment):
10323         Update the phdrs_list even when the output section is NULL.
10324         * testsuite/Makefile.am: Add test.
10325         * testsuite/Makefile.in: Regenerate.
10326         * testsuite/script_test_9.cc: New.
10327         * testsuite/script_test_9.sh: New.
10328         * testsuite/script_test_9.t: New.
10329
10330 2010-05-19  Doug Kwan  <dougkwan@google.com>
10331
10332         * arm.cc (Arm_input_section::original_size): New method.
10333         (Arm_input_section::do_addralign): Add a cast.
10334         (Arm_input_section::do_output_offset): Remove static cast.
10335         (Arm_input_section::original_addralign,
10336          Arm_input_section::original_size_): Change type to uint32_t.
10337         (Arm_input_section::init): Add safe casts for section alignment
10338         and size.
10339         (Arm_input_section::set_final_data_size): Do not set address and
10340         offset of stub table.
10341         (Arm_output_section::fix_exidx_coverage): Change use of of
10342         Output_section::Simple_input_section to that of
10343         Output_section::Input_section.
10344         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10345         except for the first pass.
10346         * output.cc (Output_section::get_input_sections): Change type of
10347         input_sections to std::list<Input_section>.
10348         (Output_section::add_script_input_section): Rename from
10349         Output_section::add_simple_input_section.  Change type of SIS
10350         parameter from Simple_input_section to Input_section.
10351         * output.h (Output_section::Simple_input_section): Remove class.
10352         (Output_section::Input_section): Change class visibility to public.
10353         (Output_section::Input_section::addralign): Use stored alignments
10354         for special input sections if set.
10355         (Output_section::Input_section::set_addralign): New method.
10356         (Output_section::get_input_sections): Change parameter type from
10357         list of Simple_input_section to list of Input_section.
10358         (Output_section::add_script_input_section): Rename from
10359         Output_section::add_simple_input_section. Change first parameter's
10360         type from Simple_input_section to Input_section and remove the
10361         second and third parameters.
10362         * script-sections.cc (Input_section::Input_section_list): Change
10363         type to list of Output_section::Input_section/
10364         (Input_section_info::Input_section_info): Change parameter type of
10365         INPUT_SECTION to Output_section::Input_section.
10366         (Input_section_info::input_section): Change return type.
10367         (Input_section_info::input_section_): Change type to
10368         Output_section::Input_section.
10369         (Output_section_element_input::set_section_addresses): Adjust code
10370         to use Output_section::Input_section instead of
10371         Output_section::Simple_input_section.  Adjust code for renaming
10372         of Output_section::add_simple_input_section.
10373         (Orphan_output_section::set_section_addresses): Ditto.
10374
10375 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10376
10377         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10378         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10379
10380 2010-05-18  Rafael Espindola  <espindola@google.com>
10381
10382         * options.cc (General_options::finalize): Handle -nostdlib.
10383         * options.h (nostdlib): New option.
10384         * script.cc (script_add_search_dir): Handle -nostdlib.
10385
10386 2010-05-12  Doug Kwan  <dougkwan@google.com>
10387
10388         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10389         attributes section only if there no attributes section after merging.
10390         (Target_arm::merge_object_attributes): Move value of
10391         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10392         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10393         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10394         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10395         and arm_attr_merge_7.stdout.
10396         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10397         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10398         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10399         arm_attr_merge_7b.o): New rules.
10400         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10401         arm_attr_merge_7
10402         * testsuite/Makefile.in: Regenerate.
10403         * testsuite/arm_attr_merge.sh: New file.
10404         * testsuite/arm_attr_merge_[67][ab].s: Same.
10405
10406 2010-05-05  Nick Clifton  <nickc@redhat.com>
10407
10408         * po/es.po: Updated Spanish translation.
10409
10410 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10411
10412         * Makefile.am (install-exec-local): Properly install gold as
10413         default cross linker.
10414         * Makefile.in: Regenerated.
10415
10416 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10417             Nick Clifton  <nickc@redhat.com>
10418
10419         * configure.ac (install_as_default): Define and set to false
10420         unless --enable-gold or --enable-gold=both/gold has been
10421         specified.
10422         * configure: Regenerate.
10423
10424         * Makefile.am (install-exec-local): Install the executable as
10425         'ld.gold'.  If install_as_default is true then also install it as
10426         'ld'.
10427         * Makefile.in: Regenerated.
10428
10429 2010-04-24  Ian Lance Taylor  <iant@google.com>
10430
10431         * layout.cc (Layout::layout_reloc): In relocatable link don't
10432         combine reloc sections for grouped sections.
10433
10434 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10435
10436         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10437         sections that are not ordinary to icf.
10438         * icf.cc (get_section_contents): Handle relocation pointing to section
10439         with no object or shndx information.
10440         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10441         * testsuite/Makefile.in: Regenerate.
10442         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10443         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10444
10445 2010-04-22  Ian Lance Taylor  <iant@google.com>
10446
10447         * expression.cc (Expression::Expression_eval_info): Add
10448         result_alignment_pointer field.
10449         (Expression::eval_with_dot): Add result_alignment_pointer
10450         parameter.  Change all callers.
10451         (Expression::eval_maybe_dot): Likewise.
10452         (class Binary_expression): Add alignment_pointer parameter to
10453         left_value and right_value.  Change all callers.
10454         (BINARY_EXPRESSION): Set result alignment.
10455         (class Trinary_expression): Add alignment_pointer parameter to
10456         arg2_value and arg3_value.  Change all callers.
10457         (Trinary_cond::value): Set result alignment.
10458         (Max_expression::value, Min_expression::value): Likewise.
10459         (Align_expression::value): Likewise.
10460         * script-sections.cc (class Sections_element): Add dot_alignment
10461         parameter to set_section_addresses virtual function.  Update
10462         instantiations.
10463         (class Output_section_element): Likewise.
10464         (Script_sections::create_segments): Add dot_alignment parameter.
10465         Change all callers.
10466         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10467         (Script_sections::set_phdrs_clause_addresses): Likewise.
10468         * script-sections.h: Update declarations.
10469         * script.h: Update declarations.
10470         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10471         min_p_align.
10472         * testsuite/script_test_3.t: Set large alignment.
10473         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10474         segment has expected alignment.
10475
10476 2010-04-22  Nick Clifton  <nickc@redhat.com>
10477
10478         * po/gold.pot: Updated by the Translation project.
10479         * po/vi.po: Updated Vietnamese translation.
10480
10481 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10482
10483         * testsuite/Makefile.am (check_PROGRAMS): Add
10484         icf_virtual_function_folding_test.
10485         * testsuite/Makefile.in: Regenerated.
10486
10487 2010-04-15  Andrew Haley  <aph@redhat.com>
10488
10489         * options.h (merge_exidx_entries): New option.
10490         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10491         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10492         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10493         (Target_arm::merge_exidx_entries): New function.
10494         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10495         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10496         to Arm_exidx_fixup constructor.
10497         Add new arg, merge_exidx_entries.
10498         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10499         Arm_output_section::fix_exidx_coverage.
10500
10501 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10502
10503         * icf.cc (get_section_contents): Check for preemptible functions.
10504         Ignore addend when appropriate.
10505         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10506         section folded.
10507         (add_from_relobj): Check for section folded.
10508         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10509         * symtab.h (should_add_dynsym_entry): Add new parameter.
10510         * target-reloc.h (scan_relocs): Check for section folded.
10511         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10512         Check reloc types for function pointers in shared objects.
10513         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10514         case.
10515         (icf_preemptible_functions_test): New test case.
10516         (icf_string_merge_test): New test case.
10517         * testsuite.Makefile.in: Regenerate.
10518         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10519         bar_glob.  Refactor code.
10520         * testsuite/icf_preemptible_functions_test.cc: New file.
10521         * testsuite/icf_preemptible_functions_test.sh: New file.
10522         * testsuite/icf_string_merge_test.cc: New file.
10523         * testsuite/icf_string_merge_test.sh: New file.
10524         * testsuite/icf_virtual_function_folding_test.cc: New file.
10525         * testsuite/icf_virtual_function_folding_test.sh: New file.
10526
10527 2010-04-14  Doug Kwan  <dougkwan@google.com>
10528
10529         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10530         for local symbol recounting if we remove a section due to ICF.
10531         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10532         there are no regular objects in input.
10533
10534 2010-04-13  Doug Kwan  <dougkwan@google.com>
10535
10536         * arm.cc (Arm_input_section::set_final_data_size): Compute
10537         accurate final data size instead of using current data size.
10538
10539 2010-04-09  Doug Kwan  <dougkwan@google.com>
10540
10541         * layout.cc (Layout::choose_output_section): Handle script section
10542         types.
10543         (Layout::make_output_section_for_script): Add section type parameter.
10544         Handle script section types.
10545         * layout.h (Layout::make_output_section_for_script): Add section
10546         type parameter.
10547         * output.cc (Output_section::Output_section): Initialize data member
10548         is_noload_.
10549         (Output_section::do_reset_address_and_file_offset): Do not set address
10550         to 0 if section is a NOLOAD section.
10551         * output.h (Output_section::is_noload): New method.
10552         (Output_section::set_is_noload): Ditto.
10553         (Output_section::is_noload_): New data member.
10554         * script-c.h (Script_section_type): New enum type.
10555         (struct Parser_output_section_header): Add new file section_type.
10556         * script-sections.cc (Sections_element::output_section_name): Add
10557         parameter for returning script section type.
10558         (Output_section_definition::output_section_name): Ditto.
10559         (Output_section_definition::section_type)P; New method.
10560         (Output_section_definiton::script_section_type_name): Ditto.
10561         (Output_section_definition::script_section_type_): New data member.
10562         (Output_section_definition::Output_section_definition): Initialize
10563         data member Output_section_definition::script_section_type_.
10564         (Output_section_definition::create_sections): Pass script section type
10565         to Layout::make_output_section_for_script.
10566         (Output_section_definition::output_section_name): Return script
10567         section type to caller.
10568         (Output_section_definition::set_section_address): Do not advance
10569         dot value and load address if section type is NOLOAD.  Set address
10570         of NOLOAD sections regardless of section flags.
10571         (Output_section_definition::print): Print section type if it is
10572         not SCRIPT_SECTION_TYPE_NONE.
10573         (Output_section_definition::section_type): New method.
10574         (Output_section_definition::script_section_type_name): Ditto.
10575         (Script_sections::output_section_name): Add new parameter
10576         PSECTION_TYPE for returning script section type.  Pass it to
10577         section elements.  Handle discard sections.
10578         (Sort_output_sections::operator()): Handle NOLOAD sections.
10579         * script-sections.h (Script_sections::Section_type): New enum type.
10580         (Script_sections::output_section_name): Add a new parameter for
10581         returning script section type.
10582         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10583         INFO and NOLOAD.
10584         * yyscript.y (union): Add new field SECTION_TYPE.
10585         (COPY, DSECT, INFO, NOLOAD): New tokens.
10586         (opt_address_and_section_type): Change type to output_section_header.
10587         (section_type): New non-terminal
10588         (section_header): Handle section type.
10589         (opt_address_and_section_type): Return section type value.
10590
10591 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10592
10593         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10594         * testsuite/plugin_common_test_2.c (foo): Likewise.
10595
10596 2010-04-08  Doug Kwan  <dougkwan@google.com>
10597
10598         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10599         Output_merge_data.
10600         * output.cc (Output_section::add_merge_input_section): Simplify
10601         code and return status of Output_merge_base::add_input_section.
10602         Update merge section map only if Output_merge_base::add_input_section
10603         returns true.
10604
10605 2010-04-07  Doug Kwan  <dougkwan@google.com>
10606
10607         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10608         if section is marked as containing instructions but has no mapping
10609         symbols.
10610         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10611         correct section index.
10612         (Arm_relobj::find_linked_text_section): Ditto.
10613
10614 2010-04-07  Cary Coutant  <ccoutant@google.com>
10615
10616         * archive.cc (include_member): Destroy Read_symbols_data object before
10617         releasing file.
10618         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10619         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10620         (Read_symbols_data::~Read_symbols_data) New destructor.
10621         (Section_relocs::Section_relocs) New constructor.
10622         (Section_relocs::~Section_relocs) New destructor.
10623         (Read_relocs_data::Read_relocs_data) New constructor.
10624         (Read_relocs_data::~Read_relocs_data) New destructor.
10625         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10626         pointers to NULL after deleting.
10627
10628 2010-04-07  Doug Kwan  <dougkwan@google.com>
10629
10630         * arm.cc: Replace "endianity" with "endianness" in comments.
10631         (Arm_exidx_cantunwind): Ditto.
10632         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10633         (Arm_relobj::merge_flags_and_attributes): New method.
10634         (Arm_relobj::merge_flags_and_attributes_): New data member.
10635         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10636         (Arm_relobj::scan_sections_for_stubs): Ditto.
10637         (Arm_relobj::do_read_symbols): Check to see if we really want to
10638         merge processor-specific flags and attributes.  Exit early if
10639         an object is empty except for section names and the undefined symbol.
10640         (Target_arm::do_finalize_sections): Move check for ELF format to
10641         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10642         attributes from a regular object only when we have determined that
10643         it is aapropriate.  Do not create an .ARM.attributes section in
10644         output if there is no regular input object.
10645         (Target_arm::merge_processor_specific_flags): Check
10646         --warn-mismatch before printing any error.
10647         (Target_arm::merge_object_attributes): Ditto.
10648         * gold.cc (queue_middle_tasks): Handle the case in which there is
10649         no regular object in input.
10650         * options.cc (General_options::parse_EB): New method.
10651         (General_options::parse_EL): Same.
10652         (General_options::General_options): Initialize endianness_.
10653         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10654         New options.
10655         (General_options::Endianness): New enum.
10656         (General_options::endianness): New method.
10657         (General_options::endianness_): New data member.
10658         * parameters.cc (Parameters::set_options): Check target endianness.
10659         (Parameters::set_target_once): Ditto.
10660         (Parameters::check_target_endianness): New method.
10661         (parameters_force_valid_target): If either -EL or -EB is specified,
10662         use it to define endianness of default target.
10663         * parameters.h (Parameters::check_target_endianness): New method
10664         declaration.
10665         * target.h (class Target): Change "endianity" to "endianness"
10666         in comments.
10667
10668 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10669
10670         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10671         * configure: Regenerate.
10672         * Makefile.in: Regenerate.
10673         * testsuite/Makefile.in: Regenerate.
10674
10675 2010-04-06  Cary Coutant  <ccoutant@google.com>
10676
10677         gcc PR lto/42757
10678         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10679         prevailing definitions of common symbols.
10680         * testsuite/plugin_test_6.sh: New test case.
10681         * testsuite/plugin_common_test_1.c: New test case.
10682         * testsuite/plugin_common_test_2.c: New test case.
10683         * testsuite/Makefile.am (plugin_test_6): New test case.
10684         * testsuite/Makefile.in: Regenerate.
10685
10686 2010-04-06  Nick Clifton  <nickc@redhat.com>
10687
10688         * po/vi.po: New Vietnamese translation.
10689
10690 2010-03-30  Doug Kwan  <dougkwan@google.com>
10691
10692         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10693
10694 2010-03-25  Doug Kwan  <dougkwan@google.com>
10695
10696         * arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10697         to avoid a conversion warning on a 32-bit host.
10698
10699 2010-03-24  Ian Lance Taylor  <iant@google.com>
10700
10701         * testsuite/script_test_3.t: Add a TLS segment.
10702         * testsuite/Makefile.am (check_PROGRAMS): Add
10703         tls_phdrs_script_test.
10704         (tls_phdrs_script_test_SOURCES): Define.
10705         (tls_phdrs_script_test_DEPENDENCIES): Define.
10706         (tls_phdrs_script_test_LDFLAGS): Define.
10707         (tls_phdrs_script_test_LDADD): Define.
10708         * testsuite/Makefile.in: Rebuild.
10709
10710 2010-03-23  Cary Coutant  <ccoutant@google.com>
10711
10712         * fileread.cc (find_or_make_view): Fix comment.
10713
10714 2010-03-23  Ian Lance Taylor  <iant@google.com>
10715
10716         * script-sections.cc (class Orphan_section_placement): Define
10717         PLACE_TLS and PLACE_TLS_BSS.
10718         (Orphan_section_placement::Orphan_section_placement): Initialize
10719         new places.
10720         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10721         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10722         (tls_script_test_SOURCES): Define.
10723         (tls_script_test_DEPENDENCIES): Define.
10724         (tls_script_test_LDFLAGS): Define.
10725         (tls_script_test_LDADD): Define.
10726         * testsuite/Makefile.in: Rebuild.
10727
10728 2010-03-22  Doug Kwan  <dougkwan@google.com>
10729
10730         * arm.cc (Arm_relocate_functions::abs8,
10731         Arm_relocate_functions::abs16): Use correct check for overflow
10732         specified in the ARM ELF specs.
10733         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10734         target of a BLX instruction specially.
10735         (Reloc_stub::stub_type_for_reloc): Ditto.
10736         (Relocate::relocate): Use symbolic names instead of numeric relocation
10737         codes to report error.
10738         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10739         workaround.
10740         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10741         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10742         thumb2_blx_out_of_range.stdout
10743         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10744         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10745         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10746         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10747         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10748         thumb2_blx_in_range, thumb2_blx_in_range.o,
10749         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10750         thumb2_blx_out_of_range.o): New rules.
10751         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10752         thumb2_blx_in_range and thumb2_blx_out_of_range.
10753         * testsuite/Makefile.in: Regenerate.
10754         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10755         * testsuite/thumb_blx_in_range.s: New file.
10756         * testsuite/thumb_blx_out_of_range.s: New file.
10757
10758 2010-03-22  Rafael Espindola  <espindola@google.com>
10759
10760         * archive.cc (Should_include): Move to archive.h.
10761         (should_include_member): Make it a member of Archive.
10762         (Lib_group): New.
10763         (Add_lib_group_symbols): New.
10764         * archive.h: Include options.h.
10765         (Archive_member): Moved from Archive.
10766         (Should_include): Moved from archive.cc.
10767         (Lib_group): New.
10768         (Add_lib_group_symbols): New.
10769         * dynobj.cc (do_should_include_member): New.
10770         * dynobj.h (do_should_include_member): New.
10771         * gold.cc (queue_initial_tasks): Update call to queue.
10772         * main.cc (main): Print lib group stats.
10773         * object.cc (do_should_include_member): New.
10774         * object.h: Include archive.h.
10775         (Object::should_include_member): New.
10776         (Object::do_should_include_member): New.
10777         (Sized_relobj::do_should_include_member): New.
10778         * options.cc (General_options::parse_start_lib): New.
10779         (General_options::parse_end_lib): New.
10780         (Input_arguments::add_file): Handle lib groups.
10781         (Input_arguments::start_group): Check we are not in a lib.
10782         (Input_arguments::start_lib): New.
10783         (Input_arguments::end_lib): New.
10784         * options.h (General_options): Add start_lib and end_lib.
10785         (Input_argument::lib_): New.
10786         (Input_argument::lib): New.
10787         (Input_argument::is_lib): New.
10788         (Input_file_lib): New.
10789         (Input_arguments::in_lib_): New.
10790         (Input_arguments::in_lib): New.
10791         (Input_arguments::start_lib): New.
10792         (Input_arguments::end_lib_): New.
10793         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10794         in unused members as preempted.
10795         (Sized_pluginobj::do_should_include_member): New.
10796         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10797         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10798         return the blocker.
10799         (Read_symbols::do_whole_lib_group): New.
10800         (Read_symbols::do_lib_group): New.
10801         (Read_symbols::do_read_symbols): Handle lib groups.
10802         (Read_symbols::get_name): Handle lib groups.
10803         * readsyms.h (Read_symbols): Add an archive member pointer.
10804         (Read_symbols::do_whole_lib_group): New.
10805         (Read_symbols::do_lib_group): New.
10806         (Read_symbols::member_): New.
10807         * script.cc (read_input_script): Update call to queue_soon.
10808
10809 2010-03-19  Doug Kwan  <dougkwan@google.com>
10810
10811         * arm.cc (Stub_table::Stub_table): Initialize new data members
10812         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10813         (Stub_table::add_reloc_stub): Assign stub offset and update
10814         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10815         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10816         New data members.
10817         (Stub_table::update_data_size_and_addralign): Use
10818         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10819         instead of going over all reloc stubs.
10820         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10821         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10822         Stringpool_template::offset_ to size of Stringpool_char.
10823         (Stringpool_template::new_key_offset): Remove code to initialize
10824         Stringpool_template::offset_.
10825         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10826         Stringpool_template::offset_ to zero.
10827
10828 2010-03-15  Doug Kwan  <dougkwan@google.com>
10829
10830         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10831         offset_.
10832         (Stringpool_template::new_key_offset): New method.
10833         (Stringpool_template::add_string): Assign offsets when adding new
10834         strings.
10835         (Stringpool_template::set_string_offsets): Do not set string offsets
10836         when not optimizing.
10837         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10838         member size_.
10839         (Chunked_vector::clear): Clear size_.
10840         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10841         (Chunked_vector::size): Return size_.
10842         (Chunked_vector::push_back): Use size_ to find insert position.
10843         (Chunked_vector::size_): New data member.
10844         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10845         (Stringpool_template::new_key_offset): New method declaration.
10846         (Stringpool_template::offset_): New data member.
10847
10848 2010-03-15   Rafael Espindola  <espindola@google.com>
10849
10850         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10851         Add_symbols' constructor.
10852         * readsyms.h (Add_symbols): Remove the input_group member.
10853
10854 2010-03-10  Ian Lance Taylor  <iant@google.com>
10855
10856         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10857         target to ask whether a reference to a symbol requires a stack
10858         split.
10859         * target.h (Target::is_call_to_non_split): New function.
10860         (Target::do_is_call_to_non_split): Declare virtual function.
10861         * target.cc: Include "symtab.h".
10862         (Target::do_is_call_to_non_split): New function.
10863         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10864
10865 2010-03-10  Cary Coutant  <ccoutant@google.com>
10866
10867         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10868         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10869         (File_read::open[2]): Add whole_file_view_ to list of views.
10870         (File_read::make_view): Remove test of whole_file_view_.
10871         (File_read::find_or_make_view): Create whole_file_view_ if
10872         necessary.
10873         (File_read::clear_views): Replace bool parameter with enum;
10874         adjust all callers.  Don't delete views with permanent data;
10875         do delete cached views and views from archives if
10876         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10877         if clearing the corresponding view.
10878         * fileread.h (File_read::Clear_views_mode): New enum.
10879         (File_read::View::is_permanent_view): New method.
10880         (File_read::clear_views): Replace bool parameter
10881         with enum; adjust all callers.
10882         * options.h (General_options): Change keep_files_mapped option;
10883         add map_whole_files.
10884         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10885         releasing the file.
10886         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10887         the file.
10888
10889 2010-03-10  David S. Miller  <davem@davemloft.net>
10890
10891         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10892
10893 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10894
10895         * icf.cc (get_section_contents): Add '@' marker after processing the
10896         merge reloc.
10897
10898 2010-03-08  Doug Kwan  <dougkwan@google.com>
10899
10900         * arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10901         due to a conversion warning.
10902         (Arm_relobj::update_output_local_symbol_count): Check for local
10903         symbol with unset output index.
10904
10905 2010-03-05  Ian Lance Taylor  <iant@google.com>
10906
10907         * options.h (class General_options): Add --spare-dynamic-tags.
10908         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10909         --spare-dynamic-tags.
10910
10911 2010-03-05  Ian Lance Taylor  <iant@google.com>
10912
10913         * incremental.cc: Include "libiberty.h".
10914
10915 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10916
10917         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10918         function, is_info_ member.
10919         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10920         (Versions::Versions): Update caller.
10921         (Versions::define_base_version): Likewise.
10922         (Versions::add_def): Likewise.
10923
10924 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10925
10926         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10927         (Scan::possible_function_pointer_reloc): New function.
10928         (Scan::local_reloc_may_be_function_pointer): Change to call
10929         possible_function_pointer_reloc.
10930         (Scan::global_reloc_may_be_function_pointer): Ditto.
10931         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10932         relocations in ".data.rel.ro._ZTV" section.
10933         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10934         * testsuite/icf_safe_so_test.cc: Ditto.
10935         * testsuite/icf_safe_test.cc: Ditto.
10936         * testsuite/icf_safe_test.sh: Ditto.
10937
10938 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10939             Ian Lance Taylor  <iant@google.com>
10940
10941         * target-reloc.h (relocate_section): Check the symbol table index
10942         for -1U before setting the local symbol index.
10943         (scan_relocatable_relocs): If copying the relocation, record that
10944         the local symbol is required.
10945         * object.h (Symbol_value::is_output_symtab_index_set): New
10946         function.
10947         (Symbol_value::may_be_discarded_from_output_symtab): New
10948         function.
10949         (Symbol_value::has_output_symtab_entry): New function.
10950         (Symbol_value::needs_output_symtab_entry): Remove.
10951         (Symbol_value::output_symtab_index): Make sure the symbol index is
10952         set.
10953         (Symbol_value::set_output_symtab_index): Make sure the symbol
10954         index is not set.  Make sure the new index is valid.
10955         (Symbol_value::set_must_have_output_symtab_entry): New function.
10956         (Symbol_value::has_output_dynsym_entry): New function.
10957         (Symbol_value::set_output_dynsym_index): Make sure the new index
10958         is valid.
10959         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10960         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10961         local symbol if permitted.
10962         (Sized_relobj::do_finalize_local_symbols): Call
10963         is_output_symtab_index_set rather than needs_output_symtab_entry.
10964         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10965         rather than needs_output_symtab_entry.  Call
10966         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10967         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10968         is_output_symtab_index_set rather than needs_output_symtab_entry.
10969         * testsuite/discard_locals_relocatable_test.c: New file.
10970         * testsuite/discard_locals_test.sh: Test -r.
10971         * testsuite/Makefile.am (check_DATA): Add
10972         discard_locals_relocatable_test1.syms,
10973         discard_local_relocatable_test2.syms.
10974         (MOSTLYCLEANFILES): Likewise.  Also add
10975         discard_locals_relocatable_test1.lout and
10976         discard_locals_relocatable_test2.out.
10977         (discard_locals_relocatable_test1.syms): New target.
10978         (discard_locals_relocatable_test.o): New target.
10979         (discard_locals_relocatable_test1.out): New target.
10980         (discard_locals_relocatable_test2.syms): New target.
10981         (discard_locals_relocatable_test2.out): New target.
10982         (various): Add missing ../ld-new dependencies.
10983         * testsuite/Makefile.in: Rebuild.
10984
10985 2010-03-03  Nick Clifton  <nickc@redhat.com>
10986
10987         * po/fi.po: New Finnish translation.
10988
10989 2010-03-01  Doug Kwan  <dougkwan@google.com>
10990
10991         * layout.cc (Layout::Layout): Force section types of .init_array*,
10992         .preinit_array* and .fini_array* sections.
10993         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10994         Fix check of return value of std::string::find.().
10995         (Output_section::Input_section_sort_compare::operator()): Remove
10996         comment about .init_array.
10997         (Output_section::Input_section_sort_init_fini_compare::operator()):
10998         New method.
10999         (Output_section::sort_attached_input_sections): Handle .init_array
11000         and .fini_array specially.
11001         * output.h (Output_section::Inut_section_sort_compare): Update
11002         comment.
11003         (Output_section::Input_section_sort_init_fini_compare): New struct.
11004
11005 2010-02-26  Doug Kwan  <dougkwan@google.com>
11006
11007         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
11008         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
11009         * testsuite/debug_msg.sh: Avoid matching source line number for
11010         use of global variable undef_int.
11011
11012 2010-02-26  Doug Kwan  <dougkwan@google.com>
11013
11014         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
11015         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
11016         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
11017         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
11018         * options.cc (General_options::General_options): Initialize member
11019         fix_v4bx_.
11020         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
11021         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
11022         and rm_no_fix_v4bx.stdout
11023         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
11024         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
11025         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
11026         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
11027         and arm_no_fix_v4bx.
11028         * Makefile.in: Regenerate.
11029         * testsuite/arm_fix_v4bx.s: New file.
11030         * testsuite/arm_fix_v4bx.sh: Ditto.
11031
11032 2010-02-24  Doug Kwan  <dougkwan@google.com>
11033
11034         * arm.cc (Target_arm::got_section): Make the .got section the first
11035         non RELRO section in the data segment.
11036         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
11037         suffixes of section names.
11038
11039 2010-02-24  Doug Kwan  <dougkwan@google.com>
11040
11041         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
11042         flags and attributes merging if an input file is a binary file.
11043         * fileread.cc (Input_file::open): Record format of original file.
11044         * fileread.h (Input_file::Format): New enum type.
11045         (Input_file::Input_file): Initialize data member format_.
11046         (Input_file::format): New method definition.
11047         (Input_file::format_):: New data member.
11048
11049 2010-02-24  Doug Kwan  <dougkwan@google.com>
11050
11051         * arm.cc (Arm_output_data_got): New class.
11052         (ARM_TCB_SIZE): New constant
11053         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
11054         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
11055         If user uses a script with a SECTIONS clause, issue only a warning
11056         for a misplaced EXIDX input section.  Otherwise, issue an error.
11057         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
11058         garbage collection.
11059         (Target_arm::got_mode_index_entry): Handle static linking.
11060         (Target_arm::Scan::local): Ditto.
11061         (Target_arm::Scan::global): Ditto.
11062         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
11063         all incorrectly implemented relocations.
11064         (Target_arm::fix_exidx_coverage): Pass layout to
11065         Arm_output_section::fix_exidx_coverage.
11066         * layout.cc (Layout::section_name_mapping): Remove trailing dots
11067         from ".ARM.exidx." and ".ARM.extab.".
11068
11069 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11070
11071         * arm.cc (Target_arm::do_finalize_sections): Create attribute
11072         section if it does not already exist.
11073         * attributes.cc (Attributes_section_data::Attributes_section_data):
11074         Don't crash if size is zero.
11075
11076 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11077             Ian Lance Taylor  <iant@google.com>
11078
11079         * gold.cc (queue_middle_tasks): If no input files were opened,
11080         exit.
11081         * workqueue.h (Task_function::Task_function): Assert that there is
11082         a blocker.
11083
11084 2010-02-22  Doug Kwan  <dougkwan@google.com>
11085
11086         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
11087         * icf.cc (get_section_contents): Cast snprintf arguments to long long
11088         types to avoid warnings due to different uint64_t implementations
11089         on different hosts.
11090
11091 2010-02-21  Doug Kwan  <dougkwan@google.com>
11092
11093         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
11094         handling of the maximum backward branch offset.
11095         (Arm_relocate_functions::thumb_branch_common): Ditto.
11096         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
11097         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
11098         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
11099         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
11100         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
11101         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
11102         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
11103         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
11104         thumb_bl_out_of_range thumb_bl_out_of_range.o,
11105         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
11106         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
11107         thumb2_bl_out_of_range.o): New rules.
11108         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
11109         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
11110         thumb2_bl_out_of_range
11111         * testsuite/Makefile.in: Regenerate.
11112         * testsuite/arm_bl_in_range.s: New file.
11113         * testsuite/arm_bl_out_of_range.s: Ditto.
11114         * testsuite/arm_branch_in_range.sh: Ditto.
11115         * testsuite/arm_branch_range.t: Ditto.
11116         * testsuite/thumb2_branch_range.t: Ditto.
11117         * testsuite/thumb_bl_in_range.s: Ditto.
11118         * testsuite/thumb_bl_out_of_range.s: Ditto.
11119         * testsuite/thumb_branch_range.t: Ditto.
11120
11121 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
11122
11123         * gc.h (gc_process_relocs): Change vectors to point to the new list.
11124         Add reloc offset information.
11125         * icf.cc (get_section_contents): Change iterators to point to the new
11126         vectors. Add reloc offset information to the contents.
11127         * icf.h (Icf::Sections_reachable_info): New typedef.
11128         (Icf::Sections_reachable_list): New typedef.
11129         (Icf::Offset_info): New typedef.
11130         (Icf::Reloc_info): New struct typedef.
11131         (Icf::Reloc_info_list): New typedef.
11132         (Icf::symbol_reloc_list): Delete method.
11133         (Icf::addend_reloc_list): Delete method.
11134         (Icf::section_reloc_list): Delete method.
11135         (Icf::reloc_info_list): New method.
11136         (Icf::reloc_info_list_): New member.
11137
11138 2010-02-19  Doug Kwan  <dougkwan@google.com>
11139
11140         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
11141         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
11142         * arm.cc (Arm_relocation_functions): New forward declaration.
11143         (Target_arm::Target_arm): Initialize new data members
11144         got_mod_index_offset_ and tls_base_symbol_defined_.
11145         (Target_arm::Relocate::relocate_tls): New method.
11146         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
11147          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
11148         New methods.
11149         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
11150         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
11151         (Target_arm::got_mod_index_offset_,
11152         Target_arm::tls_base_symbol_defined_): New data members.
11153         (Target_arm::Scan::local, Target::Scan::global,
11154         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
11155         relocations.
11156
11157 2010-02-18  Doug Kwan  <dougkwan@google.com>
11158
11159         * arm.cc (Arm_relobj::find_linked_text_section): New method.
11160         (Arm_relobj::make_exidx_input_section): Pass section index of linked
11161         text section as a parameter becuase some broken tools may not set
11162         the link in section header.
11163         (Target_arm::has_got_section): New method.
11164         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
11165         without any mapping symbol as data only.  Remove warning.
11166         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
11167         link in its section header, try to discover the link by inspecting the
11168         REL31 relocation at the beginning of the section.
11169         (Target_arm::Scan::check_non_pic): Report name of offending relocation
11170         in error message.
11171         (Target_arm::Scan::global): Treat any reference to the symbol
11172         _GLOBAL_OFFSET_TABLE_ as a GOT access.
11173
11174 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
11175
11176         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
11177         (Scan::global_reloc_may_be_function_pointer): New function.
11178         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11179         (Scan::global_reloc_may_be_function_pointer): New function.
11180         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11181         (Scan::global_reloc_may_be_function_pointer): New function.
11182         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
11183         (Scan::global_reloc_may_be_function_pointer): New function.
11184         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
11185         (Scan::global_reloc_may_be_function_pointer): New function.
11186         (Scan::possible_function_pointer_reloc): New function.
11187         (Target_x86_64::can_check_for_function_pointers): New function.
11188         * gc.h (gc_process_relocs): Scan relocation types to determine if
11189         function pointers were taken for targets that support it.
11190         * icf.cc (Icf::find_identical_sections): Include functions for
11191         folding in safe ICF whose pointer is not taken.
11192         * icf.h (Secn_fptr_taken_set): New typedef.
11193         (fptr_section_id_): New member.
11194         (section_has_function_pointers): New function.
11195         (set_section_has_function_pointers): New function.
11196         (check_section_for_function_pointers): New function.
11197         * options.h: Fix comment for safe ICF option.
11198         * target.h (can_check_for_function_pointers): New function.
11199         * testsuite/Makefile.am: Add icf_safe_so_test test case.
11200         Modify icf_safe_test for X86-64.
11201         * testsuite/Makefile.in: Regenerate.
11202         * testsuite/icf_safe_so_test.cc: New file.
11203         * testsuite/icf_safe_so_test.sh: New file.
11204         * testsuite/icf_safe_test.cc (kept_func_3): New function.
11205         (main): Change to take pointer to function kept_func_3.
11206         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
11207         folding is done correctly for X86-64.
11208
11209 2010-02-12  David S. Miller  <davem@davemloft.net>
11210
11211         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
11212         is_symbolless parameter.
11213         (Output_reloc<SHT_REL>::is_symbolless): New.
11214         (Output_reloc<SHT_REL>::is_symbolless_): New.
11215         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
11216         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
11217         (Output_reloc<SHT_RELA>::is_symbolless): New.
11218         (Output_data_reloc::add_global): Handle is_symbolless.
11219         (Output_data_reloc::add_global_relative): Likewise.
11220         (Output_data_reloc::add_local): Likewise.
11221         (Output_data_reloc::add_local_relative): Likewise.
11222         (Output_data_reloc::add_symbolless_global_addend): New.
11223         (Output_data_reloc::add_symbolless_local_addend): New.
11224         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
11225         is_symbolless.
11226         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
11227         instead of ->is_relative_
11228         (Output_reloc::write): Likewise.
11229         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
11230         (Output_reloc::write_rel): Simplify.
11231
11232         * sparc.cc (Target_sparc::Scan::local): Use
11233         ->add_symbolless_local_addend as needed.
11234         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11235         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11236         based upon relocation offset.
11237
11238 2010-02-11  Doug Kwan  <dougkwan@google.com>
11239
11240         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11241         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11242         beginning of function.
11243         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11244         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11245         parameter is_32bit in calls to should_apply_static_reloc.
11246         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11247         (check_DATA): Add arm_abs_global.stdout.
11248         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11249         arm_abs_global.stdout): New rules.
11250         (MOSTLLYCLEANFILES): Add arm_abs_global
11251         * Makefile.in: Regenerate.
11252         * testsuite/arm_abs_global.s: New file.
11253         * testsuite/arm_abs_global.sh: Ditto.
11254         * testsuite/arm_abs_lib.s: Ditto.
11255
11256 2010-02-11  Ian Lance Taylor  <iant@google.com>
11257
11258         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11259         Read_relocs task.
11260         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11261         Allocate_commons_task first.
11262         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11263         task, rather than symtab_lock_.
11264         (Gc_process_relocs::~Gc_process_relocs): New function.
11265         (Gc_process_relocs::is_runnable): Check this_blocker_.
11266         (Gc_process_relocs::locks): Use next_blocker_ rather than
11267         blocker_.
11268         (Scan_relocs::~Scan_relocs): New function.
11269         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11270         symtab_lock_.
11271         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11272         next_blocker_.
11273         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11274         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11275         constructor accordingly.
11276         (class Gc_process_relocs): Likewise.
11277         (class Scan_relocs): Likewise.
11278         * common.h (class Allocate_commons_task): Remove symtab_lock_
11279         field, and corresponding constructor parameter.
11280         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11281         symtab_lock_.
11282         (Allocate_commons_task::locks): Likewise.
11283
11284 2010-02-11  Ian Lance Taylor  <iant@google.com>
11285
11286         * gold-threads.h (class Once): Define.
11287         (class Initialize_lock): Rewrite as child of Once.
11288         * gold-threads.cc (class Once_initialize): Define.
11289         (once_pointer_control): New static variable.
11290         (once_pointer, once_arg): New static variables.
11291         (c_run_once): New static function.
11292         (Once::Once, Once::run_once, Once::internal_run): New functions.
11293         (class Initialize_lock_once): Remove.
11294         (initialize_lock_control): Remove.
11295         (initialize_lock_pointer): Remove.
11296         (initialize_lock_once): Remove.
11297         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11298         (Initialize_lock::initialize): Rewrite.
11299         (Initialize_lock::do_run_once): New function.
11300         * archive.cc (Archive::interpret_header): Only clear name if it is
11301         not already empty.
11302         * fileread.cc: Include "gold-threads.h"
11303         (file_counts_lock): New static variable.
11304         (file_counts_initialize_lock): Likewise.
11305         (File_read::release): Only increment counts when using --stats.
11306         Use a lock around the increment.
11307         * parameters.cc (class Set_parameters_target_once): Define.
11308         (set_parameters_target_once): New static variable.
11309         (Parameters::Parameters): Move here from parameters.h.
11310         (Parameters::set_target): Rewrite.
11311         (Parameters::set_target_once): New function.
11312         (Parameters::clear_target): Move here and rewrite.
11313         * parameters.h (class Parameters): Update declarations.  Add
11314         set_parameters_target_once_ field.
11315         (Parameters::Parameters): Move to parameters.cc.
11316         (Parameters::clear_target): Likewise.
11317         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11318         task.
11319         (Start_group::~Start_group): New function.
11320         (Start_group::is_runnable): New function.
11321         (Start_group::locks, Start_group::run): New functions.
11322         (Finish_group::run): Change saw_undefined to size_t.
11323         * readsyms.h (class Start_group): Define.
11324         (class Finish_group): Change saw_undefined_ field to size_t.
11325         (Finish_group::Finish_group): Remove saw_undefined and
11326         this_blocker parameters.  Change all callers.
11327         (Finish_group::set_saw_undefined): New function.
11328         (Finish_group::set_blocker): New function.
11329         * symtab.h (class Symbol_table): Change saw_undefined to return
11330         size_t.  Change saw_undefined_ field to size_t.
11331         * target-select.cc (Set_target_once::do_run_once): New function.
11332         (Target_selector::Target_selector): Initialize set_target_once_
11333         field.  Don't initialize lock_ and initialize_lock_ fields.
11334         (Target_selector::instantiate_target): Rewrite.
11335         (Target_selector::set_target): New function.
11336         * target-select.h (class Set_target_once): Define.
11337         (class Target_selector): Update declarations.  Make
11338         Set_target_once a friend.  Remove lock_ and initialize_lock_
11339         fields.  Add set_target_once_ field.
11340
11341 2010-02-10  Ian Lance Taylor  <iant@google.com>
11342
11343         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11344         queueing any tasks.
11345         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11346         (queue_middle_tasks): Add all blockers before queueing any tasks.
11347         (queue_final_tasks): Likewise.
11348         * token.h (Task_token::add_blockers): New function.
11349         * object.h (Input_objects::number_of_relobjs): New function.
11350
11351 2010-02-10  Ian Lance Taylor  <iant@google.com>
11352
11353         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11354         shared, not if not position independent.
11355         * x86_64.cc (Relocate::relocate_tls): Likewise.
11356         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11357         (tls_pie_pic_test): New target.
11358         * testsuite/Makefile.in: Rebuild.
11359
11360         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11361         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11362         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11363         * testsuite/Makefile.in: Rebuild.
11364
11365 2010-02-09  David S. Miller  <davem@davemloft.net>
11366
11367         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11368         R_SPARC_RELATIVE using ->add_local_relative().
11369         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11370
11371         * output.h (Output_data_dynamic::add_section_size): New method
11372         that takes two Output_data objects.
11373         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11374         entry param.  Handle it in initializers.
11375         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11376         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11377         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11378         arg.
11379         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11380         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11381         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11382         for dynrel_includes_plt.
11383         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11384         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11385         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11386         before .rela.plt
11387         (Target_sparc::do_finalize_sections): Update to pass true for
11388         dynrel_includes_plt.
11389         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11390         output before .rela.plt
11391         (Target_powerpc::do_finalize_sections): Update to pass true for
11392         dynrel_includes_plt when 32-bit.
11393
11394 2010-02-08  Doug Kwan  <dougkwan@google.com>
11395
11396         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11397         method.
11398         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11399         Arm_relobj::scan_section_for_cortex_a8_stubs,
11400         Arm_relobj::do_relocation_section): Instead of calling
11401         Output_section::output_address, use faster
11402         Arm_relobj::simple_input_section_output_address.
11403
11404 2010-02-08  David S. Miller  <davem@davemloft.net>
11405
11406         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11407         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11408         relocation helper function.
11409
11410         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11411         just like R_SPARC_GOT{10,13,22}.
11412         (Target_sparc::Scan::local): Likewise.
11413         (Target_sparc::Relocate:relocate): Likewise.
11414
11415 2010-02-06  Ian Lance Taylor  <iant@google.com>
11416
11417         * configure.ac: Rewrite targetobjs duplicate removal code to use
11418         only shell constructs.
11419         * configure: Rebuild.
11420
11421 2010-02-05  Doug Kwan  <dougkwan@google.com>
11422
11423         PR 11247
11424         * arm.cc (Arm_relobj::section_is_scannable): New method.
11425         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11426         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11427
11428 2010-02-04  Doug Kwan  <dougkwan@google.com>
11429
11430         PR 11247
11431         * arm-reloc-property.cc (cstdio): Include.
11432         * configure.ac (targetobjs): Remove duplicates.
11433         * configure: Regenerate.
11434         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11435         big and little endian version for a given address size.
11436
11437 2010-02-03  Doug Kwan  <dougkwan@google.com>
11438
11439         * arm-reloc-property.cc
11440         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11441         definition.
11442         * arm-reloc-property.h
11443         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11444         New method definition.
11445         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11446         declaration.
11447         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11448         overflow to N.
11449         (GOT_PREL): Change implemented to Y.
11450         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11451         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11452         (Arm_relocate_functions::movw_abs_nc): Remove method.
11453         (Arm_relocate_functions::movt_abs): Ditto.
11454         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11455         (Arm_relocate_functions::thm_movt_abs): Ditto.
11456         (Arm_relocate_functions::movw_rel_nc): Ditto.
11457         (Arm_relocate_functions::movw_rel): Ditto.
11458         (Arm_relocate_functions::movt_rel): Ditto.
11459         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11460         (Arm_relocate_functions:thm_movw_rel): Ditto.
11461         (Arm_relocate_functions:thm_movt_rel): Ditto.
11462         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11463         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11464         New method definitions.
11465         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11466         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11467         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11468         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11469         (Target_arm::Relocate::relocate): Check for non-static or
11470         unimplemented relocation code and exit early.  Change calls to
11471         Target_arm::reloc_uses_thumb_bit and
11472         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11473         instead.  Refactor code to handle similar relocations to increase
11474         code sharing.  Remove check for unsupported relocation code in switch
11475         statement.
11476         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11477         relocation property table to find out size.  Change error message to
11478         print out the name of a relocation code instead of the numeric value.
11479         (Target_arm::scan_reloc_for_stub): Use relocation property table
11480         instead of calling Target_arm::reloc_uses_thumb_bit().
11481
11482 2010-02-02  Doug Kwan  <dougkwan@google.com>
11483
11484         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11485         types of relaxed input section.
11486
11487 2010-02-02  Doug Kwan  <dougkwan@google.com>
11488
11489         * Makefile.am (HFILES): Add arm-reloc-property.h.
11490         (DEFFILES): New.
11491         (TARGETSOURCES): Add arm-reloc-property.cc
11492         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11493         (libgold_a_SOURCES): $(DEFFILES)
11494         * Makefile.in: Regenerate.
11495         * arm-reloc-property.cc: New file.
11496         * arm-reloc-property.h: New file.
11497         * arm-reloc.def: New file.
11498         * arm.cc: Update comments.
11499         (arm-reloc-property.h): New included header.
11500         (arm_reloc_property_table): New global variable.
11501         (Target_arm::do_select_as_default_target): New method definition.
11502         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11503         arm-reloc-property to targ_extra_obj.
11504         * parameters.cc (set_parameters_target): Call
11505         Target::select_as_default_target().
11506         * target.h (Target::select_as_default_target): New method definition.
11507         (Target::do_select_as_default_target): Same.
11508
11509 2010-02-01  Doug Kwan  <dougkwan@google.com>
11510
11511         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11512         first_output_text_section_.
11513         (Arm_exidx_fixup::first_output_text_section): New method definition.
11514         (Arm_exidx_fixup::first_output_text_section_): New data member.
11515         (Arm_exidx_fixup::process_exidx_section): Record the first text
11516         output section seen.
11517         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11518         and entsize in output section header.
11519
11520 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11521
11522         * arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11523         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11524         (Arm_relocate_functions::thm_alu11): New Method.
11525         (Arm_relocate_functions::thm_pc8): New Method.
11526         (Arm_relocate_functions::thm_pc12): New Method.
11527         (Target_arm::Scan::local): Handle the relocations.
11528         (Target_arm::Scan::global): Likewise.
11529         (Target_arm::Relocate::relocate): Likewise.
11530         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11531
11532 2010-01-29  Doug Kwan  <dougkwan@google.com>
11533
11534         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11535         of relocation types as ld.
11536
11537 2010-01-29  Doug Kwan  <dougkwan@google.com>
11538
11539         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11540         to public.
11541         (Arm_relocate_functions::thumb_branch_common): Ditto.
11542         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11543         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11544         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11545         Arm_relocate_functions::jump24): Remove.
11546         (Target_arm::Relocate::relocate): Adjust code to call
11547         Arm_relocation_functions::arm_branch_common and
11548         Arm_relocation_functions::thumb_branch_common instead of their removed
11549         wrappers.  Merge switch-cases together to reduce source code size.
11550
11551 2010-01-29  Doug Kwan  <dougkwan@google.com>
11552
11553         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11554         output_local_symbol_count_needs_update_.
11555         (Arm_relobj::output_local_symbol_count_needs_update,
11556          Arm_relobj::set_output_local_symbol_count_needs_update,
11557          Arm_relobj::update_output_local_symbol_count): New methods.
11558         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11559         member.
11560         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11561         of pointed function as in a R_ARM_PREL31 relocation.
11562         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11563         for output local symbol count updating.
11564         (Target_arm::do_relax): Update output local symbol counts in objects
11565         if necessary.
11566         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11567
11568 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11569
11570         * arm.cc: Added support for the ARM relocations:
11571         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11572         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11573         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11574         movw_prel_nc).
11575         (Arm_relocate_functions::movw_rel): New method.
11576         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11577         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11578         thm_movw_prel_nc).
11579         (Arm_relocate_functions::thm_movw_rel): New method.
11580         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11581         thm_movt_prel).
11582         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11583         relocations.
11584         (Target_arm::Scan::global): Likewise.
11585         (Target_arm::Relocate::relocate): Likewise.
11586         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11587         Likewise.
11588
11589 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11590
11591         * arm.cc: Added support for ARM group relocations.
11592         (Target_arm::reloc_needs_sym_origin): New method.
11593         (Arm_relocate_functions::calc_grp_kn): New method.
11594         (Arm_relocate_functions::calc_grp_residual): New method.
11595         (Arm_relocate_functions::calc_grp_gn): New method.
11596         (Arm_relocate_functions::arm_grp_alu): New Method.
11597         (Arm_relocate_functions::arm_grp_ldr): New Method.
11598         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11599         (Arm_relocate_functions::arm_grp_ldc): New Method.
11600         (Target_arm::Scan::local): Handle the ARM group relocations.
11601         (Target_arm::Scan::global): Likewise.
11602         (Target_arm::Relocate::relocate): Likewise.
11603         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11604         Likewise.
11605
11606 2010-01-26  Doug Kwan  <dougkwan@google.com>
11607
11608         * arm.cc (set): Include.
11609         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11610         pointer type.
11611         (Arm_output_section::Text_section_list): New type.
11612         (Arm_output_section::append_text_sections_to_list): New method.
11613         (Arm_output_section::fix_exidx_coverage): Ditto.
11614         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11615         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11616         Relobj::set_section_offset() instead of
11617         Sized_relobj::invalidate_section_offset().
11618         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11619         parameter for section headers. Ignore relocation sections for
11620         unallocated sections and EXIDX sections.
11621         (Target_arm::fix_exidx_coverage): New method.
11622         (Target_arm::output_section_address_less_than): New type.
11623         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11624         linked text section instead of the EXIDX section.
11625         (Arm_output_section::create_stub_group): Add an assertion to check
11626         that this is not an EXIDX output section.
11627         (Arm_output_section::append_text_sections_to_list): New method.
11628         (Arm_output_section::fix_exidx_coverage): Ditto.
11629         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11630         Arm_relobj::section_needs_reloc_stub_scanning.
11631         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11632         first pass.
11633         (Target_arm::fix_exidx_coverage): New method.
11634         * object.h (Relobj::set_output_section): New method.
11635         (Sized_relobj::invalidate_section_offset): Remove method.
11636         (Sized_relobj::do_invalidate_section_offset): Remove method.
11637         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11638
11639 2010-01-25  Doug Kwan  <dougkwan@google.com>
11640
11641         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11642         Fix warning due to signed and unsigned comparison on a 32-bit host.
11643
11644 2010-01-22  Doug Kwan  <dougkwan@google.com>
11645
11646         * arm.cc (Target_arm::do_relax): Record an output section for section
11647         offset adjustment it contains any stub table that has changed.
11648         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11649         offsets in an output section if necessary.
11650         * output.cc (Output_section::Output_section): Initialize
11651         section_offsets_need_adjustments_.
11652         (Output_section::add_input_section_for_script): Renamed to
11653         Output_section::add_simple_input_section.
11654         (Output_section::save_states): Add a comment.
11655         (Output_section::discard_states): New method defintion.
11656         (Output_section::adjust_section_offsets): Same.
11657         * output.h (Output_section::add_input_section_for_script): Renamed to
11658         Output_section::add_simple_input_section.
11659         (Output_section::discard_states): New method declaration.
11660         (Output_section::adjust_section_offsets): Same.
11661         (Output_section::section_offsets_need_adjustment,
11662         Output_section::set_section_offsets_need_adjustment): New method
11663         definitions.
11664         (Output_section::section_offsets_need_adjustment_): New data member.
11665         * script-sections.cc
11666         (Output_section_element_input::set_section_address): Adjust code for
11667         renaming of Output_section::add_input_section_for_script.
11668         (Orphan_output_section::set_section_address): Same.
11669
11670 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11671
11672         * arm.cc (Target_arm): Updated fix_v4bx method and usage of
11673         Fix_v4bx enum values .
11674         * options.h (General_options): New option definitions.
11675         (General_options::fix_v4bx): New method.
11676         (General_options::Fix_v4bx): New enum.
11677         * options.cc (General_options::parse_fix_v4bx): New method.
11678         (General_options::parse_fix_v4bx_interworking): New method.
11679
11680 2010-01-22  Doug Kwan  <dougkwan@google.com>
11681
11682         * arm.cc (Arm_exidx_fixup): New class.
11683
11684 2010-01-21  Doug Kwan  <dougkwan@google.com>
11685
11686         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11687         classes.
11688         (Arm_exidx_section_offset_map): New type.
11689
11690 2010-01-21  Doug Kwan  <dougkwan@google.com>
11691
11692         * arm.cc (Arm_exidx_input_section): New class.
11693         (Arm_relobj::exidx_input_section_by_link,
11694         Arm_relobj::exidx_input_section_by_shndx,
11695         Arm_relobj::make_exidx_input_section): New methods.
11696         (read_arm_attributes_section): Remove.
11697         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11698         information about them.
11699         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11700         to here.
11701
11702 2010-01-20  Doug Kwan  <dougkwan@google.com>
11703
11704         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11705         Input_section_specifier to Section_id.
11706         (Target_arm::new_arm_input_section: Adjust code for change of key
11707         type.
11708         (Target_arm::find_arm_input_section): Ditto.
11709         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11710         (Section_id): Remove.
11711         (Garbage_collection::Section_id_hash): Remove.
11712         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11713         (Section_id): Remove.
11714         (Icf::Section_id_hash): Remove.
11715         * object.h (Section_id, Const_section_id, Section_id_hash,
11716         Const_section_id_hash): New type definitions.
11717         * output.cc (Output_section::add_relaxed_input_section): Change to
11718         use Const_section_id instead of Input_section_specifier as key type.
11719         (Output_section::add_merge_input_section): Ditto.
11720         (Output_section::build_relaxation_map): Change to use Section_id
11721         instead of Input_section_specifier as key type.
11722         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11723         Ditto.
11724         (Output_section::convert_input_sections_to_relaxed_sections): Change
11725         to use Const_section_id instead of Input_section_specifier as key type.
11726         (Output_section::find_merge_section): Ditto.
11727         (Output_section::find_relaxed_input_section): Ditto.
11728         * output.h (Input_section_specifier): Remove class.
11729         (Output_section::Output_section_data_by_input_section_map): Change
11730         key type to Const_section_id.
11731         (Output_section::Output_relaxed_input_section_by_input_section_map):
11732         Ditto.
11733         (Output_section::Relaxation_map): Change key type to Section_id.
11734
11735 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11736
11737         * arm.cc: Added support for R_ARM_V4BX relocation
11738         (class Arm_v4bx_stub): New class.
11739         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11740         (Stub_factory::make_arm_v4bx_stub): New method.
11741         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11742         (Stub_table::empty): Handle v4bx stubs.
11743         (Stub_table::add_arm_v4bx_stub): New method.
11744         (Stub_table::find_arm_v4bx_stub): New method.
11745         (Arm_relocate_functions::v4bx): New method.
11746         (Target_arm::fix_v4bx): New method.
11747         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11748         (Stub_table::relocate_stubs): Likewise.
11749         (Stub_table::do_write): Likewise.
11750         (Stub_table::update_data_size_and_addralign): Likewise.
11751         (Stub_table::finalize_stubs):  Likewise.
11752         (Target_arm::Scan::local): Likewise.
11753         (Target_arm::Scan::global): Likewise.
11754         (Target_arm::do_finalize_sections): Likewise.
11755         (Target_arm::Relocate::relocate): Likewise.
11756         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11757         Likewise.
11758         (Target_arm::scan_reloc_for_stub): Likewise.
11759         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11760
11761 2010-01-19  Ian Lance Taylor  <iant@google.com>
11762
11763         * output.cc (Output_section_headers::do_sized_write): Write large
11764         segment count to sh_info field.
11765         (Output_file_header::do_sized_write): For large segment count,
11766         write PN_XNUM to e_phnum field.
11767
11768 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11769
11770         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11771         (Arm_relocate_functions::thm_jump8): New function.
11772         (Arm_relocate_functions::thm_jump11): New function.
11773         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11774         R_ARM_THM_JUMP11.
11775         (Target_arm::Scan::global): Likewise.
11776         (Target_arm::Relocate::relocate): Likewise.
11777         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11778         Likewise.
11779
11780 2010-01-14  Doug Kwan  <dougkwan@google.com>
11781
11782         * arm.cc (map, utility): Include headers.
11783         (Target_arm::apply_cortex_a8_workaround): New method.
11784         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11785         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11786         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11787         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11788         the --[no-]fix-cortex-a8 command line options.
11789         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11790         (Target_arm::relocate_stub): Use addend in instruction template.
11791         * options.h (DEFINE_bool): Set the user-set flag.
11792         (General_options): Add --[no-]-fix-cortex options.
11793         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11794         : Update fast look-up map after conversion.
11795
11796 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11797
11798         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11799         in the first pass of do_layout.
11800
11801 2010-01-13  Doug Kwan  <dougkwan@google.com>
11802
11803         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11804         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11805         apparent compiler problem of not folding static constant integral
11806         data members of elfcpp::Elf_sizes<32>.
11807
11808 2010-01-13  Doug Kwan  <dougkwan@google.com>
11809
11810         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11811         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11812         Arm_relobj::scan_section_for_cortex_a8_erratum,
11813         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11814         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11815         sections to scan for relocation stubs into a new method
11816         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11817         relocation and Cortex-A8 stub scanning.
11818         (Target_arm::do_relax): Force stubs to be after stubbed sections
11819         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11820         the beginning of a new relaxation pass.  Update a comment.
11821         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11822
11823 2010-01-12  Ian Lance Taylor  <iant@google.com>
11824
11825         * target-reloc.h (visibility_error): New inline function.
11826         (relocate_section): Call visibility_error.
11827         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11828         (MOSTLYCLEANFILES): Likewise.
11829         (protected_4_pic.o, protected_3.err): New targets.
11830         * testsuite/protected_4.cc: New file.
11831
11832 2010-01-12  Doug Kwan  <dougkwan@google.com>
11833
11834         * arm.cc (Cortex_a8_reloc): New class.
11835         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11836         and cortex_a8_relocs_info_.
11837         (Target_arm::fix_cortex_a8): New method definition.
11838         (Target_arm::Cortex_a8_relocs_info): New type.
11839         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11840         New data member declarations.
11841         (Target_arm::scan_reloc_for_stub): Record information about
11842         relocations for THUMB branches that might be exempted from the
11843         Cortex-A8 workaround.
11844         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11845         at the beginning of a relaxation pass.
11846
11847 2010-01-12  Doug Kwan  <dougkwan@google.com>
11848
11849         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11850         (Arm_relobj::Mapping_symbol_position,
11851          Arm_reloj::Mapping_symbol_position_less,
11852          Arm_relobj::Mapping_symbols_info): New types.
11853         (Target_arm::is_mapping_symbol_name): New method definition.
11854         (Arm_relobj::do_count_local_symbols): Save information about mapping
11855         symbols.
11856
11857 2010-01-11  Doug Kwan  <dougkwan@google.com>
11858
11859         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11860         Arm_relocate_functions::thumb32_branch_upper,
11861         Arm_relocate_functions::thumb32_branch_lower,
11862         Arm_relocate_functions::thumb32_cond_branch_offset,
11863         Arm_relocate_functions::thumb32_cond_branch_upper,
11864         Arm_relocate_functions::thumb32_cond_branch_lower,
11865         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11866         branch offset encoding.
11867         (Arm_relocate_functions::thumb_branch_common): Use new branch
11868         offset encoding methods to avoid code duplication.
11869         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11870         (Stub_addend_reader::operator()): Use new branch encoding method
11871         to avoid code duplication.
11872
11873 2010-01-11  Doug Kwan  <dougkwan@google.com>
11874
11875         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11876         (Target_arm::do_finalize_sections): Define special EXIDX section
11877         symbols only if referenced.
11878         * gc.h (Garbage_collection::add_reference): New method.
11879         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11880         code duplication.
11881
11882 2010-01-11  Ian Lance Taylor  <iant@google.com>
11883
11884         * script.cc (Version_script_info::build_expression_list_lookup):
11885         Change complaing about duplicate wildcard match from error to
11886         warning.
11887
11888         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11889         of 2009-12-30.
11890         (Version_script_info::Version_script_info): Initialize globs_,
11891         default_version_, default_is_global_, and exact_.  Don't
11892         initialize globals_ or locals_.
11893         (Version_script_info::build_lookup_tables): Build local symbols
11894         first.
11895         (Version_script_info::unquote): New function.
11896         (Version_script_info::add_exact_match): New function.
11897         (Version_script_info::build_expression_list_lookup): Remove lookup
11898         parameter.  Add is_global parameter.  Change all callers.  Handle
11899         wildcard pattern specially.  Unquote pattern.  Call
11900         add_exact_match.
11901         (Version_script_info::get_name_to_match): New function.
11902         (Version_script_info::get_symbol_version): New function.
11903         (Version_script_info::get_symbol_version_helper): Remove.
11904         (Version_script_info::check_unmatched_names): Call unquote.
11905         * script.h (class Version_script_info): Change get_symbol_version
11906         to be non-inline and add is_global parameter; change all callers.
11907         Rewrite symbol_is_local.  Update declarations.  Define struct
11908         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11909         Remove globals_ and locals_ members.  Add exact_, globs_,
11910         default_version_, is_global_.
11911         (Version_script_info::Glob): Remove pattern, add expression and
11912         is_global.  Update constructor.  Change all callers.
11913         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11914         default version.
11915         (Versions::symbol_section_contents): If a symbol is undefined, or
11916         defined in a dynamic object, set the version index to
11917         VER_NDX_LOCAL.
11918         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11919         symbol_is_local.
11920         (Symbol_table::add_from_pluginobj): Likewise.
11921         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11922
11923 2010-01-11  Doug Kwan  <dougkwan@google.com>
11924
11925         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11926         (incremental_dump_LDADD): Add linking option for libintl.
11927         * Makefile.in: Regenerate.
11928
11929 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11930
11931         PR gold/11144
11932         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11933         instead of -Ds.
11934         * testsuite/Makefile.in: Regenerated.
11935
11936 2010-01-10  Doug Kwan  <dougkwan@google.com>
11937
11938         * options.h (DEFINE_var): Use parentheses around argument varname__
11939         in macro body to avoid any unintended subsequent substitutions.
11940
11941 2010-01-10  Ian Lance Taylor  <iant@google.com>
11942
11943         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11944         candidates before doing symbol resolution.
11945
11946         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11947         ODR candidates if only one is weak.
11948
11949 2010-01-08  Ian Lance Taylor  <iant@google.com>
11950
11951         * script.cc (Version_script_info::build_expression_list_lookup):
11952         Don't warn about ambiguous version, just record the ambiguity.
11953         (Version_script_info::get_symbol_version_helper): Give error if
11954         version is ambiguous.
11955
11956 2010-01-08  Doug Kwan  <dougkwan@google.com>
11957
11958         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11959         prev_data_size_ and prev_addralign_.  Remove initializer for
11960         deleted data member has_been_changed_.
11961         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11962         to determine if the table is empty.
11963         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11964         Remove.
11965         (Stub_table::add_reloc_stub): Define method in class definition
11966         instead of just declaring it there.
11967         (Stub_table::add_cortex_a8_stub): New method definition.
11968         (Stub_table::update_data_size_and_addralign): Ditto.
11969         (Stub_table::finalize_stubs): Ditto.
11970         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11971         (Stub_table::do_addralign_): Return address alignment in the
11972         (Stub_table::do_reset_address_and_file_offset): Define method in
11973         class definition instead of declaring it there.  Set current data
11974         size to be the data size of the previous pass.
11975         (Stub_table::set_final_data_size): Use current data size as the
11976         final data size.
11977         (Stub_table::relocate_stub): Change parameter type of stub from
11978         Reloc_stub pointer to Stub pointer.
11979         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11980         (Stub_table::Cortex_a8_stub_list): New typedef.
11981         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11982          Stub_table::prev_addralign_): New data member.
11983         (Arm_relobj::Arm_relobj): Initialize data member
11984         section_has_cortex_a8_workaround_.
11985         (Arm_relobj::section_has_cortex_a8_workaround,
11986          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11987          definitions.
11988         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11989         declarations.
11990         (Target_arm::relocate_stub): Change parameter type of stub from
11991         Reloc_stub pointer to Stub pointer.
11992         (Insn_template::size, Insn_template::alignment): Handle
11993         THUMB16_SPECIAL_TYPE.
11994         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11995          Stub_table::update_data_size_and_addralign,
11996          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11997         definitions.
11998         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11999         (Stub_table::do_write): Ditto.
12000         (Target_arm::do_relax): Adjust code for changes in Stub_table.
12001
12002 2010-01-08  Ian Lance Taylor  <iant@google.com>
12003
12004         PR 11108
12005         * symtab.h (class Symbol): Remove fields is_target_special_ and
12006         has_plt_offset_.  Add field is_defined_in_discarded_section_.
12007         (Symbol::is_defined_in_discarded_section): New function.
12008         (Symbol::set_is_defined_in_discarded_section): New function.
12009         (Symbol::has_plt_offset): Rewrite.
12010         (Symbol::set_plt_offset): Verify that new offset is not -1U.
12011         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
12012         Don't initialize is_target_special_ or has_plt_offset_.
12013         Initialize is_defined_in_discarded_section_.
12014         (Symbol_table::add_from_relobj): If appropriate, set
12015         is_defined_in_discarded_section.
12016         * resolve.cc (Symbol::override_base_with_special): Don't test
12017         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
12018         * target-reloc.h (relocate_section): Do special handling for
12019         symbols defined in discarded sections for global symbols as well
12020         as local symbols.
12021
12022 2010-01-08  Ian Lance Taylor  <iant@google.com>
12023
12024         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
12025         the SHT_SYMTAB case.
12026
12027 2010-01-08  Ian Lance Taylor  <iant@google.com>
12028
12029         * object.cc (Sized_relobj::do_layout): Don't get confused if
12030         layout_eh_frame returns NULL.
12031
12032 2010-01-08  Ian Lance Taylor  <iant@google.com>
12033
12034         PR 11084
12035         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
12036         dynamic symbol table, use the normal symbol table.
12037         (Sized_dynobj::do_read_symbols): Remove assertion about type of
12038         symbol table.
12039
12040 2010-01-08  Ian Lance Taylor  <iant@google.com>
12041
12042         PR 11072
12043         * layout.cc (Layout::include_section): Remove .gnu_debuglink
12044         sections.
12045
12046 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
12047
12048         * version.cc (print_version): Change to "Copyright 2010".
12049
12050 2010-01-08  Ian Lance Taylor  <iant@google.com>
12051
12052         PR 10287
12053         PR 11063
12054         * i386.cc (class Target_i386): Change return type of plt_section
12055         to be non-const.
12056         (class Output_data_plt_i386): Add tls_desc_rel_ field.
12057         (Output_data_plt_i386::Output_data_plt_i386): Initialize
12058         tls_desc_rel_ field.
12059         (Output_data_plt_i386::rel_tls_desc): New function.
12060         (Target_i386::rel_tls_desc_section): New function.
12061         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
12062         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
12063         R_386_TLS_DESC reloc in rel_tls_desc_section.
12064         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
12065         Define struct Tlsdesc_info.
12066         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
12067         (Target_x86_64::do_reloc_symbol_index): New function.
12068         (Target_x86_64::add_tlsdesc_info): New function.
12069         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
12070         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
12071         tlsdesc_rel_ field.
12072         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
12073         all callers.
12074         (Output_data_plt_x86_64::rela_tlsdesc): New function.
12075         (Target_x86_64::rela_tlsdesc_section): New function.
12076         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
12077         handling.
12078         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
12079         (Target_x86_64::do_reloc_addend): New function.
12080         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
12081         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
12082         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
12083         (Output_reloc::type): New function.
12084         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
12085         (Output_reloc::is_target_specific): New function.
12086         (Output_reloc::target_arg): New function.
12087         (class Output_reloc) [SHT_RELA]: Add four new constructors for
12088         absolute relocs and target specific relocs.
12089         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
12090         add_target_specific.
12091         (class Output_data_reloc) [SHT_RELA]: Likewise.
12092         * output.cc (Output_reloc::Output_reloc): Add four new versions
12093         for absolute relocs and target specific relocs.
12094         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
12095         (Output_reloc::get_symbol_index): Likewise.
12096         (Output_reloc::local_section_offset): Check that local_sym_index_
12097         is not TARGET_CODE or 0.
12098         (Output_reloc::symbol_value): Likewise.
12099         (Output_reloc::write) [SHT_RELA]: Call target for target specific
12100         reloc.
12101         * target.h (class Target): Add reloc_symbol_index and reloc_addend
12102         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
12103         functions.
12104         * layout.cc (add_target_dynamic_tags): Use output section for
12105         DT_PLTRELSZ and DT_JMPREL.
12106
12107 2010-01-07  Ian Lance Taylor  <iant@google.com>
12108
12109         PR 11061
12110         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
12111         function.
12112         (class Output_data_reloc_generic): Define.
12113         (class Output_data_reloc_base): Change base class to
12114         Output_data_reloc_generic.  Change add() method to call
12115         bump_relative_reloc_count for a relative reloc.  Remove
12116         sort_relocs_ field.
12117         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
12118         to sort_relocs().
12119         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
12120         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
12121         appropriate.
12122         * layout.h (class Layout): Update declaration.
12123
12124 2010-01-07  Ian Lance Taylor  <iant@google.com>
12125
12126         * output.h (class Output_data): Add const version of
12127         output_section and do_output_section.
12128         (class Output_section_data): Add const version of
12129         do_output_section.
12130         (class Output_section): Likewise.
12131         * layout.cc (Layout::add_target_dynamic_tags): New function.
12132         * layout.h (class Layout): Update declarations.
12133         * arm.cc (Target_arm::do_finalize_sections): Use
12134         add_target_dynamic_tags.
12135         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12136         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12137         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12138         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12139
12140 2010-01-07  Ian Lance Taylor  <iant@google.com>
12141
12142         PR 11042
12143         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
12144         object as needed.
12145
12146 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
12147             Ian Lance Taylor  <iant@google.com>
12148
12149         PR 11019
12150         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
12151         Xindex::read_symtab_xindex.
12152
12153 2010-01-07  Doug Kwan  <dougkwan@google.com>
12154
12155         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
12156         (Insn_template::thumb16_bcond_insn): New method declaration.
12157         (Insn_template): Fix spelling.
12158         (Stub::thumb16_special): New method declaration.
12159         (Stub::do_write): Define virtual method which was previously pure
12160         virtual.
12161         (Stub::do_thumb16_special): New method declaration.
12162         (Stub::do_fixed_endian_write): New template member.
12163         (Reloc_stub::do_write): Remove.
12164         (Reloc_stub::do_fixed_endian_write): Remove.
12165         (Cortex_a8_stub): New class definition.
12166         (Stub_factory::make_cortex_a8_stub): New method definition.
12167         (Stub_factory::Stub_factory): Add missing static storage class
12168         qualifier for elf32_arm_stub_a8_veneer_blx.
12169
12170 2010-01-07  Ian Lance Taylor  <iant@google.com>
12171
12172         PR 10980
12173         * options.h (class General_options): Add --warn-unresolved-symbols
12174         and --error-unresolved-symbols.
12175         * errors.cc (Errors::undefined_symbol): Implement
12176         --warn-unresolved-symbols.
12177
12178         * options.h (class General_options): Add -z text and -z textoff.
12179         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
12180
12181 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
12182
12183         * gc.h (Garbage_collection::Cident_section_map): New typedef.
12184         (Garbage_collection::cident_sections): New function.
12185         (Garbage_collection::add_cident_section): New function.
12186         (Garbage_collection::cident_sections_): New member.
12187         (gc_process_relocs): Add references to sections whose names are C
12188         identifiers.
12189         * gold.h (cident_section_start_prefix): New constant.
12190         (cident_section_stop_prefix): New constant.
12191         (is_cident): New function.
12192         * layout.cc (Layout::define_section_symbols): Replace string constants
12193         with the newly defined constants.
12194         * object.cc (Sized_relobj::do_layout): Track sections whose names are
12195         C identifiers.
12196         * testsuite/Makefile.am: Add gc_orphan_section_test.
12197         * testsuite/Makefile.in: Regenerate.
12198         * testsuite/gc_orphan_section_test.cc: New file.
12199         * testsuite/gc_orphan_section_test.sh: New file.
12200
12201 2010-01-06  Ian Lance Taylor  <iant@google.com>
12202
12203         PR 10980
12204         * options.h (class General_options): Add --warn-shared-textrel.
12205         * layout.cc (Layout::finish_dynamic_section): Implement
12206         --warn-shared-textrel.
12207
12208         PR 10980
12209         * options.h (class General_options): Add --warn-multiple-gp.
12210
12211 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12212
12213         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
12214         $(THREADSLIB) and $(LIBDL).
12215         * Makefile.in: Rebuild.
12216
12217 2010-01-06  Ian Lance Taylor  <iant@google.com>
12218
12219         PR 10980
12220         * options.cc (General_options::parse_section_start): New function.
12221         (General_options::section_start): New function.
12222         (General_options::General_options): Initialize all members.
12223         * options.h: Include <map>
12224         (class General_options): Add --section-start.  Add section_starts_
12225         member.
12226         * layout.cc (Layout::attach_allocated_section_to_segment): If
12227         --section-start was used, set the address of the segment.  Remove
12228         local sort_sections.
12229         (Layout::relaxation_loop_body): If the address of the load segment
12230         has been set by --section-start, don't use it.
12231         * output.h (Output_segment::update_flags_for_output_section): New
12232         function.
12233         * output.cc (Output_segment::add_output_section): Call
12234         update_flags_for_output_section.
12235
12236 2010-01-05  Ian Lance Taylor  <iant@google.com>
12237
12238         PR 10980
12239         * options.h (class General_options): Add --undefined-version.
12240         * script.cc (struct Version_expression): Add was_matched_by_symbol
12241         field.
12242         (Version_script_info::matched_symbol): New function.
12243         (Version_script_info::get_symbol_version_helper): Call
12244         matched_symbol.
12245         (Version_script_info::check_unmatched_names): New function.
12246         * script.h (class Version_script_info): Update declarations.
12247         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12248
12249         * options.h (class General_options): Use DEFINE_bool_alias for
12250         allow_multiple_definition.
12251         * resolve.cc (Symbol_table::should_override): Don't test
12252         allow_multiple_definition.
12253
12254         PR 10980
12255         * options.h (class General_options): Add --cref.
12256         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12257         until after printing cref table.
12258         * cref.cc: Include "symtab.h".
12259         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12260         (Cref_table_compare::operator()): New function.
12261         (Cref_inputs::gather_cref): New function.
12262         (filecol): New static const.
12263         (Cref_inputs::print_cref): New function.
12264         (Cref::print_cref): New function.
12265         * cref.h: Include <cstdio>.
12266         (class Cref): Update declarations.
12267         * mapfile.h (Mapfile::file): New function.
12268         * object.h (class Object): Define Symbols.  Declare virtual
12269         do_get_global_symbols.
12270         (Object::get_global_symbols): New function.
12271         * object.cc (Input_objects::add_object): Pass object to cref_ if
12272         --cref.
12273         (Input_objects::archive_start): Likewise.
12274         (Input_objects::archive_stop): Likewise.
12275         (Input_objects::print_cref): New function.
12276         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12277         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12278         --cref.
12279         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12280         function.
12281         * plugin.h (class Sized_pluginobj): Update declarations.
12282
12283 2010-01-05  Ian Lance Taylor  <iant@google.com>
12284
12285         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12286         to is_default_version.  Rename insdef to insdefault.
12287         (Symbol_table::add_from_relobj): Rename def to is_default_version
12288         and local to is_forced_local.
12289         (Symbol_table::add_from_pluginobj): Likewise.
12290         (Symbol_table::add_from_dynobj): Likewise.
12291         (Symbol_table::define_special_symbol): Rename insdef to
12292         insdefault.
12293
12294 2010-01-04  Ian Lance Taylor  <iant@google.com>
12295
12296         PR 10980
12297         * options.h (class General_options): Add
12298         --allow-multiple-definition and -z muldefs.
12299         * resolve.cc (Symbol_table::should_override): Don't warn about a
12300         multiple symbol definition if --allow-multiple-definition or -z
12301         muldefs.
12302
12303         PR 10980
12304         * options.h (class General_options): Add --add-needed and
12305         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12306         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12307         error if --copy-dt-needed-entries aka --add-needed is used and
12308         would cause a change in behaviour.
12309
12310         PR 10980
12311         * options.h (class General_options): Add -G as a short version of
12312         --shared.  Add no-op options -assert, -g, and -i.
12313
12314 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12315
12316         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12317         check for .text or .gnu.linkonce.t sections.
12318         * icf.cc (Icf::find_identical_sections): Ditto.
12319         Change the detection for mangled function name within the section
12320         name.
12321         * icf.h (is_section_foldable_candidate): New function.
12322
12323 2009-12-30  Ian Lance Taylor  <iant@google.com>
12324
12325         PR 10980
12326         * options.h (class General_options): Permit two dashes with
12327         --retain-symbols-file.
12328
12329 2009-12-30  Ian Lance Taylor  <iant@google.com>
12330
12331         PR 10979
12332         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12333         don't put the file header and segment headers in the text
12334         segment.
12335
12336         PR 10979
12337         * common.cc (Sort_commons::operator()): Stabilize sort when both
12338         entries are NULL.
12339         (Symbol_table::do_allocate_commons_list): When allocating common
12340         symbols, skip a symbol which is no longer common.
12341         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12342         an object before checking its type.
12343         * testsuite/common_test_2.c: New file.
12344         * testsuite/common_test_3.c: New file.
12345         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12346         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12347         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12348         (common_test_2_pic.o, common_test_2.so): New targets.
12349         (common_test_3_pic.o, common_test_3.so): New targets.
12350         * testsuite/Makefile.in: Rebuild.
12351
12352         PR 10979
12353         * script.cc (read_input_script): If we see a new SECTIONS clause,
12354         and we have added an input section, give an error.
12355         * layout.h (class Layout): Add have_added_input_section function.
12356         Add have_added_input_section_ field.
12357         * layout.cc (Layout::Layout): Initialize
12358         have_added_input_section_.
12359         (Layout::layout): Set have_added_input_section_.
12360         (Layout::layout_eh_frame): Likewise.
12361
12362 2009-12-30  Ian Lance Taylor  <iant@google.com>
12363
12364         PR 10931
12365         * options.h (class General_options): Add --sort-common option.
12366         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12367         * common.cc (Sort_common): Add sort_order parameter to
12368         constructor.  Add sort_order_ field.
12369         (Sort_commons::operator): Check sort_order_.
12370         (Symbol_table::allocate_commons): Determine the sort order.
12371         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12372         Change all callers.
12373         (Symbol_table::do_allocate_commons_list): Likewise.
12374
12375 2009-12-30  Ian Lance Taylor  <iant@google.com>
12376
12377         PR 10916
12378         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12379         symbols from this object, don't change the visibility of an
12380         undefined symbol.
12381         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12382
12383 2009-12-30  Ian Lance Taylor  <iant@google.com>
12384
12385         PR 10861
12386         * script.h (class Version_script_info): Define Language enum.
12387         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12388         new fields globals_, locals_, and is_finalized_.
12389         * script.cc: Various formatting fixes.
12390         (class Parser_closure): Change language_stack_ from a vector of
12391         std::string to one of Version_script_info::Language.  Adjust all
12392         uses accordingly.
12393         (class Lazy_demangler): Remove.
12394         (struct Version_expression): Change language from std::string to
12395         Version_script_info::Language.
12396         (Version_script_info::Version_script_info): New function.
12397         (Version_script_info::~Version_script_info): Don't call clear.
12398         (Version_script_info::finalize): New function.
12399         (Version_script_info::build_lookup_tables): New function.
12400         (Version_script_info::build_expression_list_lookup): New
12401         function.
12402         (Version_script_info::get_symbol_version_helper): Rewrite to use
12403         lookup tables.
12404         (Version_script_info::print_expression_list): Adjust to use
12405         Version_script_info::Language.
12406         (script_push_lex_into_version_mode): Check that the version script
12407         has not been finalized.
12408         (version_script_push_lang): Change language string to
12409         Version_script_info::Language.
12410         * options.cc (Command_line::version_script): New function.
12411         * options.h (class General_options): Add finalize_dynamic_list
12412         function.  Change version_script from declaration to definition.
12413         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12414         * testsuite/version_script.map: Remove duplicate def of foo.
12415         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12416         version_script.map.
12417         * testsuite/Makefile.in: Rebuild.
12418
12419 2009-12-30  Ian Lance Taylor  <iant@google.com>
12420
12421         PR 10843
12422         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12423         if the input symbol index is 0, make the output symbol index 0.
12424
12425 2009-12-30  Ian Lance Taylor  <iant@google.com>
12426
12427         PR 10670
12428         * options.h (class General_options): Add -x/--discard-all.
12429         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12430         --discard-all.  If the local symbol needs a dynamic entry, check
12431         that before handling --discard-locals.
12432
12433 2009-12-30  Ian Lance Taylor  <iant@google.com>
12434
12435         PR 10450
12436         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12437         flags to PF_R.
12438         (Output_segment::add_output_section): Don't change the flags if
12439         the type is PT_TLS.
12440
12441         PR 10450
12442         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12443         GNU hash table if they need a dynamic value.  Otherwise, don't add
12444         them if they are defined in a dynamic object or are forced local.
12445
12446 2009-12-29  Ian Lance Taylor  <iant@google.com>
12447
12448         PR 10450
12449         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12450         .gnu.hash table for a 32-bit target.
12451
12452         PR 10450
12453         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12454         regular and a dynamic object only needs a dynamic symbol table
12455         entry if it is externally visible.
12456
12457         PR 10450
12458         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12459         constructor.  Add global_offset_table_ field.
12460         (Target_i386::got_section): Set global_offset_table_.
12461         (Target_i386::do_finalize_sections): Set global_offset_table_
12462         size.
12463         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12464         in constructor.  Add global_offset_table_ field.
12465         (Target_x86_64::got_section): Set global_offset_table_.
12466         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12467         size.
12468
12469         * layout.cc (Layout::Layout): Initialize increase_relro_.
12470         (Layout::get_output_section): Add is_relro, is_last_relro, and
12471         is_first_non_relro parameters.  Change all callers.
12472         (Layout::choose_output_section): Likewise.
12473         (Layout::add_output_section_data): Likewise.
12474         (Layout::make_output_section): Likewise.
12475         (Layout::set_segment_offsets): Clear increase_relro when using a
12476         linker script.
12477         * layout.h (class Layout): Add increase_relro method.  Add
12478         increase_relro_ field.  Update declarations.
12479         * output.cc (Output_section::Output_section): Initialize
12480         is_last_relro_ and is_first_non_relro_.
12481         (Output_segment::add_output_section): Group relro sections is
12482         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12483         (Output_segment::maximum_alignment): Remove relro handling.
12484         (Output_segment::set_section_addresses): Add increase_relro
12485         parameter.  Change all callers.  Add initial alignment to align
12486         relro sections on separate page.  Remove old relro handling.
12487         (Output_segment::set_section_list_addresses): Remove in_relro
12488         parameter.  Change all callers.
12489         (Output_segment::set_offset): Add increase parameter.  Change all
12490         callers.  Remove old relro handling.
12491         * output.h (class Output_section): Add new methods: is_last_relro,
12492         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12493         Add is_last_relro_ and is_first_non_relro_ fields.
12494         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12495         Create separate .got.plt section.  Call increase_relro.
12496         * x86_64.cc (Target_x86_64::got_section): Likewise.
12497         * testsuite/relro_script_test.t: Add .got.plt.
12498
12499         PR 10450
12500         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12501         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12502         (Layout::finalize): Call set_dynamic_symbol_size.
12503         (Layout::set_dynamic_symbol_size): New function.
12504         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12505         set_dynamic_symbol_size.
12506
12507         PR 10450
12508         * output.h (class Output_section): Add is_entsize_zero_ field.
12509         * output.cc (Output_section::Output_section): Initialize
12510         is_entsize_zero_.
12511         (Output_section::set_entsize): If two different entsizes are
12512         requested, force it to zero.
12513         (Output_section::add_input_section): Set flags for .debug_str
12514         before updating section flags.  Set entsize.
12515         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12516         and SHF_STRING if all input sections have those flags.
12517
12518 2009-12-29   Rafael Espindola  <espindola@google.com>
12519
12520         * main.cc (main): Fix the sys time reporting.
12521         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12522         reporting.
12523
12524 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12525
12526         * options.cc (General_options::parse_version): Allow -v to exit
12527         without an error if there is nothing to link.
12528
12529 2009-12-29  Ian Lance Taylor  <iant@google.com>
12530
12531         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12532         using a version of gcc before 4.1.
12533         * configure: Rebuild.
12534
12535 2009-12-28  Chris Demetriou  <cgd@google.com>
12536
12537         * attributes.cc (Output_attributes_section_data::do_write): Use
12538         std::vector::front rather than std::vector::data.
12539
12540 2009-12-28  Ian Lance Taylor  <iant@google.com>
12541
12542         * symtab.h (class Symbol_table): Add enum Defined.
12543         * resolve.cc (Symbol_table::should_override): Add defined
12544         parameter.  Change all callers.  Test whether object is NULL
12545         before calling a method on it.
12546         (Symbol_table::report_resolve_problem): Add defined parameter.
12547         Change all callers.
12548         (Symbol_table::should_override_with_special): Likewise.
12549         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12550         parameter.  Change all callers.
12551         (Symbol_table::do_define_in_output_data): Likewise.
12552         (Symbol_table::define_in_output_segment): Likewise.
12553         (Symbol_table::do_define_in_output_segment): Likewise.
12554         (Symbol_table::define_as_constant): Likewise.
12555         (Symbol_table::do_define_as_constant): Likewise.
12556         * script.h (class Symbol_assignment): Add is_defsym parameter to
12557         constructor; change all callers.
12558         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12559         parameter.  Change all callers.  Add is_defsym_ field.
12560         (class Parser_closure): Add parsing_defsym parameter to
12561         constructor; change all callers.  Add parsing_defsym accessor
12562         function.  Add parsing_defsym_ field.
12563
12564 2009-12-28  Ian Lance Taylor  <iant@google.com>
12565
12566         * gold.cc (queue_middle_tasks): Fix formatting.
12567         * object.cc (Relobj::is_section_name_included): Likewise.
12568
12569 2009-12-23  Ian Lance Taylor  <iant@google.com>
12570
12571         * i386.cc (Target_i386::do_calls_non_split): Recognize
12572         -fsplit-stack prologue for a function with a static chain.
12573         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12574         -fsplit-stack prologue when using %r11.
12575
12576 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12577
12578         * options.cc (General_options::parse_version): Make -v continue and do
12579         the link like GNU ld does.
12580
12581 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12582
12583         * Makefile.am (CCFILES): Add timer.cc.
12584         (HFILES): Add timer.h.
12585         * configure.ac: Check for sysconf and times.
12586         * main.cc: include timer.h.
12587         (main): Use Timer instead of get_run_time.
12588         * timer.cc: New.
12589         * timer.h: New.
12590         * workqueue.cc: include timer.h.
12591         (Workqueue::find_and_run_task):
12592         Report user, sys and wall time.
12593         * Makefile.in: Regenerate.
12594         * config.in: Regenerate.
12595         * configure: Regenerate.
12596
12597 2009-12-16  Doug Kwan  <dougkwan@google.com>
12598
12599         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12600         sections.
12601         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12602         relaxed input sections.
12603         * output.cc (Output_section::find_relaxed_input_section): Change
12604         return type to Output_relaxed_input_section pointer.  Adjust code
12605         for new type of relaxed_input_section_map_.
12606         * output.h (Output_section::find_relaxed_input_section): Change
12607         return type to Output_relaxed_input_section pointer.
12608         (Output_section::Output_relaxed_input_section_by_input_section_map):
12609         New type.
12610         (Output_section::relaxed_input_section_map_): Change type to
12611         Output_section::Output_relaxed_input_section_by_input_section_map.
12612         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12613         input section.
12614
12615 2009-12-15  Ian Lance Taylor  <iant@google.com>
12616
12617         * layout.cc (Layout::create_shstrtab): Only write out after input
12618         sections if we are compressing debug sections.
12619
12620 2009-12-15  Ian Lance Taylor  <iant@google.com>
12621
12622         * archive.cc (Archive::add_symbols): Only look up a symbol without
12623         a version if there is, in fact, a version.
12624
12625 2009-12-14  Ian Lance Taylor  <iant@google.com>
12626
12627         Revert -Wshadow changes, all changes from:
12628         2009-12-11  Doug Kwan  <dougkwan@google.com>
12629         2009-12-11  Nick Clifton  <nickc@redhat.com>
12630         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12631
12632 2009-12-11  Doug Kwan  <dougkwan@google.com>
12633
12634         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12635         due to -Wshadow.
12636         * attributes.cc (Object_attribute::size): Ditto.
12637         (Attributes_section_data::size): Ditto.
12638         (Attributes_section_data::Attributes_section_data): Ditto.
12639         (Output_attributes_section_data::do_write): Ditto.
12640         * attributes.h (Object_attribute::set_type): Ditto.
12641         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12642
12643 2009-12-11  Nick Clifton  <nickc@redhat.com>
12644
12645         * archive.cc: Fix shadowed variable warnings.
12646         * arm.cc: Likewise.
12647         * compressed_output.cc: Likewise.
12648         * compressed_output.h: Likewise.
12649         * configure: Likewise.
12650         * dwarf_reader.cc: Likewise.
12651         * dynobj.cc: Likewise.
12652         * dynobj.h: Likewise.
12653         * ehframe.cc: Likewise.
12654         * ehframe.h: Likewise.
12655         * errors.cc: Likewise.
12656         * expression.cc: Likewise.
12657         * fileread.cc: Likewise.
12658         * fileread.h: Likewise.
12659         * freebsd.h: Likewise.
12660         * i386.cc: Likewise.
12661         * icf.cc: Likewise.
12662         * incremental.h: Likewise.
12663         * layout.cc: Likewise.
12664         * layout.h: Likewise.
12665         * mapfile.cc: Likewise.
12666         * merge.cc: Likewise.
12667         * merge.h: Likewise.
12668         * object.cc: Likewise.
12669         * object.h: Likewise.
12670         * options.h: Likewise.
12671         * output.cc: Likewise.
12672         * output.h: Likewise.
12673         * parameters.cc: Likewise.
12674         * plugin.cc: Likewise.
12675         * powerpc.cc: Likewise.
12676         * reduced_debug_output.cc: Likewise.
12677         * reduced_debug_output.h: Likewise.
12678         * reloc.cc: Likewise.
12679         * reloc.h: Likewise.
12680         * resolve.cc: Likewise.
12681         * script-sections.cc: Likewise.
12682         * script.cc: Likewise.
12683         * script.h: Likewise.
12684         * sparc.cc: Likewise.
12685         * symtab.cc: Likewise.
12686         * symtab.h: Likewise.
12687         * target-select.cc: Likewise.
12688         * target-select.h: Likewise.
12689         * token.h: Likewise.
12690         * workqueue.cc: Likewise.
12691         * workqueue.h: Likewise.
12692         * x86_64.cc: Likewise.
12693
12694 2009-12-10  Doug Kwan  <dougkwan@google.com>
12695
12696         * arm.cc (attributes.h): New include.
12697         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12698         (Arm_relobj::~Arm_relobj): Delete object pointed by
12699         attributes_section_data_.
12700         (Arm_relobj::attributes_section_data): New method definition.
12701         (Arm_relobj::attributes_section_data_): New data member declaration.
12702         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12703         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12704         attributes_section_data_.
12705         (Arm_dynobj::attributes_section_data): New method definition.
12706         (Arm_dynobj::attributes_section_data_): New data member declaration.
12707         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12708         initialization value of may_use_blx_ to false.
12709         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12710         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12711         object attributes to compute results instead of hard-coding.
12712         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12713         Target_arm::get_secondary_compatible_arch,
12714         Target_arm::set_secondary_compatible_arch
12715         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12716         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12717         New method declarations.
12718         (Target_arm::get_aeabi_object_attribute): New method definition.
12719         (Target_arm::attributes_section_data_): New data member declaration.
12720         (read_arm_attributes_section): New template definition.
12721         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12722         (Arm_dynobj::do_read_symbols): Ditto.
12723         (Target_arm::do_finalize_sections): Merge attributes sections from
12724         input.  Check for BLX use after attributes section merging.
12725         Fix __exidx_start and __exidx_end visibility.  Create an
12726         .ARM.attributes section if necessary.
12727         (Target_arm::get_secondary_compatible_arch,
12728         Target_arm::set_secondary_compatible_arch,
12729         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12730         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12731         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12732         New method definitions.
12733
12734 2009-12-09  Ian Lance Taylor  <iant@google.com>
12735
12736         * plugin.cc (Plugin::load): Don't cast from void* to a function
12737         pointer.
12738
12739 2009-12-09  Ian Lance Taylor  <iant@google.com>
12740
12741         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12742         information fields.
12743
12744 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12745
12746         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12747         Replace two_file_shared_1.so with two_file_shared_2.so.
12748         * testsuite/Makefile.in: Regenerated.
12749
12750 2009-12-08  Doug Kwan  <dougkwan@google.com>
12751
12752         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12753         (HFILES): Add attributes.h and int_encoding.h.
12754         * Makefile.in: Regenerate.
12755         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12756         function definitions to int_encoding.cc
12757         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12758         prototypes to int_encoding.h
12759         * reduced_debug_output.cc (int_encoding.h): New include.
12760         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12761         function definitions to int_encoding.cc
12762         (insert_into_vector, read_from_pointer): Move template definitions to
12763         int_encoding.h
12764         * attributes.cc: New file.
12765         * attributes.h: New file.
12766         * int_encoding.cc: New file.
12767         * int_encoding.h: New file.
12768
12769 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12770
12771         PR gold/11055
12772         * incremental-dump.cc (dump_incremental_inputs): New.
12773         (main): Use dump_incremental_inputs.
12774
12775 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12776
12777         PR gold/10893
12778         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12779         checking elfcpp::STT_FUNC.
12780         (Target_i386::Relocate::relocate): Likewise.
12781         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12782
12783         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12784         symbols from shared libraries into normal FUNC symbols.
12785
12786         * symtab.h (Symbol): Add is_func and use it.
12787
12788 2009-12-05  Doug Kwan  <dougkwan@google.com>
12789
12790         * arm.cc (Target_arm::arm_info): Initialize new fields
12791         attributes_section and attributes_vendor.
12792         * i386.cc (Target_i386::i386_info): Same.
12793         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12794         * powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12795         fields attributes_section and attributes_vendor.
12796         * sparc.cc (Target_sparc::sparc_info): Same.
12797         * target.h (Target::attributes_section, Target::attributes_vendor,
12798         Target::is_attributes_section, Target::attribute_arg_type,
12799         Target::attributes_order): New method definitions.
12800         (Target::Target_info::attributes_section,
12801         Target::Target_info::attributes_vendor): New fields.
12802         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12803         virtual method definitions.
12804         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12805         attributes_section and attributes_vendor.
12806         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12807
12808 2009-12-05  Doug Kwan  <dougkwan@google.com>
12809
12810         * arm.cc: Update comments about interworking and stub generation.
12811         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12812         considered as non-PIC.
12813         (Arm_relocate_functions::base_abs): Fix formatting.
12814         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12815         of function to use GOT entry address instead of offset.
12816         (Target_arm::Scan::global): Issue an error if a symbol would need a
12817         PLT does not get one because it is untyped.  Remove code to create
12818         dynamic symbols for relative branches.
12819         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12820         takes unsigned integer instead of boolean.
12821
12822 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12823
12824         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12825         (two_file_test_LDADD): Likewise.
12826         (common_test_1_LDADD): Likewise.
12827         (exception_test_LDADD) Likewise.
12828         (weak_test_LDADD): Likewise.
12829         (many_sections_test_LDADD): Likewise.
12830         (initpri1_LDADD): Likewise.
12831         (script_test_1_LDADD): Likewise.
12832         (script_test_2_LDADD): Likewise.
12833         (justsyms_LDADD): Likewise.
12834         (binary_test_LDADD): Likewise.
12835         (large_LDADD): Likewise.
12836         * testsuite/Makefile.in: Regenerated.
12837
12838 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12839
12840         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12841         (Symbol_table::override_with_special): Likewise.
12842         (Symbol_table::add_from_object): Likewise.
12843
12844 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12845
12846         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12847         Don't set the data_offset twice.
12848
12849 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12850
12851         * testsuite/Makefile.in: Regenerate.
12852
12853 2009-12-03  Doug Kwan  <dougkwan@google.com>
12854
12855         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12856         (Target_arm::do_finalize_sections): Add parameter for symbol table
12857         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12858         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12859         parameter for symbol table pointer.
12860         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12861         an additional parameter for a pointer to symbol table.
12862         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12863         parameter for a symbol table pointer.
12864         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12865         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12866         Ditto.
12867         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12868         parameter for a symbol table pointer.
12869
12870 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12871
12872         * incremental.cc (Incremental_inputs_header)
12873         (Incremental_inputs_header_write, Incremental_inputs_entry)
12874         (Incremental_inputs_entry_write): Move ...
12875         * incremental.h (Incremental_inputs_header)
12876         (Incremental_inputs_header_write, Incremental_inputs_entry)
12877         (Incremental_inputs_entry_write): here.
12878
12879 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12880
12881         * incremental.cc (make_sized_incremental_binary): Set the target.
12882         Error if it is incompatible.
12883         * output.h (Output_file): Add filename method.
12884
12885 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12886
12887         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12888         from the get_* methods.
12889
12890 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12891
12892         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12893         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12894         Write 0 for the data_offset of scripts.
12895
12896 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12897
12898         * testsuite/Makefile.am: Add the incremental_test.sh test.
12899         * testsuite/incremental_test.sh: New.
12900         * testsuite/incremental_test_1.c: New.
12901         * testsuite/incremental_test_2.c: New.
12902
12903 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12904
12905         * incremental-dump.cc (main): Fix typos.
12906
12907 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12908
12909         PR gold/11025
12910         * incremental-dump.cc (main): Use llu to print 64 bit values.
12911
12912 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12913             H.J. Lu  <hongjiu.lu@intel.com>
12914
12915         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12916         $(LIBDL).
12917         (incremental_dump_LDADD): Likewise.
12918         * Makefile.in: Regenerated.
12919
12920 2009-11-25  Doug Kwan  <dougkwan@google.com>
12921
12922         Revert:
12923
12924         2009-11-25  Doug Kwan  <dougkwan@google.com>
12925
12926                 * arm.cc (Target_arm::Target_arm): Move method definition
12927                 outside of class definition.  Add code to handle
12928                 --target1-rel, --target1-abs and --target2= options.
12929                 (Target_arm::get_reloc_reloc_type): Change method to be
12930                 non-static and const.
12931                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12932                 New data member declaration.
12933                 (Target_arm::Scan::local, Target_arm::Scan::global,
12934                 Target_arm::Relocate::relocate,
12935                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12936                 Adjust call to Target_arm::get_real_reloc_type.
12937                 (Target_arm::get_real_reloc_type): Use command line options
12938                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12939                 * options.h (--target1-rel, --target1-abs, --target2): New
12940                 ARM-only options.
12941
12942 2009-11-25  Doug Kwan  <dougkwan@google.com>
12943
12944         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12945         class definition.  Add code to handle --target1-rel, --target1-abs
12946         and --target2= options.
12947         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12948         and const.
12949         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12950         member declaration.
12951         (Target_arm::Scan::local, Target_arm::Scan::global,
12952         Target_arm::Relocate::relocate,
12953         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12954         call to Target_arm::get_real_reloc_type.
12955         (Target_arm::get_real_reloc_type): Use command line options to
12956         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12957         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12958         options.
12959
12960 2009-11-25  Doug Kwan  <dougkwan@google.com>
12961
12962         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12963         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12964         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12965         formatting.
12966         (Arm_relocate_functions::thm_call): Replace body with a call to
12967         Arm_relocate_functions::thumb_branch_common.
12968         (Arm_relocate_functions::thm_jump24,
12969         Arm_relocate_functions::thm_xpc22): New method definitions.
12970         (Arm_relocate_functions::thumb_branch_common): New method definition.
12971         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12972         operator.
12973         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12974         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12975
12976 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12977
12978         * Makefile.am: Build incremental-dump
12979         * Makefile.in: Regenerate.
12980         * incremental-dump.cc: New.
12981         * incremental.cc (Incremental_inputs_header_data,
12982         Incremental_inputs_entry_data): Move to incremental.h
12983         * incremental.h: (Incremental_inputs_header_data,
12984         Incremental_inputs_entry_data): Move from incremental.cc
12985
12986 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12987
12988         * incremental.cc (Incremental_inputs_header,
12989         Incremental_inputs_header_write, Incremental_inputs_entry,
12990         Incremental_inputs_entry_write): Add a typedef with the data type.
12991
12992 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12993
12994         * incremental.cc (Incremental_inputs_header,
12995         Incremental_inputs_header_write, Incremental_inputs_entry,
12996         Incremental_inputs_entry_write): Update comment about which
12997         type has the filed descriptions.
12998
12999 2009-11-15  Doug Kwan  <dougkwan@google.com>
13000
13001         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
13002         (Arm_relocate_functions::arm_branch_common): Change method defintion
13003         in class definition to a method declaration and update list of formal
13004         parameters.
13005         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
13006         Arm_relocation_functions::jump24): Adjust call to
13007         Arm_relocate_functions::arm_branch_common.  Update list of formal
13008         parameters.
13009         (Arm_relocate_functions::xpc25): New method definition.
13010         (Arm_relocate_functions::arm_branch_common): Move method defintion
13011         out from class definition.  Use stubs for mode-switching and extending
13012         branch ranges.
13013         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
13014         specially.  Change code to enable use of stubs in ARM branches.
13015
13016 2009-11-10  Doug Kwan  <dougkwan@google.com>
13017
13018         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
13019         in method declaration.
13020         (Target_arm::relocate_stub): New method declaration.
13021         (Target_arm::default_target): Change to return a pointer instead of
13022         a const reference.
13023         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
13024         Target_arm::default_target.
13025         (Arm_Relobj::do_relocate_sections): Remove options paramater in
13026         method definition.
13027         (Target_arm::relocate_section): Adjust view.
13028         (Target_arm::relocate_stub): New method definition.
13029
13030 2009-11-10  Doug Kwan  <dougkwan@google.com>
13031
13032         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
13033         a format warning.
13034         * incremental.cc (open_incremental_binary): Initialized local
13035         variables to avoid warnings.
13036         * object.cc (make_elf_object): Ditto.
13037         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
13038         a format warning.
13039
13040 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
13041
13042         PR gold/10930
13043         * testsuite/plugin_test.c: Include "config.h".
13044
13045 2009-11-09  Doug Kwan  <dougkwan@google.com>
13046
13047         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
13048         (arm_symbol_value): Remove.
13049         (Arm_relocate_functions::arm_branch_common,
13050         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
13051         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
13052         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
13053         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
13054         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
13055         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
13056         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
13057         Arm_relocate_functions::thm_mobw_abs_nc,
13058         Arm_relocate_functions::thm_mov_abs,
13059         Arm_relocate_functions::movw_prel_nc,
13060         Arm_relocate_functions::thm_movt_abs,
13061         Arm_relocate_functions::movt_prel,
13062         Arm_relocate_functions::thm_movw_prel_nc,
13063         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
13064         (Target_arm::Relocate::relocate): Only decompose address into two
13065         parts if relocation type uses the thumb-bit and pass the actual
13066         bit instead of a flag indicating that the thumb-bit is used.  Adjust
13067         calls to methods in Arm_relocate_functions for this change.
13068
13069 2009-11-08  Ian Lance Taylor  <iant@google.com>
13070
13071         PR 10925
13072         * reloc.cc: Instantiate
13073         Sized_relobj::initialize_input_to_output_maps and
13074         Sized_relobj:free_input_to_output_maps.
13075
13076 2009-11-06  Ian Lance Taylor  <iant@google.com>
13077
13078         PR 10876
13079         * defstd.cc (in_segment): Set only_if_ref true for "end".
13080
13081 2009-11-06  Doug Kwan  <dougkwan@google.com>
13082
13083         * arm.cc (class Reloc_stub): Correct a comment.
13084         (Target_arm::Target_arm): Initialize arm_input_section_map_.
13085         (Target_arm::scan_section_for_stubs): New method declaration.
13086         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
13087         Change methods from private to protected.
13088         (Target_arm::do_may_relax): New method definition.
13089         (Target_arm::do_relax, Target_arm::group_sections,
13090         Target_arm::scan_reloc_for_stub,
13091         Target_arm::scan_reloc_section_for_stubs): New method declarations.
13092         (Target_arm::arm_input_section_map_): New data member declaration.
13093         (Target_arm::scan_reloc_for_stub,
13094         Target_arm::scan_reloc_section_for_stubs,
13095         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
13096         Target_arm::do_relax): New method definitions.
13097
13098 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
13099
13100         * configure.ac: Check for (struct stat)::st_mtim
13101         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
13102         * config.in: Regenerate.
13103         * configure: Regenerate.
13104
13105 2009-11-05  Ian Lance Taylor  <iant@google.com>
13106
13107         PR 10910
13108         * output.cc (Output_segment::add_output_section): Add missing
13109         return statement.
13110
13111 2009-11-04  Ian Lance Taylor  <iant@google.com>
13112
13113         PR 10880
13114         * object.h (class Object): Add is_needed and set_is_needed
13115         methods.  Add is_needed_ field.  Make bool fields into bitfields.
13116         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
13117         defined in a dynamic object and referenced by a regular object,
13118         set is_needed for the dynamic object.
13119         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
13120         if the file is marked with as_needed and it is not needed.
13121
13122 2009-11-04  Ian Lance Taylor  <iant@google.com>
13123
13124         PR 10887
13125         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
13126         tags if data is discarded by linker script.
13127         * i386.cc (Target_i386::do_finalize_sections): Likewise.
13128         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
13129         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
13130         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
13131
13132 2009-11-04  Ian Lance Taylor  <iant@google.com>
13133
13134         * layout.cc (Layout::get_output_section): Add is_interp and
13135         is_dynamic_linker_section parameters.  Change all callers.
13136         (Layout::choose_output_section): Likewise.
13137         (Layout::make_output_section): Likewise.
13138         (Layout::add_output_section_data): Add is_dynamic_linker_section
13139         parameter.  Change all callers.
13140         * layout.h (class Layout): Update declarations.
13141         * output.h (class Output_section): Add is_interp, set_is_interp,
13142         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
13143         Add is_interp_, is_dynamic_linker_section_ fields.  Change
13144         generate_code_fills_at_write_ to a bitfield.
13145         * output.cc (Output_section::Output_sections): Initialize new
13146         fields.
13147         (Output_segment::add_output_section): Add do_sort parameter.
13148         Change all callers.
13149
13150 2009-11-03  Ian Lance Taylor  <iant@google.com>
13151
13152         PR 10860
13153         * options.h (class General_options): Add --warn-common.
13154         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
13155         merging two common symbols.
13156         (Symbol_table::should_override): Handle --warn-common when merging
13157         a common symbol with a defined symbol.  Use report_resolve_problem
13158         for multiple definitions.
13159         (Symbol_table::report_resolve_problem): New function.
13160         * symtab.h (class Symbol_table): Declare report_resolve_problem.
13161
13162 2009-11-03  Doug Kwan  <dougkwan@google.com>
13163
13164         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
13165         stub_factory_.
13166         (Target_arm::stub_factory): New method definition.
13167         (Target_arm::new_arm_input_section,
13168         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
13169         Target_arm::reloc_uses_thumb_bit): New method declarations.
13170         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
13171         New type definitions.
13172         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
13173         member declarations.
13174         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
13175         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
13176         New method definitions.
13177
13178 2009-11-03  Ian Lance Taylor  <iant@google.com>
13179
13180         * options.h (class General_options): Add --warn_constructors.
13181
13182 2009-11-03  Ian Lance Taylor  <iant@google.com>
13183
13184         PR 10893
13185         * defstd.cc (in_section): Add entries for __rel_iplt_start,
13186         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
13187
13188 2009-11-03  Ian Lance Taylor  <iant@google.com>
13189
13190         PR 10895
13191         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
13192         --msgid-bugs-address.
13193         (install-pdf): New target.
13194         (install-data_yes): Look up one directory to find mkinstalldirs.
13195
13196 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
13197
13198         * po/Make-in (.po.gmo): Don't generate .gmo files in source
13199         tree.
13200
13201 2009-10-30  Doug Kwan  <dougkwan@google.com>
13202
13203         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
13204
13205 2009-10-30  Doug Kwan  <dougkwan@google.com>
13206
13207         * arm.cc (Stub_addend_reader): New struct template definition
13208         and partial specializations.
13209         (Stub_addend_reader::operator()): New method definition for a
13210         partially specialized template.
13211
13212 2009-10-30  Doug Kwan  <dougkwan@google.com>
13213
13214         * arm.cc (Arm_relobj::processor_specific_flags): New method
13215         definition.
13216         (Arm_relobj::do_read_symbols): New method declaration.
13217         (Arm_relobj::processor_specific_flags_): New data member declaration.
13218         (Arm_dynobj): New class definition.
13219         (Target_arm::do_finalize_sections): Add input_objects parameter.
13220         (Target_arm::do_adjust_elf_header): New method declaration.
13221         (Target_arm::are_eabi_versions_compatible,
13222         (Target_arm::merge_processor_specific_flags): New method declaration.
13223         (Target_arm::do_make_elf_object): New overloaded method definitions
13224         and declaration.
13225         (Arm_relobj::do_read_symbols): New method definition.
13226         (Arm_dynobj::do_read_symbols): Ditto.
13227         (Target_arm::do_finalize_sections): Add input_objects parameters.
13228         Merge processor-specific flags from all input objects.
13229         (Target_arm::are_eabi_versions_compatible,
13230         Target_arm::merge_processor_specific_flags,
13231         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
13232         New method definitions.
13233         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13234         Input_objects pointer type parameter.
13235         * layout.cc (Layout::finalize): Pass input objects to target's.
13236         finalize_sections function.
13237         * output.cc (Output_file_header::do_sized_write): Set ELF file
13238         header's processor-specific flags.
13239         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13240         Input_objects pointer type parameter.
13241         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13242         * target.h (Input_objects): New forward class declaration.
13243         (Target::processor_specific_flags,
13244         Target::are_processor_specific_flags_sect): New method definitions.
13245         (Target::finalize_sections): Add input_objects parameter.
13246         (Target::Target): Initialize processor_specific_flags_ and
13247         are_processor_specific_flags_set_.
13248         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13249         parameter.
13250         (Target::set_processor_specific_flags): New method definition.
13251         (Target::processor_specific_flags_,
13252         Target::are_processor_specific_flags_set_): New data member
13253         declarations.
13254         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13255         Input_objects pointer type parameter.
13256
13257 2009-10-30  Doug Kwan  <dougkwan@google.com>
13258
13259         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13260
13261 2009-10-28  Ian Lance Taylor  <iant@google.com>
13262
13263         * object.h (class Relobj): Drop options parameter from
13264         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13265         do_scan_relocs, do_relocate.  Change all callers.
13266         (class Sized_relobj): Drop options parameters from
13267         do_gc_process_relocs, do_scan_relocs, do_relocate,
13268         do_relocate_sections, relocate_sections, emit_relocs_scan,
13269         emit_relocs_scan_reltype.  Change all callers.
13270         (struct Relocate_info): Remove options field and all references to
13271         it.
13272         * reloc.h (class Read_relocs): Remove options constructor
13273         parameter and options_ field.  Change all callers.
13274         (class Gc_process_relocs, class Scan_relocs): Likewise.
13275         (class Relocate_task): Likewise.
13276         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13277         all callers.
13278         (scan_relocatable_relocs): Likewise.
13279         * target.h (class Sized_target): Remove options parameter from
13280         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13281         all callers.
13282         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13283         callers.
13284         * arm.cc: Update functions to remove options parameters.
13285         * i386.cc: Likewise.
13286         * powerpc.cc: Likewise.
13287         * sparc.cc: Likewise.
13288         * x86_64.cc: Likewise.
13289         * testsuite/testfile.cc: Likewise.
13290
13291 2009-10-28  Doug Kwan  <dougkwan@google.com>
13292
13293         * arm.cc (Arm_relobj): New class definition.
13294         (Arm_relobj::scan_sections_for_stubs,
13295         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13296         New method definitions.
13297
13298 2009-10-28  Cary Coutant  <ccoutant@google.com>
13299
13300         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13301         (Plugin::cleanup_done_): New member.
13302         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13303         (Plugin_manager::cleanup_done_): Remove.
13304         (Plugin_manager::add_input_file): Edit error message.
13305         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13306         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13307
13308 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13309
13310         * fileread.cc: (File_read::View::~View): Use the new
13311         data_ownership_ filed.
13312         (File_read::~File_read): Dispose the new whole_file_view_.
13313         (File_read::open): Mmap the whole file if needed.
13314         (File_read::open): Use whole_file_view_ instead of contents_.
13315         (File_read::find_view): Use whole_file_view_ if applicable.
13316         (File_read::do_read): Use whole_file_view_ instead of contents_.
13317         (File_read::make_view): Use whole_file_view_ instead of contents_,
13318         update File_read::View::View call.
13319         (File_read::find_or_make_view): Update File_read::View::View
13320         call.
13321         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13322         remove contents_
13323         (File_read::View::Data_ownership): New enum.
13324         (File_read::View::View): Replace bool mapped_ with Data_ownership
13325         argument.
13326         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13327         (File_read::View::data_ownership_): New field.
13328         (File_read::contents_): Remove (replaced by whole_file_view_).
13329         (File_read::whole_file_view_): New field.
13330         * options.h (class General_options): Add --keep-files-mapped.
13331
13332 2009-10-27  Cary Coutant  <ccoutant@google.com>
13333
13334         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13335         * testsuite/Makefile.am (plugin_test_5): New test case.
13336         * testsuite/Makefile.in: Regenerate.
13337
13338 2009-10-25  Doug Kwan  <dougkwan@google.com>
13339
13340         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13341         from private to protected to allow access by child class.
13342         (Sized_relobj::do_relocate_sections): New method declaration.
13343         (Sized_relobj::relocate_sections): Virtualize.
13344         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13345         Sized_relobj::relocate_sections.  Instantiate template explicitly
13346         for different target sizes and endianity.
13347
13348 2009-10-24  Doug Kwan  <dougkwan@google.com>
13349
13350         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13351         (Arm_input_section::as_arm_input_section): New method.
13352         (Arm_output_section): New class definition.
13353         (Arm_output_section::create_stub_group,
13354         Arm_output_section::group_sections): New method definitions.
13355
13356 2009-10-22  Doug Kwan  <dougkwan@google.com>
13357
13358         * arm.cc (Arm_input_section): New class definition.
13359         (Arm_input_section::init, Arm_input_section:do_write,
13360         Arm_input_section::set_final_data_size,
13361         Arm_input_section::do_reset_address_and_file_offset): New method
13362         definitions.
13363
13364 2009-10-21  Doug Kwan  <dougkwan@google.com>
13365
13366         * arm.cc (Stub_table, Arm_input_section): New forward class
13367         declarations.
13368         (Stub_table): New class defintion.
13369         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13370         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13371         New method definition.
13372
13373 2009-10-21  Doug Kwan  <dougkwan@google.com>
13374
13375         * arm.cc: Update copyright comments.
13376         (Target_arm): New forward class template declaration.
13377         (Arm_address): New type.
13378         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13379         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13380         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13381         constants.
13382         (Insn_template): Same.
13383         (DEF_STUBS): New macro.
13384         (Stub_type): New enum type.
13385         (Stub_template): New class definition.
13386         (Stub): Same.
13387         (Reloc_stub): Same.
13388         (Stub_factory): Same.
13389         (Target_arm::Target_arm): Initialize may_use_blx_ and
13390         should_force_pic_veneer_.
13391         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13392         Target_arm::should_force_pic_veneer,
13393         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13394         Target_arm::using_thumb_only, Target_arm:;default_target): New
13395         method defintions.
13396         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13397         New data member declarations.
13398         (Insn_template::size, Insn_template::alignment): New method defintions.
13399         (Stub_template::Stub_template): New method definition.
13400         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13401         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13402         (Stub_factory::Stub_factory): New method definition.
13403         * gold.h (string_hash): New template.
13404         * output.h (Input_section_specifier::hash_value): Use
13405         gold::string_hash.
13406         (Input_section_specifier::string_hash): Remove.
13407         * stringpool.cc (Stringpool_template::string_hash): Use
13408         gold::string_hash.
13409
13410 2009-10-20  Doug Kwan  <dougkwan@google.com>
13411
13412         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13413         symbols of relaxed input sections.
13414         * output.h (Output_section::find_relaxed_input_section): Make
13415         method public.
13416
13417 2009-10-16  Doug Kwan  <dougkwan@google.com>
13418
13419         * dynobj.cc (Versions::Versions): Initialize version_script_.
13420         Only insert base version symbol definition for a shared object
13421         if version script defines any version versions.
13422         (Versions::define_base_version): New method definition.
13423         (Versions::add_def): Check that base version is not needed.
13424         (Versions::add_need): Define base version lazily.
13425         * dynobj.h (Versions::define_base_version): New method declaration.
13426         (Versions::needs_base_version_): New data member declaration.
13427         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13428         (check_DATA): Add no_version_test.stdout.
13429         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13430         New make rules.
13431         * testsuite/Makefile.in: Regenerate.
13432         * testsuite/no_version_test.c: New file.
13433         * testsuite/no_version_test.sh: Ditto.
13434
13435 2009-10-16  Doug Kwan  <dougkwan@google.com>
13436
13437         * expression.cc (class Segment_start_expression): New class definition.
13438         (Segment_start_expression::value): New method definition.
13439         (script_exp_function_segment_start): Return a new
13440         Segment_start_expression.
13441         * script-c.h (script_saw_segment_start_expression): New function
13442         prototype.
13443         * script-sections.cc (Script_sections::Script_sections): Initialize
13444         SAW_SEGMENT_START_EXPRESSION_ to false.
13445         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13446         and -Tbbs options to specify section addresses if given in
13447         command line and no SEGMENT_START expression is seen in a script.
13448         * script-sections.h (Script_sections::saw_segment_start_expression,
13449         Script_sections::set_saw_segment_start_expression): New method
13450         definition.
13451         (Script_sections::saw_segment_start_expression_): New data member
13452         declaration.
13453         * script.cc (script_saw_segment_start_expression): New function.
13454         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13455         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13456         script_test_7.sh and script_test_8.sh.
13457         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13458         script_test_8.stdout.
13459         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13460         (script_test_6, script_test_6.stdout, script_test_7,
13461         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13462         * Makefile.in: Regenerate.
13463         * testsuite/script_test_6.sh: New file.
13464         * testsuite/script_test_6.t: Same.
13465         * testsuite/script_test_7.sh: Same.
13466         * testsuite/script_test_7.t: Same.
13467         * testsuite/script_test_8.sh: Same.
13468
13469 2009-10-16  Doug Kwan  <dougkwan@google.com>
13470
13471         * output.cc (Output_segment::set_section_list_address): Cast
13472         expressions to unsigned long long type to avoid format warnings.
13473
13474 2009-10-15  Ian Lance Taylor  <iant@google.com>
13475
13476         * script.cc (Script_options::add_symbol_assignment): Always add a
13477         dot assignment to script_sections_.
13478         * script-sections.cc (Script_sections::add_dot_assignment):
13479         Initialize if necessary.
13480
13481         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13482         program headers with no load segment if there is a linker script.
13483
13484         * layout.cc (Layout::set_segment_offsets): Align the file offset
13485         to the segment aligment for -N or -n with no load segment.
13486         * output.cc (Output_segment::add_output_section): Don't crash if
13487         the first section is a TLS section.
13488         (Output_segment::set_section_list_addresses): Print an error
13489         message if the address moves backward in a linker script.
13490         * script-sections.cc
13491         (Output_section_element_input::set_section_addresses): Don't
13492         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13493         (Orphan_output_section::set_section_addresses): Likewise.
13494
13495 2009-10-15  Doug Kwan  <dougkwan@google.com>
13496
13497         * layout.cc (Layout::finish_dynamic_section): Generate tags
13498         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13499         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13500         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13501
13502 2009-10-14  Ian Lance Taylor  <iant@google.com>
13503
13504         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13505         fields.
13506         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13507         data_shdr fields of relinfo.
13508         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13509         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13510         R_386_TLS_LDO_32, adjust based on section flags.
13511         (Target_i386::Relocate::fix_up_ldo): Remove.
13512
13513 2009-10-13  Ian Lance Taylor  <iant@google.com>
13514
13515         Add support for -pie.
13516         * options.h (class General_options): Add -pie and
13517         --pic-executable.
13518         (General_options::output_is_position_independent): Test -pie.
13519         (General_options::output_is_executable): Return true if not shared
13520         and not relocatable.
13521         (General_options::output_is_pie): Remove.
13522         * options.cc (General_options::finalize): Reject incompatible uses
13523         of -pie.
13524         * gold.cc (queue_middle_tasks): A -pie link is not static.
13525         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13526         * symtab.cc (Symbol::final_value_is_known): Return false if
13527         output_is_position_independent.
13528         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13529         output_is_position_independent.
13530         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13531         output_is_position_independent.
13532         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13533         output_is_position_independent.
13534         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13535         two_file_pie_test.
13536         (basic_pie_test.o, basic_pie_test): New targets.
13537         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13538         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13539         (two_file_pie_test): New target.
13540         * testsuite/Makefile.in: Rebuild.
13541         * README: Remove note saying that -pie is not supported.
13542
13543 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13544
13545         * options.h (class General_options): Add -init and -fini.
13546         * layout.cc (Layout::finish_dynamic_section): Emit
13547         given init and fini functions.
13548
13549 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13550
13551         * gc.h (gc_process_relocs): Check if icf is enabled using new
13552         function.
13553         * gold.cc (queue_initial_tasks): Likewise.
13554         (queue_middle_tasks): Likewise.
13555         * object.cc (do_layout): Likewise.
13556         * symtab.cc (is_section_folded): Likewise.
13557         * main.cc (main): Likewise.
13558         * reloc.cc (Read_relocs::run): Likewise.
13559         (Sized_relobj::do_scan_relocs): Likewise.
13560         * icf.cc (is_function_ctor_or_dtor): New function.
13561         (Icf::find_identical_sections): Check if function is ctor or dtor when
13562         safe icf is chosen.
13563         * options.h (General_options::icf): Change option to be an enum.
13564         (Icf_status): New enum.
13565         (icf_enabled): New method.
13566         (icf_safe_folding): New method.
13567         (set_icf_status): New method.
13568         (icf_status_): New variable.
13569         * (options.cc) (General_options::finalize): Set icf_status_.
13570         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13571         icf_test and icf_keep_unique_test to use the --icf enum flag.
13572         * testsuite/icf_safe_test.sh: New file.
13573         * testsuite/icf_safe_test.cc: New file.
13574
13575 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13576
13577         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13578         includes to gc.h and icf.h.
13579         * arm.cc: Include gc.h.
13580         * gold.cc: Likewise.
13581         * i386.cc: Likewise.
13582         * powerpc.cc: Likewise.
13583         * sparc.cc: Likewise.
13584         * x86_64.cc: Likewise.
13585         * gc.h: Include icf.h.
13586
13587 2009-10-11  Ian Lance Taylor  <iant@google.com>
13588
13589         * plugin.cc: Include "gold.h" before other header files.
13590
13591 2009-10-10  Chris Demetriou  <cgd@google.com>
13592
13593         * options.h (Input_file_argument::Input_file_type): New enum.
13594         (Input_file_argument::is_lib_): Replace with...
13595         (Input_file_argument::type_): New member.
13596         (Input_file_argument::Input_file_argument): Take Input_file_type
13597         'type' rather than boolean 'is_lib' as second argument.
13598         (Input_file_argument::is_lib): Use type_.
13599         (Input_file_argument::is_searched_file): New function.
13600         (Input_file_argument::may_need_search): Handle is_searched_file.
13601         * options.cc (General_options::parse_library): Support -l:filename.
13602         (General_options::parse_just_symbols): Update for Input_file_argument
13603         changes.
13604         (Command_line::process): Likewise.
13605         * archive.cc (Archive::get_file_and_offset): Likewise.
13606         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13607         * script.cc (read_script_file, script_add_file): Likewise.
13608         * fileread.cc (Input_file::Input_file): Likewise.
13609         (Input_file::will_search_for): Handle is_searched_file.
13610         (Input_file::open): Likewise.
13611         * readsyms.cc (Read_symbols::get_name): Likewise.
13612         * testsuite/Makefile.am (searched_file_test): New test.
13613         * testsuite/Makefile.in: Regenerate.
13614         * testsuite/searched_file_test.cc: New file.
13615         * testsuite/searched_file_test_lib.cc: New file.
13616
13617 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13618             Ian Lance Taylor  <iant@google.com>
13619
13620         * descriptor.cc: Include <cstdio> and "binary-io.h".
13621         (Descriptors::open): Open the files in binary mode always.
13622         * script.cc (Lex::get_token): Treat \r as whitespace.
13623
13624 2009-10-09  Ian Lance Taylor  <iant@google.com>
13625
13626         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13627
13628 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13629             Ian Lance Taylor  <iant@google.com>
13630
13631         * configure.ac: Check for readv function also.
13632         * fileread.cc (readv): Define if not HAVE_READV.
13633         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13634         does not exist.
13635         * config.in: Regenerate.
13636         * configure: Regenerate.
13637
13638 2009-10-09  Doug Kwan  <dougkwan@google.com>
13639
13640         * layout.cc (Layout::make_output_section): Call target hook to make
13641         ordinary output section.
13642         (Layout::finalize): Adjust parameter list of call the
13643         Target::may_relax().
13644         * layout.h (class Layout::section_list): New method.
13645         * merge.h (Output_merge_base::entsize): Change visibility to public.
13646         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13647         New methods.
13648         (Output_merge_string::do_is_string): New method.
13649         * object.cc (Sized_relobj::do_setup): renamed from
13650         Sized_relobj::set_up.
13651         * object.h (Sized_relobj::adjust_shndx,
13652         Sized_relobj::initializ_input_to_output_maps,
13653         Sized_relobj::free_input_to_output_maps): Change visibilities to
13654         protected.
13655         (Sized_relobj::setup): Virtualize.
13656         (Sized_relobj::do_setup): New method declaration.
13657         (Sized_relobj::invalidate_section_offset,
13658         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13659         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13660         * options.cc (parse_int): New function.
13661         * options.h (parse_int): New declaration.
13662         (DEFINE_int): New macro.
13663         (stub_group_size): New option.
13664         * output.cc (Output_section::Output_section): Initialize memebers
13665         merge_section_map_, merge_section_by_properties_map_,
13666         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13667         (Output_section::add_input_section): Handled deferred code-fill
13668         generation and remove an old comment.
13669         (Output_section::add_relaxed_input_section): New method definition.
13670         (Output_section::add_merge_input_section): Use merge section by
13671         properties map to speed to search.  Update merge section maps
13672         as appropriate.
13673         (Output_section::build_relaxation_map): New method definition.
13674         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13675         Same.
13676         (Output_section::relax_input_section): Renamed to
13677         Output_section::convert_input_sections_to_relaxed_sections and change
13678         interface to take a vector of pointers to relaxed sections.
13679         (Output_section::find_merge_section,
13680         Output_section::find_relaxed_input_section): New method definitions.
13681         (Output_section::is_input_address_mapped,
13682         Output_section::output_offset, Output_section::output_address):
13683         Use output section data maps to speed up searching.
13684         (Output_section::find_starting_output_address): Add comments.
13685         (Output_section::do_write,
13686         Output_section::write_to_postprocessing_buffer): Do code-fill
13687         generation as appropriate.
13688         (Output_section::get_input_sections): Invalidate relaxed input section
13689         map.
13690         (Output_section::restore_states): Adjust type of checkpoint .
13691         Invalidate relaxed input section map.
13692         * output.h (Output_merge_base): New class declaration.
13693         (Input_section_specifier): New class defintion.
13694         (class Output_relaxed_input_section) Change base class to
13695         Output_section_data_build.
13696         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13697         base class initializer.
13698         (Output_section::add_relaxed_input_section): New method declaration.
13699         (Output_section::Input_section): Change visibility to protected.
13700         (Output_section::Input_section::relobj,
13701         Output_section::Input_section::shndx): Handle relaxed input sections.
13702         Output_section::input_sections) Change visibility to protected.  Also
13703         define overload to return a non-const pointer.
13704         (Output_section::Merge_section_properties): New class defintion.
13705         (Output_section::Merge_section_by_properties_map,
13706         Output_section::Output_section_data_by_input_section_map,
13707         Output_section::Relaxation_map): New types.
13708         (Output_section::relax_input_section): Rename method to
13709         Output_section::convert_input_sections_to_relaxed_sections and change
13710         interface to take a vector of relaxed section pointers.
13711         (Output_section::find_merge_section,
13712         Output_section::find_relaxed_input_section,
13713         Output_section::build_relaxation_map,
13714         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13715         New method declarations.
13716         (Output_section::merge_section_map_
13717         Output_section::merge_section_by_properties_map_,
13718         Output_section::relaxed_input_section_map_,
13719         Output_section::is_relaxed_input_section_map_valid_,
13720         Output_section::generate_code_fills_at_write_): New data members.
13721         * script-sections.cc
13722         (Output_section_element_input::set_section_addresses): Call
13723         current_data_size and addralign methods of relaxed input sections.
13724         (Orphan_output_section::set_section_addresses): Call current_data_size
13725         and addralign methods of relaxed input sections.
13726         * symtab.cc (Symbol_table::compute_final_value): Extract template
13727         from the body of Symbol_table::sized_finalize_symbol.
13728         (Symbol_table::sized_finalized_symbol): Call
13729         Symbol_table::compute_final_value.
13730         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13731         (Symbol_table::compute_final_value): New templated method declaration.
13732         * target.cc (Target::do_make_output_section): New method defintion.
13733         * target.h (Target::make_output_section): New method declaration.
13734         (Target::relax): Add more parameters for input objects, symbol table
13735         and layout.  Adjust call to do_relax.
13736         (Target::do_make_output_section): New method declaration.
13737         (Target::do_relax): Add parameters for input objects, symbol table
13738         and layout.
13739
13740 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13741
13742         * pread.c: Include stdio.h.
13743
13744 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13745
13746         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13747         defined.
13748
13749 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13750
13751         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13752         Change read_shndx type to unsigned int.
13753         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13754         int.
13755         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13756         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13757         Change read_shndx type to unsigned int.
13758         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13759         int.
13760         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13761         * layout.cc (Layout::create_symtab_sections): Cast the result of
13762         local_symcount * symsize to off_t in the gold_assert.
13763
13764 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13765
13766         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13767         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13768         R_ARM_BASE_ABS.
13769         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13770         (Arm_relocate_functions::thm_abs5): New function.
13771         (Arm_relocate_functions::abs12): New function.
13772         (Arm_relocate_functions::abs16): New function.
13773         (Arm_relocate_functions::base_abs): New function.
13774         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13775         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13776         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13777         R_ARM_BASE_ABS.
13778         (Scan::global): Likewise.
13779         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13780         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13781         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13782         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13783         R_ARM_BASE_ABS.
13784
13785 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13786
13787         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13788         (Arm_relocate_functions::movt_prel): New function.
13789         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13790         (Arm_relocate_functions::thm_movt_prel): New function.
13791         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13792         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13793         (Scan::global, Relocate::relocate): Likewise.
13794         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13795
13796 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13797
13798         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13799         Incremental_checker.
13800         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13801         unsigned int.
13802         (class Incremental_inputs_header): New class.
13803         (Incremental_inputs_header_writer): Edit comment.
13804         (Incremental_inputs_entry): New class.
13805         (Incremental_inputs_entry_writer): Edit comment.
13806         (Sized_incremental_binary::do_find_incremental_inputs_section):
13807         Add *strtab_shndx parameter, fill it.
13808         (Sized_incremental_binary::do_check_inputs): New method.
13809         (Incremental_checker::can_incrementally_link_output_file): Use
13810         Sized_incremental_binary::check_inputs.
13811         (Incremental_inputs::report_command_line): Save command line in
13812         command_line_.
13813         * incremental.h:
13814         (Incremental_binary::find_incremental_inputs_section): New
13815         method.
13816         (Incremental_binary::do_find_incremental_inputs_section): Add
13817         strtab_shndx parameter.
13818         (Incremental_binary::do_check_inputs): New pure virtual method.
13819         (Sized_incremental_binary::do_check_inputs): Declare.
13820         (Incremental_checker::Incremental_checker): Add incremental_inputs
13821         parameter, use it to initialize incremental_inputs_.
13822         (Incremental_checker::incremental_inputs_): New field.
13823         (Incremental_checker::command_line): New method.
13824         (Incremental_checker::inputs): New method.
13825         (Incremental_checker::command_line_): New field.
13826
13827 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13828
13829         * incremental.cc: Include <cstdarg> and "target-select.h".
13830         (vexplain_no_incremental): New function.
13831         (explain_no_incremental): New function.
13832         (Incremental_binary::error): New method.
13833         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13834         method.
13835         (make_sized_incremental_binary): New function.
13836         (open_incremental_binary): New function.
13837         (can_incrementally_link_file): Add checks if output is ELF and has
13838         inputs section.
13839         * incremental.h: Include "elfcpp_file.h" and "output.h".
13840         (Incremental_binary): New class.
13841         (Sized_incremental_binary): New class.
13842         (open_incremental_binary): Declare.
13843         * object.cc (is_elf_object): Use
13844         elfcpp::Elf_recognizer::is_elf_file.
13845         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13846         * output.h (Output_file::filesize): New method.
13847
13848 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13849
13850         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13851         New function.
13852         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13853         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13854         function.
13855         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13856         function.
13857         (Arm_relocate_functions::movw_abs_nc): New function.
13858         (Arm_relocate_functions::movt_abs): New function.
13859         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13860         (Arm_relocate_functions::thm_movt_abs): New function.
13861         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13862         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13863         (Scan::global): Likewise.
13864         (Relocate::relocate): Likewise.
13865         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13866
13867 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13868
13869         * arm.cc (Arm_relocate_functions::got_prel) New function.
13870         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13871         (Relocate::relocate): Likewise.
13872         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13873
13874 2009-10-06  Ian Lance Taylor  <iant@google.com>
13875
13876         * options.h (class General_options): Define
13877         split_stack_adjust_size parameter.
13878         * object.h (class Object): Add uses_split_stack_ and
13879         has_no_split_stack_ fields.  Add uses_split_stack and
13880         has_no_split_stack accessor functions.  Declare
13881         handle_split_stack_section.
13882         (class Reloc_symbol_changes): Define.
13883         (class Sized_relobj): Define Function_offsets.  Declare
13884         split_stack_adjust, split_stack_adjust_reltype, and
13885         find_functions.
13886         * object.cc (Object::handle_split_stack_section): New function.
13887         (Sized_relobj::do_layout): Call handle_split_stack_section.
13888         * dynobj.cc (Sized_dynobj::do_layout): Call
13889         handle_split_stack_section.
13890         * reloc.cc (Sized_relobj::relocate_sections): Call
13891         split_stack_adjust for executable sections in split_stack
13892         objects.  Pass reloc_map to relocate_section.
13893         (Sized_relobj::split_stack_adjust): New function.
13894         (Sized_relobj::split_stack_adjust_reltype): New function.
13895         (Sized_relobj::find_functions): New function.
13896         * target-reloc.h: Include "object.h".
13897         (relocate_section): Add reloc_symbol_changes parameter.  Change
13898         all callers.
13899         * target.h (class Target): Add calls_non_split method.  Declare
13900         do_calls_non_split virtual method.  Declare match_view and
13901         set_view_to_nop.
13902         * target.cc: Include "elfcpp.h".
13903         (Target::do_calls_non_split): New function.
13904         (Target::match_view): New function.
13905         (Target::set_view_to_nop): New function.
13906         * gold.cc (queue_middle_tasks): Give an error if mixing
13907         split-stack and non-split-stack objects with -r.
13908         * i386.cc (Target_i386::relocate_section): Add
13909         reloc_symbol_changes parameter.
13910         (Target_i386::do_calls_non_split): New function.
13911         * x86_64.cc (Target_x86_64::relocate_section): Add
13912         reloc_symbol_changes parameter.
13913         (Target_x86_64::do_calls_non_split): New function.
13914         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13915         parameter.
13916         * powerpc.cc (Target_powerpc::relocate_section): Add
13917         reloc_symbol_changes parameter.
13918         * sparc.cc (Target_sparc::relocate_section): Add
13919         reloc_symbol_changes parameter.
13920         * configure.ac: Call AM_CONDITIONAL for the default target.
13921         * configure: Rebuild.
13922         * testsuite/Makefile.am (TEST_AS): New variable.
13923         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13924         (check_DATA): Add split_i386 and split_x86_64 files.
13925         (SPLIT_DEFSYMS): Define.
13926         (split_i386_[1234n].o): New targets.
13927         (split_i386_[124]): New targets.
13928         (split_i386_[1234r].stdout): New targets.
13929         (split_x86_64_[1234n].o): New targets.
13930         (split_x86_64_[124]): New targets.
13931         (split_x86_64_[1234r].stdout): New targets.
13932         (MOSTLYCLEANFILES): Add new executables.
13933         * testsuite/split_i386.sh: New file.
13934         * testsuite/split_x86_64.sh: New file.
13935         * testsuite/split_i386_1.s: New file.
13936         * testsuite/split_i386_2.s: New file.
13937         * testsuite/split_i386_3.s: New file.
13938         * testsuite/split_i386_4.s: New file.
13939         * testsuite/split_i386_n.s: New file.
13940         * testsuite/split_x86_64_1.s: New file.
13941         * testsuite/split_x86_64_2.s: New file.
13942         * testsuite/split_x86_64_3.s: New file.
13943         * testsuite/split_x86_64_4.s: New file.
13944         * testsuite/split_x86_64_n.s: New file.
13945         * testsuite/testfile.cc (Target_test): Update relocation_section
13946         function.
13947         * testsuite/Makefile.in: Rebuild.
13948
13949 2009-10-06  Ian Lance Taylor  <iant@google.com>
13950
13951         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13952         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13953         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13954         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13955         the address on ldo_addrs_.
13956         (Target_i386::Relocate::fix_up_ldo): New function.
13957
13958 2009-10-06   Rafael Espindola  <espindola@google.com>
13959
13960         * plugin.cc (add_input_library): New.
13961         (Plugin::load): Add add_input_library to tv.
13962         (Plugin_manager::add_input_file): Add the is_lib argument.
13963         (add_input_file): Update call to Plugin_manager::add_input_file.
13964         (add_input_library): New.
13965         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13966
13967 2009-09-30  Doug Kwan  <dougkwan@google.com>
13968
13969         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13970         symbol and call Symbol::may_need_copy_reloc to determine if
13971         a copy reloc is needed.
13972         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13973         nocopyreloc is given in command line.
13974         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13975         given in command line.
13976         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13977         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13978         of the removed Target_i386::may_need_copy_reloc.
13979         * options.h (copyreloc): New option with default value false.
13980         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13981         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13982         instead of the removed Target_powerpc::may_need_copy_reloc.
13983         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13984         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13985         instead of the removed Target_sparc::may_need_copy_reloc.
13986         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13987         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13988         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13989         instead of the removed Target_x86_64::may_need_copy_reloc.
13990
13991 2009-09-30  Ian Lance Taylor  <iant@google.com>
13992
13993         * object.h (class Object): Remove target_ field, and target,
13994         sized_target, and set_target methods.
13995         (Object::sized_target): Remove.
13996         (class Sized_relobj): Update declarations.  Remove sized_target.
13997         * object.cc (Sized_relobj::setup): Remove target parameter.
13998         Change all callers.
13999         (Input_objects::add_object): Don't do anything with the target.
14000         (make_elf_sized_object): Add punconfigured parameter.  Change all
14001         callers.  Set or test parameter target.
14002         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
14003         Change all callers.
14004         * parameters.cc (Parameters::set_target): Change parameter type to
14005         be non-const.
14006         (Parameters::default_target): Remove.
14007         (set_parameters_target): Change parameter type to be non-const.
14008         (parameters_force_valid_target): New function.
14009         (parameters_clear_target): New function.
14010         * parameters.h (class Parameters): Update declarations.  Remove
14011         default_target method.  Add sized_target and clear_target
14012         methods.  Change target_ to be non-const.
14013         (set_parameters_target): Update declaration.
14014         (parameters_force_valid_target): Declare.
14015         (parameters_clear_target): Declare.
14016         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
14017         as NULL if we aren't searching.
14018         (Add_symbols::run): Don't check for compatible target.
14019         * fileread.cc (Input_file::open_binary): Call
14020         parameters_force_valid_target.
14021         * gold.cc (queue_middle_tasks): Likewise.
14022         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
14023         set_target on object.
14024         * dynobj.h (class Sized_dynobj): Update declarations.
14025         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
14026         make_elf_object returns NULL.
14027         (Archive::include_member): Don't check whether object target is
14028         compatible.
14029         * output.cc (Output_section::add_input_section): Get target from
14030         parameters.
14031         (Output_section::relax_input_section): Likewise.
14032         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
14033         parameters.
14034         (Sized_relobj::do_scan_relocs): Likewise.
14035         (Sized_relobj::relocate_sections): Likewise.
14036         * resolve.cc (Symbol_table::resolve): Likewise.
14037         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
14038         parameter.  Change all callers.
14039         (Symbol_table::add_from_object): Get target from parameters.
14040         (Symbol_table::add_from_relobj): Don't check object target.
14041         (Symbol_table::add_from_dynobj): Likewise.
14042         (Symbol_table::define_special_symbol): Get target from
14043         parameters.
14044         * symtab.h (class Symbol_table): Update declaration.
14045         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
14046         parameter.  Change all callers.  Clear parameter target.
14047         (Binary_test): Test target here.
14048         * testsuite/object_unittest.cc (gold_testsuite): Remove
14049         target_test_pointer parameter.  Change all callers.
14050         (Object_test): Test target here.
14051
14052 2009-09-26  Ian Lance Taylor  <iant@google.com>
14053
14054         * testsuite/initpri1.c: Don't try to use constructor priorities if
14055         compiling with gcc before 4.3.
14056
14057 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
14058
14059         * testsuite/retain_symbols_file_test.sh (check_present): Change
14060         output file name to retain_symbols_file_test.stdout.
14061         (check_absent): Likewise.
14062
14063 2009-09-18  Craig Silverstein  <csilvers@google.com>
14064
14065         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
14066         * options.cc: Include <cerrno> and <fstream>.
14067         (General_options::finalize): Parse -retain-symbols-file tag.
14068         * options.h: New flag.
14069         (General_options): New method should_retain_symbol, new
14070         variable symbols_to_retain.
14071         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
14072         should_retain_symbol map.
14073         * testsuite/Makefile.am (retain_symbols_file_test): New test.
14074         * testsuite/Makefile.in: Regenerate.
14075         * testsuite/retain_symbols_file_test.sh: New file.
14076
14077 2009-09-18  Nick Clifton  <nickc@redhat.com>
14078
14079         * po/es.po: Updated Spanish translation.
14080
14081 2009-09-17  Doug Kwan  <dougkwan@google.com>
14082
14083         * debug.h (DEBUG_RELAXATION): New constant.
14084         (DEBUG_ALL): Add DEBUG_RELAXATION.
14085         (debug_string_to_enum): Add relaxation debug option.
14086         * layout.cc
14087         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
14088         Layout::Relaxation_debug_check::read_sections,
14089         Layout::Relaxation_debug_check::read_sections): New method definitions.
14090         (Layout::Layout): Initialize data members
14091         record_output_section_data_from_scrips_,
14092         script_output_section_data_list_ and relaxation_debug_check_.
14093         (Layout::save_segments, Layout::restore_segments,
14094         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
14095         Layout::relaxation_loop_body): New method definitions.
14096         (Layout::finalize): Support relaxation.  Move section layout code to
14097         Layout::relaxation_loop_body.
14098         (Layout::set_asection_address_from_script): Move code for orphan
14099         section placement out.
14100         (Layout::place_orphan_sections_in_script): New method definition.
14101         * layout.h (Output_segment_headers, Output_file_header):
14102         New forward class declarations.
14103         (Layout::~Layout): Define.
14104         (Layout::new_output_section_data_from_script): New method definition.
14105         (Layout::place_orphan_sections_in_script): New method declaration.
14106         (Layout::Segment_states): New type declaration.
14107         (Layout::save_segments, Layout::restore_segments,
14108         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
14109         Layout::relaxation_loop_body): New method declarations.
14110         (Layout::Output_section_data_list): New type declaration.
14111         (Layout::Relaxation_debug_check): New class definition.
14112         (Layout::record_output_section_data_from_script_,
14113         Layout::script_output_section_data_list_, Layout::segment_states_,
14114         Layout::relaxation_debug_check_): New data members.
14115         * output.cc: (Output_section_headers::do_size): New method definition.
14116         (Output_section_headers::Output_section_headers): Move size
14117         computation to Output_section_headers::do_size.
14118         (Output_segment_headers::do_size): New method definition.
14119         (Output_file_header::Output_file_header): Move size computation to
14120         Output_file_header::do_size and call it.
14121         (Output_file_header::do_size): New method definition.
14122         (Output_data_group::Output_data_group): Adjust call to
14123         Output_section_data.
14124         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
14125         (Output_symtab_xindex::do_write): Add array bound check.
14126         (Output_section::Input_section::print_to_mapfile): Handle
14127         RELAXED_INPUT_SECTION_CODE.
14128         (Output_section::Output_section): Initialize data member checkpoint_.
14129         (Output_section::~Output_section): Delete checkpoint object pointed
14130         by checkpoint_.
14131         (Output_section::add_input_section): Always add an Input_section if
14132         relaxing.
14133         (Output_section::add_merge_input_section): Add assert.
14134         (Output_section::relax_input_section): New method definition.
14135         (Output_section::set_final_data_size): Set load address to zero for
14136         an unallocated section.
14137         (Output_section::do_address_and_file_offset_have_reset_values):
14138         New method definition.
14139         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
14140         Handle relaxed input section.
14141         (Output_section::sort_attached_input_sections): Checkpoint input
14142         section list lazily.
14143         (Output_section::get_input_sections): Change type of input_sections to
14144         list of Simple_input_section pointers.  Checkpoint input section list
14145         lazily.  Also handle relaxed input sections.
14146         (Output_section::add_input_section_for_script): Take a reference to
14147         a Simple_input_section object instead of Relobj pointer and section
14148         index as parameter.  Handle relaxed input sections.
14149         (Output_section::save_states, Output_section::restore_states): New
14150         method definitions.
14151         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
14152         (Output_data::is_data_size_fixed): New method definition.
14153         (Output_data::reset_addresss_and_file_offset): Do not reset data size
14154         if it is fixed.
14155         (Output_data::address_and_file_offset_have_reset_values): New method
14156         definition.
14157         (Output_data::do_address_and_file_offset_have_reset_values): New method
14158         definition.
14159         (Output_data::set_data_size): Check that data size is not fixed.
14160         (Output_data::fix_data_size): New method definition.
14161         (Output_data::is_data_size_fixed_): New data member.
14162         (Output_section_headers::set_final_data_size): New method definition.
14163         (Output_section_headers::do_size): New method declaration.
14164         (Output_segment_headers::set_final_data_size): New method definition.
14165         (Output_segment_headers::do_size): New method declaration.
14166         (Output_file_header::set_final_data_size)::New method definition.
14167         (Output_file_header::do_size)::New method declaration.
14168         (Output_section_data::Output_section_data): Add new parameter
14169         is_data_size_fixed and use it to fix data size.
14170         (Output_data_const::Output_data_const): Adjust call to base class
14171         constructor and fix data size.
14172         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
14173         base class constructor and fix data size.
14174         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
14175         base class constructor and fix data size.
14176         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
14177         class constructor and fix data size.
14178         (Output_data_group::set_final_data_size): New method definition.
14179         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
14180         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
14181         class constructor and fix data size.
14182         (Output_relaxed_input_section): New class definition.
14183         (Output_section::Simple_input_section): New class definition.
14184         (Output_section::get_input_sections): Adjust parameter list.
14185         (Output_section::add_input_section_for_script): Same.
14186         (Output_section::save_states, Output_section::restore_states,
14187         Output_section::do_address_and_file_offset_have_reset_values,
14188         (Output_section::Input_section::Input_section): Handle
14189         RELAXED_INPUT_SECTION_CODE.  Add new overload for
14190         Output_relaxed_input_section.
14191         (Output_section::Input_section::is_input_section,
14192         Output_section::Input_section::set_output_section): Handle relaxed
14193         input section.
14194         (Output_section::Input_section::is_relaxed_input_section,
14195         Output_section::Input_section::output_section_data,
14196         Output_section::Input_section::relaxed_input_section): New method
14197         definitions.
14198         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
14199         value.
14200         (Output_section::Input_section::u1_): Update comments.
14201         (Output_section::Input_section::u2_): Add new union member poris.
14202         (Output_section::Checkpoint_output_section): New classs definition.
14203         (Output_section::relax_input_section): New method declaration.
14204         (Output_section::checkpoint_): New data member.
14205         (Output_segment): Update comments.
14206         (Output_segment::Output_segment): Un-privatize copy constructor.
14207         (Output_segment::operator=): Un-privatize.
14208         * script-sections.cc (Output_section_element::Input_section_list):
14209         Change element type to Output_section::Simple_input_section.
14210         (Output_section_element_dot_assignment::set_section_addresses):
14211         Register output section data for relaxation clean up.
14212         (Output_data_exression::Output_data_expression): Adjust call to base
14213         constructor to fix data size.
14214         (Output_section_element_data::set_section_addresses): Register
14215         Output_data_expression object for relaxation clean up.
14216         (struct Input_section_info): Replace Relobj pointer and section index
14217         pair with Output_section::Simple_input_section and Convert struct to a
14218         class.
14219         (Input_section_sorter::operator()): Adjust access to
14220         Input_section_info data member to use accessors.
14221         (Output_section_element_input::set_section_addresses): Use layout
14222         parameter.  Adjust code to use Output_section::Simple_input_section
14223         and Input_secction_info classes.  Register filler for relaxation
14224         clean up.
14225         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
14226         and section index pair with Output_section::Simple_input_section
14227         class.  Adjust code accordingly.
14228         (Phdrs_element::release_segment): New method definition.
14229         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
14230         segment list.
14231         (Script_sections::release_segments): New method definition.
14232         * script-sections.h (Script_sections::release_segments): New
14233         method declaration.
14234         * target.h (Target::may_relax, Target::relax,
14235         Target::do_may_relax, Target::do_relax): New method definitions.
14236
14237 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14238
14239         * arm.cc (has_signed_unsigned_overflow): New function.
14240         (Arm_relocate_functions::abs8): New function.
14241         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14242         (Target_arm::Scan::global): Likewise.
14243         (Target_arm::relocate::relocate): Likewise.
14244         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14245         Likewise.
14246
14247 2009-09-16  Cary Coutant  <ccoutant@google.com>
14248
14249         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14250         * testsuite/Makefile.in: Regenerate.
14251
14252 2009-09-11  Nick Clifton  <nickc@redhat.com>
14253
14254         * po/gold.pot: Updated by the Translation project.
14255
14256 2009-09-08  Cary Coutant  <ccoutant@google.com>
14257
14258         * output.cc (Output_file::open): Add execute permission to empty file.
14259         * testsuite/Makefile.am (permission_test): New test.
14260         * testsuite/Makefile.in: Regenerate.
14261
14262 2009-09-02  Ian Lance Taylor  <iant@google.com>
14263
14264         * output.cc (Output_file::resize): Call map_no_anonymous rather
14265         than map.
14266
14267 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14268
14269         * gold.cc: Include "incremental.h".
14270         (queue_initial_tasks): Call Incremental_checker methods.
14271         * incremental.cc: Include "output.h".
14272         (Incremental_checker::can_incrementally_link_output_file): New
14273         method.
14274         * incremental.h (Incremental_checker): New class.
14275
14276         * output.cc (Output_file::open_for_modification): New method.
14277         (Output_file::map_anonymous): Changed return type to bool.  Record
14278         map in base_ field.
14279         (Output_file::map_no_anonymous): New method, broken out of map.
14280         (Output_file::map): Use map_no_anonymous and map_anonymous.
14281         * output.h (class Output_file): Update declarations.
14282
14283 2009-08-24  Cary Coutant  <ccoutant@google.com>
14284
14285         * options.h (Command_line::Pre_options): New class.
14286         (Command_line::pre_options): New member.
14287         * options.cc (gold::options::ready_to_register): New variable.
14288         (One_option::register_option): Do nothing if not registering options.
14289         Assert if same short option registered twice.
14290         (General_options::General_options): Turn off option registration when
14291         done constructing.
14292         (Command_line::Pre_options::Pre_options): New constructor.
14293
14294 2009-08-24  Cary Coutant  <ccoutant@google.com>
14295
14296         * options.h (General_options::no_keep_memory): Remove incorrect
14297         short option.
14298
14299 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14300
14301         * Makefile.am (am__skiplex, am__skipyacc): New.
14302         * Makefile.in: Regenerate.
14303
14304 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14305
14306         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14307         (INCLUDES): ... this.
14308         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14309         (AM_CPPFLAGS): Renamed from ...
14310         (INCLUDE): ... this.
14311         * Makefile.in, testsuite/Makefile.in: Regenerate.
14312
14313         * Makefile.in: Regenerate.
14314         * aclocal.m4: Likewise.
14315         * config.in: Likewise.
14316         * configure: Likewise.
14317         * testsuite/Makefile.in: Likewise.
14318
14319         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14320         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14321         * Makefile.in: Regenerate.
14322         * testsuite/Makefile.in: Regenerate.
14323
14324 2009-08-19  Cary Coutant  <ccoutant@google.com>
14325
14326         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14327         symbols in shared libraries overridden by hidden or internal symbols
14328         in the main program.
14329
14330 2009-08-19  Chris Demetriou  <cgd@google.com>
14331
14332         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14333         checking source file names in error messages.
14334
14335 2009-08-18  Doug Kwan  <dougkwan@google.com>
14336
14337         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14338         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14339         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14340         an elfcpp::Ehdr as parameter.
14341         * object.cc (Object::set_target): Remove the version that looks up
14342         a target and sets it.
14343         (Sized_relobj::setup): Take a Target object instead of
14344         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14345         (make_elf_sized_object): Find target and ask target to
14346         make an ELF object.
14347         * object.h: (Object::set_target): Remove the version that looks up
14348         a target and sets it.
14349         (Sized_relobj::setup): Take a Target object instead of
14350         an elfcpp:Ehdr as parameter.
14351         * target.cc: Include dynobj.h.
14352         (Target::do_make_elf_object_implementation): New.
14353         (Target::do_make_elf_object): New.
14354         * target.h (Target::make_elf_object): New template declaration.
14355         (Target::do_make_elf_object): New method declarations.
14356         (Target::do_make_elf_object_implementation): New template declaration.
14357
14358 2009-08-14  Ian Lance Taylor  <iant@google.com>
14359
14360         * gold.h (FUNCTION_NAME): Define.
14361         (gold_unreachable): Use FUNCTION_NAME.
14362
14363 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14364
14365         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14366         symbol in the --keep-unique list is not found.
14367
14368 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14369
14370         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14371         been maked as --keep-unique.
14372         (Icf::unfold_section): New function.
14373         * icf.h (Icf::unfold_section): New function.
14374         * options.h (General_options::keep_unique): New option.
14375         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14376         * testsuite/Makefile.in: Regenerate.
14377         * testsuite/icf_keep_unique_test.sh: New file.
14378         * testsuite/icf_keep_unique_test.cc: New file.
14379
14380 2009-08-12  Cary Coutant  <ccoutant@google.com>
14381
14382         PR 10471
14383         * resolve.cc (Symbol_table::resolve): Check for references from
14384         dynamic objects to hidden and internal symbols.
14385         * testsuite/Makefile.am (hidden_test.sh): New test.
14386         * testsuite/Makefile.in: Regenerate.
14387         * testsuite/hidden_test.sh: New script.
14388         * testsuite/hidden_test_1.c: New test source.
14389         * testsuite/hidden_test_main.c: New test source.
14390
14391 2009-08-11  Doug Kwan  <dougkwan@google.com>
14392
14393         * arm.cc: Update comments.
14394         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14395         segment to locate the .ARM.exidx section if present.
14396
14397 2009-08-09  Doug Kwan  <dougkwan@google.com>
14398
14399         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14400         patch.
14401
14402 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14403         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14404         compiler warnings.
14405
14406 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14407
14408         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14409         valid tls_segment only for non-debug-section relocations.
14410         * testsuite/Makefile.am: Add gc_tls_test.
14411         * testsuite/Makefile.in: Regenerate.
14412         * testsuite/gc_tls_test.cc: New file.
14413         * testsuite/gc_tls_test.sh: New file.
14414
14415 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14416
14417         * icf.cc: New file.
14418         * icf.h: New file.
14419         * Makefile.am (CCFILES): Add icf.cc.
14420         (HFILES): Add icf.h
14421         * Makefile.in: Regenerate.
14422         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14423         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14424         section, symbol and addend information for the relocs.
14425         * gold.cc (queue_middle_tasks): Call identical code folding.
14426         * gold.h: Add defines for multimap.
14427         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14428         to the call of finalize_local_symbols.
14429         * main.cc (main): Create object of class Icf.
14430         * object.cc (Sized_relobj::do_layout): Allow this function to be
14431         called twice during icf.
14432         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14433         to sections marked as identical by icf.
14434         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14435         when available.
14436         (Sized_relobj::do_section_entsize): New function.
14437         * object.h (Object::section_entsize): New function.
14438         (Object::do_section_entsize): New pure virtual function.
14439         (Relobj::finalize_local_symbols): Add new parameter.
14440         (Relobj::do_section_entsize): New function.
14441         * options.h (General_options::icf): New option.
14442         (General_options::icf_iterations): New option.
14443         (General_options::print_icf_sections): New option.
14444         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14445         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14446         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14447         icf.
14448         * symtab.cc (Symbol_table::is_section_folded): New function.
14449         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14450         to sections marked as identical by icf.
14451         * symtab.h (Symbol_table::set_icf): New function.
14452         (Symbol_table::icf): New function.
14453         (Symbol_table::is_section_folded): New function.
14454         (Symbol_table::icf_): New data member.
14455         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14456         * testsuite/Makefile.am: Add commands to build icf_test.
14457         * testsuite/Makefile.in: Regenerate.
14458         * testsuite/icf_test.sh: New file.
14459         * testsuite/icf_test.cc: New file.
14460
14461 2009-07-24  Chris Demetriou  <cgd@google.com>
14462
14463         * layout.cc (is_compressible_debug_section): Fix incorrect
14464         comment about compressed section names.
14465
14466 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14467
14468         PR 10419
14469         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14470
14471 2009-07-16  Ian Lance Taylor  <iant@google.com>
14472
14473         PR 10400
14474         * layout.h: #include <map>.
14475         (class Kept_section): Change from struct to class.  Add accessors
14476         and setters.  Add section size to Comdat_group mapping.  Change
14477         Comdat_group to std::map.  Add is_comdat_ field.  Add
14478         linkonce_size field in union.
14479         (class Layout): Update declaration of find_or_add_kept_section.
14480         Don't declare find_kept_object.
14481         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14482         parameter.  Add object, shndx, is_comdat, and is_group_name
14483         parameters.  Change all callers.  Adjust for new Kept_section.
14484         (Layout::find_kept_object): Remove.
14485         * object.cc (Sized_relobj::include_section_group): Update use of
14486         Kept_section.  Rename secnum to shndx.  Only record
14487         Kept_comdat_section if sections are the same size.
14488         (Sized_relobj::include_linkonce_section): Update use of
14489         Kept_section.  Only record Kept_comdat_section if sections are the
14490         same size.  Set size of linkonce section.
14491         (Sized_relobj::map_to_kept_section): Update call to
14492         get_kept_comdat_section.
14493         * object.h (class Sized_relobj): Rename fields in
14494         Kept_comdat_section to drop trailing underscores; change object
14495         field to Relobj*.  Change Kept_comdat_section_table to store
14496         struct rather than pointer.
14497         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14498         Add kept_object and kept_shndx parameters.  Change all callers.
14499         (Sized_relobj::get_kept_comdat_section): Change return type to
14500         bool.  Add kept_object and kept_shndx parameters.  Change all
14501         callers.
14502         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14503         Layout::find_or_add_kept_section.
14504
14505 2009-07-09  Ian Lance Taylor  <iant@google.com>
14506
14507         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14508         Reserve space in the hash table.
14509
14510 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14511
14512         * fileread.cc (File_read::get_mtime): New method.
14513         * fileread.h (Timespec): New structure.
14514         (File_read::get_mtime): New method.
14515         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14516         Renamed from timestamp_nsec.
14517         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14518         Elf_Xword.
14519         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14520         timestamp_nsec.
14521         (Incremental_inputs::report_archive): Save mtime; style fix.
14522         (Incremental_inputs::report_obejct): Save mtime; style fix.
14523         (Incremental_inputs::report_script): Save mtime; style fix.
14524         (Incremental_inputs::finalize_inputs): Style fix.
14525         (Incremental_inputs::finalize): Style fix.
14526         (Incremental_inputs::create_input_section_data): Store inputs
14527         mtime.
14528         * incremental.h (Incremental_inputs::report_script): Add mtime
14529         argument.
14530         (Incremental_inputs::Input_info::Input_info): Intialize only one
14531         union member.
14532         (Incremental_inputs::Input_info::archive): Move to nameless
14533         union.
14534         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14535         (Incremental_inputs::Input_info::script): Move to nameless union.
14536         (Incremental_inputs::mtime): New field.
14537         * script.cc (read_input_script): Pass file mtime to
14538         Incremental_input.
14539         * script.h (Script_info::inputs): Style fix.
14540
14541 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14542
14543         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14544         instead of 32.
14545
14546 2009-06-24  Ian Lance Taylor  <iant@google.com>
14547
14548         PR 10156
14549         * layout.cc (Layout::choose_output_section): If we find an
14550         existing section, update the flags.
14551         (Layout::create_notes): New function, broken out of
14552         Layout::finalize.
14553         (Layout::finalize): Don't create note sections.
14554         (Layout::create_note): Don't crash if linker script discards
14555         section.
14556         (Layout::create_gold_note): Likewise.
14557         (Layout::create_build_id): Likewise.  Don't set
14558         after_input_sections on the section.
14559         (Layout::create_executable_stack_info): Remove target parameter.
14560         Change caller.
14561         * layout.h (class Layout): Declare create_notes.  Update
14562         declaration of create_executable_stack_info.
14563         * gold.cc (queue_middle_tasks): Call create_notes.
14564         * output.cc (Output_section::update_flags_for_input_section): Move
14565         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14566         invalid.
14567         * output.h (Output_data::mark_address_invalid): New function.
14568         (class Output_section): Only declare, not define,
14569         update_flags_for_input_section.  Remove set_flags.
14570
14571 2009-06-24  Ian Lance Taylor  <iant@google.com>
14572
14573         * script-sections.cc (Output_section_definition::
14574         set_section_addresses): Rename shadowing local load_address to
14575         laddr.
14576
14577 2009-06-24  Ian Lance Taylor  <iant@google.com>
14578
14579         PR 10244
14580         * reloc.cc (relocate_sections): Skip empty relocation sections.
14581
14582 2009-06-23  Ian Lance Taylor  <iant@google.com>
14583
14584         PR 10156
14585         * layout.cc (Layout::create_note): Use choose_output_section
14586         rather than make_output_section.
14587
14588 2009-06-23  Ian Lance Taylor  <iant@google.com>
14589
14590         PR 10237
14591         * options.cc (General_options::parse_V): Set printed_version_.
14592         (General_options::General_options): Initialize printed_version_.
14593         * options.h (class General_options): Add printed_version_ field.
14594         * gold.cc (queue_initial_tasks): If there are no input files,
14595         don't give a fatal error if we printed the version information.
14596         (queue_middle_tasks): If using -r with a shared object, give a
14597         fatal error rather than an ordinary error.
14598
14599 2009-06-23  Ian Lance Taylor  <iant@google.com>
14600
14601         PR 10219
14602         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14603         (Layout::make_output_section): Set have_stabstr_section_ if we see
14604         a .stab*str section.
14605         (Layout::finalize): Call link_stabs_sections.
14606         (Layout::link_stabs_sections): New file.
14607         * layout.h (class Layout): Add have_stabstr_section_ field.
14608         Declare link_stabs_sections.
14609
14610 2009-06-23  Doug Kwan  <dougkwan@google.com>
14611
14612         * Makefile.am (libgold_a_LIBADD): New.
14613         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14614         * Makefile.in: Regenerate.
14615         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14616         * configure: Regenerate.
14617         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14618         * fileread.cc: Include sys/state.h
14619         * gold.h: Declare memmem and strndup if found missing.
14620         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14621
14622 2009-06-23  Ian Lance Taylor  <iant@google.com>
14623
14624         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14625         * configure: Rebuild.
14626
14627 2009-06-23  Ian Lance Taylor  <iant@google.com>
14628
14629         PR 10147
14630         * object.cc (Object::section_contents): Don't try to get a view if
14631         the section has length zero.
14632         (Object::handle_gnu_warning_section): If the section is empty, use
14633         the name of the section as the warning.
14634
14635 2009-06-23  Ian Lance Taylor  <iant@google.com>
14636
14637         PR 10133
14638         * stringpool.h (class Stringpool_template): Add optimize_ field.
14639         (Stringpool_template::set_optimize): New function.
14640         * stringpool.cc (Stringpool_template::Stringpool_template):
14641         Initialize optimize_ field.
14642         (Stringpool_template::set_string_offsets): Test local optimize
14643         fild rather than parameter.
14644         * layout.cc (Layout::Layout): Call set_optimize on the section
14645         name stringpool.
14646
14647 2009-06-22  Ian Lance Taylor  <iant@google.com>
14648
14649         PR 10030
14650         * yyscript.y: Parse TARGET.
14651         * script.cc (script_set_target): New function.
14652         * script-c.h (script_set_target): Declare.
14653         * options.cc (General_options::string_to_object_format): Rename
14654         from string_to_object_format in anonymous namespace.  Change
14655         callers.
14656         * options.h (class General_options): Declare
14657         string_to_object_format.
14658
14659 2009-06-22  Ian Lance Taylor  <iant@google.com>
14660
14661         * script-sections.cc (Script_sections::create_segments): Don't put
14662         program headers in a PT_LOAD segment if -n or -N.
14663
14664 2009-06-22  Ian Lance Taylor  <iant@google.com>
14665
14666         PR 10141
14667         * options.h (class General_options): Add -z lazy and -z now.  Sort
14668         -z options into alphabetical order.
14669         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14670
14671 2009-06-21  Ian Lance Taylor  <iant@google.com>
14672
14673         * layout.cc (Layout::make_output_section): Call
14674         Target::new_output_section.
14675         (Layout::attach_allocated_section_to_segment): Put large section
14676         sections in a separate load segment with the large segment flag
14677         set.
14678         (Layout::segment_precedes): Sort large data segments after other
14679         load segments.
14680         (align_file_offset): New static function.
14681         (Layout::set_segment_offsets): Use align_file_offset.
14682         * output.h (class Output_section): Add is_small_section_ and
14683         is_large_section_ fields.
14684         (Output_section::is_small_section): New function.
14685         (Output_section::set_is_small_section):  New function.
14686         (Output_section::is_large_section): New function.
14687         (Output_section::set_is_large_section): New function.
14688         (Output_section::is_large_data_section): New function.
14689         (class Output_segment): Add is_large_data_segment_ field.
14690         (Output_segment::is_large_data_segment): New function.
14691         (Output_segment::set_is_large_data_segment): New function.
14692         * output.cc (Output_section::Output_section): Initialize new
14693         fields.
14694         (Output_segment::Output_segment): Likewise.
14695         (Output_segment::add_output_section): Add assertion that large
14696         data sections always go in large data segments.  Force small data
14697         sections to the end of the list of data sections.  Force small BSS
14698         sections to the start of the list of BSS sections.  For large BSS
14699         sections to the end of the list of BSS sections.
14700         * symtab.h (class Symbol): Declare is_common_shndx.
14701         (Symbol::is_defined): Check Symbol::is_common_shndx.
14702         (Symbol::is_common): Likewise.
14703         (class Symbol_table): Define enum Commons_section_type.  Update
14704         declarations.  Add small_commons_ and large_commons_ fields.
14705         * symtab.cc (Symbol::is_common_shndx): New function.
14706         (Symbol_table::Symbol_table): Initialize new fields.
14707         (Symbol_table::add_from_object): Put small and large common
14708         symbols in the right list.
14709         (Symbol_table::sized_finalized_symbol): Check
14710         Symbol::is_common_shndx.
14711         (Symbol_table::sized_write_globals): Likewise.
14712         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14713         common symbol lists.  Don't call do_allocate_commons_list if the
14714         list is empty.
14715         (Symbol_table::do_allocate_commons_list): Remove is_tls
14716         parameter.  Add comons_section_type parameter.  Change all
14717         callers.  Handle small and large common symbols.
14718         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14719         Symbol::is_common_shndx.
14720         * resolve.cc (symbol_to_bits): Likewise.
14721         * target.h (Target::small_common_shndx): New function.
14722         (Target::small_common_section_flags): New function.
14723         (Target::large_common_shndx): New function.
14724         (Target::large_common_section_flags): New function.
14725         (Target::new_output_section): New function.
14726         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14727         small_common_section_flags, and large_common_section_flags
14728         fields.
14729         (Target::do_new_output_section): New virtual function.
14730         * arm.cc (Target_arm::arm_info): Initialize new fields.
14731         * i386.cc (Target_i386::i386_info): Likewise.
14732         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14733         Likewise.
14734         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14735         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14736         (Target_x86_64::do_new_output_section): New function.
14737         * configure.ac: Define conditional MCMODEL_MEDIUM.
14738         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14739         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14740         (large_LDFLAGS): Define.
14741         * testsuite/large.c: New file.
14742         * testsuite/testfile.cc (Target_test::test_target_info):
14743         Initialize new fields.
14744         * configure, testsuite/Makefile.in: Rebuild.
14745
14746 2009-06-05  Doug Kwan  <dougkwan@google.com>
14747
14748         * Makefile.am (CCFILES): Add target.cc.
14749         * Makefile.in: Regenerate.
14750         * i386.cc (class Target_i386): Define new virtual method to
14751         override do_is_local_label_name in parent.
14752         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14753         local symbols if --discard-locals or -X is given.
14754         * options.h (class General_options): Declare new options
14755         '--discard-locals' and '-X' for discarding locals.
14756         * target.h (class Target): Define new methods is_local_label_name.
14757         Declare new virtual method do_is_local_label_name.
14758         * target.cc: New file.
14759         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14760         (check_SCRIPTS): Add discard_locals_test.sh.
14761         (check_DATA): Add discard_local_tests.syms.
14762         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14763         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14764         * testsuite/Makefile.in: Regenerate.
14765         * testsuite/discard_locals_test.c: New file.
14766         * testsuite/discard_locals_test.sh: Same.
14767
14768 2009-06-05  Doug Kwan  <dougkwan@google.com>
14769
14770         * object.cc (Sized_relobj::Sized_relobj): Initialize
14771         discarded_eh_frame_shndx_ to -1U.
14772         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14773         section.
14774         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14775         a discarded .eh_frame section.
14776         (Sized_relobj::do_finalize_local_symbols): Ditto.
14777         * object.h (class Sized_relobj): Declare new member
14778         discarded_eh_frame_shndx_.
14779         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14780         (local_labels_test.o, local_labels_test): New rules.
14781         * testsuite/Makefile.in: Regenerate.
14782
14783 2009-06-04  Doug Kwan  <dougkwan@google.com>
14784
14785         * layout.cc (Layout::section_name_mapping): Add mapping for
14786         special ARM sections.
14787
14788 2009-06-03  Doug Kwan  <dougkwan@google.com>
14789
14790         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14791         (utils::has_overflow): Same.
14792
14793 2009-06-03  Ian Lance Taylor  <iant@google.com>
14794
14795         * layout.cc (Layout::section_name_mapping): New array, replacing
14796         Layout::linkonce_mapping.
14797         (Layout::section_name_mapping_count): New variable, replacing
14798         Layout::linkonce_mapping_count.
14799         (Layout::linkonce_output_name): Remove.
14800         (Layout::output_section_name): Rewrite.
14801         * layout.h (class Layout): Rename Linkonce_mapping to
14802         Section_name_mapping, linkonce_mapping to section_name_mapping,
14803         linkonce_mapping_count to section_name_mapping_count.  Don't
14804         declare linkonce_output_name.
14805
14806 2009-06-03  Doug Kwan  <dougkwan@google.com>
14807
14808         * arm.cc (namespace utils): New.
14809         (Target_arm::reloc_is_non_pic): Define new method.
14810         (class Arm_relocate_functions): New.
14811         (Target_arm::Relocate::relocate): Handle relocation types used by
14812         Android.
14813
14814 2009-06-03  Ian Lance Taylor  <iant@google.com>
14815
14816         * arm.cc (Target_arm::scan::global): Use || instead of |.
14817
14818 2009-06-02  Doug Kwan  <dougkwan@google.com>
14819
14820         * arm.cc (Target_arm::Scan::Scan):  Initialize
14821         issued_non_pic_error_.
14822         (class Target_arm::Scan): Declare new method check_non_pic.
14823         Define new method symbol_needs_plt_entry.
14824         Declare new data member issued_non_pic_error_.
14825         (class Target_arm::Relocate): Declare new method
14826         should_apply_static_reloc.
14827         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14828         (Target_arm::Scan::check_non_pic): Define new method.
14829         (Target_arm::Scan::local): Handle a small subset of reloc types used
14830         by Android.
14831         (Target_arm::Scan::local): Same.
14832         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14833
14834 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14835
14836         * incremental.cc (Incremental_inputs::report_command_line): Filter
14837         out --incremental-* options.
14838
14839 2009-05-29  Doug Kwan  <dougkwan@google.com>
14840
14841         * arm.cc (Output_data_plt_arm): Forward declaration for new
14842         template class.
14843         (class Target_arm): Update comment.
14844         (Target_arm::Target_arm): Initialize new data members GOT_,
14845         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14846         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14847         and Target_arm::rel_dyn_section.
14848         Declare new_enum Target_arm::Got_type.
14849         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14850         and DYNBSS_.
14851         Update commments for member do_dynsym_value.
14852         (Target_arm::got_size, Target_arm::plt_section,
14853         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14854         new methods inside class defintion.
14855         (Target_arm::got_section): Define new method.
14856         (Target_arm::rel_dyn_section): Same.
14857         (Output_data_plt_arm): New template class.
14858         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14859         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14860         (Output_data_plt_arm::add_entry): Same.
14861         (Output_data_plt_arm::first_plt_entry): Define new
14862         static data member for PLT instruction template.
14863         (Output_data_plt_arm::plt_entry): Same.
14864         (Output_data_plt_arm::do_write): Define new method.
14865         (Target_arm::make_plt_entry): Same.
14866         (Target_arm::do_finalize_sections): Same.
14867         (Target_arm::do_dynsym_value): Same.
14868
14869 2009-05-28  Doug Kwan  <dougkwan@google.com>
14870
14871         * Makefile.am (TARGETSOURCES): Add arm.cc.
14872         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14873         * Makefile.in: Regenerate.
14874         * arm.cc: New file.
14875         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14876
14877 2009-05-26  Doug Kwan  <dougkwan@google.com>
14878
14879         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14880         (General_options::check_excluded_libs): Strip off directories in
14881         archive name before matching like GNU ld does.
14882         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14883         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14884         (exclude_libs_test_LDFLAGS): Add linker option
14885         -Wl,--exclude-libs,libexclude_libs_test_3
14886         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14887         an explicit archive without using -l.
14888         (alt/libexclude_libs_test_3.a): New make rule.
14889         * testsuite/Makefile.in: Regenerate.
14890         * testsuite/exclude_libs_test.c : Declare lib3_default().
14891         (main): Call it.
14892         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14893         * exclude_libs_test_3.c: New file.
14894
14895 2009-05-26  Nick Clifton  <nickc@redhat.com>
14896
14897         * po/id.po: New Indonesian translation.
14898         * po/gold.pot: Updated template file.
14899
14900 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14901
14902         * testsuite/Makefile.am: Add -ffunction-sections to compile
14903         gc_comdat_test files.  Add -Wl,--gc-sections to build
14904         gc_comdat_test.
14905         * testsuite/Makefile.in: Regenerate.
14906         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14907
14908 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14909
14910         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14911         kept comdat section was garbage collected.
14912         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14913         * testsuite/Makefile.in: Regenerate.
14914         * testsuite/gc_comdat_test.sh: New file.
14915         * testsuite/gc_comdat_test_1.cc: New file.
14916         * testsuite/gc_comdat_test_2.cc: New file.
14917
14918 2009-05-19  Doug Kwan  <dougkwan@google.com>
14919
14920         * archive.cc (Archive::Archive): Move constructor from archive.h
14921         to here.  Initialize no_export_.
14922         (Archive::get_elf_object_for_member): Set no_export flag of object.
14923         * archive.h (Archive::Archive): Move constructor body to
14924         archive.cc.
14925         (Archive::no_export): New method.
14926         (Archive::no_export_): New field.
14927         * object.h (Object::Object): Initialize no_export_ to false.
14928         (Object::no_export, Object::set_no_export): New methods.
14929         (Object::no_export_): New field.
14930         * options.cc (General_options::parse_exclude_libs): New method.
14931         (General_options::check_excluded_libs) Same.
14932         * options.h (exclude_libs): New option.
14933         (General_options::check_excluded_libs): New method declaration.
14934         (General_options::excluded_libs_): New field.
14935         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14936         default or protected visibility if an object has no-export flag set.
14937         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14938         (check_SCRIPTS): Add exclude_libs_test.sh.
14939         (check_DATA): Add exclude_libs_test.syms.
14940         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14941         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14942         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14943         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14944         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14945         libexclude_libs_test_2.a): New rules.
14946         * testsuite/Makefile.in: Regenerate.
14947         * testsuite/exclude_libs_test.c: New file.
14948         * testsuite/exclude_libs_test.sh: Ditto.
14949         * testsuite/exclude_libs_test_1.c: Ditto.
14950         * testsuite/exclude_libs_test_2.c: Ditto.
14951
14952 2009-05-15  Ian Lance Taylor  <iant@google.com>
14953
14954         * configure.ac: Check for declarations for cases where libiberty.h
14955         checks HAVE_DECL_xxx.
14956         * configure, config.in: Rebuild.
14957
14958 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14959
14960         * gold.h (Incremental_argument_list): Remove (invalid) forward
14961         declaration.
14962         * incremental.cc (Incremental_inputs::report_achive): New method.
14963         (Incremental_inputs::report_object): New method.
14964         (Incremental_inputs::report_script): New method.
14965         (Incremental_inputs::finalize_inputs): New method.
14966         (Incremental_inputs::finalize): Call finalize_inputs().
14967         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14968         Create inputs entries.
14969         * incremental.h (Incremental_input_type): New enum.
14970         (Incremental_inputs::Incremental_input): Initialize new fields.
14971         (Incremental_inputs::report_inputs): New method.
14972         (Incremental_inputs::report_achive): New method.
14973         (Incremental_inputs::report_object): New method.
14974         (Incremental_inputs::report_script): New method.
14975         (Incremental_inputs::finalize_inputs): New method.
14976         (Incremental_inputs::Input_info): New struct.
14977         (Incremental_inputs::Input_info_map): New typedef.
14978         (Incremental_inputs::lock_): New field.
14979         (Incremental_inputs::Inputs_): New field.
14980         (Incremental_inputs::Inputs_map): New field.
14981         * main.cc (main): Call Incremental_input::report_inputs.
14982         * options.h (Input_argument_list): Typedef moved from
14983         Input_arguments.
14984         (Input_file_group::Files): Remove, use ::Input_argument_list.
14985         (Input_file_group::Input_argument_list): Remove, use
14986         ::Input_argument_list.
14987         * plugin.cc (Plugin_manager::add_input_file): Add error in
14988         incremental build.
14989         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14990         functions.
14991         * script.cc (read_input_script): Call
14992         Incremental_input::report_script.
14993         * script.h (Script_info): New class.
14994
14995 2009-04-27  Ian Lance Taylor  <iant@google.com>
14996
14997         * x86_64.cc (do_adjust_output_section): Set entsize to
14998         plt_entry_size.
14999
15000 2009-04-23  Elliott Hughes  <enh@google.com>
15001
15002         * output.cc (Output_file::close): After short writes, continue
15003         writing from the correct offset in the buffer being written.
15004
15005 2009-04-23  Chris Demetriou  <cgd@google.com>
15006
15007         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
15008         * configure: Regenerate.
15009         * config.in: Regenerate.
15010         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
15011         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
15012
15013 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
15014
15015         * incremental.cc (Incremental_inputs_header_data): Renamed from
15016         Incremental_input_header_data.
15017         (Incremental_inputs_header_data::data_size): New field.
15018         (Incremental_inputs_header_data::put_input_file_count): Renamed
15019         from input_file_count.
15020         (Incremental_inputs_header_data::put_command_line_offset): Renamed
15021         from command_line_offset.
15022         (Incremental_inputs_header_data::put_reserved): Renamed from
15023         put_reserved.
15024         (Incremental_inputs_entry_data): Renamed from
15025         Incremental_input_entry_data.
15026         (Incremental_inputs_entry_data::data_size): New field.
15027         (Incremental_inputs::report_command_line): New method.
15028         (Incremental_inputs::finalize): New method.
15029         (Incremental_inputs::create_incremental_inputs_data): New method.
15030         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
15031         * incremental.h: New file.
15032         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
15033         (Layout::finalize): Create incremental inputs section in
15034         incremental builds.
15035         (Layout::create_incremental_info_sections): New method.
15036         * layout.h (Layout::incremental_inputs): New method.
15037         (Layout::create_incremental_info_sections): New method.
15038         (Layout::incremental_inputs_): New field.
15039         * main.cc (main): Notify Incremental_input of the command line.
15040
15041 2009-04-01  Ian Lance Taylor  <iant@google.com>
15042             Mikolaj Zalewski  <mikolajz@google.com>
15043
15044         * gold.h (reserve_unordered_map): Define, three versions, one for
15045         each version of Unordered_map.
15046         * layout.cc (Layout::Layout): Remove options parameter.  Add
15047         number_of_input_files parameter.  Don't initialize options_.
15048         Initialize number_of_input_files_ and resized_signatures_.  Move
15049         sections_are_attached_.
15050         (Layout::layout_group): Reserve space for group_signatures_.
15051         (Layout::find_or_add_kept_section): Change name parameter to be a
15052         reference.  Resize signatures_ map when it gets large enough.
15053         (Layout::layout_eh_frame): Use parameters->options() instead of
15054         this->options_.
15055         (Layout::make_output_section): Likewise.
15056         (Layout::attach_allocated_section_to_segment): Likewise.
15057         (Layout::finalize, Layout::create_executable_stack): Likewise.
15058         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
15059         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
15060         * layout.h (class Layout): Update declarations.  Remove options_
15061         field.  Add number_of_input_files_ and resized_signatures_
15062         fields.  Move sections_are_attached_ field.
15063         * main.cc (main): Pass number of input files to Layout
15064         constructor.  Don't pass options.
15065
15066 2009-03-30  Ian Lance Taylor  <iant@google.com>
15067
15068         * ffsll.c (ffsll): Correct implementation.
15069
15070 2009-03-27  Ian Lance Taylor  <iant@google.com>
15071
15072         * ffsll.c: New file.
15073         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
15074         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
15075         * ftruncate.c (ftruncate): Declare before definition.
15076         * mremap.c (mremap): Likewise.
15077         * pread.c (pread): Likewise.
15078         * configure, Makefile.in, config.in: Rebuild.
15079
15080         * mremap.c: New file.
15081         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
15082         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
15083         (mremap): Declare if HAVE_MREMAP is not defined.
15084         * configure, Makefile.in, config.in: Rebuild.
15085
15086 2009-03-27  Cary Coutant  <ccoutant@google.com>
15087
15088         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
15089         position independent.
15090         * sparc.cc (Target_sparc::check_non_pic): Likewise.
15091         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
15092
15093 2009-03-24  Cary Coutant  <ccoutant@google.com>
15094
15095         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
15096         an executable.
15097         (needs_dynamic_reloc): Likewise.
15098
15099 2009-03-24  Ian Lance Taylor  <iant@google.com>
15100
15101         * yyscript.y (file_cmd): Recognize EXTERN.
15102         (extern_name_list, extern_name_list_body): New nonterminals.
15103         * script.cc (script_add_extern): Define.
15104         * script-c.h (script_add_extern): Declare.
15105
15106 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
15107
15108         * object.cc (is_elf_object): Define.
15109         * object.h (is_elf_object): Declare.
15110         * archive.cc (Archive::get_elf_object_for_member): Call
15111         is_elf_object.
15112         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
15113
15114 2009-03-24  Elliott Hughes  <enh@google.com>
15115
15116         * output.cc (Output_file::map_anonymous): Define.
15117         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
15118         try an anonymous one.  Report the size if the mmap fails.
15119         * output.h (class Output_file): Declare map_anonymous.
15120
15121 2009-03-24  Ian Lance Taylor  <iant@google.com>
15122
15123         * target-select.cc (instantiate_target): Don't acquire the lock if
15124         the instantiated_target_ field has already been set.
15125
15126 2009-03-23  Ian Lance Taylor  <iant@google.com>
15127
15128         * gold-threads.h (class Initialize_lock): Define.
15129         * gold-threads.cc (class Initialize_lock_once): Define.
15130         (initialize_lock_control): New static variable.
15131         (initialize_lock_pointer): New static variable.
15132         (initialize_lock_once): New static function.
15133         (Initialize_lock::Initialize_lock): Define.
15134         (Initialize_lock::initialize): Define.
15135         * target-select.h: Include "gold-threads.h".
15136         (class Target_selector): Add lock_ and initialize_lock_ fields.
15137         Don't define instantiate_target, just declare it.
15138         * target-select.cc (Target_selector::Target_selector): Initialize
15139         new fields.
15140         (Target_selector::instantiate_target): Define.
15141         * descriptors.h: Include "gold-threads.h".
15142         (class Descriptors): Add initialize_lock_ field.
15143         * descriptors.cc (Descriptors::Descriptors): Initialize new
15144         field.
15145         (Descriptors::open): Use initialize_lock_ field
15146         * errors.h (class Errors): Add initialize_lock_ field.
15147         * errors.cc (Errors::Errors): Initialize new field.
15148         (Errors::initialize_lock): Use initialize_lock_ field.
15149         * powerpc.cc (class Target_selector_powerpc): Remove
15150         instantiated_target_ field.  In do_recognize call
15151         instantiate_target rather than do_instantiate_target.  In
15152         do_instantiate_target just allocate a new target.
15153         * sparc.cc (class Target_selector_sparc): Likewise.
15154
15155         * freebsd.h: New file.
15156         * i386.cc: Include "freebsd.h".
15157         (Target_i386): Derive from Target_freebsd rather than
15158         Sized_target.
15159         (Target_selector_i386): Derive from Target_selector_freebsd rather
15160         than Target_selector.
15161         * x86_64.cc: Include "freebsd.h".
15162         (Target_x86_64): Derive from Target_freebsd rather than
15163         Sized_target.
15164         (Target_selector_x86_64): Derive from Target_selector_freebsd
15165         rather than Target_selector.
15166         * target.h (class Target): Add adjust_elf_header and
15167         do_adjust_elf_header.
15168         * output.cc (Output_file_header:: do_sized_write): Call target
15169         adjust_elf_header routine.
15170         * configure.tgt: Set targ_osabi.
15171         * configure.ac: Define GOLD_DEFAULT_OSABI.
15172         * parameters.cc (Parameters::default_target): Pass
15173         GOLD_DEFAULT_OSABI to select_target.
15174         * target-select.h (class Target_selector): Make instantiate_target
15175         protected rather than private.
15176         * Makefile.am (HFILES): Add freebsd.h.
15177         * configure, Makefile.in, config.in: Rebuild.
15178
15179         * merge.cc (do_add_input_section): Correct pend value.  Change
15180         message about last entry not being null terminated from error to
15181         warning.
15182
15183 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
15184
15185         * incremental.cc: New file.
15186         * Makefile.am (CCFILES): Add incremental.cc.
15187         * Makefile.in: Rebuild.
15188
15189 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
15190
15191         * layout.cc (Layout::output_section_name): Preserve names
15192         of '.note.' sections.
15193
15194 2009-03-19  Ian Lance Taylor  <iant@google.com>
15195
15196         * descriptors.cc (Descriptors::open): Check that the options are
15197         valid before using them.
15198
15199 2009-03-18  Ian Lance Taylor  <iant@google.com>
15200
15201         * script-sections.h: Include <list>.
15202         (class Script_sections): Change Sections_elements from std::vector
15203         to std::list.  Typedef public Elements_iterator.  Add
15204         orphan_section_placement_, data_segment_align_start_, and
15205         saw_data_segment_align_ fields.  Remove data_segment_align_index_
15206         field.
15207         * script-sections.cc (class Orphan_section_placement): New class.
15208         (class Sections_element): Add virtual functions is_relro and
15209         orphan_section_init.  Remove virtual function place_orphan_here.
15210         (class Output_section_definition): Add is_relro and
15211         orphan_section_init.  Remove place_orphan_here.
15212         (class Orphan_output_section): Likewise.
15213         (Script_sections::Script_sections): Update for field changes.
15214         (Script_sections::data_segment_align): Set saw_data_segment_align_
15215         and data_segment_align_start_, not data_segment_align_index.
15216         (Script_sections::data_segment_relro_end): Check
15217         saw_data_segment_align_.  Use data_segment_align_start_ rather
15218         than data_segment_align_index_.
15219         (Script_sections::place_orphan): Rewrite to use
15220         Orphan_section_placement.
15221
15222 2009-03-17  Ian Lance Taylor  <iant@google.com>
15223
15224         * archive.cc (Archive::add_symbols): Check for a version attached
15225         to the symbol name in the archive map.
15226         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
15227         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
15228         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
15229         (ver_test_11.a): New target.
15230         * testsuite/Makefile.in: Rebuild.
15231
15232         * configure.ac: Check for chsize and posix_fallocate.  Replace
15233         ftruncate.
15234         * ftruncate.c: New file, from gnulib.
15235         * output.cc (posix_fallocate): Define dummy version if not
15236         HAVE_POSIX_FALLOCATE.
15237         (Output_file::map): Call posix_fallocate rather than lseek and
15238         write.
15239         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15240         * configure, Makefile.in, config.in: Rebuild.
15241
15242 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15243
15244         * layout.h (Layout::create_note): Add section_name parameter.
15245         * layout.cc (Layout::create_note): Likewise.
15246         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15247
15248 2009-03-17  Ian Lance Taylor  <iant@google.com>
15249
15250         * descriptors.cc: Include "options.h".
15251         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15252         (Descriptors::open): Always use O_CLOEXEC when opening a new
15253         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15254         then set FD_CLOEXEC.
15255
15256         * sparc.cc (class Target_sparc): Add has_got_section.
15257         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15258         make sure we have a GOT section.
15259
15260         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15261         (Target_sparc::Scan::local): Likewise.
15262         (Target_sparc::Scan::global): Likewise.
15263         (Target_sparc::Relocate::relocate): Likewise.
15264         (Target_sparc::Relocate::relocate_tls): Likewise.
15265
15266         * symtab.cc (Symbol_table::define_default_version): New function,
15267         broken out of add_from_object.
15268         (Symbol_table::add_from_object): Call define_default_version.
15269         (Symbol_table::define_special_symbol): Add resolve_oldsym
15270         parameter.  Change all callers.  If the version for a symbol comes
15271         from a version script, resolve it with the symbol with the same
15272         name with no version.  Also add the symbol without a version if
15273         appropriate.
15274         (do_define_in_output_data): If resolving with oldsym, don't delete
15275         sym.
15276         (do_define_in_output_segment): Likewise.
15277         (do_define_as_constant): Likewise.
15278         * symtab.h (class Symbol_table): Update declarations.
15279
15280 2009-03-13  Ian Lance Taylor  <iant@google.com>
15281
15282         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15283         (Read_symbols::requeue): New function.
15284         (Read_symbols::do_read_symbols): If make_elf_object fails because
15285         the target type is not configured, and the file was searched for,
15286         issue a warning and retry with the next directory.
15287         (Add_symbols::run): If the file has an incompatible format, and
15288         it was searched for, requeue the Read_symbols task.  On error,
15289         release the object.
15290         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15291         dirindex parameter to constructor.  Change all callers.  Declare
15292         incompatible_warning and requeue.
15293         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15294         input_argument_ and input_group_ fields.  Add them to
15295         constructor.  Change all callers.
15296         (class Read_script): Add dirindex_ field.  Add it to constructor.
15297         Change all callers.
15298         * archive.cc (Archive::setup): Remove input_objects parameter.
15299         Change all callers.
15300         (Archive::get_file_and_offset): Likewise.
15301         (Archive::read_all_symbols): Likewise.
15302         (Archive::read_symbols): Likewise.
15303         (Archive::get_elf_object_for_member): Remove input_objects
15304         parameter.  Add punconfigured parameter.  Change all callers.
15305         (Archive::add_symbols): Change return type to bool.  Check return
15306         value of include_member.
15307         (Archive::include_all_members): Likewise.
15308         (Archive::include_member): Change return type to bool.  Return
15309         false if first included object has incompatible target.  Set
15310         included_member_ field.
15311         (Add_archive_symbols::run): If add_symbols returns false, requeue
15312         Read_symbols task.
15313         * archive.h (class Archive): Add included_member_ field.
15314         Initialize it in constructor.  Add input_file and searched_for
15315         methods.  Update declarations.
15316         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15317         input_argument_ fields.  Add them to constructor.  Change all
15318         callers.
15319         * script.cc: Include "target-select.h".
15320         (class Parser_closure): Add skip_on_incompatible_target_ and
15321         found_incompatible_target_ fields.  Add
15322         skip_on_incompatible_target parameter to constructor.  Change all
15323         callers.  Add methods skip_on_incompatible_target,
15324         clear_skip_on_incompatible_target, found_incompatible_target, and
15325         set_found_incompatible_target.
15326         (read_input_script): Add dirindex parameter.  Change all callers.
15327         If parser finds an incompatible target, requeue Read_symbols
15328         task.
15329         (script_set_symbol): Clear skip_on_incompatible_target in
15330         closure.
15331         (script_add_assertion, script_parse_option): Likewise.
15332         (script_start_sections, script_add_phdr): Likewise.
15333         (script_check_output_format): New function.
15334         * script.h (read_input_script): Update declaration.
15335         * script-c.h (script_check_output_format): Declare.
15336         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15337         (ignore_cmd): Remove OUTPUT_FORMAT.
15338         * fileread.cc (Input_file::Input_file): Add explicit this.
15339         (Input_file::will_search_for): New function.
15340         (Input_file::open): Add pindex parameter.  Change all callers.
15341         * fileread.h (class Input_file): Add input_file_argument method.
15342         Declare will_search_for.  Update declarations.
15343         * object.cc (make_elf_object): Add punconfigured parameter.
15344         Change all callers.
15345         * object.h (class Object): Make input_file public.  Add
15346         searched_for method.
15347         (make_elf_object): Update declaration.
15348         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15349         restart search.
15350         * dirsearch.h (class Dirsearch): Update declaration.
15351         * options.h (class General_options): Add --warn-search-mismatch.
15352         * parameters.cc (Parameters::is_compatible_target): New function.
15353         * parameters.h (class Parameters): Declare is_compatible_target.
15354         * workqueue.cc (Workqueue::add_blocker): New function.
15355         * workqueue.h (class Workqueue): Declare add_blocker.
15356
15357         * fileread.cc (Input_file::open): Remove options parameter.
15358         Change all callers.
15359         (Input_file::open_binary): Likewise.
15360         * script.cc (read_input_script): Likewise.
15361         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15362         options parameter from constructor.  Change all callers.
15363         (class Read_script): Likewise.
15364         * fileread.h (class Input_file): Update declarations.
15365         * script.h (read_input_script): Update declaration.
15366
15367 2009-03-10  Nick Clifton  <nickc@redhat.com>
15368
15369         * po/es.po: New Spanish translation.
15370
15371 2009-03-06  Cary Coutant  <ccoutant@google.com>
15372
15373         * options.cc (parse_short_option): Keep dash_z from registering itself.
15374
15375 2009-03-03  Ian Lance Taylor  <iant@google.com>
15376
15377         PR 9918
15378         * target-reloc.h (relocate_section): Pass output_section to
15379         relocate.
15380         * i386.cc (Target_i386::should_apply_static_reloc): Add
15381         output_section parameter.  Change all callers.
15382         (Target_i386::Relocate::relocate): Add output_section parameter.
15383         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15384         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15385         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15386         * testsuite/two_file_shared.sh: New script.
15387         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15388         (check_DATA): Add two_file_shared.dbg.
15389         (two_file_shared.dbg): New target.
15390         * testsuite/Makefile.in: Rebuild.
15391
15392 2009-03-01  Ian Lance Taylor  <iant@google.com>
15393
15394         * configure.ac: Check for byteswap.h.
15395         * configure: Rebuild.
15396         * config.in: Rebuild.
15397
15398 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15399
15400         * layout.cc (Layout::find_or_add_kept_section): New function.
15401         (Layout::add_comdat): Removed.
15402         * layout.h (struct Kept_section): Move out of class Layout.
15403         Remove trailing underscores from field names.  Add group_sections
15404         field.  Rename group_ field to is_group.  Change all uses.
15405         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15406         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15407         comdat_groups_ field.
15408         (Sized_relobj::include_section_group): Use
15409         find_or_add_kept_section and Kept_section::group_sections.
15410         (Sized_relobj::include_linkonce_section): Likewise.
15411         * object.cc (class Sized_relobj): Don't define Comdat_group or
15412         Comdat_group_table.  Remove find_comdat_group and
15413         add_comdat_group.  Remove comdat_groups_ field.
15414         * plugin.cc (include_comdat_group): Use
15415         Layout::find_or_add_kept_section.
15416
15417 2009-02-28  Ian Lance Taylor  <iant@google.com>
15418
15419         * README: --gc-sections and map files are now supported.  Document
15420         some build requirements.
15421
15422         PR 6992
15423         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15424         relocatable link set the value of the section symbol to zero.
15425         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15426         relocatable link don't include the section address in the local
15427         symbol value.
15428
15429 2009-02-27  Ian Lance Taylor  <iant@google.com>
15430
15431         PR 6811
15432         * options.h (class Search_directory): Add is_system_directory.
15433         (class General_options): Declare is_in_system_directory.
15434         * options.cc (get_relative_sysroot): Make static.
15435         (get_default_sysroot): Make static.
15436         (General_optoins::is_in_system_directory): New function.
15437         * fileread.cc (Input_file::is_in_system_directory): New function.
15438         * fileread.h (class Input_file): Declare is_in_system_directory.
15439         * object.h (class Object): Add is_in_system_directory.
15440         (class Input_objects): Remove system_library_directory_ field.
15441         * object.cc (Input_objects::add_object): Don't set
15442         system_library_directory_.
15443         (input_objects::found_in_system_library_directory): Remove.
15444         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15445         parameter.  Change all callers.
15446         (Symbol_table::sized_write_globals): Likewise.
15447         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15448         Call Object::is_in_system_directory.
15449         * symtab.h (class Symbol_table): Update declarations.
15450
15451         PR 5990
15452         * descriptors.h (Open_descriptor): Add is_on_stack field.
15453         * descriptors.cc (Descriptors::open): If the descriptor is on the
15454         top of the stack, remove it.  Initialize is_on_stack field.
15455         (Descriptors::release): Only add pod to stack if it is not on the
15456         stack already.
15457         (Descriptors::close_some_descriptor): Clear stack_next and
15458         is_on_stack fields.
15459
15460         PR 7091
15461         * output.cc (Output_section::find_starting_output_address): Rename
15462         from starting_output_address; add PADDR parameter; change return
15463         type.
15464         * output.h (class Output_section): Declare
15465         find_starting_output_address instead of starting_output_address.
15466         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15467         section symbol for which we can't find a merge section.
15468
15469         PR 9836
15470         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15471         hidden or internal, force the symbol to be local.
15472         * resolve.cc (Symbol::override_visibility): Define.
15473         (Symbol::override_base): Use override_visibility.
15474         (Symbol_table::resolve): Likewise.
15475         (Symbol::override_base_with_special): Likewise.
15476         (Symbol_table::override_with_special): If the visibility is hidden
15477         or internal, force the symbol to be local.
15478         * symtab.h (class Symbol): Add set_visibility and
15479         override_visibility.
15480         * testsuite/ver_test_1.sh: New file.
15481         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15482         (check_DATA): Add ver_test_1.syms.
15483         (ver_test_1.syms): New target.
15484         * testsuite/Makefile.in: Rebuild.
15485
15486 2009-02-25  Cary Coutant  <ccoutant@google.com>
15487
15488         * layout.cc (Layout::choose_output_section): Don't rename sections
15489         when using a linker script that has a SECTIONS clause.
15490         * Makefile.in: Regenerate.
15491
15492         * testsuite/Makefile.am (script_test_5.sh): New test case.
15493         * testsuite/Makefile.in: Regenerate.
15494         * testsuite/script_test_5.cc: New file.
15495         * testsuite/script_test_5.sh: New file.
15496         * testsuite/script_test_5.t: New file.
15497
15498 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15499
15500         * archive.cc (Archive::include_member): Update calls to add_symbols.
15501         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15502         the Layout argument.
15503         * dynobj.h (do_add_symbols): Add the Layout argument.
15504         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15505         Layout argument.
15506         * object.h (Object::add_symbols): Add the Layout argument.
15507         (Object::do_add_symbols): Add the Layout argument.
15508         (Sized_relobj::do_add_symbols): Add the Layout argument.
15509         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15510         Unify the two versions.
15511         (Add_plugin_symbols): Remove.
15512         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15513         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15514         (Add_plugin_symbols): Remove.
15515         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15516         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15517         (Add_symbols::run): Make it work with Pulginobj.
15518
15519 2009-02-06  Ian Lance Taylor  <iant@google.com>
15520
15521         * object.cc (Sized_relobj::do_layout): Make info message start
15522         with lower case letter.
15523
15524 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15525
15526         * binary.cc: Fix file comment.
15527
15528         * options.h (enum Incremental_disposition): Define.
15529         (class General_options): Add new options: --incremental,
15530         --incremental_changed, --incremental_unchanged,
15531         --incremental_unknown.  Add incremental_disposition_ and
15532         implicit_incremental_ fields.
15533         (General_options::incremental_disposition): New function.
15534         (class Position_dependent_options): Add incremental_disposition
15535         option.
15536         (Position_dependent_options::copy_from_options): Set incremental
15537         dispositions.
15538         * options.cc (General_options::parse_incremental_changed): New
15539         function.
15540         (General_options::parse_incremental_unchanged): New function.
15541         (General_options::parse_incremental_unknown): New function.
15542         (General_options::General_options): Initialize new fields
15543         incremental_disposition_ and implicit_incremental_.
15544         (General_options::finalize): Check for uasge of --incremental-*
15545         without --incremental.
15546
15547 2009-02-06  Chris Demetriou  <cgd@google.com>
15548
15549         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15550         pointer and to report location as the file name associated with
15551         the symbol.
15552         (gold_undefined_symbol_at_location): New function to replace the
15553         old gold_undefined_symbol functionality.
15554         * target-reloc.h (relocate_section): Update to use
15555         gold_undefined_symbol_at_location.
15556         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15557         Call gold_undefined_symbol function rather than gold_error.
15558         * errors.h (Errors::undefined_symbol): Take location as a
15559         string, rather than calculating it from a relocation.
15560         * errors.cc (Errors::fatal): Print "fatal error:" before the
15561         formatted message.
15562         (Errors::error, Errors::error_at_location): Print "error: "
15563         before the formatted message.
15564         (Errors::undefined_symbol): Take location as a string, rather
15565         than calculating it from a relocation.
15566         (gold_undefined_symbol_at_location): New function akin to
15567         old gold_undefined_symbol, calculates location from relocation.
15568         (gold_undefined_symbol): Change to take only a Symbol pointer
15569         and to report location as the file name associated with the symbol.
15570         * testsuite/debug_msg.sh: Update for changed error messages.
15571         * testsuite/undef_symbol.sh: Likewise.
15572
15573 2009-02-04  Duncan Sands  <baldrick@free.fr>
15574
15575         PR 9812
15576         * reduced_debug_output.h
15577         (Output_reduced_debug_abbrev_section::failed): Use format for
15578         gold_warning.
15579         (Output_reduced_debug_info_section::faild): Likewise.
15580
15581 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15582
15583         * script.cc (Lazy_demangler): New class.
15584         (Version_script_info::get_symbol_version_helper): Demangle a
15585         symbol only once.
15586
15587 2009-01-29  Cary Coutant  <ccoutant@google.com>
15588
15589         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15590         to __tls_get_addr.
15591         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15592
15593 2009-01-28  Ian Lance Taylor  <iant@google.com>
15594
15595         * version.cc (version_string): Bump to 1.9.
15596
15597         * gold.h: Include <cstring> and <stdint.h>.
15598         * version.cc: Include <cstdio>.
15599         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15600         warning.
15601         * reduced_debug_output.cc (insert_into_vector): Rename from
15602         Insert_into_vector; change all callers.  Use Swap_unaligned to
15603         avoid aliasing issue; remove union since it is unnecessary.
15604
15605 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15606
15607         * Makefile.am (CCFILES): Add gc.cc.
15608         (HFILES): Add gc.h.
15609         * Makefile.in: Regenerate.
15610         * gold.cc (Gc_runner): New class.
15611         (queue_initial_tasks): Call garbage collection related tasks
15612         when corresponding options are invoked.
15613         (queue_middle_gc_tasks): New function.
15614         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15615         processed early before laying out sections during garbage collection.
15616         * gold.h (queue_middle_gc_tasks): New function.
15617         (is_prefix_of): Move from "layout.cc".
15618         * i386.cc (Target_i386::gc_process_relocs): New function.
15619         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15620         * main.cc (main): Create object of class "Garbage_collection".
15621         * object.cc (Relobj::copy_symbols_data): New function.
15622         (Relobj::is_section_name_included): New function.
15623         (Sized_relobj::do_layout): Allow this function to be called twice
15624         during garbage collection and defer layout of section during the
15625         first call.
15626         * object.h (Relobj::get_symbols_data): New function.
15627         (Relobj::is_section_name_included): New function.
15628         (Relobj::copy_symbols_data): New function.
15629         (Relobj::set_symbols_data): New function.
15630         (Relobj::get_relocs_data): New function.
15631         (Relobj::set_relocs_data): New function.
15632         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15633         (Relobj::gc_process_relocs): New function.
15634         (Relobj::do_gc_process_relocs): New pure virtual function.
15635         (Relobj::sd_): New data member.
15636         (Sized_relobj::is_output_section_offset_invalid): New function.
15637         (Sized_relobj::do_gc_process_relocs): New function.
15638         * options.h (General_options::gc_sections): Modify to not be a no-op.
15639         (General_options::print_gc_sections): New option.
15640         * plugin.cc (Plugin_finish::run): Remove function call to
15641         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15642         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15643         * reloc.cc (Read_relocs::run): Add task to process relocs and
15644         determine unreferenced sections when doing garbage collection.
15645         (Gc_process_relocs): New class.
15646         (Sized_relobj::do_gc_process_relocs): New function.
15647         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15648         sections that are garbage collected.
15649         * reloc.h (Gc_process_relocs): New class.
15650         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15651         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15652         symbols whose corresponding sections are garbage collected.
15653         (Symbol_table::Symbol_table): Add new parameter for the garbage
15654         collection object.
15655         (Symbol_table::gc_mark_undef_symbols): New function.
15656         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15657         (Symbol_table::gc_mark_dyn_syms): New function.
15658         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15659         as garbage.
15660         (Symbol_table::add_from_object): Likewise.
15661         (Symbol_table::add_from_relobj): When building shared objects, do not
15662         treat externally visible symbols as garbage.
15663         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15664         table information for static and relocatable links.
15665         * symtab.h (Symbol_table::set_gc): New function.
15666         (Symbol_table::gc): New function.
15667         (Symbol_table::gc_mark_undef_symbols): New function.
15668         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15669         (Symbol_table::gc_mark_dyn_syms): New function.
15670         (Symbol_table::gc_): New data member.
15671         * target.h (Sized_target::gc_process_relocs): New pure virtual
15672         function.
15673         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15674         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15675
15676 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15677
15678         * options.h (General_options::gc_sections): Define as a no-op for now.
15679         (General_options::no_keep_memory): Ditto.
15680         (General_options::Bshareable): Define.
15681         * options.cc (General_options::finalize): Honor -Bshareable.
15682
15683 2009-01-20  Andreas Schwab  <schwab@suse.de>
15684
15685         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15686         read the value in the contents, since we don't use it.  Use the
15687         template endianness when writing.
15688         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15689
15690 2009-01-19  Andreas Schwab  <schwab@suse.de>
15691
15692         * configure.tgt (powerpc64-*): Fix targ_obj.
15693
15694 2009-01-15  Ian Lance Taylor  <iant@google.com>
15695
15696         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15697         local symbols when stripping all symbols.
15698
15699 2009-01-14  Cary Coutant  <ccoutant@google.com>
15700
15701         * output.cc (Output_reloc): Add explicit instantiations.
15702
15703 2009-01-14  Cary Coutant  <ccoutant@google.com>
15704
15705         * archive.cc (Archive::get_elf_object_for_member): Remove call
15706         to File_read::claim_for_plugin.
15707         * descriptors.cc (Descriptors::open): Remove reference to
15708         is_claimed.
15709         (Descriptors::claim_for_plugin): Remove.
15710         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15711         (Descriptors::is_claimed): Remove.
15712         (claim_descriptor_for_plugin): Remove.
15713         * fileread.cc (File_read::claim_for_plugin): Remove.
15714         * fileread.h (File_read::claim_for_plugin): Remove.
15715         (File_read::descriptor): Reopen descriptor if necessary.
15716         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15717         (Plugin_manager::all_symbols_read): Add task parameter. Change
15718         all callers.
15719         (Plugin_manager::get_input_file): New function.
15720         (Plugin_manager::release_input_file): New function.
15721         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15722         corresponding data member.
15723         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15724         and pass to base constructor. Change all callers.
15725         (get_input_file, release_input_file): New functions.
15726         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15727         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15728         (Plugin_manager::all_symbols_read): Add task parameter.
15729         (Plugin_manager::get_input_file): New function.
15730         (Plugin_manager::release_input_file): New function.
15731         (Plugin_manager::task_): New data member.
15732         (Pluginobj::Pluginobj): Add filesize parameter.
15733         (Pluginobj::filename): New function.
15734         (Pluginobj::descriptor): New function.
15735         (Pluginobj::filesize): New function.
15736         (Pluginobj::filesize_): New data member.
15737         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15738         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15739         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15740
15741         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15742         with archive libraries.
15743         * testsuite/Makefile.in: Regenerate.
15744         * testsuite/plugin_test.c (struct sym_info): New type.
15745         (get_input_file, release_input_file): New static variables.
15746         (onload): Capture new transfer vector entries.
15747         (claim_file_hook): Stop reading at end of file according to filesize.
15748         Factor out parsing of readelf output into separate function.
15749         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15750         APIs and get the source file name from the symbol table.  Convert
15751         source file name to corresponding object file name.  Print info
15752         message when adding new input files.
15753         (parse_readelf_line): New function.
15754         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15755         * testsuite/plugin_test_2.sh: Likewise.
15756         * testsuite/plugin_test_3.sh: Likewise.
15757         * testsuite/plugin_test_4.sh: New test case.
15758
15759 2009-01-07  Ian Lance Taylor  <iant@google.com>
15760
15761         * version.cc (version_string): Bump to 1.8.
15762
15763 2008-12-23  Cary Coutant  <ccoutant@google.com>
15764
15765         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15766         * plugin.cc (Plugin_manager::finish): Rename as
15767         layout_deferred_objects.  Move cleanup to separate function.
15768         (Plugin_manager::cleanup): New function.
15769         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15770         separately.
15771         * plugin.h (Plugin_manager::finish): Rename as
15772         layout_deferred_objects.
15773         (Plugin_manager::cleanup): New function.
15774         (Plugin_manager::cleanup_done): New field.
15775
15776 2008-12-23  Cary Coutant  <ccoutant@google.com>
15777
15778         * plugin.cc (is_visible_from_outside): New function.
15779         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15780         so we don't return "IR only" status for exported symbols or -r links.
15781
15782         * testsuite/Makefile.am (plugin_test_3): New test case.
15783         * testsuite/Makefile.in: Regenerate.
15784         * testsuite/plugin_test_3.sh: New file.
15785
15786 2008-12-22  Cary Coutant  <ccoutant@google.com>
15787
15788         * object.cc (Sized_relobj::layout_section): New function.
15789         (Sized_relobj::do_layout): Defer layout of input sections until after
15790         plugin has provided replacement files.
15791         (Sized_relobj::do_layout_deferred_sections): New function.
15792         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15793         (Relobj::layout_deferred_sections): New function.
15794         (Relobj::do_layout_deferred_sections): New function.
15795         (Sized_relobj::do_layout_deferred_sections): New function.
15796         (Sized_relobj::layout_section): New function.
15797         (Sized_relobj::Deferred_layout): New structure.
15798         (Sized_relobj::deferred_layout_): New field.
15799         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15800         Change all callers.  Layout deferred sections.
15801         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15802         references.
15803         (Plugin_hook::run): Move code from do_plugin_hook inline.
15804         (Plugin_hook::do_plugin_hook): Remove.
15805         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15806         (Plugin_manager::finish): Renamed, was cleanup.
15807         (Plugin_manager::should_defer_layout): New function.
15808         (Plugin_manager::add_deferred_layout_object): New function.
15809         (Plugin_manager::Deferred_layout_list): New type.
15810         (Plugin_manager::deferred_layout_objects_): New field.
15811         (Plugin_hook::do_plugin_hook): Remove.
15812
15813 2008-12-17  Ian Lance Taylor  <iant@google.com>
15814
15815         * options.h (class General_options): Add --no case for
15816         --export-dynamic.
15817
15818 2008-12-16  Cary Coutant  <ccoutant@google.com>
15819
15820         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15821         vector.
15822         (Plugin_manager::claim_file): Create plugin object even if
15823         plugin did not call the add_symbols callback.
15824         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15825         asking for more symbols than were added.
15826         * testsuite/Makefile.am (plugin_test_1): Add test case with
15827         no global symbols.
15828         (empty.syms): New target.
15829         * testsuite/Makefile.in: Regenerate.
15830         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15831         message. Don't call add_symbols if no globals.
15832         (all_symbols_read_hook): Don't provide replacement for empty
15833         claimed file.
15834
15835 2008-12-12  Ian Lance Taylor  <iant@google.com>
15836
15837         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15838         r_type == 0 for a local symbol with r_sym == 0.
15839         (scan_relocatable_relocs): Pass r_sym to
15840         local_non_section_strategy.
15841         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15842         r_sym parameter.
15843
15844         * configure.ac: Update test for TLS descriptors: they are
15845         supported as of glibc 2.9.
15846         * configure: Rebuild.
15847
15848 2008-12-11  Ian Lance Taylor  <iant@google.com>
15849
15850         PR 7091
15851         * target-reloc.h (Default_scan_relocatable_relocs): For each
15852         function, map r_type == 0 to RELOC_DISCARD.
15853
15854 2008-12-10  Cary Coutant  <ccoutant@google.com>
15855
15856         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15857         object to override a kept COMDAT group from a plugin object.
15858
15859 2008-12-09  Ian Lance Taylor  <iant@google.com>
15860
15861         PR 7088
15862         * yyscript.y (file_cmd): Handle INPUT.
15863
15864         * testsuite/initpri1.c: Change all declarations to be full
15865         prototypes by adding void, to avoid compiler warnings.
15866
15867 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15868
15869         * options.cc (General_options::parse_plugin_opt): New.
15870         (General_options::add_plugin): The argument now is just the filename.
15871         (General_options::add_plugin_option): New.
15872         * options.h (plugin_opt): New.
15873         (add_plugin): Change argument name.
15874         (add_plugin_option): New.
15875         * plugin.cc (Plugin::load): Don't parse the plugin option.
15876         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15877         (Plugin::add_option): New.
15878         (Plugin::args_): Change type.
15879         (Plugin::filename_): New.
15880         (Plugin_manager::add_plugin_option): New.
15881         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15882         * testsuite/Makefile.in: Regenerate.
15883
15884 2008-12-05  Cary Coutant  <ccoutant@google.com>
15885
15886         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15887         Handle --strip-lto-sections option.
15888         * options.h (strip_lto_sections): New option.
15889
15890 2008-12-01  Cary Coutant  <ccoutant@google.com>
15891
15892         * plugin.cc (ld_plugin_message): Change format parameter to const.
15893         Fix mismatch between new[] and delete.
15894
15895 2008-11-14  Cary Coutant  <ccoutant@google.com>
15896
15897         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15898         instead of -1U.
15899
15900 2008-11-05  Craig Silverstein  <csilvers@google.com>
15901
15902         * options.cc (General_options::parse_dynamic_list): New function.
15903         * options.h (General_options): New flags dynamic_list,
15904         dynamic_list_data, dynamic_list_cpp_new, and
15905         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15906         (General_options::in_dynamic_list): New function.
15907         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15908         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15909         (Lex::can_continue_name): Likewise.
15910         (yylex): Likewise.
15911         (read_script_file): New parameter script_options.
15912         (read_dynamic_list): New function.
15913         (Script_options::define_dynamic_list): New function.
15914         (dynamic_list_keyword_parsecodes): New variable.
15915         (dynamic_list_keywords): New variable.
15916         * script.h (Script_options::define_dynamic_list): New function
15917         prototype.
15918         (read_dynamic_list): New function prototype.
15919         * symtab.cc (strprefix): New macro.
15920         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15921         dynamic_list_data, dynamic_list_cpp_new, and
15922         dynamic_list_cpp_typeinfo.
15923         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15924         (dynamic_list_expr): New rule.
15925         (dynamic_list_nodes): Likewise.
15926         (dynamic_list_node): Likewise.
15927         * testsuite/Makefile.am (dynamic_list): New test.
15928         * testsuite/Makefile.in: Regenerated.
15929         * testsuite/dynamic_list.t: New file.
15930         * testsuite/dynamic_list.sh: New file.
15931
15932 2008-11-05  Craig Silverstein  <csilvers@google.com>
15933
15934         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15935         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15936         (t11_last): Likewise.
15937         * testsuite/ver_test_6.c (main): Likewise.
15938
15939 2008-10-07  Cary Coutant  <ccoutant@google.com>
15940
15941         * options.c (General_options::finalize): Add check for -static and
15942         -shared.
15943         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15944         is not empty.
15945
15946 2008-10-02  Cary Coutant  <ccoutant@google.com>
15947
15948         * plugin.cc (make_sized_plugin_object): Fix conditional
15949         compilation to work when not all targets are enabled.
15950
15951 2008-09-29  Cary Coutant  <ccoutant@google.com>
15952
15953         * archive.cc (Archive::get_file_and_offset): Use filename instead
15954         of name to get library path.
15955         (Archive::include_member): Unlock external member of a thin archive.
15956
15957         * testsuite/Makefile.am (TEST_AR): New variable.
15958         (thin_archive_test_1): New test.
15959         (thin_archive_test_2): New test.
15960         * testsuite/Makefile.in: Regenerate.
15961         * testsuite/thin_archive_main.cc: New file.
15962         * testsuite/thin_archive_test_1.cc: New file.
15963         * testsuite/thin_archive_test_2.cc: New file.
15964         * testsuite/thin_archive_test_3.cc: New file.
15965         * testsuite/thin_archive_test_4.cc: New file.
15966
15967 2008-09-29  Cary Coutant  <ccoutant@google.com>
15968
15969         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15970         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15971         instead of -1U.
15972         (Sized_relobj::do_finalize_local_symbols): Likewise.
15973         (Sized_relobj::map_to_kept_section): Likewise.
15974         * object.h (Sized_relobj::invalid_address): New constant.
15975         (Sized_relobj::do_output_section_offset): Check for invalid_address
15976         and return -1ULL.
15977         * output.cc (Output_reloc::local_section_offset): Use constant
15978         invalid_address instead of -1U.
15979         (Output_reloc::get_address): Likewise.
15980         (Output_section::output_address): Change -1U to -1ULL.
15981         * output.h (Output_reloc::invalid_address): New constant.
15982         * reloc.cc (Sized_relobj::write_sections): Use constant
15983         invalid_address instead of -1U.
15984         (Sized_relobj::relocate_sections): Likewise.
15985         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15986         values for merge sections.
15987         * target-reloc.h (relocate_for_relocatable): Use constant
15988         invalid_address instead of -1U.
15989
15990 2008-09-19  Cary Coutant  <ccoutant@google.com>
15991
15992         Add plugin functionality for link-time optimization (LTO).
15993         * configure.ac (plugins): Add --enable-plugins option.
15994         * configure: Regenerate.
15995         * config.in: Regenerate.
15996         * Makefile.am (LIBDL): New variable.
15997         (CCFILES): Add plugin.cc.
15998         (HFILES): Add plugin.h.
15999         (ldadd_var): Add LIBDL.
16000         * Makefile.in: Regenerate.
16001
16002         * archive.cc: Include "plugin.h".
16003         (Archive::setup): Don't preread archive symbols when using a plugin.
16004         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
16005         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
16006         files.
16007         (Archive::include_member): Add symbols from plugin objects.
16008         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
16009         * descriptors.cc (Descriptors::open): Check for file descriptors
16010         abandoned by plugins.
16011         (Descriptors::claim_for_plugin): New function.
16012         * descriptors.h (Descriptors::claim_for_plugin): New function.
16013         (Open_descriptor::is_claimed): New field.
16014         (claim_descriptor_for_plugin): New function.
16015         * fileread.cc (File_read::claim_for_plugin): New function.
16016         * fileread.h (File_read::claim_for_plugin): New function.
16017         (File_read::descriptor): New function.
16018         * gold.cc: Include "plugin.h".
16019         (queue_initial_tasks): Add task to call plugin hooks for generating
16020         new object files.
16021         * main.cc: Include "plugin.h".
16022         (main): Load plugin libraries.
16023         * object.h (Pluginobj): Declare.
16024         (Object::pluginobj): New function.
16025         (Object::do_pluginobj): New function.
16026         (Object::set_target): New function.
16027         * options.cc: Include "plugin.h".
16028         (General_options::parse_plugin): New function.
16029         (General_options::General_options): Initialize plugins_ field.
16030         (General_options::add_plugin): New function.
16031         * options.h (Plugin_manager): Declare.
16032         (General_options): Add --plugin option.
16033         (General_options::has_plugins): New function.
16034         (General_options::plugins): New function.
16035         (General_options::add_plugin): New function.
16036         (General_options::plugins_): New field.
16037         * plugin.cc: New file.
16038         * plugin.h: New file.
16039         * readsyms.cc: Include "plugin.h".
16040         (Read_symbols::do_read_symbols): Check for archive before checking
16041         for ELF file.  Call plugin hooks to claim files.
16042         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
16043         from a real object file; force override when processing replacement
16044         files.
16045         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
16046         (Symbol::init_base_object): Likewise.
16047         (Symbol::init_base_output_data): Likewise.
16048         (Symbol::init_base_output_segment): Likewise.
16049         (Symbol::init_base_constant): Likewise.
16050         (Symbol::init_base_undefined): Likewise.
16051         (Symbol::output_section): Assert that object is not a plugin.
16052         (Symbol_table::add_from_pluginobj): New function.
16053         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
16054         undefined.
16055         (Symbol_table::sized_write_globals): Likewise.
16056         (Symbol_table::add_from_pluginobj): Instantiate template.
16057         * symtab.h (Sized_pluginobj): Declare.
16058         (Symbol::in_real_elf): New function.
16059         (Symbol::set_in_real_elf): New function.
16060         (Symbol::in_real_elf_): New field.
16061         (Symbol_table::add_from_pluginobj): New function.
16062
16063         * testsuite/Makefile.am (AM_CFLAGS): New variable.
16064         (LIBDL): New variable.
16065         (LDADD): Add LIBDL.
16066         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
16067         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
16068         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
16069         (MOSTLYCLEANFILES): Likewise.
16070         * testsuite/Makefile.in: Regenerate.
16071         * testsuite/plugin_test.c: New file.
16072         * testsuite/plugin_test_1.sh: New file.
16073         * testsuite/plugin_test_2.sh: New file.
16074
16075 2008-09-16  Ian Lance Taylor  <iant@google.com>
16076
16077         * target-reloc.h (relocate_section): Check whether a symbol is
16078         defined by the ABI before reporting an undefined symbol error.
16079         * target.h (Target::is_defined_by_abi): Make parameter const.
16080         (Target::do_is_defined_by_abi): Likewise.
16081         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
16082         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
16083         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
16084         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
16085         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
16086         * testsuite/Makefile.in: Rebuild.
16087
16088         * fileread.cc (make_view): Add casts to avoid warning.
16089
16090 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
16091
16092         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
16093         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
16094
16095 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
16096
16097         * options.h (General_options::output_is_executable): New.
16098         (General_options::output_is_pie): New.
16099         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
16100         for shared libraries.
16101         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
16102
16103 2008-09-11  Chris Demetriou  <cgd@google.com>
16104
16105         * options.h (origin): New -z option.
16106         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
16107         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
16108         in DT_FLAGS_1.
16109
16110 2008-09-05  Cary Coutant  <ccoutant@google.com>
16111
16112         * fileread.cc (File_read::make_view): Add check for attempt to map
16113         beyond end of file.
16114
16115 2008-09-05  Cary Coutant  <ccoutant@google.com>
16116
16117         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
16118         explicit instantiations.
16119
16120 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
16121
16122         PR gold/6858
16123         * options.cc (General_options::finalize): Allow undefined symbols
16124         in shlibs if linking -shared.
16125
16126         PR gold/6859
16127         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
16128         symbols as not needing a dynsym entry.
16129
16130 2008-08-20  Craig Silverstein  <csilvers@google.com>
16131
16132         * fileread.cc (File_read::open): Do not lock the file unless it
16133         was successfully opened.
16134
16135 2008-08-14  Cary Coutant  <ccoutant@google.com>
16136
16137         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
16138         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
16139         * testsuite/tls_test.cc (struct int128): 128-bit struct
16140         for testing TLS relocs with non-zero addend.
16141         (v12): New TLS variable.
16142         (t12): New test.
16143         (t_last): Add check for v12.
16144         * testsuite/tls_test.h (t12): New function.
16145         * testsuite/tls_test_main.cc (thread_routine): Call new test.
16146
16147 2008-08-13  Ian Lance Taylor  <iant@google.com>
16148
16149         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
16150         set tls_segment_ or relro_segment_.
16151         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
16152         when appropriate.
16153         * output.h (Output_section::clear_is_relro): New function.
16154         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
16155         sections specially even when output_data_ is empty.
16156         (Output_segment::maximum_alignment): When first section is relro,
16157         only force alignment for PT_LOAD segments.
16158         * script.cc (script_data_segment_align): New function.
16159         (script_data_segment_relro_end): New function.
16160         * script-c.h (script_data_segment_align): Declare.
16161         (script_data_segment_relro_end): Declare.
16162         * script-sections.h (class Script_sections): Declare
16163         data_segment_align and data_segment_relro_end.  Add fields
16164         segment_align_index_ and saw_relro_end_.
16165         * script-sections.cc (class Sections_element): Add set_is_relro
16166         virtual function.  Add new bool* parameter to place_orphan_here.
16167         Add get_output_section virtual function.
16168         (class Output_section_definition): Add set_is_relro.  Add new
16169         bool* parameter to place_orphan_here.  Add get_output_section.
16170         Add is_relro_ field.
16171         (Output_section_definition::Output_section_definition): Initialize
16172         evaluated_address_, evaluated_load_address, evaluated_addralign_,
16173         and is_relro_ fields.
16174         (Output_section_definition::place_orphan_here): Add is_relro
16175         parameter.
16176         (Output_section_definition::set_section_addresses): Set relro for
16177         output section.
16178         (Output_section_definition::alternate_constraint): Likewise.
16179         (class Orphan_output_section): Add new bool* parameter to
16180         place_orphan_here.  Add get_output_section.
16181         (Orphan_output_section::place_orphan_here): Add is_relro
16182         parameter.
16183         (Script_sections::Script_sections): Initialize
16184         data_segment_align_index_ and saw_relro_end_.
16185         (Script_sections::data_segment_align): New function.
16186         (Script_sections::data_segment_relro_end): New function.
16187         (Script_sections::place_orphan): Set or clear is_relro.
16188         (Script_sections::set_section_addresses): Force alignment of first
16189         TLS section.
16190         * yyscript.y (exp): Call script_data_segment_align and
16191         script_data_segment_relro_end.
16192         * testsuite/relro_script_test.t: New file.
16193         * testsuite/relro_test.cc (using_script): Declare.
16194         (t1, t2): Test using_script.
16195         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
16196         (relro_script_test_SOURCES): Define.
16197         (relro_script_test_DEPENDENCIES): Define.
16198         (relro_script_test_LDFLAGS): Define.
16199         (relro_script_test_LDADD): Define.
16200         (relro_script_test.so): New target.
16201         * testsuite/Makefile.in: Rebuild.
16202
16203 2008-08-06  Cary Coutant <ccoutant@google.com>
16204
16205         * archive.cc (Archive::total_archives, Archive::total_members)
16206         (Archive::total_members_loaded): New variables.
16207         (Archive::setup): Add parameter.  Add option to preread
16208         archive symbols.
16209         (Archive::read_armap): Add counter.
16210         (Archive::get_file_and_offset): New function.
16211         (Archive::get_elf_object_for_member): New function.
16212         (Archive::read_all_symbols): New function.
16213         (Archive::read_symbols): New function.
16214         (Archive::add_symbols): Add counters.
16215         (Archive::include_all_members): Use armap to find members if it's
16216         already built.
16217         (Archive::include_member): Skip reading symbols if already read.
16218         Factored code into Archive::get_file_and_offset and
16219         Archive::get_elf_object_for_member.  Changed call to
16220         Mapfile::report_include_archive_member.
16221         (Archive::print_stats): New function.
16222         * archive.h: Declare Object and Read_symbols_data classes.
16223         (Archive::Archive): Add initializers for new members.
16224         (Archive::setup): Add parameter.
16225         (Archive::print_stats): New function.
16226         (Archive::total_archives, Archive::total_members)
16227         (Archive::total_members_loaded): New variables.
16228         (Archive::get_file_and_offset): New function.
16229         (Archive::get_elf_object_for_member): New function.
16230         (Archive::read_all_symbols): New function.
16231         (Archive::read_symbols): New function.
16232         (Archive::Archive_member): New class.
16233         (Archive::members_): New member.
16234         (Archive::num_members_): New member.
16235         * main.cc: Include archive.h.
16236         (main): Call Archive::print_stats.
16237         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16238         archive parameter; member_name is now the fully-decorated name.
16239         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16240         * options.h: (General_options): Add --preread-archive-symbols option.
16241         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16242         Archive::setup.
16243
16244 2008-08-04  Ian Lance Taylor  <iant@google.com>
16245
16246         * symtab.h (Symbol::use_plt_offset): New function.
16247         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16248         * powerpc.cc (Relocate::relocate): Likewise.
16249         * sparc.cc (Relocate::relocate): Likewise.
16250         * x86_64.cc (Relocate::relocate): Likewise.
16251         * testsuite/weak_plt.sh: New test.
16252         * testsuite/weak_plt_main.cc: New test.
16253         * testsuite/weak_plt_shared.cc: New test.
16254         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16255         (check_PROGRAMS): Add weak_plt.
16256         (check_DATA): Add weak_plt_shared.so.
16257         (weak_plt_main_pic.o, weak_plt): New targets.
16258         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16259         * testsuite/Makefile.in: Rebuild.
16260
16261         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16262         gcctestdir/ld.
16263         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16264         * testsuite/Makefile.in: Rebuild.
16265
16266 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16267
16268         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16269         * Makefile.in: Regenerate.
16270         * po/POTFILES.in: Regenerate.
16271
16272 2008-07-29  Ian Lance Taylor  <iant@google.com>
16273
16274         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16275         symbols before other symbols.
16276         * testsuite/script_test_2.cc (test_addr): Declare.
16277         (test_addr_alias): Declare.
16278         (main): Check that test_addr and test_addr_alias have the right
16279         values.
16280         * testsuite/script_test_2.t: Define test_addr_alias and
16281         test_addr.
16282
16283 2008-07-24  Ian Lance Taylor  <iant@google.com>
16284
16285         PR 5990
16286         * descriptors.cc: New file.
16287         * descriptors.h: New file.
16288         * gold-threads.h (class Hold_optional_lock): New class.
16289         * fileread.cc: Include "descriptors.h".
16290         (File_read::~File_read): Release descriptor rather than closing
16291         it.
16292         (File_read::open) [file]: Call open_descriptor rather than open.
16293         Set is_descriptor_opened_.
16294         (File_read::open) [memory]: Assert that descriptor is not open.
16295         (File_read::reopen_descriptor): New function.
16296         (File_read::release): Release descriptor.
16297         (File_read::do_read): Make non-const.  Reopen descriptor.
16298         (File_read::read): Make non-const.
16299         (File_read::make_view): Reopen descriptor.
16300         (File_read::do_readv): Likewise.
16301         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16302         Update declarations.
16303         * layout.cc: Include "descriptors.h".
16304         (Layout::create_build_id): Use open_descriptor rather than open.
16305         * output.cc: Include "descriptors.h".
16306         (Output_file::open): Use open_descriptor rather than open.
16307         * archive.cc (Archive::const_iterator): Change Archive to be
16308         non-const.
16309         (Archive::begin, Archive::end): Make non-const.
16310         (Archive::count_members): Likewise.
16311         * archive.h (class Archive): Update declarations.
16312         * object.h (Object::read): Make non-const.
16313         * Makefile.am (CCFILES): Add descriptors.cc.
16314         (HFILES): Add descriptors.h.
16315         * Makefile.in: Rebuild.
16316
16317         PR 6716
16318         * gold.h: Always include <clocale>.  Add Solaris workarounds
16319         following code in binutils/sysdep.h.
16320
16321         PR 6048
16322         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16323         this->eh_frame_hdr_ is NULL before using it.
16324
16325         * dynobj.cc (Versions::Versions): Update comment.
16326
16327         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16328         the base version name.
16329
16330         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16331         array size plus one.
16332         (Stringpool_template::set_string_offsets): Subtract one from key
16333         before using it as an array index.
16334         (Stringpool_template::get_offset_with_length): Likewise.
16335         (Stringpool_template::write_to_buffer): Likewise.
16336         * stringpool.h (Stringpool_template::get_offset_from_key):
16337         Likewise.
16338
16339 2008-07-23  Ian Lance Taylor  <iant@google.com>
16340
16341         PR 6658
16342         * object.h (Merged_symbol_value::value): Do our best to handle a
16343         negative addend.
16344
16345         PR 6647
16346         * script.cc (Version_script_info::get_versions): Don't add empty
16347         version tag to return value.
16348         (Version_script_info::get_symbol_version_helper): Change return
16349         type to bool.  Add pversion parameter.  Change all callers.
16350         (script_register_vers_node): Don't require a non-NULL tag.
16351         * script.h (class Version_script_info): Update declarations.
16352         (Version_script_info::get_symbol_version): Change return type to
16353         bool.  Add version parameter.  Change all callers.
16354         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16355         handling.  Handle an empty version from a version script.
16356         (Symbol_table::define_special_symbol): Likewise.
16357         * testsuite/ver_test_10.script: New file.
16358         * testsuite/ver_test_10.sh: New file.
16359         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16360         (check_DATA): Add ver_test_10.syms.
16361         (ver_test_10.syms, ver_test_10.so): New target.
16362         * testsuite/Makefile.in: Rebuild.
16363
16364 2008-07-23  Simon Baldwin  <simonb@google.com>
16365
16366         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16367         to zero for undefined symbols from dynamic libraries.
16368
16369 2008-07-23  Ian Lance Taylor  <iant@google.com>
16370
16371         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16372         Change all callers.
16373         * symtab.h (class Symbol_table): Update declaration.
16374         * testsuite/ver_test_9.cc: New file.
16375         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16376         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16377         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16378         (ver_test_9.so, ver_test_9.o): New targets.
16379         * testsuite/Makefile.in: Rebuild.
16380
16381 2008-07-22  Ian Lance Taylor  <iant@google.com>
16382
16383         * options.h (class General_options): Define --check-sections.
16384         * layout.cc (Layout::set_segment_offsets): Handle
16385         --check-sections.
16386
16387         * options.h (class General_options): Define -n/--nmagic and
16388         -N/--omagic.
16389         * options.cc (General_options::finalize): For -n/--nmagic or
16390         -N/--omagic, set -static.
16391         * layout.cc (Layout::attach_allocated_section_to_segment): If
16392         -N/--omagic, don't put read-only and read-write sections in
16393         different segments.
16394         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16395         finding a read-only segment.
16396         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16397         don't set the minimum segment alignment to the common page size,
16398         and don't set the file offset to the address modulo the page size.
16399         * script-sections.cc (Script_sections::create_segments): If
16400         -n/--omagic, don't put read-only and read-write sections in
16401         different segments.
16402
16403         * cref.cc: New file.
16404         * cref.h: New file.
16405         * options.h (class General_options): Add --print-symbol-counts.
16406         * main.cc (main): Issue defined symbol report if requested.
16407         * archive.cc (Archive::interpret_header): Make into a const member
16408         function.
16409         (Archive::add_symbols): Call Input_objects::archive_start and
16410         archive_stop.
16411         (Archive::const_iterator): Define new class.
16412         (Archive::begin, Archive::end): New functions.
16413         (Archive::include_all_members): Rewrite to use iterator.
16414         (Archive::count_members): New function.
16415         * archive.h (class Archive): Update declarations.
16416         (Archive::filename): New function.
16417         * object.cc: Include "cref.h".
16418         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16419         (Sized_relobj::do_get_global_symbol_counts): New function.
16420         (Input_objects::add_object): Add object to cross-referencer.
16421         (Input_objects::archive_start): New function.
16422         (Input_objects::archive_stop): New function.
16423         (Input_objects::print_symbol_counts): New function.
16424         * object.h: Declare Cref and Archive.
16425         (Object::get_global_symbol_counts): New function.
16426         (Object::do_get_global_symbol_counts): New pure virtual function.
16427         (class Sized_relobj): Add defined_count_ field.  Update
16428         declarations.
16429         (class Input_objects): Add cref_ field.  Update constructor.
16430         Update declarations.
16431         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16432         defined_count_.
16433         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16434         symbol counts.
16435         (Sized_dynobj::do_get_global_symbol_counts): New function.
16436         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16437         defined_count_.  Update declarations.  Define Symbols typedef.
16438         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16439         parameter.  Change all callers.
16440         (Symbol_table::add_from_dynobj): Add sympointers and defined
16441         parameters.  Change all callers.
16442         * symtab.h (class Symbol_table): Update declarations.
16443         * Makefile.am (CCFILES): Add cref.cc.
16444         (HFILES): Add cref.h.
16445         * Makefile.in: Rebuild.
16446
16447 2008-07-22  Simon Baldwin  <simonb@google.com>
16448
16449         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16450         to zero when writing undefined symbols.
16451
16452 2008-07-22  Ian Lance Taylor  <iant@google.com>
16453
16454         * output.cc (Output_section::add_input_section): Don't try to
16455         merge empty merge sections.
16456
16457 2008-07-21  Craig Silverstein  <csilvers@google.com>
16458
16459         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16460         Include symbol version in error message.
16461
16462 2008-07-20  Chris Demetriou  <cgd@google.com>
16463
16464         * configure.ac (gold_cv_c_random_seed): New configured variable.
16465         (RANDOM_SEED_CFLAGS): New substituted variable.
16466         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16467         * configure: Rebuild.
16468         * Makefile.in: Likewise.
16469         * testsuite/Makefile.in: Likewise.
16470
16471 2008-07-18  Ian Lance Taylor  <iant@google.com>
16472
16473         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16474         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16475         * testsuite/ver_test_main.cc (main): Call t4.
16476         (t4, t4_2a): Define.
16477         * testsuite/ver_test_2.cc (t4_2): Define.
16478         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16479         * testsuite/ver_test_4.cc (t4_2a): Define.
16480         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16481         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16482
16483 2008-07-17  Ian Lance Taylor  <iant@google.com>
16484
16485         * dynobj.cc (Versions::add_def): If we give an error about a
16486         missing version, go ahead and create the version anyhow.
16487
16488 2008-07-10  Ian Lance Taylor  <iant@google.com>
16489
16490         Handle output sections with more than 0x7fffffff bytes.
16491         * object.h (class Relobj): Change map_to_output_ to
16492         output_sections_, and just keep a section pointer.  Change all
16493         uses.  Move comdat group support to Sized_relobj.
16494         (Relobj::is_section_specially_mapped): Remove.
16495         (Relobj::output_section): Remove poff parameter.  Change all
16496         callers.
16497         (Relobj::output_section_offset): New function.
16498         (Relobj::set_section_offset): Rewrite.
16499         (Relobj::map_to_output): Remove.
16500         (Relobj::output_sections): New function.
16501         (Relobj::do_output_section_offset): New pure virtual function.
16502         (Relobj::do_set_section_offset): Likewise.
16503         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16504         group support from Relobj.  Update declarations.
16505         (Sized_relobj::get_output_section_offset): New function.
16506         (Sized_relobj::do_output_section_offset): New function.
16507         (Sized_relobj::do_set_section_offset): New function.
16508         * object.cc (Relobj::output_section_address): Remove.
16509         (Sized_relobj::Sized_relobj): Initialize new fields.
16510         (Sized_relobj::include_section_group): Cast find_kept_object to
16511         Sized_relobj.
16512         (Sized_relobj::include_linkonce_section): Likewise.
16513         (Sized_relobj::do_layout): Use separate arrays for output section
16514         and output offset.
16515         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16516         output_sections.
16517         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16518         output_sections and section_offsets.
16519         (Sized_relobj::write_local_symbols): Likewise.
16520         (map_to_kept_section): Compute output address directly.
16521         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16522         output_sections and section_offsets.
16523         (Sized_relobj::write_sections): Likewise.
16524         (Sized_relobj::relocate_sections): Likewise.
16525         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16526         * output.h (class Output_reloc): Update declarations.  Change
16527         u2_.relobj to Sized_relobj*.
16528         (class Output_data_reloc): Change add functions to use
16529         Sized_relobj*.
16530         * output.cc (Output_reloc::Output_reloc): Change relobj to
16531         Sized_relobj*.
16532         (Output_reloc::local_section_offset): Change return type to
16533         Elf_Addr.  Use get_output_section_offset.
16534         (Output_reloc::get_address): Likewise.
16535         (Output_section::is_input_address_mapped): Don't call
16536         is_section_specially_mapped.
16537         (Output_section::output_offset): Likewise.
16538         (Output_section::output_address): Likewise.
16539         (Output_section::starting_output_address): Likewise.
16540         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16541         parameter to Sized_relobj*.
16542         (Copy_relocs::need_copy_reloc): Likewise.
16543         (Copy_relocs::save): Likewise.
16544         * copy-relocs.h (class Copy_relocs): Update declarations.
16545         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16546         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16547         * target-reloc.h (relocate_for_relocatable): Change
16548         offset_in_output_section type to Elf_Addr.  Change code that uses
16549         it as well.
16550         * layout.cc (Layout::layout): Always set *off.
16551         * mapfile.cc (Mapfile::print_input_section): Use
16552         output_section_offset.
16553         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16554         Sized_relobj*.
16555         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16556         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16557         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16558
16559 2008-07-03  Ian Lance Taylor  <iant@google.com>
16560
16561         * layout.cc (Layout::include_section): Do not discard unrecognized
16562         SHT_STRTAB sections.
16563
16564 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16565
16566         * script.cc (Lex::can_continue_name): Make '?' allowable in
16567         version-script names.
16568         * testsuite/version_script.map: Change glob pattern to use '?'
16569
16570 2008-06-30  Manish Singh  <yosh@gimp.org>
16571
16572         PR 6585
16573         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16574         Correct typo.
16575
16576 2008-06-30  Ian Lance Taylor  <iant@google.com>
16577
16578         PR 6660
16579         PR 6682
16580         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16581         versions]: Don't try to read the value in the contents, since we
16582         don't use it.  Use the template endianness when writing.
16583
16584 2008-06-25  Cary Coutant  <ccoutant@google.com>
16585
16586         * fileread.cc (File_read::make_view): Assert on zero-length view.
16587         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16588         symbol table when there are no symbols to read.
16589
16590 2008-06-23  Craig Silverstein  <csilvers@google.com>
16591
16592         * version.cc (version_string): Bump to 1.7
16593
16594 2008-06-18  Craig Silverstein  <csilvers@google.com>
16595
16596         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16597         constant 0xFFFF to type Valtype.
16598         (Powerpc_relocate_functions::rel16_ha): Likewise.
16599
16600 2008-06-17  Ian Lance Taylor  <iant@google.com>
16601
16602         * output.h (Output_section::Input_section): Initialize p2align_ to
16603         zero for Output_section_data constructors.
16604         (Output_section::Input_section::addralign): If not an input
16605         section, return the alignment of the Output_section_data.
16606         * testsuite/copy_test.cc: New file.
16607         * testsuite/copy_test_1.cc: New file.
16608         * testsuite/copy_test_2.cc: New file.
16609         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16610         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16611         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16612         (copy_test_1_pic.o, copy_test_1.so): New targets.
16613         (copy_test_2_pic.o, copy_test_2.so): New targets.
16614         * testsuite/Makefile.in: Rebuild.
16615
16616         * script-sections.cc (Script_sections::place_orphan): Initialize
16617         local variable exact.
16618
16619 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16620
16621         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16622
16623 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16624             David S. Miller  <davem@davemloft.net>
16625
16626         * powerpc.cc: New file.
16627         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16628         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16629         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16630         * Makefile.in: Rebuild.
16631
16632 2008-06-09  Ian Lance Taylor  <iant@google.com>
16633
16634         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16635         <exception>.
16636         (throwing, orig_terminate): New static variables.
16637         (terminate_handler): New static function.
16638         (t2): Set terminate handler.
16639
16640 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16641
16642         PR 6584
16643         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16644         alignment.
16645
16646 2008-05-30  Cary Coutant  <ccoutant@google.com>
16647
16648         * archive.cc (Archive::include_all_members) Correct to step
16649         over symbol table and extended name table in thin archives.
16650
16651 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16652
16653         PR 6407
16654         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16655         calculation.
16656
16657 2008-05-28  Caleb Howe  <cshowe@google.com>
16658
16659         * reduced_debug_output.cc: New file.
16660         * reduced_debug_output.h: New file.
16661         * options.h (class General_options): Add --strip-debug-non-line.
16662         * options.cc (General_options::finalize): Add strip_debug_non_line
16663         to the strip heirarchy.
16664         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16665         fields.
16666         * layout.cc: Include "reduced_debug_output.h".
16667         (Layout::Layout): Initialize new fields.
16668         (line_only_debug_sections): New static array.
16669         (is_lines_only_debug_sections): New static inline function.
16670         (Layout::include_section): Handle --strip-debug-non-line.
16671         (Layout::make_output_section): If --strip-debug-non-line, build
16672         new output sections for .debug_abbrev and .debug_info.
16673         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16674         gold.  Warn about possible overflow.
16675         (read_signed_LEB_128): Likewise.
16676         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16677         (read_signed_LEB_128): Declare.
16678         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16679         (HFILES): Add reduced_debug_output.h.
16680         * Makefile.in: Rebuild.
16681
16682 2008-05-21  Ian Lance Taylor  <iant@google.com>
16683
16684         * mapfile.cc: New file.
16685         * mapfile.h: New file.
16686         * options.h (class General_options): Add -M/--print-map and -Map.
16687         * options.cc (General_options::finalize): Make -M equivalent to
16688         -Map -.
16689         * main.cc: Include <cstdio> and "mapfile.h".
16690         (main): Open mapfile if requested.
16691         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16692         constructor.  Change caller.
16693         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16694         (queue_middle_tasks): Likewise.
16695         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16696         declarations.
16697         * archive.cc: Include "mapfile.h".
16698         (Archive::add_symbols): Add mapfile parameter.  Change all
16699         callers.  Pass mapfile, symbol, and reason to include_member.
16700         (Archive::include_all_members): Add mapfile parameter.  Change all
16701         callers.
16702         (Archive::include_member): Add mapfile, sym, and why parameters.
16703         Change all callers.  Report inclusion to map file.
16704         * archive.h: Include "fileread.h".
16705         (class Archive): Update declarations.
16706         (Archive::file): New const method.
16707         (class Add_archive_symbols): Add mapfile_ field.  Update
16708         constructor.  Change all callers.
16709         * readsyms.h (class Read_symbols): Likewise.
16710         (class Finish_group): Likewise.
16711         (class Read_script): Likewise.
16712         * common.cc: Include "mapfile.h".
16713         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16714         all callers.
16715         (Symbol_table::do_allocate_commons): Likewise.
16716         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16717         symbol allocation to mapfile.
16718         * common.h (class Allocate_commons_task): Add mapfile_ field.
16719         Update constructor.  Change all callers.
16720         * symtab.h (class Symbol_table): Update declarations.
16721         * layout.cc: Include "mapfile.h".
16722         (Layout_task_runner::run): Print information to mapfile.
16723         (Layout::create_gold_note): Change Output_data_fixed_space to
16724         Output_data_zero_fill.
16725         (Layout::create_build_id): Likewise.
16726         (Layout::print_to_mapfile): New function.
16727         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16728         constructor.  Change caller.
16729         (class Layout): Declare print_to_mapfile.
16730         * output.cc (Output_section::Input_section::print_to_mapfile): New
16731         function.
16732         (Output_section::add_input_section): If producing a map, always
16733         add to input_sections_ list.
16734         (Output_section::do_print_to_mapfile): New function.
16735         (Output_segment::print_sections_to_mapfile): New function.
16736         (Output_segment::print_section_list_to_mapfile): New function.
16737         * output.h: Include "mapfile.h".
16738         (Output_data::print_to_mapfile): New function.
16739         (Output_data::do_print_to_mapfile): New virtual function.
16740         (Output_segment_headers::do_print_to_mapfile): New function.
16741         (Output_file_header::do_print_to_mapfile): New function.
16742         (Output_data_const::do_print_to_mapfile): New function.
16743         (class Output_data_const_buffer): Add map_name_ field.  Update
16744         constructor.  Change all callers.  Add do_print_to_mapfile
16745         function.
16746         (class Output_data_fixed_space): Likewise.
16747         (class Output_data_space): Likewise.
16748         (class Output_data_zero_fill): New class.
16749         (Output_data_strtab::do_print_to_mapfile): New function.
16750         (Output_data_reloc_base::do_print_to_mapfile): New function.
16751         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16752         (Output_data_group::do_print_to_mapfile): New function.
16753         (Output_data_got::do_print_to_mapfile): New function.
16754         (Output_data_dynamic::do_print_to_mapfile): New function.
16755         (Output_symtab_xindex::do_print_to_mapfile): New function.
16756         (class Output_section): Declare do_print_to_mapflie.  Declare
16757         print_to_mapfile in Input_section.
16758         (class Output_segment): Declare new functions.
16759         * object.h (Sized_relobj::symbol_count): New function.
16760         * script-sections.cc
16761         (Output_section_element_dot_assignment::set_section_addresses):
16762         Change Output_data_fixed_space to Output_data_zero_fill.
16763         (Output_data_expression::do_print_to_mapfile): New function.
16764         * script.cc (read_input_script): Add mapfile parameter.  Change
16765         all callers.
16766         * script.h (read_input_script): Update declaration.
16767         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16768         (Eh_frame::do_print_to_mapfile): New function.
16769         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16770         (Output_merge_string::do_print_to_mapfile): New function.
16771         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16772         function.
16773         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16774         function.
16775         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16776         function.
16777         * Makefile.am (CCFILES): Add mapfile.cc.
16778         (HFILES): Add mapfile.h.
16779         * Makefile.in: Rebuild.
16780
16781 2008-05-19  Ian Lance Taylor  <iant@google.com>
16782
16783         * options.h (class General_options): Add -z relro.
16784         * layout.cc (Layout::Layout): Initialize relro_segment_.
16785         (Layout::add_output_section_data): Return the output section.
16786         (Layout::make_output_section): Rcognize relro sections and mark
16787         them appropriately.
16788         (Layout::attach_allocated_section_to_segment): Put relro sections
16789         in a PT_GNU_RELRO segment.
16790         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16791         section as relro.
16792         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16793         PT_TLS segments.
16794         (Layout::linkonce_mapping): Map d.rel.ro.local to
16795         .data.rel.ro.local.
16796         (Layout::output_section_name): Us .data.rel.ro.local for any
16797         section which begins with that.
16798         * layout.h (class Layout): Update add_output_section_data
16799         declaration.  Add relro_segment_ field.
16800         * output.cc (Output_section::Output_section): Initialize is_relro_
16801         and is_relro_local_ fields.
16802         (Output_segment::add_output_section): Group relro sections.
16803         (Output_segment::is_first_section_relro): New function.
16804         (Output_segment::maximum_alignment): If there is a relro section,
16805         align the segment to the common page size.
16806         (Output_segment::set_section_addresses): Track whether we are
16807         looking at relro sections.  If the last section is a relro
16808         section, align to the common page size.
16809         (Output_segment::set_section_list_addresses): Add in_relro
16810         parameter.  Change all callers.  Align to the page size when
16811         moving from relro to non-relro section.
16812         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16813         segment.
16814         * output.h (class Output_section): Add is_relro_ and
16815         is_relro_local_ fields.
16816         (Output_section::is_relro): New function.
16817         (Output_section::set_is_relro): New function.
16818         (Output_section::is_relro_local): New function.
16819         (Output_section::set_is_relro_local): New function.
16820         (class Output_segment): Update declarations.
16821         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16822         * sparc.cc (Target_sparc::got_section): Likewise.
16823         * x86_64.cc (Target_x86_64::got_section): Likewise.
16824         * testsuite/relro_test_main.cc: New file.
16825         * testsuite/relro_test.cc: New file.
16826         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16827         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16828         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16829         (relro_test.so, relro_test_pic.o): New targets.
16830         * testsuite/Makefile.in: Rebuild.
16831
16832 2008-05-16  Ian Lance Taylor  <iant@google.com>
16833
16834         * output.cc (Output_segment::add_output_section): Remove front
16835         parameter.
16836         * output.h (class Output_segment): Remove
16837         add_initial_output_section and overloaded add_output_section.
16838         Update declaration of remaining add_output_section.
16839         * layout.cc (Layout::create_interp): Call add_output_section
16840         rather than add_initial_output_section.
16841         (Layout::finish_dynamic_section): Likewise.
16842
16843         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16844         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16845         know the dynamic type.
16846         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16847         field.  Initialize it in constructor.
16848         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16849         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16850         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16851         reloc.
16852
16853         * output.cc (Output_reloc::get_address): Change return type to
16854         Elf_Addr.
16855         * output.h (class Output_reloc): Update get_address declaration.
16856         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16857         for section addresses.
16858
16859 2008-05-09  Ian Lance Taylor  <iant@google.com>
16860
16861         PR 6493
16862         * gold.cc (gold_nomem): Use return value of write.
16863
16864 2008-05-08  Ian Lance Taylor  <iant@google.com>
16865
16866         * symtab.c (Symbol::init_base_output_data): Add version
16867         parameter.  Change all callers.
16868         (Symbol::init_base_output_segment): Likewise.
16869         (Symbol::init_base_constant): Likewise.
16870         (Symbol::init_base_undefined): Likewise.
16871         (Sized_symbol::init_output_data): Likewise.
16872         (Sized_symbol::init_output_segment): Likewise.
16873         (Sized_symbol::init_constant): Likewise.
16874         (Sized_symbol::init_undefined): Likewise.
16875         (Symbol_table::do_define_in_output_data): If the new symbol has a
16876         version, mark it as the default.
16877         (Symbol_table::do_define_in_output_segment): Likewise.
16878         (Symbol_table::do_define_as_constant): Likewise.
16879         * symtab.h (class Symbol): Update declarations.
16880         (class Sized_symbol): Likewise.
16881         * resolve.cc (Symbol::override_version): New function.
16882         (Symbol::override_base): Call override_version.
16883         (Symbol::override_base_with_special): Likewise.
16884         * testsuite/ver_script_8.script: New file.
16885         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16886         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16887         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16888         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16889
16890 2008-05-06  Ian Lance Taylor  <iant@google.com>
16891
16892         PR 6049
16893         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16894         functions.
16895         (class General_options): Remove existing --undefined, and add
16896         --no-undefined instead.  Add new --undefined as synonym for -u.
16897         * archive.cc (Archive::add_symbols): Check whether symbol was
16898         named with -u.
16899         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16900         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16901         all uses.  Add IS_UNDEFINED.  Update declarations to split
16902         different versions of init_base.  Declare init_base_undefined.
16903         (Symbol::is_defined): Handle IS_UNDEFINED.
16904         (Symbol::is_undefined): Likewise.
16905         (Symbol::is_weak_undefined): Call is_undefined.
16906         (Symbol::is_absolute): Handle IS_CONSTANT.
16907         (class Sized_symbol): Update declarations to split different
16908         versions of init.  Declare init_undefined.
16909         (class Symbol_table): Declare new functions.
16910         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16911         Change all callers.
16912         (Symbol::init_base_output_data): Likewise.
16913         (Symbol::init_base_output_segment): Likewise.
16914         (Symbol::init_base_constant): Likewise.
16915         (Symbol::init_base_undefined): New function.
16916         (Sized_symbol::init_object): Rename from init.  Change all
16917         callers.
16918         (Sized_symbol::init_output_data): Likewise.
16919         (Sized_symbol::init_output_segment): Likewise.
16920         (Sized_symbol::init_constant): Likewise.
16921         (Sized_symbol::init_undefined): New function.
16922         (Symbol_table::add_undefined_symbols_from_command_line): New
16923         function.
16924         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16925         function.
16926         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16927         (Symbol::output_section): Likewise.
16928         (Symbol::set_output_section): Likewise.
16929         (Symbol_table::sized_finalize_symbol): Likewise.
16930         (Symbol_table::sized_write_globals): Likewise.
16931         * resolve.cc (Symbol_table::should_override): Likewise.
16932         (Symbol::override_base_with_special): Likewise.
16933
16934         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16935         symbol, change it to have default visibility.
16936         * testsuite/protected_1.cc: New file.
16937         * testsuite/protected_2.cc: New file.
16938         * testsuite/protected_3.cc: New file.
16939         * testsuite/protected_main_1.cc: New file.
16940         * testsuite/protected_main_2.cc: New file.
16941         * testsuite/protected_main_3.cc: New file.
16942         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16943         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16944         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16945         (protected_1.so): New target.
16946         (protected_1_pic.o, protected_2_pic.o): New targets.
16947         (protected_3_pic.o): New target.
16948         (check_PROGRAMS): Add protected_2.
16949         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16950         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16951         * testsuite/Makefile.in: Rebuild.
16952
16953         * options.h (DEFINE_var): Add set_user_set_##varname__.
16954         (DEFINE_bool_alias): New macro.
16955         (class General_options): Define -Bstatic using DEFINE_bool_alias
16956         rather than DEFINE_special.  Add --undefined as an alias for -z
16957         defs.
16958         * options.cc (General_options::parse_Bstatic): Remove.
16959
16960         * options.h (class General_options): Add --fatal-warnings.
16961         * main.cc (main): Implement --fatal-warnings.
16962         * errors.h (Errors::warning_count): New function.
16963
16964         * options.h (class General_options): Add -Bsymbolic-functions.
16965         * symtab.h (Symbol::is_preemptible): Check for
16966         -Bsymbolic-functions.
16967
16968 2008-05-05  Ian Lance Taylor  <iant@google.com>
16969
16970         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16971         as noVARNAME rather than no-VARNAME.
16972         (class General_options): Add option -z combreloc.
16973         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16974         get_address.
16975         (Output_reloc::sort_before) [SHT_REL]: New function.
16976         (Output_reloc::sort_before) [SHT_RELA]: New function.
16977         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16978         Sort_relocs_comparison.
16979         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16980         parameter.  Change all callers.
16981         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16982         sort_relocs parameter.  Change all callers.
16983         * output.cc (Output_reloc::get_address): New function, broken out
16984         of write_rel.
16985         (Output_reloc::write_rel): Call it.
16986         (Output_reloc::compare): New function.
16987         (Output_data_reloc_base::do_write): Optionally sort relocs.
16988
16989         * configure.ac: If targ_extra_obj is set, link it in.
16990         * configure.tgt: Initialize all variables.
16991         (x86_64*): Set targ_extra_obj and targ_extra_size.
16992         * configure: Rebuild.
16993
16994         * object.cc (Sized_relobj::include_section_group): Adjust section
16995         indexes read from group data.  Build vector to pass to
16996         layout_group.
16997         * layout.cc (Layout::layout_group): Add flags and shndxes
16998         parameters.  Remove contents parameter.  Change caller.  Update
16999         explicit instantiations.
17000         * layout.h (class Layout): Update layout_group declaration.
17001         * output.cc (Output_data_group::Output_data_group): Add flags and
17002         input_shndxes parameters.  Remove contents parameter.  Change
17003         caller.
17004         (Output_data_group::do_write): Change input_sections_ to
17005         input_shndxes_.
17006         * output.h (class Output_data_group): Update constructor
17007         declaration.  Rename input_sections_ to input_shndxes_.
17008         * testsuite/many_sections_test.cc: Add template.
17009
17010 2008-04-30  Cary Coutant  <ccoutant@google.com>
17011
17012         * target-reloc.h (relocate_section): Fix dead-pointer bug.
17013
17014         * layout.cc (Layout::include_section): Refactored check for debug
17015         info section.
17016         (Layout::add_comdat): Add new parameters.  Change type
17017         of signature parameter.  Add object and shndx to signatures table.
17018         (Layout::find_kept_object): New function.
17019         * layout.h: Include <cstring>.
17020         (Layout::is_debug_info_section): New function.
17021         (Layout::add_comdat): Add new parameters.
17022         (Layout::find_kept_object): New function.
17023         (Layout::Kept_section): New struct.
17024         (Layout::Signatures): Change type of map range.
17025         * object.cc (Relobj::output_section_address): New function.
17026         (Sized_relobj::include_section_group): Add new parameters.  Change
17027         calls to Layout::add_comdat.  Change to build table of kept comdat
17028         groups and table mapping discarded sections to kept sections.
17029         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
17030         (Sized_relobj::do_layout): Change calls to include_section_group and
17031         include_linkonce_section.
17032         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
17033         value to zero when section is discarded.
17034         (Sized_relobj::map_to_kept_section): New function.
17035         * object.h (Relobj::output_section_address): New function.
17036         (Relobj::Comdat_group): New type.
17037         (Relobj::find_comdat_group): New function.
17038         (Relobj::Comdat_group_table): New type.
17039         (Relobj::Kept_comdat_section): New type.
17040         (Relobj::Kept_comdat_section_table): New type.
17041         (Relobj::add_comdat_group): New function.
17042         (Relobj::set_kept_comdat_section): New function.
17043         (Relobj::get_kept_comdat_section): New function.
17044         (Relobj::comdat_groups_): New field.
17045         (Relobj::kept_comdat_sections_): New field.
17046         (Symbol_value::input_value): Update comment.
17047         (Sized_relobj::map_to_kept_section) New function.
17048         (Sized_relobj::include_linkonce_section): Add new parameter.
17049         * target-reloc.h (Comdat_behavior): New type.
17050         (get_comdat_behavior): New function.
17051         (relocate_section): Add code to map a discarded section to the
17052         corresponding kept section when applying a relocation.
17053
17054 2008-04-30  Craig Silverstein  <csilvers@google.com>
17055
17056         * dwarf_reader.cc (next_generation_count): New static var.
17057         (Addr2line_cache_entry): New struct.
17058         (addr2line_cache): New static var.
17059         (Dwarf_line_info::one_addr2line): Added caching.
17060         (Dwarf_line_info::clear_addr2line_cache): New function.
17061         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
17062         cache-size parameter.
17063         (Dwarf_line_info::one_addr2line_cache): New function.
17064         * symtab.cc (Symbol_table::detect_odr_violations): Pass
17065         new cache-size argument to one_addr2line(), and clear cache.
17066
17067 2008-04-28  Cary Coutant  <ccoutant@google.com>
17068
17069         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
17070         R_386_PC8 relocations.
17071
17072 2008-04-23  Ian Lance Taylor  <iant@google.com>
17073
17074         * object.cc (Sized_relobj::include_section_group): Check for
17075         invalid section group.
17076
17077         * object.cc (make_elf_object): Correct test for 64-bit ELF file
17078         header size.
17079
17080         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
17081         than read for file header.
17082         * archive.cc (Archive::include_member): Likewise.
17083
17084 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
17085
17086         * aclocal.m4: Regenerate.
17087         * configure: Regenerate.
17088
17089 2008-04-19  Ian Lance Taylor  <iant@google.com>
17090
17091         * version.cc (version_string): Bump to 1.6.
17092
17093         * testsuite/Makefile.am (many_sections_r_test): New target.
17094         (many_sections_r_test_SOURCES): Remove.
17095         (many_sections_r_test_DEPENDENCIES): Remove.
17096         (many_sections_r_test_LDFLAGS): Remove.
17097         (many_sections_r_test_LDADD): Remove.
17098
17099         * object.cc (Sized_relobj::do_add_symbols): Always pass
17100         local_symbol_count_ to add_from_relobj.
17101
17102         * testsuite/Makefile.am (many_sections_check.h): Only check one in
17103         every thousand variables.
17104         * testsuite/Makefile.in: Rebuild.
17105
17106         * object.cc (Xindex::initialize_symtab_xindex): New function.
17107         (Xindex::read_symtab_xindex): New function.
17108         (Xindex::sym_xindex_to_shndx): New function.
17109         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
17110         available.
17111         (Sized_relobj::do_initialize_xindex): New function.
17112         (Sized_relobj::do_read_symbols): Adjust section links.
17113         (Sized_relobj::symbol_section_and_value): Add is_ordinary
17114         parameter.  Change all callers.
17115         (Sized_relobj::include_section_group): Adjust section links and
17116         symbol section indexes.
17117         (Sized_relobj::do_layout): Adjust section links.
17118         (Sized_relobj::do_count_local_symbols): Adjust section links and
17119         symbol section indexes.
17120         (Sized_relobj::do_finalize_local_symbols): Distinguish between
17121         ordinary and special symbols.
17122         (Sized_relobj::write_local_symbols): Add symtab_xindex and
17123         dynsym_xindex parameters.  Change all callers.  Adjust section
17124         links.  Use SHN_XINDEX when needed.
17125         (Sized_relobj::get_symbol_location_info): Adjust section links.
17126         Don't get fooled by special symbols.
17127         * object.h (class Xindex): Define.
17128         (class Object): Add xindex_ parameter.  Declare virtual functoin
17129         do_initialize_xindex.
17130         (Object::adjust_sym_shndx): New function.
17131         (Object::set_xindex): New protected function.
17132         (class Symbol_value): Add is_ordinary_shndx_ field.
17133         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
17134         (Symbol_value::value): Assert ordinary section.
17135         (Symbol_value::initialize_input_to_output_map): Likewise.
17136         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
17137         Change all callers.
17138         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
17139         all callers.
17140         (class Sized_relobj): Update declarations.
17141         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
17142         parameter.  Change all callers.
17143         (Sized_relobj::adjust_shndx): New function.
17144         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
17145         field.
17146         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
17147         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
17148         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
17149         (Sized_dynobj::read_dynsym_section): Adjust section links.
17150         (Sized_dynobj::read_dynamic): Likewise.
17151         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
17152         section links.
17153         (Sized_dynobj::do_initialize_xindex): New function.
17154         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
17155         do_initialize_xindex.
17156         (Sized_dynobj::adjust_shndx): New function.
17157         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
17158         dynsym_xindex_ fields.
17159         (Layout::finalize): Add a call to set_section_indexes before
17160         creating the symtab sections.
17161         (Layout::set_section_indexes): Don't do anything if the section
17162         already has a section index.
17163         (Layout::create_symtab_sections): Add shnum parameter.  Change
17164         caller.  Create .symtab_shndx section if needed.
17165         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
17166         caller.
17167         (Layout::allocated_output_section_count): New function.
17168         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
17169         needed.
17170         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
17171         fields.  Update declarations.
17172         (Layout::symtab_xindex): New function.
17173         (Layout::dynsym_xindex): New function.
17174         (class Write_symbols_task): Add layout_ field.
17175         (Write_symbols_task::Write_symbols_task): Add layout parameter.
17176         Change caller.
17177         * output.cc (Output_section_headers::Output_section_headers): Add
17178         shstrtab_section parameter.  Change all callers.
17179         (Output_section_headers::do_sized_write): Store overflow values
17180         for section count and section string table section index in
17181         section header zero.
17182         (Output_file_header::do_sized_write): Check for overflow of
17183         section count and section string table section index.
17184         (Output_symtab_xindex::do_write): New function.
17185         (Output_symtab_xindex::endian_do_write): New function.
17186         * output.h (class Output_section_headers): Add shstrtab_section_.
17187         Update declarations.
17188         (class Output_symtab_xindex): Define.
17189         (Output_section::has_out_shndx): New function.
17190         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
17191         field.
17192         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
17193         Change all callers.
17194         (Sized_symbol::init): Likewise.
17195         (Symbol::output_section): Check for ordinary symbol.
17196         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
17197         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
17198         callers.
17199         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
17200         Change all callers.  Simplify handling of symbols from sections
17201         not included in the link.
17202         (Symbol_table::add_from_dynobj): Handle ordinary symbol
17203         distinction.
17204         (Weak_alias_sorter::operator()): Assert that symbols are
17205         ordinary.
17206         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
17207         distinction.
17208         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
17209         parameters.  Change all callers.
17210         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
17211         symbol distinction.  Use SHN_XINDEX when needed.
17212         (Symbol_table::write_section_symbol): Add symtab_xindex
17213         parameter.  Change all callers.
17214         (Symbol_table::sized_write_section_symbol): Likewise.  Use
17215         SHN_XINDEX when needed.
17216         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
17217         declarations.
17218         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
17219         (Symbol::is_defined): Check is_ordinary.
17220         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
17221         (Symbol::is_absolute, Symbol::is_common): Likewise.
17222         (class Sized_symbol): Update declarations.
17223         (class Symbol_table): Update declarations.
17224         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
17225         parameters.  Change all callers.
17226         (Sized_symbol::override): Likewise.
17227         (Symbol_table::override): Likewise.
17228         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
17229         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
17230         is_ordinary, and orig_st_shndx parameters.  Change all callers.
17231         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
17232         to be in an ordinary section.
17233         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17234         object and is_ordinary parameters.  Change all callers.
17235         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17236         Change all callers.  Don't add undefined or non-ordinary symbols
17237         to reloc_map_.
17238         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17239         Change all callers.
17240         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17241         declarations.
17242         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17243         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17244         (Sized_relobj::relocate_sections): Likewise.
17245         * target-reloc.h (scan_relocs): Adjust section symbol index.
17246         (scan_relocatable_relocs): Likewise.
17247         * i386.cc (Scan::local): Check for ordinary symbols.
17248         * sparc.cc (Scan::local): Likewise.
17249         * x86_64.cc (Scan::local): Likewise.
17250         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17251         to symbol_section_and_value.
17252         * testsuite/many_sections_test.cc: New file.
17253         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17254         (check_PROGRAMS): Add many_sections_test.
17255         (many_sections_test_SOURCES): Define.
17256         (many_sections_test_DEPENDENCIES): Define.
17257         (many_sections_test_LDFLAGS): Define.
17258         (BUILT_SOURCES): Add many_sections_define.h.
17259         (many_sections_define.h): New target.
17260         (BUILT_SOURCES): Add many_sections_check.h.
17261         (many_sections_check.h): New target.
17262         (check_PROGRAMS): Add many_sections_r_test.
17263         (many_sections_r_test_SOURCES): Define.
17264         (many_sections_r_test_DEPENDENCIES): Define.
17265         (many_sections_r_test_LDFLAGS): Define.
17266         (many_sections_r_test_LDADD): Define.
17267         (many_sections_r_test.o): New target.
17268         * testsuite/Makefile.in: Rebuild.
17269
17270 2008-04-17  Cary Coutant  <ccoutant@google.com>
17271
17272         * errors.cc (Errors::info): New function.
17273         (gold_info): New function.
17274         * errors.h (Errors::info): New function.
17275         * gold.h (gold_info): New function.
17276         * object.cc (Input_objects::add_object): Print trace output.
17277         * options.cc (options::parse_set): New function.
17278         (General_options::parse_wrap): Deleted.
17279         (General_options::General_options): Deleted initializer.
17280         * options.h (options::String_set): New typedef.
17281         (options::parse_set): New function.
17282         (DEFINE_set): New macro.
17283         (General_options::wrap): Changed to use DEFINE_set. Changed
17284         callers of any_wrap_symbols and is_wrap_symbol.
17285         (General_options::trace, General_options::trace_symbol):
17286         New options.
17287         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17288         (General_options::wrap_symbols_): Deleted.
17289         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17290
17291 2008-04-17  David S. Miller  <davem@davemloft.net>
17292
17293         * options.cc (General_options::parse_V): New function.
17294         * options.h: Add entries for -V and -Qy.
17295
17296 2008-04-17  Ian Lance Taylor  <iant@google.com>
17297
17298         * common.cc (Symbol_table::allocate_commons): Remove options
17299         parameter.  Change caller.
17300         (Symbol_table::do_allocate_commons): Remove options parameter.
17301         Change caller.  Just call do_allocate_commons_list twice.
17302         (Symbol_table::do_allocate_commons_list): New function, broken out
17303         of do_allocate_commons.
17304         * common.h (class Allocate_commons_task): Remove options_ field.
17305         Update constructor.
17306         * symtab.cc (Symbol_table::Symbol_table): Initialize
17307         tls_commons_.
17308         (Symbol_table::add_from_object): Put TLS common symbols on
17309         tls_commons_ list.
17310         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17311         which are IN_OUTPUT_DATA.
17312         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17313         allocate_commons and do_allocate_commons declarations.  Declare
17314         do_allocate_commons_list.
17315         * gold.cc (queue_middle_tasks): Update creation of
17316         Allocate_commons_task to not pass options.
17317         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17318         (TLS_TEST_C_FLAGS): New variable.
17319         (tls_test_c_pic.o): New target.
17320         (tls_test_shared.so): Link in tls_test_c_pic.o.
17321         (tls_test_c_pic_ie.o): New target.
17322         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17323         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17324         (tls_test_c.o): New target.
17325         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17326         (tls_pic_test_LDADD): Likewise.
17327         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17328         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17329         (tls_test_c_gnu2.o): New target.
17330         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17331         tls_test_c_gnu2.o.
17332         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17333         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17334         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17335         * testsuite/tls_test.cc: Include "config.h".
17336         (t_last): Call t11_last.
17337         * testsuite/tls_test.h (t11, t11_last): Declare.
17338         * testsuite/tls_test_c.c: New file.
17339         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17340         * configure.ac: Check for OpenMP support.
17341         * configure, config.in, Makefile.in: Rebuild.
17342         * testsuite/Makefile.in: Rebuild.
17343
17344 2008-04-16  Cary Coutant  <ccoutant@google.com>
17345
17346         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17347         (Target_i386::tls_base_symbol_defined_): New field.
17348         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17349         (Target_i386::Scan::global): Likewise.
17350         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17351         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17352         (Target_x86_64::tls_base_symbol_defined_): New field.
17353         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17354         (Target_x86_64::Scan::global): Likewise.
17355
17356 2008-04-16  Cary Coutant  <ccoutant@google.com>
17357
17358         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17359         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17360         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17361         building shared libraries.
17362         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17363         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17364         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17365         * testsuite/Makefile.in: Rebuild.
17366         * testsuite/weak_undef.h: New file.
17367         * testsuite/weak_undef_file1.cc: Add extra test cases.
17368         * testsuite/weak_undef_file2.cc: Likewise.
17369         * testsuite/weak_undef_test.cc: Likewise.
17370
17371 2008-04-16  David S. Miller  <davem@davemloft.net>
17372
17373         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17374         Add issued_non_pic_error_ field.  Declare check_non_pic.
17375         (Target_sparc::Scan::check_non_pic): New function.
17376         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17377         (Target_sparc::Scan::global): Likewise.
17378
17379         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17380         * configure: Rebuild.
17381
17382         * options.h (DEFINE_enable): New macro.
17383         (new_dtags): New enable option.
17384         (initfirst, interpose, loadfltr, nodefaultlib,
17385         nodelete, nodlopen, nodump): New -z options.
17386         * layout.cc (Layout:finish_dynamic_section): If new
17387         dtags enabled, emit DT_RUNPATH.  Also, emit a
17388         DT_FLAGS_1 containing any specified -z flags.
17389
17390 2008-04-16  Ian Lance Taylor  <iant@google.com>
17391
17392         * copy-relocs.cc: New file.
17393         * copy-relocs.h: New file.
17394         * reloc.cc: Remove Copy_relocs code.
17395         * reloc.h: Likewise.
17396         * reloc-types.h (struct Reloc_types) [both versions]: Add
17397         get_reloc_addend_noerror.
17398         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17399         variants of add_global which take an addend which must be zero.
17400         * i386.cc: Include "copy-relocs.h".
17401         (class Target_i386): Change type of copy_relocs_ to variable,
17402         update initializer.
17403         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17404         Change all callers.
17405         (Target_i386::do_finalize_sections): Change handling of
17406         copy_relocs_.
17407         * sparc.cc: Include "copy-relocs.h".
17408         (class Target_sparc): Change type of copy_relocs_ to variable,
17409         update initializer.
17410         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17411         Change all callers.
17412         (Target_sparc::do_finalize_sections): Change handling of
17413         copy_relocs_.
17414         * x86_64.cc: Include "copy-relocs.h".
17415         (class Target_x86_64): Change type of copy_relocs_ to variable,
17416         update initializer.
17417         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17418         class.  Change all callers.
17419         (Target_x86_64::do_finalize_sections): Change handling of
17420         copy_relocs_.
17421         * Makefile.am (CCFILES): Add copy-relocs.cc.
17422         (HFILES): Add copy-relocs.h.
17423
17424         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17425
17426         * testsuite/script_test_4.sh: Permit leading zeroes.
17427
17428 2008-04-15  Ian Lance Taylor  <iant@google.com>
17429
17430         * script-sections.cc (Script_sections::create_segments): Use
17431         header_size_adjustment even when there is enough room for the
17432         headers.
17433         * testsuite/script_test_4.sh: New file.
17434         * testsuite/script_test_4.t: New file.
17435         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17436         (check_DATA): Add script_test_4.stdout.
17437         (MOSTLYCLEANFILES): Likewise.
17438         (script_test_4): New target.
17439         (script_test_4.stdout): New target.
17440         * testsuite/Makefile.in: Rebuild.
17441
17442         * sparc.cc: Add definitions for Output_data_plt_sparc class
17443         constants.
17444
17445 2008-04-14  David S. Miller  <davem@davemloft.net>
17446
17447         * sparc.cc: New file.
17448         * Makefile.am (TARGETSOURCES): Add sparc.cc
17449         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17450         * configure.tgt: Document targ_extra_size and
17451         targ_extra_big_endian.  Add entries for sparc-* and
17452         sparc64-*.
17453         * configure.ac: Handle targ_extra_size and
17454         targ_extra_big_endian.
17455         * Makefile.in: Rebuild.
17456         * configure: Likewise.
17457         * po/POTFILES.in: Likewise.
17458         * po/gold.pot: Likewise.
17459
17460 2008-04-14  Ian Lance Taylor  <iant@google.com>
17461
17462         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17463         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17464         in the name/type/flags to section mapping.  Don't call
17465         allocate_output_section.
17466         (Layout::choose_output_section): Change parameter from adjust_name
17467         to is_input_section.  Don't permit input sections after sections
17468         are attached to segments.  Don't call allocate_output_section.
17469         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17470         not write_enable_output_section.
17471         (Layout::make_output_section): Don't push to
17472         unattached_section_list_ nor call attach_to_segment.  Call
17473         attach_section_to_segment if sections are attached.
17474         (Layout::attach_sections_to_segments): New function.
17475         (Layout::attach_section_to_segment): New function.
17476         (Layout::attach_allocated_section_to_segment): Rename from
17477         attach_to_segment.  Remove flags parameter.
17478         (Layout::allocate_output_section): Remove function.
17479         (Layout::write_enable_output_section): Remove function.
17480         * layout.h (class Layout): Update for above changes.  Add new
17481         field sections_are_attached_.
17482         * output.h (Output_section::update_flags_for_input_section): New
17483         function.
17484         * output.cc (Output_section::add_input_section): Call
17485         update_flags_for_input_section.
17486         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17487
17488 2008-04-11  Cary Coutant  <ccoutant@google.com>
17489
17490         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17491         thought unnecessary.
17492         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17493
17494 2008-04-11  Ian Lance Taylor  <iant@google.com>
17495
17496         * output.h (class Output_section_data): Remove inline definition
17497         of set_addralign.
17498         * output.cc (Output_section_data::set_addralign): New function.
17499
17500 2008-04-11  Cary Coutant  <ccoutant@google.com>
17501
17502         Add support for TLS descriptors for i386 and x86_64.
17503         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17504         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17505         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17506         GOT_TYPE_TLS_DESC.
17507         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17508         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17509         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17510         relocations.
17511         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17512         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17513         Fix problem with initial-exec relocations.
17514         (Target_i386::Relocate::relocate_tls): Likewise.
17515         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17516         relaxation.
17517         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17518         support for section-plus-offset dynamic table entries.
17519         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17520         (Output_data_dynamic::Dynamic_entry): Add support for
17521         section-plus-offset dynamic table entries.
17522         (Output_data_dynamic::Classification): Likewise.
17523         (Output_data_dynamic::classification_): Renamed offset_.
17524         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17525         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17526         (Target_x86_64::make_plt_section): New function.
17527         (Target_x86_64::reserve_tlsdesc_entries): New function.
17528         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17529         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17530         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17531         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17532         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17533         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17534         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17535         add extra PLT entry for TLS descriptors.
17536         (Output_data_plt_x86_64::got_): New field.
17537         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17538         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17539         fields.
17540         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17541         descriptors.
17542         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17543         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17544         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17545         R_386_TLS_DESC_CALL relocations.
17546         (Target_x86_64::Scan::global): Likewise.
17547         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17548         for TLS descriptors.
17549         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17550         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17551         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17552         GD-to-IE relaxation.
17553         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17554         and TLS_DESCRIPTORS.
17555         * Makefile.in: Rebuild.
17556         * configure: Rebuild.
17557         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17558         (tls_test_shared2.so): New target.
17559         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17560         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17561         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17562         (tls_shared_gd_to_ie_test_LDADD): New variable.
17563         (tls_shared_gnu2_gd_to_ie_test): New target.
17564         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17565         New targets.
17566         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17567         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17568         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17569         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17570         (tls_shared_gnu2_test): New target.
17571         (tls_test_gnu2_shared.so): New target.
17572         (tls_shared_gnu2_test_SOURCES): New variable.
17573         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17574         (tls_shared_gnu2_test_LDFLAGS): New variable.
17575         (tls_shared_gnu2_test_LDADD): New variable.
17576         * testsuite/Makefile.in: Rebuild.
17577         * testsuite/Makefile.
17578
17579 2008-04-11  Ian Lance Taylor  <iant@google.com>
17580
17581         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17582         justsyms.t.
17583         * testsuite/Makefile.in: Rebuild.
17584
17585         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17586         long.
17587         * testsuite/script_test_2.cc (main): Adjust test.
17588
17589 2008-04-11  David S. Miller  <davem@davemloft.net>
17590             Ian Lance Taylor  <iant@google.com>
17591
17592         * options.h (General_options): Add entries for '-Y' and
17593         '-relax'.
17594         * options.cc (General_options:finalize): If -Y was used, add those
17595         entries to the library path instead of the default "/lib" and
17596         "/usr/lib".
17597
17598 2008-04-11  David S. Miller  <davem@davemloft.net>
17599
17600         * testsuite/justsyms.t: Start at 0x100.
17601         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17602         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17603         long.
17604         * testsuite/script_test_2.cc: Adjust string and section length
17605         checks.
17606
17607 2008-04-09  Ian Lance Taylor  <iant@google.com>
17608
17609         PR gold/5996
17610         * script-sections.cc (Sections_element::allocate_to_segment): Add
17611         orphan parameter.
17612         (Output_section_definition::allocate_to_segment): Likewise.
17613         (Orphan_output_section::allocate_to_segment): Likewise.
17614         (Script_sections::attach_sections_using_phdrs_clause): Don't
17615         propagate non-PT_LOAD segments to orphan sections.
17616         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17617         readelf rather than objdump.
17618         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17619         .interp section and PT_INTERP segment are the same size.
17620         * testsuite/Makefile.in: Rebuild.
17621
17622         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17623         aliases for symbols defined in the same object.
17624         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17625         (weak_alias_test_SOURCES): New variable.
17626         (weak_alias_test_DEPENDENCIES): New variable.
17627         (weak_alias_test_LDFLAGS): New variable.
17628         (weak_alias_test_LDADD): New variable.
17629         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17630         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17631         (weak_alias_test_3.o): New target.
17632         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17633         * testsuite/weak_alias_test_main.cc: New file.
17634         * testsuite/weak_alias_test_1.cc: New file.
17635         * testsuite/weak_alias_test_2.cc: New file.
17636         * testsuite/weak_alias_test_3.cc: New file.
17637
17638 2008-04-08  Ian Lance Taylor  <iant@google.com>
17639
17640         * options.h (class General_options): Add --noinhibit-exec option.
17641         * main.cc (main): Check --noinhibit-exec.
17642
17643         * options.h (class General_options): Define --wrap as a special
17644         option.  Add wrap_symbols_ field.
17645         (General_options::any_wrap_symbols): New function.
17646         (General_options::is_wrap_symbol): New function.
17647         * options.cc (General_options::parse_wrap): New function.
17648         (General_options::General_options): Initialize wrap_symbols_.
17649         * symtab.cc (Symbol_table::wrap_symbol): New function.
17650         (Symbol_table::add_from_object): Handle --wrap.
17651         * symtab.h (class Symbol_table): Declare wrap_symbol.
17652         * target.h (Target::wrap_char): New function.
17653         (Target::Target_info): Add wrap_char field.
17654         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17655         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17656         * testsuite/testfile.cc (Target_test::test_target_info):
17657         Likewise.
17658
17659         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17660         there is one.
17661
17662         * layout.h (class Layout): Add added_eh_frame_data_ field.
17663         * layout.cc (Layout::Layout): Initialize new field.
17664         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17665         output section until we find a section we merged successfully.
17666         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17667         that the size be non-zero.
17668
17669         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17670         qualifier.
17671
17672 2008-04-08  Craig Silverstein  <csilvers@google.com>
17673
17674         * configure.ac: Export new conditional variable HAVE_ZLIB.
17675         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17676         on HAVE_ZLIB.
17677         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17678         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17679
17680 2008-04-07  Ian Lance Taylor  <iant@google.com>
17681
17682         * version.cc (version_string): Set to "1.5".
17683
17684         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17685         Add issued_non_pic_error_ field.  Declare check_non_pic.
17686         (Target_x86_64::Scan::check_non_pic): New function.
17687         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17688         (Target_x86_64::Scan::global): Likewise.
17689
17690         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17691         addend parameter.  Change caller.  Handle merge sections.
17692         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17693         Address to Addend.  Don't add in the result of
17694         local_section_offset, pass down the addend and use the returned
17695         value.
17696         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17697         Update declarations of local_section_offset and symbol_value.
17698         * testsuite/two_file_test_1.cc (t18): New function.
17699         * testsuite/two_file_test_2.cc (f18): New function.
17700         * testsuite/two_file_test_main.cc (main): Call t18.
17701         * testsuite/two_file_test.h (t18, f18): Declare.
17702
17703         * configure.ac: Don't test for objdump, c++filt, or readelf.
17704         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17705         conditionals.
17706         (TEST_READELF): New variable.
17707         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17708         (check_PROGRAMS): Add two_file_strip_test.
17709         (two_file_strip_test): New target.
17710         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17711         (two_file_same_shared_strip_test_SOURCES): New variable.
17712         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17713         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17714         (two_file_same_shared_strip_test_LDADD): New variable.
17715         (two_file_shared_strip.so): New target.
17716         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17717         (ver_test_5.syms, ver_test_7.syms): Likewise.
17718         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17719         (strip_test_3.stdout): Use TEST_OBJDUMP.
17720         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17721
17722 2008-04-04  Cary Coutant  <ccoutant@google.com>
17723
17724         * symtab.h (Symbol::is_weak_undefined): New function.
17725         (Symbol::is_strong_undefined): New function.
17726         (Symbol::is_absolute): New function.
17727         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17728         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17729         absolute symbols.
17730         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17731         (weak_undef_test): New target.
17732         * testsuite/Makefile.in: Rebuild.
17733         * testsuite/weak_undef_file1.cc: New file.
17734         * testsuite/weak_undef_file2.cc: New file.
17735         * testsuite/weak_undef_test.cc: New file.
17736
17737 2008-04-03  Craig Silverstein  <csilvers@google.com>
17738
17739         * compressed_output.h (class Output_compressed_section): Use
17740         unsigned buffer.
17741         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17742         add zlib header.
17743         (zlib_compressed_suffix): Removed.
17744         (Output_compressed_section::set_final_data_size): Use unsigned
17745         buffers.
17746         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17747         Fix linker invocation.
17748         (flagstest_o_specialfile_and_compress_debug_sections):
17749         Likewise.
17750         * testsuite/Makefile.in: Regenerated.
17751
17752 2008-04-02  David S. Miller  <davem@davemloft.net>
17753
17754         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17755         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17756
17757 2008-04-02  Craig Silverstein  <csilvers@google.com>
17758
17759         * TODO: New file.
17760
17761 2008-04-02  Ian Lance Taylor  <iant@google.com>
17762
17763         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17764         parameters.  Update for new key type to views_.  Change all
17765         callers.
17766         (File_read::read): Adjust for byteshift in returned view.
17767         (File_read::add_view): New function, broken out of
17768         find_and_make_view.
17769         (File_read::make_view): New function, broken out of
17770         find_and_make_view.
17771         (File_read::find_or_make_view): Add offset and aligned
17772         parameters.  Rewrite accordingly.  Change all callers.
17773         (File_read::get_view): Add offset and aligned parameters.  Adjust
17774         for byteshift in return value.
17775         (File_read::get_lasting_view): Likewise.
17776         * fileread.h (class File_read): Update declarations.
17777         (class File_read::View): Add byteshift_ field.  Add byteshift to
17778         constructor.  Add byteshift method.
17779         * archive.h (Archive::clear_uncached_views): New function.
17780         (Archive::get_view): Add aligned parameter.  Change all callers.
17781         * object.h (Object::get_view): Add aligned parameter.  Change all
17782         callers.
17783         (Object::get_lasting_view): Likewise.
17784
17785         * fileread.cc (File_read::release): Don't call clear_views if
17786         there are multiple objects.
17787         * fileread.h (File_read::clear_uncached_views): New function.
17788         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17789         on the archive.
17790
17791 2008-03-31  Cary Coutant  <ccoutant@google.com>
17792
17793         Add thin archive support.
17794         * archive.cc (Archive::armagt): New const.
17795         (Archive::setup): Remove task parameter and calls to unlock.
17796         (Archive::unlock_nested_archives): New function.
17797         (Archive::read_header): Add nested_off parameter. Change
17798         all callers.
17799         (Archive::interpret_header): Likewise.
17800         (Archive::include_all_members): Change to handle thin
17801         archives.
17802         (Archive::include_member): Likewise.
17803         * archive.h (Archive::Archive): Add new parameters and
17804         initializers.
17805         (Archive::armagt): New const.
17806         (Archive::setup): Remove task parameter.
17807         (Archive::unlock_nested_archives): New function.
17808         (Archive::read_header): Add nested_off parameter.
17809         (Archive::interpret_header): Likewise.
17810         (Archive::Nested_archive_table): New typedef.
17811         (Archive::is_thin_archive_): New field.
17812         (Archive::nested_archives_): New field.
17813         (Archive::options_): New field.
17814         (Archive::dirpath_): New field.
17815         (Archive::task_): New field.
17816         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17817         for thin archives.  Pass additional parameters to
17818         Archive::Archive.  Unlock the archive file after calling
17819         Archive::setup.
17820
17821 2008-03-29  Ian Lance Taylor  <iant@google.com>
17822
17823         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17824         version symbol to be local.
17825         * testsuite/ver_test_4.sh: New file.
17826         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17827         (check_DATA): Add ver_test_4.syms.
17828         (ver_test_4.syms): New target.
17829         * testsuite/Makefile.in: Rebuild.
17830
17831         * output.cc
17832         (Output_section::Input_section_sort_entry::has_priority): New
17833         function.
17834         (Output_section::Input_section_sort_entry::match_file_name): New
17835         function.
17836         (Output_section::Input_section_sort_entry::match_section_name):
17837         Remove.
17838         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17839         Remove.
17840         (Output_section::Input_section_sort_entry::match_section_file):
17841         Remove.
17842         (Output_section::Input_section_sort_compare::operator()): Rewrite
17843         using new Input_section_sort_entry functions.  Sort crtbegin and
17844         crtend first.  Sort sections with no priority before sections with
17845         a priority.
17846         * testsuite/initpri1.c (d3): Check j != 4.
17847         (cd5): New constructor/destructor function.
17848         (main): Check j != 2.
17849
17850         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17851         new symbol when resolving, don't call set_is_default.
17852         * testsuite/ver_test_7.cc: New file.
17853         * testsuite/ver_test_7.sh: New file.
17854         * testsuite/Makefile.am (ver_test_7.so): New target.
17855         (ver_test_7.o): New target.
17856         (check_SCRIPTS): Add ver_test_7.sh.
17857         (check_DATA): Add ver_test_7.syms.
17858         (ver_test_7.syms): New target.
17859
17860 2008-03-28  Ian Lance Taylor  <iant@google.com>
17861
17862         * layout.cc (Layout::layout): If we see an input section with a
17863         name that needs sorting, set the must_sort flag for the output
17864         section.
17865         (Layout::make_output_section): If the name of the output section
17866         indicates that it might require sorting, set the may_sort flag.
17867         * output.h (Output_section::may_sort_attached_input_sections): New
17868         function.
17869         (Output_section::set_may_sort_attached_input_sections): New
17870         function.
17871         (Output_section::must_sort_attached_input_sections): New
17872         function.
17873         (Output_section::set_must_sort_attached_input_sections): New
17874         function.
17875         (class Output_section): Declare Input_section_sort_entry.  Define
17876         Input_section_sort_compare.  Declare
17877         sort_attached_input_sections.  Add new fields:
17878         may_sort_attached_input_sections_,
17879         must_sort_attached_input_sections_,
17880         attached_input_sections_are_sorted_.
17881         * output.cc (Output_section::Output_section): Initialize new
17882         fields.
17883         (Output_section::add_input_section): Add an entry to
17884         input_sections_ if may_sort or must_sort are true.
17885         (Output_section::set_final_data_size): Call
17886         sort_attached_input_sections if necessary.
17887         (Output_section::Input_section_sort_entry): Define new class.
17888         (Output_section::Input_section_sort_compare::operator()): New
17889         function.
17890         (Output_section::sort_attached_input_sections): New function.
17891         * configure.ac: Check whether the compiler supports constructor
17892         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17893         * testsuite/initpri1.c: New file.
17894         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17895         CONSTRUCTOR_PRIORITY.
17896         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17897         (initpri1_LDFLAGS): New variable.
17898         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17899
17900 2008-03-27  Ian Lance Taylor  <iant@google.com>
17901
17902         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17903         * testsuite/common_test_1.c: New file.
17904         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17905         (common_test_1_SOURCES): New variable.
17906         (common_test_1_DEPENDENCIES): New variable.
17907         (common_test_1_LDFLAGS): New variable.
17908
17909         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17910         and commons_ correctly when NAME/VERSION does not override
17911         NAME/NULL.
17912         * testsuite/ver_test_6.c: New file.
17913         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17914         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17915         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17916
17917 2008-03-26  Ian Lance Taylor  <iant@google.com>
17918
17919         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17920         of an undefined symbol from a version script.
17921         * testsuite/Makefile.am (ver_test_5.so): New target.
17922         (ver_test_5.o): New target.
17923         (check_SCRIPTS): Add ver_test_5.sh.
17924         (check_DATA): Add ver_test_5.syms.
17925         (ver_test_5.syms): New target.
17926         * testsuite/ver_test_5.cc: New file.
17927         * testsuite/ver_test_5.script: New file.
17928         * testsuite/ver_test_5.sh: New file.
17929         * Makefile.in, testsuite/Makefile.in: Rebuild.
17930
17931         PR gold/5986
17932         Fix problems building gold with gcc 4.3.0.
17933         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17934         (gold_error_at_location, gold_warning_at_location): Use it.
17935         * configure.ac: Check whether we can compile and use a template
17936         function with a printf attribute.
17937         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17938         when jumping over bytes.
17939         * object.cc: Instantiate Object::read_section_data.
17940         * debug.h: Include <cstring>
17941         * dwarf_reader.cc: Include <algorithm>
17942         * main.cc: Include <cstring>.
17943         * options.cc: Include <cstring>.
17944         * output.cc: Include <cstring>.
17945         * script.cc: Include <cstring>.
17946         * script.h: Include <string>.
17947         * symtab.cc: Include <cstring> and <algorithm>.
17948         * target-select.cc: Include <cstring>.
17949         * version.cc: Include <string>.
17950         * testsuite/testmain.cc: Include <cstdlib>.
17951         * configure, config.in: Rebuild.
17952
17953 2008-03-25  Ian Lance Taylor  <iant@google.com>
17954
17955         * options.cc: Include "../bfd/bfdver.h".
17956         (options::help): Print bug reporting address.
17957
17958         * version.cc (print_version): Adjust output for current value of
17959         BFD_VERSION_STRING.
17960
17961         * NEWS: New file.
17962
17963         * options.cc (options::help): Print list of supported targets.
17964         * target-select.h: Include <vector>.
17965         (class Target_selector): Make machine_, size_, and is_big_endian_
17966         fields const.  Add bfd_name_ and instantiated_target_ fields.
17967         (Target_selector::Target_selector): Add bfd_name parameter.
17968         (Target_selector::recognize): Make non-virtual, call
17969         do_recognize.
17970         (Target_selector::recognize_by_name): Make non-virtual, call
17971         do_recognize_by_name.
17972         (Target_selector::supported_names): New function.
17973         (Target_selector::bfd_name): New function.
17974         (Target_selector::do_instantiate_target): New pure virtual
17975         function.
17976         (Target_selector::do_recognize): New virtual function.
17977         (Target_selector::do_recognize_by_name): New virtual function.
17978         (Target_selector::instantiate_target): New private function.
17979         (supported_target_names): Declare.
17980         * target-select.cc (Target_selector::Target_selector): Update for
17981         new parameter and fields.
17982         (select_target_by_name): Check that the name matches before
17983         calling recognize_by_name.
17984         (supported_target_names): New function.
17985         * i386.cc (class Target_selector_i386): Update Target_selector
17986         constructor call.  Remove recognize and recognize_by_name.  Add
17987         do_instantiate_target.
17988         * x86_64.cc (class Target_selector_x86_64): Likewise.
17989         * testsuite/testfile.cc (class Target_selector_test): Update for
17990         changes to Target_selector.
17991
17992         * README: Rewrite, with some notes on unsupported features.
17993
17994 2008-03-24  Cary Coutant  <ccoutant@google.com>
17995
17996         * i386.cc (Target_i386::Got_type): New enum declaration.
17997         (Target_i386::Scan::local): Updated callers of Output_data_got
17998         member functions.
17999         (Target_i386::Scan::global): Likewise.
18000         (Target_i386::Relocate::relocate): Likewise.
18001         (Target_i386::Relocate::relocate_tls): Likewise.
18002         * object.h (Got_offset_list): New class.
18003         (Sized_relobj::local_has_got_offset): Added got_type parameter.
18004         (Sized_relobj::local_got_offset): Likewise.
18005         (Sized_relobj::set_local_got_offset): Likewise.
18006         (Sized_relobj::local_has_tls_got_offset): Removed.
18007         (Sized_relobj::local_tls_got_offset): Removed.
18008         (Sized_relobj::set_local_tls_got_offset): Removed.
18009         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
18010         * output.cc (Output_data_got::add_global): Added got_type parameter.
18011         (Output_data_got::add_global_with_rel): Likewise.
18012         (Output_data_got::add_global_with_rela): Likewise.
18013         (Output_data_got::add_global_pair_with_rel): New function.
18014         (Output_data_got::add_global_pair_with_rela): New function.
18015         (Output_data_got::add_local): Added got_type parameter.
18016         (Output_data_got::add_local_with_rel): Likewise.
18017         (Output_data_got::add_local_with_rela): Likewise.
18018         (Output_data_got::add_local_pair_with_rel): New function.
18019         (Output_data_got::add_local_pair_with_rela): New function.
18020         (Output_data_got::add_global_tls): Removed.
18021         (Output_data_got::add_global_tls_with_rel): Removed.
18022         (Output_data_got::add_global_tls_with_rela): Removed.
18023         (Output_data_got::add_local_tls): Removed.
18024         (Output_data_got::add_local_tls_with_rel): Removed.
18025         (Output_data_got::add_local_tls_with_rela): Removed.
18026         * output.h (Output_data_got::add_global): Added got_type parameter.
18027         (Output_data_got::add_global_with_rel): Likewise.
18028         (Output_data_got::add_global_with_rela): Likewise.
18029         (Output_data_got::add_global_pair_with_rel): New function.
18030         (Output_data_got::add_global_pair_with_rela): New function.
18031         (Output_data_got::add_local): Added got_type parameter.
18032         (Output_data_got::add_local_with_rel): Likewise.
18033         (Output_data_got::add_local_with_rela): Likewise.
18034         (Output_data_got::add_local_pair_with_rel): New function.
18035         (Output_data_got::add_local_pair_with_rela): New function.
18036         (Output_data_got::add_global_tls): Removed.
18037         (Output_data_got::add_global_tls_with_rel): Removed.
18038         (Output_data_got::add_global_tls_with_rela): Removed.
18039         (Output_data_got::add_local_tls): Removed.
18040         (Output_data_got::add_local_tls_with_rel): Removed.
18041         (Output_data_got::add_local_tls_with_rela): Removed.
18042         * resolve.cc (Symbol::override_base_with_special): Removed
18043         reference to has_got_offset_ field.
18044         * symtab.cc (Symbol::init_fields): Replaced initialization
18045         of got_offset_ with got_offsets_.  Removed initialization
18046         of has_got_offset_
18047         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
18048         (Symbol::got_offset): Likewise.
18049         (Symbol::set_got_offset): Likewise.
18050         (Symbol::has_tls_got_offset): Removed.
18051         (Symbol::tls_got_offset): Removed.
18052         (Symbol::set_tls_got_offset): Removed.
18053         (Symbol::got_offset_): Removed.
18054         (Symbol::tls_mod_got_offset_): Removed.
18055         (Symbol::tls_pair_got_offset_): Removed.
18056         (Symbol::got_offsets_): New field.
18057         (Symbol::has_got_offset): Removed.
18058         (Symbol::has_tls_mod_got_offset): Removed.
18059         (Symbol::has_tls_pair_got_offset): Removed.
18060         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
18061         (Target_x86_64::Scan::local): Updated callers of Output_data_got
18062         member functions.
18063         (Target_x86_64::Scan::global): Likewise.
18064         (Target_x86_64::Relocate::relocate): Likewise.
18065         (Target_x86_64::Relocate::relocate_tls): Likewise.
18066
18067 2008-03-25  Ben Elliston  <bje@au.ibm.com>
18068
18069         * yyscript.y: Fix spelling error in comment.
18070
18071 2008-03-24  Ian Lance Taylor  <iant@google.com>
18072
18073         * options.h (class General_options): Define build_id option.
18074         * layout.h (class Layout): Declare write_build_id, create_note,
18075         create_build_id.  Add build_id_note_ member.
18076         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
18077         "libiberty.h", "md5.h", "sha1.h".
18078         (Layout::Layout): Initialize eh_frame_data_,
18079         eh_frame_hdr_section_, and build_id_note_.
18080         (Layout::finalize): Call create_build_id.
18081         (Layout::create_note): New function, broken out of
18082         Layout::create_gold_note.
18083         (Layout::create_gold_note): Call create_note.
18084         (Layout::create_build_id): New function.
18085         (Layout::write_build_id): New function.
18086         (Close_task_runner::run): Call write_build_id.
18087
18088         * x86_64.cc: Correct license to GPLv3.
18089
18090 2008-03-23  Ian Lance Taylor  <iant@google.com>
18091
18092         * options.cc: Include "demangle.h".
18093         (parse_optional_string): New function.
18094         (parse_long_option): Handle takes_optional_argument.
18095         (parse_short_option): Update dash_z initializer.  Handle
18096         takes_optional_argument.
18097         (General_options::General_options): Initialize do_demangle_.
18098         (General_options::finalize): Set do_demangle_.  Handle demangling
18099         style.
18100         * options.h (parse_optional_string): Declare.
18101         (struct One_option): Add optional_arg field.  Update constructor.
18102         Update call constructor calls.  Add takes_optional_argument
18103         function.
18104         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
18105         (DEFINE_optional_string): Define.
18106         (General_options::demangle): Change from DEFINE_bool to
18107         DEFINE_optional_string.
18108         (General_options::no_demangle): New function.
18109         (General_options::do_demangle): New function.
18110         (General_options::set_do_demangle): New function.
18111         (General_options::execstack_status_): Move definition to end of
18112         class definition.
18113         (General_options::static_): Likewise.
18114         (General_options::do_demangle_): New field.
18115         * object.cc (big_endian>::get_symbol_location_info): Call
18116         Options::do_demangle, not Options::demangle.
18117         * symtab.cc (demangle): Likewise.
18118
18119 2008-03-22  Ian Lance Taylor  <iant@google.com>
18120
18121         * gold.h: Include <cstddef> and <sys/types.h>
18122         * options.h: Include <cstring>.
18123
18124 2008-03-21  Ian Lance Taylor  <iant@google.com>
18125
18126         * Added source code to GNU binutils.
18127 \f
18128 Copyright (C) 2008-2015 Free Software Foundation, Inc.
18129
18130 Copying and distribution of this file, with or without modification,
18131 are permitted in any medium without royalty provided the copyright
18132 notice and this notice are preserved.
18133
18134 Local Variables:
18135 mode: change-log
18136 left-margin: 8
18137 fill-column: 74
18138 version-control: never
18139 End: