gold/
[external/binutils.git] / gold / ChangeLog
1 2012-10-23  Cary Coutant  <ccoutant@google.com>
2
3         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4         abbrev_shndx.
5         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
6         abbrev_shndx_.
7         (Dwarf_info_reader::set_abbrev_shndx): New method.
8         (Dwarf_info_reader::abbrev_shndx_): New data member.
9
10 2012-10-23  Cary Coutant  <ccoutant@google.com>
11
12         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
13         from object, not parameters.
14         (Dwarf_info_reader::parse): Likewise.
15         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
16         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
17         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
18         methods.
19
20 2012-10-23  Cary Coutant  <ccoutant@google.com>
21
22         * fileread.cc (Input_file::Input_file): New constructor.
23         * fileread.h (class Input_file): Add new constructor.
24
25 2012-10-18  Alan Modra  <amodra@gmail.com>
26
27         PR gold/14727
28         * object.cc (Relobj::is_section_name_included): Also match
29         .sdata personality section.
30
31 2012-10-18  Alan Modra  <amodra@gmail.com>
32
33         * target-reloc.h (class Default_comdat_behavior): New, package up..
34         (get_comdat_behaviour): ..this.
35         (relocate_section): Add Relocate_comdat_behavior template arg,
36         adjust code to suit.
37         * arm.cc (Target_arm::relocate_section): Adjust to suit.
38         (Target_arm::scan_reloc_section): Likewise.
39         * i386.cc (Target_i386::relocate_section): Likewise.
40         * sparc.cc (Target_sparc::relocate_section): Likewise.
41         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
42         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
43         * powerpc.cc (class Relocate_comdat_behavior): New.
44         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
45         gold::relocate_section with new template arg.
46
47 2012-10-18  Alan Modra  <amodra@gmail.com>
48
49         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
50         dynamic relocs for GOT_TPREL got entries, without symbol if
51         resolving locally.
52         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
53         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
54         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
55
56 2012-10-17  Alan Modra  <amodra@gmail.com>
57
58         PR gold/14726
59         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
60
61 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
62
63         * layout.cc (Layout::include_section): Keep sections marked
64         SHF_EXCLUDE when doing relocatable links.
65
66 2012-10-16  Alan Modra  <amodra@gmail.com>
67
68         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
69         (Target_powerpc::do_finalize_sections): Call it.
70         (Output_data_save_res): New class and supporting functions.
71         (Target_powerpc::symval_for_branch): Only look up .opd entry for
72         normal symbols defined in object files.
73
74 2012-10-12  Alan Modra  <amodra@gmail.com>
75
76         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
77         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
78         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
79         section if scan_opd_relocs not yet called.
80         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
81
82 2012-10-12  Alan Modra  <amodra@gmail.com>
83
84         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
85         add_local_ifunc_entry): Revert last change.
86         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
87
88 2012-10-05  Alan Modra  <amodra@gmail.com>
89
90         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
91         do_plt_address_for_global): New functions.
92         (Output_data_got_powerpc::do_write): Don't segfault when linking
93         statically.
94         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
95         add_local_ifunc_entry): Return true on adding entry..
96         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
97         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
98         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
99         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
100         set up symbols here.
101         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
102         syms here.  Do so even when no .iplt.  Don't segfault when linking
103         statically.
104         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
105         new variants without reloc param.
106         (Glink_sym_ent::Glink_sym_ent): Likewise.
107         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
108         reloc when refs will resolve to plt call stub.
109         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
110         R_PPC_PLTREL24 to resolve locally.
111         (Target_powerpc::Scan::global): Correct ifunc handling.
112         (Target_powerpc::Relocate::relocate): Correct local sym glink
113         lookup.  Don't destroy "value" when we have a plt call stub,
114         and when checking plt call validity.
115         (Target_powerpc::do_dynsym_value): Simplify.
116
117 2012-10-05  Alan Modra  <amodra@gmail.com>
118
119         * i386.cc (Output_data_plt_i386::address_for_global,
120         address_for_local): Add plt offset to returned value.  Adjust uses.
121         * sparc.cc (Output_data_plt_sparc::address_for_global,
122         address_for_local): Likewise.
123         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
124         address_for_local): Likewise.
125         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
126         address_for_local): Likewise.
127         * target.h (Target::plt_address_for_global, plt_address_for_local):
128         Update comment.
129         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
130         (Output_data_got::Got_entry::write): Nor here.
131         * output.h: Comment fix.
132
133 2012-10-02  Jiong Wang  <jiwang@tilera.com>
134
135         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
136         global_offset_table_ value for larget got.
137         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
138
139 2012-09-29  Alan Modra  <amodra@gmail.com>
140
141         * powerpc.cc (Target_powerpc::iplt_): New output section.
142         (Target_powerpc::iplt_section, make_iplt_section,
143         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
144         (Target_powerpc::make_plt_entry): Handle ifunc syms.
145         Target_powerpc::plt_entry_count): Count iplt entries too.
146         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
147         reloc section in constructor.  New params.
148         (Target_powerpc::make_plt_section): Create reloc section here instead.
149         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
150         functions.
151         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
152         (Output_data_glink::add_entry, find_entry): New functions to
153         deal with local syms.
154         (Glink_sym_ent): Add support for local syms.
155         (Output_data_glink::do_write): Handle ifunc plt entries.
156         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
157         (Target_powerpc::Scan::local, global): Handle ifunc syms.
158         (Target_powerpc::Relocate::relocate): Likewise.
159         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
160
161 2012-09-25  Alan Modra  <amodra@gmail.com>
162
163         * object.h (Sized_relobj_file::adjust_local_symbol,
164         do_adjust_local_symbol): New functions.
165         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
166         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
167         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
168         and irregular opd entry spacing.
169         (Powerpc_relobj::do_read_relocs): Add opd size checks.
170         (Global_symbol_visitor_opd): New functor.
171         (Target_powerpc::do_finalize_sections): Omit global symbols defined
172         on deleted opd entries.
173
174 2012-09-15  Jiong Wang  <jiwang@tilera.com>
175
176         * tilegx.cc: New file.
177         * Makefile.am (TARGETSOURCES): Add tilegx.cc
178         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
179         * configure.tgt: Add entries for tilegx*.
180         * configure.ac: Likewise.
181         * Makefile.in: Rebuild.
182         * configure: Likewise.
183         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
184         tilegx.
185
186 2012-09-13  Alan Modra  <amodra@gmail.com>
187
188         * target-reloc.h (scan_relocs): Call scan.local for relocs
189         against symbols in discarded sections.  Pass is_discarded
190         param.
191         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
192         Add is_discarded param.
193         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
194         is_discarded to flag opd entry as discarded.  Don't emit dyn
195         relocs on such entries.
196         (Target_powerpc::Scan::global): Similarly detect and handle
197         such opd entries.
198         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
199         opd_ent_.  Update all uses.
200         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
201         (Target_powerpc::relocate_section): Zero out discarded opd
202         entry relocs.
203
204 2012-09-12  Ian Lance Taylor  <iant@google.com>
205
206         PR gold/14570
207         * output.cc: Rename Output_data_got template parameter from size
208         to got_size for all functions.  Compile all variants of
209         Output_data_got.
210         (Output_data_got::Got_entry::write): Correct use of size for
211         symbol value.  Use local_is_tls rather than casting to
212         Sized_relobj_file.
213         * object.h (class Object): Add local_is_tls and do_local_is_tls.
214         (class Sized_relobj_file): Add do_local_is_tls.
215         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
216
217 2012-09-11  Alan Modra  <amodra@gmail.com>
218
219         PR gold/14566
220         * layout.cc (Layout::set_segment_offsets): When using
221         common-page-size alignment, ensure we are on a new max-page-size
222         page.
223         * output.cc (Output_segment::set_section_addresses): Use
224         abi_pagesize, not common_pagesize for relro boundary.
225         (Output_segment::set_offset): Likewise.
226
227 2012-09-11  Alan Modra  <amodra@gmail.com>
228
229         * output.h (Output_data_got::add_global_tls, add_local_tls,
230         add_local_tls_pair): New functions.
231         (Output_data_got::add_local_pair_with_rel): Remove second
232         reloc param.  Expand comment.
233         (Output_data_got::Got_entry): Rename use_plt_offset_ to
234         use_plt_or_tls_offset_, similarly for constructor param.
235         (Output_data_got::Got_entry::write): Add got_index param.
236         * output.cc (Output_data_got::add_global_tls, add_local_tls,
237         add_local_tls_pair): New functions.
238         (Output_data_got::Got_entry::write): Handle tls symbols
239         with use_plt_or_tls_offset_ set specially.
240         (Output_data_got::add_local_pair_with_rel): Only one reloc.
241         (Output_data_got::do_write): Replace iterator with index, pass
242         index to entry write function.
243         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
244         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
245         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
246         call.
247         * i386.cc (Target_i386::Scan::local): Likewise.
248         * sparc.cc (Target_sparc::Scan::local): Likewise.
249         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
250         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
251         do_tls_offset_for_global): New functions.
252         (Target_powerpc::Scan::local): Correct TLS relocations and got
253         entry values.
254         (Target_powerpc::Scan::global): Don't emit unnecessary
255         dynamic relocations on TLS GOT entries.
256
257 2012-09-10  Matthias Klose  <doko@ubuntu.com>
258
259         * config.in: Disable sanity check for kfreebsd.
260
261 2012-09-10  Sterling Augustine  <saugustine@google.com>
262
263         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
264         (Gdb_index::pubtypes_read): New parameter.
265         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
266         to calls.
267         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
268         pubtypes_object_.
269
270 2012-09-09  Alan Modra  <amodra@gmail.com>
271
272         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
273         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
274         * gc.h (gc_process_relocs): Call target gc_add_reference.
275         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
276         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
277         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
278         unnecessary cast.
279         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
280         to cater for when we don't need code offset.  Update use.
281         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
282         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
283         set_opd_valid): New functions.
284         (Target_powerpc::do_gc_add_reference): New function.
285         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
286         stashed refs.
287         (Target_powerpc::do_gc_mark_symbol): New function.
288
289 2012-09-06  Cary Coutant  <ccoutant@google.com>
290
291         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
292         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
293         (Dwarf_die::skip_attributes): Likewise.
294         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
295         * testsuite/gdb_index_test.cc (inline_func_1): New function.
296         (main): Call it.
297         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
298
299 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
300
301         * testsuite/script_test_3.t: Add .got.plt output section
302         statement.
303         * testsuite/script_test_4.t: Likewise.
304
305 2012-09-05  Alan Modra  <amodra@gmail.com>
306
307         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
308         update all uses and lose "enum" when using type.
309
310 2012-09-05  Alan Modra  <amodra@gmail.com>
311
312         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
313         * configure: Regenerate.
314         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
315         (plugin_final_layout.stdout): Likewise.
316         (memory_test): Set page sizes to 0x1000.
317         * testsuite/Makefile.in: Regenerate.
318         * testsuite/discard_locals_test.sh: Add FIXME comment.
319         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
320         * testsuite/pr14265.t: Add .got output section statement.
321         * testsuite/script_test_2.t: Likewise.
322         * testsuite/script_test_3.t: Likewise.
323         * testsuite/script_test_4.t: Likewise.
324         * testsuite/script_test_5.t: Likewise.
325         * testsuite/script_test_6.t: Likewise.
326         * testsuite/script_test_7.t: Likewise.
327         * testsuite/script_test_9.t: Likewise.
328
329 2012-09-05  Alan Modra  <amodra@gmail.com>
330
331         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
332         (Powerpc_relocate_functions::Status): New typedef.
333         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
334         (Target_powerpc::Scan::local): Handle REL64.
335         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
336         for REL32 and REL64.
337         (Target_powerpc::symval_for_branch): New function, extracted from..
338         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
339         checks.  Report overflow errors.
340
341 2012-09-05  Alan Modra  <amodra@gmail.com>
342
343         * object.h (Sized_relobj_file::emit_relocs): Delete.
344         (Sized_relobj_file::emit_relocs_reltype): Delete.
345         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
346         relocate_relocs for --emit-relocs.
347         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
348         * output.h: Update comment.
349         (Output_segment::first_section): New function.
350         (Output_segment::first_section_load_address): Use first_section.
351         * output.cc (Output_segment::first_section): New function extracted..
352         (Output_segment::first_section_load_address): ..from here.  Delete.
353         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
354         * target.h (Sized_target::relocate_for_relocatable): Likewise.
355         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
356         adjust call to target.h function.
357         * i386.cc (Target_i386): Likewise.
358         * sparc.cc (Target_sparc): Likewise.
359         * x86_64.cc (Target_x86_64): Likewise.
360         * powerpc.cc (Target_powerpc): Likewise.
361         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
362         first tls section has section symbol for optimised local dynamic
363         output relocs.
364         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
365         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
366         optimised tls code.
367         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
368         Rename to relocate_relocs.  Update error message.
369
370 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
371
372         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
373         --just-symbols.
374
375 2012-08-31  Alan Modra  <amodra@gmail.com>
376
377         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
378         (Powerpc_relobj::toc_base_offset): New stub function.
379         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
380         got_mod_index_offset to tlsld_got_offset.  Update all refs.
381         (Target_powerpc::Relocate::enum skip_tls): New.
382         (Target_powerpc::call_tls_get_addr_): New var.
383         (Target_powerpc::is_branch_reloc): Move to file scope.
384         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
385         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
386         New functions.
387         (Target_powerpc::enum Got_type): Delete old values, add new ones.
388         (powerpc_info): Correct common_pagesize for ppc64.
389         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
390         (Powerpc_relocate_functions): Add overflow check enums and functions.
391         Add non-shift version of rela, rela_ua.  Delete all rel public
392         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
393         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
394         addr16_ha3, addr14 functions.
395         (Output_data_got_powerpc::add_constant_pair): New function.
396         (Output_data_got_powerpc::got_base_offset): Likewise.
397         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
398         (instruction constants): Sort, add some more.
399         (Output_data_glink::do_write): Add and use Address typedef.  Use
400         object->toc_base_offset() stub for 64-bit.
401         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
402         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
403         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
404         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
405         Always treat .opd relocs as against locally defined symbol.
406         Correct condition for RELATIVE relocs.
407         (Target_powerpc::do_finalize_sections): Test for NULL sections.
408         (Target_powerpc::Relocate::relocate): Use plt call stub as value
409         for 32-bit syms with a plt entry.  Correct ppc64 toc base
410         calculations.  Handle TLS relocs, and more.  Add overflow
411         checking and adjust for Powerpc_relocate_functions changes.
412         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
413         Reinstate --emit-relocs code with FIXME.
414
415 2012-08-30  Alan Modra  <amodra@gmail.com>
416
417         * layout.cc (Layout::set_segment_offsets): Set p_align to
418         abi_pagesize, not common_pagesize.
419         (Layout::relaxation_loop_body): Similarly use abi_pagesize
420         to determine whether file header can go in segment.
421
422 2012-08-30  Alan Modra  <amodra@gmail.com>
423
424         * output.h (Output_reloc::Output_reloc <output section>): Add
425         is_relative param.  Adjust calls.
426         (Output_reloc::add_output_section_relative): New functions.
427         * output.cc (Output_reloc::Output_reloc <output section>): Handle
428         is_relative.
429         (Output_reloc::symbol_value): Handle SECTION_CODE.
430
431 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
432
433         * gold.cc (queue_middle_tasks): Call layout again when unique
434         segments for sections is desired.
435         * layout.cc (Layout::Layout): Initialize new members.
436         (Layout::get_output_section_flags): New function.
437         (Layout::choose_output_section): Call get_output_section_flags.
438         (Layout::layout): Make output section for mapping to a unique segment.
439         (Layout::insert_section_segment_map): New function.
440         (Layout::attach_allocated_section_to_segment): Make unique segment for
441         output sections marked so.
442         (Layout::segment_precedes): Check for unique segments when sorting.
443         * layout.h (Layout::Unique_segment_info): New struct.
444         (Layout::Section_segment_map): New typedef.
445         (Layout::insert_section_segment_map): New function.
446         (Layout::get_output_section_flags): New function.
447         (Layout::is_unique_segment_for_sections_specified): New function.
448         (Layout::set_unique_segment_for_sections_specified): New function.
449         (Layout::unique_segment_for_sections_specified_): New member.
450         (Layout::section_segment_map_): New member.
451         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
452         Rename is_gc_pass_one to is_pass_one.
453         Rename is_gc_pass_two to is_pass_two.
454         Rename is_gc_or_icf to is_two_pass.
455         Check for which pass based on whether symbols data is present.
456         Make it two pass when unique segments for sections is desired.
457         * output.cc (Output_section::Output_section): Initialize new
458         members.
459         * output.h (Output_section::is_unique_segment): New function.
460         (Output_section::set_is_unique_segment): New function.
461         (Output_section::is_unique_segment_): New member.
462         (Output_section::extra_segment_flags): New function.
463         (Output_section::set_extra_segment_flags): New function.
464         (Output_section::extra_segment_flags_): New member.
465         (Output_section::segment_alignment): New function.
466         (Output_section::set_segment_alignment): New function.
467         (Output_section::segment_alignment_): New member.
468         (Output_segment::Output_segment): Initialize is_unique_segment_.
469         (Output_segment::is_unique_segment): New function.
470         (Output_segment::set_is_unique_segment): New function.
471         (Output_segment::is_unique_segment_): New member.
472         * plugin.cc (allow_unique_segment_for_sections): New function.
473         (unique_segment_for_sections): New function.
474         (Plugin::load): Add new functions to transfer vector.
475         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
476         * Makefile.in: Regenerate.
477         * testsuite/plugin_final_layout.sh: Check if unique segment
478         functionality works.
479         * testsuite/plugin_section_order.c (onload): Check if new interfaces
480         are available.
481         (allow_unique_segment_for_sections): New global.
482         (unique_segment_for_sections): New global.
483         (claim_file_hook): Call allow_unique_segment_for_sections.
484         (all_symbols_read_hook): Call unique_segment_for_sections.
485
486 2012-08-22  Cary Coutant  <ccoutant@google.com>
487
488         * layout.cc (Layout::include_section): Don't assert on GROUP
489         sections with --emit-relocs.
490
491 2012-08-21  Cary Coutant  <ccoutant@google.com>
492
493         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
494         if --export-dynamic-symbol names an undef symbol.
495
496 2012-08-18  Alan Modra  <amodra@gmail.com>
497
498         * powerpc.cc: Formatting and white space.
499         (Powerpc_relobj): Rename got2_section_ to special_.
500         Add opd_ent_shndx_ and opd_ent_off_ vectors.
501         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
502         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
503         (Target_powerpc): Add Address typedef and invalid_address.  Use
504         throughout.
505         (Target_powerpc::is_branch_reloc): New function.
506         (Powerpc_relocate_functions): Add Address typedef, use throughout.
507         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
508         for dst_mask, value and addend.
509         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
510         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
511         (Output_data_glink::do_write): Correct toc base.  Don't try to use
512         uint16_t for 24-bit offset.  Use get_output_section_offset and
513         check return.
514         (Target_powerpc::Scan::local): Handle more relocs.
515         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
516         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
517         Plug in toc restoring insn after plt calls.  Translate branches
518         to function descriptor symbols to corresponding entry point.
519         (Target_powerpc::relocate_for_relocatable): Check return from
520         get_output_section_offset.
521         * symtab.h: Comment typo.
522
523 2012-08-14  Ian Lance Taylor  <iant@google.com>
524
525         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
526         unsupported_relocal_local to call unsupported_reloc_global.
527
528 2012-08-14  Nick Clifton  <nickc@redhat.com>
529
530         PR ld/14265
531         * script-sections.cc (Sections_element::output_section_name): Add
532         keep return parameter.
533         (Output_section_element::match_name): Add keep return parameter.
534         Return the value of the keep_ member.
535         * script-sections.h (class Output_section): Update
536         output_section_name prototype.
537         * layout.cc (Layout::keep_input_section): New public member
538         function.
539         (Layout::choose_output_section): Pass keep parameter to
540         output_section_name.
541         * layout.h (class Layout): Add keep_input_section.
542         * object.cc (Sized_relobj_file::do_layout): Check for kept input
543         sections.
544         * testsuite/Makefile.am: Add a test.
545         * testsuite/Makefile.in: Regenerate.
546         * testsuite/pr14265.c: Source file for the test.
547         * testsuite/pr14265.t: Linker script for the test.
548         * testsuite/pr14265.sh: Shell script for the test.
549
550 2012-08-14  Alan Modra  <amodra@gmail.com>
551
552         * target.h (Target::output_section_name): New function.
553         (Target::do_output_section_name): New function.
554         * layout.cc (Layout::choose_output_section): Call the above.
555         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
556
557 2012-08-14  Alan Modra  <amodra@gmail.com>
558
559         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
560         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
561         for replace_constant call.
562         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
563         (Output_data_glink::do_print_to_mapfile): New function.
564         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
565         (Target_powerpc::Relocate::relocate): Likewise.
566
567 2012-08-14  Alan Modra  <amodra@gmail.com>
568
569         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
570         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
571         (Output_data_glink::add_entry,find_entry): Remove shndx param.
572         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
573         all references to shndx_.  Handle special case for R_PPC_PLTREL24
574         here.
575         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
576         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
577         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
578         here.
579         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
580         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
581
582 2012-08-12  Alan Modra  <amodra@gmail.com>
583
584         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
585         (glink insn constants): Use uint32_t.
586         (Output_data_glink::add_entry): Use insert, not [] operator.
587
588 2012-08-11  Alan Modra  <amodra@gmail.com>
589
590         * object.h (Sized_relobj_file::find_shdr): New function.
591         (Sized_relobj_file::find_special_sections): New function.
592         * object.cc (Sized_relobj_file::find_shdr): New function.
593         (Sized_relobj_file::find_eh_frame): Use find_shdr.
594         (Sized_relobj_file::find_special_sections): New function, split out..
595         (Sized_relobj_file::do_read_symbols): ..from here.
596         * output.h (Output_data_got::replace_constant): New function.
597         (Output_data_got::num_entries): New function.
598         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
599         (Output_data_got::got_offset): Protected rather than private.
600         (Output_data_got::replace_got_entry): New function.
601         * output.cc (Output_data_got::replace_got_entry): New function.
602         * powerpc.cc (class Powerpc_relobj): New.
603         (class Powerpc_relocate_functions): Delete all psymval variants or
604         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
605         Implement _ha functions using corresponding _hi function.
606         (Powerpc_relobj::find_special_sections): New function.
607         (Target_powerpc::do_make_elf_object): New function.
608         (class Output_data_got_powerpc): New.
609         (class Output_data_glink): New.
610         (class Powerpc_scan_relocatable_reloc): New.
611         Many more changes througout file.
612
613 2012-08-09  Nick Clifton  <nickc@redhat.com>
614
615         * po/vi.po: Updated Vietnamese translation.
616
617 2012-08-07  Ian Lance Taylor  <iant@google.com>
618
619         * layout.cc (Layout::add_target_dynamic_tags): If
620         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
621         plt_rel.
622
623 2012-07-30  Nick Clifton  <nickc@redhat.com>
624
625         * po/gold.pot: Updated template.
626         * po/es.po: Updated Spanish translation.
627
628 2012-07-18  Cary Coutant  <ccoutant@google.com>
629
630         PR gold/14344
631         * configure.ac: Add check for -gpubnames support.
632         * configure: Regenerate.
633         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
634         support; force -gno-pubnames.
635         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
636         support.
637         (gdb_index_test_4): New test.
638         * testsuite/Makefile.in: Regenerate.
639         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
640         * testsuite/gdb_index_test_2.sh: Likewise.
641         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
642         * testsuite/gdb_index_test_4.sh: New script.
643         * testsuite/gdb_index_test_comm.sh: New script with common code;
644         don't look for space after colon.
645
646 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
647
648         * gold.cc (queue_middle_tasks): Update function order only after
649         deferred objects due to plugins are processed.
650
651 2012-07-11  Ian Lance Taylor  <iant@google.com>
652
653         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
654         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
655         (Target_arm::scan_reloc_for_stub): Likewise.
656         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
657         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
658         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
659         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
660         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
661
662 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
663             Ian Lance Taylor  <iant@google.com>
664
665         PR gold/14309
666         * configure.ac: Test whether std::tr1::hash<off_t> works.
667         * gold.h: Add a specialization for std::tr1::hash<off_t> if
668         needed.
669         * output.h (class Output_fill): Add virtual destructor.
670         * configure, config.in: Rebuild.
671
672 2012-06-22  Roland McGrath  <mcgrathr@google.com>
673
674         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
675
676 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
677
678         * plugin.cc (Plugin::load): Handle position independent executables.
679
680 2012-06-06  Cary Coutant  <ccoutant@google.com>
681
682         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
683         add .debug_macro.
684         (lines_only_debug_sections): Likewise.
685         (gdb_fast_lookup_sections): New static array.
686         (is_gdb_debug_section): Rename formal parameter.
687         (is_lines_only_debug_section): Likewise.
688         (is_gdb_fast_lookup_section): New function.
689         (Layout::include_section): Check for ".zdebug_" prefix; pass
690         section name suffix to is_gdb_debug_section, et al.; check for
691         fast-lookup sections when building .gdb_index.
692         * options.h (--strip-debug-gdb): Update GDB version number.
693
694 2012-06-06  Cary Coutant  <ccoutant@google.com>
695
696         * configure.ac: Add check for fallocate.
697         * configure: Regenerate.
698         * config.in: Regenerate.
699
700         * options.h (class General_options): Add --mmap-output-file and
701         --posix-fallocate options.
702         * output.cc: (posix_fallocate): Remove; replace with...
703         (gold_fallocate): New function.
704         (Output_file::map_no_anonymous): Call gold_fallocate.
705         (Output_file::map): Check --mmap-output-file option.
706
707 2012-06-05  Jing Yu  <jingyu@google.com>
708
709         * gold.h (textdomain): Add do {} to empty while(0).
710         (bindtextdomain): Likewise.
711
712 2012-06-04  Cary Coutant  <ccoutant@google.com>
713
714         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
715         has_dynsym_index.
716
717 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
718
719         * symtab.cc (Symbol_table::define_special_symbol):
720         Initialize *poldsym to prevent uninitialized variable errors.
721
722 2012-05-23  Cary Coutant  <ccoutant@google.com>
723
724         * layout.cc (Layout::section_name_mapping): Add rules to handle
725         exact match on .data.rel.ro.local or .data.rel.ro.
726         (Layout::output_section_name): Check for exact matches.
727
728 2012-05-23  Cary Coutant  <ccoutant@google.com>
729
730         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
731         more carefully.
732
733 2012-05-22  Cary Coutant  <ccoutant@google.com>
734
735         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
736         object before exporting symbol.
737
738 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
739
740         * testsuite/tls_test.cc: Include "config.h" first.
741         * testsuite/tls_test_c.c: Likewise.
742
743 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
744             Nick Clifton  <nickc@redhat.com>
745
746         PR 14072
747         * configure.in: Add check that sysdep.h has been included before
748         any system header files.
749         * configure: Regenerate.
750         * config.in: Regenerate.
751
752 2012-05-14  Cary Coutant  <ccoutant@google.com>
753
754         * layout.cc (Layout::make_output_section): Mark .tdata section
755         as RELRO.
756         * testsuite/relro_test.cc: Add a TLS variable.
757
758 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
759
760         PR gold/14091
761         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
762         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
763         R_X86_64_64.
764
765 2012-05-08  Cary Coutant  <ccoutant@google.com>
766
767         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
768         (lines_only_debug_sections): Likewise.
769
770 2012-05-02  Roland McGrath  <mcgrathr@google.com>
771
772         * nacl.cc: New file.
773         * nacl.h: New file.
774         * Makefile.am (CCFILES, HFILES): Add them.
775         * Makefile.in: Regenerate.
776         * i386.cc (Output_data_plt_i386_nacl): New class.
777         (Output_data_plt_i386_nacl_exec): New class.
778         (Output_data_plt_i386_nacl_dyn): New class.
779         (Target_i386_nacl): New class.
780         (Target_selector_i386_nacl): New class.
781         (target_selector_i386): Use it instead of Target_selector_i386.
782         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
783         (Target_x86_64_nacl): New class.
784         (Target_selector_x86_64_nacl): New class.
785         (target_selector_x86_64, target_selector_x32): Use it instead of
786         Target_selector_x86_64.
787         * arm.cc (Output_data_plt_arm_nacl): New class.
788         (Target_arm_nacl): New class.
789         (Target_selector_arm_nacl): New class.
790         (target_selector_arm, target_selector_armbe): Use it instead of
791         Target_selector_arm.
792
793         * target-select.cc (select_target): Take new Input_file* and off_t
794         arguments, pass them on to recognize method of selector.
795         * object.cc (make_elf_sized_object): Update caller.
796         * parameters.cc (parameters_force_valid_target): Likewise.
797         * incremental.cc (make_sized_incremental_binary): Likewise.
798         * target-select.h: Update decl.
799         (Target_selector::recognize): Take new Input_file* argument,
800         pass it on to do_recognize.
801         (Target_selector::do_recognize): Take new Input_file* argument.
802         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
803         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
804         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
805         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
806
807         * target.h (Target::Target_info): New members isolate_execinstr
808         and rosegment_gap.
809         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
810         * arm.cc (Target_arm::arm_info): Update initializer.
811         * i386.cc (Target_i386::i386_info): Likewise.
812         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
813         * sparc.cc (Target_sparc::sparc_info): Likewise.
814         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
815         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
816         * layout.cc (Layout::attach_allocated_section_to_segment):
817         Take new const Target* argument.  If target->isolate_execinstr(), act
818         like --rosegment.
819         (Layout::find_first_load_seg): Take new const Target* argument;
820         if target->isolate_execinstr(), reject PF_X segments.
821         (Layout::relaxation_loop_body): Update caller.
822         (Layout::set_segment_offsets): If target->isolate_execinstr(),
823         reset file offset to zero when we hit LOAD_SEG, and then do a second
824         loop over the segments before LOAD_SEG to reassign offsets after
825         addresses have been determined.  Handle target->rosegment_gap().
826         (Layout::attach_section_to_segment): Take new const Target* argument;
827         pass it to attach_allocated_section_to_segment.
828         (Layout::make_output_section): Update caller.
829         (Layout::attach_sections_to_segments): Take new const Target* argument;
830         pass it to attach_section_to_segment.
831         * gold.cc (queue_middle_tasks): Update caller.
832         * layout.h (Layout): Update method decls with new arguments.
833
834         * arm.cc (Target_arm::Target_arm): Take optional argument for the
835         Target_info pointer to use.
836         (Target_arm::do_make_data_plt): New virtual method.
837         (Target_arm::make_data_plt): New method that calls it.
838         (Target_arm::make_plt_entry): Use it.
839         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
840         for the section alignment.
841         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
842         method.
843         (Output_data_plt_arm::first_plt_entry_offset): Call it.
844         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
845         method.
846         (Output_data_plt_arm::get_plt_entry_size): Call it.
847         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
848         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
849         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
850         method.
851         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
852         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
853         method instead of sizeof(plt_entry).
854         (Output_data_plt_arm::add_entry): Likewise.
855         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
856         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
857         than static method.
858         (Target_arm::plt_entry_size): Likewise.
859         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
860         Move to ...
861         (Output_data_plt_arm_standard): ... here, new class.
862         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
863         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
864         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
865
866         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
867         Take additional argument for the PLT entry size.
868         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
869         Use get_plt_entry_size method rather than plt_entry_size variable.
870         (Output_data_plt_x86_64::reserve_slot): Likewise.
871         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
872         (Output_data_plt_x86_64::add_entry): Likewise.
873         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
874         (Output_data_plt_x86_64::address_for_global): Likewise.
875         (Output_data_plt_x86_64::address_for_local): Likewise.
876         (Output_data_plt_x86_64::set_final_data_size): Likewise.
877         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
878         Make method non-static.
879         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
880         method.
881         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
882         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
883         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
884         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
885         virtual method.
886         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
887         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
888         virtual method.
889         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
890         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
891         virtual method.
892         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
893         (Output_data_plt_x86_64::plt_entry_size)
894         (Output_data_plt_x86_64::first_plt_entry)
895         (Output_data_plt_x86_64::plt_entry)
896         (Output_data_plt_x86_64::tlsdesc_plt_entry)
897         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
898         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
899         (Output_data_plt_x86_64_standard): ... here, new class.
900         (Target_x86_64::Target_x86_64): Take optional argument for the
901         Target_info pointer to use.
902         (Target_x86_64::do_make_data_plt): New virtual method.
903         (Target_x86_64::make_data_plt): New method to call it.
904         (Target_x86_64::init_got_plt_for_update): Use that.
905         Call this->plt_->add_eh_frame method here.
906         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
907         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
908         rather than static method.
909         (Target_x86_64::plt_entry_size): Likewise.
910         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
911         rather than plt_entry_size variable.  Move guts of PLT filling to...
912         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
913         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
914         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
915
916         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
917         additional argument for the section alignment.
918         Don't do add_eh_frame_for_plt here.
919         (Output_data_plt_i386::first_plt_entry_offset): Make the method
920         non-static.  Use get_plt_entry_size method rather than plt_entry_size
921         variable.
922         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
923         method.
924         (Output_data_plt_i386::get_plt_entry_size): Call it.
925         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
926         (Output_data_plt_i386::add_eh_frame): New method to call it.
927         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
928         method.
929         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
930         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
931         method.
932         (Output_data_plt_i386::fill_plt_entry): New method to call it.
933         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
934         method instead of plt_entry_size.
935         (Output_data_plt_i386::plt_entry_size)
936         (Output_data_plt_i386::plt_eh_frame_fde_size)
937         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
938         (Output_data_plt_i386_standard): ... here, new class.
939         (Output_data_plt_i386_exec): New class.
940         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
941         (Output_data_plt_i386_exec::first_plt_entry): ... here.
942         (Output_data_plt_i386::exec_plt_entry): Move to ...
943         (Output_data_plt_i386_exec::plt_entry): ... here.
944         (Output_data_plt_i386_dyn): New class.
945         (Output_data_plt_i386::first_plt_entry): Move to ...
946         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
947         (Output_data_plt_i386::dyn_plt_entry): Move to ...
948         (Output_data_plt_i386_dyn::plt_entry): ... here.
949         (Target_i386::Target_i386): Take optional argument for the Target_info
950         pointer to use.
951         (Target_i386::do_make_data_plt): New virtual method.
952         (Target_i386::make_data_plt): New method to call it.
953         (Target_i386::make_plt_section): Use that.
954         Call this->plt_->add_eh_frame method here.
955         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
956         rather than plt_entry_size variable.
957         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
958         (Output_data_plt_i386::address_for_local): Likewise.
959         (Output_data_plt_i386::do_write): Likewise.
960         Move guts of PLT filling to...
961         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
962         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
963         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
964         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
965
966 2012-05-01  Cary Coutant  <ccoutant@google.com>
967
968         * dwarf_reader.cc (Dwarf_die::read_attributes)
969         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
970         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
971         * reduced_debug_output.cc
972         (Output_reduced_debug_info_section::get_die_end): Remove
973         DW_FORM_GNU_ref_index.  Add default case.
974
975 2012-04-26  Mark Wielaard  <mjw@redhat.com>
976
977         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
978         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
979         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
980         DW_AT_high_pc as offset from DW_AT_low_pc.
981
982         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
983         * testsuite/Makefile.in: Regenerate.
984         * testsuite/gdb_index_test_3.c: New test source file.
985         * testsuite/gdb_index_test_3.sh: New test source file.
986
987 2012-04-25  Ian Lance Taylor  <iant@google.com>
988
989         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
990         pointer.
991         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
992         as a class, not a struct.
993         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
994         (Target_arm::apply_cortex_a8_workaround): Likewise.
995         * gc.h: Declare Reloc_types as a struct, not a class.
996         * object.h: Declare Symbols_data as a struct.
997         * reloc.h: Declare Read_relocs_data as a struct.
998         * target.h: Declare Relocate_info as a struct.
999
1000 2012-04-24  David S. Miller  <davem@davemloft.net>
1001
1002         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1003         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1004         and R_SPARC_WPLT30.
1005
1006 2012-04-24  Cary Coutant  <ccoutant@google.com>
1007
1008         * incremental-dump.cc (find_input_containing_global): Replace
1009         magic number with symbolic constant.
1010         (dump_incremental_inputs): Update version number.
1011         * incremental.cc (Output_section_incremental_inputs): Update version
1012         number; import symbolic constants from Incremental_inputs_reader.
1013         (Incremental_inputs::create_data_sections): Align relocations
1014         section correctly for 64-bit targets.
1015         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1016         constants; add padding.
1017         (Output_section_incremental_inputs::write_header): Add assert for
1018         header_size.
1019         (Output_section_incremental_inputs::write_input_files): Add assert
1020         for input_entry_size.
1021         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1022         add assert for object_info_size, input_section_entry_size,
1023         global_sym_entry_size.
1024         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1025         for data structure sizes; use them.
1026         (Incremental_input_entry_reader): Import symbolic constants from
1027         Incremental_inputs_reader; use them.
1028
1029 2012-04-23  David S. Miller  <davem@davemloft.net>
1030
1031         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1032         and elf_flags_set_.
1033         (Target_sparc::Target_sparc): Initialize new fields.
1034         (Target_sparc::do_make_elf_object): New function.
1035         (Target_sparc::do_adjust_elf_header): New function.
1036
1037 2012-04-23  Cary Coutant  <ccoutant@google.com>
1038
1039         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1040         CU range table of gdb index.
1041
1042 2012-04-20  David S. Miller  <davem@davemloft.net>
1043
1044         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1045         instead of false.
1046
1047 2012-04-16  David S. Miller  <davem@davemloft.net>
1048
1049         * sparc.cc (Target_sparc::got_address): New function.
1050         (Sparc_relocate_functions::gdop_hix22): New function.
1051         (Sparc_relocate_functions::gdop_lox10): New function.
1052         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1053         relocs.
1054         (Target_sparc::Scan::local): Likewise if the global symbol is not
1055         preemptible and is not IFUNC.
1056         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1057         transformations for local and non-preemptible non-IFUNC global
1058         symbols.
1059
1060         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1061         writing out 64-bit part of ranges.
1062
1063         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1064         -fpic and -fpie respectively.
1065         * Makefile.in: Regenerate.
1066
1067         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1068         (Target_sparc::Target_sparc): Initialize new field.
1069         (Target_sparc::do_plt_section_for_global): New function.
1070         (Target_sparc::do_plt_section_for_local): New function.
1071         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1072         (Target_sparc::make_plt_section): New function, broken out of
1073         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1074         (Target_sparc::make_plt_entry): Call make_plt_section.
1075         (Target_sparc::make_local_ifunc_plt_entry): New function.
1076         (Target_sparc::rela_ifunc_section): New function.
1077         (Target_sparc::plt_section): Remove const.
1078         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1079         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1080         and ifunc_count_ fields.
1081         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1082         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1083         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1084         (Output_data_plt_sparc::rela_ifunc): New function.
1085         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1086         (Output_data_plt_sparc::has_ifunc_section): New function.
1087         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1088         (Output_data_plt_sparc::address_for_global): New function.
1089         (Output_data_plt_sparc::address_for_local): New function.
1090         (Output_data_plt_sparc::plt_index_to_offset): New function.
1091         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1092         and entry_count.
1093         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1094         entry_count.
1095         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1096         R_SPARC_JMP_IREL to switch.
1097         (Target_sparc::Scan::check_non_pic): Likewise.
1098         (Target_sparc::Scan::local): Handle IFUNC symbols.
1099         (Target_sparc::Scan::local): Likewise.
1100         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1101         and plt_address_for_local.
1102         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1103         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1104
1105         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1106         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1107         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1108         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1109         global relocs too.
1110         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1111         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1112         calls.
1113         * sparc.cc (Target_sparc::Scan::global): Likewise.
1114         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1115
1116 2012-04-16  Cary Coutant  <ccoutant@google.com>
1117
1118         * archive.cc (Library_base::should_include_member): Check for
1119         --export-dynamic-symbol.
1120         * options.h (class General_options): Add --export-dynamic-symbol.
1121         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1122         --export-dynamic-symbol.
1123         (Symbol_table::gc_mark_undef_symbols): Likewise.
1124         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1125
1126 2012-04-12  David S. Miller  <davem@davemloft.net>
1127
1128         * sparc.cc (Reloc::wdisp10): New relocation method.
1129         (Reloc::h34): Likewise.
1130         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1131         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1132         R_SPARC_WDISP10.
1133         (Target_sparc::Scan::local): Likewise.
1134         (Target_sparc::Scan::global): Likewise.
1135         (Target_sparc::Relocate::relocate): Likewise.
1136
1137 2012-04-09  Cary Coutant  <ccoutant@google.com>
1138
1139         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1140         low_pc == 0.
1141
1142 2012-04-06  Ian Lance Taylor  <iant@google.com>
1143
1144         * timer.cc: #include <unistd.h>.
1145
1146 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1147
1148         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1149         * config.in: Regenerate.
1150         * configure: Regenerate.
1151
1152 2012-04-05  Nick Clifton  <nickc@redhat.com>
1153
1154         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1155         (AM_LC_MESSAGES): Add.
1156         * aclocal.m4: Regenerate.
1157         * config.in: Regenerate.
1158         * configure: Regenerate.
1159
1160 2012-03-21  Cary Coutant  <ccoutant@google.com>
1161
1162         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1163         * Makefile.in: Regenerate.
1164         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1165         (Sized_elf_reloc_mapper::symbol_section): New function.
1166         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1167         (make_elf_reloc_mapper): New function.
1168         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1169         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1170         (Dwarf_abbrev_table::do_get_abbrev): New function.
1171         (Dwarf_ranges_table::read_ranges_table): New function.
1172         (Dwarf_ranges_table::read_range_list): New function.
1173         (Dwarf_pubnames_table::read_section): New function.
1174         (Dwarf_pubnames_table::read_header): New function.
1175         (Dwarf_pubnames_table::next_name): New function.
1176         (Dwarf_die::Dwarf_die): New function.
1177         (Dwarf_die::read_attributes): New function.
1178         (Dwarf_die::skip_attributes): New function.
1179         (Dwarf_die::set_name): New function.
1180         (Dwarf_die::set_linkage_name): New function.
1181         (Dwarf_die::attribute): New function.
1182         (Dwarf_die::string_attribute): New function.
1183         (Dwarf_die::int_attribute): New function.
1184         (Dwarf_die::uint_attribute): New function.
1185         (Dwarf_die::ref_attribute): New function.
1186         (Dwarf_die::child_offset): New function.
1187         (Dwarf_die::sibling_offset): New function.
1188         (Dwarf_info_reader::check_buffer): New function.
1189         (Dwarf_info_reader::parse): New function.
1190         (Dwarf_info_reader::do_parse): New function.
1191         (Dwarf_info_reader::do_read_string_table): New function.
1192         (Dwarf_info_reader::lookup_reloc): New function.
1193         (Dwarf_info_reader::get_string): New function.
1194         (Dwarf_info_reader::visit_compilation_unit): New function.
1195         (Dwarf_info_reader::visit_type_unit): New function.
1196         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1197         Sized_elf_reloc_mapper.
1198         (Sized_dwarf_line_info::symbol_section): Remove function.
1199         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1200         (Sized_dwarf_line_info::read_line_mappings): Remove object
1201         parameter, adjust callers.
1202         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1203         * dwarf_reader.h: Include <sys/types.h>.
1204         (class Track_relocs): Remove forward declaration.
1205         (class Elf_reloc_mapper): New class.
1206         (class Sized_elf_reloc_mapper): New class.
1207         (class Dwarf_abbrev_table): New class.
1208         (class Dwarf_range_list): New class.
1209         (class Dwarf_ranges_table): New class.
1210         (class Dwarf_pubnames_table): New class.
1211         (class Dwarf_die): New class.
1212         (class Dwarf_info_reader): New class.
1213         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1214         (Sized_dwarf_line_info::symbol_section): Remove member function.
1215         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1216         base class.
1217         * gdb-index.cc: New source file.
1218         * gdb-index.h: New source file.
1219         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1220         and .debug_types sections, call Layout::add_to_gdb_index.
1221         (Sized_relobj_incr::do_section_name): Implement.
1222         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1223         return type; Implement.
1224         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1225         return type.
1226         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1227         parameter list and return type.
1228         (Sized_incr_dynobj::do_section_contents): Likewise.
1229         * layout.cc: Include gdb-index.h.
1230         (Layout::Layout): Initialize gdb_index_data_.
1231         (Layout::init_fixed_output_section): Check for .gdb_index section.
1232         (Layout::add_to_gdb_index): New function. Instantiate.
1233         * layout.h: Add forward declaration for class Gdb_index.
1234         (Layout::add_to_gdb_index): New member function.
1235         (Layout::gdb_index_data_): New data member.
1236         * main.cc: Include gdb-index.h.
1237         (main): Print statistics for gdb index.
1238         * object.cc (Object::section_contents): Move code into
1239         do_section_contents.
1240         (need_decompressed_section): Check for sections needed when building
1241         gdb index.
1242         (build_compressed_section_map): Likewise.
1243         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1244         gdb index.
1245         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1246         sections; call Layout::add_to_gdb_index.
1247         (Sized_relobj_file::do_decompressed_section_contents): Call
1248         do_section_contents directly.
1249         * object.h (Object::do_section_contents): Adjust parameter list and
1250         return type.
1251         (Object::do_decompressed_section_contents): Call do_section_contents
1252         directly.
1253         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1254         return type.
1255         * options.h (class General_options): Add --gdb-index option.
1256         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1257         list and return type.
1258         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1259         * reloc.h (Track_relocs::checkpoint): New function.
1260         (Track_relocs::reset): New function.
1261
1262         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1263         New test cases.
1264         * testsuite/Makefile.in: Regenerate.
1265         * testsuite/gdb_index_test.cc: New test source file.
1266         * testsuite/gdb_index_test_1.sh: New test source file.
1267         * testsuite/gdb_index_test_2.sh: New test source file.
1268
1269 2012-03-19  Doug Kwan  <dougkwan@google.com>
1270
1271         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1272         (Target_arm::do_finalize_sections): Remove code which defines
1273         __exidx_start and __exidx_end.  Make symbol table parameter
1274         anonymous as it is not used.
1275         * gold.cc (queue_middle_tasks): Call target hook to define any
1276         target-specific symbols.
1277         * target.h (Target::define_standard_symbols): New method.
1278         (Target::do_define_standard_symbols): Same.
1279         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1280         * testsuite/Makefile.in: Regenerate.
1281         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1282         and __exidx_end.
1283         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1284         relocations are generated for __exidx_start and __exidx_end.
1285
1286 2012-03-16  Doug Kwan  <dougkwan@google.com>
1287
1288         * testsuite/Makefile.am: Disable test initpri3b.
1289         * testsuite/Makefile.in: Regenerate.
1290
1291 2012-03-15  Doug Kwan  <dougkwan@google.com>
1292
1293         * arm.cc (Target_arm::got_section): Make .got section read-only
1294         if -z now is given.
1295
1296 2012-03-15  Ian Lance Taylor  <iant@google.com>
1297
1298         PR gold/13850
1299         * layout.cc (Layout::make_output_section): Correctly mark
1300         SHT_INIT_ARRAY, et. al., as relro.
1301
1302 2012-03-14  Doug Kwan  <dougkwan@google.com>
1303
1304         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1305         dynamic relocations for protected symbols in shared objects.
1306
1307 2012-03-13  Ian Lance Taylor  <iant@google.com>
1308
1309         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1310         keep the larger alignment.
1311
1312 2012-03-12  Cary Coutant  <ccoutant@google.com>
1313
1314         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1315         handling of DW_LNE_define_file.
1316
1317 2012-03-12  Cary Coutant  <ccoutant@google.com>
1318
1319         * reduced_debug_output.cc
1320         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1321         codes to switch.
1322
1323 2012-02-29  Cary Coutant  <ccoutant@google.com>
1324
1325         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1326
1327 2012-02-29  Cary Coutant  <ccoutant@google.com>
1328
1329         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1330         Call Object::decompressed_section_contents.
1331         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1332         New dtor.
1333         (Sized_dwarf_line_info::buffer_start_): New data member.
1334         * merge.cc (Output_merge_data::do_add_input_section): Call
1335         Object::decompressed_section_contents.
1336         (Output_merge_string::do_add_input_section): Likewise.
1337         * object.cc (need_decompressed_section): New function.
1338         (build_compressed_section_map): Decompress sections needed later.
1339         (Sized_relobj_file::do_decompressed_section_contents): New function.
1340         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1341         * object.h (Object::decompressed_section_contents): New function.
1342         (Object::discard_decompressed_sections): New function.
1343         (Object::do_decompressed_section_contents): New function.
1344         (Object::do_discard_decompressed_sections): New function.
1345         (Compressed_section_info): New type.
1346         (Compressed_section_map): Include decompressed section contents.
1347         (Sized_relobj_file::do_decompressed_section_contents): New function.
1348         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1349
1350 2012-02-16  Cary Coutant  <ccoutant@google.com>
1351
1352         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1353         * testsuite/Makefile.in: Regenerate.
1354
1355 2012-02-14  Cary Coutant  <ccoutant@google.com>
1356
1357         * options.cc (General_options::finalize): Disallow -pie and -static.
1358
1359 2012-02-03  Doug Kwan  <dougkwan@google.com>
1360
1361         * arm.cc (Arm_relocate_functions::abs8,
1362         Arm_relocate_functions::abs16): Use
1363         Bits::has_signed_unsigned_overflow32.
1364         (Arm_relocate_functions::thm_abs8): Correct range of
1365         overflow check.
1366         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1367         in assertions.
1368
1369 2012-02-02  Doug Kwan  <dougkwan@google.com>
1370
1371         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1372         position independent outputs, not just shared objects.
1373
1374 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1375
1376         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1377         * configure: Regenerated.
1378
1379 2012-01-27  Ian Lance Taylor  <iant@google.com>
1380
1381         * reloc.h (Bits): New class with static functions, copied from
1382         namespace utils in arm.cc.
1383         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1384         instead.
1385
1386 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1387
1388         * incremental.cc (write_info_blocks): Correct relocation offset.
1389
1390 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1391
1392         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1393         (Relocate::tls_gd_to_le): Likewise.
1394
1395 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1396
1397         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1398
1399 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1400
1401         * configure.ac: Check if -mcmodel=medium works.
1402         * configure: Regenerated.
1403
1404 2012-01-24  Cary Coutant  <ccoutant@google.com>
1405
1406         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1407         definition and ...
1408         (read_unsigned_LEB_128_x): ... this new function.
1409         (read_signed_LEB_128): Replaced with inline definition and ...
1410         (read_signed_LEB_128_x): ... this new function.
1411         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1412         (read_unsigned_LEB_128): Add inline definition.
1413         (read_signed_LEB_128_x): New function.
1414         (read_signed_LEB_128): Add inline definition.
1415         * testsuite/Makefile.am (leb128_unittest): New unit test.
1416         * testsuite/Makefile.in: Regenerate.
1417         * testsuite/leb128_unittest.cc: New unit test.
1418
1419 2012-01-23  Ian Lance Taylor  <iant@google.com>
1420
1421         PR gold/13617
1422         * i386.cc (Target_i386::do_code_fill): When using a jmp
1423         instruction, pad with nop instructions.
1424         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1425
1426 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1427
1428         * x86_64.cc (gc_process_relocs): Add typename on types used in
1429         template.
1430         (scan_relocs): Likewise.
1431         (relocate_section): Likewise.
1432         (apply_relocation): Likewise.
1433
1434 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1435
1436         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1437         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1438         under x32.
1439
1440 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1441
1442         * x86_64.cc: Initial support for x32.
1443
1444 2012-01-03  Cary Coutant  <ccoutant@google.com>
1445
1446         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1447         Use abstract base class for GOT.
1448         * gold/output.h (class Output_data_got_base): New abstract base class.
1449         (class Output_data_got): Derive from new base class, adjust ctors.
1450         (Output_data_got::reserve_slot): Make virtual; rename to
1451         do_reserve_slot; Adjust callers.
1452         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1453         pointer to abstract base class.
1454         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1455
1456 2011-12-18  Ian Lance Taylor  <iant@google.com>
1457
1458         * object.h (Relobj::local_symbol_value): New function.
1459         (Relobj::local_plt_offset): New function.
1460         (Relobj::local_has_got_offset): New function.
1461         (Relobj::local_got_offset): New function.
1462         (Relobj::set_local_got_offset): New function.
1463         (Relobj::do_local_symbol_value): New pure virtual function.
1464         (Relobj::do_local_plt_offset): Likewise.
1465         (Relobj::do_local_has_got_offset): Likewise.
1466         (Relobj::do_local_got_offset): Likewise.
1467         (Relobj::do_set_local_got_offset): Likewise.
1468         (Sized_relobj::do_local_has_got_offset): Rename from
1469         local_has_got_offset.
1470         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1471         (Sized_relobj::do_set_local_got_offset): Rename from
1472         set_local_got_offset.
1473         (Sized_relobj_file::do_local_plt_offset): Rename from
1474         local_plt_offset.
1475         (Sized_relobj_file::do_local_symbol_value): New function.
1476         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1477         local_plt_offset.
1478         * output.cc (Output_data_got::Got_entry::write): Change object to
1479         Relobj.  Use local_symbol_value.
1480         (Output_data_got::add_global_with_rel): Change rel_dyn to
1481         Output_data_reloc_generic*.  Use add_global_generic.
1482         (Output_data_got::add_global_with_rela): Remove.  Change all
1483         callers to use add_global_with_rel.
1484         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1485         Output_data_reloc_generic*.  Use add_global_generic.
1486         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1487         callers to use add_global_pair_with_rel.
1488         (Output_data_got::add_local): Change object to Relobj*.
1489         (Output_data_got::add_local_plt): Likewise.
1490         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1491         change rel_dyn to Output_data_reloc_generic*.  Use
1492         add_local_generic.
1493         (Output_data_got::add_local_with_rela): Remove.  Change all
1494         callers to use all_local_with_rel.
1495         (Output_data_got::add_local_pair_with_rel): Change object to
1496         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1497         add_output_section_generic.
1498         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1499         callers to use add_local_pair_with_rel.
1500         (Output_data_got::reserve_local): Change object to Relobj*.
1501         * output.h: (class Output_data_reloc_generic): Add pure virtual
1502         declarations for add_global_generic, add_local_generic,
1503         add_output_section_generic.
1504         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1505         functions for Output_data_reloc_generic.  Update declarations for
1506         changes listed in output.cc.
1507         (class Output_data_got): Change template parameter to got_size.
1508         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1509         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1510         function.
1511         (Sized_relobj_incr::do_local_plt_offset): New function.
1512         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1513         add_global_generic.
1514
1515 2011-12-17  Cary Coutant  <ccoutant@google.com>
1516
1517         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1518         * resolve.cc (Symbol_table::resolve): Likewise.
1519         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1520         arrays.
1521         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1522
1523 2011-12-16  Ian Lance Taylor  <iant@google.com>
1524
1525         * output.h (Output_data_reloc_generic::add): Only call
1526         add_dynamic_reloc if this is a dynamic reloc section.
1527
1528 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1529
1530         PR gold/13505
1531         * target-reloc.h (apply_relocation): Replace <64, false> with
1532         <size, big_endian>.
1533
1534 2011-11-25  Nick Clifton  <nickc@redhat.com>
1535
1536         * po/it.po: New Italian translation.
1537
1538 2011-11-17  Sterling Augustine  <saugustine@google.com>
1539
1540         * script.cc (script_include_directive): Implement.
1541         (read_script_file): New local variables name and search_path. Update
1542         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1543         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1544         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1545
1546 2011-11-11  Sterling Augustine  <saugustine@google.com>
1547
1548         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1549         (file_or_sections_cmd): Likewise.
1550
1551 2011-11-11  Doug Kwan  <dougkwan@google.com>
1552
1553         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1554         if --just-symbols is given.
1555
1556 2011-11-10  Doug Kwan  <dougkwan@google.com>
1557
1558         PR gold/13362
1559         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1560         when processing data relocs.
1561         * reloc.h (Relocate_functions::rel_unaligned): New method.
1562         (Relocate_functions::pcrel_unaligned): Ditto.
1563         (Relocate_functions::rel32_unaligned): Ditto.
1564         (Relocate_functions::pcrel32_unaligned): Ditto.
1565
1566 2011-11-09  Doug Kwan  <dougkwan@google.com>
1567
1568         PR gold/13362
1569         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1570         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1571         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1572         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1573         (Relocate_functions::rel_unaligned): New.
1574         (Relocate_functions::rel32_unaligned): New.
1575         * target-reloc.h (relocate_for_relocatable): Add code to handle
1576         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1577         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1578         arm_unaligned_reloc_r): New targets.
1579         * testsuite/Makefile.in: Regenerate.
1580         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1581         linking.
1582
1583 2011-11-02  Ian Lance Taylor  <iant@google.com>
1584
1585         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1586         NATIVE_LINKER.
1587         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1588         * options.cc (General_options::finalize): Use library search path
1589         from configure script if specified.  If not native and no sysroot,
1590         only search TOOLLIBDIR.
1591         * options.h (Search_directory::Search_directory): Change name to
1592         const std::string&.
1593         (General_options::add_to_library_path_with_sysroot): Change arg to
1594         const std::string&.
1595         * configure, Makefile.in, config.in: Rebuild.
1596
1597 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1598
1599         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1600         we are working around the ARM1176 Erratum.
1601         * options.h (General_options::fix_arm1176): Add option.
1602         * testsuite/Makefile.am: Add testcases, and keep current ones
1603         working.
1604         * testsuite/Makefile.in: Regenerate.
1605         * testsuite/arm_fix_1176.s: New file.
1606         * testsuite/arm_fix_1176.sh: Likewise.
1607
1608 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1609
1610         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1611         may_use_blx_.
1612         (Target_arm::may_use_blx): Remove method.
1613         (Target_arm::set_may_use_blx): Likewise.
1614         (Target_arm::may_use_v4t_interworking): New method.
1615         (Target_arm::may_use_v5t_interworking): Likewise.
1616         (Target_arm::may_use_blx_): Remove member variable.
1617         (Arm_relocate_functions::arm_branch_common): Check for v5T
1618         interworking.
1619         (Arm_relocate_functions::thumb_branch_common): Likewise.
1620         (Reloc_stub::stub_type_for_reloc): Likewise.
1621         (Target_arm::do_finalize_sections): Correct interworking checks.
1622         * testsuite/Makefile.am: Add new tests.
1623         * testsuite/Makefile.in: Regenerate.
1624         * testsuite/arm_farcall_arm_arm.s: New test.
1625         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1626         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1627         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1628         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1629         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1630         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1631         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1632
1633 2011-10-31  Cary Coutant  <ccoutant@google.com>
1634
1635         PR gold/13023
1636         * expression.cc (Expression::eval_with_dot): Add
1637         is_section_dot_assignment parameter.
1638         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1639         absolute and assigning to dot within a section.
1640         * script-sections.cc
1641         (Output_section_element_assignment::set_section_addresses): Pass
1642         dot_section to set_if_absolute.
1643         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1644         as is_section_dot_assignment flag to eval_with_dot.
1645         (Output_section_element_dot_assignment::set_section_addresses):
1646         Likewise.
1647         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1648         parameter.  Also set value if relative to dot_section; set the
1649         symbol's output_section.
1650         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1651         parameter.  Adjust all callers.
1652         (Expression::eval_maybe_dot): Likewise.
1653         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1654         Adjust all callers.
1655         * testsuite/script_test_2.t: Test assignment of an absolute value
1656         to dot within an output section element.
1657
1658 2011-10-31  Cary Coutant  <ccoutant@google.com>
1659
1660         * options.h (class General_options): Add --[no-]gnu-unique options.
1661         * symtab.cc (Symbol_table::sized_write_globals): Convert
1662         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1663
1664 2011-10-31  Cary Coutant  <ccoutant@google.com>
1665
1666         PR gold/13359
1667         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1668         unnecessary assertion.
1669         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1670
1671 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1672
1673         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1674         gc_mark_symbol.
1675         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1676         gc_mark_symbol.
1677         Change to just keep the section associated with symbol.
1678         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1679         they are externally visible and --export-dynamic is turned on.
1680         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1681
1682 2011-10-19  Ian Lance Taylor  <iant@google.com>
1683
1684         PR gold/13163
1685         * script-sections.cc
1686         (Output_section_element_dot_assignment::needs_output_section): New
1687         function.
1688
1689 2011-10-19  Ian Lance Taylor  <iant@google.com>
1690
1691         PR gold/13204
1692         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1693         --section-start option was seen.
1694         * options.h (General_options::any_section_start): New function.
1695
1696 2011-10-18  David S. Miller  <davem@davemloft.net>
1697
1698         PR binutils/13301
1699         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1700         member to track relocation locations that have moved during TLS
1701         reloc optimizations.
1702         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1703         (Target_sparc::Relocate::relocate): Adjust view down by 4
1704         bytes if it matches reloc_adjust_addr_.
1705         (Target_sparc::Relocate::relocate_tls): Always move the
1706         __tls_get_addr call delay slot instruction forward 4 bytes when
1707         performing relaxation.
1708
1709 2011-10-18  Cary Coutant  <ccoutant@google.com>
1710
1711         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1712         (Output_file::map_no_anonymous): Check for non-zero
1713         return code from posix_fallocate.
1714
1715 2011-10-17  Cary Coutant  <ccoutant@google.com>
1716
1717         PR gold/13245
1718         * plugin.cc (is_visible_from_outside): Check for symbols
1719         referenced from dynamic objects.
1720         * resolve.cc (Symbol_table::resolve): Don't count references
1721         from dynamic objects as references from real ELF files.
1722         * testsuite/plugin_test_2.sh: Adjust expected result.
1723
1724 2011-10-17  Cary Coutant  <ccoutant@google.com>
1725
1726         * gold.cc: Include timer.h.
1727         (queue_middle_tasks): Stamp time.
1728         (queue_final_tasks): Likewise.
1729         * main.cc (main): Store timer in parameters.  Print timers
1730         for each pass.
1731         * parameters.cc (Parameters::Parameters): Initialize timer_.
1732         (Parameters::set_timer): New function.
1733         (set_parameters_timer): New function.
1734         * parameters.h (Parameters::set_timer): New function.
1735         (Parameters::timer): New function.
1736         (Parameters::timer_): New data member.
1737         (set_parameters_timer): New function.
1738         * timer.cc (Timer::stamp): New function.
1739         (Timer::get_pass_time): New function.
1740         * timer.h (Timer::stamp): New function.
1741         (Timer::get_pass_time): New function.
1742         (Timer::pass_times_): New data member.
1743
1744 2011-10-17  Cary Coutant  <ccoutant@google.com>
1745
1746         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1747         task for members of lib groups.
1748
1749 2011-10-17  Cary Coutant  <ccoutant@google.com>
1750
1751         PR gold/13288
1752         * fileread.cc (File_read::find_view): Add assert.
1753         (File_read::make_view): Move bounds check (replace with assert)...
1754         (File_read::find_or_make_view): ... to here.
1755
1756 2011-10-12  Cary Coutant  <ccoutant@google.com>
1757
1758         * output.cc (Output_file::open_base_file): Handle case where
1759         ::read returns less than requested size.
1760
1761 2011-10-10  Cary Coutant  <ccoutant@google.com>
1762
1763         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1764         Initialize defined_count_.
1765         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1766         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1767         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1768         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1769         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1770         * incremental.h (Sized_relobj_incr::defined_count_): New data
1771         member.
1772         (Sized_incr_dynobj::defined_count_): New data member.
1773         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1774         Return zeroes instead of internal error.
1775
1776 2011-10-10  Cary Coutant  <ccoutant@google.com>
1777
1778         PR gold/13249
1779         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1780         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1781         * output.h (class Output_reloc): Add use_plt_offset flag.
1782         (Output_reloc::type_): Adjust size of bit field.
1783         (Output_reloc::use_plt_offset_): New bit field.
1784         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1785         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1786         flag.  Adjust all callers.
1787         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1788         creating RELATIVE relocations.
1789
1790 2011-10-10  Nick Clifton  <nickc@redhat.com>
1791
1792         * po/es.po: Updated Spanish translation.
1793         * po/fi.po: Updated Finnish translation.
1794
1795 2011-10-03   Diego Novillo  <dnovillo@google.com>
1796
1797         * options.cc (parse_uint): Fix dereference of RETVAL.
1798
1799 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1800
1801         * layout.h (section_order_map_): New member.
1802         (get_section_order_map): New member function.
1803         * output.cc (Output_section::add_input_section): Check for patterns
1804         only when --section-ordering-file is specified.
1805         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1806         output_sections have been formed.
1807         * layout.cc (Layout_Layout): Initialize section_order_map_.
1808         * plugin.cc (update_section_order): Store order in order_map. Do not
1809         update the order.
1810         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1811         * testsuite/Makefile.in: Regenerate.
1812         * testsuite/plugin_section_order.c: New file.
1813         * testsuite/plugin_final_layout.cc: New file.
1814         * testsuite/plugin_final_layout.sh: New file.
1815
1816 2011-09-29  Cary Coutant  <ccoutant@google.com>
1817
1818         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1819         Check for NULL.
1820         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1821         symbols during incremental update.
1822         (Symbol_table::add_from_dynobj): Likewise.
1823
1824 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1825             Ian Lance Taylor  <iant@google.com>
1826
1827         * symtab.cc (Symbol_table::define_special_symbol): Always
1828         canonicalize version string.
1829
1830 2011-09-26  Cary Coutant  <ccoutant@google.com>
1831
1832         * gold.cc (queue_initial_tasks): Move option checks ...
1833         * options.cc (General_options::finalize): ... to here. Disable
1834         some options; make others fatal.
1835
1836 2011-09-26  Cary Coutant  <ccoutant@google.com>
1837
1838         gcc PR lto/47247
1839         * plugin.cc (get_symbols_v2): New function.
1840         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1841         (is_referenced_from_outside): New function.
1842         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1843         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1844         (get_symbols): Pass version parameter.
1845         (get_symbols_v2): New function.
1846         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1847         parameter.
1848         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1849         (onload): Add LDPT_GET_SYMBOLS_V2.
1850         (all_symbols_read_hook): Use get_symbols_v2; check for
1851         LDPR_PREVAILING_DEF_IRONLY_EXP.
1852         * testsuite/plugin_test_3.sh: Update expected results.
1853
1854 2011-09-23  Simon Baldwin  <simonb@google.com>
1855
1856         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1857         configuration options.
1858         * configure: Regenerate.
1859         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1860         * Makefile.in: Regenerate.
1861         * testsuite/Makefile.in: Regenerate.
1862
1863 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1864
1865         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1866
1867 2011-09-19  Cary Coutant  <ccoutant@google.com>
1868
1869         * incremental.cc (can_incremental_update): Fix typo in comment.
1870         * incremental.h (can_incremental_update): Likewise.
1871
1872 2011-09-18  Cary Coutant  <ccoutant@google.com>
1873
1874         * incremental.cc (can_incremental_update): New function.
1875         * incremental.h (can_incremental_update): New function.
1876         * layout.cc (Layout::init_fixed_output_section): Call it.
1877         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1878         * object.cc (Sized_relobj_file::do_layout): Call
1879         can_incremental_update.
1880
1881 2011-09-13  Cary Coutant  <ccoutant@google.com>
1882
1883         * configure.ac: Check for glibc support for gnu_indirect_function
1884         support with static linking, setting automake conditional
1885         IFUNC_STATIC.
1886         * Makefile.in: Regenerate.
1887         * configure: Regenerate.
1888
1889         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1890         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1891         for IFUNC_STATIC.
1892         * testsuite/Makefile.in: Regenerate.
1893
1894 2011-09-13  Cary Coutant  <ccoutant@google.com>
1895
1896         * incremental.cc (Sized_relobj_incr::do_layout): Call
1897         report_comdat_group for kept comdat sections.
1898         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1899         * testsuite/Makefile.in: Regenerate.
1900         * testsuite/incr_comdat_test_1.cc: New source file.
1901         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1902         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1903         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1904
1905 2011-09-13  Ian Lance Taylor  <iant@google.com>
1906
1907         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1908         variable external_symbols_offset.
1909
1910 2011-09-12  Ian Lance Taylor  <iant@google.com>
1911
1912         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1913         triggered if object has no symbols.
1914
1915 2011-09-09  David S. Miller  <davem@davemloft.net>
1916
1917         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1918         (Output_fill_debug_line::do_write): Likewise.
1919
1920 2011-08-29  Cary Coutant  <ccoutant@google.com>
1921
1922         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1923         casts to match formatting specs.
1924         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1925
1926 2011-08-26  Cary Coutant  <ccoutant@google.com>
1927
1928         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1929         remaining hole size when allocating.
1930         (Layout::make_output_section): Set fill methods for debug sections.
1931         * layout.h (Free_list::Free_list_node): Move from private to
1932         public.
1933         (Free_list::set_min_hole_size): New function.
1934         (Free_list::begin, Free_list::end): New functions.
1935         (Free_list::min_hole_): New data member.
1936         * output.cc: Include dwarf.h.
1937         (Output_fill_debug_info::do_minimum_hole_size): New function.
1938         (Output_fill_debug_info::do_write): New function.
1939         (Output_fill_debug_line::do_minimum_hole_size): New function.
1940         (Output_fill_debug_line::do_write): New function.
1941         (Output_section::Output_section): Initialize new data member.
1942         (Output_section::set_final_data_size): Ensure patch space is larger
1943         than minimum hole size.
1944         (Output_section::do_write): Fill holes in debug sections.
1945         * output.h (Output_fill): New class.
1946         (Output_fill_debug_info): New class.
1947         (Output_fill_debug_line): New class.
1948         (Output_section::set_free_space_fill): New function.
1949         (Output_section::free_space_fill_): New data member.
1950         * testsuite/Makefile.am (incremental_test_3): Add
1951         --incremental-patch option.
1952         (incremental_test_4): Likewise.
1953         (incremental_test_5): Likewise.
1954         (incremental_test_6): Likewise.
1955         (incremental_copy_test): Likewise.
1956         (incremental_common_test_1): Likewise.
1957         * testsuite/Makefile.in: Regenerate.
1958
1959 2011-08-26  Nick Clifton  <nickc@redhat.com>
1960
1961         * po/es.po: Updated Spanish translation.
1962
1963 2011-08-01  Cary Coutant  <ccoutant@google.com>
1964
1965         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1966         * gold/testsuite/Makefile.in: Regenerate.
1967         * gold/testsuite/justsyms_exec.c: New source file.
1968         * gold/testsuite/justsyms_lib.c: New source file.
1969
1970 2011-08-01  Cary Coutant  <ccoutant@google.com>
1971
1972         * layout.cc (Layout::set_segment_offsets): Don't realign text
1973         segment if -Ttext was specified.
1974         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1975         file type.
1976         * object.h (Sized_relobj_file::e_type): New function.
1977         (Sized_relobj_file::e_type_): New data member.
1978         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1979         base address for ET_EXEC files.
1980         * target.cc (Target::do_make_elf_object_implementation): Allow
1981         ET_EXEC files with --just-symbols option.
1982
1983 2011-07-28  Cary Coutant  <ccoutant@google.com>
1984
1985         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1986         Add thread_number parameter.
1987         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1988         * workqueue-threads.cc
1989         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1990         current thread if its thread number is greater than desired thread
1991         count.
1992         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1993         Add thread_number parameter.
1994         (Workqueue::should_cancel_thread): Likewise.
1995         (Workqueue::find_runnable_or_wait): Pass thread_number to
1996         should_cancel_thread.
1997         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1998         parameter.
1999
2000 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2001
2002         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2003         only after checking if it cannot be forced local.
2004         * symtab.h (is_externally_visible): Check if the symbol is not forced
2005         local.
2006
2007 2011-07-15  Ian Lance Taylor  <iant@google.com>
2008
2009         * options.h (class General_options): Add --print-output-format.
2010         Move -EL next to -EB, for  better --help output.
2011         * target-select.cc: Include <cstdio>, "options.h", and
2012         "parameters.h".
2013         (Target_selector::do_target_bfd_name): New function.
2014         (print_output_format): New function.
2015         * target-select.h (class Target_selector): Update declarations.
2016         (Target_selector::target_bfd_name): New function.
2017         (print_output_format): Declare.
2018         * main.cc: Include "target-select.h".
2019         (main): Handle --print-output-format.
2020         * gold.cc: Include "target-select.h".
2021         (queue_initial_tasks): Handle --print-output-format when there are
2022         no input files.
2023         * parameters.cc (parameters_force_valid_target): Give a better
2024         error message if -EB/-EL does not match target.
2025         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2026         function.
2027
2028 2011-07-15  Ian Lance Taylor  <iant@google.com>
2029
2030         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2031         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2032         (Output_data_plt_i386::do_write): Write address of .dynamic
2033         section to first entry in .got.plt section.
2034         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2035         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2036         Initialize layout_.
2037         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2038         section to first entry in .got.plt section.
2039         * layout.h (Layout::dynamic_section): New function.
2040
2041 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2042
2043         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2044         to claim_file call.
2045         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2046         input_section_position_, and input_section_glob_.
2047         (read_layout_from_file): Call function section_ordering_specified.
2048         * layout.h (is_section_ordering_specified): New function.
2049         (section_ordering_specified): New function.
2050         (section_ordering_specified_): New boolean member.
2051         * main.cc(main): Call load_plugins after layout object is defined.
2052         * output.cc (Output_section::add_input_section): Use
2053         function section_ordering_specified to check if section ordering is
2054         needed.
2055         * output.cc (Output_section::add_relaxed_input_section): Use
2056         function section_ordering_specified to check if section ordering is
2057         needed.
2058         (Output_section::update_section_layout): New function.
2059         (Output_section::sort_attached_input_sections): Check if input section
2060         must be reordered.
2061         * output.h (Output_section::update_section_layout): New function.
2062         * plugin.cc (get_section_count): New function.
2063         (get_section_type): New function.
2064         (get_section_name): New function.
2065         (get_section_contents): New function.
2066         (update_section_order): New function.
2067         (allow_section_ordering): New function.
2068         (Plugin::load): Add the new interfaces to the transfer vector.
2069         (Plugin_manager::load_plugins): New parameter.
2070         (Plugin_manager::all_symbols_read): New parameter.
2071         (Plugin_manager::claim_file): New parameter. Save the elf object for
2072         unclaimed objects.
2073         (Plugin_manager::get_elf_object): New function.
2074         (Plugin_manager::get_view): Change to directly use the bool to check
2075         if get_view is called from claim_file_hook.
2076         * plugin.h (input_objects): New function
2077         (Plugin__manager::load_plugins): New parameter.
2078         (Plugin_manager::claim_file): New parameter.
2079         (Plugin_manager::get_elf_object): New function.
2080         (Plugin_manager::in_claim_file_handler): New function.
2081         (Plugin_manager::in_claim_file_handler_): New member.
2082         (layout): New function.
2083         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2084         handler with an extra parameter. Make the elf object before calling
2085         claim_file handler.
2086         * testsuite/plugin_test.c (get_section_count): New function pointer.
2087         (get_section_type): New function pointer.
2088         (get_section_name): New function pointer.
2089         (get_section_contents): New function pointer.
2090         (update_section_order): New function pointer.
2091         (allow_section_ordering): New function pointer.
2092         (onload): Check if the new interfaces exist.
2093
2094 2011-07-13  Ian Lance Taylor  <iant@google.com>
2095
2096         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2097         relro section.
2098         * x86_64.cc (Target_x86_64::got_section): Likewise.
2099         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2100         (relro_now_test_SOURCES): New variable.
2101         (relro_now_test_DEPENDENCIES): New variable.
2102         (relro_now_test_LDFLAGS): New variable.
2103         (relro_now_test_LDADD): New variable.
2104         (relro_now_test.so): New target.
2105         * testsuite/Makefile.in: Rebuild.
2106
2107 2011-07-12  Ian Lance Taylor  <iant@google.com>
2108
2109         PR gold/12980
2110         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2111         GLOB_DAT relocation rather than a RELATIVE relocation for a
2112         protected symbol when creating a shared library.
2113         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2114         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2115         * testsuite/protected_main_1.cc (main): Test that protected
2116         function has same address.
2117
2118 2011-07-11  Ian Lance Taylor  <iant@google.com>
2119
2120         PR gold/12979
2121         * options.h (class General_options): Add -Bgroup.
2122         * options.cc (General_options::finalize): If -Bgroup is set,
2123         default to --unresolved-symbols=report-all.
2124         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2125         * target-reloc.h (issue_undefined_symbol_error): Handle
2126         --unresolved-symbols=report-all.
2127
2128 2011-07-08  Ian Lance Taylor  <iant@google.com>
2129
2130         PR gold/11985
2131         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2132         if linker script discards key sections.
2133         (Layout::create_dynamic_symtab): Likewise.
2134         (Layout::assign_local_dynsym_offsets): Likewise.
2135         (Layout::sized_create_version_sections): Likewise.
2136         (Layout::create_interp): Likewise.
2137         (Layout::finish_dynamic_section): Likewise.
2138         (Layout::set_dynamic_symbol_size): Likewise.
2139
2140 2011-07-08  Ian Lance Taylor  <iant@google.com>
2141
2142         PR gold/12386
2143         * options.h (class General_options): Add --unresolved-symbols.
2144         * target-reloc.h (issue_undefined_symbol_error): Check
2145         --unresolved-symbols.  Add comments.
2146
2147 2011-07-08  Ian Lance Taylor  <iant@google.com>
2148
2149         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2150         expression more complex.
2151
2152 2011-07-08  Ian Lance Taylor  <iant@google.com>
2153
2154         PR gold/11317
2155         * target-reloc.h (issue_undefined_symbol_error): New inline
2156         function, broken out of relocate_section.
2157         (relocate_section): Call issue_undefined_symbol_error.
2158         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2159         there is no TLS segment if we are about to issue an undefined
2160         symbol error.
2161         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2162
2163 2011-07-08  Ian Lance Taylor  <iant@google.com>
2164
2165         PR gold/12279
2166         * resolve.cc (Symbol_table::should_override): Add fromtype
2167         parameter.  Change all callers.  Give error when linking together
2168         TLS and non-TLS symbol.
2169         (Symbol_table::should_override_with_special): Add fromtype
2170         parameter.  Change all callers.
2171         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2172         there is no TLS segment if we have reported some errors.
2173         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2174
2175 2011-07-08  Ian Lance Taylor  <iant@google.com>
2176
2177         PR gold/12372
2178         * target.h (Target::plt_address_for_global): New function.
2179         (Target::plt_address_for_local): New function.
2180         (Target::plt_section_for_global): Remove.
2181         (Target::plt_section_for_local): Remove.
2182         (Target::do_plt_address_for_global): New virtual function.
2183         (Target::do_plt_address_for_local): New virtual function.
2184         (Target::do_plt_section_for_global): Remove.
2185         (Target::do_plt_section_for_local): Remove.
2186         (Target::register_global_plt_entry): Add Symbol_table and Layout
2187         parameters.
2188         * output.cc (Output_data_got::Got_entry::write): Use
2189         plt_address_for_global and plt_address_for_local.
2190         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2191         address of output section.
2192         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2193         got_irelative_, and irelative_count_ fields.  Update
2194         declarations.
2195         (Output_data_plt_i386::has_irelative_section): New function.
2196         (Output_data_plt_i386::entry_count): Add irelative_count_.
2197         (Output_data_plt_i386::set_final_data_size): Likewise.
2198         (class Target_i386): Add got_irelative_ and rel_irelative_
2199         fields.  Update declarations.
2200         (Target_i386::Target_i386): Initialize new fields.
2201         (Target_i386::do_plt_address_for_global): New function replacing
2202         do_plt_section_for_global.
2203         (Target_i386::do_plt_address_for_local): New function replacing
2204         do_plt_section_for_local.
2205         (Target_i386::got_section): Create got_irelative_.
2206         (Target_i386::rel_irelative_section): New function.
2207         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2208         fields.  Don't define __rel_iplt_{start,end}.
2209         (Output_data_plt_i386::add_entry): Add symtab and layout
2210         parameters.  Change all callers.  Use different PLT and GOT for
2211         IFUNC symbols.
2212         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2213         layout parameters.  Change all callers.  Use different PLT and
2214         GOT.
2215         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2216         (Output_data_plt_i386::rel_irelative): New function.
2217         (Output_data_plt_i386::address_for_global): New function.
2218         (Output_data_plt_i386::address_for_local): New function.
2219         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2220         IRELATIVE GOT when changing IFUNC GOT entries.
2221         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2222         reloc.
2223         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2224         if we didn't create an IRELATIVE GOT.
2225         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2226         plt_address_for_local.
2227         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2228         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2229         got_irelative_, and irelative_count_ fields.  Update
2230         declarations.
2231         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2232         Initialize new fields.  Remove symtab parameter.  Change all
2233         callers.
2234         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2235         irelative_count_.
2236         (Output_data_plt_x86_64::has_irelative_section): New function.
2237         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2238         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2239         fields.  Update declarations.
2240         (Target_x86_64::Target_x86_64): Initialize new fields.
2241         (Target_x86_64::do_plt_address_for_global): New function replacing
2242         do_plt_section_for_global.
2243         (Target_x86_64::do_plt_address_for_local): New function replacing
2244         do_plt_section_for_local.
2245         (Target_x86_64::got_section): Create got_irelative_.
2246         (Target_x86_64::rela_irelative_section): New function.
2247         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2248         all callers.  Don't create __rel_iplt_{start,end}.
2249         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2250         parameters.  Change all callers.  Use different PLT and GOT for
2251         IFUNC symbols.
2252         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2253         layout parameters.  Change all callers.  Use different PLT and
2254         GOT.
2255         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2256         parameters.  Change all callers.  Use different PLT and GOT for
2257         IFUNC symbols.
2258         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2259         (Output_data_plt_x86_64::rela_irelative): New function.
2260         (Output_data_plt_x86_64::address_for_global): New function.
2261         (Output_data_plt_x86_64::address_for_local): New function.
2262         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2263         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2264         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2265         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2266         parameters.
2267         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2268         reloc.
2269         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2270         symbols if we didn't create an IRELATIVE GOT.
2271         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2272         plt_address_for_local.
2273         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2274         * testsuite/ifuncvar1.c: New test file.
2275         * testsuite/ifuncvar2.c: New test file.
2276         * testsuite/ifuncvar3.c: New test file.
2277         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2278         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2279         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2280         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2281         * testsuite/Makefile.in: Rebuild.
2282
2283 2011-07-07  Cary Coutant  <ccoutant@google.com>
2284
2285         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2286         (two_file_test_1_ndebug.o): Likewise.
2287         (two_file_test_1b_ndebug.o): Likewise.
2288         (two_file_test_2_ndebug.o): Likewise.
2289         (two_file_test_main_ndebug.o): Likewise.
2290         (incremental_test_2): Link with no-debug versions.
2291
2292 2011-07-06  Cary Coutant  <ccoutant@google.com>
2293
2294         * gold/incremental.cc
2295         (Output_section_incremental_inputs::write_info_blocks): Check for
2296         hidden and internal symbols.
2297
2298 2011-07-06  Cary Coutant  <ccoutant@google.com>
2299
2300         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2301         Check disposition for startup file.
2302         (Incremental_inputs::report_command_line): Ignore
2303         --incremental-startup-unchanged option.
2304         * options.cc (General_options::parse_incremental_startup_unchanged):
2305         New function.
2306         (General_options::General_options): Initialize new data member.
2307         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2308         (General_options): Add --incremental-startup-unchanged option.
2309         (General_options::incremental_startup_disposition): New function.
2310         (General_options::incremental_startup_disposition_): New data member.
2311
2312 2011-07-06  Cary Coutant  <ccoutant@google.com>
2313
2314         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2315         input file index to Script_info ctor.
2316         (Sized_incremental_binary::do_file_has_changed): Find the
2317         command-line argument for files named in scripts.
2318         * incremental.h (Script_info::Script_info): New ctor
2319         with input file index.
2320         (Script_info::input_file_index): New function.
2321         (Script_info::input_file_index_): New data member.
2322         (Incremental_binary::get_library): Add const.
2323         (Incremental_binary::get_script_info): Add const.
2324         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2325         * testsuite/Makefile.am (incremental_test_5): New test case.
2326         (incremental_test_6): New test case.
2327         * testsuite/Makefile.in: Regenerate.
2328
2329 2011-07-06  Cary Coutant  <ccoutant@google.com>
2330
2331         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2332         debug output when command lines differ.
2333
2334 2011-07-06  Cary Coutant  <ccoutant@google.com>
2335
2336         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2337         --incremental-patch option.
2338         * layout.cc (Free_list::allocate): Extend allocation beyond original
2339         end if enabled.
2340         (Layout::make_output_section): Mark sections that should get
2341         patch space.
2342         * options.cc (parse_percent): New function.
2343         * options.h (parse_percent): New function.
2344         (DEFINE_percent): New macro.
2345         (General_options): Add --incremental-patch option.
2346         * output.cc (Output_section::Output_section): Initialize new data
2347         members.
2348         (Output_section::add_input_section): Print section name when out
2349         of patch space.
2350         (Output_section::add_output_section_data): Likewise.
2351         (Output_section::set_final_data_size): Add patch space when
2352         doing --incremental-full.
2353         (Output_section::do_reset_address_and_file_offset): Remove patch
2354         space.
2355         (Output_segment::set_section_list_addresses): Print debug output
2356         only if --incremental-update.
2357         * output.h (Output_section::set_is_patch_space_allowed): New function.
2358         (Output_section::is_patch_space_allowed_): New data member.
2359         (Output_section::patch_space_): New data member.
2360         * parameters.cc (Parameters::incremental_full): New function.
2361         * parameters.h (Parameters::incremental_full): New function
2362         * testsuite/Makefile.am (incremental_test_2): Add test for
2363         --incremental-patch option.
2364         * testsuite/Makefile.in: Regenerate.
2365         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2366         (t18): Remove function body.
2367
2368 2011-07-05  Doug Kwan  <dougkwan@google.com>
2369
2370         PR gold/12771
2371         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2372         Arm_Address type for relocation result.
2373         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2374         overflow check.
2375         (Arm_relocate_functions::abs32): Use unaligned access.
2376         (Arm_relocate_functions::rel32): Ditto.
2377         (Arm_relocate_functions::prel31): Ditto.
2378         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2379         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2380         static data relocations.
2381         * testsuite/Makefile.in: Regnerate.
2382         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2383
2384 2011-07-05  Ian Lance Taylor  <iant@google.com>
2385
2386         PR gold/12392
2387         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2388         symbols if necessary.
2389         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2390
2391 2011-07-05  Ian Lance Taylor  <iant@google.com>
2392
2393         PR gold/12952
2394         * resolve.cc (Symbol::override_base_with_special): Simply override
2395         version with special symbol version, ignoring previous version.
2396
2397 2011-07-05  Ian Lance Taylor  <iant@google.com>
2398
2399         * object.cc (Sized_relobj_file::include_section_group): Add
2400         information to comment about signature location.
2401
2402 2011-07-02  Ian Lance Taylor  <iant@google.com>
2403
2404         PR gold/12957
2405         * options.h (class General_options): Add -f and -F.
2406         * options.cc (General_options::finalize): Fatal error if -f/-F
2407         are used without -shared.
2408         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2409
2410 2011-07-02  Ian Lance Taylor  <iant@google.com>
2411
2412         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2413
2414 2011-07-01  Ian Lance Taylor  <iant@google.com>
2415
2416         PR gold/12525
2417         PR gold/12952
2418         * resolve.cc (Symbol::override_base_with_special): Don't override
2419         the version if the overriding symbol has a different name.
2420         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2421         all callers.  If we give an error about an undefined version,
2422         define the base version if necessary.
2423         * dynobj.h (class Versions): Update declaration.
2424         * testsuite/weak_alias_test_5.cc: New file.
2425         * testsuite/weak_alias_test.script: New file.
2426         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2427         and versioned_alias have the right value, and call t2.
2428         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2429         weak_alias_test_5.so.
2430         (weak_alias_test_LDADD): Likewise.
2431         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2432         * testsuite/Makefile.in: Rebuild.
2433
2434 2011-07-01  Ian Lance Taylor  <iant@google.com>
2435
2436         PR gold/12525
2437         * options.h (class General_options): Support -z notext.
2438         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2439         -Wl,-z,notext.
2440         (two_file_shared_nonpic.so): Likewise.
2441         (two_file_shared_mixed.so): Likewise.
2442         (two_file_shared_mixed_1.so): Likewise.
2443         (weak_undef_lib_nonpic.so): Likewise.
2444         (alt/weak_undef_lib_nonpic.so): Likewise.
2445         (tls_test_shared_nonpic.so): Likewise.
2446         * testsuite/Makefile.in: Rebuild.
2447
2448 2011-07-01  Ian Lance Taylor  <iant@google.com>
2449
2450         PR gold/12525
2451         * configure.ac: Test whether static linking works, setting
2452         the automake conditional HAVE_STATIC.
2453         * testsuite/Makefile.am: Disable tests using -static if
2454         HAVE_STATIC is not true.
2455         * configure, testsuite/Makefile.in: Rebuild.
2456
2457 2011-07-01  Ian Lance Taylor  <iant@google.com>
2458
2459         PR gold/12525
2460         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2461         Assert if we see DW_EH_PE_indirect.
2462         * target.h (Target::ehframe_datarel_base): New function.
2463         (Target::do_ehframe_datarel_base): New target function.
2464         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2465         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2466         function.
2467
2468 2011-07-01  Ian Lance Taylor  <iant@google.com>
2469
2470         PR gold/12571
2471         * options.h (class General_options): Add
2472         --ld-generated-unwind-info.
2473         * ehframe.cc (Fde::write): Add address parameter.  Change all
2474         callers.  If associated with PLT, fill in address and size.
2475         (Cie::set_output_offset): Only add merge mapping if there is an
2476         object.
2477         (Cie::write): Add address parameter.  Change all callers.
2478         (Eh_frame::add_ehframe_for_plt): New function.
2479         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2480         input_offset_ fields into union u_, with new plt field.
2481         (Fde::Fde): Adjust for new union field.
2482         (Fde::Fde) [Output_data version]: New constructor.
2483         (Fde::add_mapping): Only add merge mapping if there is an object.
2484         (class Cie): Update declarations.
2485         (class Eh_frame): Declare add_ehframe_for_plt.
2486         * layout.cc (Layout::layout_eh_frame): Break out code into
2487         make_eh_frame_section, and call it.
2488         (Layout::make_eh_frame_section): New function.
2489         (Layout::add_eh_frame_for_plt): New function.
2490         * layout.h (class Layout): Update declarations.
2491         * merge.cc (Merge_map::add_mapping): Add assertion.
2492         * i386.cc: Include "dwarf.h".
2493         (class Output_data_plt_i386): Make first_plt_entry,
2494         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2495         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2496         and plt_eh_frame_fde.
2497         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2498         boundary.  Call add_eh_frame_for_plt if appropriate.
2499         * x86_64.cc: Include "dwarf.h".
2500         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2501         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2502         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2503         and plt_eh_frame_fde.
2504         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2505         appropriate.
2506
2507 2011-06-29  Ian Lance Taylor  <iant@google.com>
2508
2509         PR gold/12629
2510         * object.cc (Sized_relobj_file::layout_section): Change shdr
2511         parameter to be const.
2512         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2513         out of do_layout.
2514         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2515         appropriate.  Call layout_eh_frame_section.
2516         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2517         sections.
2518         * object.h (class Sized_relobj_file): Update declarations.
2519
2520 2011-06-29  Ian Lance Taylor  <iant@google.com>
2521
2522         PR gold/12652
2523         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2524         modifier.
2525         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2526
2527 2011-06-29  Ian Lance Taylor  <iant@google.com>
2528
2529         PR gold/12675
2530         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2531         SHT_X86_64_UNWIND.
2532         * layout.cc (Layout::layout_eh_frame): Likewise.
2533
2534 2011-06-29  Ian Lance Taylor  <iant@google.com>
2535
2536         PR gold/12695
2537         * layout.cc (Layout::symtab_section_shndx): New function.
2538         * layout.h (class Layout): Declare symtab_section_shndx.
2539         * output.cc (Output_section::write_header): Call it.
2540
2541 2011-06-29  Ian Lance Taylor  <iant@google.com>
2542
2543         PR gold/12818
2544         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2545         symbols which are not used in a relocation.
2546
2547 2011-06-28  Ian Lance Taylor  <iant@google.com>
2548
2549         PR gold/12898
2550         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2551         script create indistinguishable segments.
2552         (Layout::set_segment_offsets): Use stable_sort when sorting
2553         segments.  Pass this to Compare_segments constructor.
2554         * layout.h (class Layout): Make segment_precedes non-static.
2555         (class Compare_segments): Change from struct to class.  Add
2556         layout_ field.  Add constructor.
2557         * script-sections.cc
2558         (Script_sections::attach_sections_using_phdrs_clause): Rename
2559         local orphan to is_orphan.  Don't report failure to put empty
2560         section in segment.  On attachment failure, report name of
2561         section, and attach to first PT_LOAD segment.
2562
2563 2011-06-28  Ian Lance Taylor  <iant@google.com>
2564
2565         PR gold/12934
2566         * target-select.cc (Target_selector::Target_selector): Add
2567         emulation parameter.  Change all callers.
2568         (select_target_by_bfd_name): Rename from select_target_by_name.
2569         Change all callers.
2570         (select_target_by_emulation): New function.
2571         (supported_emulation_names): New function.
2572         * target-select.h (class Target_selector): Add emulation_ field.
2573         Update declarations.
2574         (Target_selector::recognize_by_bfd_name): Rename from
2575         recognize_by_name.  Change all callers.
2576         (Target_selector::supported_bfd_names): Rename from
2577         supported_names.  Change all callers.
2578         (Target_selector::recognize_by_emulation): New function.
2579         (Target_selector::supported_emulations): New function.
2580         (Target_selector::emulation): New function.
2581         (Target_selector::do_recognize_by_bfd_name): Rename from
2582         do_recognize_by_name.  Change all callers.
2583         (Target_selector::do_supported_bfd_names): Rename from
2584         do_supported_names.  Change all callers.
2585         (Target_selector::do_recognize_by_emulation): New function.
2586         (Target_selector::do_supported_emulations): New function.
2587         (select_target_by_bfd_name): Change name in declaration.
2588         (select_target_by_emulation): Declare.
2589         (supported_emulation_names): Declare.
2590         * parameters.cc (parameters_force_valid_target): Try to find
2591         target based on emulation from -m option.
2592         * options.h (class General_options): Change doc string for -m.
2593         * options.cc (help): Print emulations.
2594         (General_options::parse_V): Likewise.
2595         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2596         Add emulation parameter.  Change all callers.
2597
2598 2011-06-28  Ian Lance Taylor  <iant@google.com>
2599
2600         * target.h (class Target): Add osabi_ field.
2601         (Target::osabi): New function.
2602         (Target::set_osabi): New function.
2603         (Target::Target): Initialize osabi_.
2604         (Target::do_adjust_elf_header): Make pure virtual.
2605         (Sized_target::do_adjust_elf_header): Declare.
2606         * target.cc (Sized_target::do_adjust_elf_header): New function.
2607         (class Sized_target): Instantiate all versions.
2608         * freebsd.h (class Target_freebsd): Remove.
2609         (Target_selector_freebsd::do_recognize): Call set_osabi on
2610         Target.
2611         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2612         (Target_selector_freebsd::set_osabi): Remove.
2613         * i386.cc (class Target_i386): Inherit from Sized_target rather
2614         than Target_freebsd.
2615         * x86_64.cc (class Target_x86_64): Likewise.
2616
2617 2011-06-28  Ian Lance Taylor  <iant@google.com>
2618
2619         * target.h (Target::can_check_for_function_pointers): Rewrite.
2620         Make non-virtual.
2621         (Target::can_icf_inline_merge_sections): Likewise.
2622         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2623         (Target::Target_info): Add can_icf_inline_merge_sections field.
2624         (Target::do_can_check_for_function_pointers): New virtual
2625         function.
2626         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2627         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2628         from can_check_for_function_pointers, move in file.
2629         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2630         section_may_have_icf_unsafe_poineters, move in file.
2631         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2632         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2633         Rename from can_check_for_function_pointers, move in file.
2634         (Target_i386::can_icf_inline_merge_sections): Remove.
2635         (Target_i386::i386_info): Initialize
2636         can_icf_inline_merge_sections.
2637         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2638         Initialize can_icf_inline_merge_sections.
2639         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2640         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2641         Rename from can_check_for_function_pointers, move in file.
2642         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2643         (Target_x86_64::x86_64_info): Initialize
2644         can_icf_inline_merge_sections.
2645         * testsuite/testfile.cc (Target_test::test_target_info):
2646         Likewise.
2647         * icf.cc (get_section_contents): Correct formatting.
2648
2649 2011-06-27  Ian Lance Taylor  <iant@google.com>
2650
2651         * symtab.cc (Symbol::versioned_name): New function.
2652         (Symbol_table::add_to_final_symtab): Use versioned_name when
2653         appropriate.
2654         (Symbol_table::sized_write_symbol): Likewise.
2655         * symtab.h (class Symbol): Declare versioned_name.
2656         * stringpool.h (class Stringpool_template): Add variant of add
2657         which takes a std::basic_string.
2658         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2659         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2660         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2661         (ver_test_12.o): New target.
2662         * testsuite/Makefile.in: Rebuild.
2663
2664 2011-06-27  Doug Kwan  <dougkwan@google.com>
2665
2666         * arm.cc (Arm_relocate_functions::thm_jump8,
2667         Arm_relocate_functions::thm_jump11): Use a wider signed
2668         type to compute offset.
2669         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2670         arm_thm_jump8.
2671         * testsuite/Makefile.in: Regenerate.
2672         * testsuite/arm_branch_in_range.sh: Check test results of
2673         arm_thm_jump11 and arm_thm_jump8.
2674         * testsuite/arm_thm_jump11.s: New test source file.
2675         * testsuite/arm_thm_jump11.t: New linker script.
2676         * testsuite/arm_thm_jump8.s: New test source file.
2677         * testsuite/arm_thm_jump8.t: New linker script.
2678
2679 2011-06-24  Ian Lance Taylor  <iant@google.com>
2680
2681         * layout.cc: Include "object.h".
2682         (ctors_sections_in_init_array): New static variable.
2683         (Layout::is_ctors_in_init_array): New function.
2684         (Layout::layout): Add entry to ctors_sections_in_init_array if
2685         appropriate.
2686         * layout.h (class Layout): Declare is_ctors_in_init_array.
2687         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2688         is_ctors_reverse_view is set.
2689         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2690         all callers.  Set is_ctors_reverse_view field of View_size.
2691         (Sized_relobj_file::reverse_words): New function.
2692         * object.h (Sized_relobj_file::View_size): Add
2693         is_ctors_reverse_view field.
2694         (class Sized_relobj_file): Update declarations.
2695         * testsuite/initpri3.c: New test.
2696         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2697         initpri3b.
2698         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2699         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2700         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2701         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2702         * testsuite/Makefile.in: Rebuild.
2703
2704 2011-06-24  Cary Coutant  <ccoutant@google.com>
2705
2706         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2707         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2708         (debug_msg_cdebug.err): New targets.
2709         * testsuite/Makefile.in: Regenerate.
2710         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2711         Fix checks for link with shared library.
2712
2713 2011-06-24  Doug Kwan  <dougkwan@google.com>
2714
2715         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2716         skip empty text sections.
2717         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2718
2719 2011-06-22  Ian Lance Taylor  <iant@google.com>
2720
2721         PR gold/12910
2722         * options.h (class General_options): Add --ctors-in-init-array.
2723         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2724         friends as SHT_PROGBITS for merging sections.
2725         (Layout::layout): Remove special handling of .init_array and
2726         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2727         and .dtors if ctors_in_init_array.
2728         (Layout::make_output_section): Force correct section types for
2729         .init_array and friends.  Don't sort if doing relocatable link,
2730         Don't sort .ctors and .dtors if ctors_in_init_array.
2731         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2732         (Layout::output_section_name): Add relobj parameter.  Change all
2733         callers.  Handle .ctors. and .dtors. in code rather than table.
2734         Handle .ctors and .dtors if ctors_in_init_array.
2735         (Layout::match_file_name): New function, moved from output.cc.
2736         * layout.h (class Layout): Update declarations.
2737         * output.cc: Include "layout.h".
2738         (Input_section_sort_entry::get_priority): New function.
2739         (Input_section_sort_entry::match_file_name): Just call
2740         Layout::match_file_name.
2741         (Output_section::Input_section_sort_init_fini_compare::operator()):
2742         Handle .ctors and .dtors.  Sort by explicit priority rather than
2743         by name.
2744         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2745         * testsuite/initpri2.c: New test.
2746         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2747         (check_PROGRAMS): Add initpri2.
2748         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2749         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2750         * configure, testsuite/Makefile.in: Rebuild.
2751
2752 2011-06-19  Ian Lance Taylor  <iant@google.com>
2753
2754         PR gold/12880
2755         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2756         .interp section to a PT_INTERP segment even if we have seen a
2757         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2758         clause in a linker script.
2759         (Layout::finalize): Don't create a .interp section if we've
2760         already create a PT_INTERP segment.
2761         (Layout::create_interp): Always call choose_output_section (revert
2762         patch of 2011-06-17).  Don't create PT_INTERP segment.
2763         * script-sections.cc
2764         (Script_sections::create_note_and_tls_segments): Add a .interp
2765         section to a PT_INTERP segment even if we have seen a
2766         --dynamic-linker option.
2767
2768 2011-06-18  Ian Lance Taylor  <iant@google.com>
2769
2770         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2771         merely because a non-PT_LOAD segment has a dynamic reloc.
2772
2773 2011-06-18  Ian Lance Taylor  <iant@google.com>
2774
2775         * layout.cc (Layout::finish_dynamic_section): Don't create
2776         DT_FLAGS entry if not needed.
2777
2778 2011-06-18  Ian Lance Taylor  <iant@google.com>
2779
2780         PR gold/12745
2781         * layout.cc (Layout::layout_eh_frame): Correct handling of
2782         writable .eh_frame section.
2783
2784 2011-06-17  Ian Lance Taylor  <iant@google.com>
2785
2786         PR gold/12893
2787         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2788         symbol is redefined with the exact same object and value.
2789
2790 2011-06-17  Ian Lance Taylor  <iant@google.com>
2791
2792         PR gold/12880
2793         * layout.h (class Layout): Add interp_segment_ field.
2794         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2795         (Layout::attach_allocated_section_to_segment): If making shared
2796         library, put .interp section in PT_INTERP segment.
2797         (Layout::finalize): Also call create_interp if -dynamic-linker
2798         option was used.
2799         (Layout::create_interp): Assert that there is no PT_INTERP
2800         segment.  If not using a SECTIONS clause, use make_output_section.
2801         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2802         * script-sections.cc
2803         (Script_sections::create_note_and_tls_segments): If making shared
2804         library, put .interp section in PT_INTERP segment.
2805
2806 2011-06-17  Ian Lance Taylor  <iant@google.com>
2807
2808         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2809         when making a shared library.
2810
2811 2011-06-17  Ian Lance Taylor  <iant@google.com>
2812
2813         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2814         parameter.  Change all callers.  Don't issue warning about PC32
2815         against locally defined symbol.
2816
2817 2011-06-16  Ian Lance Taylor  <iant@google.com>
2818
2819         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2820         occurs in same object.
2821
2822 2011-06-14  Alan Modra  <amodra@gmail.com>
2823
2824         * po/POTFILES.in: Regenerate.
2825
2826 2011-06-09  Ian Lance Taylor  <iant@google.com>
2827
2828         * script-sections.cc
2829         (Orphan_output_section::set_section_addresses): For a relocatable
2830         link set address to 0.
2831
2832 2011-06-09  Cary Coutant  <ccoutant@google.com>
2833
2834         PR gold/12804
2835         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2836         used with --compress-debug-sections.
2837         * gold/object.cc (Sized_relobj_file::do_layout): Report
2838         uncompressed size of compressed input sections.
2839
2840 2011-06-08  Cary Coutant  <ccoutant@google.com>
2841
2842         PR gold/12804
2843         * testsuite/two_file_test_2_v1.cc: Change initialization of
2844         v2 to keep it in .data.
2845
2846 2011-06-07  Cary Coutant  <ccoutant@google.com>
2847
2848         * common.cc (Symbol_table::do_allocate_commons_list): Call
2849         gold_fallback.
2850         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2851         (Errors::fallback): New function.
2852         (gold_fallback): New function.
2853         * errors.h (Errors::fallback): New function.
2854         * gold.cc (gold_exit): Change status parameter to enum; adjust
2855         all callers.
2856         (queue_initial_tasks): Call gold_fallback.
2857         * gold.h: Include cstdlib.
2858         (Exit_status): New enum type.
2859         (gold_exit): Change status parameter to enum.
2860         (gold_fallback): New function.
2861         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2862         (Layout::create_symtab_sections): Likewise.
2863         (Layout::create_shdrs): Likewise.
2864         * main.cc (main): Adjust call to gold_exit.
2865         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2866         (Output_data_got::add_got_entry_pair): Likewise.
2867         (Output_section::add_input_section): Likewise.
2868         (Output_section::add_output_section_data): Likewise.
2869         (Output_segment::set_section_list_addresses): Likewise.
2870         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2871
2872 2011-06-07  Cary Coutant  <ccoutant@google.com>
2873
2874         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2875         for incremental links.
2876         * output.cc (Output_segment::set_section_list_addresses): Remove
2877         FIXME and test for TLS or BSS.
2878
2879 2011-06-07  Cary Coutant  <ccoutant@google.com>
2880
2881         * testsuite/Makefile.am: Add incremental_copy_test,
2882         incremental_common_test_1.
2883         * testsuite/Makefile.in: Regenerate.
2884         * testsuite/common_test_1_v1.c: New source file.
2885         * testsuite/common_test_1_v2.c: New source file.
2886         * testsuite/copy_test_v1.cc: New source file.
2887
2888 2011-06-07  Cary Coutant  <ccoutant@google.com>
2889
2890         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2891         update, allocate common from bss section's free list.
2892         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2893         linker-defined symbols.
2894         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2895         Skip GOT and PLT entries that are no longer referenced.
2896         (Output_section_incremental_inputs::write_info_blocks): Mark
2897         linker-defined symbols.
2898         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2899         * output.cc (Output_section::allocate): New function.
2900         * output.h (Output_section::allocate): New function.
2901         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2902         linker-defined symbols.
2903         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2904         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2905         (Symbol::init_base_output_data): Likewise.
2906         (Symbol::init_base_output_segment): Likewise.
2907         (Symbol::init_base_constant): Likewise.
2908         (Sized_symbol::init_output_data): Likewise.
2909         (Sized_symbol::init_output_segment): Likewise.
2910         (Sized_symbol::init_constant): Likewise.
2911         (Symbol_table::do_define_in_output_data): Likewise.
2912         (Symbol_table::do_define_in_output_segment): Likewise.
2913         (Symbol_table::do_define_as_constant): Likewise.
2914         * symtab.h (Symbol::is_predefined): New function.
2915         (Symbol::init_base_output_data): Add is_predefined parameter.
2916         (Symbol::init_base_output_segment): Likewise.
2917         (Symbol::init_base_constant): Likewise.
2918         (Symbol::is_predefined_): New data member.
2919         (Sized_symbol::init_output_data): Add is_predefined parameter.
2920         (Sized_symbol::init_output_segment): Likewise.
2921         (Sized_symbol::init_constant): Likewise.
2922         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2923
2924 2011-06-07  Cary Coutant  <ccoutant@google.com>
2925
2926         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2927         instead of emit_copy_reloc.
2928         (Copy_relocs::emit_copy_reloc): Refactor.
2929         (Copy_relocs::make_copy_reloc): New function.
2930         (Copy_relocs::add_copy_reloc): Remove.
2931         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2932         section.
2933         (Copy_relocs::make_copy_reloc): New function.
2934         (Copy_relocs::add_copy_reloc): Remove.
2935         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2936         unchanged input files.
2937         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2938         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2939         Reserve BSS space for COPY relocations.
2940         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2941         (Output_section_incremental_inputs::write_info_blocks): Record
2942         whether a symbol is copied from a shared object.
2943         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2944         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2945         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2946         (Incremental_input_entry_reader::get_output_symbol_index): Add
2947         is_copy parameter.
2948         (Incremental_binary::emit_copy_relocs): New function.
2949         (Incremental_binary::do_emit_copy_relocs): New function.
2950         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2951         new data member.
2952         (Sized_incremental_binary::add_copy_reloc): New function.
2953         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2954         (Sized_incremental_binary::Copy_reloc): New struct.
2955         (Sized_incremental_binary::Copy_relocs): New typedef.
2956         (Sized_incremental_binary::copy_relocs_): New data member.
2957         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2958         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2959         * target.h (Sized_target::emit_copy_reloc): New function.
2960         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2961
2962 2011-06-02  Cary Coutant  <ccoutant@google.com>
2963
2964         PR gold/12163
2965         * gold/archive.cc (Archive::Archive): Initialize new data member.
2966         (Archive::include_all_members): Return if archive has already been
2967         included.
2968         * gold/archive.h (Archive::include_all_members_): New data member.
2969
2970 2011-06-02  Nick Clifton  <nickc@redhat.com>
2971
2972         * dynobj.h: Fix spelling mistake in comment.
2973         * output.cc: Likewise.
2974
2975 2011-05-31  Doug Kwan  <dougkwan@google.com>
2976             Asier Llano
2977
2978         PR gold/12826
2979         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2980         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2981         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2982         redundant arm_exidx_test.so.
2983         * testsuite/Makefile.in: Regenerate.
2984         (check_SCRIPTS): Add pr12826.sh
2985         (check_DATA): Add pr12826.stdout
2986         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2987         * testsuite/pr12826.sh: New file.
2988         * testsuite/pr12826_1.s: Ditto.
2989         * testsuite/pr12826_1.s: Ditto.
2990
2991 2011-05-30  Ian Lance Taylor  <iant@google.com>
2992
2993         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2994         sections.
2995
2996 2011-05-29  Ian Lance Taylor  <iant@google.com>
2997
2998         PR gold/12804
2999         * testsuite/Makefile.am: Use different file name for two_file_test
3000         temporary file for each incremental test.
3001         * testsuite/Makefile.in: Rebuild.
3002
3003 2011-05-29  Ian Lance Taylor  <iant@google.com>
3004
3005         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3006         binary input file is empty.
3007
3008 2011-05-27  Ian Lance Taylor  <iant@google.com>
3009
3010         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3011         (ver_test_9.so): Likewise.
3012         * testsuite/Makefile.in: Rebuild.
3013
3014 2011-05-26 Cary Coutant  <ccoutant@google.com>
3015
3016         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3017         * incremental.cc (Incremental_inputs::report_input_section): Fix
3018         comment, indentation.
3019         (Incremental_inputs::report_comdat_group): New function.
3020         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3021         of data for incremental input file entry.
3022         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3023         group count, COMDAT group signatures.
3024         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3025         an unchanged input file.
3026         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3027         Initialize new data member.
3028         (Incremental_object_entry::add_comdat_group): New function.
3029         (Incremental_object_entry::get_comdat_group_count): New function.
3030         (Incremental_object_entry::get_comdat_signature_key): New function.
3031         (Incremental_object_entry::groups_): New data member.
3032         (Incremental_inputs::report_comdat_group): New function.
3033         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3034         data for incremental input file entry.
3035         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3036         (Incremental_input_entry_reader::get_input_section): Adjust size of
3037         data for incremental input file entry.
3038         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3039         (Incremental_input_entry_reader::get_comdat_group_signature): New
3040         function.
3041         * object.cc (Sized_relobj::include_section_group): Report kept
3042         COMDAT groups for incremental links.
3043
3044 2011-05-24  David Meyer  <pdox@google.com>
3045
3046         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3047         with name parameter.  Add found_name parameter.
3048         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3049         * dirsearch.h (class Dirsearch): Update declaration.
3050
3051 2011-05-24  Ian Lance Taylor  <iant@google.com>
3052
3053         * archive.cc (Library_base::should_include_member): Pull in object
3054         from archive if it defines the entry symbol.
3055         * parameters.cc (Parameters::entry): New function.
3056         * parameters.h (class Parameters): Declare entry.
3057         * output.h (class Output_file_header): Remove entry_ field.
3058         * output.cc (Output_file_header::Output_file_header): Remove entry
3059         parameter.  Change all callers.
3060         (Output_file_header::entry): Use parameters->entry.
3061         * gold.cc (queue_middle_tasks): Likewise.
3062         * plugin.cc (Plugin_hook::run): Likewise.
3063
3064 2011-05-24 Cary Coutant  <ccoutant@google.com>
3065
3066         * gold.cc (queue_initial_tasks): Pass incremental base filename
3067         to Output_file::open_base_file; don't print error message.
3068         * incremental-dump.cc (main): Adjust call to
3069         Output_file::open_for_modification.
3070         * incremental-dump.cc (main): Likewise.
3071         * incremental.cc (Incremental_inputs::report_command_line):
3072         Ignore --incremental-base option when comparing command lines.
3073         Ignore parameter when given as separate argument.
3074         * options.h (class General_options): Add --incremental-base.
3075         * output.cc (Output_file::Output_file):
3076         (Output_file::open_base_file): Add base_name and writable parameters;
3077         read base file into new file; print error message here.
3078         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3079         callers.
3080         * output.h (Output_file::open_for_modification): Rename to...
3081         (Output_file::open_base_file): ...this; add base_name and
3082         writable parameters; adjust all callers.
3083         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3084         callers.
3085         * testsuite/Makefile.am (incremental_test_4): Test
3086         --incremental-base.
3087         * testsuite/Makefile.in: Regenerate.
3088
3089 2011-05-24 Cary Coutant  <ccoutant@google.com>
3090
3091         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3092         incremental_test_4.
3093         * testsuite/Makefile.in: Regenerate.
3094         * testsuite/two_file_test_1_v1.cc: New test source file.
3095         * testsuite/two_file_test_1b_v1.cc: New test source file.
3096         * testsuite/two_file_test_2_v1.cc: New test source file.
3097
3098 2011-05-24 Cary Coutant  <ccoutant@google.com>
3099
3100         * dynobj.h (Dynobj::do_dynobj): New function.
3101         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3102         flag and soname for shared objects.
3103         * incremental.cc (Incremental_inputs::report_object): Make
3104         either Incremental_object_entry or Incremental_dynobj_entry; add
3105         soname to string table.
3106         (Incremental_inputs::report_input_section): Add assertion.
3107         (Output_section_incremental_inputs::set_final_data_size): Adjust
3108         type of input file entry for shared libraries; adjust size of
3109         shared library info entry.
3110         (Output_section_incremental_inputs::write_input_files): Write
3111         as_needed flag for shared libraries.
3112         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3113         of input file entry for shared libraries; write soname.
3114         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3115         soname from incremental info.
3116         * incremental.h (enum Incremental_input_flags): Add
3117         INCREMENTAL_INPUT_AS_NEEDED.
3118         (Incremental_input_entry::Incremental_input_entry): Initialize new
3119         data member.
3120         (Incremental_input_entry::set_as_needed): New function.
3121         (Incremental_input_entry::as_needed): New function.
3122         (Incremental_input_entry::do_dynobj_entry): New function.
3123         (Incremental_input_entry::as_needed_): New data member.
3124         (Incremental_object_entry::Incremental_object_entry): Don't check
3125         for shared library.
3126         (Incremental_object_entry::do_type): Likewise.
3127         (class Incremental_dynobj_entry): New class.
3128         (Incremental_input_entry_reader::as_needed): New function.
3129         (Incremental_input_entry_reader::get_soname): New function.
3130         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3131         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3132         size of shared library info entry.
3133         * layout.cc (Layout::finish_dynamic_section): Don't test for
3134         incremental link when adding DT_NEEDED entries.
3135         * object.h (Object::Object): Initialize new data member.
3136         (Object::dynobj): New function.
3137         (Object::set_as_needed): New function.
3138         (Object::as_needed): New function.
3139         (Object::do_dynobj): New function.
3140         (Object::as_needed_): New data member.
3141
3142 2011-05-24 Cary Coutant  <ccoutant@google.com>
3143
3144         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3145         info; adjust display of GOT entries.
3146         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3147         vector of input objects; remove file_status_.
3148         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3149         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3150         got_plt reader; call target hooks to reserve GOT entries.
3151         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3152         of input file info header and GOT info entry.
3153         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3154         relocation info.
3155         (Got_plt_view_info::got_descriptor): Remove.
3156         (Got_plt_view_info::sym_index): New data member.
3157         (Got_plt_view_info::input_index): New data member.
3158         (Local_got_offset_visitor::visit): Write input file index.
3159         (Global_got_offset_visitor::visit): Write 0 for input file index.
3160         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3161         with sym_index and input_index.
3162         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3163         incremental info GOT entry; replace got_descriptor with input_index.
3164         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3165         map from input file index to object.
3166         (Sized_relobj_incr::do_layout): Replace direct data member reference
3167         with accessor function.
3168         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3169         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3170         Adjust size of input file info header.
3171         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3172         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3173         (Incremental_input_entry_reader::get_input_section): Adjust size of
3174         input file info header.
3175         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3176         of incremental info GOT entry.
3177         (Incremental_got_plt_reader::get_got_desc): Remove.
3178         (Incremental_got_plt_reader::get_got_symndx): New function.
3179         (Incremental_got_plt_reader::get_got_input_index): New function.
3180         (Sized_incremental_binary::Sized_incremental_binary): Remove
3181         file_status_; add input_objects_.
3182         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3183         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3184         (Sized_incremental_binary::file_is_unchanged): Remove.
3185         (Sized_incremental_binary::set_input_object): New function.
3186         (Sized_incremental_binary::input_object): New function.
3187         (Sized_incremental_binary::file_status_): Remove.
3188         (Sized_incremental_binary::input_objects_): New data member.
3189         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3190         references.
3191         (Sized_relobj_incr::invalid_address): Move to base class.
3192         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3193         class.
3194         (Sized_relobj_incr::do_output_section_offset): Likewise.
3195         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3196         (Sized_relobj_incr::section_offsets_): Likewise.
3197         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3198         function.
3199         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3200         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3201         with accessor function.
3202         (Sized_relobj_file::do_layout): Likewise.
3203         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3204         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3205         (Sized_relobj_file::compute_final_local_value): Replace refs to
3206         section_offsets_ with accessor function.
3207         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3208         * object.h (Relobj::Relobj): Initialize new data members.
3209         (Relobj::add_dyn_reloc): New function.
3210         (Relobj::first_dyn_reloc): New function.
3211         (Relobj::dyn_reloc_count): New function.
3212         (Relobj::first_dyn_reloc_): New data member.
3213         (Relobj::dyn_reloc_count_): New data member.
3214         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3215         references.
3216         (Sized_relobj::Address): New typedef.
3217         (Sized_relobj::invalid_address): Move here from child class.
3218         (Sized_relobj::Sized_relobj): Initialize new data members.
3219         (Sized_relobj::sized_relobj): New function.
3220         (Sized_relobj::is_output_section_offset_invalid): Move here from
3221         child class.
3222         (Sized_relobj::get_output_section_offset): Likewise.
3223         (Sized_relobj::local_has_got_offset): Likewise.
3224         (Sized_relobj::local_got_offset): Likewise.
3225         (Sized_relobj::set_local_got_offset): Likewise.
3226         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3227         (Sized_relobj::clear_got_offsets): New function.
3228         (Sized_relobj::section_offsets): Move here from child class.
3229         (Sized_relobj::do_output_section_offset): Likewise.
3230         (Sized_relobj::do_set_section_offset): Likewise.
3231         (Sized_relobj::Local_got_offsets): Likewise.
3232         (Sized_relobj::local_got_offsets_): Likewise.
3233         (Sized_relobj::section_offsets_): Likewise.
3234         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3235         references.
3236         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3237         class.
3238         (Sized_relobj_file::sized_relobj): New function
3239         (Sized_relobj_file::local_has_got_offset): Move to base class.
3240         (Sized_relobj_file::local_got_offset): Likewise.
3241         (Sized_relobj_file::set_local_got_offset): Likewise.
3242         (Sized_relobj_file::get_output_section_offset): Likewise.
3243         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3244         (Sized_relobj_file::do_output_section_offset): Likewise.
3245         (Sized_relobj_file::do_set_section_offset): Likewise.
3246         (Sized_relobj_file::Local_got_offsets): Likewise.
3247         (Sized_relobj_file::local_got_offsets_): Likewise.
3248         (Sized_relobj_file::section_offsets_): Likewise.
3249         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3250         (all constructors).
3251         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3252         (Output_reloc::get_symbol_index): Likewise.
3253         (Output_reloc::local_section_offset): Likewise.
3254         (Output_reloc::get_address): Likewise.
3255         (Output_reloc::symbol_value): Likewise.
3256         (Output_data_got::reserve_slot): Move to class definition.
3257         (Output_data_got::reserve_local): New function.
3258         (Output_data_got::reserve_slot_for_global): Remove.
3259         (Output_data_got::reserve_global): New function.
3260         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3261         (all constructors, two instantiations).
3262         (Output_reloc::get_relobj): New function (two instantiations).
3263         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3264         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3265         (Output_data_reloc::add_global): Adjust type of relobj.
3266         (Output_data_reloc::add_global_relative): Likewise.
3267         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3268         (Output_data_reloc::add_local): Likewise.
3269         (Output_data_reloc::add_local_relative): Likewise.
3270         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3271         (Output_data_reloc::add_local_section): Likewise.
3272         (Output_data_reloc::add_output_section): Likewise.
3273         (Output_data_reloc::add_absolute): Likewise.
3274         (Output_data_reloc::add_target_specific): Likewise.
3275         (Output_data_got::reserve_slot): Move definition here.
3276         (Output_data_got::reserve_local): New function.
3277         (Output_data_got::reserve_global): New function.
3278         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3279         section_offsets_ with accessor function.
3280         (Sized_relobj_file::write_sections): Likewise.
3281         (Sized_relobj_file::do_relocate_sections): Likewise.
3282         * target.h (Sized_target::reserve_local_got_entry): New function.
3283         (Sized_target::reserve_global_got_entry): New function.
3284         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3285         (Target_x86_64::reserve_global_got_entry): New function.
3286         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3287
3288 2011-05-23 Cary Coutant  <ccoutant@google.com>
3289
3290         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3291         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3292         bit when checking got_type.
3293         * incremental.cc (Sized_incremental_binary::setup_readers):
3294         Store symbol table and string table locations; initialize bit vector
3295         of file status flags.
3296         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3297         unchanged files.
3298         (Sized_incremental_binary::do_process_got_plt): New function.
3299         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3300         (Output_section_incremental_inputs::set_final_data_size): Record
3301         file index for each input file.
3302         (Output_section_incremental_inputs::write_got_plt): Store file index
3303         instead of input entry offset for each GOT entry.
3304         * incremental.h
3305         (Incremental_input_entry::Incremental_input_entry): Initialize new
3306         data member.
3307         (Incremental_input_entry::set_offset): Store file index.
3308         (Incremental_input_entry::get_file_index): New function.
3309         (Incremental_input_entry::file_index_): New data member.
3310         (Incremental_binary::process_got_plt): New function.
3311         (Incremental_binary::do_process_got_plt): New function.
3312         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3313         data members.
3314         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3315         (Sized_incremental_binary::set_file_is_unchanged): New function.
3316         (Sized_incremental_binary::file_is_unchanged): New function.
3317         (Sized_incremental_binary::do_process_got_plt): New function.
3318         (Sized_incremental_binary::file_status_): New data member.
3319         (Sized_incremental_binary::main_symtab_loc_): New data member.
3320         (Sized_incremental_binary::main_strtab_loc_): New data member.
3321         * output.cc (Output_data_got::Got_entry::write): Add case
3322         RESERVED_CODE.
3323         (Output_data_got::add_global): Call add_got_entry.
3324         (Output_data_got::add_global_plt): Likewise.
3325         (Output_data_got::add_global_with_rel): Likewise.
3326         (Output_data_got::add_global_with_rela): Likewise.
3327         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3328         (Output_data_got::add_global_pair_with_rela): Likewise.
3329         (Output_data_got::add_local): Call add_got_entry.
3330         (Output_data_got::add_local_plt): Likewise.
3331         (Output_data_got::add_local_with_rel): Likewise.
3332         (Output_data_got::add_local_with_rela): Likewise.
3333         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3334         (Output_data_got::add_local_pair_with_rela): Likewise.
3335         (Output_data_got::reserve_slot): New function.
3336         (Output_data_got::reserve_slot_for_global): New function.
3337         (Output_data_got::add_got_entry): New function.
3338         (Output_data_got::add_got_entry_pair): New function.
3339         (Output_section::add_output_section_data): Edit FIXME.
3340         * output.h
3341         (Output_section_data_build::Output_section_data_build): New
3342         constructor with size parameter.
3343         (Output_data_space::Output_data_space): Likewise.
3344         (Output_data_got::Output_data_got): Initialize new data member; new
3345         constructor with size parameter.
3346         (Output_data_got::add_constant): Call add_got_entry.
3347         (Output_data_got::reserve_slot): New function.
3348         (Output_data_got::reserve_slot_for_global): New function.
3349         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3350         (Output_data_got::add_got_entry): New function.
3351         (Output_data_got::add_got_entry_pair): New function.
3352         (Output_data_got::free_list_): New data member.
3353         * target.h (Sized_target::init_got_plt_for_update): New function.
3354         (Sized_target::register_global_plt_entry): New function.
3355         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3356         Initialize new data member; call init; add constructor with PLT count.
3357         (Output_data_plt_x86_64::init): New function.
3358         (Output_data_plt_x86_64::add_relocation): New function.
3359         (Output_data_plt_x86_64::reserve_slot): New function.
3360         (Output_data_plt_x86_64::free_list_): New data member.
3361         (Target_x86_64::init_got_plt_for_update): New function.
3362         (Target_x86_64::register_global_plt_entry): New function.
3363         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3364         incremental updates.
3365         (Output_data_plt_x86_64::add_relocation): New function.
3366         * testsuite/object_unittest.cc (Object_test): Set default options.
3367
3368 2011-05-16  Ian Lance Taylor  <iant@google.com>
3369
3370         * options.h (class General_options): Make -i a synonym for -r.
3371
3372 2011-05-16  Ian Lance Taylor  <iant@google.com>
3373
3374         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3375
3376 2011-05-10 Cary Coutant  <ccoutant@google.com>
3377
3378         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3379         strip_all (-s).
3380
3381 2011-05-06  Ian Lance Taylor  <iant@google.com>
3382
3383         * layout.cc (Layout::layout): If the output section flags change,
3384         update the ordering.
3385
3386 2011-04-25 Cary Coutant  <ccoutant@google.com>
3387
3388         * incremental-dump.cc (dump_incremental_inputs): Print local
3389         symbol info for each input file.
3390         * incremental.cc
3391         (Output_section_incremental_inputs::set_final_data_size): Add local
3392         symbol info to input file entries in incremental info.
3393         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3394         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3395         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3396         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3397         implementation.
3398         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3399         (Sized_incr_relobj::do_relocate): Write the local symbols.
3400         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3401         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3402         Adjust size of input file header.
3403         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3404         (Incremental_inputs_reader::get_local_symbol_count): New function.
3405         (Incremental_inputs_reader::get_input_section): Adjust size of input
3406         file header.
3407         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3408         (Sized_incr_relobj::This): New typedef.
3409         (Sized_incr_relobj::sym_size): New const data member.
3410         (Sized_incr_relobj::Local_symbol): New struct.
3411         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3412         (Sized_incr_relobj::do_local_symbol_offset): New function.
3413         (Sized_incr_relobj::local_symbol_count_): New data member.
3414         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3415         (Sized_incr_relobj::local_symbol_index_): New data member.
3416         (Sized_incr_relobj::local_symbol_offset_): New data member.
3417         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3418         (Sized_incr_relobj::local_symbols_): New data member.
3419         * object.h (Relobj::output_local_symbol_count): New function.
3420         (Relobj::local_symbol_offset): New function.
3421         (Relobj::do_output_local_symbol_count): New function.
3422         (Relobj::do_local_symbol_offset): New function.
3423         (Sized_relobj::do_output_local_symbol_count): New function.
3424         (Sized_relobj::do_local_symbol_offset): New function.
3425
3426 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3427
3428         * descriptors.cc (set_close_on_exec): New function.
3429         (Descriptors::open): Use set_close_on_exec.
3430         * output.cc (S_ISLNK): Define if not defined.
3431
3432 2011-04-22 Cary Coutant  <ccoutant@google.com>
3433
3434         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3435         global symbol map.
3436         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3437         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3438         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3439         relocations.
3440         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3441         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3442         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3443         * incremental.h
3444         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3445         function.
3446         (Incremental_binary::apply_incremental_relocs): New function.
3447         (Incremental_binary::do_apply_incremental_relocs): New function.
3448         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3449         data member.
3450         (Sized_incremental_binary::add_global_symbol): New function.
3451         (Sized_incremental_binary::global_symbol): New function.
3452         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3453         (Sized_incremental_binary::symbol_map_): New data member.
3454         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3455         * target.h (Sized_target::apply_relocation): New function.
3456         * target-reloc.h (apply_relocation): New function.
3457         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3458
3459 2011-04-22  Doug Kwan  <dougkwan@google.com>
3460
3461         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3462         flag of a SHT_ARM_EXIDX section.
3463         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3464         * testsuite/Makefile.in: Regenerate.
3465         * testsuite/arm_exidx_test.s: New file.
3466         * testsuite/arm_exidx_test.sh: Same.
3467
3468 2011-04-20 Cary Coutant  <ccoutant@google.com>
3469
3470         PR gold/12689
3471         * archive.h (Incremental_archive_entry::Archive_member):
3472         Initialize arg_serial_ (second constructor).
3473
3474 2011-04-17  Ian Lance Taylor  <iant@google.com>
3475
3476         * object.cc (Relocate_info::location): Simplify location string.
3477         * errors.cc (Errors::error_at_location): Don't print program
3478         name.
3479         (Errors::warning_at_location): Likewise.
3480         (Errors::undefined_symbol): Likewise.
3481         * testsuite/debug_msg.sh: Update accordingly.
3482
3483 2011-04-14 Cary Coutant  <ccoutant@google.com>
3484
3485         * gold/layout.cc (Layout::symtab_section_offset): New function.
3486         * gold/layout.h (Layout::symtab_section_offset): New function.
3487         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3488
3489 2011-04-12  Ian Lance Taylor  <iant@google.com>
3490
3491         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3492         with MREMAP_MAYMOVE.
3493         * output.h (class Output_file): Add map_is_allocated_ field.
3494         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3495         not available, provide stubs.  If mremap is not available, #define
3496         it to gold_mremap.
3497         (MREMAP_MAYMOVE): Define if not defined.
3498         (Output_file::Output_file): Initialize map_is_allocated_.
3499         (Output_file::resize): Check map_is_allocated_.
3500         (Output_file::map_anonymous): If mmap fails, use malloc.
3501         (Output_file::unmap): Don't do anything for an anonymous map.
3502         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3503         is not available, provide stubs.
3504         (File_read::View::~View): Use free rather than delete[].
3505         (File_read::make_view): Use malloc rather than new[].  If mmap
3506         fails, use malloc.
3507         (File_read::find_or_make_view): Use malloc rather than new[].
3508         * gold.h: Remove HAVE_REMAP code.
3509         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3510         exists.  Rename mremap to gold_mremap.  If mmap is not available
3511         don't do anything.
3512         * configure, config.in: Rebuild.
3513
3514 2011-04-11  Ian Lance Taylor  <iant@google.com>
3515
3516         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3517         initialize local variable v.
3518
3519 2011-04-11  Cary Coutant  <ccoutant@google.com>
3520
3521         * archive.cc (Archive::include_member): Adjust call to
3522         report_object.
3523         (Add_archive_symbols::run): Track argument serial numbers.
3524         (Lib_group::include_member): Likewise.
3525         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3526         * archive.h (Incremental_archive_entry::Archive_member):
3527         Initialize arg_serial_.
3528         (Archive_member::arg_serial_): New data member.
3529         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3530         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3531         incremental link.
3532         (Sized_dynobj::do_for_all_local_got_entries): New function.
3533         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3534         function.
3535         * fileread.cc (get_mtime): New function.
3536         * fileread.h (get_mtime): New function.
3537         * gold.cc (queue_initial_tasks): Check for incremental update.
3538         (process_incremental_input): New function.
3539         (queue_middle_tasks): Don't force valid target for incremental
3540         update.
3541         * incremental-dump.cc (find_input_containing_global): Adjust
3542         size of symbol info entry.
3543         (dump_incremental_inputs): Dump argument serial number and
3544         in_system_directory flag; bias shndx by 1; print symbol names
3545         when dumping per-file symbol lists; use new symbol info readers.
3546         * incremental.cc
3547         (Output_section_incremental_inputs:update_data_size): New function.
3548         (Sized_incremental_binary::setup_readers): Setup input readers
3549         for each input file; build maps for files added from libraries
3550         and scripts.
3551         (Sized_incremental_binary::check_input_args): New function.
3552         (Sized_incremental_binary::do_check_inputs): Build map of argument
3553         serial numbers to input arguments.
3554         (Sized_incremental_binary::do_file_has_changed): Rename
3555         do_file_is_unchanged to this; compare file modification times.
3556         (Sized_incremental_binary::do_init_layout): New function.
3557         (Sized_incremental_binary::do_reserve_layout): New function.
3558         (Sized_incremental_binary::do_get_input_reader): Remove.
3559         (Sized_incremental_binary::get_symtab_view): New function.
3560         (Incremental_checker::can_incrementally_link_output_file): Remove.
3561         (Incremental_inputs::report_command_line): Exclude --debug options.
3562         (Incremental_inputs::report_archive_begin): Add parameter; track
3563         argument serial numbers; don't put input file entry for archive
3564         before archive members.
3565         (Incremental_inputs::report_archive_end): Put input file entry
3566         for archive after archive members.
3567         (Incremental_inputs::report_object): Add parameter; track argument
3568         serial numbers and in_system_directory flag.
3569         (Incremental_inputs::report_script): Add parameter; track argument
3570         serial numbers.
3571         (Output_section_incremental_inputs::set_final_data_size): Adjust
3572         size of symbol info entry; check for forwarding symbols.
3573         (Output_section_incremental_inputs::write_input_files): Write
3574         in_system_directory flag and argument serial number.
3575         (Output_section_incremental_inputs::write_info_blocks): Map section
3576         indices between incremental info and original input file; store
3577         input section index for each symbol.
3578         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3579         change operator() to visit().
3580         (class Global_got_offset_visitor): Likewise.
3581         (class Global_symbol_visitor_got_plt):
3582         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3583         classes.
3584         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3585         (Sized_incr_relobj::do_read_symbols): New function.
3586         (Sized_incr_relobj::do_layout): New function.
3587         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3588         (Sized_incr_relobj::do_add_symbols): New function.
3589         (Sized_incr_relobj::do_should_include_member): New function.
3590         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3591         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3592         (Sized_incr_relobj::do_section_size): New function.
3593         (Sized_incr_relobj::do_section_name): New function.
3594         (Sized_incr_relobj::do_section_contents): New function.
3595         (Sized_incr_relobj::do_section_flags): New function.
3596         (Sized_incr_relobj::do_section_entsize): New function.
3597         (Sized_incr_relobj::do_section_address): New function.
3598         (Sized_incr_relobj::do_section_type): New function.
3599         (Sized_incr_relobj::do_section_link): New function.
3600         (Sized_incr_relobj::do_section_info): New function.
3601         (Sized_incr_relobj::do_section_addralign): New function.
3602         (Sized_incr_relobj::do_initialize_xindex): New function.
3603         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3604         (Sized_incr_relobj::do_read_relocs): New function.
3605         (Sized_incr_relobj::do_gc_process_relocs): New function.
3606         (Sized_incr_relobj::do_scan_relocs): New function.
3607         (Sized_incr_relobj::do_count_local_symbols): New function.
3608         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3609         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3610         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3611         (Sized_incr_relobj::do_relocate): New function.
3612         (Sized_incr_relobj::do_set_section_offset): New function.
3613         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3614         (Sized_incr_dynobj::do_read_symbols): New function.
3615         (Sized_incr_dynobj::do_layout): New function.
3616         (Sized_incr_dynobj::do_add_symbols): New function.
3617         (Sized_incr_dynobj::do_should_include_member): New function.
3618         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3619         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3620         (Sized_incr_dynobj::do_section_size): New function.
3621         (Sized_incr_dynobj::do_section_name): New function.
3622         (Sized_incr_dynobj::do_section_contents): New function.
3623         (Sized_incr_dynobj::do_section_flags): New function.
3624         (Sized_incr_dynobj::do_section_entsize): New function.
3625         (Sized_incr_dynobj::do_section_address): New function.
3626         (Sized_incr_dynobj::do_section_type): New function.
3627         (Sized_incr_dynobj::do_section_link): New function.
3628         (Sized_incr_dynobj::do_section_info): New function.
3629         (Sized_incr_dynobj::do_section_addralign): New function.
3630         (Sized_incr_dynobj::do_initialize_xindex): New function.
3631         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3632         (make_sized_incremental_object): New function.
3633         (Incremental_library::copy_unused_symbols): New function.
3634         (Incremental_library::do_for_all_unused_symbols): New function.
3635         * incremental.h (enum Incremental_input_flags): New type.
3636         (class Incremental_checker): Remove.
3637         (Incremental_input_entry::Incremental_input_entry): Add argument
3638         serial number.
3639         (Incremental_input_entry::arg_serial): New function.
3640         (Incremental_input_entry::set_is_in_system_directory): New function.
3641         (Incremental_input_entry::is_in_system_directory): New function.
3642         (Incremental_input_entry::arg_serial_): New data member.
3643         (Incremental_input_entry::is_in_system_directory_): New data member.
3644         (class Script_info): Move here from script.h.
3645         (Script_info::Script_info): Add filename parameter.
3646         (Script_info::filename): New function.
3647         (Script_info::filename_): New data member.
3648         (Incremental_script_entry::Incremental_script_entry): Add argument
3649         serial number.
3650         (Incremental_object_entry::Incremental_object_entry): Likewise.
3651         (Incremental_object_entry::add_input_section): Build list of input
3652         sections with map to original shndx.
3653         (Incremental_object_entry::get_input_section_index): New function.
3654         (Incremental_object_entry::shndx_): New data member.
3655         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3656         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3657         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3658         serial number.
3659         (Incremental_inputs::report_archive_begin): Likewise.
3660         (Incremental_inputs::report_object): Likewise.
3661         (Incremental_inputs::report_script): Likewise.
3662         (class Incremental_global_symbol_reader): New class.
3663         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3664         and store flags and input file type.
3665         (Incremental_input_entry_reader::arg_serial): New function.
3666         (Incremental_input_entry_reader::type): Extract type from flags.
3667         (Incremental_input_entry_reader::is_in_system_directory): New function.
3668         (Incremental_input_entry_reader::get_input_section_count): Call
3669         accessor function for type.
3670         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3671         function for type; adjust size of global symbol entry.
3672         (Incremental_input_entry_reader::get_global_symbol_count): Call
3673         accessor function for type.
3674         (Incremental_input_entry_reader::get_object_count): Likewise.
3675         (Incremental_input_entry_reader::get_object_offset): Likewise.
3676         (Incremental_input_entry_reader::get_member_count): Likewise.
3677         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3678         (Incremental_input_entry_reader::get_member_offset): Likewise.
3679         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3680         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3681         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3682         (Incremental_input_entry_reader::get_global_symbol_reader): New
3683         function.
3684         (Incremental_input_entry_reader::get_output_symbol_index): New
3685         function.
3686         (Incremental_input_entry_reader::type_): Remove.
3687         (Incremental_input_entry_reader::flags_): New data member.
3688         (Incremental_inputs_reader::input_file_offset): New function.
3689         (Incremental_inputs_reader::input_file_index): New function.
3690         (Incremental_inputs_reader::input_file): Call input_file_offset.
3691         (Incremental_inputs_reader::input_file_at_offset): New function.
3692         (Incremental_relocs_reader::get_r_type): Reformat.
3693         (Incremental_relocs_reader::get_r_shndx): Reformat.
3694         (Incremental_relocs_reader::get_r_offset): Reformat.
3695         (Incremental_relocs_reader::data): New function.
3696         (Incremental_binary::Incremental_binary): Initialize new data members.
3697         (Incremental_binary::check_inputs): Add cmdline parameter.
3698         (Incremental_binary::file_is_unchanged): Remove.
3699         (Input_reader::arg_serial): New function.
3700         (Input_reader::get_unused_symbol_count): New function.
3701         (Input_reader::get_unused_symbol): New function.
3702         (Input_reader::do_arg_serial): New function.
3703         (Input_reader::do_get_unused_symbol_count): New function.
3704         (Input_reader::do_get_unused_symbol): New function.
3705         (Incremental_binary::input_file_count): New function.
3706         (Incremental_binary::get_input_reader): Change signature to use
3707         index instead of filename.
3708         (Incremental_binary::file_has_changed): New function.
3709         (Incremental_binary::get_input_argument): New function.
3710         (Incremental_binary::get_library): New function.
3711         (Incremental_binary::get_script_info): New function.
3712         (Incremental_binary::init_layout): New function.
3713         (Incremental_binary::reserve_layout): New function.
3714         (Incremental_binary::output_file): New function.
3715         (Incremental_binary::do_check_inputs): New function.
3716         (Incremental_binary::do_file_is_unchanged): Remove.
3717         (Incremental_binary::do_file_has_changed): New function.
3718         (Incremental_binary::do_init_layout): New function.
3719         (Incremental_binary::do_reserve_layout): New function.
3720         (Incremental_binary::do_input_file_count): New function.
3721         (Incremental_binary::do_get_input_reader): Change signature.
3722         (Incremental_binary::input_args_map_): New data member.
3723         (Incremental_binary::library_map_): New data member.
3724         (Incremental_binary::script_map_): New data member.
3725         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3726         new data members.
3727         (Sized_incremental_binary::output_section): New function.
3728         (Sized_incremental_binary::inputs_reader): Add const.
3729         (Sized_incremental_binary::symtab_reader): Add const.
3730         (Sized_incremental_binary::relocs_reader): Add const.
3731         (Sized_incremental_binary::got_plt_reader): Add const.
3732         (Sized_incremental_binary::get_symtab_view): New function.
3733         (Sized_incremental_binary::Inputs_reader): New typedef.
3734         (Sized_incremental_binary::Input_entry_reader): New typedef.
3735         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3736         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3737         (Sized_incremental_binary::do_file_has_changed): New function.
3738         (Sized_incremental_binary::do_init_layout): New function.
3739         (Sized_incremental_binary::do_reserve_layout): New function.
3740         (Sized_input_reader::Inputs_reader): Remove.
3741         (Sized_input_reader::Input_entry_reader): Remove.
3742         (Sized_input_reader::do_arg_serial): New function.
3743         (Sized_input_reader::do_get_unused_symbol_count): New function.
3744         (Sized_input_reader::do_get_unused_symbol): New function.
3745         (Sized_incremental_binary::do_input_file_count): New function.
3746         (Sized_incremental_binary::do_get_input_reader): Change signature;
3747         use index instead of filename.
3748         (Sized_incremental_binary::section_map_): New data member.
3749         (Sized_incremental_binary::input_entry_readers_): New data member.
3750         (class Sized_incr_relobj): New class.
3751         (class Sized_incr_dynobj): New class.
3752         (make_sized_incremental_object): New function.
3753         (class Incremental_library): New class.
3754         * layout.cc (Free_list::num_lists): New static data member.
3755         (Free_list::num_nodes): New static data member.
3756         (Free_list::num_removes): New static data member.
3757         (Free_list::num_remove_visits): New static data member.
3758         (Free_list::num_allocates): New static data member.
3759         (Free_list::num_allocate_visits): New static data member.
3760         (Free_list::init): New function.
3761         (Free_list::remove): New function.
3762         (Free_list::allocate): New function.
3763         (Free_list::dump): New function.
3764         (Free_list::print_stats): New function.
3765         (Layout_task_runner::run): Resize output file for incremental updates.
3766         (Layout::Layout): Initialize new data members.
3767         (Layout::set_incremental_base): New function.
3768         (Layout::init_fixed_output_section): New function.
3769         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3770         incremental updates.
3771         (Layout::create_gold_note): Do not create gold note section for
3772         incremental updates.
3773         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3774         for incremental updates.
3775         (Layout::set_section_offsets): For incremental updates, allocate space
3776         from free list.
3777         (Layout::create_symtab_sections): Layout with offsets relative to
3778         start of section; for incremental updates, allocate space from free
3779         list.
3780         (Layout::create_shdrs): For incremental updates, allocate space from
3781         free list.
3782         (Layout::finish_dynamic_section): For incremental updates, do not
3783         check --as-needed (fixed in subsequent patch).
3784         * layout.h (class Free_list): New class.
3785         (Layout::set_incremental_base): New function.
3786         (Layout::incremental_base): New function.
3787         (Layout::init_fixed_output_section): New function.
3788         (Layout::allocate): New function.
3789         (Layout::incremental_base_): New data member.
3790         (Layout::free_list_): New data member.
3791         * main.cc (main): Print Free_list statistics.
3792         * object.cc (Relobj::finalize_incremental_relocs): Add
3793         clear_counts parameter; clear counts only when clear_counts is set.
3794         (Sized_relobj::Sized_relobj): Initialize new base class.
3795         (Sized_relobj::do_layout): Don't report special sections.
3796         (Sized_relobj::do_for_all_local_got_entries): New function.
3797         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3798         symtab_off to all symbol table offsets.
3799         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3800         * object.h (class Got_offset_list): Move to top of file.
3801         (Object::Object): Allow case where input_file == NULL.
3802         (Object::~Object): Likewise.
3803         (Object::input_file): Assert that input_file != NULL.
3804         (Object::lock): Allow case where input_file == NULL.
3805         (Object::unlock): Likewise.
3806         (Object::is_locked): Likewise.
3807         (Object::token): Likewise.
3808         (Object::release): Likewise.
3809         (Object::is_incremental): New function.
3810         (Object::get_mtime): New function.
3811         (Object::for_all_local_got_entries): New function.
3812         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3813         (Object::set_is_in_system_directory): New function.
3814         (Object::is_in_system_directory): New function.
3815         (Object::do_is_incremental): New function.
3816         (Object::do_get_mtime): New function.
3817         (Object::do_for_all_local_got_entries): New function.
3818         (Object::is_in_system_directory_): New data member.
3819         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3820         (class Sized_relobj_base): New class.
3821         (class Sized_relobj): Derive from Sized_relobj_base.
3822         (class Sized_relobj::Symbols): Redeclare from base class.
3823         (class Sized_relobj::local_got_offset_list): Remove.
3824         (class Sized_relobj::Output_sections): Redeclare from base class.
3825         (class Sized_relobj::do_for_all_local_got_entries): New function.
3826         (class Sized_relobj::write_local_symbols): Add offset parameter.
3827         (class Sized_relobj::local_symbol_offset_): Update comment.
3828         (class Sized_relobj::local_dynsym_offset_): Update comment.
3829         * options.cc (Input_arguments::add_file): Remove const.
3830         * options.h (Input_file_argument::Input_file_argument):
3831         Initialize arg_serial_ (all constructors).
3832         (Input_file_argument::set_arg_serial): New function.
3833         (Input_file_argument::arg_serial): New function.
3834         (Input_file_argument::arg_serial_): New data member.
3835         (Input_arguments::Input_arguments): Initialize file_count_.
3836         (Input_arguments::add_file): Remove const.
3837         (Input_arguments::number_of_input_files): New function.
3838         (Input_arguments::file_count_): New data member.
3839         (Command_line::number_of_input_files): Call
3840         Input_arguments::number_of_input_files.
3841         * output.cc (Output_segment_headers::Output_segment_headers):
3842         Set current size.
3843         (Output_section::Input_section::current_data_size): New function.
3844         (Output_section::Output_section): Initialize new data members.
3845         (Output_section::add_input_section): Don't do merge sections for
3846         an incremental link; allocate space from free list for an
3847         incremental update.
3848         (Output_section::add_output_section_data): Allocate space from
3849         free list for an incremental update.
3850         (Output_section::update_data_size): New function.
3851         (Output_section::set_fixed_layout): New function.
3852         (Output_section::reserve): New function.
3853         (Output_segment::set_section_addresses): Remove const.
3854         (Output_segment::set_section_list_addresses): Remove const; allocate
3855         space from free list for an incremental update.
3856         (Output_segment::set_offset): Adjust size of RELRO segment for an
3857         incremental update.
3858         * output.h (Output_data::current_data_size): Move here from
3859         child classes.
3860         (Output_data::pre_finalize_data_size): New function.
3861         (Output_data::update_data_size): New function.
3862         (Output_section_headers::update_data_size): new function.
3863         (Output_section_data_build::current_data_size): Move to Output_data.
3864         (Output_data_strtab::update_data_size): New function.
3865         (Output_section::current_data_size): Move to Output_data.
3866         (Output_section::set_fixed_layout): New function.
3867         (Output_section::has_fixed_layout): New function.
3868         (Output_section::reserve): New function.
3869         (Output_section::update_data_size): New function.
3870         (Output_section::has_fixed_layout_): New data member.
3871         (Output_section::free_list_): New data member.
3872         (Output_segment::set_section_addresses): Remove const.
3873         (Output_segment::set_section_list_addresses): Remove const.
3874         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3875         New function.
3876         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3877         New function.
3878         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3879         parameter when calling Add_symbols constructor; store argument
3880         serial number for members of a lib group.
3881         (Add_symbols::locks): Allow case where token == NULL.
3882         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3883         (Read_member::~Read_member): New function.
3884         (Read_member::is_runnable): New function.
3885         (Read_member::locks): New function.
3886         (Read_member::run): New function.
3887         (Check_script::~Check_script): New function.
3888         (Check_script::is_runnable): New function.
3889         (Check_script::locks): New function.
3890         (Check_script::run): New function.
3891         (Check_library::~Check_library): New function.
3892         (Check_library::is_runnable): New function.
3893         (Check_library::locks): New function.
3894         (Check_library::run): New function.
3895         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3896         (Add_symbols::library_): New data member.
3897         (class Read_member): New class.
3898         (class Check_script): New class.
3899         (class Check_library): New class.
3900         * reloc.cc (Read_relocs::is_runnable): Allow case where
3901         token == NULL.
3902         (Read_relocs::locks): Likewise.
3903         (Scan_relocs::locks): Likewise.
3904         (Relocate_task::locks): Likewise.
3905         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3906         to clear counters.
3907         (Sized_relobj::incremental_relocs_scan): Fix comment.
3908         (Sized_relobj::do_relocate): Pass output file offset to
3909         write_local_symbols.
3910         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3911         from class declaration.
3912         * script.cc (read_input_script): Allocate Script_info; pass
3913         argument serial number to report_script.
3914         * script.h (class Script_info): Move to incremental.h.
3915         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3916         * symtab.h (Symbol_table::add_from_incrobj): New function.
3917         (Symbol_table::set_file_offset): New function.
3918
3919 2011-04-05  Cary Coutant  <ccoutant@google.com>
3920
3921         * incremental-dump.cc (dump_incremental_inputs): Change signature
3922         to take a Sized_incremental_binary; change caller.  Use readers
3923         in Sized_incremental_binary.
3924         * incremental.cc
3925         (Sized_incremental_binary::find_incremental_inputs_sections):
3926         Rename do_find_incremental_inputs_sections to this.
3927         (Sized_incremental_binary::setup_readers): New function.
3928         (Sized_incremental_binary::do_check_inputs): Check
3929         has_incremental_info_ flag; move setup code to setup_readers;
3930         use input readers.
3931         (Sized_incremental_binary::do_file_is_unchanged): New function.
3932         (Sized_incremental_binary::do_get_input_reader): New function.
3933         * incremental.h (class Incremental_binary): Move to end of file.
3934         (Incremental_binary::file_is_unchanged): New function.
3935         (Incremental_binary::do_file_is_unchanged): New function.
3936         (Incremental_binary::Input_reader): New class.
3937         (Incremental_binary::get_input_reader): New function.
3938         (class Sized_incremental_binary): Move to end of file.
3939         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3940         input section reader classes.
3941         (Sized_incremental_binary::has_incremental_info): New function.
3942         (Sized_incremental_binary::inputs_reader): New function.
3943         (Sized_incremental_binary::symtab_reader): New function.
3944         (Sized_incremental_binary::relocs_reader): New function.
3945         (Sized_incremental_binary::got_plt_reader): New function.
3946         (Sized_incremental_binary::do_file_is_unchanged): New function.
3947         (Sized_incremental_binary::Sized_input_reader): New class.
3948         (Sized_incremental_binary::get_input_reader): New function.
3949         (Sized_incremental_binary::find_incremental_inputs_sections):
3950         Rename do_find_incremental_inputs_sections to this.
3951         (Sized_incremental_binary::setup_readers): New function.
3952         (Sized_incremental_binary::has_incremental_info_): New data member.
3953         (Sized_incremental_binary::inputs_reader_): New data member.
3954         (Sized_incremental_binary::symtab_reader_): New data member.
3955         (Sized_incremental_binary::relocs_reader_): New data member.
3956         (Sized_incremental_binary::got_plt_reader_): New data member.
3957         (Sized_incremental_binary::current_input_file_): New data member.
3958
3959 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3960
3961         PR gold/12640
3962         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3963         violation.
3964
3965 2011-03-30  Cary Coutant  <ccoutant@google.com>
3966
3967         * archive.cc (Archive::include_member): Adjust call to report_object.
3968         (Add_archive_symbols::run): Add script_info to call to
3969         report_archive_begin.
3970         (Lib_group::include_member): Adjust call to report_object.
3971         (Add_lib_group_symbols::run): Adjust call to report_object.
3972         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3973         blocks.  Add object count for script input files.
3974         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3975         script_info parameter; change all callers.
3976         (Incremental_inputs::report_object): Add script_info parameter;
3977         change all callers.
3978         (Incremental_inputs::report_script): Store backpointer to
3979         incremental info entry.
3980         (Output_section_incremental_inputs::set_final_data_size): Record
3981         additional information for scripts.
3982         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3983         * incremental.h (Incremental_script_entry::add_object): New function.
3984         (Incremental_script_entry::get_object_count): New function.
3985         (Incremental_script_entry::get_object): New function.
3986         (Incremental_script_entry::objects_): New data member; adjust
3987         constructor.
3988         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3989         (Incremental_inputs::report_object): Add script_info parameter.
3990         (Incremental_inputs_reader::get_object_count): New function.
3991         (Incremental_inputs_reader::get_object_offset): New function.
3992         * options.cc (Input_arguments::add_file): Return reference to
3993         new input argument.
3994         * options.h (Input_argument::set_script_info): New function.
3995         (Input_argument::script_info): New function.
3996         (Input_argument::script_info_): New data member; adjust all
3997         constructors.
3998         (Input_file_group::add_file): Return reference to new input argument.
3999         (Input_file_lib::add_file): Likewise.
4000         (Input_arguments::add_file): Likewise.
4001         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4002         * script.cc (Parser_closure::Parser_closure): Add script_info
4003         parameter; adjust all callers.
4004         (Parser_closure::script_info): New function.
4005         (Parser_closure::script_info_): New data member.
4006         (read_input_script): Report scripts earlier to incremental info.
4007         (script_add_file): Set script_info in Input_argument.
4008         (script_add_library): Likewise.
4009         * script.h (Script_options::Script_info): Rewrite class.
4010
4011 2011-03-29  Cary Coutant  <ccoutant@google.com>
4012
4013         * archive.cc (Library_base::should_include_member): Move
4014         method here from class Archive.
4015         (Archive::Archive): Initialize base class.
4016         (Archive::should_include_member): Move to base class.
4017         (Archive::do_for_all_unused_symbols): New function.
4018         (Add_archive_symbols::run): Remove redundant access to
4019         incremental_inputs.
4020         (Lib_group::Lib_group): Initialize base class.
4021         (Lib_group::do_filename): New function.
4022         (Lib_group::include_member): Pass pointer to Lib_group to
4023         report_object.
4024         (Lib_group::do_for_all_unused_symbols): New function.
4025         (Add_lib_group_symbols::run): Report archive information for
4026         incremental links.
4027         * archive.h (class Library_base): New base class.
4028         (class Archive): Derive from Library_base.
4029         (Archive::filename): Move to base class.
4030         (Archive::set_incremental_info): Likewise.
4031         (Archive::incremental_info): Likewise.
4032         (Archive::Should_include): Likewise.
4033         (Archive::should_include_member): Likewise.
4034         (Archive::Armap_entry): Remove.
4035         (Archive::Unused_symbol_iterator): Remove.
4036         (Archive::unused_symbols_begin): Remove.
4037         (Archive::unused_symbols_end): Remove.
4038         (Archive::do_filename): New function.
4039         (Archive::do_get_mtime): New function.
4040         (Archive::do_for_all_unused_symbols): New function.
4041         (Archive::task_): Move to base class.
4042         (Archive::incremental_info_): Likewise.
4043         (class Lib_group): Derive from Library_base.
4044         (Lib_group::do_filename): New function.
4045         (Lib_group::do_get_mtime): New function.
4046         (Lib_group::do_for_all_unused_symbols): New function.
4047         (Lib_group::task_): Move to base class.
4048         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4049         function.
4050         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4051         function.
4052         * incremental.cc (Incremental_inputs::report_archive_begin):
4053         Use Library_base; call library's get_mtime; add incremental inputs
4054         entry before members.
4055         (class Unused_symbol_visitor): New class.
4056         (Incremental_inputs::report_archive_end): Use Library_base; use
4057         visitor class to record unused symbols; don't add incremental inputs
4058         entry after members.
4059         (Incremental_inputs::report_object): Use Library_base.
4060         * incremental.h
4061         (Incremental_archive_entry::Incremental_archive_entry): Remove
4062         unused Archive parameter.
4063         (Incremental_inputs::report_archive_begin): Use Library_base.
4064         (Incremental_inputs::report_archive_end): Likewise.
4065         (Incremental_inputs::report_object): Likewise.
4066         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4067         function.
4068         * object.h (Object::for_all_global_symbols): New function.
4069         (Object::do_for_all_global_symbols): New function.
4070         (Sized_relobj::do_for_all_global_symbols): New function.
4071         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4072         function.
4073         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4074         function.
4075
4076 2011-03-27  Ian Lance Taylor  <iant@google.com>
4077
4078         * archive.cc (Archive::interpret_header): Return -1 if something
4079         goes wrong.  Change callers accordingly.
4080
4081 2011-03-25  Cary Coutant  <ccoutant@google.com>
4082
4083         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4084         * testsuite/Makefile.in: Regenerate.
4085
4086 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4087
4088         * plugin.cc (get_view): New.
4089         (Plugin::load): Pass get_view to the plugin.
4090         (Plugin_manager::get_view): New.
4091
4092 2011-03-21  Ian Lance Taylor  <iant@google.com>
4093
4094         * testsuite/final_layout.sh: Rewrite to not use dc.
4095         * testsuite/relro_test.sh: Fail if dc is not present.
4096
4097 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4098
4099         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4100         Change == to -eq.
4101         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4102         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4103         Change == to -eq.
4104         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4105         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4106
4107 2011-03-14  Ian Lance Taylor  <iant@google.com>
4108
4109         * script-sections.cc (Sort_output_sections::script_compare):
4110         Rename from is_before, change return type.
4111         (Sort_output_sections::operator()): Adjust accordingly.
4112
4113 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4114
4115         PR gold/12572
4116         * testsuite/odr_violation2.cc: Add comment to make all error line
4117         numbers double digits.
4118         * testsuite/debug_msg.sh: Adjust expected errors.
4119
4120 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4121
4122         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4123         but mark earlier ones as non-canonical
4124         (offset_to_iterator): Update search target and example
4125         (do_addr2line): Return extra lines in a vector*
4126         (format_file_lineno): Extract from do_addr2line
4127         (one_addr2line): Add vector* out-param
4128         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4129         when a lineno entry appeared last for its instruction
4130         (Dwarf_line_info): Add vector* out-param
4131         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4132         * symtab.cc (Odr_violation_compare): Include the lineno in the
4133         comparison again.
4134         (linenos_from_loc): New. Combine the canonical line for an
4135         address with its other lines.
4136         (True_if_intersect): New. Helper functor to make
4137         std::set_intersection a query.
4138         (detect_odr_violations): Compare sets of lines instead of just
4139         one line for each function. This became less deterministic, but
4140         has fewer false positives.
4141         * symtab.h: Declarations.
4142         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4143         mix an optimized and non-optimized object in the same binary
4144         (odr_violation2.so): Same.
4145         * testsuite/Makefile.in: Regenerate from Makefile.am.
4146         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4147         * testsuite/debug_msg.sh: Update line numbers and add
4148         assertions.
4149         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4150         non-optimized context.
4151         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4152         isn't inlined, and use OdrDerived in an optimized context.
4153         * testsuite/odr_header1.h: Defines OdrDerived, where
4154         optimization will change the
4155         first-instruction-in-the-destructor's file and line number.
4156         * testsuite/odr_header2.h: Defines OdrBase.
4157
4158 2011-03-09  Ian Lance Taylor  <iant@google.com>
4159
4160         * fileread.cc (File_read::clear_views): Don't delete the whole
4161         file view.
4162
4163 2011-03-08  Ian Lance Taylor  <iant@google.com>
4164
4165         PR gold/12525
4166         * fileread.cc: #include <climits>.
4167         (GOLD_IOV_MAX): Define.
4168         (File_read::read_multiple): Limit number of entries by iov_max.
4169         * fileread.h (class File_read): Always set max_readv_entries to
4170         128.
4171
4172 2011-03-07  Ian Lance Taylor  <iant@google.com>
4173
4174         PR gold/12525
4175         * options.h (class General_options): Add -dy and -dn.
4176
4177 2011-03-02  Cary Coutant  <ccoutant@google.com>
4178
4179         * testsuite/script_test_9.t: Add TLS segment.
4180
4181 2011-03-02  Simon Baldwin  <simonb@google.com>
4182
4183         * configure.ac: Add check for gnu_indirect_function support in
4184         the toolchain building binutils.
4185         * configure: Rebuild.
4186
4187 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4188
4189         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4190         plugin only symbols.
4191         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4192         in plugin files as not needed in the symbol table.
4193
4194 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4195
4196         * output.cc (Output_section::add_input_section): Delay fill
4197         generation for section ordering.
4198
4199 2011-02-09  Ian Lance Taylor  <iant@google.com>
4200
4201         PR gold/12316
4202         * object.h (class Sized_relobj): Remove clear_local_symbols.
4203         * reloc.cc (Sized_relobj::do_relocate): Don't call
4204         clear_local_symbols.
4205
4206 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4207
4208         * plugin.cc (is_visible_from_outside): Return true for symbols
4209         in the -u option.
4210
4211 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4212
4213         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4214         filename.
4215
4216 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4217
4218         * icf.h (is_section_foldable_candidate): Change type of parameter
4219         to std::string.
4220         * icf.cc (Icf::find_identical_sections): Change type of local variable
4221         section_name to be std::string.
4222         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4223
4224 2011-01-25  Ian Lance Taylor  <iant@google.com>
4225
4226         * script.cc (script_add_extern): Rewrite to use
4227         add_symbol_reference.
4228
4229 2011-01-25  Doug Kwan  <dougkwan@google.com>
4230
4231         * icf.cc (get_section_contents): Always lock section's object.
4232
4233 2011-01-24  Ian Lance Taylor  <iant@google.com>
4234
4235         * options.h (class General_options): Accept
4236         --no-detect-odr-violations.
4237
4238 2011-01-24  Ian Lance Taylor  <iant@google.com>
4239
4240         * version.cc (version_string): Bump to 1.11.
4241
4242 2011-01-24  Ian Lance Taylor  <iant@google.com>
4243
4244         * plugin.cc (class Plugin_rescan): Define new class.
4245         (Plugin_manager::claim_file): Set any_claimed_.
4246         (Plugin_manager::save_archive): New function.
4247         (Plugin_manager::save_input_group): New function.
4248         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4249         necessary.
4250         (Plugin_manager::new_undefined_symbol): New function.
4251         (Plugin_manager::rescan): New function.
4252         (Plugin_manager::rescannable_defines): New function.
4253         (Plugin_manager::add_input_file): Set any_added_.
4254         * plugin.h (class Plugin_manager): define new fields rescannable_,
4255         undefined_symbols_, any_claimed_, and any_added_.  Declare
4256         Plugin_rescan as friend.  Declare new functions.
4257         (Plugin_manager::Rescannable): Define type.
4258         (Plugin_manager::Rescannable_list): Define type.
4259         (Plugin_manager::Undefined_symbol_list): Define type.
4260         (Plugin_manager::Plugin_manager): Initialize new fields.
4261         * archive.cc (Archive::defines_symbol): New function.
4262         (Add_archive_symbols::run): Pass archive to plugins if any.
4263         * archive.h (class Archive): Declare defines_symbol.
4264         * readsyms.cc (Input_group::~Input_group): New function.
4265         (Finish_group::run): Pass input_group to plugins if any.
4266         * readsyms.h (class Input_group): Declare destructor.
4267         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4268         any.
4269
4270 2011-01-10  Ian Lance Taylor  <iant@google.com>
4271
4272         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4273         section as relro.
4274         (Layout::set_segment_offsets): Reset increase_relro before calling
4275         set_section_addresses a second time.
4276
4277 2011-01-04  Cary Coutant  <ccoutant@google.com>
4278
4279         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4280         sections before NOBITS sections.
4281
4282 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4283
4284         * version.cc (print_version): Update copyright to 2011.
4285
4286 2010-12-23  Cary Coutant  <ccoutant@google.com>
4287
4288         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4289         of OS to this->add.  Add OD parameter to second form of the function.
4290
4291 2010-12-20  Ian Lance Taylor  <iant@google.com>
4292
4293         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4294         second of two consecutive entries with same offset.
4295
4296 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4297
4298         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4299         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4300         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4301         to avoid unneeded links against $(LDADD).
4302         * testsuite/Makefile.in: Regenerate.
4303
4304 2010-12-15  Ian Lance Taylor  <iant@google.com>
4305
4306         PR gold/12324
4307         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4308         for R_X86_64_32 and R_X86_64_PC32.
4309         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4310         ver_matching_def_pic.o.
4311         (ver_matching_def_pic.o): New target.
4312
4313 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4314
4315         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4316         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4317         Move definition before File_read::View member definitions.
4318         (File_read::View::~View): Initialize and hold lock before
4319         updating current_mapped_bytes.
4320
4321 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4322
4323         * dwarf_reader.cc: Remove outdated comment.
4324         * gold-threads.cc: Fix typo in error message.
4325         * archive.cc: Fix typos in comments.
4326         * archive.h: Likewise.
4327         * arm-reloc-property.cc: Likewise.
4328         * arm-reloc-property.h: Likewise.
4329         * arm-reloc.def: Likewise.
4330         * arm.cc: Likewise.
4331         * attributes.h: Likewise.
4332         * cref.cc: Likewise.
4333         * ehframe.cc: Likewise.
4334         * fileread.h: Likewise.
4335         * gold.h: Likewise.
4336         * i386.cc: Likewise.
4337         * icf.cc: Likewise.
4338         * incremental.h: Likewise.
4339         * int_encoding.cc: Likewise.
4340         * layout.h: Likewise.
4341         * main.cc: Likewise.
4342         * merge.h: Likewise.
4343         * object.cc: Likewise.
4344         * object.h: Likewise.
4345         * options.cc: Likewise.
4346         * readsyms.cc: Likewise.
4347         * reduced_debug_output.cc: Likewise.
4348         * reloc.cc: Likewise.
4349         * script-sections.cc: Likewise.
4350         * sparc.cc: Likewise.
4351         * symtab.h: Likewise.
4352         * target-reloc.h: Likewise.
4353         * target.cc: Likewise.
4354         * target.h: Likewise.
4355         * timer.cc: Likewise.
4356         * timer.h: Likewise.
4357         * x86_64.cc: Likewise.
4358
4359 2010-12-09  Cary Coutant  <ccoutant@google.com>
4360
4361         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4362         stack.
4363         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4364         parameter; change all callers.
4365         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4366         * options.h (warn_execstack): New option.
4367
4368 2010-12-07  Doug Kwan  <dougkwan@google.com>
4369
4370         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4371         like function call relocations.
4372
4373 2010-12-07  Ian Lance Taylor  <iant@google.com>
4374
4375         * archive.cc (Archive::get_elf_object_for_member): Permit
4376         punconfigured to be NULL.
4377         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4378         (Archive::include_member): Pass NULL to get_elf_object_for_member
4379         if we searched for the archive and this is the first included
4380         object.
4381
4382 2010-12-01  Ian Lance Taylor  <iant@google.com>
4383
4384         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4385         track_relocs_type_ field.
4386         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4387         Set track_relocs_type_.
4388         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4389         contents when using RELA relocs.
4390         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4391         reloc_map_.
4392         * reloc.cc (Track_relocs::next_addend): New function.
4393         * reloc.h (class Track_relocs): Declare next_addend.
4394
4395 2010-12-01  Ian Lance Taylor  <iant@google.com>
4396
4397         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4398         virtual destructor.
4399
4400 2010-12-01  Ian Lance Taylor  <iant@google.com>
4401
4402         * README: Update compilers known to work and fail.
4403
4404 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4405
4406         * configure.in: For --enable-gold, handle value `default' instead of
4407         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4408         not the default.
4409         * configure: Regenerate.
4410
4411 2010-11-18  Doug Kwan  <dougkwan@google.com>
4412
4413         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4414         and right_alignment to be zero.  Store result alignment only if it is
4415         greater than existing alignment.
4416
4417 2010-11-16  Cary Coutant  <ccoutant@google.com>
4418
4419         PR gold/12220
4420         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4421         Check for ".zdebug_line".
4422
4423 2010-11-16  Doug Kwan  <dougkwan@google.com>
4424             Cary Coutant  <ccoutant@google.com>
4425
4426         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4427         by reference; adjust all callers.
4428         * output.cc (Output_segment::set_section_addresses): Adjust references
4429         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4430         list is empty.
4431         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4432         end at page boundary.
4433
4434 2010-11-16  Cary Coutant  <ccoutant@google.com>
4435
4436         PR gold/12220
4437         * layout.cc (Layout::choose_output_section): Transform names of
4438         compressed sections even when using a script with a SECTIONS clause.
4439         (Layout::output_section_name): Remove code to transform
4440         compressed debug section names.
4441         * output.cc (Output_section::add_input_section): Use uncompressed
4442         section size when tracking input sections.
4443
4444 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4445
4446         * symtab.h (Symbol::NON_PIC_REF): Remove.
4447         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4448         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4449         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4450         (Symbol::use_plt_offset): Take a flags argument and pass it
4451         directly to needs_dynamic_reloc.  Restrict check for undefined
4452         weak symbols to function calls.
4453         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4454         (Target_arm::Scan::global): Use it.
4455         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4456         (Target_arm::Relocate::relocate): Likewise.
4457         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4458         parameter with an r_type parameter.  Use get_reference_flags
4459         to get the flags.
4460         (Target_arm::Relocate::relocate): Update accordingly.
4461         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4462         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4463         (Target_i386::Scan::global): Likewise.
4464         (Target_i386::Relocate::relocate): Likewise.
4465         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4466         parameter with an r_type parameter.  Use get_reference_flags
4467         to get the flags.
4468         (Target_i386::Relocate::relocate): Update accordingly.
4469         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4470         (Target_powerpc::Scan::global): Use it.
4471         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4472         (Target_powerpc::Relocate::relocate): Likewise.
4473         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4474         (Target_sparc::Scan::global): Use it.
4475         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4476         (Target_sparc::Relocate::relocate): Likewise.
4477         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4478         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4479         (Target_x86_64::Scan::global): Likewise.
4480         (Target_x86_64::Relocate::relocate): Likewise.
4481
4482 2010-11-08  Doug Kwan  <dougkwan@google.com>
4483             Cary Coutant  <ccoutant@google.com>
4484
4485         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4486         (Arm_exidx_merge_section::section_contents_): New data member.
4487         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4488         (Arm_input_section::~Arm_input_section): De-allocate memory.
4489         (Arm_input_section::original_contents_): New data member.
4490         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4491         in parameters instead of calling Object::section_contents without
4492         locking.
4493         (Arm_output_section::group_section): New parameter TASK.  Pass it
4494         to callees that need locking objects.
4495         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4496         to lock EXIDX input sections.  Fix a formatting issue.  Call
4497         Arm_exidx_merged_section::build_contents to create merged section
4498         contents.
4499         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4500         to lock object of stub table owner.
4501         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4502         TEXT_SIZE to initialize data member TEXT_SIZE_.
4503         (Arm_exidx_input_section::addralign): Fix typo in comment.
4504         (Arm_exidx_input_section::text_size): New method.
4505         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4506         that require locking objects.  Lock objects before scanning for stubs
4507         and updating local symbols.
4508         (Arm_input_section<big_endian>::init): Copy contents of original
4509         input section.
4510         (Arm_input_section<big_endian>::do_write): Use saved contents of
4511         original input section instead of calling Object::section_contents
4512         without locking.
4513         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4514         size without calling Object::section_size().
4515         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4516         for size.  Allocate a buffer for merged EXIDX entries.
4517         (Arm_exidx_merged_section::build_contents): New method.
4518         (Arm_exidx_merged_section::do_write): Move merge section contents
4519         building code to Arm_exidx_merged_section::build_contetns.  Write
4520         out contetns in buffer instead of building it on the fly.
4521         (Arm_relobj::make_exidx_input_section): Also pass text section size
4522         to Arm_exidx_input_section constructor.
4523         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4524         (Arm_dynobj::do_read_symbols): Fix memory leak.
4525         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4526         * target.h: (class Task): Add forward declaration.
4527         (Target::relax): Add new parameter TASK and pass it to
4528         Target::do_relax().
4529         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4530
4531 2010-11-05  Cary Coutant  <ccoutant@google.com>
4532
4533         PR gold/10708
4534         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4535         object when reading from the file.
4536         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4537         second layout pass.
4538         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4539         when reading section contents.
4540         (get_section_contents): Likewise.
4541         (icf::find_identical_sections): Likewise.
4542         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4543         object when reading from the file.
4544         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4545         the object when doing deferred section layout.
4546
4547 2010-11-03  Nick Clifton  <nickc@redhat.com>
4548
4549         PR gold/12001
4550         * script.h (class Symbol_assignment: name): New member.  Returns
4551         the name of the symbol.
4552         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4553         Returns true if the given symbol name is on the list of
4554         assignments wating to be processed.
4555         * archive.cc (should_incldue_member): If the symbol is undefined,
4556         check to see if it is on the list of symbols pending assignment.
4557
4558 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4559
4560         * script-sections.cc (Script_sections::find_memory_region): Check
4561         for a NULL output section pointer.
4562
4563 2010-10-29  Doug Kwan  <dougkwan@google.com>
4564
4565         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4566         Output_section::add_relaxed_input_section.
4567         * output.cc (Output_section::add_relaxed_input_section): Add new
4568         arguments LAYOUT and NAME.  Set section order index.
4569         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4570         Copy section order index.
4571         * output.h (Output_section::add_relaxed_input_section): Add new
4572         arguments LAYOUT and NAME.
4573
4574 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4575
4576         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4577         NATIVE_OR_CROSS_LINKER.
4578         * testsuite/Makefile.in: Regenerate.
4579
4580 2010-10-20  Doug Kwan  <dougkwan@google.com>
4581
4582         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4583         without SHF_LINK_ORDER flags.
4584         * layout.cc (Layout::choose_output_section): Do not filter
4585         SHF_LINK_ORDER flag in a relocatable link.
4586
4587 2010-10-17  Cary Coutant  <ccoutant@google.com>
4588
4589         * output.h (Output_segment::set_section_addresses): Change function
4590         signature.  Update all callers.
4591         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4592         sections.
4593         (Output_segment::set_section_addresses): Align after last TLS
4594         section.  Add padding before last relro section instead of after.
4595
4596 2010-10-17  Doug Kwan  <dougkwan@google.com>
4597
4598         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4599         GOT output section to be writable.
4600
4601 2010-10-14  Cary Coutant  <ccoutant@google.com>
4602
4603         * debug.h (DEBUG_INCREMENTAL): New flag.
4604         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4605         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4606         mode.
4607         * incremental.cc (report_command_line): Ignore all forms of
4608         --incremental.
4609         * layout.cc (Layout::Layout): Check parameters for incremental link
4610         mode.
4611         * options.cc (General_options::parse_incremental): New function.
4612         (General_options::parse_no_incremental): New function.
4613         (General_options::parse_incremental_full): New function.
4614         (General_options::parse_incremental_update): New function.
4615         (General_options::incremental_mode_): New data member.
4616         (General_options::finalize): Check incremental_mode_.
4617         * options.h (General_options): Update help text for --incremental.
4618         Add --no-incremental, --incremental-full, --incremental-update.
4619         (General_options::Incremental_mode): New enum type.
4620         (General_options::incremental_mode): New function.
4621         (General_options::incremental_mode_): New data member.
4622         * parameters.cc (Parameters::incremental_mode_): New data member.
4623         (Parameters::set_options): Set incremental_mode_.
4624         (Parameters::set_incremental_full): New function.
4625         (Parameters::incremental): New function.
4626         (Parameters::incremental_update): New function.
4627         (set_parameters_incremental_full): New function.
4628         * parameters.h (Parameters::set_incremental_full): New function.
4629         (Parameters::incremental): New function.
4630         (Parameters::incremental_update): New function.
4631         (Parameters::incremental_mode_): New data member.
4632         (set_parameters_incremental_full): New function.
4633         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4634         incremental link mode.
4635         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4636         (Sized_relobj::do_relocate_sections): Likewise.
4637         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4638         option.
4639         * testsuite/Makefile.in: Regenerate.
4640         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4641
4642 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4643
4644         * script-sections.h (class Script_sections): Make
4645         Sections_elements typedef public.
4646         * script-sections.cc (class Sort_output_sections): Add elements_
4647         field.  Add constructor which sets it; change all callers.
4648         (Sort_output_sections::is_before): New function.
4649         (Sort_output_sections::operator()): Call is_before.
4650         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4651         conditional.
4652         * testsuite/script_test_10.sh: New test. Test script section
4653         order.
4654         * testsuite/script_test_10.t: Likewise.
4655         * testsuite/script_test_10.s: Likewise.
4656         * testsuite/Makefile.am: Wrap the cross linker tests and the
4657         common tests into NATIVE_OR_CROSS_LINKER.
4658         (check_SCRIPTS): Add script_test_10.sh.
4659         (check_DATA): Add script_test_10.stdout.
4660         (script_test_10.o, script_test_10): New targets.
4661         (script_test_10.stdout): New target.
4662         * configure, testsuite/Makefile.in: Regenerate.
4663
4664 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4665
4666         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4667         error for the deprecated relocations.
4668         (Target_arm::Scan::global): Likewise.
4669         (Target_arm::Relocate::relocate): Likewise.
4670
4671 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4672
4673         * fileread.cc (Input_file::find_file): Initialize *found_name
4674         and *namep when using the fallback search for case 4.
4675
4676 2010-10-11  Cary Coutant  <ccoutant@google.com>
4677
4678         * options.h (class General_options): Redefine -z lazy as an alias for
4679         the negation of -z now.
4680
4681 2010-10-11  Ian Lance Taylor  <iant@google.com>
4682
4683         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4684         binding.
4685
4686 2010-10-06  Nick Clifton  <nickc@redhat.com>
4687
4688         * script-sections.cc(class Memory_region): Remove
4689         current_lma_offset_ field.  Rename current_vma_offset_ to
4690         current_offset_.  Add last_section_ field.
4691         (Memory_region::get_current_vma_address): Rename to
4692         get_current_address.
4693         (Memory_region::get_current_lma_address): Delete.
4694         (Memory_region::increment_vma_offset): Rename to
4695         increment_offset.
4696         (Memory_region::increment_lma_offset): Delete.
4697         (Memory_region::attributes_compatible): New method.  Returns
4698         true if the provided section is compatible with the region.
4699         (Memory_region::get_last_section): New method.  Returns the last
4700         section to use the region.
4701         (Memory_region::set_last_section): New method.  Stores the last
4702         section to use the region.
4703         (Script_sections::block_in_region): New method.  Returns true if
4704         a block of memory is contained within a region.
4705         (Script_sections::find_memory_region): New method.  Locates a
4706         memory region to be used to set a VMA or LMA address.
4707         (Output_section_definition::set_section_addresses): Add code to
4708         check for addresses set by memory regions.
4709         (Output_segment::set_section_addresses): Remove memory region
4710         walking code.
4711         (Script_sections::create_segment): Add a warning if a header
4712         segment is created outside of any region.
4713         * script-sections.h (class Script_sections): Add prototypes for
4714         find_memory_region and block_in_region methods.
4715         * testsuite/memory_test.s: Use .long instead of .word.
4716         * testsuite/memory_test.t: Add some more output sections.
4717         * testsuite/memory_test.sh: Update expected output.
4718
4719 2010-10-02  Doug Kwan  <dougkwan@google.com>
4720
4721         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4722         defintion to symtab.h
4723         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4724         declaration to defintion.
4725
4726 2010-10-01  Nick Clifton  <nickc@redhat.com>
4727
4728         * expression.cc (eval): Replace dummy argument with NULL.
4729         (eval_maybe_dot): Check for a NULL result section pointer.
4730         (Symbol_expression::value): Likewise.
4731         (Dot_expression::value): Likewise.
4732         (BINARY_EXPRESSION): Likewise.
4733         (Max_expression::value): Likewise.
4734         (Min_expression::value): Likewise.
4735         (Absolute_expression::value): Likewise.
4736         (Addr_expression::value_from_output_section): Likewise.
4737         (Loaddddr_expression::value_from_output_section): Likewise.
4738         (Segment_start_expression::value): Likewise.
4739         * script-sections.cc
4740         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4741         argument with NULL.
4742         (Sections_elememt_dot_assignment::set_section_addresses):
4743         Likewise.
4744         (Output_data_expression::do_write_to_buffer): Likewise.
4745         (Output_section_definition::finalize_symbols): Likewise.
4746         (Output_section_definition::set_section_addresses): Likewise.
4747
4748 2010-09-30  Doug Kwan  <dougkwan@google.com>
4749
4750         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4751
4752 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4753
4754         * target.h (Target::can_icf_inline_merge_sections): New virtual
4755         function.
4756         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4757         virtual function.
4758         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4759         virtual function.
4760         * icf.cc (get_section_contents): Inline merge sections only when
4761         target allows it.
4762
4763 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4764
4765         * configure: Regenerate.
4766
4767 2010-09-17  Ian Lance Taylor  <iant@google.com>
4768
4769         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4770         * testsuite/Makefile.am (memory_test.o): New target.
4771         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4772         memory_test.t.
4773         * testsuite/Makefile.in: Rebuild.
4774
4775 2010-09-17  Doug Kwan  <dougkwan@google.com>
4776
4777         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4778         defintion if relocation uses GOT entries of the symbol.
4779         * testsuite/icf_safe_test.sh: Fix test.
4780         * testsuite/icf_safe_so_test.sh: Fix test.
4781
4782 2010-09-16  Cary Coutant  <ccoutant@google.com>
4783
4784         * script_sections.cc (class Memory_region): Remove "NULL" from
4785         vector initializations.
4786
4787 2010-09-15  Cary Coutant  <ccoutant@google.com>
4788
4789         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4790         Resolve forwarding symbols.
4791
4792 2010-09-15  Doug Kwan  <dougkwan@google.com>
4793
4794         * gold/testsuite/script_test_3.t: Add ARM special sections.
4795         * gold/testsuite/script_test_4.t: Same.
4796         * gold/testsuite/script_test_5.t: Same.
4797         * gold/testsuite/script_test_6.t: Same.
4798         * gold/testsuite/script_test_7.t: Same.
4799         * gold/testsuite/script_test_7.t: Same.
4800         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4801
4802 2010-09-14  Cary Coutant  <ccoutant@google.com>
4803
4804         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4805         (Target_x86_64::Relocate::relocate_tls): Replace check for
4806         saw_tls_block_reloc_ with test for executable section.
4807
4808 2010-09-12  Cary Coutant  <ccoutant@google.com>
4809
4810         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4811         position-independent executables to shared libraries need dynamic
4812         relocations.
4813         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4814         position-independent executables.
4815         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4816         * testsuite/Makefile.in: Regenerate.
4817
4818 2010-09-10  Nick Clifton  <nickc@redhat.com>
4819
4820         PR gold/11997
4821         * testsuite/memory_test.t: Discard any sections that are not
4822         needed.
4823
4824 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4825
4826         PR gold/11996
4827         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4828         "This::" to work around a bug in gcc 4.2.
4829
4830         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4831
4832 2010-09-09  Rafael Espindola  <espindola@google.com>
4833
4834         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4835         sections with different PF_X flags in the same segment.
4836         (Layout::find_first_load_seg): Search all segments to find the first
4837         one.
4838         * options.h (rosegment): New.
4839
4840 2010-09-08  Rafael Espindola  <espindola@google.com>
4841
4842         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4843
4844 2010-09-08  Doug Kwan  <dougkwan@google.com>
4845
4846         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4847         (Arm_relobj::do_relocate_sections): Add new parameter for output
4848         file to match the parent.
4849         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4850         of local symbols instead of input values.  Update code to track
4851         changes in gold::relocate_section.
4852         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4853         (Sized_relobj::compute_final_local_value_internal): New methods.
4854         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4855         body into private version of Sized_relobj::compute_final_local_value.
4856         Call the inline method.
4857         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4858         merged symbol value if there is one.
4859         (Symbol_value::has_output_value): New method defintiion.
4860         (Sized_relobj::Compute_final_local_value_status): New enum type.
4861         (Sized_relobj::compute_final_local_value): New methods.
4862         (Sized_relobj::compute_final_local_value_internal): New methods.
4863         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4864         and arm_cortex_a8.sh.
4865         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4866         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4867         New tests.
4868         * Makefile.in: Regenerate.
4869         * testsuite/arm_bl_out_of_range.s: Update test.
4870         * testsuite/thumb_bl_out_of_range.s: Ditto.
4871         * testsuite/thumb_blx_out_of_range.s: Ditto.
4872         * testsuite/arm_branch_out_of_range.sh: New file.
4873         * testsuite/arm_cortex_a8.sh: Ditto.
4874         * testsuite/arm_cortex_a8_b.s: Ditto.
4875         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4876         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4877         * testsuite/arm_cortex_a8_bl.s: Ditto.
4878         * testsuite/arm_cortex_a8_blx.s: Ditto.
4879         * testsuite/arm_cortex_a8_local.s: Ditto.
4880         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4881         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4882
4883 2010-09-08  Rafael Espindola  <espindola@google.com>
4884
4885         * Makefile.am (memory_test.stdout): Run readelf with -W.
4886         * Makefile.in: Regenerate.
4887         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4888         64 bit output.
4889
4890 2010-09-08  Rafael Espindola  <espindola@google.com>
4891
4892         * script-sections.cc (Script_sections::add_memory_region): Convert
4893         field precision to int.
4894         * script.cc (script_set_section_region, script_set_section_region):
4895         Convert field precision to int.
4896
4897 2010-09-08  Rafael Espindola  <espindola@google.com>
4898
4899         * arm.cc (do_finalize_sections): Create the __exidx_start and
4900         __exdix_end symbols even when the section is missing.
4901
4902 2010-09-08  Nick Clifton  <nickc@redhat.com>
4903
4904         * README: Remove claim that MEMORY is not supported.
4905         * expression.cc (script_exp_function_origin)
4906         (script_exp_function_length): Move from here to ...
4907         * script.cc: ... here.
4908         (script_set_section_region, script_add_memory)
4909         (script_parse_memory_attr, script_include_directive): New
4910         functions.
4911         * script-sections.cc
4912         (class Memory_region): New class.
4913         (class Output_section_definition): Add set_memory_region,
4914         set_section_vma, set_section_lma and get_section_name methods.
4915         (class Script_Sections): Add add_memory_region,
4916         find_memory_region, find_memory_region_origin,
4917         find_memory_region_length and set_memory_region methods.
4918         Have set_section_addresses method walk the list of set memory
4919         regions.
4920         Extend the print methos to display memory regions.
4921         * script-sections.h: Add prototypes for new methods.
4922         Add enum for MEMORY region attributes.
4923         * yyscript.y: Add support for parsing MEMORY regions.
4924         * script-c.h: Add prototypes for new functions.
4925         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4926         * testsuite/Makefile.in: Regenerate.
4927         * testsuite/memory_test.sh: New script.
4928         * testsuite/memory_test.s: New assembler source file.
4929         * testsuite/memory_test.t: New linker script.
4930
4931 2010-08-27  Doug Kwan  <dougkwan@google.com>
4932
4933         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4934         reference override an existing dynamic weak reference.
4935         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4936         * testsuite/Makefile.in: Regenerate.
4937         * testsuite/dyn_weak_ref.sh: New file.
4938         * testsuite/dyn_weak_ref_1.c: Ditto.
4939         * testsuite/dyn_weak_ref_2.c: Ditto.
4940
4941 2010-08-27  Ian Lance Taylor  <iant@google.com>
4942
4943         * incremental.h (class Incremental_input_entry): Add virtual
4944         destructor.
4945
4946 2010-08-27  Ian Lance Taylor  <iant@google.com>
4947
4948         * testsuite/start_lib_test_3.c: Mark t3 as used.
4949
4950 2010-08-27  Nick Clifton  <nickc@redhat.com>
4951
4952         * options.cc (version_script): Fix small typo in previous
4953         whitespace tidyup.
4954
4955 2010-08-25  Nick Clifton  <nickc@redhat.com>
4956
4957         * archive.cc: Formatting fixes: Remove whitespace between
4958         typename and following asterisk.  Remove whitespace between
4959         function name and opening parenthesis.
4960         * archive.h: Likewise.
4961         * arm.cc: Likewise.
4962         * attributes.cc: Likewise.
4963         * attributes.h: Likewise.
4964         * common.cc: Likewise.
4965         * copy-relocs.cc: Likewise.
4966         * dirsearch.h: Likewise.
4967         * dynobj.cc: Likewise.
4968         * ehframe.cc: Likewise.
4969         * ehframe.h: Likewise.
4970         * expression.cc: Likewise.
4971         * fileread.cc: Likewise.
4972         * fileread.h: Likewise.
4973         * gc.h: Likewise.
4974         * gold-threads.cc: Likewise.
4975         * gold.cc: Likewise.
4976         * i386.cc: Likewise.
4977         * icf.h: Likewise.
4978         * incremental-dump.cc: Likewise.
4979         * incremental.cc: Likewise.
4980         * layout.cc: Likewise.
4981         * layout.h: Likewise.
4982         * main.cc: Likewise.
4983         * merge.cc: Likewise.
4984         * merge.h: Likewise.
4985         * object.cc: Likewise.
4986         * object.h: Likewise.
4987         * options.cc: Likewise.
4988         * options.h: Likewise.
4989         * output.cc: Likewise.
4990         * output.h: Likewise.
4991         * plugin.cc: Likewise.
4992         * plugin.h: Likewise.
4993         * powerpc.cc: Likewise.
4994         * reloc.cc: Likewise.
4995         * script-c.h: Likewise.
4996         * script-sections.cc: Likewise.
4997         * script.cc: Likewise.
4998         * stringpool.cc: Likewise.
4999         * symtab.cc: Likewise.
5000         * symtab.h: Likewise.
5001         * target.cc: Likewise.
5002         * timer.cc: Likewise.
5003         * timer.h: Likewise.
5004         * version.cc: Likewise.
5005         * x86_64.cc: Likewise.
5006
5007 2010-08-24  Nick Clifton  <nickc@redhat.com>
5008
5009         PR 11899
5010         * layout.cc (segment_precedes): Sort segments by their physical
5011         addresses, if they have been set.
5012
5013 2010-08-23  Cary Coutant  <ccoutant@google.com>
5014
5015         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5016         symbols data.
5017         (Lib_group::include_member): Unlock object after deleting its
5018         symbols data.
5019         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5020         the bug fixed here.
5021
5022 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5023             Cary Coutant  <ccoutant@google.com>
5024
5025         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5026         constructor, and set_blocker.
5027         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5028         readsyms_blocker_.
5029         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5030         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5031         * testsuite/Makefile.am (start_lib_test): New test case.
5032         * testsuite/Makefile.in: Regenerate.
5033         * testsuite/start_lib_test_main.c: New file.
5034         * testsuite/start_lib_test_1.c: New file.
5035         * testsuite/start_lib_test_2.c: New file.
5036         * testsuite/start_lib_test_3.c: New file.
5037
5038 2010-08-19  Ian Lance Taylor  <iant@google.com>
5039
5040         * Makefile.in: Rebuild with automake 1.11.1.
5041         * aclocal.m4: Likewise.
5042         * testsuite/Makefile.in: Likewise.
5043
5044 2010-08-19  Ian Lance Taylor  <iant@google.com>
5045
5046         PR 10893
5047         * i386.cc (class Output_data_plt_i386): Update declarations.
5048         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5049         local_ifuncs_ fields.
5050         (Target_i386::do_plt_section_for_global): New function.
5051         (Target_i386::do_plt_section_for_local): New function.
5052         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5053         parameter; change all callers.  Initialize global_ifuncs_ and
5054         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5055         __rel_iplt_end.
5056         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5057         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5058         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5059         symbols.
5060         (Target_i386::make_plt_section): New function, broken out of
5061         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5062         (Target_i386::make_plt_entry): Call make_plt_section.
5063         (Target_i386::make_local_ifunc_plt_entry): New function.
5064         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5065         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5066         R_386_IRELATIVE to switch.
5067         (Target_i386::Scan::global): Likewise.
5068         (Target_i386::Relocate::relocate): Likewise.
5069         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5070         switch.
5071         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5072         (Target_x86_64::do_plt_section_for_global): New function.
5073         (Target_x86_64::do_plt_section_for_local): New function.
5074         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5075         parameter; change all callers.  If doing a static link define
5076         __rela_iplt_start and __rela_iplt_end.
5077         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5078         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5079         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5080         to point to .plt.
5081         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5082         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5083         switch.
5084         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5085         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5086         R_X86_64_IRELATIVE to switch.
5087         (Target_x86_64::Scan::global): Likewise.
5088         (Target_x86_64::Relocate::relocate): Likewise.
5089         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5090         switch.
5091         * target.h (class Target): Add plt_section_for_global and
5092         plt_section_for_local functions.  Add do_plt_section_for_global
5093         and do_plt_section_for_local virtual functions.
5094         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5095         clarifying comments.
5096         (Symbol::use_plt_offset): Handle IFUNC symbol.
5097         * object.cc (Sized_relobj::Sized_relobj): Initialize
5098         local_plt_offsets_.
5099         (Sized_relobj::local_has_plt_offset): New function.
5100         (Sized_relobj::local_plt_offset): New function.
5101         (Sized_relobj::set_local_plt_offset): New function.
5102         (Sized_relobj::do_count): Handle IFUNC symbol.
5103         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5104         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5105         is_ifunc_symbol functions.
5106         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5107         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5108         local_plt_offsets_ field.
5109         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5110         * output.h (class Output_section_data): Add non-const
5111         output_section function.
5112         (class Output_data_got): Update declarations.
5113         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5114         Add use_plt_offset parameter to global and local constructors.
5115         Change all callers.  Change local_sym_index_ field to 31 bits.
5116         Change GSYM_CODE and CONSTANT_CODE accordingly.
5117         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5118         doing a static link don't set sh_link field.
5119         (Output_data_got::Got_entry::write): Use PLT offset if
5120         appropriate.
5121         (Output_data_got::add_global_plt): New function.
5122         (Output_data_got::add_local_plt): New function.
5123         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5124         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5125         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5126         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5127         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5128         IFUNC conditional.
5129         * testsuite/ifunc-sel.h: New file.
5130         * testsuite/ifuncmain1.c: New file.
5131         * testsuite/ifuncmain1vis.c: New file.
5132         * testsuite/ifuncmod1.c: New file.
5133         * testsuite/ifuncdep2.c: New file.
5134         * testsuite/ifuncmain2.c: New file.
5135         * testsuite/ifuncmain3.c: New file.
5136         * testsuite/ifuncmod3.c: New file.
5137         * testsuite/ifuncmain4.c: New file.
5138         * testsuite/ifuncmain5.c: New file.
5139         * testsuite/ifuncmod5.c: New file.
5140         * testsuite/ifuncmain6pie.c: New file.
5141         * testsuite/ifuncmod6.c: New file.
5142         * testsuite/ifuncmain7.c: New file.
5143         * configure, testsuite/Makefile.in: Rebuild.
5144
5145 2010-08-18  Ian Lance Taylor  <iant@google.com>
5146
5147         * incremental.cc
5148         (Output_section_incremental_inputs::write_input_files): Add cast
5149         to avoid signed/unsigned comparison warning.
5150         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5151
5152 2010-08-12  Cary Coutant  <ccoutant@google.com>
5153
5154         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5155
5156 2010-08-13  Ian Lance Taylor  <iant@google.com>
5157
5158         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5159
5160 2010-08-12  Cary Coutant  <ccoutant@google.com>
5161             Doug Kwan  <dougkwan@google.com>
5162
5163         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5164         defintion overrides non-weak undef, remember that the original undef
5165         is not weak.
5166         * symtab.cc (Symbol_table::sized_write_global): For undef without
5167         an original weak binding, set binding to global in output.
5168         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5169         * testsuite/Makefile.in: Regenerate.
5170         * testsuite/strong_ref_weak_def.sh: New file.
5171         * testsuite/strong_ref_weak_def_1.c: Ditto.
5172         * testsuite/strong_ref_weak_def_2.c: Ditto.
5173
5174 2010-08-12  Cary Coutant  <ccoutant@google.com>
5175
5176         * testsuite/incremental_test.sh: Rewrite.
5177         * testsuite/incremental_test_1.c: Rewrite.
5178         * testsuite/incremental_test_2.c: Rewrite.
5179
5180 2010-08-12  Cary Coutant  <ccoutant@google.com>
5181
5182         * arm.cc (Target_arm::got_size): Add const.
5183         (Target_arm::got_entry_count): New function.
5184         (Target_arm::plt_entry_count): New function.
5185         (Target_arm::first_plt_entry_offset): New function.
5186         (Target_arm::plt_entry_size): New function.
5187         (Output_data_plt_arm::entry_count): New function.
5188         (Output_data_plt_arm::first_plt_entry_offset): New function.
5189         (Output_data_plt_arm::get_plt_entry_size): New function.
5190         * i386.cc (Target_i386::got_size): Add const.
5191         (Target_i386::got_entry_count): New function.
5192         (Target_i386::plt_entry_count): New function.
5193         (Target_i386::first_plt_entry_offset): New function.
5194         (Target_i386::plt_entry_size): New function.
5195         (Output_data_plt_i386::entry_count): New function.
5196         (Output_data_plt_i386::first_plt_entry_offset): New function.
5197         (Output_data_plt_i386::get_plt_entry_size): New function.
5198         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5199         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5200         * incremental.cc: Include target.h.
5201         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5202         parameter.  Adjust all callers.  Find incremental_got_plt section.
5203         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5204         section.
5205         (Output_section_incremental_inputs::set_final_data_size): Calculate
5206         size of incremental_got_plt section.
5207         (Output_section_incremental_inputs::do_write): Write the
5208         incremental_got_plt section.
5209         (Got_plt_view_info): New struct.
5210         (Local_got_offset_visitor): New class.
5211         (Global_got_offset_visitor): New class.
5212         (Global_symbol_visitor_got_plt): New class.
5213         (Output_section_incremental_inputs::write_got_plt): New function.
5214         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5215         Add parameter.  Adjust all callers.
5216         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5217         (Incremental_inputs::got_plt_section): New function.
5218         (Incremental_inputs::got_plt_section_): New data member.
5219         (Incremental_got_plt_reader): New class.
5220         * layout.cc (Layout::create_incremental_info_sections): Add the
5221         incremental_got_plt section.
5222         * object.h (Got_offset_list::get_list): New function.
5223         (Got offset_list::for_all_got_offsets): New function.
5224         (Sized_relobj::local_got_offset_list): New function.
5225         * powerpc.cc (Target_powerpc::got_size): Add const.
5226         (Target_powerpc::got_entry_count): New function.
5227         (Target_powerpc::plt_entry_count): New function.
5228         (Target_powerpc::first_plt_entry_offset): New function.
5229         (Target_powerpc::plt_entry_size): New function.
5230         (Output_data_plt_powerpc::entry_count): New function.
5231         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5232         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5233         * sparc.cc (Target_sparc::got_size): Add const.
5234         (Target_sparc::got_entry_count): New function.
5235         (Target_sparc::plt_entry_count): New function.
5236         (Target_sparc::first_plt_entry_offset): New function.
5237         (Target_sparc::plt_entry_size): New function.
5238         (Output_data_plt_sparc::entry_count): New function.
5239         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5240         (Output_data_plt_sparc::get_plt_entry_size): New function.
5241         * symtab.h (Symbol::got_offset_list): New function.
5242         (Symbol_table::for_all_symbols): New function.
5243         * target.h (Sized_target::got_entry_count): New function.
5244         (Sized_target::plt_entry_count): New function.
5245         (Sized_target::plt_entry_size): New function.
5246         * x86_64.cc (Target_x86_64::got_size): Add const.
5247         (Target_x86_64::got_entry_count): New function.
5248         (Target_x86_64::plt_entry_count): New function.
5249         (Target_x86_64::first_plt_entry_offset): New function.
5250         (Target_x86_64::plt_entry_size): New function.
5251         (Output_data_plt_x86_64::entry_count): New function.
5252         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5253         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5254
5255 2010-08-12  Cary Coutant  <ccoutant@google.com>
5256
5257         * archive.cc: Include incremental.h.
5258         (Archive::Archive): Initialize incremental_info_.
5259         (Archive::include_member): Record archive members in incremental info.
5260         (Add_archive_symbols::run): Record begin and end of an archive in
5261         incremental info.
5262         (Lib_group::include_member): Record objects in incremental info.
5263         * archive.h (Incremental_archive_entry): Forward declaration.
5264         (Archive::set_incremental_info): New member function.
5265         (Archive::incremental_info): New member function.
5266         (Archive::Unused_symbol_iterator): New class.
5267         (Archive::unused_symbols_begin): New member function.
5268         (Archive::unused_symbols_end): New member function.
5269         (Archive::incremental_info_): New data member.
5270         * incremental-dump.cc (find_input_containing_global): New function.
5271         (dump_incremental_inputs): Dump new incremental info sections.
5272         * incremental.cc: Include symtab.h.
5273         (Output_section_incremental_inputs): New class.
5274         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5275         new incremental info sections.
5276         (Sized_incremental_binary::do_check_inputs): Likewise.
5277         (Incremental_inputs::report_archive): Remove.
5278         (Incremental_inputs::report_archive_begin): New function.
5279         (Incremental_inputs::report_archive_end): New function.
5280         (Incremental_inputs::report_object): New function.
5281         (Incremental_inputs::finalize_inputs): Remove.
5282         (Incremental_inputs::report_input_section): New function.
5283         (Incremental_inputs::report_script): Rewrite.
5284         (Incremental_inputs::finalize): Do nothing but finalize string table.
5285         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5286         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5287         (Incremental_inputs::create_data_sections): New function.
5288         (Incremental_inputs::relocs_entsize): New function.
5289         (Output_section_incremental_inputs::set_final_data_size): New function.
5290         (Output_section_incremental_inputs::do_write): New function.
5291         (Output_section_incremental_inputs::write_header): New function.
5292         (Output_section_incremental_inputs::write_input_files): New function.
5293         (Output_section_incremental_inputs::write_info_blocks): New function.
5294         (Output_section_incremental_inputs::write_symtab): New function.
5295         * incremental.h (Incremental_script_entry): Forward declaration.
5296         (Incremental_object_entry): Forward declaration.
5297         (Incremental_archive_entry): Forward declaration.
5298         (Incremental_inputs): Forward declaration.
5299         (Incremental_inputs_header_data): Remove.
5300         (Incremental_inputs_header): Remove.
5301         (Incremental_inputs_header_write): Remove.
5302         (Incremental_inputs_entry_data): Remove.
5303         (Incremental_inputs_entry): Remove.
5304         (Incremental_inputs_entry_write): Remove.
5305         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5306         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5307         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5308         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5309         Likewise.
5310         (Incremental_input_entry): New class.
5311         (Incremental_script_entry): New class.
5312         (Incremental_object_entry): New class.
5313         (Incremental_archive_entry): New class.
5314         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5315         (Incremental_inputs::report_inputs): Remove.
5316         (Incremental_inputs::report_archive): Remove.
5317         (Incremental_inputs::report_archive_begin): New function.
5318         (Incremental_inputs::report_archive_end): New function.
5319         (Incremental_inputs::report_object): Change prototype.
5320         (Incremental_inputs::report_input_section): New function.
5321         (Incremental_inputs::report_script): Change prototype.
5322         (Incremental_inputs::get_reloc_count): New function.
5323         (Incremental_inputs::set_reloc_count): New function.
5324         (Incremental_inputs::create_data_sections): New function.
5325         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5326         (Incremental_inputs::inputs_section): New function.
5327         (Incremental_inputs::symtab_section): New function.
5328         (Incremental_inputs::relocs_section): New function.
5329         (Incremental_inputs::get_stringpool): Add const.
5330         (Incremental_inputs::command_line): Add const.
5331         (Incremental_inputs::inputs): Remove.
5332         (Incremental_inputs::command_line_key): New function.
5333         (Incremental_inputs::input_file_count): New function.
5334         (Incremental_inputs::input_files): New function.
5335         (Incremental_inputs::relocs_entsize): New function.
5336         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5337         (Incremental_inputs::finalize_inputs): Remove.
5338         (Incremental_inputs::Input_info): Remove.
5339         (Incremental_inputs::lock_): Remove.
5340         (Incremental_inputs::inputs_): Change type.
5341         (Incremental_inputs::inputs_map_): Remove.
5342         (Incremental_inputs::current_object_entry_): New data member.
5343         (Incremental_inputs::inputs_section_): New data member.
5344         (Incremental_inputs::symtab_section_): New data member.
5345         (Incremental_inputs::relocs_section_): New data member.
5346         (Incremental_inputs::reloc_count_): New data member.
5347         (Incremental_inputs_reader): New class.
5348         (Incremental_symtab_reader): New class.
5349         (Incremental_relocs_reader): New class.
5350         * layout.cc (Layout::finalize): Move finalization of incremental info
5351         and creation of incremental info sections to follow finalization of
5352         symbol table.  Set offsets for postprocessing sections.
5353         (Layout::create_incremental_info_sections): Call
5354         Incremental_inputs::create_data_sections.  Add incremental symtab
5355         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5356         sections to layout after input sections.
5357         * layout.h (struct Timespec): Forward declaration.
5358         (Layout::incremental_inputs): Add const.
5359         (Layout::create_incremental_info_sections): Add parameter.
5360         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5361         * object.cc: Include incremental.h.
5362         (Relobj::finalize_incremental_relocs): New function.
5363         (Sized_relobj::do_layout): Record input sections in incremental info.
5364         * object.h (Object::output_section): New function.
5365         (Object::output_section_offset): Moved from Relobj.
5366         (Object::get_incremental_reloc_base): New function.
5367         (Object::get_incremental_reloc_count): New function.
5368         (Object::do_output_section): New function.
5369         (Object::do_output_section_offset): Moved from Relobj.
5370         (Object::do_get_incremental_reloc_base): New function.
5371         (Object::do_get_incremental_reloc_count): New function.
5372         (Object::Object): Initialize new data members.
5373         (Relobj::output_section): Renamed do_output_section and moved to
5374         protected.
5375         (Relobj::output_section_offset): Moved to Object.
5376         (Relobj::do_get_incremental_reloc_base): New function.
5377         (Relobj::do_get_incremental_reloc_count): New function.
5378         (Relobj::allocate_incremental_reloc_counts): New function.
5379         (Relobj::count_incremental_reloc): New function.
5380         (Relobj::finalize_incremental_relocs): New function.
5381         (Relobj::next_incremental_reloc_index): New function.
5382         (Relobj::reloc_counts_): New data member.
5383         (Relobj::reloc_bases_): New data member.
5384         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5385         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5386         (Sized_relobj::incremental_relocs_scan): New function.
5387         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5388         (Sized_relobj::incremental_relocs_write): New function.
5389         (Sized_relobj::incremental_relocs_write_reltype): New function.
5390         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5391         incremental link.
5392         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5393         archives and object files elsewhere.
5394         (Add_symbols::run): Report object files here.
5395         (Finish_group::run): Report end of archive at end of group.
5396         * reloc.cc: Include layout.h, incremental.h.
5397         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5398         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5399         (Sized_relobj::incremental_relocs_scan): New function.
5400         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5401         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5402         (Sized_relobj::incremental_relocs_write): New function.
5403         (Sized_relobj::incremental_relocs_write_reltype): New function.
5404         * script.cc (read_input_script): Rewrite test for incremental link.
5405         Change call to Incremental_inputs::report_script.
5406         * symtab.h (Symbol_table::first_global_index): New function.
5407         (Symbol_table::output_count): New function.
5408
5409 2010-08-12  Doug Kwan  <dougkwan@google.com>
5410
5411         * arm.cc (Target_arm::merge_object_attributes): Check command line
5412         options --no-wchar-size-warning and --no-enum-size-warning.
5413         * options.h (General_options): Add ld-compatible options
5414         --no-enum-size-warning and --no-wchar-size-warning.
5415
5416 2010-08-04  Ian Lance Taylor  <iant@google.com>
5417
5418         * x86_64.cc (Target_x86_64::Scan::local): Use
5419         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5420         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5421         (Target_x86_64::Scan::global): Likewise.
5422         (Target_x86_64::Relocate::relocate): Likewise.
5423         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5424         Likewise.
5425
5426 2010-08-03  Cary Coutant  <ccoutant@google.com>
5427
5428         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5429         to reserve space in merged_strings vector. Keep total input size
5430         for stats.
5431         (Output_merge_string::do_print_merge_stats): Print total input size.
5432         * merge.h (Output_merge_string): Add input_size_ field.
5433         * stringpool.cc (Stringpool_template::string_length): Move
5434         implementations out of Stringpool_template class and place in
5435         stringpool.h.
5436         * stringpool.h (string_length): Move out of Stringpool_template.
5437
5438 2010-08-03  Ian Lance Taylor  <iant@google.com>
5439
5440         PR 11712
5441         * layout.cc (relaxation_loop_body): If address of load segment is
5442         set, adjust address to include headers if possible.
5443
5444 2010-08-03  Ian Lance Taylor  <iant@google.com>
5445
5446         * version.cc (version_string): Bump to 1.10.
5447
5448 2010-08-03  Ian Lance Taylor  <iant@google.com>
5449
5450         PR 11805
5451         * layout.h (enum Output_section_order): Define.
5452         (class Layout): Update declarations.
5453         * layout.cc (Layout::get_output_section): Add order parameter.
5454         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5455         is_first_non_relro parameters.  Change all callers.
5456         (Layout::choose_output_section): Likewise.
5457         (Layout::add_output_section_data): Likewise.
5458         (Layout::make_output_section): Likewise.  Set order.
5459         (Layout::default_section_order): New function.
5460         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5461         * output.cc (Output_section::Output_section): Initialize order_.
5462         Don't initialize deleted fields.
5463         (Output_segment::Output_segment): Don't initialize deleted
5464         fields.
5465         (Output_segment::add_output_section_to_load): New function
5466         replacing add_output_section.  Change all callers to call this or
5467         add_output_section_to_nonload.
5468         (Output_segment::add_output_section_to_nonload): New function.
5469         (Output_segment::remove_output_section): Rewrite.
5470         (Output_segment::add_initial_output_data): Likewise.
5471         (Output_segment::has_any_data_sections): Likewise.
5472         (Output_segment::is_first_section_relro): Likewise.
5473         (Output_segment::maximum_alignment): Likewise.
5474         (Output_segment::has_dynamic_reloc): New function replacing
5475         dynamic_reloc_count.  Change all callers.
5476         (Output_segment::has_dynamic_reloc_list): New function replacing
5477         dynamic_reloc_count_list.  Change all callers.
5478         (Output_segment::set_section_addresses): Rewrite.
5479         (Output_segment::set_offset): Rewrite.
5480         (Output_segment::find_first_and_last_list): Remove.
5481         (Output_segment::set_tls_offsets): Rewrite.
5482         (Output_segment::first_section_load_address): Likewise.
5483         (Output_segment::output_section_count): Likewise.
5484         (Output_segment::section_with_lowest_load_address): Likewise.
5485         (Output_segment::write_section_headers): Likewise.
5486         (Output_segment::print_sections_to_map): Likewise.
5487         * output.h (class Output_data): Remove dynamic_reloc_count_
5488         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5489         (Output_data::add_dynamic_reloc): Rewrite.
5490         (Output_data::has_dynamic_reloc): New function.
5491         (Output_data::dynamic_reloc_count): Remove.
5492         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5493         is_last_relro_, is_first_non_relro_, is_interp_,
5494         is_dynamic_linker_section_ fields.  Add order and set_order
5495         functions.  Remove is_relro_local, set_is_relro_local,
5496         is_last_relro, set_is_last_relro, is_first_non_relro,
5497         set_is_first_non_relro functions, is_interp, set_is_interp,
5498         is_dynamic_linker_section, and set_is_dynamic_linker_section
5499         functions.
5500         (class Output_segment): Change Output_data_list from std::list to
5501         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5502         output_bss_ fields.  Update declarations.
5503
5504 2010-08-02  Ian Lance Taylor  <iant@google.com>
5505
5506         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5507         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5508         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5509
5510 2010-08-02  Ian Lance Taylor  <iant@google.com>
5511
5512         PR 11855
5513         * script.cc (Script_options::Script_options): Initialize
5514         symbol_definitions_ and symbol_references_.
5515         (Script_options::add_symbol_assignment): Update
5516         symbol_definitions_ and symbol_references_.
5517         (Script_options::add_symbol_reference): New function.
5518         (script_symbol): New function.
5519         * script.h (class Script_options): Add symbol_definitions_ and
5520         symbol_references_ fields.
5521         (Script_options::referenced_const_iterator): New type.
5522         (Script_options::referenced_begin): New function.
5523         (Script_options::referenced_end): New function.
5524         (Script_options::is_referenced): New function.
5525         (Script_options::any_unreferenced): New function.
5526         * script-c.h (script_symbol): Declare.
5527         * yyscript.y (exp): Call script_symbol.
5528         * symtab.cc: Include "script.h".
5529         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5530         Change all callers.  Check symbols referenced by scripts.
5531         (Symbol_table::add_undefined_symbols_from_command_line): Add
5532         layout parameter.  Change all callers.
5533         (Symbol_table::do_add_undefined_symbols_from_command_line):
5534         Likewise.  Break out loop body.  Check symbols referenced by
5535         scripts.
5536         (Symbol_table::add_undefined_symbol_from_command_line): New
5537         function broken out of
5538         do_add_undefined_symbols_from_command_line.
5539         * symtab.h (class Symbol_table): Update declarations.
5540         * archive.cc: Include "layout.h".
5541         (Archive::should_include_member): Add layout parameter.  Change
5542         all callers.  Check for symbol mentioned in expression.
5543         * archive.h (class Archive): Update declaration.
5544         * object.cc (Sized_relobj::do_should_include_member): Add layout
5545         parameter.
5546         * object.h (Object::should_include_member): Add layout parameter.
5547         Change all callers.
5548         (Object::do_should_include_member): Add layout parameter.
5549         (class Sized_relobj): Update declaration.
5550         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5551         parameter.
5552         * dynobj.h (class Sized_dynobj): Update declaration.
5553         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5554         layout parameter.
5555         * plugin.h (class Sized_pluginobj): Update declaration.
5556
5557 2010-08-02  Ian Lance Taylor  <iant@google.com>
5558
5559         PR 11866
5560         * output.cc (Output_segment::set_offset): Search for the first and
5561         last sections rather than assuming that the list is in order.
5562         (Output_segment::find_first_and_last_list): New function.
5563         * output.h (class Output_segment): Update declarations.
5564         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5565         (relro_strip_test_SOURCES): New variable.
5566         (relro_strip_test_DEPENDENCIES): New variable.
5567         (relro_strip_test_LDFLAGS): New variable.
5568         (relro_strip_test_LDADD): New variable.
5569         (relro_strip_test.so): New target.
5570
5571 2010-08-02  Ian Lance Taylor  <iant@google.com>
5572
5573         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5574         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5575         (Target_i386::got_tlsdesc_section): New function.
5576         (Target_i386::got_section): Create space for GOT entries for
5577         TLSDESC relocations.
5578         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5579         R_386_TLS_GOTDESC.
5580         (Target_i386::Scan::global): Likewise.
5581         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5582         using TLSDESC GOT.
5583         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5584         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5585         (Target_x86_64::got_tlsdesc_section): New function.
5586         (Target_x86_64::got_section): Create space for GOT entries for
5587         TLSDESC relocations.
5588         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5589         R_386_TLS_GOTDESC.
5590         (Target_x86_64::Scan::global): Likewise.
5591         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5592         using TLSDESC GOT.
5593
5594 2010-08-02  Ian Lance Taylor  <iant@google.com>
5595
5596         * testsuite/final_layout.sh: Use dc to convert from hex to
5597         decimal.
5598
5599 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5600
5601         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5602         paramter to the call to gold::gc_process_relocs.
5603         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5604         paramter to the call to gold::gc_process_relocs.
5605         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5606         parameter to the call to gold::gc_process_relocs.
5607         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5608         template parameter to the call to gold::gc_process_relocs.
5609         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5610         paramter to the call to gold::gc_process_relocs.
5611         * gc.h (get_embedded_addend_size): New function.
5612         (gc_process_relocs): Save the size of the reloc for use by ICF.
5613         * icf.cc (get_section_contents): Get the addend from the text section
5614         for SHT_REL relocation sections.
5615         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5616         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5617         * int_encoding.h (read_from_pointer): New overloaded function.
5618         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5619         * testsuite/icf_sht_rel_addend_test.sh: New file.
5620         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5621         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5622
5623 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5624
5625         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5626         * Makefile.in: Regenerate.
5627         * testsuite/Makefile.in: Regenerate.
5628
5629 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5630
5631         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5632         * gold/testsuite/debug_msg.cc: Likewise.
5633         * gold/testsuite/odr_violation1.cc
5634         * gold/testsuite/odr_violation2.cc
5635
5636 2010-07-21  Cary Coutant  <ccoutant@google.com>
5637
5638         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5639         string, and length fields.
5640         (Output_merge_string::Merged_strings_list): New type.
5641         (Output_merge_string::Merged_strings_lists): New typedef.
5642         (Output_merge_string): Replace merged_strings_ with
5643         merged_strings_lists_.
5644         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5645         Merged_strings_list per input object and section.  Don't store pointer
5646         to the string.  Don't store length with each merged string entry.
5647         (Output_merge_string::finalize_merged_data): Loop over list of merged
5648         strings lists.  Recompute length of each merged string.
5649
5650 2010-07-15  Cary Coutant  <ccoutant@google.com>
5651
5652         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5653         here.
5654
5655 2010-07-14  Ian Lance Taylor  <iant@google.com>
5656
5657         * descriptors.cc (Descriptors::open): Report correct name in error
5658         message.
5659
5660 2010-07-13  Doug Kwan  <dougkwan@google.com>
5661
5662         * arm.cc (Arm_input_section::Arm_input_section): For a
5663         SHT_ARM_EXIDX section, always keeps the input sections.
5664         (Arm_input_section::set_exidx_section_link): New method.
5665         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5666         has_errors_ to false.
5667         (Arm_exidx_input_section::has_errors,
5668         Arm_exidx_input_section::set_has_errors): New methods.
5669         (Arm_exidx_input_section::has_errors_): New data member.
5670         (Arm_relobj::get_exidx_shndx_list): New method.
5671         (Arm_output_section::append_text_sections_to_list): Do not skip
5672         section without SHF_EXECINSTR.
5673         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5674         errors.
5675         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5676         section header.  Make error messages more verbose.  Check for
5677         a non-executable section linked to an EXIDX section.
5678         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5679         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5680         check that there is no deferred EXIDX section if we exit early.
5681         Instead of not making an EXIDX section in case of an error, make one
5682         and set the has_errors flag of it.
5683         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5684         in a relocatable link.
5685         (Target_arm::do_relax): Look for the EXIDX output section instead of
5686         assuming that it is called .ARM.exidx.
5687         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5688         section list.  Do not check for SHF_EXECINSTR section flags but
5689         skip any input section with errors.
5690         * output.cc (Output_section::Output_section): Initialize
5691         always_keeps_input_sections_ to false.
5692         (Output_section::add_input_section): Check for
5693         always_keeps_input_sections_.
5694         *  output.h (Output_section::always_keeps_input_sections,
5695         Output_section::set_always_keeps_input_sections): New methods.
5696         (Output_section::always_keeps_input_sections): New data member.
5697
5698 2010-07-13  Rafael Espindola  <espindola@google.com>
5699
5700         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5701         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5702
5703 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5704             Ian Lance Taylor  <iant@google.com>
5705
5706         * output.h (Output_section_lookup_maps::add_merge_section):
5707         Correct check of whether value was inserted.
5708         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5709         (Output_section_lookup_maps::add_relaxed_input_section):
5710         Likewise.
5711         * arm.cc (Target_arm::got_section): Remove used local os.
5712         * i386.cc (Target_i386::got_section): Likewise.
5713         * x86_64.cc (Target_x86_64::got_section): Likewise.
5714         * sparc.cc (Target_sparc::got_section): Likewise.
5715         (Target_sparc::relocate): Remove unused local have_got_offset.
5716         * powerpc.cc (Target_powerpc::relocate): Likewise.
5717
5718 2010-07-13  Ian Lance Taylor  <iant@google.com>
5719
5720         * compressed_output.cc (zlib_decompress): Fix signature in
5721         !HAVE_ZLIB_H case.
5722
5723         * archive.cc (Archive::include_member): Unlock an external member
5724         of a thin archive.  Don't bother to delete an object we know is
5725         NULL.
5726
5727 2010-07-12  Cary Coutant  <ccoutant@google.com>
5728
5729         * compressed_output.cc (zlib_decompress): New function.
5730         (get_uncompressed_size): New function.
5731         (decompress_input_section): New function.
5732         * compressed_output.h (get_uncompressed_size): New function.
5733         (decompress_input_section): New function.
5734         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5735         Handle compressed debug sections.
5736         * layout.cc (is_compressed_debug_section): New function.
5737         (Layout::output_section_name): Map compressed section names to
5738         canonical names.
5739         * layout.h (is_compressed_debug_section): New function.
5740         (is_debug_info_section): Recognize compressed debug sections.
5741         * merge.cc: Include compressed_output.h.
5742         (Output_merge_data::do_add_input_section): Handle compressed
5743         debug sections.
5744         (Output_merge_string::do_add_input_section): Handle compressed
5745         debug sections.
5746         * object.cc: Include compressed_output.h.
5747         (Sized_relobj::Sized_relobj): Initialize new data members.
5748         (build_compressed_section_map): New function.
5749         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5750         * object.h (Object::section_is_compressed): New method.
5751         (Object::do_section_is_compressed): New method.
5752         (Sized_relobj::Compressed_section_map): New type.
5753         (Sized_relobj::do_section_is_compressed): New method.
5754         (Sized_relobj::compressed_sections_): New data member.
5755         * output.cc (Output_section::add_input_section): Handle compressed
5756         debug sections.
5757         * reloc.cc: Include compressed_output.h.
5758         (Sized_relobj::write_sections): Handle compressed debug sections.
5759
5760 2010-07-08  Cary Coutant  <ccoutant@google.com>
5761
5762         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5763         weak when resolving to a dynamic def.
5764         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5765         for weak undef/dynamic def cases. Adjust callers.
5766         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5767         undef_binding_weak_.
5768         (Symbol_table::sized_write_globals): Adjust symbol binding.
5769         (Symbol_table::sized_write_symbol): Add binding parameter.
5770         * symtab.h (Symbol::set_undef_binding): New method.
5771         (Symbol::is_undef_binding_weak): New method.
5772         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5773         (Symbol_table::should_override): Add new parameter.
5774         (Symbol_table::sized_write_symbol): Add new parameter.
5775
5776         * testsuite/weak_undef_file1.cc: Add new test case.
5777         * testsuite/weak_undef_file2.cc: Fix header comment.
5778         * testsuite/weak_undef_test.cc: Add new test case.
5779
5780 2010-06-29  Doug Kwan  <dougkwan@google.com>
5781
5782         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5783         Initialize USE_SYMBOL_.
5784         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5785         definition.
5786         (Arm_reloc_property::uses_symbol_): New data member declaration.
5787         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5788         uses symbol value and symbol is undefined but not weakly undefined.
5789
5790 2010-06-28  Rafael Espindola  <espindola@google.com>
5791
5792         * plugin.cc (Plugin::load): Use dlerror.
5793
5794 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5795
5796         * symtab.cc (detect_odr_violations): When reporting an ODR
5797         violation, report an object where the symbol is defined.
5798
5799 2010-06-25  Doug Kwan  <dougkwan@google.com>
5800
5801         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5802         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5803         definition.
5804         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5805         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5806         target hook to detect function points.
5807         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5808         * icf.h (Icf::check_section_for_function_pointers): Change type of
5809         parameter SECTION_NAME to const reference to std::string.  Use
5810         target hook to determine if section may have unsafe pointers.
5811         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5812         method definition.
5813
5814 2010-06-21  Rafael Espindola  <espindola@google.com>
5815
5816         * fileread.cc (Input_file::find_fie): New
5817         (Input_file::open): Use Input_file::find_fie.
5818         * fileread.h (Input_file::find_fie): New
5819         * plugin.cc (set_extra_library_path): New.
5820         (Plugin::load): Add set_extra_library_path to the transfer vector.
5821         (Plugin_manager::set_extra_library_path): New.
5822         (Plugin_manager::add_input_file): Use the extra search path if set.
5823         (set_extra_library_path(): New.
5824         * plugin.h (Plugin_manager): Add set_extra_library_path and
5825         extra_search_path_.
5826
5827 2010-06-19  Cary Coutant  <ccoutant@google.com>
5828
5829         * layout.cc (gdb_sections): Add .debug_types.
5830         (lines_only_debug_sections): Likewise.
5831
5832 2010-06-18  Rafael Espindola  <espindola@google.com>
5833
5834         * plugin.cc (add_input_file,add_input_library)
5835         (Plugin_manager::add_input_file): Make filename arguments const.
5836         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5837         const.
5838
5839 2010-06-16  Doug Kwan  <dougkwan@google.com>
5840
5841         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5842         .ARM.attributes section if we have not merged any input
5843         attributes sections.
5844
5845 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5846
5847         * arm.cc: Allow combining objects with no EABI version
5848         information.
5849
5850 2010-06-15  Rafael Espindola  <espindola@google.com>
5851
5852         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5853
5854 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5855
5856         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5857         (struct iovec): Correct !HAVE_READV definition.
5858
5859 2010-06-10  Cary Coutant  <ccoutant@google.com>
5860
5861         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5862         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5863         reloc sections.
5864         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5865
5866         PR 11683
5867         * symtab.h (Symbol::is_placeholder): New member function.
5868         * target-reloc.h (relocate_section): Check for placeholder symbols.
5869
5870         * testsuite/Makefile.am (plugin_test_8): New test.
5871         (plugin_test_9): New test.
5872         * testsuite/Makefile.in: Regenerate.
5873
5874 2010-06-09  Nick Clifton  <nickc@redhat.com>
5875
5876         * yyscript.y (input_list_element): Allow strings prefixed with
5877         the '-' character.  Treat these as libraries.
5878         * script.cc (script_add_library): New function.  Adds a library
5879         specified by "-l<name>" found in an input script.
5880         * script-c.h: Add prototype for script_add_library.
5881
5882 2010-06-07  Doug Kwan  <dougkwan@google.com>
5883
5884         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5885         Restrict stub-group size to be within long conditional branch
5886         range when working around cortex-A8 erratum.
5887
5888 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5889
5890         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5891         #ifdef typo.
5892
5893 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5894
5895         PR gold/11658
5896         * output.cc
5897         (Output_section::Input_section_sort_entry::compare_section_ordering):
5898         Change to return non-zero correctly.
5899         (Output_section::Input_section_sort_section_order_index_compare
5900         ::operator()): Change to fix ambiguity in comparisons.
5901
5902 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5903
5904         * gold.h (is_wildcard_string): New function.
5905         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5906         (Layout::layout_eh_frame): Ditto.
5907         (Layout::find_section_order_index): New method.
5908         (Layout::read_layout_from_file): New method.
5909         * layout.h (Layout::find_section_order_index): New method.
5910         (Layout::read_layout_from_file): New method.
5911         (Layout::input_section_position_): New private member.
5912         (Layout::input_section_glob_): New private member.
5913         * main.cc (main): Call read_layout_from_file here.
5914         * options.h (--section-ordering-file): New option.
5915         * output.cc (Output_section::input_section_order_specified_): New
5916         member.
5917         (Output_section::Output_section): Initialize new member.
5918         (Output_section::add_input_section): Add new parameter.
5919         Keep input sections when --section-ordering-file is used.
5920         (Output_section::set_final_data_size): Sort input sections when
5921         section ordering file is specified.
5922         (Output_section::Input_section_sort_entry): Add new parameter.
5923         Check sorting type.
5924         (Output_section::Input_section_sort_entry::compare_section_ordering):
5925         New method.
5926         (Output_section::Input_section_sort_compare::operator()): Change to
5927         consider section_order_index.
5928         (Output_section::Input_section_sort_init_fini_compare::operator()):
5929         Change to consider section_order_index.
5930         (Output_section::Input_section_sort_section_order_index_compare
5931         ::operator()): New method.
5932         (Output_section::sort_attached_input_sections): Change to sort
5933         according to section order when specified.
5934         (Output_section::add_input_section<32, true>): Add new parameter.
5935         (Output_section::add_input_section<64, true>): Add new parameter.
5936         (Output_section::add_input_section<32, false>): Add new parameter.
5937         (Output_section::add_input_section<64, false>): Add new parameter.
5938         * output.h (Output_section::add_input_section): Add new parameter.
5939         (Output_section::input_section_order_specified): New
5940         method.
5941         (Output_section::set_input_section_order_specified): New method.
5942         (Input_section::Input_section): Initialize section_order_index_.
5943         (Input_section::section_order_index): New method.
5944         (Input_section::set_section_order_index): New method.
5945         (Input_section::section_order_index_): New member.
5946         (Input_section::Input_section_sort_section_order_index_compare): New
5947         struct.
5948         (Output_section::input_section_order_specified_): New member.
5949         * script-sections.cc (is_wildcard_string): Delete and move modified
5950         method to gold.h.
5951         (Output_section_element_input::Output_section_element_input): Modify
5952         call to is_wildcard_string.
5953         (Output_section_element_input::Input_section_pattern
5954         ::Input_section_pattern): Ditto.
5955         (Output_section_element_input::Output_section_element_input): Ditto.
5956         * testsuite/Makefile.am (final_layout): New test case.
5957         * testsuite/Makefile.in: Regenerate.
5958         * testsuite/final_layout.cc: New file.
5959         * testsuite/final_layout.sh: New file.
5960
5961 2010-06-01  Rafael Espindola  <espindola@google.com>
5962
5963         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5964
5965 2010-06-01  Rafael Espindola  <espindola@google.com>
5966
5967         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5968         visibility of symbols.
5969
5970 2010-05-27  Doug Kwan  <dougkwan@google.com>
5971
5972         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5973         from start of output section instead of address for a local symbol
5974         in a merged or relaxed section when doing a relocatable link.
5975
5976 2010-05-26  Rafael Espindola  <espindola@google.com>
5977
5978         PR 11604
5979         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5980         adding sections the garbage collector removed.
5981         * gold/testsuite/Makefile.am: Add test.
5982         * gold/testsuite/Makefile.in: Regenerate.
5983         * gold/testsuite/plugin_test_7.sh: New.
5984         * gold/testsuite/plugin_test_7_1.c: New.
5985         * gold/testsuite/plugin_test_7_2.c: New.
5986
5987 2010-05-26  Rafael Espindola  <espindola@google.com>
5988
5989         * script-sections.cc (Output_section_definition::set_section_addresses):
5990         Check for --section-start.
5991
5992 2010-05-26  Doug Kwan  <dougkwan@google.com>
5993
5994         * arm.cc (Arm_scan_relocatable_relocs): New class.
5995         (Target_arm::relocate_special_relocatable): New method.
5996         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5997         (Arm_relocate_functions::thumb_branch_common): Same.
5998         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5999         instead of Default_scan_relocatable_relocs.
6000         * target-reloc.h (relocate_for_relocatable): Let target handle
6001         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6002         * target.h (Sized_target::relocate_special_relocatable): New method.
6003
6004 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6005
6006         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6007
6008 2010-05-23  Doug Kwan  <dougkwan@google.com>
6009
6010         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6011         instead of a cast.
6012         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6013         with a direct branch, not a conditional branch, to a stub.
6014         * merge.cc (Output_merge_base::record_input_section): New method
6015         defintion.
6016         (Output_merge_data::do_add_input_section): Record input section if
6017         keeps-input-sections flag is set.
6018         (Output_merge_string::do_add_input_section): Ditto.
6019         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6020         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6021         INPUT_SECTIONS_.
6022         (Output_merge_base::keeps_input_sections,
6023         Output_merge_base::set_keeps_input_sections,
6024         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6025         method definitions.
6026         (Output_merge_base::Input_sections): New type declaration.
6027         (Output_merge_base::input_sections_begin,
6028         Output_merge_base::input_sections_end,
6029         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6030         (Output_merge_base::bool keeps_input_sections_,
6031         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6032         Output_merge_base::input_sections_): New data members.
6033         (Output_merge_data::do_set_keeps_input_sections): New method
6034         defintion.
6035         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6036         * output.cc (Output_section::Input_section::relobj): Move method
6037         defintion from class declaration to here and handle merge sections.
6038         (Output_section::Input_section::shndx): Ditto.
6039         (Output_section::Output_section): Remove initializations of removed
6040         data members and initialize new data member LOOKUP_MAPS_.
6041         (Output_section::add_input_section): Set keeps-input-sections flag
6042         for a newly created merge output section as appropriate.  Adjust code
6043         to use Output_section_lookup_maps class.
6044         (Output_section::add_relaxed_input_section): Adjst code for lookup
6045         maps code refactoring.
6046         (Output_section::add_merge_input_section): Add a new parameter
6047         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6048         class.  If adding input section to a newly created merge output
6049         section fails, remove the new merge section.
6050         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6051         Adjust code for use of the Output_section_lookup_maps class.
6052         (Output_section::find_merge_section): Ditto.
6053         (Output_section::build_lookup_maps): New method defintion.
6054         (Output_section::find_relaxed_input_section): Adjust code to use
6055         Output_section_lookup_maps class.
6056         (Output_section::get_input_sections): Export merge sections.  Adjust
6057         code to use Output_section_lookup_maps class.
6058         (Output_section:::add_script_input_section): Adjust code to use
6059         Output_section_lookup_maps class.  Update lookup maps for merge
6060         sections also.
6061         (Output_section::discard_states): Use Output_section_lookup_maps.
6062         (Output_section::restore_states): Same.
6063         * output.h (Merge_section_properties): Move class defintion out of
6064         Output_section.
6065         (Output_section_lookup_maps): New class.
6066         (Output_section::Input_section::is_merge_section): New method
6067         defintion.
6068         (Output_section::Input_section::relobj): Move defintion out of class
6069         defintion.  Declare method only.
6070         (Output_section::Input_section::shndx): Ditto.
6071         (Output_section::Input_section::output_merge_base): New method defintion.
6072         (Output_section::Input_section::u2_.pomb): New union field.
6073         (Output_section::Merge_section_by_properties_map,
6074         Output_section::Output_section_data_by_input_section_map,
6075         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6076         Remove types.
6077         (Output_section::add_merge_input_section): Add new parameter
6078         KEEPS_INPUT_SECTIONS.
6079         (Output_section::build_lookup_maps): New method declaration.
6080         (Output_section::merge_section_map_,
6081         Output_section::merge_section_by_properties_map_,
6082         Output_section::relaxed_input_section_map_,
6083         Output_section::is_relaxed_input_section_map_valid_): Remove data
6084         members.
6085         (Output_section::lookup_maps_): New data member.
6086
6087 2010-05-21  Doug Kwan  <dougkwan@google.com>
6088
6089         PR gold/11619
6090         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6091         avoid a compilation error.
6092
6093 2010-05-19  Rafael Espindola  <espindola@google.com>
6094
6095         * script-sections.cc (Output_section_definition::allocate_to_segment):
6096         Update the phdrs_list even when the output section is NULL.
6097         * testsuite/Makefile.am: Add test.
6098         * testsuite/Makefile.in: Regenerate.
6099         * testsuite/script_test_9.cc: New.
6100         * testsuite/script_test_9.sh: New.
6101         * testsuite/script_test_9.t: New.
6102
6103 2010-05-19  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Arm_input_section::original_size): New method.
6106         (Arm_input_section::do_addralign): Add a cast.
6107         (Arm_input_section::do_output_offset): Remove static cast.
6108         (Arm_input_section::original_addralign,
6109          Arm_input_section::original_size_): Change type to uint32_t.
6110         (Arm_input_section::init): Add safe casts for section alignment
6111         and size.
6112         (Arm_input_section::set_final_data_size): Do not set address and
6113         offset of stub table.
6114         (Arm_output_section::fix_exidx_coverage): Change use of of
6115         Output_section::Simple_input_section to that of
6116         Output_section::Input_section.
6117         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6118         except for the first pass.
6119         * output.cc (Output_section::get_input_sections): Change type of
6120         input_sections to std::list<Input_section>.
6121         (Output_section::add_script_input_section): Rename from
6122         Output_section::add_simple_input_section.  Change type of SIS
6123         parameter from Simple_input_section to Input_section.
6124         * output.h (Output_section::Simple_input_section): Remove class.
6125         (Output_section::Input_section): Change class visibility to public.
6126         (Output_section::Input_section::addralign): Use stored alignments
6127         for special input sections if set.
6128         (Output_section::Input_section::set_addralign): New method.
6129         (Output_section::get_input_sections): Change parameter type from
6130         list of Simple_input_section to list of Input_section.
6131         (Output_section::add_script_input_section): Rename from
6132         Output_section::add_simple_input_section. Change first parameter's
6133         type from Simple_input_section to Input_section and remove the
6134         second and third parameters.
6135         * script-sections.cc (Input_section::Input_section_list): Change
6136         type to list of Output_section::Input_section/
6137         (Input_section_info::Input_section_info): Change parameter type of
6138         INPUT_SECTION to Output_section::Input_section.
6139         (Input_section_info::input_section): Change return type.
6140         (Input_section_info::input_section_): Change type to
6141         Output_section::Input_section.
6142         (Output_section_element_input::set_section_addresses): Adjust code
6143         to use Output_section::Input_section instead of
6144         Output_section::Simple_input_section.  Adjust code for renaming
6145         of Output_section::add_simple_input_section.
6146         (Orphan_output_section::set_section_addresses): Ditto.
6147
6148 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6149
6150         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6151         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6152
6153 2010-05-18  Rafael Espindola  <espindola@google.com>
6154
6155         * options.cc (General_options::finalize): Handle -nostdlib.
6156         * options.h (nostdlib): New option.
6157         * script.cc (script_add_search_dir): Handle -nostdlib.
6158
6159 2010-05-12  Doug Kwan  <dougkwan@google.com>
6160
6161         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6162         attributes section only if there no attributes section after merging.
6163         (Target_arm::merge_object_attributes): Move value of
6164         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6165         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6166         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6167         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6168         and arm_attr_merge_7.stdout.
6169         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6170         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6171         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6172         arm_attr_merge_7b.o): New rules.
6173         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6174         arm_attr_merge_7
6175         * testsuite/Makefile.in: Regenerate.
6176         * testsuite/arm_attr_merge.sh: New file.
6177         * testsuite/arm_attr_merge_[67][ab].s: Same.
6178
6179 2010-05-05  Nick Clifton  <nickc@redhat.com>
6180
6181         * po/es.po: Updated Spanish translation.
6182
6183 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6184
6185         * Makefile.am (install-exec-local): Properly install gold as
6186         default cross linker.
6187         * Makefile.in: Regenerated.
6188
6189 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6190             Nick Clifton  <nickc@redhat.com>
6191
6192         * configure.ac (install_as_default): Define and set to false
6193         unless --enable-gold or --enable-gold=both/gold has been
6194         specified.
6195         * configure: Regenerate.
6196
6197         * Makefile.am (install-exec-local): Install the executable as
6198         'ld.gold'.  If install_as_default is true then also install it as
6199         'ld'.
6200         * Makefile.in: Regenerated.
6201
6202 2010-04-24  Ian Lance Taylor  <iant@google.com>
6203
6204         * layout.cc (Layout::layout_reloc): In relocatable link don't
6205         combine reloc sections for grouped sections.
6206
6207 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6208
6209         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6210         sections that are not ordinary to icf.
6211         * icf.cc (get_section_contents): Handle relocation pointing to section
6212         with no object or shndx information.
6213         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6214         * testsuite/Makefile.in: Regenerate.
6215         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6216         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6217
6218 2010-04-22  Ian Lance Taylor  <iant@google.com>
6219
6220         * expression.cc (Expression::Expression_eval_info): Add
6221         result_alignment_pointer field.
6222         (Expression::eval_with_dot): Add result_alignment_pointer
6223         parameter.  Change all callers.
6224         (Expression::eval_maybe_dot): Likewise.
6225         (class Binary_expression): Add alignment_pointer parameter to
6226         left_value and right_value.  Change all callers.
6227         (BINARY_EXPRESSION): Set result alignment.
6228         (class Trinary_expression): Add alignment_pointer parameter to
6229         arg2_value and arg3_value.  Change all callers.
6230         (Trinary_cond::value): Set result alignment.
6231         (Max_expression::value, Min_expression::value): Likewise.
6232         (Align_expression::value): Likewise.
6233         * script-sections.cc (class Sections_element): Add dot_alignment
6234         parameter to set_section_addresses virtual function.  Update
6235         instantiations.
6236         (class Output_section_element): Likewise.
6237         (Script_sections::create_segments): Add dot_alignment parameter.
6238         Change all callers.
6239         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6240         (Script_sections::set_phdrs_clause_addresses): Likewise.
6241         * script-sections.h: Update declarations.
6242         * script.h: Update declarations.
6243         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6244         min_p_align.
6245         * testsuite/script_test_3.t: Set large alignment.
6246         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6247         segment has expected alignment.
6248
6249 2010-04-22  Nick Clifton  <nickc@redhat.com>
6250
6251         * po/gold.pot: Updated by the Translation project.
6252         * po/vi.po: Updated Vietnamese translation.
6253
6254 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6255
6256         * testsuite/Makefile.am (check_PROGRAMS): Add
6257         icf_virtual_function_folding_test.
6258         * testsuite/Makefile.in: Regenerated.
6259
6260 2010-04-15  Andrew Haley  <aph@redhat.com>
6261
6262         * options.h (merge_exidx_entries): New option.
6263         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6264         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6265         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6266         (Target_arm::merge_exidx_entries): New function.
6267         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6268         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6269         to Arm_exidx_fixup constructor.
6270         Add new arg, merge_exidx_entries.
6271         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6272         Arm_output_section::fix_exidx_coverage.
6273
6274 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6275
6276         * icf.cc (get_section_contents): Check for preemptible functions.
6277         Ignore addend when appropriate.
6278         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6279         section folded.
6280         (add_from_relobj): Check for section folded.
6281         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6282         * symtab.h (should_add_dynsym_entry): Add new parameter.
6283         * target-reloc.h (scan_relocs): Check for section folded.
6284         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6285         Check reloc types for function pointers in shared objects.
6286         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6287         case.
6288         (icf_preemptible_functions_test): New test case.
6289         (icf_string_merge_test): New test case.
6290         * testsuite.Makefile.in: Regenerate.
6291         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6292         bar_glob.  Refactor code.
6293         * testsuite/icf_preemptible_functions_test.cc: New file.
6294         * testsuite/icf_preemptible_functions_test.sh: New file.
6295         * testsuite/icf_string_merge_test.cc: New file.
6296         * testsuite/icf_string_merge_test.sh: New file.
6297         * testsuite/icf_virtual_function_folding_test.cc: New file.
6298         * testsuite/icf_virtual_function_folding_test.sh: New file.
6299
6300 2010-04-14  Doug Kwan  <dougkwan@google.com>
6301
6302         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6303         for local symbol recounting if we remove a section due to ICF.
6304         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6305         there are no regular objects in input.
6306
6307 2010-04-13  Doug Kwan  <dougkwan@google.com>
6308
6309         * arm.cc (Arm_input_section::set_final_data_size): Compute
6310         accurate final data size instead of using current data size.
6311
6312 2010-04-09  Doug Kwan  <dougkwan@google.com>
6313
6314         * layout.cc (Layout::choose_output_section): Handle script section
6315         types.
6316         (Layout::make_output_section_for_script): Add section type parameter.
6317         Handle script section types.
6318         * layout.h (Layout::make_output_section_for_script): Add section
6319         type parameter.
6320         * output.cc (Output_section::Output_section): Initialize data member
6321         is_noload_.
6322         (Output_section::do_reset_address_and_file_offset): Do not set address
6323         to 0 if section is a NOLOAD section.
6324         * output.h (Output_section::is_noload): New method.
6325         (Output_section::set_is_noload): Ditto.
6326         (Output_section::is_noload_): New data member.
6327         * script-c.h (Script_section_type): New enum type.
6328         (struct Parser_output_section_header): Add new file section_type.
6329         * script-sections.cc (Sections_element::output_section_name): Add
6330         parameter for returning script section type.
6331         (Output_section_definition::output_section_name): Ditto.
6332         (Output_section_definition::section_type)P; New method.
6333         (Output_section_definiton::script_section_type_name): Ditto.
6334         (Output_section_definition::script_section_type_): New data member.
6335         (Output_section_definition::Output_section_definition): Initialize
6336         data member Output_section_definition::script_section_type_.
6337         (Output_section_definition::create_sections): Pass script section type
6338         to Layout::make_output_section_for_script.
6339         (Output_section_definition::output_section_name): Return script
6340         section type to caller.
6341         (Output_section_definition::set_section_address): Do not advance
6342         dot value and load address if section type is NOLOAD.  Set address
6343         of NOLOAD sections regardless of section flags.
6344         (Output_section_definition::print): Print section type if it is
6345         not SCRIPT_SECTION_TYPE_NONE.
6346         (Output_section_definition::section_type): New method.
6347         (Output_section_definition::script_section_type_name): Ditto.
6348         (Script_sections::output_section_name): Add new parameter
6349         PSECTION_TYPE for returning script section type.  Pass it to
6350         section elements.  Handle discard sections.
6351         (Sort_output_sections::operator()): Handle NOLOAD sections.
6352         * script-sections.h (Script_sections::Section_type): New enum type.
6353         (Script_sections::output_section_name): Add a new parameter for
6354         returning script section type.
6355         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6356         INFO and NOLOAD.
6357         * yyscript.y (union): Add new field SECTION_TYPE.
6358         (COPY, DSECT, INFO, NOLOAD): New tokens.
6359         (opt_address_and_section_type): Change type to output_section_header.
6360         (section_type): New non-terminal
6361         (section_header): Handle section type.
6362         (opt_address_and_section_type): Return section type value.
6363
6364 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6365
6366         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6367         * testsuite/plugin_common_test_2.c (foo): Likewise.
6368
6369 2010-04-08  Doug Kwan  <dougkwan@google.com>
6370
6371         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6372         Output_merge_data.
6373         * output.cc (Output_section::add_merge_input_section): Simplify
6374         code and return status of Output_merge_base::add_input_section.
6375         Update merge section map only if Output_merge_base::add_input_section
6376         returns true.
6377
6378 2010-04-07  Doug Kwan  <dougkwan@google.com>
6379
6380         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6381         if section is marked as containing instructions but has no mapping
6382         symbols.
6383         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6384         correct section index.
6385         (Arm_relobj::find_linked_text_section): Ditto.
6386
6387 2010-04-07  Cary Coutant  <ccoutant@google.com>
6388
6389         * archive.cc (include_member): Destroy Read_symbols_data object before
6390         releasing file.
6391         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6392         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6393         (Read_symbols_data::~Read_symbols_data) New destructor.
6394         (Section_relocs::Section_relocs) New constructor.
6395         (Section_relocs::~Section_relocs) New destructor.
6396         (Read_relocs_data::Read_relocs_data) New constructor.
6397         (Read_relocs_data::~Read_relocs_data) New destructor.
6398         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6399         pointers to NULL after deleting.
6400
6401 2010-04-07  Doug Kwan  <dougkwan@google.com>
6402
6403         * arm.cc: Replace "endianity" with "endianness" in comments.
6404         (Arm_exidx_cantunwind): Ditto.
6405         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6406         (Arm_relobj::merge_flags_and_attributes): New method.
6407         (Arm_relobj::merge_flags_and_attributes_): New data member.
6408         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6409         (Arm_relobj::scan_sections_for_stubs): Ditto.
6410         (Arm_relobj::do_read_symbols): Check to see if we really want to
6411         merge processor-specific flags and attributes.  Exit early if
6412         an object is empty except for section names and the undefined symbol.
6413         (Target_arm::do_finalize_sections): Move check for ELF format to
6414         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6415         attributes from a regular object only when we have determined that
6416         it is aapropriate.  Do not create an .ARM.attributes section in
6417         output if there is no regular input object.
6418         (Target_arm::merge_processor_specific_flags): Check
6419         --warn-mismatch before printing any error.
6420         (Target_arm::merge_object_attributes): Ditto.
6421         * gold.cc (queue_middle_tasks): Handle the case in which there is
6422         no regular object in input.
6423         * options.cc (General_options::parse_EB): New method.
6424         (General_options::parse_EL): Same.
6425         (General_options::General_options): Initialize endianness_.
6426         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6427         New options.
6428         (General_options::Endianness): New enum.
6429         (General_options::endianness): New method.
6430         (General_options::endianness_): New data member.
6431         * parameters.cc (Parameters::set_options): Check target endianness.
6432         (Parameters::set_target_once): Ditto.
6433         (Parameters::check_target_endianness): New method.
6434         (parameters_force_valid_target): If either -EL or -EB is specified,
6435         use it to define endianness of default target.
6436         * parameters.h (Parameters::check_target_endianness): New method
6437         declaration.
6438         * target.h (class Target): Change "endianity" to "endianness"
6439         in comments.
6440
6441 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6442
6443         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6444         * configure: Regenerate.
6445         * Makefile.in: Regenerate.
6446         * testsuite/Makefile.in: Regenerate.
6447
6448 2010-04-06  Cary Coutant  <ccoutant@google.com>
6449
6450         gcc PR lto/42757
6451         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6452         prevailing definitions of common symbols.
6453         * testsuite/plugin_test_6.sh: New test case.
6454         * testsuite/plugin_common_test_1.c: New test case.
6455         * testsuite/plugin_common_test_2.c: New test case.
6456         * testsuite/Makefile.am (plugin_test_6): New test case.
6457         * testsuite/Makefile.in: Regenerate.
6458
6459 2010-04-06  Nick Clifton  <nickc@redhat.com>
6460
6461         * po/vi.po: New Vietnamese translation.
6462
6463 2010-03-30  Doug Kwan  <dougkwan@google.com>
6464
6465         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6466
6467 2010-03-25  Doug Kwan  <dougkwan@google.com>
6468
6469         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6470         to avoid a conversion warning on a 32-bit host.
6471
6472 2010-03-24  Ian Lance Taylor  <iant@google.com>
6473
6474         * testsuite/script_test_3.t: Add a TLS segment.
6475         * testsuite/Makefile.am (check_PROGRAMS): Add
6476         tls_phdrs_script_test.
6477         (tls_phdrs_script_test_SOURCES): Define.
6478         (tls_phdrs_script_test_DEPENDENCIES): Define.
6479         (tls_phdrs_script_test_LDFLAGS): Define.
6480         (tls_phdrs_script_test_LDADD): Define.
6481         * testsuite/Makefile.in: Rebuild.
6482
6483 2010-03-23  Cary Coutant  <ccoutant@google.com>
6484
6485         * fileread.cc (find_or_make_view): Fix comment.
6486
6487 2010-03-23  Ian Lance Taylor  <iant@google.com>
6488
6489         * script-sections.cc (class Orphan_section_placement): Define
6490         PLACE_TLS and PLACE_TLS_BSS.
6491         (Orphan_section_placement::Orphan_section_placement): Initialize
6492         new places.
6493         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6494         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6495         (tls_script_test_SOURCES): Define.
6496         (tls_script_test_DEPENDENCIES): Define.
6497         (tls_script_test_LDFLAGS): Define.
6498         (tls_script_test_LDADD): Define.
6499         * testsuite/Makefile.in: Rebuild.
6500
6501 2010-03-22  Doug Kwan  <dougkwan@google.com>
6502
6503         * arm.cc (Arm_relocate_functions::abs8,
6504         Arm_relocate_functions::abs16): Use correct check for overflow
6505         specified in the ARM ELF specs.
6506         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6507         target of a BLX instruction specially.
6508         (Reloc_stub::stub_type_for_reloc): Ditto.
6509         (Relocate::relocate): Use symbolic names instead of numeric relocation
6510         codes to report error.
6511         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6512         workaround.
6513         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6514         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6515         thumb2_blx_out_of_range.stdout
6516         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6517         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6518         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6519         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6520         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6521         thumb2_blx_in_range, thumb2_blx_in_range.o,
6522         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6523         thumb2_blx_out_of_range.o): New rules.
6524         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6525         thumb2_blx_in_range and thumb2_blx_out_of_range.
6526         * testsuite/Makefile.in: Regenerate.
6527         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6528         * testsuite/thumb_blx_in_range.s: New file.
6529         * testsuite/thumb_blx_out_of_range.s: New file.
6530
6531 2010-03-22  Rafael Espindola  <espindola@google.com>
6532
6533         * archive.cc (Should_include): Move to archive.h.
6534         (should_include_member): Make it a member of Archive.
6535         (Lib_group): New.
6536         (Add_lib_group_symbols): New.
6537         * archive.h: Include options.h.
6538         (Archive_member): Moved from Archive.
6539         (Should_include): Moved from archive.cc.
6540         (Lib_group): New.
6541         (Add_lib_group_symbols): New.
6542         * dynobj.cc (do_should_include_member): New.
6543         * dynobj.h (do_should_include_member): New.
6544         * gold.cc (queue_initial_tasks): Update call to queue.
6545         * main.cc (main): Print lib group stats.
6546         * object.cc (do_should_include_member): New.
6547         * object.h: Include archive.h.
6548         (Object::should_include_member): New.
6549         (Object::do_should_include_member): New.
6550         (Sized_relobj::do_should_include_member): New.
6551         * options.cc (General_options::parse_start_lib): New.
6552         (General_options::parse_end_lib): New.
6553         (Input_arguments::add_file): Handle lib groups.
6554         (Input_arguments::start_group): Check we are not in a lib.
6555         (Input_arguments::start_lib): New.
6556         (Input_arguments::end_lib): New.
6557         * options.h (General_options): Add start_lib and end_lib.
6558         (Input_argument::lib_): New.
6559         (Input_argument::lib): New.
6560         (Input_argument::is_lib): New.
6561         (Input_file_lib): New.
6562         (Input_arguments::in_lib_): New.
6563         (Input_arguments::in_lib): New.
6564         (Input_arguments::start_lib): New.
6565         (Input_arguments::end_lib_): New.
6566         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6567         in unused members as preempted.
6568         (Sized_pluginobj::do_should_include_member): New.
6569         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6570         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6571         return the blocker.
6572         (Read_symbols::do_whole_lib_group): New.
6573         (Read_symbols::do_lib_group): New.
6574         (Read_symbols::do_read_symbols): Handle lib groups.
6575         (Read_symbols::get_name): Handle lib groups.
6576         * readsyms.h (Read_symbols): Add an archive member pointer.
6577         (Read_symbols::do_whole_lib_group): New.
6578         (Read_symbols::do_lib_group): New.
6579         (Read_symbols::member_): New.
6580         * script.cc (read_input_script): Update call to queue_soon.
6581
6582 2010-03-19  Doug Kwan  <dougkwan@google.com>
6583
6584         * arm.cc (Stub_table::Stub_table): Initialize new data members
6585         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6586         (Stub_table::add_reloc_stub): Assign stub offset and update
6587         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6588         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6589         New data members.
6590         (Stub_table::update_data_size_and_addralign): Use
6591         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6592         instead of going over all reloc stubs.
6593         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6594         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6595         Stringpool_template::offset_ to size of Stringpool_char.
6596         (Stringpool_template::new_key_offset): Remove code to initialize
6597         Stringpool_template::offset_.
6598         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6599         Stringpool_template::offset_ to zero.
6600
6601 2010-03-15  Doug Kwan  <dougkwan@google.com>
6602
6603         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6604         offset_.
6605         (Stringpool_template::new_key_offset): New method.
6606         (Stringpool_template::add_string): Assign offsets when adding new
6607         strings.
6608         (Stringpool_template::set_string_offsets): Do not set string offsets
6609         when not optimizing.
6610         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6611         member size_.
6612         (Chunked_vector::clear): Clear size_.
6613         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6614         (Chunked_vector::size): Return size_.
6615         (Chunked_vector::push_back): Use size_ to find insert position.
6616         (Chunked_vector::size_): New data member.
6617         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6618         (Stringpool_template::new_key_offset): New method declaration.
6619         (Stringpool_template::offset_): New data member.
6620
6621 2010-03-15   Rafael Espindola  <espindola@google.com>
6622
6623         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6624         Add_symbols' constructor.
6625         * readsyms.h (Add_symbols): Remove the input_group member.
6626
6627 2010-03-10  Ian Lance Taylor  <iant@google.com>
6628
6629         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6630         target to ask whether a reference to a symbol requires a stack
6631         split.
6632         * target.h (Target::is_call_to_non_split): New function.
6633         (Target::do_is_call_to_non_split): Declare virtual function.
6634         * target.cc: Include "symtab.h".
6635         (Target::do_is_call_to_non_split): New function.
6636         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6637
6638 2010-03-10  Cary Coutant  <ccoutant@google.com>
6639
6640         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6641         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6642         (File_read::open[2]): Add whole_file_view_ to list of views.
6643         (File_read::make_view): Remove test of whole_file_view_.
6644         (File_read::find_or_make_view): Create whole_file_view_ if
6645         necessary.
6646         (File_read::clear_views): Replace bool parameter with enum;
6647         adjust all callers.  Don't delete views with permanent data;
6648         do delete cached views and views from archives if
6649         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6650         if clearing the corresponding view.
6651         * fileread.h (File_read::Clear_views_mode): New enum.
6652         (File_read::View::is_permanent_view): New method.
6653         (File_read::clear_views): Replace bool parameter
6654         with enum; adjust all callers.
6655         * options.h (General_options): Change keep_files_mapped option;
6656         add map_whole_files.
6657         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6658         releasing the file.
6659         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6660         the file.
6661
6662 2010-03-10  David S. Miller  <davem@davemloft.net>
6663
6664         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6665
6666 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6667
6668         * icf.cc (get_section_contents): Add '@' marker after processing the
6669         merge reloc.
6670
6671 2010-03-08  Doug Kwan  <dougkwan@google.com>
6672
6673         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6674         due to a conversion warning.
6675         (Arm_relobj::update_output_local_symbol_count): Check for local
6676         symbol with unset output index.
6677
6678 2010-03-05  Ian Lance Taylor  <iant@google.com>
6679
6680         * options.h (class General_options): Add --spare-dynamic-tags.
6681         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6682         --spare-dynamic-tags.
6683
6684 2010-03-05  Ian Lance Taylor  <iant@google.com>
6685
6686         * incremental.cc: Include "libiberty.h".
6687
6688 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6689
6690         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6691         function, is_info_ member.
6692         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6693         (Versions::Versions): Update caller.
6694         (Versions::define_base_version): Likewise.
6695         (Versions::add_def): Likewise.
6696
6697 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6698
6699         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6700         (Scan::possible_function_pointer_reloc): New function.
6701         (Scan::local_reloc_may_be_function_pointer): Change to call
6702         possible_function_pointer_reloc.
6703         (Scan::global_reloc_may_be_function_pointer): Ditto.
6704         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6705         relocations in ".data.rel.ro._ZTV" section.
6706         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6707         * testsuite/icf_safe_so_test.cc: Ditto.
6708         * testsuite/icf_safe_test.cc: Ditto.
6709         * testsuite/icf_safe_test.sh: Ditto.
6710
6711 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6712             Ian Lance Taylor  <iant@google.com>
6713
6714         * target-reloc.h (relocate_section): Check the symbol table index
6715         for -1U before setting the local symbol index.
6716         (scan_relocatable_relocs): If copying the relocation, record that
6717         the local symbol is required.
6718         * object.h (Symbol_value::is_output_symtab_index_set): New
6719         function.
6720         (Symbol_value::may_be_discarded_from_output_symtab): New
6721         function.
6722         (Symbol_value::has_output_symtab_entry): New function.
6723         (Symbol_value::needs_output_symtab_entry): Remove.
6724         (Symbol_value::output_symtab_index): Make sure the symbol index is
6725         set.
6726         (Symbol_value::set_output_symtab_index): Make sure the symbol
6727         index is not set.  Make sure the new index is valid.
6728         (Symbol_value::set_must_have_output_symtab_entry): New function.
6729         (Symbol_value::has_output_dynsym_entry): New function.
6730         (Symbol_value::set_output_dynsym_index): Make sure the new index
6731         is valid.
6732         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6733         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6734         local symbol if permitted.
6735         (Sized_relobj::do_finalize_local_symbols): Call
6736         is_output_symtab_index_set rather than needs_output_symtab_entry.
6737         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6738         rather than needs_output_symtab_entry.  Call
6739         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6740         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6741         is_output_symtab_index_set rather than needs_output_symtab_entry.
6742         * testsuite/discard_locals_relocatable_test.c: New file.
6743         * testsuite/discard_locals_test.sh: Test -r.
6744         * testsuite/Makefile.am (check_DATA): Add
6745         discard_locals_relocatable_test1.syms,
6746         discard_local_relocatable_test2.syms.
6747         (MOSTLYCLEANFILES): Likewise.  Also add
6748         discard_locals_relocatable_test1.lout and
6749         discard_locals_relocatable_test2.out.
6750         (discard_locals_relocatable_test1.syms): New target.
6751         (discard_locals_relocatable_test.o): New target.
6752         (discard_locals_relocatable_test1.out): New target.
6753         (discard_locals_relocatable_test2.syms): New target.
6754         (discard_locals_relocatable_test2.out): New target.
6755         (various): Add missing ../ld-new dependencies.
6756         * testsuite/Makefile.in: Rebuild.
6757
6758 2010-03-03  Nick Clifton  <nickc@redhat.com>
6759
6760         * po/fi.po: New Finnish translation.
6761
6762 2010-03-01  Doug Kwan  <dougkwan@google.com>
6763
6764         * layout.cc (Layout::Layout): Force section types of .init_array*,
6765         .preinit_array* and .fini_array* sections.
6766         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6767         Fix check of return value of std::string::find.().
6768         (Output_section::Input_section_sort_compare::operator()): Remove
6769         comment about .init_array.
6770         (Output_section::Input_section_sort_init_fini_compare::operator()):
6771         New method.
6772         (Output_section::sort_attached_input_sections): Handle .init_array
6773         and .fini_array specially.
6774         * output.h (Output_section::Inut_section_sort_compare): Update
6775         comment.
6776         (Output_section::Input_section_sort_init_fini_compare): New struct.
6777
6778 2010-02-26  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6781         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6782         * testsuite/debug_msg.sh: Avoid matching source line number for
6783         use of global variable undef_int.
6784
6785 2010-02-26  Doug Kwan  <dougkwan@google.com>
6786
6787         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6788         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6789         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6790         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6791         * options.cc (General_options::General_options): Initialize member
6792         fix_v4bx_.
6793         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6794         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6795         and rm_no_fix_v4bx.stdout
6796         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6797         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6798         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6799         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6800         and arm_no_fix_v4bx.
6801         * Makefile.in: Regenerate.
6802         * testsuite/arm_fix_v4bx.s: New file.
6803         * testsuite/arm_fix_v4bx.sh: Ditto.
6804
6805 2010-02-24  Doug Kwan  <dougkwan@google.com>
6806
6807         * arm.cc (Target_arm::got_section): Make the .got section the first
6808         non RELRO section in the data segment.
6809         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6810         suffixes of section names.
6811
6812 2010-02-24  Doug Kwan  <dougkwan@google.com>
6813
6814         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6815         flags and attributes merging if an input file is a binary file.
6816         * fileread.cc (Input_file::open): Record format of original file.
6817         * fileread.h (Input_file::Format): New enum type.
6818         (Input_file::Input_file): Initialize data member format_.
6819         (Input_file::format): New method definition.
6820         (Input_file::format_):: New data member.
6821
6822 2010-02-24  Doug Kwan  <dougkwan@google.com>
6823
6824         * arm.cc (Arm_output_data_got): New class.
6825         (ARM_TCB_SIZE): New constant
6826         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6827         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6828         If user uses a script with a SECTIONS clause, issue only a warning
6829         for a misplaced EXIDX input section.  Otherwise, issue an error.
6830         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6831         garbage collection.
6832         (Target_arm::got_mode_index_entry): Handle static linking.
6833         (Target_arm::Scan::local): Ditto.
6834         (Target_arm::Scan::global): Ditto.
6835         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6836         all incorrectly implemented relocations.
6837         (Target_arm::fix_exidx_coverage): Pass layout to
6838         Arm_output_section::fix_exidx_coverage.
6839         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6840         from ".ARM.exidx." and ".ARM.extab.".
6841
6842 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6843
6844         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6845         section if it does not already exist.
6846         * attributes.cc (Attributes_section_data::Attributes_section_data):
6847         Don't crash if size is zero.
6848
6849 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6850             Ian Lance Taylor  <iant@google.com>
6851
6852         * gold.cc (queue_middle_tasks): If no input files were opened,
6853         exit.
6854         * workqueue.h (Task_function::Task_function): Assert that there is
6855         a blocker.
6856
6857 2010-02-22  Doug Kwan  <dougkwan@google.com>
6858
6859         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6860         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6861         types to avoid warnings due to different uint64_t implementations
6862         on different hosts.
6863
6864 2010-02-21  Doug Kwan  <dougkwan@google.com>
6865
6866         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6867         handling of the maximum backward branch offset.
6868         (Arm_relocate_functions::thumb_branch_common): Ditto.
6869         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6870         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6871         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6872         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6873         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6874         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6875         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6876         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6877         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6878         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6879         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6880         thumb2_bl_out_of_range.o): New rules.
6881         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6882         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6883         thumb2_bl_out_of_range
6884         * testsuite/Makefile.in: Regenerate.
6885         * testsuite/arm_bl_in_range.s: New file.
6886         * testsuite/arm_bl_out_of_range.s: Ditto.
6887         * testsuite/arm_branch_in_range.sh: Ditto.
6888         * testsuite/arm_branch_range.t: Ditto.
6889         * testsuite/thumb2_branch_range.t: Ditto.
6890         * testsuite/thumb_bl_in_range.s: Ditto.
6891         * testsuite/thumb_bl_out_of_range.s: Ditto.
6892         * testsuite/thumb_branch_range.t: Ditto.
6893
6894 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6895
6896         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6897         Add reloc offset information.
6898         * icf.cc (get_section_contents): Change iterators to point to the new
6899         vectors. Add reloc offset information to the contents.
6900         * icf.h (Icf::Sections_reachable_info): New typedef.
6901         (Icf::Sections_reachable_list): New typedef.
6902         (Icf::Offset_info): New typedef.
6903         (Icf::Reloc_info): New struct typedef.
6904         (Icf::Reloc_info_list): New typedef.
6905         (Icf::symbol_reloc_list): Delete method.
6906         (Icf::addend_reloc_list): Delete method.
6907         (Icf::section_reloc_list): Delete method.
6908         (Icf::reloc_info_list): New method.
6909         (Icf::reloc_info_list_): New member.
6910
6911 2010-02-19  Doug Kwan  <dougkwan@google.com>
6912
6913         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6914         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6915         * arm.cc (Arm_relocation_functions): New forward declaration.
6916         (Target_arm::Target_arm): Initialize new data members
6917         got_mod_index_offset_ and tls_base_symbol_defined_.
6918         (Target_arm::Relocate::relocate_tls): New method.
6919         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6920          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6921         New methods.
6922         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6923         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6924         (Target_arm::got_mod_index_offset_,
6925         Target_arm::tls_base_symbol_defined_): New data members.
6926         (Target_arm::Scan::local, Target::Scan::global,
6927         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6928         relocations.
6929
6930 2010-02-18  Doug Kwan  <dougkwan@google.com>
6931
6932         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6933         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6934         text section as a parameter becuase some broken tools may not set
6935         the link in section header.
6936         (Target_arm::has_got_section): New method.
6937         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6938         without any mapping symbol as data only.  Remove warning.
6939         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6940         link in its section header, try to discover the link by inspecting the
6941         REL31 relocation at the beginning of the section.
6942         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6943         in error message.
6944         (Target_arm::Scan::global): Treat any reference to the symbol
6945         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6946
6947 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6948
6949         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6950         (Scan::global_reloc_may_be_function_pointer): New function.
6951         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6952         (Scan::global_reloc_may_be_function_pointer): New function.
6953         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6954         (Scan::global_reloc_may_be_function_pointer): New function.
6955         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6956         (Scan::global_reloc_may_be_function_pointer): New function.
6957         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6958         (Scan::global_reloc_may_be_function_pointer): New function.
6959         (Scan::possible_function_pointer_reloc): New function.
6960         (Target_x86_64::can_check_for_function_pointers): New function.
6961         * gc.h (gc_process_relocs): Scan relocation types to determine if
6962         function pointers were taken for targets that support it.
6963         * icf.cc (Icf::find_identical_sections): Include functions for
6964         folding in safe ICF whose pointer is not taken.
6965         * icf.h (Secn_fptr_taken_set): New typedef.
6966         (fptr_section_id_): New member.
6967         (section_has_function_pointers): New function.
6968         (set_section_has_function_pointers): New function.
6969         (check_section_for_function_pointers): New function.
6970         * options.h: Fix comment for safe ICF option.
6971         * target.h (can_check_for_function_pointers): New function.
6972         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6973         Modify icf_safe_test for X86-64.
6974         * testsuite/Makefile.in: Regenerate.
6975         * testsuite/icf_safe_so_test.cc: New file.
6976         * testsuite/icf_safe_so_test.sh: New file.
6977         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6978         (main): Change to take pointer to function kept_func_3.
6979         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6980         folding is done correctly for X86-64.
6981
6982 2010-02-12  David S. Miller  <davem@davemloft.net>
6983
6984         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6985         is_symbolless parameter.
6986         (Output_reloc<SHT_REL>::is_symbolless): New.
6987         (Output_reloc<SHT_REL>::is_symbolless_): New.
6988         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6989         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6990         (Output_reloc<SHT_RELA>::is_symbolless): New.
6991         (Output_data_reloc::add_global): Handle is_symbolless.
6992         (Output_data_reloc::add_global_relative): Likewise.
6993         (Output_data_reloc::add_local): Likewise.
6994         (Output_data_reloc::add_local_relative): Likewise.
6995         (Output_data_reloc::add_symbolless_global_addend): New.
6996         (Output_data_reloc::add_symbolless_local_addend): New.
6997         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6998         is_symbolless.
6999         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7000         instead of ->is_relative_
7001         (Output_reloc::write): Likewise.
7002         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7003         (Output_reloc::write_rel): Simplify.
7004
7005         * sparc.cc (Target_sparc::Scan::local): Use
7006         ->add_symbolless_local_addend as needed.
7007         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7008         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7009         based upon relocation offset.
7010
7011 2010-02-11  Doug Kwan  <dougkwan@google.com>
7012
7013         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7014         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7015         beginning of function.
7016         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7017         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7018         parameter is_32bit in calls to should_apply_static_reloc.
7019         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7020         (check_DATA): Add arm_abs_global.stdout.
7021         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7022         arm_abs_global.stdout): New rules.
7023         (MOSTLLYCLEANFILES): Add arm_abs_global
7024         * Makefile.in: Regenerate.
7025         * testsuite/arm_abs_global.s: New file.
7026         * testsuite/arm_abs_global.sh: Ditto.
7027         * testsuite/arm_abs_lib.s: Ditto.
7028
7029 2010-02-11  Ian Lance Taylor  <iant@google.com>
7030
7031         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7032         Read_relocs task.
7033         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7034         Allocate_commons_task first.
7035         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7036         task, rather than symtab_lock_.
7037         (Gc_process_relocs::~Gc_process_relocs): New function.
7038         (Gc_process_relocs::is_runnable): Check this_blocker_.
7039         (Gc_process_relocs::locks): Use next_blocker_ rather than
7040         blocker_.
7041         (Scan_relocs::~Scan_relocs): New function.
7042         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7043         symtab_lock_.
7044         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7045         next_blocker_.
7046         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7047         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7048         constructor accordingly.
7049         (class Gc_process_relocs): Likewise.
7050         (class Scan_relocs): Likewise.
7051         * common.h (class Allocate_commons_task): Remove symtab_lock_
7052         field, and corresponding constructor parameter.
7053         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7054         symtab_lock_.
7055         (Allocate_commons_task::locks): Likewise.
7056
7057 2010-02-11  Ian Lance Taylor  <iant@google.com>
7058
7059         * gold-threads.h (class Once): Define.
7060         (class Initialize_lock): Rewrite as child of Once.
7061         * gold-threads.cc (class Once_initialize): Define.
7062         (once_pointer_control): New static variable.
7063         (once_pointer, once_arg): New static variables.
7064         (c_run_once): New static function.
7065         (Once::Once, Once::run_once, Once::internal_run): New functions.
7066         (class Initialize_lock_once): Remove.
7067         (initialize_lock_control): Remove.
7068         (initialize_lock_pointer): Remove.
7069         (initialize_lock_once): Remove.
7070         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7071         (Initialize_lock::initialize): Rewrite.
7072         (Initialize_lock::do_run_once): New function.
7073         * archive.cc (Archive::interpret_header): Only clear name if it is
7074         not already empty.
7075         * fileread.cc: Include "gold-threads.h"
7076         (file_counts_lock): New static variable.
7077         (file_counts_initialize_lock): Likewise.
7078         (File_read::release): Only increment counts when using --stats.
7079         Use a lock around the increment.
7080         * parameters.cc (class Set_parameters_target_once): Define.
7081         (set_parameters_target_once): New static variable.
7082         (Parameters::Parameters): Move here from parameters.h.
7083         (Parameters::set_target): Rewrite.
7084         (Parameters::set_target_once): New function.
7085         (Parameters::clear_target): Move here and rewrite.
7086         * parameters.h (class Parameters): Update declarations.  Add
7087         set_parameters_target_once_ field.
7088         (Parameters::Parameters): Move to parameters.cc.
7089         (Parameters::clear_target): Likewise.
7090         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7091         task.
7092         (Start_group::~Start_group): New function.
7093         (Start_group::is_runnable): New function.
7094         (Start_group::locks, Start_group::run): New functions.
7095         (Finish_group::run): Change saw_undefined to size_t.
7096         * readsyms.h (class Start_group): Define.
7097         (class Finish_group): Change saw_undefined_ field to size_t.
7098         (Finish_group::Finish_group): Remove saw_undefined and
7099         this_blocker parameters.  Change all callers.
7100         (Finish_group::set_saw_undefined): New function.
7101         (Finish_group::set_blocker): New function.
7102         * symtab.h (class Symbol_table): Change saw_undefined to return
7103         size_t.  Change saw_undefined_ field to size_t.
7104         * target-select.cc (Set_target_once::do_run_once): New function.
7105         (Target_selector::Target_selector): Initialize set_target_once_
7106         field.  Don't initialize lock_ and initialize_lock_ fields.
7107         (Target_selector::instantiate_target): Rewrite.
7108         (Target_selector::set_target): New function.
7109         * target-select.h (class Set_target_once): Define.
7110         (class Target_selector): Update declarations.  Make
7111         Set_target_once a friend.  Remove lock_ and initialize_lock_
7112         fields.  Add set_target_once_ field.
7113
7114 2010-02-10  Ian Lance Taylor  <iant@google.com>
7115
7116         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7117         queueing any tasks.
7118         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7119         (queue_middle_tasks): Add all blockers before queueing any tasks.
7120         (queue_final_tasks): Likewise.
7121         * token.h (Task_token::add_blockers): New function.
7122         * object.h (Input_objects::number_of_relobjs): New function.
7123
7124 2010-02-10  Ian Lance Taylor  <iant@google.com>
7125
7126         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7127         shared, not if not position independent.
7128         * x86_64.cc (Relocate::relocate_tls): Likewise.
7129         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7130         (tls_pie_pic_test): New target.
7131         * testsuite/Makefile.in: Rebuild.
7132
7133         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7134         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7135         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7136         * testsuite/Makefile.in: Rebuild.
7137
7138 2010-02-09  David S. Miller  <davem@davemloft.net>
7139
7140         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7141         R_SPARC_RELATIVE using ->add_local_relative().
7142         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7143
7144         * output.h (Output_data_dynamic::add_section_size): New method
7145         that takes two Output_data objects.
7146         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7147         entry param.  Handle it in initializers.
7148         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7149         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7150         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7151         arg.
7152         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7153         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7154         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7155         for dynrel_includes_plt.
7156         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7157         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7158         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7159         before .rela.plt
7160         (Target_sparc::do_finalize_sections): Update to pass true for
7161         dynrel_includes_plt.
7162         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7163         output before .rela.plt
7164         (Target_powerpc::do_finalize_sections): Update to pass true for
7165         dynrel_includes_plt when 32-bit.
7166
7167 2010-02-08  Doug Kwan  <dougkwan@google.com>
7168
7169         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7170         method.
7171         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7172         Arm_relobj::scan_section_for_cortex_a8_stubs,
7173         Arm_relobj::do_relocation_section): Instead of calling
7174         Output_section::output_address, use faster
7175         Arm_relobj::simple_input_section_output_address.
7176
7177 2010-02-08  David S. Miller  <davem@davemloft.net>
7178
7179         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7180         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7181         relocation helper function.
7182
7183         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7184         just like R_SPARC_GOT{10,13,22}.
7185         (Target_sparc::Scan::local): Likewise.
7186         (Target_sparc::Relocate:relocate): Likewise.
7187
7188 2010-02-06  Ian Lance Taylor  <iant@google.com>
7189
7190         * configure.ac: Rewrite targetobjs duplicate removal code to use
7191         only shell constructs.
7192         * configure: Rebuild.
7193
7194 2010-02-05  Doug Kwan  <dougkwan@google.com>
7195
7196         PR 11247
7197         * arm.cc (Arm_relobj::section_is_scannable): New method.
7198         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7199         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7200
7201 2010-02-04  Doug Kwan  <dougkwan@google.com>
7202
7203         PR 11247
7204         * arm-reloc-property.cc (cstdio): Include.
7205         * configure.ac (targetobjs): Remove duplicates.
7206         * configure: Regenerate.
7207         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7208         big and little endian version for a given address size.
7209
7210 2010-02-03  Doug Kwan  <dougkwan@google.com>
7211
7212         * arm-reloc-property.cc
7213         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7214         definition.
7215         * arm-reloc-property.h
7216         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7217         New method definition.
7218         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7219         declaration.
7220         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7221         overflow to N.
7222         (GOT_PREL): Change implemented to Y.
7223         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7224         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7225         (Arm_relocate_functions::movw_abs_nc): Remove method.
7226         (Arm_relocate_functions::movt_abs): Ditto.
7227         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7228         (Arm_relocate_functions::thm_movt_abs): Ditto.
7229         (Arm_relocate_functions::movw_rel_nc): Ditto.
7230         (Arm_relocate_functions::movw_rel): Ditto.
7231         (Arm_relocate_functions::movt_rel): Ditto.
7232         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7233         (Arm_relocate_functions:thm_movw_rel): Ditto.
7234         (Arm_relocate_functions:thm_movt_rel): Ditto.
7235         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7236         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7237         New method definitions.
7238         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7239         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7240         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7241         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7242         (Target_arm::Relocate::relocate): Check for non-static or
7243         unimplemented relocation code and exit early.  Change calls to
7244         Target_arm::reloc_uses_thumb_bit and
7245         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7246         instead.  Refactor code to handle similar relocations to increase
7247         code sharing.  Remove check for unsupported relocation code in switch
7248         statement.
7249         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7250         relocation property table to find out size.  Change error message to
7251         print out the name of a relocation code instead of the numeric value.
7252         (Target_arm::scan_reloc_for_stub): Use relocation property table
7253         instead of calling Target_arm::reloc_uses_thumb_bit().
7254
7255 2010-02-02  Doug Kwan  <dougkwan@google.com>
7256
7257         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7258         types of relaxed input section.
7259
7260 2010-02-02  Doug Kwan  <dougkwan@google.com>
7261
7262         * Makefile.am (HFILES): Add arm-reloc-property.h.
7263         (DEFFILES): New.
7264         (TARGETSOURCES): Add arm-reloc-property.cc
7265         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7266         (libgold_a_SOURCES): $(DEFFILES)
7267         * Makefile.in: Regenerate.
7268         * arm-reloc-property.cc: New file.
7269         * arm-reloc-property.h: New file.
7270         * arm-reloc.def: New file.
7271         * arm.cc: Update comments.
7272         (arm-reloc-property.h): New included header.
7273         (arm_reloc_property_table): New global variable.
7274         (Target_arm::do_select_as_default_target): New method definition.
7275         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7276         arm-reloc-property to targ_extra_obj.
7277         * parameters.cc (set_parameters_target): Call
7278         Target::select_as_default_target().
7279         * target.h (Target::select_as_default_target): New method definition.
7280         (Target::do_select_as_default_target): Same.
7281
7282 2010-02-01  Doug Kwan  <dougkwan@google.com>
7283
7284         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7285         first_output_text_section_.
7286         (Arm_exidx_fixup::first_output_text_section): New method definition.
7287         (Arm_exidx_fixup::first_output_text_section_): New data member.
7288         (Arm_exidx_fixup::process_exidx_section): Record the first text
7289         output section seen.
7290         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7291         and entsize in output section header.
7292
7293 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7294
7295         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7296         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7297         (Arm_relocate_functions::thm_alu11): New Method.
7298         (Arm_relocate_functions::thm_pc8): New Method.
7299         (Arm_relocate_functions::thm_pc12): New Method.
7300         (Target_arm::Scan::local): Handle the relocations.
7301         (Target_arm::Scan::global): Likewise.
7302         (Target_arm::Relocate::relocate): Likewise.
7303         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7304
7305 2010-01-29  Doug Kwan  <dougkwan@google.com>
7306
7307         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7308         of relocation types as ld.
7309
7310 2010-01-29  Doug Kwan  <dougkwan@google.com>
7311
7312         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7313         to public.
7314         (Arm_relocate_functions::thumb_branch_common): Ditto.
7315         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7316         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7317         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7318         Arm_relocate_functions::jump24): Remove.
7319         (Target_arm::Relocate::relocate): Adjust code to call
7320         Arm_relocation_functions::arm_branch_common and
7321         Arm_relocation_functions::thumb_branch_common instead of their removed
7322         wrappers.  Merge switch-cases together to reduce source code size.
7323
7324 2010-01-29  Doug Kwan  <dougkwan@google.com>
7325
7326         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7327         output_local_symbol_count_needs_update_.
7328         (Arm_relobj::output_local_symbol_count_needs_update,
7329          Arm_relobj::set_output_local_symbol_count_needs_update,
7330          Arm_relobj::update_output_local_symbol_count): New methods.
7331         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7332         member.
7333         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7334         of pointed function as in a R_ARM_PREL31 relocation.
7335         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7336         for output local symbol count updating.
7337         (Target_arm::do_relax): Update output local symbol counts in objects
7338         if necessary.
7339         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7340
7341 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7342
7343         * arm.cc: Added support for the ARM relocations:
7344         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7345         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7346         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7347         movw_prel_nc).
7348         (Arm_relocate_functions::movw_rel): New method.
7349         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7350         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7351         thm_movw_prel_nc).
7352         (Arm_relocate_functions::thm_movw_rel): New method.
7353         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7354         thm_movt_prel).
7355         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7356         relocations.
7357         (Target_arm::Scan::global): Likewise.
7358         (Target_arm::Relocate::relocate): Likewise.
7359         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7360         Likewise.
7361
7362 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7363
7364         * arm.cc: Added support for ARM group relocations.
7365         (Target_arm::reloc_needs_sym_origin): New method.
7366         (Arm_relocate_functions::calc_grp_kn): New method.
7367         (Arm_relocate_functions::calc_grp_residual): New method.
7368         (Arm_relocate_functions::calc_grp_gn): New method.
7369         (Arm_relocate_functions::arm_grp_alu): New Method.
7370         (Arm_relocate_functions::arm_grp_ldr): New Method.
7371         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7372         (Arm_relocate_functions::arm_grp_ldc): New Method.
7373         (Target_arm::Scan::local): Handle the ARM group relocations.
7374         (Target_arm::Scan::global): Likewise.
7375         (Target_arm::Relocate::relocate): Likewise.
7376         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7377         Likewise.
7378
7379 2010-01-26  Doug Kwan  <dougkwan@google.com>
7380
7381         * arm.cc (set): Include.
7382         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7383         pointer type.
7384         (Arm_output_section::Text_section_list): New type.
7385         (Arm_output_section::append_text_sections_to_list): New method.
7386         (Arm_output_section::fix_exidx_coverage): Ditto.
7387         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7388         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7389         Relobj::set_section_offset() instead of
7390         Sized_relobj::invalidate_section_offset().
7391         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7392         parameter for section headers. Ignore relocation sections for
7393         unallocated sections and EXIDX sections.
7394         (Target_arm::fix_exidx_coverage): New method.
7395         (Target_arm::output_section_address_less_than): New type.
7396         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7397         linked text section instead of the EXIDX section.
7398         (Arm_output_section::create_stub_group): Add an assertion to check
7399         that this is not an EXIDX output section.
7400         (Arm_output_section::append_text_sections_to_list): New method.
7401         (Arm_output_section::fix_exidx_coverage): Ditto.
7402         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7403         Arm_relobj::section_needs_reloc_stub_scanning.
7404         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7405         first pass.
7406         (Target_arm::fix_exidx_coverage): New method.
7407         * object.h (Relobj::set_output_section): New method.
7408         (Sized_relobj::invalidate_section_offset): Remove method.
7409         (Sized_relobj::do_invalidate_section_offset): Remove method.
7410         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7411
7412 2010-01-25  Doug Kwan  <dougkwan@google.com>
7413
7414         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7415         Fix warning due to signed and unsigned comparison on a 32-bit host.
7416
7417 2010-01-22  Doug Kwan  <dougkwan@google.com>
7418
7419         * arm.cc (Target_arm::do_relax): Record an output section for section
7420         offset adjustment it contains any stub table that has changed.
7421         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7422         offsets in an output section if necessary.
7423         * output.cc (Output_section::Output_section): Initialize
7424         section_offsets_need_adjustments_.
7425         (Output_section::add_input_section_for_script): Renamed to
7426         Output_section::add_simple_input_section.
7427         (Output_section::save_states): Add a comment.
7428         (Output_section::discard_states): New method defintion.
7429         (Output_section::adjust_section_offsets): Same.
7430         * output.h (Output_section::add_input_section_for_script): Renamed to
7431         Output_section::add_simple_input_section.
7432         (Output_section::discard_states): New method declaration.
7433         (Output_section::adjust_section_offsets): Same.
7434         (Output_section::section_offsets_need_adjustment,
7435         Output_section::set_section_offsets_need_adjustment): New method
7436         definitions.
7437         (Output_section::section_offsets_need_adjustment_): New data member.
7438         * script-sections.cc
7439         (Output_section_element_input::set_section_address): Adjust code for
7440         renaming of Output_section::add_input_section_for_script.
7441         (Orphan_output_section::set_section_address): Same.
7442
7443 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7444
7445         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7446         Fix_v4bx enum values .
7447         * gold/options.h (General_options): New option definitions.
7448         (General_options::fix_v4bx): New method.
7449         (General_options::Fix_v4bx): New enum.
7450         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7451         (General_options::parse_fix_v4bx_interworking): New method.
7452
7453 2010-01-22  Doug Kwan  <dougkwan@google.com>
7454
7455         * arm.cc (Arm_exidx_fixup): New class.
7456
7457 2010-01-21  Doug Kwan  <dougkwan@google.com>
7458
7459         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7460         classes.
7461         (Arm_exidx_section_offset_map): New type.
7462
7463 2010-01-21  Doug Kwan  <dougkwan@google.com>
7464
7465         * arm.cc (Arm_exidx_input_section): New class.
7466         (Arm_relobj::exidx_input_section_by_link,
7467         Arm_relobj::exidx_input_section_by_shndx,
7468         Arm_relobj::make_exidx_input_section): New methods.
7469         (read_arm_attributes_section): Remove.
7470         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7471         information about them.
7472         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7473         to here.
7474
7475 2010-01-20  Doug Kwan  <dougkwan@google.com>
7476
7477         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7478         Input_section_specifier to Section_id.
7479         (Target_arm::new_arm_input_section: Adjust code for change of key
7480         type.
7481         (Target_arm::find_arm_input_section): Ditto.
7482         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7483         (Section_id): Remove.
7484         (Garbage_collection::Section_id_hash): Remove.
7485         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7486         (Section_id): Remove.
7487         (Icf::Section_id_hash): Remove.
7488         * object.h (Section_id, Const_section_id, Section_id_hash,
7489         Const_section_id_hash): New type definitions.
7490         * output.cc (Output_section::add_relaxed_input_section): Change to
7491         use Const_section_id instead of Input_section_specifier as key type.
7492         (Output_section::add_merge_input_section): Ditto.
7493         (Output_section::build_relaxation_map): Change to use Section_id
7494         instead of Input_section_specifier as key type.
7495         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7496         Ditto.
7497         (Output_section::convert_input_sections_to_relaxed_sections): Change
7498         to use Const_section_id instead of Input_section_specifier as key type.
7499         (Output_section::find_merge_section): Ditto.
7500         (Output_section::find_relaxed_input_section): Ditto.
7501         * output.h (Input_section_specifier): Remove class.
7502         (Output_section::Output_section_data_by_input_section_map): Change
7503         key type to Const_section_id.
7504         (Output_section::Output_relaxed_input_section_by_input_section_map):
7505         Ditto.
7506         (Output_section::Relaxation_map): Change key type to Section_id.
7507
7508 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7509
7510         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7511         (class Arm_v4bx_stub): New class.
7512         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7513         (Stub_factory::make_arm_v4bx_stub): New method.
7514         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7515         (Stub_table::empty): Handle v4bx stubs.
7516         (Stub_table::add_arm_v4bx_stub): New method.
7517         (Stub_table::find_arm_v4bx_stub): New method.
7518         (Arm_relocate_functions::v4bx): New method.
7519         (Target_arm::fix_v4bx): New method.
7520         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7521         (Stub_table::relocate_stubs): Likewise.
7522         (Stub_table::do_write): Likewise.
7523         (Stub_table::update_data_size_and_addralign): Likewise.
7524         (Stub_table::finalize_stubs):  Likewise.
7525         (Target_arm::Scan::local): Likewise.
7526         (Target_arm::Scan::global): Likewise.
7527         (Target_arm::do_finalize_sections): Likewise.
7528         (Target_arm::Relocate::relocate): Likewise.
7529         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7530         Likewise.
7531         (Target_arm::scan_reloc_for_stub): Likewise.
7532         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7533
7534 2010-01-19  Ian Lance Taylor  <iant@google.com>
7535
7536         * output.cc (Output_section_headers::do_sized_write): Write large
7537         segment count to sh_info field.
7538         (Output_file_header::do_sized_write): For large segment count,
7539         write PN_XNUM to e_phnum field.
7540
7541 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7542
7543         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7544         (Arm_relocate_functions::thm_jump8): New function.
7545         (Arm_relocate_functions::thm_jump11): New function.
7546         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7547         R_ARM_THM_JUMP11.
7548         (Target_arm::Scan::global): Likewise.
7549         (Target_arm::Relocate::relocate): Likewise.
7550         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7551         Likewise.
7552
7553 2010-01-14  Doug Kwan  <dougkwan@google.com>
7554
7555         * arm.cc (map, utility): Include headers.
7556         (Target_arm::apply_cortex_a8_workaround): New method.
7557         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7558         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7559         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7560         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7561         the --[no-]fix-cortex-a8 command line options.
7562         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7563         (Target_arm::relocate_stub): Use addend in instruction template.
7564         * options.h (DEFINE_bool): Set the user-set flag.
7565         (General_options): Add --[no-]-fix-cortex options.
7566         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7567         : Update fast look-up map after conversion.
7568
7569 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7570
7571         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7572         in the first pass of do_layout.
7573
7574 2010-01-13  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7577         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7578         apparent compiler problem of not folding static constant integral
7579         data members of elfcpp::Elf_sizes<32>.
7580
7581 2010-01-13  Doug Kwan  <dougkwan@google.com>
7582
7583         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7584         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7585         Arm_relobj::scan_section_for_cortex_a8_erratum,
7586         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7587         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7588         sections to scan for relocation stubs into a new method
7589         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7590         relocation and Cortex-A8 stub scanning.
7591         (Target_arm::do_relax): Force stubs to be after stubbed sections
7592         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7593         the beginning of a new relaxation pass.  Update a comment.
7594         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7595
7596 2010-01-12  Ian Lance Taylor  <iant@google.com>
7597
7598         * target-reloc.h (visibility_error): New inline function.
7599         (relocate_section): Call visibility_error.
7600         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7601         (MOSTLYCLEANFILES): Likewise.
7602         (protected_4_pic.o, protected_3.err): New targets.
7603         * testsuite/protected_4.cc: New file.
7604
7605 2010-01-12  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc (Cortex_a8_reloc): New class.
7608         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7609         and cortex_a8_relocs_info_.
7610         (Target_arm::fix_cortex_a8): New method definition.
7611         (Target_arm::Cortex_a8_relocs_info): New type.
7612         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7613         New data member declarations.
7614         (Target_arm::scan_reloc_for_stub): Record information about
7615         relocations for THUMB branches that might be exempted from the
7616         Cortex-A8 workaround.
7617         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7618         at the beginning of a relaxation pass.
7619
7620 2010-01-12  Doug Kwan  <dougkwan@google.com>
7621
7622         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7623         (Arm_relobj::Mapping_symbol_position,
7624          Arm_reloj::Mapping_symbol_position_less,
7625          Arm_relobj::Mapping_symbols_info): New types.
7626         (Target_arm::is_mapping_symbol_name): New method definition.
7627         (Arm_relobj::do_count_local_symbols): Save information about mapping
7628         symbols.
7629
7630 2010-01-11  Doug Kwan  <dougkwan@google.com>
7631
7632         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7633         Arm_relocate_functions::thumb32_branch_upper,
7634         Arm_relocate_functions::thumb32_branch_lower,
7635         Arm_relocate_functions::thumb32_cond_branch_offset,
7636         Arm_relocate_functions::thumb32_cond_branch_upper,
7637         Arm_relocate_functions::thumb32_cond_branch_lower,
7638         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7639         branch offset encoding.
7640         (Arm_relocate_functions::thumb_branch_common): Use new branch
7641         offset encoding methods to avoid code duplication.
7642         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7643         (Stub_addend_reader::operator()): Use new branch encoding method
7644         to avoid code duplication.
7645
7646 2010-01-11  Doug Kwan  <dougkwan@google.com>
7647
7648         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7649         (Target_arm::do_finalize_sections): Define special EXIDX section
7650         symbols only if referenced.
7651         * gc.h (Garbage_collection::add_reference): New method.
7652         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7653         code duplication.
7654
7655 2010-01-11  Ian Lance Taylor  <iant@google.com>
7656
7657         * script.cc (Version_script_info::build_expression_list_lookup):
7658         Change complaing about duplicate wildcard match from error to
7659         warning.
7660
7661         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7662         of 2009-12-30.
7663         (Version_script_info::Version_script_info): Initialize globs_,
7664         default_version_, default_is_global_, and exact_.  Don't
7665         initialize globals_ or locals_.
7666         (Version_script_info::build_lookup_tables): Build local symbols
7667         first.
7668         (Version_script_info::unquote): New function.
7669         (Version_script_info::add_exact_match): New function.
7670         (Version_script_info::build_expression_list_lookup): Remove lookup
7671         parameter.  Add is_global parameter.  Change all callers.  Handle
7672         wildcard pattern specially.  Unquote pattern.  Call
7673         add_exact_match.
7674         (Version_script_info::get_name_to_match): New function.
7675         (Version_script_info::get_symbol_version): New function.
7676         (Version_script_info::get_symbol_version_helper): Remove.
7677         (Version_script_info::check_unmatched_names): Call unquote.
7678         * script.h (class Version_script_info): Change get_symbol_version
7679         to be non-inline and add is_global parameter; change all callers.
7680         Rewrite symbol_is_local.  Update declarations.  Define struct
7681         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7682         Remove globals_ and locals_ members.  Add exact_, globs_,
7683         default_version_, is_global_.
7684         (Version_script_info::Glob): Remove pattern, add expression and
7685         is_global.  Update constructor.  Change all callers.
7686         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7687         default version.
7688         (Versions::symbol_section_contents): If a symbol is undefined, or
7689         defined in a dynamic object, set the version index to
7690         VER_NDX_LOCAL.
7691         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7692         symbol_is_local.
7693         (Symbol_table::add_from_pluginobj): Likewise.
7694         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7695
7696 2010-01-11  Doug Kwan  <dougkwan@google.com>
7697
7698         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7699         (incremental_dump_LDADD): Add linking option for libintl.
7700         * Makefile.in: Regenerate.
7701
7702 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7703
7704         PR gold/11144
7705         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7706         instead of -Ds.
7707         * testsuite/Makefile.in: Regenerated.
7708
7709 2010-01-10  Doug Kwan  <dougkwan@google.com>
7710
7711         * options.h (DEFINE_var): Use parentheses around argument varname__
7712         in macro body to avoid any unintended subsequent substitutions.
7713
7714 2010-01-10  Ian Lance Taylor  <iant@google.com>
7715
7716         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7717         candidates before doing symbol resolution.
7718
7719         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7720         ODR candidates if only one is weak.
7721
7722 2010-01-08  Ian Lance Taylor  <iant@google.com>
7723
7724         * script.cc (Version_script_info::build_expression_list_lookup):
7725         Don't warn about ambiguous version, just record the ambiguity.
7726         (Version_script_info::get_symbol_version_helper): Give error if
7727         version is ambiguous.
7728
7729 2010-01-08  Doug Kwan  <dougkwan@google.com>
7730
7731         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7732         prev_data_size_ and prev_addralign_.  Remove initializer for
7733         deleted data member has_been_changed_.
7734         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7735         to determine if the table is empty.
7736         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7737         Remove.
7738         (Stub_table::add_reloc_stub): Define method in class definition
7739         instead of just declaring it there.
7740         (Stub_table::add_cortex_a8_stub): New method definition.
7741         (Stub_table::update_data_size_and_addralign): Ditto.
7742         (Stub_table::finalize_stubs): Ditto.
7743         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7744         (Stub_table::do_addralign_): Return address alignment in the
7745         (Stub_table::do_reset_address_and_file_offset): Define method in
7746         class definition instead of declaring it there.  Set current data
7747         size to be the data size of the previous pass.
7748         (Stub_table::set_final_data_size): Use current data size as the
7749         final data size.
7750         (Stub_table::relocate_stub): Change parameter type of stub from
7751         Reloc_stub pointer to Stub pointer.
7752         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7753         (Stub_table::Cortex_a8_stub_list): New typedef.
7754         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7755          Stub_table::prev_addralign_): New data member.
7756         (Arm_relobj::Arm_relobj): Initialize data member
7757         section_has_cortex_a8_workaround_.
7758         (Arm_relobj::section_has_cortex_a8_workaround,
7759          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7760          definitions.
7761         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7762         declarations.
7763         (Target_arm::relocate_stub): Change parameter type of stub from
7764         Reloc_stub pointer to Stub pointer.
7765         (Insn_template::size, Insn_template::alignment): Handle
7766         THUMB16_SPECIAL_TYPE.
7767         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7768          Stub_table::update_data_size_and_addralign,
7769          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7770         definitions.
7771         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7772         (Stub_table::do_write): Ditto.
7773         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7774
7775 2010-01-08  Ian Lance Taylor  <iant@google.com>
7776
7777         PR 11108
7778         * symtab.h (class Symbol): Remove fields is_target_special_ and
7779         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7780         (Symbol::is_defined_in_discarded_section): New function.
7781         (Symbol::set_is_defined_in_discarded_section): New function.
7782         (Symbol::has_plt_offset): Rewrite.
7783         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7784         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7785         Don't initialize is_target_special_ or has_plt_offset_.
7786         Initialize is_defined_in_discarded_section_.
7787         (Symbol_table::add_from_relobj): If appropriate, set
7788         is_defined_in_discarded_section.
7789         * resolve.cc (Symbol::override_base_with_special): Don't test
7790         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7791         * target-reloc.h (relocate_section): Do special handling for
7792         symbols defined in discarded sections for global symbols as well
7793         as local symbols.
7794
7795 2010-01-08  Ian Lance Taylor  <iant@google.com>
7796
7797         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7798         the SHT_SYMTAB case.
7799
7800 2010-01-08  Ian Lance Taylor  <iant@google.com>
7801
7802         * object.cc (Sized_relobj::do_layout): Don't get confused if
7803         layout_eh_frame returns NULL.
7804
7805 2010-01-08  Ian Lance Taylor  <iant@google.com>
7806
7807         PR 11084
7808         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7809         dynamic symbol table, use the normal symbol table.
7810         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7811         symbol table.
7812
7813 2010-01-08  Ian Lance Taylor  <iant@google.com>
7814
7815         PR 11072
7816         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7817         sections.
7818
7819 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7820
7821         * version.cc (print_version): Change to "Copyright 2010".
7822
7823 2010-01-08  Ian Lance Taylor  <iant@google.com>
7824
7825         PR 10287
7826         PR 11063
7827         * i386.cc (class Target_i386): Change return type of plt_section
7828         to be non-const.
7829         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7830         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7831         tls_desc_rel_ field.
7832         (Output_data_plt_i386::rel_tls_desc): New function.
7833         (Target_i386::rel_tls_desc_section): New function.
7834         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7835         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7836         R_386_TLS_DESC reloc in rel_tls_desc_section.
7837         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7838         Define struct Tlsdesc_info.
7839         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7840         (Target_x86_64::do_reloc_symbol_index): New function.
7841         (Target_x86_64::add_tlsdesc_info): New function.
7842         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7843         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7844         tlsdesc_rel_ field.
7845         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7846         all callers.
7847         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7848         (Target_x86_64::rela_tlsdesc_section): New function.
7849         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7850         handling.
7851         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7852         (Target_x86_64::do_reloc_addend): New function.
7853         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7854         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7855         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7856         (Output_reloc::type): New function.
7857         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7858         (Output_reloc::is_target_specific): New function.
7859         (Output_reloc::target_arg): New function.
7860         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7861         absolute relocs and target specific relocs.
7862         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7863         add_target_specific.
7864         (class Output_data_reloc) [SHT_RELA]: Likewise.
7865         * output.cc (Output_reloc::Output_reloc): Add four new versions
7866         for absolute relocs and target specific relocs.
7867         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7868         (Output_reloc::get_symbol_index): Likewise.
7869         (Output_reloc::local_section_offset): Check that local_sym_index_
7870         is not TARGET_CODE or 0.
7871         (Output_reloc::symbol_value): Likewise.
7872         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7873         reloc.
7874         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7875         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7876         functions.
7877         * layout.cc (add_target_dynamic_tags): Use output section for
7878         DT_PLTRELSZ and DT_JMPREL.
7879
7880 2010-01-07  Ian Lance Taylor  <iant@google.com>
7881
7882         PR 11061
7883         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7884         function.
7885         (class Output_data_reloc_generic): Define.
7886         (class Output_data_reloc_base): Change base class to
7887         Output_data_reloc_generic.  Change add() method to call
7888         bump_relative_reloc_count for a relative reloc.  Remove
7889         sort_relocs_ field.
7890         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7891         to sort_relocs().
7892         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7893         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7894         appropriate.
7895         * layout.h (class Layout): Update declaration.
7896
7897 2010-01-07  Ian Lance Taylor  <iant@google.com>
7898
7899         * output.h (class Output_data): Add const version of
7900         output_section and do_output_section.
7901         (class Output_section_data): Add const version of
7902         do_output_section.
7903         (class Output_section): Likewise.
7904         * layout.cc (Layout::add_target_dynamic_tags): New function.
7905         * layout.h (class Layout): Update declarations.
7906         * arm.cc (Target_arm::do_finalize_sections): Use
7907         add_target_dynamic_tags.
7908         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7909         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7910         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7911         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7912
7913 2010-01-07  Ian Lance Taylor  <iant@google.com>
7914
7915         PR 11042
7916         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7917         object as needed.
7918
7919 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7920             Ian Lance Taylor  <iant@google.com>
7921
7922         PR 11019
7923         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7924         Xindex::read_symtab_xindex.
7925
7926 2010-01-07  Doug Kwan  <dougkwan@google.com>
7927
7928         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7929         (Insn_template::thumb16_bcond_insn): New method declaration.
7930         (Insn_template): Fix spelling.
7931         (Stub::thumb16_special): New method declaration.
7932         (Stub::do_write): Define virtual method which was previously pure
7933         virtual.
7934         (Stub::do_thumb16_special): New method declaration.
7935         (Stub::do_fixed_endian_write): New template member.
7936         (Reloc_stub::do_write): Remove.
7937         (Reloc_stub::do_fixed_endian_write): Remove.
7938         (Cortex_a8_stub): New class definition.
7939         (Stub_factory::make_cortex_a8_stub): New method definition.
7940         (Stub_factory::Stub_factory): Add missing static storage class
7941         qualifier for elf32_arm_stub_a8_veneer_blx.
7942
7943 2010-01-07  Ian Lance Taylor  <iant@google.com>
7944
7945         PR 10980
7946         * options.h (class General_options): Add --warn-unresolved-symbols
7947         and --error-unresolved-symbols.
7948         * errors.cc (Errors::undefined_symbol): Implement
7949         --warn-unresolved-symbols.
7950
7951         * options.h (class General_options): Add -z text and -z textoff.
7952         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7953
7954 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7955
7956         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7957         (Garbage_collection::cident_sections): New function.
7958         (Garbage_collection::add_cident_section): New function.
7959         (Garbage_collection::cident_sections_): New member.
7960         (gc_process_relocs): Add references to sections whose names are C
7961         identifiers.
7962         * gold.h (cident_section_start_prefix): New constant.
7963         (cident_section_stop_prefix): New constant.
7964         (is_cident): New function.
7965         * layout.cc (Layout::define_section_symbols): Replace string constants
7966         with the newly defined constants.
7967         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7968         C identifiers.
7969         * testsuite/Makefile.am: Add gc_orphan_section_test.
7970         * testsuite/Makefile.in: Regenerate.
7971         * testsuite/gc_orphan_section_test.cc: New file.
7972         * testsuite/gc_orphan_section_test.sh: New file.
7973
7974 2010-01-06  Ian Lance Taylor  <iant@google.com>
7975
7976         PR 10980
7977         * options.h (class General_options): Add --warn-shared-textrel.
7978         * layout.cc (Layout::finish_dynamic_section): Implement
7979         --warn-shared-textrel.
7980
7981         PR 10980
7982         * options.h (class General_options): Add --warn-multiple-gp.
7983
7984 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7985
7986         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7987         $(THREADSLIB) and $(LIBDL).
7988         * Makefile.in: Rebuild.
7989
7990 2010-01-06  Ian Lance Taylor  <iant@google.com>
7991
7992         PR 10980
7993         * options.cc (General_options::parse_section_start): New function.
7994         (General_options::section_start): New function.
7995         (General_options::General_options): Initialize all members.
7996         * options.h: Include <map>
7997         (class General_options): Add --section-start.  Add section_starts_
7998         member.
7999         * layout.cc (Layout::attach_allocated_section_to_segment): If
8000         --section-start was used, set the address of the segment.  Remove
8001         local sort_sections.
8002         (Layout::relaxation_loop_body): If the address of the load segment
8003         has been set by --section-start, don't use it.
8004         * output.h (Output_segment::update_flags_for_output_section): New
8005         function.
8006         * output.cc (Output_segment::add_output_section): Call
8007         update_flags_for_output_section.
8008
8009 2010-01-05  Ian Lance Taylor  <iant@google.com>
8010
8011         PR 10980
8012         * options.h (class General_options): Add --undefined-version.
8013         * script.cc (struct Version_expression): Add was_matched_by_symbol
8014         field.
8015         (Version_script_info::matched_symbol): New function.
8016         (Version_script_info::get_symbol_version_helper): Call
8017         matched_symbol.
8018         (Version_script_info::check_unmatched_names): New function.
8019         * script.h (class Version_script_info): Update declarations.
8020         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8021
8022         * options.h (class General_options): Use DEFINE_bool_alias for
8023         allow_multiple_definition.
8024         * resolve.cc (Symbol_table::should_override): Don't test
8025         allow_multiple_definition.
8026
8027         PR 10980
8028         * options.h (class General_options): Add --cref.
8029         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8030         until after printing cref table.
8031         * cref.cc: Include "symtab.h".
8032         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8033         (Cref_table_compare::operator()): New function.
8034         (Cref_inputs::gather_cref): New function.
8035         (filecol): New static const.
8036         (Cref_inputs::print_cref): New function.
8037         (Cref::print_cref): New function.
8038         * cref.h: Include <cstdio>.
8039         (class Cref): Update declarations.
8040         * mapfile.h (Mapfile::file): New function.
8041         * object.h (class Object): Define Symbols.  Declare virtual
8042         do_get_global_symbols.
8043         (Object::get_global_symbols): New function.
8044         * object.cc (Input_objects::add_object): Pass object to cref_ if
8045         --cref.
8046         (Input_objects::archive_start): Likewise.
8047         (Input_objects::archive_stop): Likewise.
8048         (Input_objects::print_cref): New function.
8049         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8050         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8051         --cref.
8052         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8053         function.
8054         * plugin.h (class Sized_pluginobj): Update declarations.
8055
8056 2010-01-05  Ian Lance Taylor  <iant@google.com>
8057
8058         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8059         to is_default_version.  Rename insdef to insdefault.
8060         (Symbol_table::add_from_relobj): Rename def to is_default_version
8061         and local to is_forced_local.
8062         (Symbol_table::add_from_pluginobj): Likewise.
8063         (Symbol_table::add_from_dynobj): Likewise.
8064         (Symbol_table::define_special_symbol): Rename insdef to
8065         insdefault.
8066
8067 2010-01-04  Ian Lance Taylor  <iant@google.com>
8068
8069         PR 10980
8070         * options.h (class General_options): Add
8071         --allow-multiple-definition and -z muldefs.
8072         * resolve.cc (Symbol_table::should_override): Don't warn about a
8073         multiple symbol definition if --allow-multiple-definition or -z
8074         muldefs.
8075
8076         PR 10980
8077         * options.h (class General_options): Add --add-needed and
8078         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8079         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8080         error if --copy-dt-needed-entries aka --add-needed is used and
8081         would cause a change in behaviour.
8082
8083         PR 10980
8084         * options.h (class General_options): Add -G as a short version of
8085         --shared.  Add no-op options -assert, -g, and -i.
8086
8087 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8088
8089         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8090         check for .text or .gnu.linkonce.t sections.
8091         * icf.cc (Icf::find_identical_sections): Ditto.
8092         Change the detection for mangled function name within the section
8093         name.
8094         * icf.h (is_section_foldable_candidate): New function.
8095
8096 2009-12-30  Ian Lance Taylor  <iant@google.com>
8097
8098         PR 10980
8099         * options.h (class General_options): Permit two dashes with
8100         --retain-symbols-file.
8101
8102 2009-12-30  Ian Lance Taylor  <iant@google.com>
8103
8104         PR 10979
8105         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8106         don't put the file header and segment headers in the text
8107         segment.
8108
8109         PR 10979
8110         * common.cc (Sort_commons::operator()): Stabilize sort when both
8111         entries are NULL.
8112         (Symbol_table::do_allocate_commons_list): When allocating common
8113         symbols, skip a symbol which is no longer common.
8114         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8115         an object before checking its type.
8116         * testsuite/common_test_2.c: New file.
8117         * testsuite/common_test_3.c: New file.
8118         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8119         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8120         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8121         (common_test_2_pic.o, common_test_2.so): New targets.
8122         (common_test_3_pic.o, common_test_3.so): New targets.
8123         * testsuite/Makefile.in: Rebuild.
8124
8125         PR 10979
8126         * script.cc (read_input_script): If we see a new SECTIONS clause,
8127         and we have added an input section, give an error.
8128         * layout.h (class Layout): Add have_added_input_section function.
8129         Add have_added_input_section_ field.
8130         * layout.cc (Layout::Layout): Initialize
8131         have_added_input_section_.
8132         (Layout::layout): Set have_added_input_section_.
8133         (Layout::layout_eh_frame): Likewise.
8134
8135 2009-12-30  Ian Lance Taylor  <iant@google.com>
8136
8137         PR 10931
8138         * options.h (class General_options): Add --sort-common option.
8139         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8140         * common.cc (Sort_common): Add sort_order parameter to
8141         constructor.  Add sort_order_ field.
8142         (Sort_commons::operator): Check sort_order_.
8143         (Symbol_table::allocate_commons): Determine the sort order.
8144         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8145         Change all callers.
8146         (Symbol_table::do_allocate_commons_list): Likewise.
8147
8148 2009-12-30  Ian Lance Taylor  <iant@google.com>
8149
8150         PR 10916
8151         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8152         symbols from this object, don't change the visibility of an
8153         undefined symbol.
8154         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8155
8156 2009-12-30  Ian Lance Taylor  <iant@google.com>
8157
8158         PR 10861
8159         * script.h (class Version_script_info): Define Language enum.
8160         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8161         new fields globals_, locals_, and is_finalized_.
8162         * script.cc: Various formatting fixes.
8163         (class Parser_closure): Change language_stack_ from a vector of
8164         std::string to one of Version_script_info::Language.  Adjust all
8165         uses accordingly.
8166         (class Lazy_demangler): Remove.
8167         (struct Version_expression): Change language from std::string to
8168         Version_script_info::Language.
8169         (Version_script_info::Version_script_info): New function.
8170         (Version_script_info::~Version_script_info): Don't call clear.
8171         (Version_script_info::finalize): New function.
8172         (Version_script_info::build_lookup_tables): New function.
8173         (Version_script_info::build_expression_list_lookup): New
8174         function.
8175         (Version_script_info::get_symbol_version_helper): Rewrite to use
8176         lookup tables.
8177         (Version_script_info::print_expression_list): Adjust to use
8178         Version_script_info::Language.
8179         (script_push_lex_into_version_mode): Check that the version script
8180         has not been finalized.
8181         (version_script_push_lang): Change language string to
8182         Version_script_info::Language.
8183         * options.cc (Command_line::version_script): New function.
8184         * options.h (class General_options): Add finalize_dynamic_list
8185         function.  Change version_script from declaration to definition.
8186         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8187         * testsuite/version_script.map: Remove duplicate def of foo.
8188         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8189         version_script.map.
8190         * testsuite/Makefile.in: Rebuild.
8191
8192 2009-12-30  Ian Lance Taylor  <iant@google.com>
8193
8194         PR 10843
8195         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8196         if the input symbol index is 0, make the output symbol index 0.
8197
8198 2009-12-30  Ian Lance Taylor  <iant@google.com>
8199
8200         PR 10670
8201         * options.h (class General_options): Add -x/--discard-all.
8202         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8203         --discard-all.  If the local symbol needs a dynamic entry, check
8204         that before handling --discard-locals.
8205
8206 2009-12-30  Ian Lance Taylor  <iant@google.com>
8207
8208         PR 10450
8209         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8210         flags to PF_R.
8211         (Output_segment::add_output_section): Don't change the flags if
8212         the type is PT_TLS.
8213
8214         PR 10450
8215         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8216         GNU hash table if they need a dynamic value.  Otherwise, don't add
8217         them if they are defined in a dynamic object or are forced local.
8218
8219 2009-12-29  Ian Lance Taylor  <iant@google.com>
8220
8221         PR 10450
8222         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8223         .gnu.hash table for a 32-bit target.
8224
8225         PR 10450
8226         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8227         regular and a dynamic object only needs a dynamic symbol table
8228         entry if it is externally visible.
8229
8230         PR 10450
8231         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8232         constructor.  Add global_offset_table_ field.
8233         (Target_i386::got_section): Set global_offset_table_.
8234         (Target_i386::do_finalize_sections): Set global_offset_table_
8235         size.
8236         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8237         in constructor.  Add global_offset_table_ field.
8238         (Target_x86_64::got_section): Set global_offset_table_.
8239         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8240         size.
8241
8242         * layout.cc (Layout::Layout): Initialize increase_relro_.
8243         (Layout::get_output_section): Add is_relro, is_last_relro, and
8244         is_first_non_relro parameters.  Change all callers.
8245         (Layout::choose_output_section): Likewise.
8246         (Layout::add_output_section_data): Likewise.
8247         (Layout::make_output_section): Likewise.
8248         (Layout::set_segment_offsets): Clear increase_relro when using a
8249         linker script.
8250         * layout.h (class Layout): Add increase_relro method.  Add
8251         increase_relro_ field.  Update declarations.
8252         * output.cc (Output_section::Output_section): Initialize
8253         is_last_relro_ and is_first_non_relro_.
8254         (Output_segment::add_output_section): Group relro sections is
8255         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8256         (Output_segment::maximum_alignment): Remove relro handling.
8257         (Output_segment::set_section_addresses): Add increase_relro
8258         parameter.  Change all callers.  Add initial alignment to align
8259         relro sections on separate page.  Remove old relro handling.
8260         (Output_segment::set_section_list_addresses): Remove in_relro
8261         parameter.  Change all callers.
8262         (Output_segment::set_offset): Add increase parameter.  Change all
8263         callers.  Remove old relro handling.
8264         * output.h (class Output_section): Add new methods: is_last_relro,
8265         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8266         Add is_last_relro_ and is_first_non_relro_ fields.
8267         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8268         Create separate .got.plt section.  Call increase_relro.
8269         * x86_64.cc (Target_x86_64::got_section): Likewise.
8270         * testsuite/relro_script_test.t: Add .got.plt.
8271
8272         PR 10450
8273         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8274         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8275         (Layout::finalize): Call set_dynamic_symbol_size.
8276         (Layout::set_dynamic_symbol_size): New function.
8277         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8278         set_dynamic_symbol_size.
8279
8280         PR 10450
8281         * output.h (class Output_section): Add is_entsize_zero_ field.
8282         * output.cc (Output_section::Output_section): Initialize
8283         is_entsize_zero_.
8284         (Output_section::set_entsize): If two different entsizes are
8285         requested, force it to zero.
8286         (Output_section::add_input_section): Set flags for .debug_str
8287         before updating section flags.  Set entsize.
8288         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8289         and SHF_STRING if all input sections have those flags.
8290
8291 2009-12-29   Rafael Espindola  <espindola@google.com>
8292
8293         * main.cc (main): Fix the sys time reporting.
8294         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8295         reporting.
8296
8297 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8298
8299         * options.cc (General_options::parse_version): Allow -v to exit
8300         without an error if there is nothing to link.
8301
8302 2009-12-29  Ian Lance Taylor  <iant@google.com>
8303
8304         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8305         using a version of gcc before 4.1.
8306         * configure: Rebuild.
8307
8308 2009-12-28  Chris Demetriou  <cgd@google.com>
8309
8310         * attributes.cc (Output_attributes_section_data::do_write): Use
8311         std::vector::front rather than std::vector::data.
8312
8313 2009-12-28  Ian Lance Taylor  <iant@google.com>
8314
8315         * symtab.h (class Symbol_table): Add enum Defined.
8316         * resolve.cc (Symbol_table::should_override): Add defined
8317         parameter.  Change all callers.  Test whether object is NULL
8318         before calling a method on it.
8319         (Symbol_table::report_resolve_problem): Add defined parameter.
8320         Change all callers.
8321         (Symbol_table::should_override_with_special): Likewise.
8322         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8323         parameter.  Change all callers.
8324         (Symbol_table::do_define_in_output_data): Likewise.
8325         (Symbol_table::define_in_output_segment): Likewise.
8326         (Symbol_table::do_define_in_output_segment): Likewise.
8327         (Symbol_table::define_as_constant): Likewise.
8328         (Symbol_table::do_define_as_constant): Likewise.
8329         * script.h (class Symbol_assignment): Add is_defsym parameter to
8330         constructor; change all callers.
8331         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8332         parameter.  Change all callers.  Add is_defsym_ field.
8333         (class Parser_closure): Add parsing_defsym parameter to
8334         constructor; change all callers.  Add parsing_defsym accessor
8335         function.  Add parsing_defsym_ field.
8336
8337 2009-12-28  Ian Lance Taylor  <iant@google.com>
8338
8339         * gold.cc (queue_middle_tasks): Fix formatting.
8340         * object.cc (Relobj::is_section_name_included): Likewise.
8341
8342 2009-12-23  Ian Lance Taylor  <iant@google.com>
8343
8344         * i386.cc (Target_i386::do_calls_non_split): Recognize
8345         -fsplit-stack prologue for a function with a static chain.
8346         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8347         -fsplit-stack prologue when using %r11.
8348
8349 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8350
8351         * options.cc (General_options::parse_version): Make -v continue and do
8352         the link like GNU ld does.
8353
8354 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8355
8356         * Makefile.am (CCFILES): Add timer.cc.
8357         (HFILES): Add timer.h.
8358         * configure.ac: Check for sysconf and times.
8359         * main.cc: include timer.h.
8360         (main): Use Timer instead of get_run_time.
8361         * timer.cc: New.
8362         * timer.h: New.
8363         * workqueue.cc: include timer.h.
8364         (Workqueue::find_and_run_task):
8365         Report user, sys and wall time.
8366         * Makefile.in: Regenerate.
8367         * config.in: Regenerate.
8368         * configure: Regenerate.
8369
8370 2009-12-16  Doug Kwan  <dougkwan@google.com>
8371
8372         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8373         sections.
8374         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8375         relaxed input sections.
8376         * output.cc (Output_section::find_relaxed_input_section): Change
8377         return type to Output_relaxed_input_section pointer.  Adjust code
8378         for new type of relaxed_input_section_map_.
8379         * output.h (Output_section::find_relaxed_input_section): Change
8380         return type to Output_relaxed_input_section pointer.
8381         (Output_section::Output_relaxed_input_section_by_input_section_map):
8382         New type.
8383         (Output_section::relaxed_input_section_map_): Change type to
8384         Output_section::Output_relaxed_input_section_by_input_section_map.
8385         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8386         input section.
8387
8388 2009-12-15  Ian Lance Taylor  <iant@google.com>
8389
8390         * layout.cc (Layout::create_shstrtab): Only write out after input
8391         sections if we are compressing debug sections.
8392
8393 2009-12-15  Ian Lance Taylor  <iant@google.com>
8394
8395         * archive.cc (Archive::add_symbols): Only look up a symbol without
8396         a version if there is, in fact, a version.
8397
8398 2009-12-14  Ian Lance Taylor  <iant@google.com>
8399
8400         Revert -Wshadow changes, all changes from:
8401         2009-12-11  Doug Kwan  <dougkwan@google.com>
8402         2009-12-11  Nick Clifton  <nickc@redhat.com>
8403         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8404
8405 2009-12-11  Doug Kwan  <dougkwan@google.com>
8406
8407         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8408         due to -Wshadow.
8409         * attributes.cc (Object_attribute::size): Ditto.
8410         (Attributes_section_data::size): Ditto.
8411         (Attributes_section_data::Attributes_section_data): Ditto.
8412         (Output_attributes_section_data::do_write): Ditto.
8413         * attributes.h (Object_attribute::set_type): Ditto.
8414         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8415
8416 2009-12-11  Nick Clifton  <nickc@redhat.com>
8417
8418         * archive.cc: Fix shadowed variable warnings.
8419         * arm.cc: Likewise.
8420         * compressed_output.cc: Likewise.
8421         * compressed_output.h: Likewise.
8422         * configure: Likewise.
8423         * dwarf_reader.cc: Likewise.
8424         * dynobj.cc: Likewise.
8425         * dynobj.h: Likewise.
8426         * ehframe.cc: Likewise.
8427         * ehframe.h: Likewise.
8428         * errors.cc: Likewise.
8429         * expression.cc: Likewise.
8430         * fileread.cc: Likewise.
8431         * fileread.h: Likewise.
8432         * freebsd.h: Likewise.
8433         * i386.cc: Likewise.
8434         * icf.cc: Likewise.
8435         * incremental.h: Likewise.
8436         * layout.cc: Likewise.
8437         * layout.h: Likewise.
8438         * mapfile.cc: Likewise.
8439         * merge.cc: Likewise.
8440         * merge.h: Likewise.
8441         * object.cc: Likewise.
8442         * object.h: Likewise.
8443         * options.h: Likewise.
8444         * output.cc: Likewise.
8445         * output.h: Likewise.
8446         * parameters.cc: Likewise.
8447         * plugin.cc: Likewise.
8448         * powerpc.cc: Likewise.
8449         * reduced_debug_output.cc: Likewise.
8450         * reduced_debug_output.h: Likewise.
8451         * reloc.cc: Likewise.
8452         * reloc.h: Likewise.
8453         * resolve.cc: Likewise.
8454         * script-sections.cc: Likewise.
8455         * script.cc: Likewise.
8456         * script.h: Likewise.
8457         * sparc.cc: Likewise.
8458         * symtab.cc: Likewise.
8459         * symtab.h: Likewise.
8460         * target-select.cc: Likewise.
8461         * target-select.h: Likewise.
8462         * token.h: Likewise.
8463         * workqueue.cc: Likewise.
8464         * workqueue.h: Likewise.
8465         * x86_64.cc: Likewise.
8466
8467 2009-12-10  Doug Kwan  <dougkwan@google.com>
8468
8469         * arm.cc (attributes.h): New include.
8470         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8471         (Arm_relobj::~Arm_relobj): Delete object pointed by
8472         attributes_section_data_.
8473         (Arm_relobj::attributes_section_data): New method definition.
8474         (Arm_relobj::attributes_section_data_): New data member declaration.
8475         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8476         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8477         attributes_section_data_.
8478         (Arm_dynobj::attributes_section_data): New method definition.
8479         (Arm_dynobj::attributes_section_data_): New data member declaration.
8480         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8481         initialization value of may_use_blx_ to false.
8482         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8483         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8484         object attributes to compute results instead of hard-coding.
8485         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8486         Target_arm::get_secondary_compatible_arch,
8487         Target_arm::set_secondary_compatible_arch
8488         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8489         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8490         New method declarations.
8491         (Target_arm::get_aeabi_object_attribute): New method definition.
8492         (Target_arm::attributes_section_data_): New data member declaration.
8493         (read_arm_attributes_section): New template definition.
8494         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8495         (Arm_dynobj::do_read_symbols): Ditto.
8496         (Target_arm::do_finalize_sections): Merge attributes sections from
8497         input.  Check for BLX use after attributes section merging.
8498         Fix __exidx_start and __exidx_end visibility.  Create an
8499         .ARM.attributes section if necessary.
8500         (Target_arm::get_secondary_compatible_arch,
8501         Target_arm::set_secondary_compatible_arch,
8502         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8503         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8504         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8505         New method definitions.
8506
8507 2009-12-09  Ian Lance Taylor  <iant@google.com>
8508
8509         * plugin.cc (Plugin::load): Don't cast from void* to a function
8510         pointer.
8511
8512 2009-12-09  Ian Lance Taylor  <iant@google.com>
8513
8514         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8515         information fields.
8516
8517 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8518
8519         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8520         Replace two_file_shared_1.so with two_file_shared_2.so.
8521         * testsuite/Makefile.in: Regenerated.
8522
8523 2009-12-08  Doug Kwan  <dougkwan@google.com>
8524
8525         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8526         (HFILES): Add attributes.h and int_encoding.h.
8527         * Makefile.in: Regenerate.
8528         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8529         function definitions to int_encoding.cc
8530         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8531         prototypes to int_encoding.h
8532         * reduced_debug_output.cc (int_encoding.h): New include.
8533         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8534         function definitions to int_encoding.cc
8535         (insert_into_vector, read_from_pointer): Move template definitions to
8536         int_encoding.h
8537         * attributes.cc: New file.
8538         * attributes.h: New file.
8539         * int_encoding.cc: New file.
8540         * int_encoding.h: New file.
8541
8542 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8543
8544         PR gold/11055
8545         * incremental-dump.cc (dump_incremental_inputs): New.
8546         (main): Use dump_incremental_inputs.
8547
8548 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8549
8550         PR gold/10893
8551         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8552         checking elfcpp::STT_FUNC.
8553         (Target_i386::Relocate::relocate): Likewise.
8554         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8555
8556         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8557         symbols from shared libraries into normal FUNC symbols.
8558
8559         * symtab.h (Symbol): Add is_func and use it.
8560
8561 2009-12-05  Doug Kwan  <dougkwan@google.com>
8562
8563         * arm.cc (Target_arm::arm_info): Initialize new fields
8564         attributes_section and attributes_vendor.
8565         * i386.cc (Target_i386::i386_info): Same.
8566         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8567         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8568         fields attributes_section and attributes_vendor.
8569         * sparc.cc (Target_sparc::sparc_info): Same.
8570         * target.h (Target::attributes_section, Target::attributes_vendor,
8571         Target::is_attributes_section, Target::attribute_arg_type,
8572         Target::attributes_order): New method definitions.
8573         (Target::Target_info::attributes_section,
8574         Target::Target_info::attributes_vendor): New fields.
8575         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8576         virtual method definitions.
8577         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8578         attributes_section and attributes_vendor.
8579         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8580
8581 2009-12-05  Doug Kwan  <dougkwan@google.com>
8582
8583         * arm.cc: Update comments about interworking and stub generation.
8584         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8585         considered as non-PIC.
8586         (Arm_relocate_functions::base_abs): Fix formatting.
8587         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8588         of function to use GOT entry address instead of offset.
8589         (Target_arm::Scan::global): Issue an error if a symbol would need a
8590         PLT does not get one because it is untyped.  Remove code to create
8591         dynamic symbols for relative branches.
8592         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8593         takes unsigned integer instead of boolean.
8594
8595 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8596
8597         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8598         (two_file_test_LDADD): Likewise.
8599         (common_test_1_LDADD): Likewise.
8600         (exception_test_LDADD) Likewise.
8601         (weak_test_LDADD): Likewise.
8602         (many_sections_test_LDADD): Likewise.
8603         (initpri1_LDADD): Likewise.
8604         (script_test_1_LDADD): Likewise.
8605         (script_test_2_LDADD): Likewise.
8606         (justsyms_LDADD): Likewise.
8607         (binary_test_LDADD): Likewise.
8608         (large_LDADD): Likewise.
8609         * testsuite/Makefile.in: Regenerated.
8610
8611 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8612
8613         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8614         (Symbol_table::override_with_special): Likewise.
8615         (Symbol_table::add_from_object): Likewise.
8616
8617 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8618
8619         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8620         Don't set the data_offset twice.
8621
8622 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8623
8624         * testsuite/Makefile.in: Regenerate.
8625
8626 2009-12-03  Doug Kwan  <dougkwan@google.com>
8627
8628         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8629         (Target_arm::do_finalize_sections): Add parameter for symbol table
8630         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8631         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8632         parameter for symbol table pointer.
8633         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8634         an additional parameter for a pointer to symbol table.
8635         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8636         parameter for a symbol table pointer.
8637         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8638         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8639         Ditto.
8640         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8641         parameter for a symbol table pointer.
8642
8643 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8644
8645         * incremental.cc (Incremental_inputs_header)
8646         (Incremental_inputs_header_write, Incremental_inputs_entry)
8647         (Incremental_inputs_entry_write): Move ...
8648         * incremental.h (Incremental_inputs_header)
8649         (Incremental_inputs_header_write, Incremental_inputs_entry)
8650         (Incremental_inputs_entry_write): here.
8651
8652 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8653
8654         * incremental.cc (make_sized_incremental_binary): Set the target.
8655         Error if it is incompatible.
8656         * output.h (Output_file): Add filename method.
8657
8658 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8659
8660         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8661         from the get_* methods.
8662
8663 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8664
8665         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8666         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8667         Write 0 for the data_offset of scripts.
8668
8669 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8670
8671         * testsuite/Makefile.am: Add the incremental_test.sh test.
8672         * testsuite/incremental_test.sh: New.
8673         * testsuite/incremental_test_1.c: New.
8674         * testsuite/incremental_test_2.c: New.
8675
8676 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8677
8678         * incremental-dump.cc (main): Fix typos.
8679
8680 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8681
8682         PR gold/11025
8683         * incremental-dump.cc (main): Use llu to print 64 bit values.
8684
8685 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8686             H.J. Lu  <hongjiu.lu@intel.com>
8687
8688         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8689         $(LIBDL).
8690         (incremental_dump_LDADD): Likewise.
8691         * Makefile.in: Regenerated.
8692
8693 2009-11-25  Doug Kwan  <dougkwan@google.com>
8694
8695         Revert:
8696
8697         2009-11-25  Doug Kwan  <dougkwan@google.com>
8698
8699                 * arm.cc (Target_arm::Target_arm): Move method definition
8700                 outside of class definition.  Add code to handle
8701                 --target1-rel, --target1-abs and --target2= options.
8702                 (Target_arm::get_reloc_reloc_type): Change method to be
8703                 non-static and const.
8704                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8705                 New data member declaration.
8706                 (Target_arm::Scan::local, Target_arm::Scan::global,
8707                 Target_arm::Relocate::relocate,
8708                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8709                 Adjust call to Target_arm::get_real_reloc_type.
8710                 (Target_arm::get_real_reloc_type): Use command line options
8711                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8712                 * options.h (--target1-rel, --target1-abs, --target2): New
8713                 ARM-only options.
8714
8715 2009-11-25  Doug Kwan  <dougkwan@google.com>
8716
8717         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8718         class definition.  Add code to handle --target1-rel, --target1-abs
8719         and --target2= options.
8720         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8721         and const.
8722         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8723         member declaration.
8724         (Target_arm::Scan::local, Target_arm::Scan::global,
8725         Target_arm::Relocate::relocate,
8726         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8727         call to Target_arm::get_real_reloc_type.
8728         (Target_arm::get_real_reloc_type): Use command line options to
8729         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8730         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8731         options.
8732
8733 2009-11-25  Doug Kwan  <dougkwan@google.com>
8734
8735         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8736         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8737         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8738         formatting.
8739         (Arm_relocate_functions::thm_call): Replace body with a call to
8740         Arm_relocate_functions::thumb_branch_common.
8741         (Arm_relocate_functions::thm_jump24,
8742         Arm_relocate_functions::thm_xpc22): New method definitions.
8743         (Arm_relocate_functions::thumb_branch_common): New method definition.
8744         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8745         operator.
8746         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8747         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8748
8749 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8750
8751         * Makefile.am: Build incremental-dump
8752         * Makefile.in: Regenerate.
8753         * incremental-dump.cc: New.
8754         * incremental.cc (Incremental_inputs_header_data,
8755         Incremental_inputs_entry_data): Move to incremental.h
8756         * incremental.h: (Incremental_inputs_header_data,
8757         Incremental_inputs_entry_data): Move from incremental.cc
8758
8759 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8760
8761         * incremental.cc (Incremental_inputs_header,
8762         Incremental_inputs_header_write, Incremental_inputs_entry,
8763         Incremental_inputs_entry_write): Add a typedef with the data type.
8764
8765 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8766
8767         * incremental.cc (Incremental_inputs_header,
8768         Incremental_inputs_header_write, Incremental_inputs_entry,
8769         Incremental_inputs_entry_write): Update comment about which
8770         type has the filed descriptions.
8771
8772 2009-11-15  Doug Kwan  <dougkwan@google.com>
8773
8774         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8775         (Arm_relocate_functions::arm_branch_common): Change method defintion
8776         in class definition to a method declaration and update list of formal
8777         parameters.
8778         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8779         Arm_relocation_functions::jump24): Adjust call to
8780         Arm_relocate_functions::arm_branch_common.  Update list of formal
8781         parameters.
8782         (Arm_relocate_functions::xpc25): New method definition.
8783         (Arm_relocate_functions::arm_branch_common): Move method defintion
8784         out from class definition.  Use stubs for mode-switching and extending
8785         branch ranges.
8786         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8787         specially.  Change code to enable use of stubs in ARM branches.
8788
8789 2009-11-10  Doug Kwan  <dougkwan@google.com>
8790
8791         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8792         in method declaration.
8793         (Target_arm::relocate_stub): New method declaration.
8794         (Target_arm::default_target): Change to return a pointer instead of
8795         a const reference.
8796         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8797         Target_arm::default_target.
8798         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8799         method definition.
8800         (Target_arm::relocate_section): Adjust view.
8801         (Target_arm::relocate_stub): New method definition.
8802
8803 2009-11-10  Doug Kwan  <dougkwan@google.com>
8804
8805         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8806         a format warning.
8807         * incremental.cc (open_incremental_binary): Initialized local
8808         variables to avoid warnings.
8809         * object.cc (make_elf_object): Ditto.
8810         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8811         a format warning.
8812
8813 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8814
8815         PR gold/10930
8816         * testsuite/plugin_test.c: Include "config.h".
8817
8818 2009-11-09  Doug Kwan  <dougkwan@google.com>
8819
8820         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8821         (arm_symbol_value): Remove.
8822         (Arm_relocate_functions::arm_branch_common,
8823         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8824         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8825         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8826         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8827         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8828         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8829         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8830         Arm_relocate_functions::thm_mobw_abs_nc,
8831         Arm_relocate_functions::thm_mov_abs,
8832         Arm_relocate_functions::movw_prel_nc,
8833         Arm_relocate_functions::thm_movt_abs,
8834         Arm_relocate_functions::movt_prel,
8835         Arm_relocate_functions::thm_movw_prel_nc,
8836         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8837         (Target_arm::Relocate::relocate): Only decompose address into two
8838         parts if relocation type uses the thumb-bit and pass the actual
8839         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8840         calls to methods in Arm_relocate_functions for this change.
8841
8842 2009-11-08  Ian Lance Taylor  <iant@google.com>
8843
8844         PR 10925
8845         * reloc.cc: Instantiate
8846         Sized_relobj::initialize_input_to_output_maps and
8847         Sized_relobj:free_input_to_output_maps.
8848
8849 2009-11-06  Ian Lance Taylor  <iant@google.com>
8850
8851         PR 10876
8852         * defstd.cc (in_segment): Set only_if_ref true for "end".
8853
8854 2009-11-06  Doug Kwan  <dougkwan@google.com>
8855
8856         * arm.cc (class Reloc_stub): Correct a comment.
8857         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8858         (Target_arm::scan_section_for_stubs): New method declaration.
8859         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8860         Change methods from private to protected.
8861         (Target_arm::do_may_relax): New method definition.
8862         (Target_arm::do_relax, Target_arm::group_sections,
8863         Target_arm::scan_reloc_for_stub,
8864         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8865         (Target_arm::arm_input_section_map_): New data member declaration.
8866         (Target_arm::scan_reloc_for_stub,
8867         Target_arm::scan_reloc_section_for_stubs,
8868         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8869         Target_arm::do_relax): New method definitions.
8870
8871 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8872
8873         * configure.ac: Check for (struct stat)::st_mtim
8874         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8875         * config.in: Regenerate.
8876         * configure: Regenerate.
8877
8878 2009-11-05  Ian Lance Taylor  <iant@google.com>
8879
8880         PR 10910
8881         * output.cc (Output_segment::add_output_section): Add missing
8882         return statement.
8883
8884 2009-11-04  Ian Lance Taylor  <iant@google.com>
8885
8886         PR 10880
8887         * object.h (class Object): Add is_needed and set_is_needed
8888         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8889         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8890         defined in a dynamic object and referenced by a regular object,
8891         set is_needed for the dynamic object.
8892         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8893         if the file is marked with as_needed and it is not needed.
8894
8895 2009-11-04  Ian Lance Taylor  <iant@google.com>
8896
8897         PR 10887
8898         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8899         tags if data is discarded by linker script.
8900         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8901         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8902         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8903         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8904
8905 2009-11-04  Ian Lance Taylor  <iant@google.com>
8906
8907         * layout.cc (Layout::get_output_section): Add is_interp and
8908         is_dynamic_linker_section parameters.  Change all callers.
8909         (Layout::choose_output_section): Likewise.
8910         (Layout::make_output_section): Likewise.
8911         (Layout::add_output_section_data): Add is_dynamic_linker_section
8912         parameter.  Change all callers.
8913         * layout.h (class Layout): Update declarations.
8914         * output.h (class Output_section): Add is_interp, set_is_interp,
8915         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8916         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8917         generate_code_fills_at_write_ to a bitfield.
8918         * output.cc (Output_section::Output_sections): Initialize new
8919         fields.
8920         (Output_segment::add_output_section): Add do_sort parameter.
8921         Change all callers.
8922
8923 2009-11-03  Ian Lance Taylor  <iant@google.com>
8924
8925         PR 10860
8926         * options.h (class General_options): Add --warn-common.
8927         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8928         merging two common symbols.
8929         (Symbol_table::should_override): Handle --warn-common when merging
8930         a common symbol with a defined symbol.  Use report_resolve_problem
8931         for multiple definitions.
8932         (Symbol_table::report_resolve_problem): New function.
8933         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8934
8935 2009-11-03  Doug Kwan  <dougkwan@google.com>
8936
8937         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8938         stub_factory_.
8939         (Target_arm::stub_factory): New method definition.
8940         (Target_arm::new_arm_input_section,
8941         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8942         Target_arm::reloc_uses_thumb_bit): New method declarations.
8943         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8944         New type definitions.
8945         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8946         member declarations.
8947         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8948         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8949         New method definitions.
8950
8951 2009-11-03  Ian Lance Taylor  <iant@google.com>
8952
8953         * options.h (class General_options): Add --warn_constructors.
8954
8955 2009-11-03  Ian Lance Taylor  <iant@google.com>
8956
8957         PR 10893
8958         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8959         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8960
8961 2009-11-03  Ian Lance Taylor  <iant@google.com>
8962
8963         PR 10895
8964         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8965         --msgid-bugs-address.
8966         (install-pdf): New target.
8967         (install-data_yes): Look up one directory to find mkinstalldirs.
8968
8969 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8970
8971         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8972         tree.
8973
8974 2009-10-30  Doug Kwan  <dougkwan@google.com>
8975
8976         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8977
8978 2009-10-30  Doug Kwan  <dougkwan@google.com>
8979
8980         * arm.cc (Stub_addend_reader): New struct template definition
8981         and partial specializations.
8982         (Stub_addend_reader::operator()): New method definition for a
8983         partially specialized template.
8984
8985 2009-10-30  Doug Kwan  <dougkwan@google.com>
8986
8987         * arm.cc (Arm_relobj::processor_specific_flags): New method
8988         definition.
8989         (Arm_relobj::do_read_symbols): New method declaration.
8990         (Arm_relobj::processor_specific_flags_): New data member declaration.
8991         (Arm_dynobj): New class definition.
8992         (Target_arm::do_finalize_sections): Add input_objects parameter.
8993         (Target_arm::do_adjust_elf_header): New method declaration.
8994         (Target_arm::are_eabi_versions_compatible,
8995         (Target_arm::merge_processor_specific_flags): New method declaration.
8996         (Target_arm::do_make_elf_object): New overloaded method definitions
8997         and declaration.
8998         (Arm_relobj::do_read_symbols): New method definition.
8999         (Arm_dynobj::do_read_symbols): Ditto.
9000         (Target_arm::do_finalize_sections): Add input_objects parameters.
9001         Merge processor-specific flags from all input objects.
9002         (Target_arm::are_eabi_versions_compatible,
9003         Target_arm::merge_processor_specific_flags,
9004         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9005         New method definitions.
9006         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9007         Input_objects pointer type parameter.
9008         * layout.cc (Layout::finalize): Pass input objects to target's.
9009         finalize_sections function.
9010         * output.cc (Output_file_header::do_sized_write): Set ELF file
9011         header's processor-specific flags.
9012         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9013         Input_objects pointer type parameter.
9014         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9015         * target.h (Input_objects): New forward class declaration.
9016         (Target::processor_specific_flags,
9017         Target::are_processor_specific_flags_sect): New method definitions.
9018         (Target::finalize_sections): Add input_objects parameter.
9019         (Target::Target): Initialize processor_specific_flags_ and
9020         are_processor_specific_flags_set_.
9021         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9022         parameter.
9023         (Target::set_processor_specific_flags): New method definition.
9024         (Target::processor_specific_flags_,
9025         Target::are_processor_specific_flags_set_): New data member
9026         declarations.
9027         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9028         Input_objects pointer type parameter.
9029
9030 2009-10-30  Doug Kwan  <dougkwan@google.com>
9031
9032         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9033
9034 2009-10-28  Ian Lance Taylor  <iant@google.com>
9035
9036         * object.h (class Relobj): Drop options parameter from
9037         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9038         do_scan_relocs, do_relocate.  Change all callers.
9039         (class Sized_relobj): Drop options parameters from
9040         do_gc_process_relocs, do_scan_relocs, do_relocate,
9041         do_relocate_sections, relocate_sections, emit_relocs_scan,
9042         emit_relocs_scan_reltype.  Change all callers.
9043         (struct Relocate_info): Remove options field and all references to
9044         it.
9045         * reloc.h (class Read_relocs): Remove options constructor
9046         parameter and options_ field.  Change all callers.
9047         (class Gc_process_relocs, class Scan_relocs): Likewise.
9048         (class Relocate_task): Likewise.
9049         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9050         all callers.
9051         (scan_relocatable_relocs): Likewise.
9052         * target.h (class Sized_target): Remove options parameter from
9053         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9054         all callers.
9055         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9056         callers.
9057         * arm.cc: Update functions to remove options parameters.
9058         * i386.cc: Likewise.
9059         * powerpc.cc: Likewise.
9060         * sparc.cc: Likewise.
9061         * x86_64.cc: Likewise.
9062         * testsuite/testfile.cc: Likewise.
9063
9064 2009-10-28  Doug Kwan  <dougkwan@google.com>
9065
9066         * arm.cc (Arm_relobj): New class definition.
9067         (Arm_relobj::scan_sections_for_stubs,
9068         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9069         New method definitions.
9070
9071 2009-10-28  Cary Coutant  <ccoutant@google.com>
9072
9073         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9074         (Plugin::cleanup_done_): New member.
9075         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9076         (Plugin_manager::cleanup_done_): Remove.
9077         (Plugin_manager::add_input_file): Edit error message.
9078         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9079         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9080
9081 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9082
9083         * fileread.cc: (File_read::View::~View): Use the new
9084         data_ownership_ filed.
9085         (File_read::~File_read): Dispose the new whole_file_view_.
9086         (File_read::open): Mmap the whole file if needed.
9087         (File_read::open): Use whole_file_view_ instead of contents_.
9088         (File_read::find_view): Use whole_file_view_ if applicable.
9089         (File_read::do_read): Use whole_file_view_ instead of contents_.
9090         (File_read::make_view): Use whole_file_view_ instead of contents_,
9091         update File_read::View::View call.
9092         (File_read::find_or_make_view): Update File_read::View::View
9093         call.
9094         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9095         remove contents_
9096         (File_read::View::Data_ownership): New enum.
9097         (File_read::View::View): Replace bool mapped_ with Data_ownership
9098         argument.
9099         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9100         (File_read::View::data_ownership_): New field.
9101         (File_read::contents_): Remove (replaced by whole_file_view_).
9102         (File_read::whole_file_view_): New field.
9103         * options.h (class General_options): Add --keep-files-mapped.
9104
9105 2009-10-27  Cary Coutant  <ccoutant@google.com>
9106
9107         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9108         * testsuite/Makefile.am (plugin_test_5): New test case.
9109         * testsuite/Makefile.in: Regenerate.
9110
9111 2009-10-25  Doug Kwan  <dougkwan@google.com>
9112
9113         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9114         from private to protected to allow access by child class.
9115         (Sized_relobj::do_relocate_sections): New method declaration.
9116         (Sized_relobj::relocate_sections): Virtualize.
9117         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9118         Sized_relobj::relocate_sections.  Instantiate template explicitly
9119         for different target sizes and endianity.
9120
9121 2009-10-24  Doug Kwan  <dougkwan@google.com>
9122
9123         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9124         (Arm_input_section::as_arm_input_section): New method.
9125         (Arm_output_section): New class definition.
9126         (Arm_output_section::create_stub_group,
9127         Arm_output_section::group_sections): New method definitions.
9128
9129 2009-10-22  Doug Kwan  <dougkwan@google.com>
9130
9131         * arm.cc (Arm_input_section): New class definition.
9132         (Arm_input_section::init, Arm_input_section:do_write,
9133         Arm_input_section::set_final_data_size,
9134         Arm_input_section::do_reset_address_and_file_offset): New method
9135         definitions.
9136
9137 2009-10-21  Doug Kwan  <dougkwan@google.com>
9138
9139         * arm.cc (Stub_table, Arm_input_section): New forward class
9140         declarations.
9141         (Stub_table): New class defintion.
9142         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9143         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9144         New method definition.
9145
9146 2009-10-21  Doug Kwan  <dougkwan@google.com>
9147
9148         * arm.cc: Update copyright comments.
9149         (Target_arm): New forward class template declaration.
9150         (Arm_address): New type.
9151         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9152         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9153         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9154         constants.
9155         (Insn_template): Same.
9156         (DEF_STUBS): New macro.
9157         (Stub_type): New enum type.
9158         (Stub_template): New class definition.
9159         (Stub): Same.
9160         (Reloc_stub): Same.
9161         (Stub_factory): Same.
9162         (Target_arm::Target_arm): Initialize may_use_blx_ and
9163         should_force_pic_veneer_.
9164         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9165         Target_arm::should_force_pic_veneer,
9166         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9167         Target_arm::using_thumb_only, Target_arm:;default_target): New
9168         method defintions.
9169         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9170         New data member declarations.
9171         (Insn_template::size, Insn_template::alignment): New method defintions.
9172         (Stub_template::Stub_template): New method definition.
9173         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9174         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9175         (Stub_factory::Stub_factory): New method definition.
9176         * gold.h (string_hash): New template.
9177         * output.h (Input_section_specifier::hash_value): Use
9178         gold::string_hash.
9179         (Input_section_specifier::string_hash): Remove.
9180         * stringpool.cc (Stringpool_template::string_hash): Use
9181         gold::string_hash.
9182
9183 2009-10-20  Doug Kwan  <dougkwan@google.com>
9184
9185         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9186         symbols of relaxed input sections.
9187         * output.h (Output_section::find_relaxed_input_section): Make
9188         method public.
9189
9190 2009-10-16  Doug Kwan  <dougkwan@google.com>
9191
9192         * dynobj.cc (Versions::Versions): Initialize version_script_.
9193         Only insert base version symbol definition for a shared object
9194         if version script defines any version versions.
9195         (Versions::define_base_version): New method definition.
9196         (Versions::add_def): Check that base version is not needed.
9197         (Versions::add_need): Define base version lazily.
9198         * dynobj.h (Versions::define_base_version): New method declaration.
9199         (Versions::needs_base_version_): New data member declaration.
9200         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9201         (check_DATA): Add no_version_test.stdout.
9202         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9203         New make rules.
9204         * testsuite/Makefile.in: Regenerate.
9205         * testsuite/no_version_test.c: New file.
9206         * testsuite/no_version_test.sh: Ditto.
9207
9208 2009-10-16  Doug Kwan  <dougkwan@google.com>
9209
9210         * expression.cc (class Segment_start_expression): New class definition.
9211         (Segment_start_expression::value): New method definition.
9212         (script_exp_function_segment_start): Return a new
9213         Segment_start_expression.
9214         * gold/script-c.h (script_saw_segment_start_expression): New function
9215         prototype.
9216         * script-sections.cc (Script_sections::Script_sections): Initialize
9217         SAW_SEGMENT_START_EXPRESSION_ to false.
9218         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9219         and -Tbbs options to specify section addresses if given in
9220         command line and no SEGMENT_START expression is seen in a script.
9221         * script-sections.h (Script_sections::saw_segment_start_expression,
9222         Script_sections::set_saw_segment_start_expression): New method
9223         definition.
9224         (Script_sections::saw_segment_start_expression_): New data member
9225         declaration.
9226         * script.cc (script_saw_segment_start_expression): New function.
9227         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9228         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9229         script_test_7.sh and script_test_8.sh.
9230         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9231         script_test_8.stdout.
9232         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9233         (script_test_6, script_test_6.stdout, script_test_7,
9234         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9235         * Makefile.in: Regenerate.
9236         * testsuite/script_test_6.sh: New file.
9237         * testsuite/script_test_6.t: Same.
9238         * testsuite/script_test_7.sh: Same.
9239         * testsuite/script_test_7.t: Same.
9240         * testsuite/script_test_8.sh: Same.
9241
9242 2009-10-16  Doug Kwan  <dougkwan@google.com>
9243
9244         * output.cc (Output_segment::set_section_list_address): Cast
9245         expressions to unsigned long long type to avoid format warnings.
9246
9247 2009-10-15  Ian Lance Taylor  <iant@google.com>
9248
9249         * script.cc (Script_options::add_symbol_assignment): Always add a
9250         dot assignment to script_sections_.
9251         * script-sections.cc (Script_sections::add_dot_assignment):
9252         Initialize if necessary.
9253
9254         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9255         program headers with no load segment if there is a linker script.
9256
9257         * layout.cc (Layout::set_segment_offsets): Align the file offset
9258         to the segment aligment for -N or -n with no load segment.
9259         * output.cc (Output_segment::add_output_section): Don't crash if
9260         the first section is a TLS section.
9261         (Output_segment::set_section_list_addresses): Print an error
9262         message if the address moves backward in a linker script.
9263         * script-sections.cc
9264         (Output_section_element_input::set_section_addresses): Don't
9265         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9266         (Orphan_output_section::set_section_addresses): Likewise.
9267
9268 2009-10-15  Doug Kwan  <dougkwan@google.com>
9269
9270         * layout.cc (Layout::finish_dynamic_section): Generate tags
9271         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9272         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9273         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9274
9275 2009-10-14  Ian Lance Taylor  <iant@google.com>
9276
9277         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9278         fields.
9279         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9280         data_shdr fields of relinfo.
9281         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9282         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9283         R_386_TLS_LDO_32, adjust based on section flags.
9284         (Target_i386::Relocate::fix_up_ldo): Remove.
9285
9286 2009-10-13  Ian Lance Taylor  <iant@google.com>
9287
9288         Add support for -pie.
9289         * options.h (class General_options): Add -pie and
9290         --pic-executable.
9291         (General_options::output_is_position_independent): Test -pie.
9292         (General_options::output_is_executable): Return true if not shared
9293         and not relocatable.
9294         (General_options::output_is_pie): Remove.
9295         * options.cc (General_options::finalize): Reject incompatible uses
9296         of -pie.
9297         * gold.cc (queue_middle_tasks): A -pie link is not static.
9298         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9299         * symtab.cc (Symbol::final_value_is_known): Return false if
9300         output_is_position_independent.
9301         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9302         output_is_position_independent.
9303         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9304         output_is_position_independent.
9305         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9306         output_is_position_independent.
9307         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9308         two_file_pie_test.
9309         (basic_pie_test.o, basic_pie_test): New targets.
9310         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9311         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9312         (two_file_pie_test): New target.
9313         * testsuite/Makefile.in: Rebuild.
9314         * README: Remove note saying that -pie is not supported.
9315
9316 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9317
9318         * options.h (class General_options): Add -init and -fini.
9319         * layout.cc (Layout::finish_dynamic_section): Emit
9320         given init and fini functions.
9321
9322 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9323
9324         * gc.h (gc_process_relocs): Check if icf is enabled using new
9325         function.
9326         * gold.cc (queue_initial_tasks): Likewise.
9327         (queue_middle_tasks): Likewise.
9328         * object.cc (do_layout): Likewise.
9329         * symtab.cc (is_section_folded): Likewise.
9330         * main.cc (main): Likewise.
9331         * reloc.cc (Read_relocs::run): Likewise.
9332         (Sized_relobj::do_scan_relocs): Likewise.
9333         * icf.cc (is_function_ctor_or_dtor): New function.
9334         (Icf::find_identical_sections): Check if function is ctor or dtor when
9335         safe icf is chosen.
9336         * options.h (General_options::icf): Change option to be an enum.
9337         (Icf_status): New enum.
9338         (icf_enabled): New method.
9339         (icf_safe_folding): New method.
9340         (set_icf_status): New method.
9341         (icf_status_): New variable.
9342         * (options.cc) (General_options::finalize): Set icf_status_.
9343         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9344         icf_test and icf_keep_unique_test to use the --icf enum flag.
9345         * testsuite/icf_safe_test.sh: New file.
9346         * testsuite/icf_safe_test.cc: New file.
9347
9348 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9349
9350         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9351         includes to gc.h and icf.h.
9352         * arm.cc: Include gc.h.
9353         * gold.cc: Likewise.
9354         * i386.cc: Likewise.
9355         * powerpc.cc: Likewise.
9356         * sparc.cc: Likewise.
9357         * x86_64.cc: Likewise.
9358         * gc.h: Include icf.h.
9359
9360 2009-10-11  Ian Lance Taylor  <iant@google.com>
9361
9362         * plugin.cc: Include "gold.h" before other header files.
9363
9364 2009-10-10  Chris Demetriou  <cgd@google.com>
9365
9366         * options.h (Input_file_argument::Input_file_type): New enum.
9367         (Input_file_argument::is_lib_): Replace with...
9368         (Input_file_argument::type_): New member.
9369         (Input_file_argument::Input_file_argument): Take Input_file_type
9370         'type' rather than boolean 'is_lib' as second argument.
9371         (Input_file_argument::is_lib): Use type_.
9372         (Input_file_argument::is_searched_file): New function.
9373         (Input_file_argument::may_need_search): Handle is_searched_file.
9374         * options.cc (General_options::parse_library): Support -l:filename.
9375         (General_options::parse_just_symbols): Update for Input_file_argument
9376         changes.
9377         (Command_line::process): Likewise.
9378         * archive.cc (Archive::get_file_and_offset): Likewise.
9379         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9380         * script.cc (read_script_file, script_add_file): Likewise.
9381         * fileread.cc (Input_file::Input_file): Likewise.
9382         (Input_file::will_search_for): Handle is_searched_file.
9383         (Input_file::open): Likewise.
9384         * readsyms.cc (Read_symbols::get_name): Likewise.
9385         * testsuite/Makefile.am (searched_file_test): New test.
9386         * testsuite/Makefile.in: Regenerate.
9387         * testsuite/searched_file_test.cc: New file.
9388         * testsuite/searched_file_test_lib.cc: New file.
9389
9390 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9391             Ian Lance Taylor  <iant@google.com>
9392
9393         * descriptor.cc: Include <cstdio> and "binary-io.h".
9394         (Descriptors::open): Open the files in binary mode always.
9395         * script.cc (Lex::get_token): Treat \r as whitespace.
9396
9397 2009-10-09  Ian Lance Taylor  <iant@google.com>
9398
9399         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9400
9401 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9402             Ian Lance Taylor  <iant@google.com>
9403
9404         * configure.ac: Check for readv function also.
9405         * fileread.cc (readv): Define if not HAVE_READV.
9406         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9407         does not exist.
9408         * config.in: Regenerate.
9409         * configure: Regenerate.
9410
9411 2009-10-09  Doug Kwan  <dougkwan@google.com>
9412
9413         * layout.cc (Layout::make_output_section): Call target hook to make
9414         ordinary output section.
9415         (Layout::finalize): Adjust parameter list of call the
9416         Target::may_relax().
9417         * layout.h (class Layout::section_list): New method.
9418         * merge.h (Output_merge_base::entsize): Change visibility to public.
9419         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9420         New methods.
9421         (Output_merge_string::do_is_string): New method.
9422         * object.cc (Sized_relobj::do_setup): renamed from
9423         Sized_relobj::set_up.
9424         * object.h (Sized_relobj::adjust_shndx,
9425         Sized_relobj::initializ_input_to_output_maps,
9426         Sized_relobj::free_input_to_output_maps): Change visibilities to
9427         protected.
9428         (Sized_relobj::setup): Virtualize.
9429         (Sized_relobj::do_setup): New method declaration.
9430         (Sized_relobj::invalidate_section_offset,
9431         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9432         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9433         * options.cc (parse_int): New function.
9434         * options.h (parse_int): New declaration.
9435         (DEFINE_int): New macro.
9436         (stub_group_size): New option.
9437         * output.cc (Output_section::Output_section): Initialize memebers
9438         merge_section_map_, merge_section_by_properties_map_,
9439         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9440         (Output_section::add_input_section): Handled deferred code-fill
9441         generation and remove an old comment.
9442         (Output_section::add_relaxed_input_section): New method definition.
9443         (Output_section::add_merge_input_section): Use merge section by
9444         properties map to speed to search.  Update merge section maps
9445         as appropriate.
9446         (Output_section::build_relaxation_map): New method definition.
9447         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9448         Same.
9449         (Output_section::relax_input_section): Renamed to
9450         Output_section::convert_input_sections_to_relaxed_sections and change
9451         interface to take a vector of pointers to relaxed sections.
9452         (Output_section::find_merge_section,
9453         Output_section::find_relaxed_input_section): New method definitions.
9454         (Output_section::is_input_address_mapped,
9455         Output_section::output_offset, Output_section::output_address):
9456         Use output section data maps to speed up searching.
9457         (Output_section::find_starting_output_address): Add comments.
9458         (Output_section::do_write,
9459         Output_section::write_to_postprocessing_buffer): Do code-fill
9460         generation as appropriate.
9461         (Output_section::get_input_sections): Invalidate relaxed input section
9462         map.
9463         (Output_section::restore_states): Adjust type of checkpoint .
9464         Invalidate relaxed input section map.
9465         * output.h (Output_merge_base): New class declaration.
9466         (Input_section_specifier): New class defintion.
9467         (class Output_relaxed_input_section) Change base class to
9468         Output_section_data_build.
9469         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9470         base class initializer.
9471         (Output_section::add_relaxed_input_section): New method declaration.
9472         (Output_section::Input_section): Change visibility to protected.
9473         (Output_section::Input_section::relobj,
9474         Output_section::Input_section::shndx): Handle relaxed input sections.
9475         Output_section::input_sections) Change visibility to protected.  Also
9476         define overload to return a non-const pointer.
9477         (Output_section::Merge_section_properties): New class defintion.
9478         (Output_section::Merge_section_by_properties_map,
9479         Output_section::Output_section_data_by_input_section_map,
9480         Output_section::Relaxation_map): New types.
9481         (Output_section::relax_input_section): Rename method to
9482         Output_section::convert_input_sections_to_relaxed_sections and change
9483         interface to take a vector of relaxed section pointers.
9484         (Output_section::find_merge_section,
9485         Output_section::find_relaxed_input_section,
9486         Output_section::build_relaxation_map,
9487         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9488         New method declarations.
9489         (Output_section::merge_section_map_
9490         Output_section::merge_section_by_properties_map_,
9491         Output_section::relaxed_input_section_map_,
9492         Output_section::is_relaxed_input_section_map_valid_,
9493         Output_section::generate_code_fills_at_write_): New data members.
9494         * script-sections.cc
9495         (Output_section_element_input::set_section_addresses): Call
9496         current_data_size and addralign methods of relaxed input sections.
9497         (Orphan_output_section::set_section_addresses): Call current_data_size
9498         and addralign methods of relaxed input sections.
9499         * symtab.cc (Symbol_table::compute_final_value): Extract template
9500         from the body of Symbol_table::sized_finalize_symbol.
9501         (Symbol_table::sized_finalized_symbol): Call
9502         Symbol_table::compute_final_value.
9503         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9504         (Symbol_table::compute_final_value): New templated method declaration.
9505         * target.cc (Target::do_make_output_section): New method defintion.
9506         * target.h (Target::make_output_section): New method declaration.
9507         (Target::relax): Add more parameters for input objects, symbol table
9508         and layout.  Adjust call to do_relax.
9509         (Target::do_make_output_section): New method declaration.
9510         (Target::do_relax): Add parameters for input objects, symbol table
9511         and layout.
9512
9513 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9514
9515         * pread.c: Include stdio.h.
9516
9517 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9518
9519         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9520         defined.
9521
9522 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9523
9524         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9525         Change read_shndx type to unsigned int.
9526         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9527         int.
9528         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9529         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9530         Change read_shndx type to unsigned int.
9531         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9532         int.
9533         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9534         * layout.cc (Layout::create_symtab_sections): Cast the result of
9535         local_symcount * symsize to off_t in the gold_assert.
9536
9537 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9538
9539         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9540         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9541         R_ARM_BASE_ABS.
9542         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9543         (Arm_relocate_functions::thm_abs5): New function.
9544         (Arm_relocate_functions::abs12): New function.
9545         (Arm_relocate_functions::abs16): New function.
9546         (Arm_relocate_functions::base_abs): New function.
9547         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9548         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9549         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9550         R_ARM_BASE_ABS.
9551         (Scan::global): Likewise.
9552         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9553         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9554         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9555         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9556         R_ARM_BASE_ABS.
9557
9558 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9559
9560         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9561         (Arm_relocate_functions::movt_prel): New function.
9562         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9563         (Arm_relocate_functions::thm_movt_prel): New function.
9564         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9565         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9566         (Scan::global, Relocate::relocate): Likewise.
9567         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9568
9569 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9570
9571         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9572         Incremental_checker.
9573         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9574         unsigned int.
9575         (class Incremental_inputs_header): New class.
9576         (Incremental_inputs_header_writer): Edit comment.
9577         (Incremental_inputs_entry): New class.
9578         (Incremental_inputs_entry_writer): Edit comment.
9579         (Sized_incremental_binary::do_find_incremental_inputs_section):
9580         Add *strtab_shndx parameter, fill it.
9581         (Sized_incremental_binary::do_check_inputs): New method.
9582         (Incremental_checker::can_incrementally_link_output_file): Use
9583         Sized_incremental_binary::check_inputs.
9584         (Incremental_inputs::report_command_line): Save command line in
9585         command_line_.
9586         * incremental.h:
9587         (Incremental_binary::find_incremental_inputs_section): New
9588         method.
9589         (Incremental_binary::do_find_incremental_inputs_section): Add
9590         strtab_shndx parameter.
9591         (Incremental_binary::do_check_inputs): New pure virtual method.
9592         (Sized_incremental_binary::do_check_inputs): Declare.
9593         (Incremental_checker::Incremental_checker): Add incremental_inputs
9594         parameter, use it to initialize incremental_inputs_.
9595         (Incremental_checker::incremental_inputs_): New field.
9596         (Incremental_checker::command_line): New method.
9597         (Incremental_checker::inputs): New method.
9598         (Incremental_checker::command_line_): New field.
9599
9600 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9601
9602         * incremental.cc: Include <cstdarg> and "target-select.h".
9603         (vexplain_no_incremental): New function.
9604         (explain_no_incremental): New function.
9605         (Incremental_binary::error): New method.
9606         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9607         method.
9608         (make_sized_incremental_binary): New function.
9609         (open_incremental_binary): New function.
9610         (can_incrementally_link_file): Add checks if output is ELF and has
9611         inputs section.
9612         * incremental.h: Include "elfcpp_file.h" and "output.h".
9613         (Incremental_binary): New class.
9614         (Sized_incremental_binary): New class.
9615         (open_incremental_binary): Declare.
9616         * object.cc (is_elf_object): Use
9617         elfcpp::Elf_recognizer::is_elf_file.
9618         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9619         * output.h (Output_file::filesize): New method.
9620
9621 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9622
9623         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9624         New function.
9625         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9626         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9627         function.
9628         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9629         function.
9630         (Arm_relocate_functions::movw_abs_nc): New function.
9631         (Arm_relocate_functions::movt_abs): New function.
9632         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9633         (Arm_relocate_functions::thm_movt_abs): New function.
9634         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9635         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9636         (Scan::global): Likewise.
9637         (Relocate::relocate): Likewise.
9638         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9639
9640 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9641
9642         * arm.cc (Arm_relocate_functions::got_prel) New function.
9643         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9644         (Relocate::relocate): Likewise.
9645         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9646
9647 2009-10-06  Ian Lance Taylor  <iant@google.com>
9648
9649         * options.h (class General_options): Define
9650         split_stack_adjust_size parameter.
9651         * object.h (class Object): Add uses_split_stack_ and
9652         has_no_split_stack_ fields.  Add uses_split_stack and
9653         has_no_split_stack accessor functions.  Declare
9654         handle_split_stack_section.
9655         (class Reloc_symbol_changes): Define.
9656         (class Sized_relobj): Define Function_offsets.  Declare
9657         split_stack_adjust, split_stack_adjust_reltype, and
9658         find_functions.
9659         * object.cc (Object::handle_split_stack_section): New function.
9660         (Sized_relobj::do_layout): Call handle_split_stack_section.
9661         * dynobj.cc (Sized_dynobj::do_layout): Call
9662         handle_split_stack_section.
9663         * reloc.cc (Sized_relobj::relocate_sections): Call
9664         split_stack_adjust for executable sections in split_stack
9665         objects.  Pass reloc_map to relocate_section.
9666         (Sized_relobj::split_stack_adjust): New function.
9667         (Sized_relobj::split_stack_adjust_reltype): New function.
9668         (Sized_relobj::find_functions): New function.
9669         * target-reloc.h: Include "object.h".
9670         (relocate_section): Add reloc_symbol_changes parameter.  Change
9671         all callers.
9672         * target.h (class Target): Add calls_non_split method.  Declare
9673         do_calls_non_split virtual method.  Declare match_view and
9674         set_view_to_nop.
9675         * target.cc: Include "elfcpp.h".
9676         (Target::do_calls_non_split): New function.
9677         (Target::match_view): New function.
9678         (Target::set_view_to_nop): New function.
9679         * gold.cc (queue_middle_tasks): Give an error if mixing
9680         split-stack and non-split-stack objects with -r.
9681         * i386.cc (Target_i386::relocate_section): Add
9682         reloc_symbol_changes parameter.
9683         (Target_i386::do_calls_non_split): New function.
9684         * x86_64.cc (Target_x86_64::relocate_section): Add
9685         reloc_symbol_changes parameter.
9686         (Target_x86_64::do_calls_non_split): New function.
9687         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9688         parameter.
9689         * powerpc.cc (Target_powerpc::relocate_section): Add
9690         reloc_symbol_changes parameter.
9691         * sparc.cc (Target_sparc::relocate_section): Add
9692         reloc_symbol_changes parameter.
9693         * configure.ac: Call AM_CONDITIONAL for the default target.
9694         * configure: Rebuild.
9695         * testsuite/Makefile.am (TEST_AS): New variable.
9696         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9697         (check_DATA): Add split_i386 and split_x86_64 files.
9698         (SPLIT_DEFSYMS): Define.
9699         (split_i386_[1234n].o): New targets.
9700         (split_i386_[124]): New targets.
9701         (split_i386_[1234r].stdout): New targets.
9702         (split_x86_64_[1234n].o): New targets.
9703         (split_x86_64_[124]): New targets.
9704         (split_x86_64_[1234r].stdout): New targets.
9705         (MOSTLYCLEANFILES): Add new executables.
9706         * testsuite/split_i386.sh: New file.
9707         * testsuite/split_x86_64.sh: New file.
9708         * testsuite/split_i386_1.s: New file.
9709         * testsuite/split_i386_2.s: New file.
9710         * testsuite/split_i386_3.s: New file.
9711         * testsuite/split_i386_4.s: New file.
9712         * testsuite/split_i386_n.s: New file.
9713         * testsuite/split_x86_64_1.s: New file.
9714         * testsuite/split_x86_64_2.s: New file.
9715         * testsuite/split_x86_64_3.s: New file.
9716         * testsuite/split_x86_64_4.s: New file.
9717         * testsuite/split_x86_64_n.s: New file.
9718         * testsuite/testfile.cc (Target_test): Update relocation_section
9719         function.
9720         * testsuite/Makefile.in: Rebuild.
9721
9722 2009-10-06  Ian Lance Taylor  <iant@google.com>
9723
9724         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9725         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9726         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9727         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9728         the address on ldo_addrs_.
9729         (Target_i386::Relocate::fix_up_ldo): New function.
9730
9731 2009-10-06   Rafael Espindola  <espindola@google.com>
9732
9733         * plugin.cc (add_input_library): New.
9734         (Plugin::load): Add add_input_library to tv.
9735         (Plugin_manager::add_input_file): Add the is_lib argument.
9736         (add_input_file): Update call to Plugin_manager::add_input_file.
9737         (add_input_library): New.
9738         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9739
9740 2009-09-30  Doug Kwan  <dougkwan@google.com>
9741
9742         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9743         symbol and call Symbol::may_need_copy_reloc to determine if
9744         a copy reloc is needed.
9745         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9746         nocopyreloc is given in command line.
9747         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9748         given in command line.
9749         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9750         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9751         of the removed Target_i386::may_need_copy_reloc.
9752         * options.h (copyreloc): New option with default value false.
9753         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9754         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9755         instead of the removed Target_powerpc::may_need_copy_reloc.
9756         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9757         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9758         instead of the removed Target_sparc::may_need_copy_reloc.
9759         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9760         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9761         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9762         instead of the removed Target_x86_64::may_need_copy_reloc.
9763
9764 2009-09-30  Ian Lance Taylor  <iant@google.com>
9765
9766         * object.h (class Object): Remove target_ field, and target,
9767         sized_target, and set_target methods.
9768         (Object::sized_target): Remove.
9769         (class Sized_relobj): Update declarations.  Remove sized_target.
9770         * object.cc (Sized_relobj::setup): Remove target parameter.
9771         Change all callers.
9772         (Input_objects::add_object): Don't do anything with the target.
9773         (make_elf_sized_object): Add punconfigured parameter.  Change all
9774         callers.  Set or test parameter target.
9775         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9776         Change all callers.
9777         * parameters.cc (Parameters::set_target): Change parameter type to
9778         be non-const.
9779         (Parameters::default_target): Remove.
9780         (set_parameters_target): Change parameter type to be non-const.
9781         (parameters_force_valid_target): New function.
9782         (parameters_clear_target): New function.
9783         * parameters.h (class Parameters): Update declarations.  Remove
9784         default_target method.  Add sized_target and clear_target
9785         methods.  Change target_ to be non-const.
9786         (set_parameters_target): Update declaration.
9787         (parameters_force_valid_target): Declare.
9788         (parameters_clear_target): Declare.
9789         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9790         as NULL if we aren't searching.
9791         (Add_symbols::run): Don't check for compatible target.
9792         * fileread.cc (Input_file::open_binary): Call
9793         parameters_force_valid_target.
9794         * gold.cc (queue_middle_tasks): Likewise.
9795         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9796         set_target on object.
9797         * dynobj.h (class Sized_dynobj): Update declarations.
9798         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9799         make_elf_object returns NULL.
9800         (Archive::include_member): Don't check whether object target is
9801         compatible.
9802         * output.cc (Output_section::add_input_section): Get target from
9803         parameters.
9804         (Output_section::relax_input_section): Likewise.
9805         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9806         parameters.
9807         (Sized_relobj::do_scan_relocs): Likewise.
9808         (Sized_relobj::relocate_sections): Likewise.
9809         * resolve.cc (Symbol_table::resolve): Likewise.
9810         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9811         parameter.  Change all callers.
9812         (Symbol_table::add_from_object): Get target from parameters.
9813         (Symbol_table::add_from_relobj): Don't check object target.
9814         (Symbol_table::add_from_dynobj): Likewise.
9815         (Symbol_table::define_special_symbol): Get target from
9816         parameters.
9817         * symtab.h (class Symbol_table): Update declaration.
9818         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9819         parameter.  Change all callers.  Clear parameter target.
9820         (Binary_test): Test target here.
9821         * testsuite/object_unittest.cc (gold_testsuite): Remove
9822         target_test_pointer parameter.  Change all callers.
9823         (Object_test): Test target here.
9824
9825 2009-09-26  Ian Lance Taylor  <iant@google.com>
9826
9827         * testsuite/initpri1.c: Don't try to use constructor priorities if
9828         compiling with gcc before 4.3.
9829
9830 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9831
9832         * testsuite/retain_symbols_file_test.sh (check_present): Change
9833         output file name to retain_symbols_file_test.stdout.
9834         (check_absent): Likewise.
9835
9836 2009-09-18  Craig Silverstein  <csilvers@google.com>
9837
9838         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9839         * options.cc: Include <cerrno> and <fstream>.
9840         (General_options::finalize): Parse -retain-symbols-file tag.
9841         * options.h: New flag.
9842         (General_options): New method should_retain_symbol, new
9843         variable symbols_to_retain.
9844         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9845         should_retain_symbol map.
9846         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9847         * testsuite/Makefile.in: Regenerate.
9848         * testsuite/retain_symbols_file_test.sh: New file.
9849
9850 2009-09-18  Nick Clifton  <nickc@redhat.com>
9851
9852         * po/es.po: Updated Spanish translation.
9853
9854 2009-09-17  Doug Kwan  <dougkwan@google.com>
9855
9856         * debug.h (DEBUG_RELAXATION): New constant.
9857         (DEBUG_ALL): Add DEBUG_RELAXATION.
9858         (debug_string_to_enum): Add relaxation debug option.
9859         * layout.cc
9860         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9861         Layout::Relaxation_debug_check::read_sections,
9862         Layout::Relaxation_debug_check::read_sections): New method definitions.
9863         (Layout::Layout): Initialize data members
9864         record_output_section_data_from_scrips_,
9865         script_output_section_data_list_ and relaxation_debug_check_.
9866         (Layout::save_segments, Layout::restore_segments,
9867         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9868         Layout::relaxation_loop_body): New method definitions.
9869         (Layout::finalize): Support relaxation.  Move section layout code to
9870         Layout::relaxation_loop_body.
9871         (Layout::set_asection_address_from_script): Move code for orphan
9872         section placement out.
9873         (Layout::place_orphan_sections_in_script): New method definition.
9874         * layout.h (Output_segment_headers, Output_file_header):
9875         New forward class declarations.
9876         (Layout::~Layout): Define.
9877         (Layout::new_output_section_data_from_script): New method definition.
9878         (Layout::place_orphan_sections_in_script): New method declaration.
9879         (Layout::Segment_states): New type declaration.
9880         (Layout::save_segments, Layout::restore_segments,
9881         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9882         Layout::relaxation_loop_body): New method declarations.
9883         (Layout::Output_section_data_list): New type declaration.
9884         (Layout::Relaxation_debug_check): New class definition.
9885         (Layout::record_output_section_data_from_script_,
9886         Layout::script_output_section_data_list_, Layout::segment_states_,
9887         Layout::relaxation_debug_check_): New data members.
9888         * output.cc: (Output_section_headers::do_size): New method definition.
9889         (Output_section_headers::Output_section_headers): Move size
9890         computation to Output_section_headers::do_size.
9891         (Output_segment_headers::do_size): New method definition.
9892         (Output_file_header::Output_file_header): Move size computation to
9893         Output_file_header::do_size and call it.
9894         (Output_file_header::do_size): New method definition.
9895         (Output_data_group::Output_data_group): Adjust call to
9896         Output_section_data.
9897         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9898         (Output_symtab_xindex::do_write): Add array bound check.
9899         (Output_section::Input_section::print_to_mapfile): Handle
9900         RELAXED_INPUT_SECTION_CODE.
9901         (Output_section::Output_section): Initialize data member checkpoint_.
9902         (Output_section::~Output_section): Delete checkpoint object pointed
9903         by checkpoint_.
9904         (Output_section::add_input_section): Always add an Input_section if
9905         relaxing.
9906         (Output_section::add_merge_input_section): Add assert.
9907         (Output_section::relax_input_section): New method definition.
9908         (Output_section::set_final_data_size): Set load address to zero for
9909         an unallocated section.
9910         (Output_section::do_address_and_file_offset_have_reset_values):
9911         New method definition.
9912         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9913         Handle relaxed input section.
9914         (Output_section::sort_attached_input_sections): Checkpoint input
9915         section list lazily.
9916         (Output_section::get_input_sections): Change type of input_sections to
9917         list of Simple_input_section pointers.  Checkpoint input section list
9918         lazily.  Also handle relaxed input sections.
9919         (Output_section::add_input_section_for_script): Take a reference to
9920         a Simple_input_section object instead of Relobj pointer and section
9921         index as parameter.  Handle relaxed input sections.
9922         (Output_section::save_states, Output_section::restore_states): New
9923         method definitions.
9924         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9925         (Output_data::is_data_size_fixed): New method definition.
9926         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9927         if it is fixed.
9928         (Output_data::address_and_file_offset_have_reset_values): New method
9929         definition.
9930         (Output_data::do_address_and_file_offset_have_reset_values): New method
9931         definition.
9932         (Output_data::set_data_size): Check that data size is not fixed.
9933         (Output_data::fix_data_size): New method definition.
9934         (Output_data::is_data_size_fixed_): New data member.
9935         (Output_section_headers::set_final_data_size): New method definition.
9936         (Output_section_headers::do_size): New method declaration.
9937         (Output_segment_headers::set_final_data_size): New method definition.
9938         (Output_segment_headers::do_size): New method declaration.
9939         (Output_file_header::set_final_data_size)::New method definition.
9940         (Output_file_header::do_size)::New method declaration.
9941         (Output_section_data::Output_section_data): Add new parameter
9942         is_data_size_fixed and use it to fix data size.
9943         (Output_data_const::Output_data_const): Adjust call to base class
9944         constructor and fix data size.
9945         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9946         base class constructor and fix data size.
9947         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9948         base class constructor and fix data size.
9949         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9950         class constructor and fix data size.
9951         (Output_data_group::set_final_data_size): New method definition.
9952         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9953         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9954         class constructor and fix data size.
9955         (Output_relaxed_input_section): New class definition.
9956         (Output_section::Simple_input_section): New class definition.
9957         (Output_section::get_input_sections): Adjust parameter list.
9958         (Output_section::add_input_section_for_script): Same.
9959         (Output_section::save_states, Output_section::restore_states,
9960         Output_section::do_address_and_file_offset_have_reset_values,
9961         (Output_section::Input_section::Input_section): Handle
9962         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9963         Output_relaxed_input_section.
9964         (Output_section::Input_section::is_input_section,
9965         Output_section::Input_section::set_output_section): Handle relaxed
9966         input section.
9967         (Output_section::Input_section::is_relaxed_input_section,
9968         Output_section::Input_section::output_section_data,
9969         Output_section::Input_section::relaxed_input_section): New method
9970         definitions.
9971         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9972         value.
9973         (Output_section::Input_section::u1_): Update comments.
9974         (Output_section::Input_section::u2_): Add new union member poris.
9975         (Output_section::Checkpoint_output_section): New classs definition.
9976         (Output_section::relax_input_section): New method declaration.
9977         (Output_section::checkpoint_): New data member.
9978         (Output_segment): Update comments.
9979         (Output_segment::Output_segment): Un-privatize copy constructor.
9980         (Output_segment::operator=): Un-privatize.
9981         * script-sections.cc (Output_section_element::Input_section_list):
9982         Change element type to Output_section::Simple_input_section.
9983         (Output_section_element_dot_assignment::set_section_addresses):
9984         Register output section data for relaxation clean up.
9985         (Output_data_exression::Output_data_expression): Adjust call to base
9986         constructor to fix data size.
9987         (Output_section_element_data::set_section_addresses): Register
9988         Output_data_expression object for relaxation clean up.
9989         (struct Input_section_info): Replace Relobj pointer and section index
9990         pair with Output_section::Simple_input_section and Convert struct to a
9991         class.
9992         (Input_section_sorter::operator()): Adjust access to
9993         Input_section_info data member to use accessors.
9994         (Output_section_element_input::set_section_addresses): Use layout
9995         parameter.  Adjust code to use Output_section::Simple_input_section
9996         and Input_secction_info classes.  Register filler for relaxation
9997         clean up.
9998         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9999         and section index pair with Output_section::Simple_input_section
10000         class.  Adjust code accordingly.
10001         (Phdrs_element::release_segment): New method definition.
10002         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10003         segment list.
10004         (Script_sections::release_segments): New method definition.
10005         * gold/script-sections.h (Script_sections::release_segments): New
10006         method declaration.
10007         * gold/target.h (Target::may_relax, Target::relax,
10008         Target::do_may_relax, Target::do_relax): New method definitions.
10009
10010 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10011
10012         * arm.cc (has_signed_unsigned_overflow): New function.
10013         (Arm_relocate_functions::abs8): New function.
10014         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10015         (Target_arm::Scan::global): Likewise.
10016         (Target_arm::relocate::relocate): Likewise.
10017         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10018         Likewise.
10019
10020 2009-09-16  Cary Coutant  <ccoutant@google.com>
10021
10022         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10023         * testsuite/Makefile.in: Regenerate.
10024
10025 2009-09-11  Nick Clifton  <nickc@redhat.com>
10026
10027         * po/gold.pot: Updated by the Translation project.
10028
10029 2009-09-08  Cary Coutant  <ccoutant@google.com>
10030
10031         * output.cc (Output_file::open): Add execute permission to empty file.
10032         * testsuite/Makefile.am (permission_test): New test.
10033         * testsuite/Makefile.in: Regenerate.
10034
10035 2009-09-02  Ian Lance Taylor  <iant@google.com>
10036
10037         * output.cc (Output_file::resize): Call map_no_anonymous rather
10038         than map.
10039
10040 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10041
10042         * gold.cc: Include "incremental.h".
10043         (queue_initial_tasks): Call Incremental_checker methods.
10044         * incremental.cc: Include "output.h".
10045         (Incremental_checker::can_incrementally_link_output_file): New
10046         method.
10047         * incremental.h (Incremental_checker): New class.
10048
10049         * output.cc (Output_file::open_for_modification): New method.
10050         (Output_file::map_anonymous): Changed return type to bool.  Record
10051         map in base_ field.
10052         (Output_file::map_no_anonymous): New method, broken out of map.
10053         (Output_file::map): Use map_no_anonymous and map_anonymous.
10054         * output.h (class Output_file): Update declarations.
10055
10056 2009-08-24  Cary Coutant  <ccoutant@google.com>
10057
10058         * options.h (Command_line::Pre_options): New class.
10059         (Command_line::pre_options): New member.
10060         * options.cc (gold::options::ready_to_register): New variable.
10061         (One_option::register_option): Do nothing if not registering options.
10062         Assert if same short option registered twice.
10063         (General_options::General_options): Turn off option registration when
10064         done constructing.
10065         (Command_line::Pre_options::Pre_options): New constructor.
10066
10067 2009-08-24  Cary Coutant  <ccoutant@google.com>
10068
10069         * options.h (General_options::no_keep_memory): Remove incorrect
10070         short option.
10071
10072 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10073
10074         * Makefile.am (am__skiplex, am__skipyacc): New.
10075         * Makefile.in: Regenerate.
10076
10077 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10078
10079         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10080         (INCLUDES): ... this.
10081         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10082         (AM_CPPFLAGS): Renamed from ...
10083         (INCLUDE): ... this.
10084         * Makefile.in, testsuite/Makefile.in: Regenerate.
10085
10086         * Makefile.in: Regenerate.
10087         * aclocal.m4: Likewise.
10088         * config.in: Likewise.
10089         * configure: Likewise.
10090         * testsuite/Makefile.in: Likewise.
10091
10092         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10093         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10094         * Makefile.in: Regenerate.
10095         * testsuite/Makefile.in: Regenerate.
10096
10097 2009-08-19  Cary Coutant  <ccoutant@google.com>
10098
10099         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10100         symbols in shared libraries overridden by hidden or internal symbols
10101         in the main program.
10102
10103 2009-08-19  Chris Demetriou  <cgd@google.com>
10104
10105         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10106         checking source file names in error messages.
10107
10108 2009-08-18  Doug Kwan  <dougkwan@google.com>
10109
10110         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10111         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10112         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10113         an elfcpp::Ehdr as parameter.
10114         * object.cc (Object::set_target): Remove the version that looks up
10115         a target and sets it.
10116         (Sized_relobj::setup): Take a Target object instead of
10117         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10118         (make_elf_sized_object): Find target and ask target to
10119         make an ELF object.
10120         * object.h: (Object::set_target): Remove the version that looks up
10121         a target and sets it.
10122         (Sized_relobj::setup): Take a Target object instead of
10123         an elfcpp:Ehdr as parameter.
10124         * target.cc: Include dynobj.h.
10125         (Target::do_make_elf_object_implementation): New.
10126         (Target::do_make_elf_object): New.
10127         * target.h (Target::make_elf_object): New template declaration.
10128         (Target::do_make_elf_object): New method declarations.
10129         (Target::do_make_elf_object_implementation): New template declaration.
10130
10131 2009-08-14  Ian Lance Taylor  <iant@google.com>
10132
10133         * gold.h (FUNCTION_NAME): Define.
10134         (gold_unreachable): Use FUNCTION_NAME.
10135
10136 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10137
10138         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10139         symbol in the --keep-unique list is not found.
10140
10141 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10142
10143         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10144         been maked as --keep-unique.
10145         (Icf::unfold_section): New function.
10146         * icf.h (Icf::unfold_section): New function.
10147         * options.h (General_options::keep_unique): New option.
10148         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10149         * testsuite/Makefile.in: Regenerate.
10150         * testsuite/icf_keep_unique_test.sh: New file.
10151         * testsuite/icf_keep_unique_test.cc: New file.
10152
10153 2009-08-12  Cary Coutant  <ccoutant@google.com>
10154
10155         PR 10471
10156         * resolve.cc (Symbol_table::resolve): Check for references from
10157         dynamic objects to hidden and internal symbols.
10158         * testsuite/Makefile.am (hidden_test.sh): New test.
10159         * testsuite/Makefile.in: Regenerate.
10160         * testsuite/hidden_test.sh: New script.
10161         * testsuite/hidden_test_1.c: New test source.
10162         * testsuite/hidden_test_main.c: New test source.
10163
10164 2009-08-11  Doug Kwan  <dougkwan@google.com>
10165
10166         * arm.cc: Update comments.
10167         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10168         segment to locate the .ARM.exidx section if present.
10169
10170 2009-08-09  Doug Kwan  <dougkwan@google.com>
10171
10172         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10173         patch.
10174
10175 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10176         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10177         compiler warnings.
10178
10179 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10180
10181         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10182         valid tls_segment only for non-debug-section relocations.
10183         * testsuite/Makefile.am: Add gc_tls_test.
10184         * testsuite/Makefile.in: Regenerate.
10185         * testsuite/gc_tls_test.cc: New file.
10186         * testsuite/gc_tls_test.sh: New file.
10187
10188 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10189
10190         * icf.cc: New file.
10191         * icf.h: New file.
10192         * Makefile.am (CCFILES): Add icf.cc.
10193         (HFILES): Add icf.h
10194         * Makefile.in: Regenerate.
10195         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10196         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10197         section, symbol and addend information for the relocs.
10198         * gold.cc (queue_middle_tasks): Call identical code folding.
10199         * gold.h: Add defines for multimap.
10200         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10201         to the call of finalize_local_symbols.
10202         * main.cc (main): Create object of class Icf.
10203         * object.cc (Sized_relobj::do_layout): Allow this function to be
10204         called twice during icf.
10205         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10206         to sections marked as identical by icf.
10207         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10208         when available.
10209         (Sized_relobj::do_section_entsize): New function.
10210         * object.h (Object::section_entsize): New function.
10211         (Object::do_section_entsize): New pure virtual function.
10212         (Relobj::finalize_local_symbols): Add new parameter.
10213         (Relobj::do_section_entsize): New function.
10214         * options.h (General_options::icf): New option.
10215         (General_options::icf_iterations): New option.
10216         (General_options::print_icf_sections): New option.
10217         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10218         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10219         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10220         icf.
10221         * symtab.cc (Symbol_table::is_section_folded): New function.
10222         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10223         to sections marked as identical by icf.
10224         * symtab.h (Symbol_table::set_icf): New function.
10225         (Symbol_table::icf): New function.
10226         (Symbol_table::is_section_folded): New function.
10227         (Symbol_table::icf_): New data member.
10228         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10229         * testsuite/Makefile.am: Add commands to build icf_test.
10230         * testsuite/Makefile.in: Regenerate.
10231         * testsuite/icf_test.sh: New file.
10232         * testsuite/icf_test.cc: New file.
10233
10234 2009-07-24  Chris Demetriou  <cgd@google.com>
10235
10236         * layout.cc (is_compressible_debug_section): Fix incorrect
10237         comment about compressed section names.
10238
10239 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10240
10241         PR 10419
10242         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10243
10244 2009-07-16  Ian Lance Taylor  <iant@google.com>
10245
10246         PR 10400
10247         * layout.h: #include <map>.
10248         (class Kept_section): Change from struct to class.  Add accessors
10249         and setters.  Add section size to Comdat_group mapping.  Change
10250         Comdat_group to std::map.  Add is_comdat_ field.  Add
10251         linkonce_size field in union.
10252         (class Layout): Update declaration of find_or_add_kept_section.
10253         Don't declare find_kept_object.
10254         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10255         parameter.  Add object, shndx, is_comdat, and is_group_name
10256         parameters.  Change all callers.  Adjust for new Kept_section.
10257         (Layout::find_kept_object): Remove.
10258         * object.cc (Sized_relobj::include_section_group): Update use of
10259         Kept_section.  Rename secnum to shndx.  Only record
10260         Kept_comdat_section if sections are the same size.
10261         (Sized_relobj::include_linkonce_section): Update use of
10262         Kept_section.  Only record Kept_comdat_section if sections are the
10263         same size.  Set size of linkonce section.
10264         (Sized_relobj::map_to_kept_section): Update call to
10265         get_kept_comdat_section.
10266         * object.h (class Sized_relobj): Rename fields in
10267         Kept_comdat_section to drop trailing underscores; change object
10268         field to Relobj*.  Change Kept_comdat_section_table to store
10269         struct rather than pointer.
10270         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10271         Add kept_object and kept_shndx parameters.  Change all callers.
10272         (Sized_relobj::get_kept_comdat_section): Change return type to
10273         bool.  Add kept_object and kept_shndx parameters.  Change all
10274         callers.
10275         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10276         Layout::find_or_add_kept_section.
10277
10278 2009-07-09  Ian Lance Taylor  <iant@google.com>
10279
10280         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10281         Reserve space in the hash table.
10282
10283 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10284
10285         * fileread.cc (File_read::get_mtime): New method.
10286         * fileread.h (Timespec): New structure.
10287         (File_read::get_mtime): New method.
10288         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10289         Renamed from timestamp_nsec.
10290         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10291         Elf_Xword.
10292         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10293         timestamp_nsec.
10294         (Incremental_inputs::report_archive): Save mtime; style fix.
10295         (Incremental_inputs::report_obejct): Save mtime; style fix.
10296         (Incremental_inputs::report_script): Save mtime; style fix.
10297         (Incremental_inputs::finalize_inputs): Style fix.
10298         (Incremental_inputs::finalize): Style fix.
10299         (Incremental_inputs::create_input_section_data): Store inputs
10300         mtime.
10301         * incremental.h (Incremental_inputs::report_script): Add mtime
10302         argument.
10303         (Incremental_inputs::Input_info::Input_info): Intialize only one
10304         union member.
10305         (Incremental_inputs::Input_info::archive): Move to nameless
10306         union.
10307         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10308         (Incremental_inputs::Input_info::script): Move to nameless union.
10309         (Incremental_inputs::mtime): New field.
10310         * script.cc (read_input_script): Pass file mtime to
10311         Incremental_input.
10312         * script.h (Script_info::inputs): Style fix.
10313
10314 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10315
10316         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10317         instead of 32.
10318
10319 2009-06-24  Ian Lance Taylor  <iant@google.com>
10320
10321         PR 10156
10322         * layout.cc (Layout::choose_output_section): If we find an
10323         existing section, update the flags.
10324         (Layout::create_notes): New function, broken out of
10325         Layout::finalize.
10326         (Layout::finalize): Don't create note sections.
10327         (Layout::create_note): Don't crash if linker script discards
10328         section.
10329         (Layout::create_gold_note): Likewise.
10330         (Layout::create_build_id): Likewise.  Don't set
10331         after_input_sections on the section.
10332         (Layout::create_executable_stack_info): Remove target parameter.
10333         Change caller.
10334         * layout.h (class Layout): Declare create_notes.  Update
10335         declaration of create_executable_stack_info.
10336         * gold.cc (queue_middle_tasks): Call create_notes.
10337         * output.cc (Output_section::update_flags_for_input_section): Move
10338         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10339         invalid.
10340         * output.h (Output_data::mark_address_invalid): New function.
10341         (class Output_section): Only declare, not define,
10342         update_flags_for_input_section.  Remove set_flags.
10343
10344 2009-06-24  Ian Lance Taylor  <iant@google.com>
10345
10346         * script-sections.cc (Output_section_definition::
10347         set_section_addresses): Rename shadowing local load_address to
10348         laddr.
10349
10350 2009-06-24  Ian Lance Taylor  <iant@google.com>
10351
10352         PR 10244
10353         * reloc.cc (relocate_sections): Skip empty relocation sections.
10354
10355 2009-06-23  Ian Lance Taylor  <iant@google.com>
10356
10357         PR 10156
10358         * layout.cc (Layout::create_note): Use choose_output_section
10359         rather than make_output_section.
10360
10361 2009-06-23  Ian Lance Taylor  <iant@google.com>
10362
10363         PR 10237
10364         * options.cc (General_options::parse_V): Set printed_version_.
10365         (General_options::General_options): Initialize printed_version_.
10366         * options.h (class General_options): Add printed_version_ field.
10367         * gold.cc (queue_initial_tasks): If there are no input files,
10368         don't give a fatal error if we printed the version information.
10369         (queue_middle_tasks): If using -r with a shared object, give a
10370         fatal error rather than an ordinary error.
10371
10372 2009-06-23  Ian Lance Taylor  <iant@google.com>
10373
10374         PR 10219
10375         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10376         (Layout::make_output_section): Set have_stabstr_section_ if we see
10377         a .stab*str section.
10378         (Layout::finalize): Call link_stabs_sections.
10379         (Layout::link_stabs_sections): New file.
10380         * layout.h (class Layout): Add have_stabstr_section_ field.
10381         Declare link_stabs_sections.
10382
10383 2009-06-23  Doug Kwan  <dougkwan@google.com>
10384
10385         * Makefile.am (libgold_a_LIBADD): New.
10386         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10387         * Makefile.in: Regenerate.
10388         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10389         * configure: Regenerate.
10390         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10391         * fileread.cc: Include sys/state.h
10392         * gold.h: Declare memmem and strndup if found missing.
10393         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10394
10395 2009-06-23  Ian Lance Taylor  <iant@google.com>
10396
10397         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10398         * configure: Rebuild.
10399
10400 2009-06-23  Ian Lance Taylor  <iant@google.com>
10401
10402         PR 10147
10403         * object.cc (Object::section_contents): Don't try to get a view if
10404         the section has length zero.
10405         (Object::handle_gnu_warning_section): If the section is empty, use
10406         the name of the section as the warning.
10407
10408 2009-06-23  Ian Lance Taylor  <iant@google.com>
10409
10410         PR 10133
10411         * stringpool.h (class Stringpool_template): Add optimize_ field.
10412         (Stringpool_template::set_optimize): New function.
10413         * stringpool.cc (Stringpool_template::Stringpool_template):
10414         Initialize optimize_ field.
10415         (Stringpool_template::set_string_offsets): Test local optimize
10416         fild rather than parameter.
10417         * layout.cc (Layout::Layout): Call set_optimize on the section
10418         name stringpool.
10419
10420 2009-06-22  Ian Lance Taylor  <iant@google.com>
10421
10422         PR 10030
10423         * yyscript.y: Parse TARGET.
10424         * script.cc (script_set_target): New function.
10425         * script-c.h (script_set_target): Declare.
10426         * options.cc (General_options::string_to_object_format): Rename
10427         from string_to_object_format in anonymous namespace.  Change
10428         callers.
10429         * options.h (class General_options): Declare
10430         string_to_object_format.
10431
10432 2009-06-22  Ian Lance Taylor  <iant@google.com>
10433
10434         * script-sections.cc (Script_sections::create_segments): Don't put
10435         program headers in a PT_LOAD segment if -n or -N.
10436
10437 2009-06-22  Ian Lance Taylor  <iant@google.com>
10438
10439         PR 10141
10440         * options.h (class General_options): Add -z lazy and -z now.  Sort
10441         -z options into alphabetical order.
10442         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10443
10444 2009-06-21  Ian Lance Taylor  <iant@google.com>
10445
10446         * layout.cc (Layout::make_output_section): Call
10447         Target::new_output_section.
10448         (Layout::attach_allocated_section_to_segment): Put large section
10449         sections in a separate load segment with the large segment flag
10450         set.
10451         (Layout::segment_precedes): Sort large data segments after other
10452         load segments.
10453         (align_file_offset): New static function.
10454         (Layout::set_segment_offsets): Use align_file_offset.
10455         * output.h (class Output_section): Add is_small_section_ and
10456         is_large_section_ fields.
10457         (Output_section::is_small_section): New function.
10458         (Output_section::set_is_small_section):  New function.
10459         (Output_section::is_large_section): New function.
10460         (Output_section::set_is_large_section): New function.
10461         (Output_section::is_large_data_section): New function.
10462         (class Output_segment): Add is_large_data_segment_ field.
10463         (Output_segment::is_large_data_segment): New function.
10464         (Output_segment::set_is_large_data_segment): New function.
10465         * output.cc (Output_section::Output_section): Initialize new
10466         fields.
10467         (Output_segment::Output_segment): Likewise.
10468         (Output_segment::add_output_section): Add assertion that large
10469         data sections always go in large data segments.  Force small data
10470         sections to the end of the list of data sections.  Force small BSS
10471         sections to the start of the list of BSS sections.  For large BSS
10472         sections to the end of the list of BSS sections.
10473         * symtab.h (class Symbol): Declare is_common_shndx.
10474         (Symbol::is_defined): Check Symbol::is_common_shndx.
10475         (Symbol::is_common): Likewise.
10476         (class Symbol_table): Define enum Commons_section_type.  Update
10477         declarations.  Add small_commons_ and large_commons_ fields.
10478         * symtab.cc (Symbol::is_common_shndx): New function.
10479         (Symbol_table::Symbol_table): Initialize new fields.
10480         (Symbol_table::add_from_object): Put small and large common
10481         symbols in the right list.
10482         (Symbol_table::sized_finalized_symbol): Check
10483         Symbol::is_common_shndx.
10484         (Symbol_table::sized_write_globals): Likewise.
10485         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10486         common symbol lists.  Don't call do_allocate_commons_list if the
10487         list is empty.
10488         (Symbol_table::do_allocate_commons_list): Remove is_tls
10489         parameter.  Add comons_section_type parameter.  Change all
10490         callers.  Handle small and large common symbols.
10491         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10492         Symbol::is_common_shndx.
10493         * resolve.cc (symbol_to_bits): Likewise.
10494         * target.h (Target::small_common_shndx): New function.
10495         (Target::small_common_section_flags): New function.
10496         (Target::large_common_shndx): New function.
10497         (Target::large_common_section_flags): New function.
10498         (Target::new_output_section): New function.
10499         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10500         small_common_section_flags, and large_common_section_flags
10501         fields.
10502         (Target::do_new_output_section): New virtual function.
10503         * arm.cc (Target_arm::arm_info): Initialize new fields.
10504         * i386.cc (Target_i386::i386_info): Likewise.
10505         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10506         Likewise.
10507         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10508         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10509         (Target_x86_64::do_new_output_section): New function.
10510         * configure.ac: Define conditional MCMODEL_MEDIUM.
10511         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10512         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10513         (large_LDFLAGS): Define.
10514         * testsuite/large.c: New file.
10515         * testsuite/testfile.cc (Target_test::test_target_info):
10516         Initialize new fields.
10517         * configure, testsuite/Makefile.in: Rebuild.
10518
10519 2009-06-05  Doug Kwan  <dougkwan@google.com>
10520
10521         * Makefile.am (CCFILES): Add target.cc.
10522         * Makefile.in: Regenerate.
10523         * i386.cc (class Target_i386): Define new virtual method to
10524         override do_is_local_label_name in parent.
10525         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10526         local symbols if --discard-locals or -X is given.
10527         * options.h (class General_options): Declare new options
10528         '--discard-locals' and '-X' for discarding locals.
10529         * target.h (class Target): Define new methods is_local_label_name.
10530         Declare new virtual method do_is_local_label_name.
10531         * target.cc: New file.
10532         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10533         (check_SCRIPTS): Add discard_locals_test.sh.
10534         (check_DATA): Add discard_local_tests.syms.
10535         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10536         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10537         * testsuite/Makefile.in: Regenerate.
10538         * testsuite/discard_locals_test.c: New file.
10539         * testsuite/discard_locals_test.sh: Same.
10540
10541 2009-06-05  Doug Kwan  <dougkwan@google.com>
10542
10543         * object.cc (Sized_relobj::Sized_relobj): Initialize
10544         discarded_eh_frame_shndx_ to -1U.
10545         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10546         section.
10547         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10548         a discarded .eh_frame section.
10549         (Sized_relobj::do_finalize_local_symbols): Ditto.
10550         * object.h (class Sized_relobj): Declare new member
10551         discarded_eh_frame_shndx_.
10552         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10553         (local_labels_test.o, local_labels_test): New rules.
10554         * testsuite/Makefile.in: Regenerate.
10555
10556 2009-06-04  Doug Kwan  <dougkwan@google.com>
10557
10558         * layout.cc (Layout::section_name_mapping): Add mapping for
10559         special ARM sections.
10560
10561 2009-06-03  Doug Kwan  <dougkwan@google.com>
10562
10563         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10564         (utils::has_overflow): Same.
10565
10566 2009-06-03  Ian Lance Taylor  <iant@google.com>
10567
10568         * layout.cc (Layout::section_name_mapping): New array, replacing
10569         Layout::linkonce_mapping.
10570         (Layout::section_name_mapping_count): New variable, replacing
10571         Layout::linkonce_mapping_count.
10572         (Layout::linkonce_output_name): Remove.
10573         (Layout::output_section_name): Rewrite.
10574         * layout.h (class Layout): Rename Linkonce_mapping to
10575         Section_name_mapping, linkonce_mapping to section_name_mapping,
10576         linkonce_mapping_count to section_name_mapping_count.  Don't
10577         declare linkonce_output_name.
10578
10579 2009-06-03  Doug Kwan  <dougkwan@google.com>
10580
10581         * gold/arm.cc (namespace utils): New.
10582         (Target_arm::reloc_is_non_pic): Define new method.
10583         (class Arm_relocate_functions): New.
10584         (Target_arm::Relocate::relocate): Handle relocation types used by
10585         Android.
10586
10587 2009-06-03  Ian Lance Taylor  <iant@google.com>
10588
10589         * arm.cc (Target_arm::scan::global): Use || instead of |.
10590
10591 2009-06-02  Doug Kwan  <dougkwan@google.com>
10592
10593         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10594         issued_non_pic_error_.
10595         (class Target_arm::Scan): Declare new method check_non_pic.
10596         Define new method symbol_needs_plt_entry.
10597         Declare new data member issued_non_pic_error_.
10598         (class Target_arm::Relocate): Declare new method
10599         should_apply_static_reloc.
10600         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10601         (Target_arm::Scan::check_non_pic): Define new method.
10602         (Target_arm::Scan::local): Handle a small subset of reloc types used
10603         by Android.
10604         (Target_arm::Scan::local): Same.
10605         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10606
10607 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10608
10609         * incremental.cc (Incremental_inputs::report_command_line): Filter
10610         out --incremental-* options.
10611
10612 2009-05-29  Doug Kwan  <dougkwan@google.com>
10613
10614         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10615         template class.
10616         (class Target_arm): Update comment.
10617         (Target_arm::Target_arm): Initialize new data members GOT_,
10618         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10619         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10620         and Target_arm::rel_dyn_section.
10621         Declare new_enum Target_arm::Got_type.
10622         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10623         and DYNBSS_.
10624         Update commments for member do_dynsym_value.
10625         (Target_arm::got_size, Target_arm::plt_section,
10626         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10627         new methods inside class defintion.
10628         (Target_arm::got_section): Define new method.
10629         (Target_arm::rel_dyn_section): Same.
10630         (Output_data_plt_arm): New template class.
10631         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10632         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10633         (Output_data_plt_arm::add_entry): Same.
10634         (Output_data_plt_arm::first_plt_entry): Define new
10635         static data member for PLT instruction template.
10636         (Output_data_plt_arm::plt_entry): Same.
10637         (Output_data_plt_arm::do_write): Define new method.
10638         (Target_arm::make_plt_entry): Same.
10639         (Target_arm::do_finalize_sections): Same.
10640         (Target_arm::do_dynsym_value): Same.
10641
10642 2009-05-28  Doug Kwan  <dougkwan@google.com>
10643
10644         * Makefile.am (TARGETSOURCES): Add arm.cc.
10645         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10646         * Makefile.in: Regenerate.
10647         * arm.cc: New file.
10648         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10649
10650 2009-05-26  Doug Kwan  <dougkwan@google.com>
10651
10652         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10653         (General_options::check_excluded_libs): Strip off directories in
10654         archive name before matching like GNU ld does.
10655         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10656         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10657         (exclude_libs_test_LDFLAGS): Add linker option
10658         -Wl,--exclude-libs,libexclude_libs_test_3
10659         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10660         an explicit archive without using -l.
10661         (alt/libexclude_libs_test_3.a): New make rule.
10662         * testsuite/Makefile.in: Regenerate.
10663         * testsuite/exclude_libs_test.c : Declare lib3_default().
10664         (main): Call it.
10665         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10666         * exclude_libs_test_3.c: New file.
10667
10668 2009-05-26  Nick Clifton  <nickc@redhat.com>
10669
10670         * po/id.po: New Indonesian translation.
10671         * po/gold.pot: Updated template file.
10672
10673 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10674
10675         * testsuite/Makefile.am: Add -ffunction-sections to compile
10676         gc_comdat_test files.  Add -Wl,--gc-sections to build
10677         gc_comdat_test.
10678         * testsuite/Makefile.in: Regenerate.
10679         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10680
10681 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10682
10683         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10684         kept comdat section was garbage collected.
10685         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10686         * testsuite/Makefile.in: Regenerate.
10687         * testsuite/gc_comdat_test.sh: New file.
10688         * testsuite/gc_comdat_test_1.cc: New file.
10689         * testsuite/gc_comdat_test_2.cc: New file.
10690
10691 2009-05-19  Doug Kwan  <dougkwan@google.com>
10692
10693         * archive.cc (Archive::Archive): Move constructor from archive.h
10694         to here.  Initialize no_export_.
10695         (Archive::get_elf_object_for_member): Set no_export flag of object.
10696         * archive.h (Archive::Archive): Move constructor body to
10697         archive.cc.
10698         (Archive::no_export): New method.
10699         (Archive::no_export_): New field.
10700         * object.h (Object::Object): Initialize no_export_ to false.
10701         (Object::no_export, Object::set_no_export): New methods.
10702         (Object::no_export_): New field.
10703         * options.cc (General_options::parse_exclude_libs): New method.
10704         (General_options::check_excluded_libs) Same.
10705         * options.h (exclude_libs): New option.
10706         (General_options::check_excluded_libs): New method declaration.
10707         (General_options::excluded_libs_): New field.
10708         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10709         default or protected visibility if an object has no-export flag set.
10710         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10711         (check_SCRIPTS): Add exclude_libs_test.sh.
10712         (check_DATA): Add exclude_libs_test.syms.
10713         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10714         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10715         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10716         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10717         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10718         libexclude_libs_test_2.a): New rules.
10719         * testsuite/Makefile.in: Regenerate.
10720         * testsuite/exclude_libs_test.c: New file.
10721         * testsuite/exclude_libs_test.sh: Ditto.
10722         * testsuite/exclude_libs_test_1.c: Ditto.
10723         * testsuite/exclude_libs_test_2.c: Ditto.
10724
10725 2009-05-15  Ian Lance Taylor  <iant@google.com>
10726
10727         * configure.ac: Check for declarations for cases where libiberty.h
10728         checks HAVE_DECL_xxx.
10729         * configure, config.in: Rebuild.
10730
10731 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10732
10733         * gold.h (Incremental_argument_list): Remove (invalid) forward
10734         declaration.
10735         * incremental.cc (Incremental_inputs::report_achive): New method.
10736         (Incremental_inputs::report_object): New method.
10737         (Incremental_inputs::report_script): New method.
10738         (Incremental_inputs::finalize_inputs): New method.
10739         (Incremental_inputs::finalize): Call finalize_inputs().
10740         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10741         Create inputs entries.
10742         * incremental.h (Incremental_input_type): New enum.
10743         (Incremental_inputs::Incremental_input): Initialize new fields.
10744         (Incremental_inputs::report_inputs): New method.
10745         (Incremental_inputs::report_achive): New method.
10746         (Incremental_inputs::report_object): New method.
10747         (Incremental_inputs::report_script): New method.
10748         (Incremental_inputs::finalize_inputs): New method.
10749         (Incremental_inputs::Input_info): New struct.
10750         (Incremental_inputs::Input_info_map): New typedef.
10751         (Incremental_inputs::lock_): New field.
10752         (Incremental_inputs::Inputs_): New field.
10753         (Incremental_inputs::Inputs_map): New field.
10754         * main.cc (main): Call Incremental_input::report_inputs.
10755         * options.h (Input_argument_list): Typedef moved from
10756         Input_arguments.
10757         (Input_file_group::Files): Remove, use ::Input_argument_list.
10758         (Input_file_group::Input_argument_list): Remove, use
10759         ::Input_argument_list.
10760         * plugin.cc (Plugin_manager::add_input_file): Add error in
10761         incremental build.
10762         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10763         functions.
10764         * script.cc (read_input_script): Call
10765         Incremental_input::report_script.
10766         * script.h (Script_info): New class.
10767
10768 2009-04-27  Ian Lance Taylor  <iant@google.com>
10769
10770         * x86_64.cc (do_adjust_output_section): Set entsize to
10771         plt_entry_size.
10772
10773 2009-04-23  Elliott Hughes  <enh@google.com>
10774
10775         * output.cc (Output_file::close): After short writes, continue
10776         writing from the correct offset in the buffer being written.
10777
10778 2009-04-23  Chris Demetriou  <cgd@google.com>
10779
10780         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10781         * configure: Regenerate.
10782         * config.in: Regenerate.
10783         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10784         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10785
10786 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10787
10788         * incremental.cc (Incremental_inputs_header_data): Renamed from
10789         Incremental_input_header_data.
10790         (Incremental_inputs_header_data::data_size): New field.
10791         (Incremental_inputs_header_data::put_input_file_count): Renamed
10792         from input_file_count.
10793         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10794         from command_line_offset.
10795         (Incremental_inputs_header_data::put_reserved): Renamed from
10796         put_reserved.
10797         (Incremental_inputs_entry_data): Renamed from
10798         Incremental_input_entry_data.
10799         (Incremental_inputs_entry_data::data_size): New field.
10800         (Incremental_inputs::report_command_line): New method.
10801         (Incremental_inputs::finalize): New method.
10802         (Incremental_inputs::create_incremental_inputs_data): New method.
10803         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10804         * incremental.h: New file.
10805         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10806         (Layout::finalize): Create incremental inputs section in
10807         incremental builds.
10808         (Layout::create_incremental_info_sections): New method.
10809         * layout.h (Layout::incremental_inputs): New method.
10810         (Layout::create_incremental_info_sections): New method.
10811         (Layout::incremental_inputs_): New field.
10812         * main.cc (main): Notify Incremental_input of the command line.
10813
10814 2009-04-01  Ian Lance Taylor  <iant@google.com>
10815             Mikolaj Zalewski  <mikolajz@google.com>
10816
10817         * gold.h (reserve_unordered_map): Define, three versions, one for
10818         each version of Unordered_map.
10819         * layout.cc (Layout::Layout): Remove options parameter.  Add
10820         number_of_input_files parameter.  Don't initialize options_.
10821         Initialize number_of_input_files_ and resized_signatures_.  Move
10822         sections_are_attached_.
10823         (Layout::layout_group): Reserve space for group_signatures_.
10824         (Layout::find_or_add_kept_section): Change name parameter to be a
10825         reference.  Resize signatures_ map when it gets large enough.
10826         (Layout::layout_eh_frame): Use parameters->options() instead of
10827         this->options_.
10828         (Layout::make_output_section): Likewise.
10829         (Layout::attach_allocated_section_to_segment): Likewise.
10830         (Layout::finalize, Layout::create_executable_stack): Likewise.
10831         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10832         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10833         * layout.h (class Layout): Update declarations.  Remove options_
10834         field.  Add number_of_input_files_ and resized_signatures_
10835         fields.  Move sections_are_attached_ field.
10836         * main.cc (main): Pass number of input files to Layout
10837         constructor.  Don't pass options.
10838
10839 2009-03-30  Ian Lance Taylor  <iant@google.com>
10840
10841         * ffsll.c (ffsll): Correct implementation.
10842
10843 2009-03-27  Ian Lance Taylor  <iant@google.com>
10844
10845         * ffsll.c: New file.
10846         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10847         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10848         * ftruncate.c (ftruncate): Declare before definition.
10849         * mremap.c (mremap): Likewise.
10850         * pread.c (pread): Likewise.
10851         * configure, Makefile.in, config.in: Rebuild.
10852
10853         * mremap.c: New file.
10854         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10855         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10856         (mremap): Declare if HAVE_MREMAP is not defined.
10857         * configure, Makefile.in, config.in: Rebuild.
10858
10859 2009-03-27  Cary Coutant  <ccoutant@google.com>
10860
10861         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10862         position independent.
10863         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10864         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10865
10866 2009-03-24  Cary Coutant  <ccoutant@google.com>
10867
10868         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10869         an executable.
10870         (needs_dynamic_reloc): Likewise.
10871
10872 2009-03-24  Ian Lance Taylor  <iant@google.com>
10873
10874         * yyscript.y (file_cmd): Recognize EXTERN.
10875         (extern_name_list, extern_name_list_body): New nonterminals.
10876         * script.cc (script_add_extern): Define.
10877         * script-c.h (script_add_extern): Declare.
10878
10879 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10880
10881         * object.cc (is_elf_object): Define.
10882         * object.h (is_elf_object): Declare.
10883         * archive.cc (Archive::get_elf_object_for_member): Call
10884         is_elf_object.
10885         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10886
10887 2009-03-24  Elliott Hughes  <enh@google.com>
10888
10889         * output.cc (Output_file::map_anonymous): Define.
10890         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10891         try an anonymous one.  Report the size if the mmap fails.
10892         * output.h (class Output_file): Declare map_anonymous.
10893
10894 2009-03-24  Ian Lance Taylor  <iant@google.com>
10895
10896         * target-select.cc (instantiate_target): Don't acquire the lock if
10897         the instantiated_target_ field has already been set.
10898
10899 2009-03-23  Ian Lance Taylor  <iant@google.com>
10900
10901         * gold-threads.h (class Initialize_lock): Define.
10902         * gold-threads.cc (class Initialize_lock_once): Define.
10903         (initialize_lock_control): New static variable.
10904         (initialize_lock_pointer): New static variable.
10905         (initialize_lock_once): New static function.
10906         (Initialize_lock::Initialize_lock): Define.
10907         (Initialize_lock::initialize): Define.
10908         * target-select.h: Include "gold-threads.h".
10909         (class Target_selector): Add lock_ and initialize_lock_ fields.
10910         Don't define instantiate_target, just declare it.
10911         * target-select.cc (Target_selector::Target_selector): Initialize
10912         new fields.
10913         (Target_selector::instantiate_target): Define.
10914         * descriptors.h: Include "gold-threads.h".
10915         (class Descriptors): Add initialize_lock_ field.
10916         * descriptors.cc (Descriptors::Descriptors): Initialize new
10917         field.
10918         (Descriptors::open): Use initialize_lock_ field
10919         * errors.h (class Errors): Add initialize_lock_ field.
10920         * errors.cc (Errors::Errors): Initialize new field.
10921         (Errors::initialize_lock): Use initialize_lock_ field.
10922         * powerpc.cc (class Target_selector_powerpc): Remove
10923         instantiated_target_ field.  In do_recognize call
10924         instantiate_target rather than do_instantiate_target.  In
10925         do_instantiate_target just allocate a new target.
10926         * sparc.cc (class Target_selector_sparc): Likewise.
10927
10928         * freebsd.h: New file.
10929         * i386.cc: Include "freebsd.h".
10930         (Target_i386): Derive from Target_freebsd rather than
10931         Sized_target.
10932         (Target_selector_i386): Derive from Target_selector_freebsd rather
10933         than Target_selector.
10934         * x86_64.cc: Include "freebsd.h".
10935         (Target_x86_64): Derive from Target_freebsd rather than
10936         Sized_target.
10937         (Target_selector_x86_64): Derive from Target_selector_freebsd
10938         rather than Target_selector.
10939         * target.h (class Target): Add adjust_elf_header and
10940         do_adjust_elf_header.
10941         * output.cc (Output_file_header:: do_sized_write): Call target
10942         adjust_elf_header routine.
10943         * configure.tgt: Set targ_osabi.
10944         * configure.ac: Define GOLD_DEFAULT_OSABI.
10945         * parameters.cc (Parameters::default_target): Pass
10946         GOLD_DEFAULT_OSABI to select_target.
10947         * target-select.h (class Target_selector): Make instantiate_target
10948         protected rather than private.
10949         * Makefile.am (HFILES): Add freebsd.h.
10950         * configure, Makefile.in, config.in: Rebuild.
10951
10952         * merge.cc (do_add_input_section): Correct pend value.  Change
10953         message about last entry not being null terminated from error to
10954         warning.
10955
10956 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10957
10958         * incremental.cc: New file.
10959         * Makefile.am (CCFILES): Add incremental.cc.
10960         * Makefile.in: Rebuild.
10961
10962 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10963
10964         * layout.cc (Layout::output_section_name): Preserve names
10965         of '.note.' sections.
10966
10967 2009-03-19  Ian Lance Taylor  <iant@google.com>
10968
10969         * descriptors.cc (Descriptors::open): Check that the options are
10970         valid before using them.
10971
10972 2009-03-18  Ian Lance Taylor  <iant@google.com>
10973
10974         * script-sections.h: Include <list>.
10975         (class Script_sections): Change Sections_elements from std::vector
10976         to std::list.  Typedef public Elements_iterator.  Add
10977         orphan_section_placement_, data_segment_align_start_, and
10978         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10979         field.
10980         * script-sections.cc (class Orphan_section_placement): New class.
10981         (class Sections_element): Add virtual functions is_relro and
10982         orphan_section_init.  Remove virtual function place_orphan_here.
10983         (class Output_section_definition): Add is_relro and
10984         orphan_section_init.  Remove place_orphan_here.
10985         (class Orphan_output_section): Likewise.
10986         (Script_sections::Script_sections): Update for field changes.
10987         (Script_sections::data_segment_align): Set saw_data_segment_align_
10988         and data_segment_align_start_, not data_segment_align_index.
10989         (Script_sections::data_segment_relro_end): Check
10990         saw_data_segment_align_.  Use data_segment_align_start_ rather
10991         than data_segment_align_index_.
10992         (Script_sections::place_orphan): Rewrite to use
10993         Orphan_section_placement.
10994
10995 2009-03-17  Ian Lance Taylor  <iant@google.com>
10996
10997         * archive.cc (Archive::add_symbols): Check for a version attached
10998         to the symbol name in the archive map.
10999         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11000         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11001         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11002         (ver_test_11.a): New target.
11003         * testsuite/Makefile.in: Rebuild.
11004
11005         * configure.ac: Check for chsize and posix_fallocate.  Replace
11006         ftruncate.
11007         * ftruncate.c: New file, from gnulib.
11008         * output.cc (posix_fallocate): Define dummy version if not
11009         HAVE_POSIX_FALLOCATE.
11010         (Output_file::map): Call posix_fallocate rather than lseek and
11011         write.
11012         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11013         * configure, Makefile.in, config.in: Rebuild.
11014
11015 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11016
11017         * layout.h (Layout::create_note): Add section_name parameter.
11018         * layout.cc (Layout::create_note): Likewise.
11019         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11020
11021 2009-03-17  Ian Lance Taylor  <iant@google.com>
11022
11023         * descriptors.cc: Include "options.h".
11024         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11025         (Descriptors::open): Always use O_CLOEXEC when opening a new
11026         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11027         then set FD_CLOEXEC.
11028
11029         * sparc.cc (class Target_sparc): Add has_got_section.
11030         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11031         make sure we have a GOT section.
11032
11033         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11034         (Target_sparc::Scan::local): Likewise.
11035         (Target_sparc::Scan::global): Likewise.
11036         (Target_sparc::Relocate::relocate): Likewise.
11037         (Target_sparc::Relocate::relocate_tls): Likewise.
11038
11039         * symtab.cc (Symbol_table::define_default_version): New function,
11040         broken out of add_from_object.
11041         (Symbol_table::add_from_object): Call define_default_version.
11042         (Symbol_table::define_special_symbol): Add resolve_oldsym
11043         parameter.  Change all callers.  If the version for a symbol comes
11044         from a version script, resolve it with the symbol with the same
11045         name with no version.  Also add the symbol without a version if
11046         appropriate.
11047         (do_define_in_output_data): If resolving with oldsym, don't delete
11048         sym.
11049         (do_define_in_output_segment): Likewise.
11050         (do_define_as_constant): Likewise.
11051         * symtab.h (class Symbol_table): Update declarations.
11052
11053 2009-03-13  Ian Lance Taylor  <iant@google.com>
11054
11055         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11056         (Read_symbols::requeue): New function.
11057         (Read_symbols::do_read_symbols): If make_elf_object fails because
11058         the target type is not configured, and the file was searched for,
11059         issue a warning and retry with the next directory.
11060         (Add_symbols::run): If the file has an incompatible format, and
11061         it was searched for, requeue the Read_symbols task.  On error,
11062         release the object.
11063         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11064         dirindex parameter to constructor.  Change all callers.  Declare
11065         incompatible_warning and requeue.
11066         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11067         input_argument_ and input_group_ fields.  Add them to
11068         constructor.  Change all callers.
11069         (class Read_script): Add dirindex_ field.  Add it to constructor.
11070         Change all callers.
11071         * archive.cc (Archive::setup): Remove input_objects parameter.
11072         Change all callers.
11073         (Archive::get_file_and_offset): Likewise.
11074         (Archive::read_all_symbols): Likewise.
11075         (Archive::read_symbols): Likewise.
11076         (Archive::get_elf_object_for_member): Remove input_objects
11077         parameter.  Add punconfigured parameter.  Change all callers.
11078         (Archive::add_symbols): Change return type to bool.  Check return
11079         value of include_member.
11080         (Archive::include_all_members): Likewise.
11081         (Archive::include_member): Change return type to bool.  Return
11082         false if first included object has incompatible target.  Set
11083         included_member_ field.
11084         (Add_archive_symbols::run): If add_symbols returns false, requeue
11085         Read_symbols task.
11086         * archive.h (class Archive): Add included_member_ field.
11087         Initialize it in constructor.  Add input_file and searched_for
11088         methods.  Update declarations.
11089         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11090         input_argument_ fields.  Add them to constructor.  Change all
11091         callers.
11092         * script.cc: Include "target-select.h".
11093         (class Parser_closure): Add skip_on_incompatible_target_ and
11094         found_incompatible_target_ fields.  Add
11095         skip_on_incompatible_target parameter to constructor.  Change all
11096         callers.  Add methods skip_on_incompatible_target,
11097         clear_skip_on_incompatible_target, found_incompatible_target, and
11098         set_found_incompatible_target.
11099         (read_input_script): Add dirindex parameter.  Change all callers.
11100         If parser finds an incompatible target, requeue Read_symbols
11101         task.
11102         (script_set_symbol): Clear skip_on_incompatible_target in
11103         closure.
11104         (script_add_assertion, script_parse_option): Likewise.
11105         (script_start_sections, script_add_phdr): Likewise.
11106         (script_check_output_format): New function.
11107         * script.h (read_input_script): Update declaration.
11108         * script-c.h (script_check_output_format): Declare.
11109         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11110         (ignore_cmd): Remove OUTPUT_FORMAT.
11111         * fileread.cc (Input_file::Input_file): Add explicit this.
11112         (Input_file::will_search_for): New function.
11113         (Input_file::open): Add pindex parameter.  Change all callers.
11114         * fileread.h (class Input_file): Add input_file_argument method.
11115         Declare will_search_for.  Update declarations.
11116         * object.cc (make_elf_object): Add punconfigured parameter.
11117         Change all callers.
11118         * object.h (class Object): Make input_file public.  Add
11119         searched_for method.
11120         (make_elf_object): Update declaration.
11121         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11122         restart search.
11123         * dirsearch.h (class Dirsearch): Update declaration.
11124         * options.h (class General_options): Add --warn-search-mismatch.
11125         * parameters.cc (Parameters::is_compatible_target): New function.
11126         * parameters.h (class Parameters): Declare is_compatible_target.
11127         * workqueue.cc (Workqueue::add_blocker): New function.
11128         * workqueue.h (class Workqueue): Declare add_blocker.
11129
11130         * fileread.cc (Input_file::open): Remove options parameter.
11131         Change all callers.
11132         (Input_file::open_binary): Likewise.
11133         * script.cc (read_input_script): Likewise.
11134         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11135         options parameter from constructor.  Change all callers.
11136         (class Read_script): Likewise.
11137         * fileread.h (class Input_file): Update declarations.
11138         * script.h (read_input_script): Update declaration.
11139
11140 2009-03-10  Nick Clifton  <nickc@redhat.com>
11141
11142         * po/es.po: New Spanish translation.
11143
11144 2009-03-06  Cary Coutant  <ccoutant@google.com>
11145
11146         * options.cc (parse_short_option): Keep dash_z from registering itself.
11147
11148 2009-03-03  Ian Lance Taylor  <iant@google.com>
11149
11150         PR 9918
11151         * target-reloc.h (relocate_section): Pass output_section to
11152         relocate.
11153         * i386.cc (Target_i386::should_apply_static_reloc): Add
11154         output_section parameter.  Change all callers.
11155         (Target_i386::Relocate::relocate): Add output_section parameter.
11156         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11157         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11158         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11159         * testsuite/two_file_shared.sh: New script.
11160         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11161         (check_DATA): Add two_file_shared.dbg.
11162         (two_file_shared.dbg): New target.
11163         * testsuite/Makefile.in: Rebuild.
11164
11165 2009-03-01  Ian Lance Taylor  <iant@google.com>
11166
11167         * configure.ac: Check for byteswap.h.
11168         * configure: Rebuild.
11169         * config.in: Rebuild.
11170
11171 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11172
11173         * layout.cc (Layout::find_or_add_kept_section): New function.
11174         (Layout::add_comdat): Removed.
11175         * layout.h (struct Kept_section): Move out of class Layout.
11176         Remove trailing underscores from field names.  Add group_sections
11177         field.  Rename group_ field to is_group.  Change all uses.
11178         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11179         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11180         comdat_groups_ field.
11181         (Sized_relobj::include_section_group): Use
11182         find_or_add_kept_section and Kept_section::group_sections.
11183         (Sized_relobj::include_linkonce_section): Likewise.
11184         * object.cc (class Sized_relobj): Don't define Comdat_group or
11185         Comdat_group_table.  Remove find_comdat_group and
11186         add_comdat_group.  Remove comdat_groups_ field.
11187         * plugin.cc (include_comdat_group): Use
11188         Layout::find_or_add_kept_section.
11189
11190 2009-02-28  Ian Lance Taylor  <iant@google.com>
11191
11192         * README: --gc-sections and map files are now supported.  Document
11193         some build requirements.
11194
11195         PR 6992
11196         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11197         relocatable link set the value of the section symbol to zero.
11198         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11199         relocatable link don't include the section address in the local
11200         symbol value.
11201
11202 2009-02-27  Ian Lance Taylor  <iant@google.com>
11203
11204         PR 6811
11205         * options.h (class Search_directory): Add is_system_directory.
11206         (class General_options): Declare is_in_system_directory.
11207         * options.cc (get_relative_sysroot): Make static.
11208         (get_default_sysroot): Make static.
11209         (General_optoins::is_in_system_directory): New function.
11210         * fileread.cc (Input_file::is_in_system_directory): New function.
11211         * fileread.h (class Input_file): Declare is_in_system_directory.
11212         * object.h (class Object): Add is_in_system_directory.
11213         (class Input_objects): Remove system_library_directory_ field.
11214         * object.cc (Input_objects::add_object): Don't set
11215         system_library_directory_.
11216         (input_objects::found_in_system_library_directory): Remove.
11217         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11218         parameter.  Change all callers.
11219         (Symbol_table::sized_write_globals): Likewise.
11220         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11221         Call Object::is_in_system_directory.
11222         * symtab.h (class Symbol_table): Update declarations.
11223
11224         PR 5990
11225         * descriptors.h (Open_descriptor): Add is_on_stack field.
11226         * descriptors.cc (Descriptors::open): If the descriptor is on the
11227         top of the stack, remove it.  Initialize is_on_stack field.
11228         (Descriptors::release): Only add pod to stack if it is not on the
11229         stack already.
11230         (Descriptors::close_some_descriptor): Clear stack_next and
11231         is_on_stack fields.
11232
11233         PR 7091
11234         * output.cc (Output_section::find_starting_output_address): Rename
11235         from starting_output_address; add PADDR parameter; change return
11236         type.
11237         * output.h (class Output_section): Declare
11238         find_starting_output_address instead of starting_output_address.
11239         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11240         section symbol for which we can't find a merge section.
11241
11242         PR 9836
11243         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11244         hidden or internal, force the symbol to be local.
11245         * resolve.cc (Symbol::override_visibility): Define.
11246         (Symbol::override_base): Use override_visibility.
11247         (Symbol_table::resolve): Likewise.
11248         (Symbol::override_base_with_special): Likewise.
11249         (Symbol_table::override_with_special): If the visibility is hidden
11250         or internal, force the symbol to be local.
11251         * symtab.h (class Symbol): Add set_visibility and
11252         override_visibility.
11253         * testsuite/ver_test_1.sh: New file.
11254         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11255         (check_DATA): Add ver_test_1.syms.
11256         (ver_test_1.syms): New target.
11257         * testsuite/Makefile.in: Rebuild.
11258
11259 2009-02-25  Cary Coutant  <ccoutant@google.com>
11260
11261         * layout.cc (Layout::choose_output_section): Don't rename sections
11262         when using a linker script that has a SECTIONS clause.
11263         * Makefile.in: Regenerate.
11264
11265         * testsuite/Makefile.am (script_test_5.sh): New test case.
11266         * testsuite/Makefile.in: Regenerate.
11267         * testsuite/script_test_5.cc: New file.
11268         * testsuite/script_test_5.sh: New file.
11269         * testsuite/script_test_5.t: New file.
11270
11271 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11272
11273         * archive.cc (Archive::include_member): Update calls to add_symbols.
11274         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11275         the Layout argument.
11276         * dynobj.h (do_add_symbols): Add the Layout argument.
11277         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11278         Layout argument.
11279         * object.h (Object::add_symbols): Add the Layout argument.
11280         (Object::do_add_symbols): Add the Layout argument.
11281         (Sized_relobj::do_add_symbols): Add the Layout argument.
11282         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11283         Unify the two versions.
11284         (Add_plugin_symbols): Remove.
11285         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11286         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11287         (Add_plugin_symbols): Remove.
11288         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11289         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11290         (Add_symbols::run): Make it work with Pulginobj.
11291
11292 2009-02-06  Ian Lance Taylor  <iant@google.com>
11293
11294         * object.cc (Sized_relobj::do_layout): Make info message start
11295         with lower case letter.
11296
11297 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11298
11299         * binary.cc: Fix file comment.
11300
11301         * options.h (enum Incremental_disposition): Define.
11302         (class General_options): Add new options: --incremental,
11303         --incremental_changed, --incremental_unchanged,
11304         --incremental_unknown.  Add incremental_disposition_ and
11305         implicit_incremental_ fields.
11306         (General_options::incremental_disposition): New function.
11307         (class Position_dependent_options): Add incremental_disposition
11308         option.
11309         (Position_dependent_options::copy_from_options): Set incremental
11310         dispositions.
11311         * options.cc (General_options::parse_incremental_changed): New
11312         function.
11313         (General_options::parse_incremental_unchanged): New function.
11314         (General_options::parse_incremental_unknown): New function.
11315         (General_options::General_options): Initialize new fields
11316         incremental_disposition_ and implicit_incremental_.
11317         (General_options::finalize): Check for uasge of --incremental-*
11318         without --incremental.
11319
11320 2009-02-06  Chris Demetriou  <cgd@google.com>
11321
11322         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11323         pointer and to report location as the file name associated with
11324         the symbol.
11325         (gold_undefined_symbol_at_location): New function to replace the
11326         old gold_undefined_symbol functionality.
11327         * target-reloc.h (relocate_section): Update to use
11328         gold_undefined_symbol_at_location.
11329         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11330         Call gold_undefined_symbol function rather than gold_error.
11331         * errors.h (Errors::undefined_symbol): Take location as a
11332         string, rather than calculating it from a relocation.
11333         * errors.cc (Errors::fatal): Print "fatal error:" before the
11334         formatted message.
11335         (Errors::error, Errors::error_at_location): Print "error: "
11336         before the formatted message.
11337         (Errors::undefined_symbol): Take location as a string, rather
11338         than calculating it from a relocation.
11339         (gold_undefined_symbol_at_location): New function akin to
11340         old gold_undefined_symbol, calculates location from relocation.
11341         (gold_undefined_symbol): Change to take only a Symbol pointer
11342         and to report location as the file name associated with the symbol.
11343         * testsuite/debug_msg.sh: Update for changed error messages.
11344         * testsuite/undef_symbol.sh: Likewise.
11345
11346 2009-02-04  Duncan Sands  <baldrick@free.fr>
11347
11348         PR 9812
11349         * reduced_debug_output.h
11350         (Output_reduced_debug_abbrev_section::failed): Use format for
11351         gold_warning.
11352         (Output_reduced_debug_info_section::faild): Likewise.
11353
11354 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11355
11356         * script.cc (Lazy_demangler): New class.
11357         (Version_script_info::get_symbol_version_helper): Demangle a
11358         symbol only once.
11359
11360 2009-01-29  Cary Coutant  <ccoutant@google.com>
11361
11362         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11363         to __tls_get_addr.
11364         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11365
11366 2009-01-28  Ian Lance Taylor  <iant@google.com>
11367
11368         * version.cc (version_string): Bump to 1.9.
11369
11370         * gold.h: Include <cstring> and <stdint.h>.
11371         * version.cc: Include <cstdio>.
11372         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11373         warning.
11374         * reduced_debug_output.cc (insert_into_vector): Rename from
11375         Insert_into_vector; change all callers.  Use Swap_unaligned to
11376         avoid aliasing issue; remove union since it is unnecessary.
11377
11378 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11379
11380         * Makefile.am (CCFILES): Add gc.cc.
11381         (HFILES): Add gc.h.
11382         * Makefile.in: Regenerate.
11383         * gold.cc (Gc_runner): New class.
11384         (queue_initial_tasks): Call garbage collection related tasks
11385         when corresponding options are invoked.
11386         (queue_middle_gc_tasks): New function.
11387         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11388         processed early before laying out sections during garbage collection.
11389         * gold.h (queue_middle_gc_tasks): New function.
11390         (is_prefix_of): Move from "layout.cc".
11391         * i386.cc (Target_i386::gc_process_relocs): New function.
11392         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11393         * main.cc (main): Create object of class "Garbage_collection".
11394         * object.cc (Relobj::copy_symbols_data): New function.
11395         (Relobj::is_section_name_included): New function.
11396         (Sized_relobj::do_layout): Allow this function to be called twice
11397         during garbage collection and defer layout of section during the
11398         first call.
11399         * object.h (Relobj::get_symbols_data): New function.
11400         (Relobj::is_section_name_included): New function.
11401         (Relobj::copy_symbols_data): New function.
11402         (Relobj::set_symbols_data): New function.
11403         (Relobj::get_relocs_data): New function.
11404         (Relobj::set_relocs_data): New function.
11405         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11406         (Relobj::gc_process_relocs): New function.
11407         (Relobj::do_gc_process_relocs): New pure virtual function.
11408         (Relobj::sd_): New data member.
11409         (Sized_relobj::is_output_section_offset_invalid): New function.
11410         (Sized_relobj::do_gc_process_relocs): New function.
11411         * options.h (General_options::gc_sections): Modify to not be a no-op.
11412         (General_options::print_gc_sections): New option.
11413         * plugin.cc (Plugin_finish::run): Remove function call to
11414         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11415         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11416         * reloc.cc (Read_relocs::run): Add task to process relocs and
11417         determine unreferenced sections when doing garbage collection.
11418         (Gc_process_relocs): New class.
11419         (Sized_relobj::do_gc_process_relocs): New function.
11420         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11421         sections that are garbage collected.
11422         * reloc.h (Gc_process_relocs): New class.
11423         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11424         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11425         symbols whose corresponding sections are garbage collected.
11426         (Symbol_table::Symbol_table): Add new parameter for the garbage
11427         collection object.
11428         (Symbol_table::gc_mark_undef_symbols): New function.
11429         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11430         (Symbol_table::gc_mark_dyn_syms): New function.
11431         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11432         as garbage.
11433         (Symbol_table::add_from_object): Likewise.
11434         (Symbol_table::add_from_relobj): When building shared objects, do not
11435         treat externally visible symbols as garbage.
11436         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11437         table information for static and relocatable links.
11438         * symtab.h (Symbol_table::set_gc): New function.
11439         (Symbol_table::gc): New function.
11440         (Symbol_table::gc_mark_undef_symbols): New function.
11441         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11442         (Symbol_table::gc_mark_dyn_syms): New function.
11443         (Symbol_table::gc_): New data member.
11444         * target.h (Sized_target::gc_process_relocs): New pure virtual
11445         function.
11446         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11447         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11448
11449 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11450
11451         * options.h (General_options::gc_sections): Define as a no-op for now.
11452         (General_options::no_keep_memory): Ditto.
11453         (General_options::Bshareable): Define.
11454         * options.cc (General_options::finalize): Honor -Bshareable.
11455
11456 2009-01-20  Andreas Schwab  <schwab@suse.de>
11457
11458         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11459         read the value in the contents, since we don't use it.  Use the
11460         template endianness when writing.
11461         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11462
11463 2009-01-19  Andreas Schwab  <schwab@suse.de>
11464
11465         * configure.tgt (powerpc64-*): Fix targ_obj.
11466
11467 2009-01-15  Ian Lance Taylor  <iant@google.com>
11468
11469         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11470         local symbols when stripping all symbols.
11471
11472 2009-01-14  Cary Coutant  <ccoutant@google.com>
11473
11474         * output.cc (Output_reloc): Add explicit instantiations.
11475
11476 2009-01-14  Cary Coutant  <ccoutant@google.com>
11477
11478         * archive.cc (Archive::get_elf_object_for_member): Remove call
11479         to File_read::claim_for_plugin.
11480         * descriptors.cc (Descriptors::open): Remove reference to
11481         is_claimed.
11482         (Descriptors::claim_for_plugin): Remove.
11483         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11484         (Descriptors::is_claimed): Remove.
11485         (claim_descriptor_for_plugin): Remove.
11486         * fileread.cc (File_read::claim_for_plugin): Remove.
11487         * fileread.h (File_read::claim_for_plugin): Remove.
11488         (File_read::descriptor): Reopen descriptor if necessary.
11489         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11490         (Plugin_manager::all_symbols_read): Add task parameter. Change
11491         all callers.
11492         (Plugin_manager::get_input_file): New function.
11493         (Plugin_manager::release_input_file): New function.
11494         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11495         corresponding data member.
11496         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11497         and pass to base constructor. Change all callers.
11498         (get_input_file, release_input_file): New functions.
11499         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11500         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11501         (Plugin_manager::all_symbols_read): Add task parameter.
11502         (Plugin_manager::get_input_file): New function.
11503         (Plugin_manager::release_input_file): New function.
11504         (Plugin_manager::task_): New data member.
11505         (Pluginobj::Pluginobj): Add filesize parameter.
11506         (Pluginobj::filename): New function.
11507         (Pluginobj::descriptor): New function.
11508         (Pluginobj::filesize): New function.
11509         (Pluginobj::filesize_): New data member.
11510         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11511         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11512         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11513
11514         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11515         with archive libraries.
11516         * testsuite/Makefile.in: Regenerate.
11517         * testsuite/plugin_test.c (struct sym_info): New type.
11518         (get_input_file, release_input_file): New static variables.
11519         (onload): Capture new transfer vector entries.
11520         (claim_file_hook): Stop reading at end of file according to filesize.
11521         Factor out parsing of readelf output into separate function.
11522         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11523         APIs and get the source file name from the symbol table.  Convert
11524         source file name to corresponding object file name.  Print info
11525         message when adding new input files.
11526         (parse_readelf_line): New function.
11527         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11528         * testsuite/plugin_test_2.sh: Likewise.
11529         * testsuite/plugin_test_3.sh: Likewise.
11530         * testsuite/plugin_test_4.sh: New test case.
11531
11532 2009-01-07  Ian Lance Taylor  <iant@google.com>
11533
11534         * version.cc (version_string): Bump to 1.8.
11535
11536 2008-12-23  Cary Coutant  <ccoutant@google.com>
11537
11538         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11539         * plugin.cc (Plugin_manager::finish): Rename as
11540         layout_deferred_objects.  Move cleanup to separate function.
11541         (Plugin_manager::cleanup): New function.
11542         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11543         separately.
11544         * plugin.h (Plugin_manager::finish): Rename as
11545         layout_deferred_objects.
11546         (Plugin_manager::cleanup): New function.
11547         (Plugin_manager::cleanup_done): New field.
11548
11549 2008-12-23  Cary Coutant  <ccoutant@google.com>
11550
11551         * plugin.cc (is_visible_from_outside): New function.
11552         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11553         so we don't return "IR only" status for exported symbols or -r links.
11554
11555         * testsuite/Makefile.am (plugin_test_3): New test case.
11556         * testsuite/Makefile.in: Regenerate.
11557         * testsuite/plugin_test_3.sh: New file.
11558
11559 2008-12-22  Cary Coutant  <ccoutant@google.com>
11560
11561         * object.cc (Sized_relobj::layout_section): New function.
11562         (Sized_relobj::do_layout): Defer layout of input sections until after
11563         plugin has provided replacement files.
11564         (Sized_relobj::do_layout_deferred_sections): New function.
11565         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11566         (Relobj::layout_deferred_sections): New function.
11567         (Relobj::do_layout_deferred_sections): New function.
11568         (Sized_relobj::do_layout_deferred_sections): New function.
11569         (Sized_relobj::layout_section): New function.
11570         (Sized_relobj::Deferred_layout): New structure.
11571         (Sized_relobj::deferred_layout_): New field.
11572         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11573         Change all callers.  Layout deferred sections.
11574         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11575         references.
11576         (Plugin_hook::run): Move code from do_plugin_hook inline.
11577         (Plugin_hook::do_plugin_hook): Remove.
11578         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11579         (Plugin_manager::finish): Renamed, was cleanup.
11580         (Plugin_manager::should_defer_layout): New function.
11581         (Plugin_manager::add_deferred_layout_object): New function.
11582         (Plugin_manager::Deferred_layout_list): New type.
11583         (Plugin_manager::deferred_layout_objects_): New field.
11584         (Plugin_hook::do_plugin_hook): Remove.
11585
11586 2008-12-17  Ian Lance Taylor  <iant@google.com>
11587
11588         * options.h (class General_options): Add --no case for
11589         --export-dynamic.
11590
11591 2008-12-16  Cary Coutant  <ccoutant@google.com>
11592
11593         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11594         vector.
11595         (Plugin_manager::claim_file): Create plugin object even if
11596         plugin did not call the add_symbols callback.
11597         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11598         asking for more symbols than were added.
11599         * testsuite/Makefile.am (plugin_test_1): Add test case with
11600         no global symbols.
11601         (empty.syms): New target.
11602         * testsuite/Makefile.in: Regenerate.
11603         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11604         message. Don't call add_symbols if no globals.
11605         (all_symbols_read_hook): Don't provide replacement for empty
11606         claimed file.
11607
11608 2008-12-12  Ian Lance Taylor  <iant@google.com>
11609
11610         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11611         r_type == 0 for a local symbol with r_sym == 0.
11612         (scan_relocatable_relocs): Pass r_sym to
11613         local_non_section_strategy.
11614         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11615         r_sym parameter.
11616
11617         * configure.ac: Update test for TLS descriptors: they are
11618         supported as of glibc 2.9.
11619         * configure: Rebuild.
11620
11621 2008-12-11  Ian Lance Taylor  <iant@google.com>
11622
11623         PR 7091
11624         * target-reloc.h (Default_scan_relocatable_relocs): For each
11625         function, map r_type == 0 to RELOC_DISCARD.
11626
11627 2008-12-10  Cary Coutant  <ccoutant@google.com>
11628
11629         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11630         object to override a kept COMDAT group from a plugin object.
11631
11632 2008-12-09  Ian Lance Taylor  <iant@google.com>
11633
11634         PR 7088
11635         * yyscript.y (file_cmd): Handle INPUT.
11636
11637         * testsuite/initpri1.c: Change all declarations to be full
11638         prototypes by adding void, to avoid compiler warnings.
11639
11640 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11641
11642         * options.cc (General_options::parse_plugin_opt): New.
11643         (General_options::add_plugin): The argument now is just the filename.
11644         (General_options::add_plugin_option): New.
11645         * options.h (plugin_opt): New.
11646         (add_plugin): Change argument name.
11647         (add_plugin_option): New.
11648         * plugin.cc (Plugin::load): Don't parse the plugin option.
11649         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11650         (Plugin::add_option): New.
11651         (Plugin::args_): Change type.
11652         (Plugin::filename_): New.
11653         (Plugin_manager::add_plugin_option): New.
11654         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11655         * testsuite/Makefile.in: Regenerate.
11656
11657 2008-12-05  Cary Coutant  <ccoutant@google.com>
11658
11659         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11660         Handle --strip-lto-sections option.
11661         * options.h (strip_lto_sections): New option.
11662
11663 2008-12-01  Cary Coutant  <ccoutant@google.com>
11664
11665         * plugin.cc (ld_plugin_message): Change format parameter to const.
11666         Fix mismatch between new[] and delete.
11667
11668 2008-11-14  Cary Coutant  <ccoutant@google.com>
11669
11670         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11671         instead of -1U.
11672
11673 2008-11-05  Craig Silverstein  <csilvers@google.com>
11674
11675         * options.cc (General_options::parse_dynamic_list): New function.
11676         * options.h (General_options): New flags dynamic_list,
11677         dynamic_list_data, dynamic_list_cpp_new, and
11678         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11679         (General_options::in_dynamic_list): New function.
11680         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11681         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11682         (Lex::can_continue_name): Likewise.
11683         (yylex): Likewise.
11684         (read_script_file): New parameter script_options.
11685         (read_dynamic_list): New function.
11686         (Script_options::define_dynamic_list): New function.
11687         (dynamic_list_keyword_parsecodes): New variable.
11688         (dynamic_list_keywords): New variable.
11689         * script.h (Script_options::define_dynamic_list): New function
11690         prototype.
11691         (read_dynamic_list): New function prototype.
11692         * symtab.cc (strprefix): New macro.
11693         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11694         dynamic_list_data, dynamic_list_cpp_new, and
11695         dynamic_list_cpp_typeinfo.
11696         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11697         (dynamic_list_expr): New rule.
11698         (dynamic_list_nodes): Likewise.
11699         (dynamic_list_node): Likewise.
11700         * testsuite/Makefile.am (dynamic_list): New test.
11701         * testsuite/Makefile.in: Regenerated.
11702         * testsuite/dynamic_list.t: New file.
11703         * testsuite/dynamic_list.sh: New file.
11704
11705 2008-11-05  Craig Silverstein  <csilvers@google.com>
11706
11707         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11708         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11709         (t11_last): Likewise.
11710         * testsuite/ver_test_6.c (main): Likewise.
11711
11712 2008-10-07  Cary Coutant  <ccoutant@google.com>
11713
11714         * options.c (General_options::finalize): Add check for -static and
11715         -shared.
11716         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11717         is not empty.
11718
11719 2008-10-02  Cary Coutant  <ccoutant@google.com>
11720
11721         * plugin.cc (make_sized_plugin_object): Fix conditional
11722         compilation to work when not all targets are enabled.
11723
11724 2008-09-29  Cary Coutant  <ccoutant@google.com>
11725
11726         * archive.cc (Archive::get_file_and_offset): Use filename instead
11727         of name to get library path.
11728         (Archive::include_member): Unlock external member of a thin archive.
11729
11730         * testsuite/Makefile.am (TEST_AR): New variable.
11731         (thin_archive_test_1): New test.
11732         (thin_archive_test_2): New test.
11733         * testsuite/Makefile.in: Regenerate.
11734         * testsuite/thin_archive_main.cc: New file.
11735         * testsuite/thin_archive_test_1.cc: New file.
11736         * testsuite/thin_archive_test_2.cc: New file.
11737         * testsuite/thin_archive_test_3.cc: New file.
11738         * testsuite/thin_archive_test_4.cc: New file.
11739
11740 2008-09-29  Cary Coutant  <ccoutant@google.com>
11741
11742         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11743         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11744         instead of -1U.
11745         (Sized_relobj::do_finalize_local_symbols): Likewise.
11746         (Sized_relobj::map_to_kept_section): Likewise.
11747         * object.h (Sized_relobj::invalid_address): New constant.
11748         (Sized_relobj::do_output_section_offset): Check for invalid_address
11749         and return -1ULL.
11750         * output.cc (Output_reloc::local_section_offset): Use constant
11751         invalid_address instead of -1U.
11752         (Output_reloc::get_address): Likewise.
11753         (Output_section::output_address): Change -1U to -1ULL.
11754         * output.h (Output_reloc::invalid_address): New constant.
11755         * reloc.cc (Sized_relobj::write_sections): Use constant
11756         invalid_address instead of -1U.
11757         (Sized_relobj::relocate_sections): Likewise.
11758         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11759         values for merge sections.
11760         * target-reloc.h (relocate_for_relocatable): Use constant
11761         invalid_address instead of -1U.
11762
11763 2008-09-19  Cary Coutant  <ccoutant@google.com>
11764
11765         Add plugin functionality for link-time optimization (LTO).
11766         * configure.ac (plugins): Add --enable-plugins option.
11767         * configure: Regenerate.
11768         * config.in: Regenerate.
11769         * Makefile.am (LIBDL): New variable.
11770         (CCFILES): Add plugin.cc.
11771         (HFILES): Add plugin.h.
11772         (ldadd_var): Add LIBDL.
11773         * Makefile.in: Regenerate.
11774
11775         * archive.cc: Include "plugin.h".
11776         (Archive::setup): Don't preread archive symbols when using a plugin.
11777         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11778         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11779         files.
11780         (Archive::include_member): Add symbols from plugin objects.
11781         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11782         * descriptors.cc (Descriptors::open): Check for file descriptors
11783         abandoned by plugins.
11784         (Descriptors::claim_for_plugin): New function.
11785         * descriptors.h (Descriptors::claim_for_plugin): New function.
11786         (Open_descriptor::is_claimed): New field.
11787         (claim_descriptor_for_plugin): New function.
11788         * fileread.cc (File_read::claim_for_plugin): New function.
11789         * fileread.h (File_read::claim_for_plugin): New function.
11790         (File_read::descriptor): New function.
11791         * gold.cc: Include "plugin.h".
11792         (queue_initial_tasks): Add task to call plugin hooks for generating
11793         new object files.
11794         * main.cc: Include "plugin.h".
11795         (main): Load plugin libraries.
11796         * object.h (Pluginobj): Declare.
11797         (Object::pluginobj): New function.
11798         (Object::do_pluginobj): New function.
11799         (Object::set_target): New function.
11800         * options.cc: Include "plugin.h".
11801         (General_options::parse_plugin): New function.
11802         (General_options::General_options): Initialize plugins_ field.
11803         (General_options::add_plugin): New function.
11804         * options.h (Plugin_manager): Declare.
11805         (General_options): Add --plugin option.
11806         (General_options::has_plugins): New function.
11807         (General_options::plugins): New function.
11808         (General_options::add_plugin): New function.
11809         (General_options::plugins_): New field.
11810         * plugin.cc: New file.
11811         * plugin.h: New file.
11812         * readsyms.cc: Include "plugin.h".
11813         (Read_symbols::do_read_symbols): Check for archive before checking
11814         for ELF file.  Call plugin hooks to claim files.
11815         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11816         from a real object file; force override when processing replacement
11817         files.
11818         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11819         (Symbol::init_base_object): Likewise.
11820         (Symbol::init_base_output_data): Likewise.
11821         (Symbol::init_base_output_segment): Likewise.
11822         (Symbol::init_base_constant): Likewise.
11823         (Symbol::init_base_undefined): Likewise.
11824         (Symbol::output_section): Assert that object is not a plugin.
11825         (Symbol_table::add_from_pluginobj): New function.
11826         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11827         undefined.
11828         (Symbol_table::sized_write_globals): Likewise.
11829         (Symbol_table::add_from_pluginobj): Instantiate template.
11830         * symtab.h (Sized_pluginobj): Declare.
11831         (Symbol::in_real_elf): New function.
11832         (Symbol::set_in_real_elf): New function.
11833         (Symbol::in_real_elf_): New field.
11834         (Symbol_table::add_from_pluginobj): New function.
11835
11836         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11837         (LIBDL): New variable.
11838         (LDADD): Add LIBDL.
11839         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11840         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11841         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11842         (MOSTLYCLEANFILES): Likewise.
11843         * testsuite/Makefile.in: Regenerate.
11844         * testsuite/plugin_test.c: New file.
11845         * testsuite/plugin_test_1.sh: New file.
11846         * testsuite/plugin_test_2.sh: New file.
11847
11848 2008-09-16  Ian Lance Taylor  <iant@google.com>
11849
11850         * target-reloc.h (relocate_section): Check whether a symbol is
11851         defined by the ABI before reporting an undefined symbol error.
11852         * target.h (Target::is_defined_by_abi): Make parameter const.
11853         (Target::do_is_defined_by_abi): Likewise.
11854         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11855         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11856         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11857         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11858         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11859         * testsuite/Makefile.in: Rebuild.
11860
11861         * fileread.cc (make_view): Add casts to avoid warning.
11862
11863 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11864
11865         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11866         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11867
11868 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11869
11870         * options.h (General_options::output_is_executable): New.
11871         (General_options::output_is_pie): New.
11872         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11873         for shared libraries.
11874         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11875
11876 2008-09-11  Chris Demetriou  <cgd@google.com>
11877
11878         * options.h (origin): New -z option.
11879         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11880         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11881         in DT_FLAGS_1.
11882
11883 2008-09-05  Cary Coutant  <ccoutant@google.com>
11884
11885         * fileread.cc (File_read::make_view): Add check for attempt to map
11886         beyond end of file.
11887
11888 2008-09-05  Cary Coutant  <ccoutant@google.com>
11889
11890         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11891         explicit instantiations.
11892
11893 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11894
11895         PR gold/6858
11896         * options.cc (General_options::finalize): Allow undefined symbols
11897         in shlibs if linking -shared.
11898
11899         PR gold/6859
11900         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11901         symbols as not needing a dynsym entry.
11902
11903 2008-08-20  Craig Silverstein  <csilvers@google.com>
11904
11905         * fileread.cc (File_read::open): Do not lock the file unless it
11906         was successfully opened.
11907
11908 2008-08-14  Cary Coutant  <ccoutant@google.com>
11909
11910         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11911         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11912         * testsuite/tls_test.cc (struct int128): 128-bit struct
11913         for testing TLS relocs with non-zero addend.
11914         (v12): New TLS variable.
11915         (t12): New test.
11916         (t_last): Add check for v12.
11917         * testsuite/tls_test.h (t12): New function.
11918         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11919
11920 2008-08-13  Ian Lance Taylor  <iant@google.com>
11921
11922         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11923         set tls_segment_ or relro_segment_.
11924         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11925         when appropriate.
11926         * output.h (Output_section::clear_is_relro): New function.
11927         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11928         sections specially even when output_data_ is empty.
11929         (Output_segment::maximum_alignment): When first section is relro,
11930         only force alignment for PT_LOAD segments.
11931         * script.cc (script_data_segment_align): New function.
11932         (script_data_segment_relro_end): New function.
11933         * script-c.h (script_data_segment_align): Declare.
11934         (script_data_segment_relro_end): Declare.
11935         * script-sections.h (class Script_sections): Declare
11936         data_segment_align and data_segment_relro_end.  Add fields
11937         segment_align_index_ and saw_relro_end_.
11938         * script-sections.cc (class Sections_element): Add set_is_relro
11939         virtual function.  Add new bool* parameter to place_orphan_here.
11940         Add get_output_section virtual function.
11941         (class Output_section_definition): Add set_is_relro.  Add new
11942         bool* parameter to place_orphan_here.  Add get_output_section.
11943         Add is_relro_ field.
11944         (Output_section_definition::Output_section_definition): Initialize
11945         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11946         and is_relro_ fields.
11947         (Output_section_definition::place_orphan_here): Add is_relro
11948         parameter.
11949         (Output_section_definition::set_section_addresses): Set relro for
11950         output section.
11951         (Output_section_definition::alternate_constraint): Likewise.
11952         (class Orphan_output_section): Add new bool* parameter to
11953         place_orphan_here.  Add get_output_section.
11954         (Orphan_output_section::place_orphan_here): Add is_relro
11955         parameter.
11956         (Script_sections::Script_sections): Initialize
11957         data_segment_align_index_ and saw_relro_end_.
11958         (Script_sections::data_segment_align): New function.
11959         (Script_sections::data_segment_relro_end): New function.
11960         (Script_sections::place_orphan): Set or clear is_relro.
11961         (Script_sections::set_section_addresses): Force alignment of first
11962         TLS section.
11963         * yyscript.y (exp): Call script_data_segment_align and
11964         script_data_segment_relro_end.
11965         * testsuite/relro_script_test.t: New file.
11966         * testsuite/relro_test.cc (using_script): Declare.
11967         (t1, t2): Test using_script.
11968         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11969         (relro_script_test_SOURCES): Define.
11970         (relro_script_test_DEPENDENCIES): Define.
11971         (relro_script_test_LDFLAGS): Define.
11972         (relro_script_test_LDADD): Define.
11973         (relro_script_test.so): New target.
11974         * testsuite/Makefile.in: Rebuild.
11975
11976 2008-08-06  Cary Coutant <ccoutant@google.com>
11977
11978         * archive.cc (Archive::total_archives, Archive::total_members)
11979         (Archive::total_members_loaded): New variables.
11980         (Archive::setup): Add parameter.  Add option to preread
11981         archive symbols.
11982         (Archive::read_armap): Add counter.
11983         (Archive::get_file_and_offset): New function.
11984         (Archive::get_elf_object_for_member): New function.
11985         (Archive::read_all_symbols): New function.
11986         (Archive::read_symbols): New function.
11987         (Archive::add_symbols): Add counters.
11988         (Archive::include_all_members): Use armap to find members if it's
11989         already built.
11990         (Archive::include_member): Skip reading symbols if already read.
11991         Factored code into Archive::get_file_and_offset and
11992         Archive::get_elf_object_for_member.  Changed call to
11993         Mapfile::report_include_archive_member.
11994         (Archive::print_stats): New function.
11995         * archive.h: Declare Object and Read_symbols_data classes.
11996         (Archive::Archive): Add initializers for new members.
11997         (Archive::setup): Add parameter.
11998         (Archive::print_stats): New function.
11999         (Archive::total_archives, Archive::total_members)
12000         (Archive::total_members_loaded): New variables.
12001         (Archive::get_file_and_offset): New function.
12002         (Archive::get_elf_object_for_member): New function.
12003         (Archive::read_all_symbols): New function.
12004         (Archive::read_symbols): New function.
12005         (Archive::Archive_member): New class.
12006         (Archive::members_): New member.
12007         (Archive::num_members_): New member.
12008         * main.cc: Include archive.h.
12009         (main): Call Archive::print_stats.
12010         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12011         archive parameter; member_name is now the fully-decorated name.
12012         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12013         * options.h: (General_options): Add --preread-archive-symbols option.
12014         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12015         Archive::setup.
12016
12017 2008-08-04  Ian Lance Taylor  <iant@google.com>
12018
12019         * symtab.h (Symbol::use_plt_offset): New function.
12020         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12021         * powerpc.cc (Relocate::relocate): Likewise.
12022         * sparc.cc (Relocate::relocate): Likewise.
12023         * x86_64.cc (Relocate::relocate): Likewise.
12024         * testsuite/weak_plt.sh: New test.
12025         * testsuite/weak_plt_main.cc: New test.
12026         * testsuite/weak_plt_shared.cc: New test.
12027         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12028         (check_PROGRAMS): Add weak_plt.
12029         (check_DATA): Add weak_plt_shared.so.
12030         (weak_plt_main_pic.o, weak_plt): New targets.
12031         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12032         * testsuite/Makefile.in: Rebuild.
12033
12034         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12035         gcctestdir/ld.
12036         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12037         * testsuite/Makefile.in: Rebuild.
12038
12039 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12040
12041         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12042         * Makefile.in: Regenerate.
12043         * po/POTFILES.in: Regenerate.
12044
12045 2008-07-29  Ian Lance Taylor  <iant@google.com>
12046
12047         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12048         symbols before other symbols.
12049         * testsuite/script_test_2.cc (test_addr): Declare.
12050         (test_addr_alias): Declare.
12051         (main): Check that test_addr and test_addr_alias have the right
12052         values.
12053         * testsuite/script_test_2.t: Define test_addr_alias and
12054         test_addr.
12055
12056 2008-07-24  Ian Lance Taylor  <iant@google.com>
12057
12058         PR 5990
12059         * descriptors.cc: New file.
12060         * descriptors.h: New file.
12061         * gold-threads.h (class Hold_optional_lock): New class.
12062         * fileread.cc: Include "descriptors.h".
12063         (File_read::~File_read): Release descriptor rather than closing
12064         it.
12065         (File_read::open) [file]: Call open_descriptor rather than open.
12066         Set is_descriptor_opened_.
12067         (File_read::open) [memory]: Assert that descriptor is not open.
12068         (File_read::reopen_descriptor): New function.
12069         (File_read::release): Release descriptor.
12070         (File_read::do_read): Make non-const.  Reopen descriptor.
12071         (File_read::read): Make non-const.
12072         (File_read::make_view): Reopen descriptor.
12073         (File_read::do_readv): Likewise.
12074         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12075         Update declarations.
12076         * layout.cc: Include "descriptors.h".
12077         (Layout::create_build_id): Use open_descriptor rather than open.
12078         * output.cc: Include "descriptors.h".
12079         (Output_file::open): Use open_descriptor rather than open.
12080         * archive.cc (Archive::const_iterator): Change Archive to be
12081         non-const.
12082         (Archive::begin, Archive::end): Make non-const.
12083         (Archive::count_members): Likewise.
12084         * archive.h (class Archive): Update declarations.
12085         * object.h (Object::read): Make non-const.
12086         * Makefile.am (CCFILES): Add descriptors.cc.
12087         (HFILES): Add descriptors.h.
12088         * Makefile.in: Rebuild.
12089
12090         PR 6716
12091         * gold.h: Always include <clocale>.  Add Solaris workarounds
12092         following code in binutils/sysdep.h.
12093
12094         PR 6048
12095         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12096         this->eh_frame_hdr_ is NULL before using it.
12097
12098         * dynobj.cc (Versions::Versions): Update comment.
12099
12100         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12101         the base version name.
12102
12103         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12104         array size plus one.
12105         (Stringpool_template::set_string_offsets): Subtract one from key
12106         before using it as an array index.
12107         (Stringpool_template::get_offset_with_length): Likewise.
12108         (Stringpool_template::write_to_buffer): Likewise.
12109         * stringpool.h (Stringpool_template::get_offset_from_key):
12110         Likewise.
12111
12112 2008-07-23  Ian Lance Taylor  <iant@google.com>
12113
12114         PR 6658
12115         * object.h (Merged_symbol_value::value): Do our best to handle a
12116         negative addend.
12117
12118         PR 6647
12119         * script.cc (Version_script_info::get_versions): Don't add empty
12120         version tag to return value.
12121         (Version_script_info::get_symbol_version_helper): Change return
12122         type to bool.  Add pversion parameter.  Change all callers.
12123         (script_register_vers_node): Don't require a non-NULL tag.
12124         * script.h (class Version_script_info): Update declarations.
12125         (Version_script_info::get_symbol_version): Change return type to
12126         bool.  Add version parameter.  Change all callers.
12127         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12128         handling.  Handle an empty version from a version script.
12129         (Symbol_table::define_special_symbol): Likewise.
12130         * testsuite/ver_test_10.script: New file.
12131         * testsuite/ver_test_10.sh: New file.
12132         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12133         (check_DATA): Add ver_test_10.syms.
12134         (ver_test_10.syms, ver_test_10.so): New target.
12135         * testsuite/Makefile.in: Rebuild.
12136
12137 2008-07-23  Simon Baldwin  <simonb@google.com>
12138
12139         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12140         to zero for undefined symbols from dynamic libraries.
12141
12142 2008-07-23  Ian Lance Taylor  <iant@google.com>
12143
12144         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12145         Change all callers.
12146         * symtab.h (class Symbol_table): Update declaration.
12147         * testsuite/ver_test_9.cc: New file.
12148         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12149         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12150         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12151         (ver_test_9.so, ver_test_9.o): New targets.
12152         * testsuite/Makefile.in: Rebuild.
12153
12154 2008-07-22  Ian Lance Taylor  <iant@google.com>
12155
12156         * options.h (class General_options): Define --check-sections.
12157         * layout.cc (Layout::set_segment_offsets): Handle
12158         --check-sections.
12159
12160         * options.h (class General_options): Define -n/--nmagic and
12161         -N/--omagic.
12162         * options.cc (General_options::finalize): For -n/--nmagic or
12163         -N/--omagic, set -static.
12164         * layout.cc (Layout::attach_allocated_section_to_segment): If
12165         -N/--omagic, don't put read-only and read-write sections in
12166         different segments.
12167         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12168         finding a read-only segment.
12169         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12170         don't set the minimum segment alignment to the common page size,
12171         and don't set the file offset to the address modulo the page size.
12172         * script-sections.cc (Script_sections::create_segments): If
12173         -n/--omagic, don't put read-only and read-write sections in
12174         different segments.
12175
12176         * cref.cc: New file.
12177         * cref.h: New file.
12178         * options.h (class General_options): Add --print-symbol-counts.
12179         * main.cc (main): Issue defined symbol report if requested.
12180         * archive.cc (Archive::interpret_header): Make into a const member
12181         function.
12182         (Archive::add_symbols): Call Input_objects::archive_start and
12183         archive_stop.
12184         (Archive::const_iterator): Define new class.
12185         (Archive::begin, Archive::end): New functions.
12186         (Archive::include_all_members): Rewrite to use iterator.
12187         (Archive::count_members): New function.
12188         * archive.h (class Archive): Update declarations.
12189         (Archive::filename): New function.
12190         * object.cc: Include "cref.h".
12191         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12192         (Sized_relobj::do_get_global_symbol_counts): New function.
12193         (Input_objects::add_object): Add object to cross-referencer.
12194         (Input_objects::archive_start): New function.
12195         (Input_objects::archive_stop): New function.
12196         (Input_objects::print_symbol_counts): New function.
12197         * object.h: Declare Cref and Archive.
12198         (Object::get_global_symbol_counts): New function.
12199         (Object::do_get_global_symbol_counts): New pure virtual function.
12200         (class Sized_relobj): Add defined_count_ field.  Update
12201         declarations.
12202         (class Input_objects): Add cref_ field.  Update constructor.
12203         Update declarations.
12204         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12205         defined_count_.
12206         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12207         symbol counts.
12208         (Sized_dynobj::do_get_global_symbol_counts): New function.
12209         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12210         defined_count_.  Update declarations.  Define Symbols typedef.
12211         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12212         parameter.  Change all callers.
12213         (Symbol_table::add_from_dynobj): Add sympointers and defined
12214         parameters.  Change all callers.
12215         * symtab.h (class Symbol_table): Update declarations.
12216         * Makefile.am (CCFILES): Add cref.cc.
12217         (HFILES): Add cref.h.
12218         * Makefile.in: Rebuild.
12219
12220 2008-07-22  Simon Baldwin  <simonb@google.com>
12221
12222         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12223         to zero when writing undefined symbols.
12224
12225 2008-07-22  Ian Lance Taylor  <iant@google.com>
12226
12227         * output.cc (Output_section::add_input_section): Don't try to
12228         merge empty merge sections.
12229
12230 2008-07-21  Craig Silverstein  <csilvers@google.com>
12231
12232         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12233         Include symbol version in error message.
12234
12235 2008-07-20  Chris Demetriou  <cgd@google.com>
12236
12237         * configure.ac (gold_cv_c_random_seed): New configured variable.
12238         (RANDOM_SEED_CFLAGS): New substituted variable.
12239         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12240         * configure: Rebuild.
12241         * Makefile.in: Likewise.
12242         * testsuite/Makefile.in: Likewise.
12243
12244 2008-07-18  Ian Lance Taylor  <iant@google.com>
12245
12246         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12247         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12248         * testsuite/ver_test_main.cc (main): Call t4.
12249         (t4, t4_2a): Define.
12250         * testsuite/ver_test_2.cc (t4_2): Define.
12251         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12252         * testsuite/ver_test_4.cc (t4_2a): Define.
12253         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12254         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12255
12256 2008-07-17  Ian Lance Taylor  <iant@google.com>
12257
12258         * dynobj.cc (Versions::add_def): If we give an error about a
12259         missing version, go ahead and create the version anyhow.
12260
12261 2008-07-10  Ian Lance Taylor  <iant@google.com>
12262
12263         Handle output sections with more than 0x7fffffff bytes.
12264         * object.h (class Relobj): Change map_to_output_ to
12265         output_sections_, and just keep a section pointer.  Change all
12266         uses.  Move comdat group support to Sized_relobj.
12267         (Relobj::is_section_specially_mapped): Remove.
12268         (Relobj::output_section): Remove poff parameter.  Change all
12269         callers.
12270         (Relobj::output_section_offset): New function.
12271         (Relobj::set_section_offset): Rewrite.
12272         (Relobj::map_to_output): Remove.
12273         (Relobj::output_sections): New function.
12274         (Relobj::do_output_section_offset): New pure virtual function.
12275         (Relobj::do_set_section_offset): Likewise.
12276         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12277         group support from Relobj.  Update declarations.
12278         (Sized_relobj::get_output_section_offset): New function.
12279         (Sized_relobj::do_output_section_offset): New function.
12280         (Sized_relobj::do_set_section_offset): New function.
12281         * object.cc (Relobj::output_section_address): Remove.
12282         (Sized_relobj::Sized_relobj): Initialize new fields.
12283         (Sized_relobj::include_section_group): Cast find_kept_object to
12284         Sized_relobj.
12285         (Sized_relobj::include_linkonce_section): Likewise.
12286         (Sized_relobj::do_layout): Use separate arrays for output section
12287         and output offset.
12288         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12289         output_sections.
12290         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12291         output_sections and section_offsets.
12292         (Sized_relobj::write_local_symbols): Likewise.
12293         (map_to_kept_section): Compute output address directly.
12294         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12295         output_sections and section_offsets.
12296         (Sized_relobj::write_sections): Likewise.
12297         (Sized_relobj::relocate_sections): Likewise.
12298         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12299         * output.h (class Output_reloc): Update declarations.  Change
12300         u2_.relobj to Sized_relobj*.
12301         (class Output_data_reloc): Change add functions to use
12302         Sized_relobj*.
12303         * output.cc (Output_reloc::Output_reloc): Change relobj to
12304         Sized_relobj*.
12305         (Output_reloc::local_section_offset): Change return type to
12306         Elf_Addr.  Use get_output_section_offset.
12307         (Output_reloc::get_address): Likewise.
12308         (Output_section::is_input_address_mapped): Don't call
12309         is_section_specially_mapped.
12310         (Output_section::output_offset): Likewise.
12311         (Output_section::output_address): Likewise.
12312         (Output_section::starting_output_address): Likewise.
12313         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12314         parameter to Sized_relobj*.
12315         (Copy_relocs::need_copy_reloc): Likewise.
12316         (Copy_relocs::save): Likewise.
12317         * copy-relocs.h (class Copy_relocs): Update declarations.
12318         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12319         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12320         * target-reloc.h (relocate_for_relocatable): Change
12321         offset_in_output_section type to Elf_Addr.  Change code that uses
12322         it as well.
12323         * layout.cc (Layout::layout): Always set *off.
12324         * mapfile.cc (Mapfile::print_input_section): Use
12325         output_section_offset.
12326         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12327         Sized_relobj*.
12328         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12329         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12330         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12331
12332 2008-07-03  Ian Lance Taylor  <iant@google.com>
12333
12334         * layout.cc (Layout::include_section): Do not discard unrecognized
12335         SHT_STRTAB sections.
12336
12337 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12338
12339         * script.cc (Lex::can_continue_name): Make '?' allowable in
12340         version-script names.
12341         * testsuite/version_script.map: Change glob pattern to use '?'
12342
12343 2008-06-30  Manish Singh  <yosh@gimp.org>
12344
12345         PR 6585
12346         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12347         Correct typo.
12348
12349 2008-06-30  Ian Lance Taylor  <iant@google.com>
12350
12351         PR 6660
12352         PR 6682
12353         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12354         versions]: Don't try to read the value in the contents, since we
12355         don't use it.  Use the template endianness when writing.
12356
12357 2008-06-25  Cary Coutant  <ccoutant@google.com>
12358
12359         * fileread.cc (File_read::make_view): Assert on zero-length view.
12360         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12361         symbol table when there are no symbols to read.
12362
12363 2008-06-23  Craig Silverstein  <csilvers@google.com>
12364
12365         * version.cc (version_string): Bump to 1.7
12366
12367 2008-06-18  Craig Silverstein  <csilvers@google.com>
12368
12369         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12370         constant 0xFFFF to type Valtype.
12371         (Powerpc_relocate_functions::rel16_ha): Likewise.
12372
12373 2008-06-17  Ian Lance Taylor  <iant@google.com>
12374
12375         * output.h (Output_section::Input_section): Initialize p2align_ to
12376         zero for Output_section_data constructors.
12377         (Output_section::Input_section::addralign): If not an input
12378         section, return the alignment of the Output_section_data.
12379         * testsuite/copy_test.cc: New file.
12380         * testsuite/copy_test_1.cc: New file.
12381         * testsuite/copy_test_2.cc: New file.
12382         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12383         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12384         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12385         (copy_test_1_pic.o, copy_test_1.so): New targets.
12386         (copy_test_2_pic.o, copy_test_2.so): New targets.
12387         * testsuite/Makefile.in: Rebuild.
12388
12389         * script-sections.cc (Script_sections::place_orphan): Initialize
12390         local variable exact.
12391
12392 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12393
12394         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12395
12396 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12397             David S. Miller  <davem@davemloft.net>
12398
12399         * powerpc.cc: New file.
12400         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12401         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12402         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12403         * Makefile.in: Rebuild.
12404
12405 2008-06-09  Ian Lance Taylor  <iant@google.com>
12406
12407         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12408         <exception>.
12409         (throwing, orig_terminate): New static variables.
12410         (terminate_handler): New static function.
12411         (t2): Set terminate handler.
12412
12413 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12414
12415         PR 6584
12416         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12417         alignment.
12418
12419 2008-05-30  Cary Coutant  <ccoutant@google.com>
12420
12421         * archive.cc (Archive::include_all_members) Correct to step
12422         over symbol table and extended name table in thin archives.
12423
12424 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12425
12426         PR 6407
12427         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12428         calculation.
12429
12430 2008-05-28  Caleb Howe  <cshowe@google.com>
12431
12432         * reduced_debug_output.cc: New file.
12433         * reduced_debug_output.h: New file.
12434         * options.h (class General_options): Add --strip-debug-non-line.
12435         * options.cc (General_options::finalize): Add strip_debug_non_line
12436         to the strip heirarchy.
12437         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12438         fields.
12439         * layout.cc: Include "reduced_debug_output.h".
12440         (Layout::Layout): Initialize new fields.
12441         (line_only_debug_sections): New static array.
12442         (is_lines_only_debug_sections): New static inline function.
12443         (Layout::include_section): Handle --strip-debug-non-line.
12444         (Layout::make_output_section): If --strip-debug-non-line, build
12445         new output sections for .debug_abbrev and .debug_info.
12446         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12447         gold.  Warn about possible overflow.
12448         (read_signed_LEB_128): Likewise.
12449         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12450         (read_signed_LEB_128): Declare.
12451         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12452         (HFILES): Add reduced_debug_output.h.
12453         * Makefile.in: Rebuild.
12454
12455 2008-05-21  Ian Lance Taylor  <iant@google.com>
12456
12457         * mapfile.cc: New file.
12458         * mapfile.h: New file.
12459         * options.h (class General_options): Add -M/--print-map and -Map.
12460         * options.cc (General_options::finalize): Make -M equivalent to
12461         -Map -.
12462         * main.cc: Include <cstdio> and "mapfile.h".
12463         (main): Open mapfile if requested.
12464         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12465         constructor.  Change caller.
12466         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12467         (queue_middle_tasks): Likewise.
12468         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12469         declarations.
12470         * archive.cc: Include "mapfile.h".
12471         (Archive::add_symbols): Add mapfile parameter.  Change all
12472         callers.  Pass mapfile, symbol, and reason to include_member.
12473         (Archive::include_all_members): Add mapfile parameter.  Change all
12474         callers.
12475         (Archive::include_member): Add mapfile, sym, and why parameters.
12476         Change all callers.  Report inclusion to map file.
12477         * archive.h: Include "fileread.h".
12478         (class Archive): Update declarations.
12479         (Archive::file): New const method.
12480         (class Add_archive_symbols): Add mapfile_ field.  Update
12481         constructor.  Change all callers.
12482         * readsyms.h (class Read_symbols): Likewise.
12483         (class Finish_group): Likewise.
12484         (class Read_script): Likewise.
12485         * common.cc: Include "mapfile.h".
12486         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12487         all callers.
12488         (Symbol_table::do_allocate_commons): Likewise.
12489         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12490         symbol allocation to mapfile.
12491         * common.h (class Allocate_commons_task): Add mapfile_ field.
12492         Update constructor.  Change all callers.
12493         * symtab.h (class Symbol_table): Update declarations.
12494         * layout.cc: Include "mapfile.h".
12495         (Layout_task_runner::run): Print information to mapfile.
12496         (Layout::create_gold_note): Change Output_data_fixed_space to
12497         Output_data_zero_fill.
12498         (Layout::create_build_id): Likewise.
12499         (Layout::print_to_mapfile): New function.
12500         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12501         constructor.  Change caller.
12502         (class Layout): Declare print_to_mapfile.
12503         * output.cc (Output_section::Input_section::print_to_mapfile): New
12504         function.
12505         (Output_section::add_input_section): If producing a map, always
12506         add to input_sections_ list.
12507         (Output_section::do_print_to_mapfile): New function.
12508         (Output_segment::print_sections_to_mapfile): New function.
12509         (Output_segment::print_section_list_to_mapfile): New function.
12510         * output.h: Include "mapfile.h".
12511         (Output_data::print_to_mapfile): New function.
12512         (Output_data::do_print_to_mapfile): New virtual function.
12513         (Output_segment_headers::do_print_to_mapfile): New function.
12514         (Output_file_header::do_print_to_mapfile): New function.
12515         (Output_data_const::do_print_to_mapfile): New function.
12516         (class Output_data_const_buffer): Add map_name_ field.  Update
12517         constructor.  Change all callers.  Add do_print_to_mapfile
12518         function.
12519         (class Output_data_fixed_space): Likewise.
12520         (class Output_data_space): Likewise.
12521         (class Output_data_zero_fill): New class.
12522         (Output_data_strtab::do_print_to_mapfile): New function.
12523         (Output_data_reloc_base::do_print_to_mapfile): New function.
12524         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12525         (Output_data_group::do_print_to_mapfile): New function.
12526         (Output_data_got::do_print_to_mapfile): New function.
12527         (Output_data_dynamic::do_print_to_mapfile): New function.
12528         (Output_symtab_xindex::do_print_to_mapfile): New function.
12529         (class Output_section): Declare do_print_to_mapflie.  Declare
12530         print_to_mapfile in Input_section.
12531         (class Output_segment): Declare new functions.
12532         * object.h (Sized_relobj::symbol_count): New function.
12533         * script-sections.cc
12534         (Output_section_element_dot_assignment::set_section_addresses):
12535         Change Output_data_fixed_space to Output_data_zero_fill.
12536         (Output_data_expression::do_print_to_mapfile): New function.
12537         * script.cc (read_input_script): Add mapfile parameter.  Change
12538         all callers.
12539         * script.h (read_input_script): Update declaration.
12540         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12541         (Eh_frame::do_print_to_mapfile): New function.
12542         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12543         (Output_merge_string::do_print_to_mapfile): New function.
12544         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12545         function.
12546         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12547         function.
12548         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12549         function.
12550         * Makefile.am (CCFILES): Add mapfile.cc.
12551         (HFILES): Add mapfile.h.
12552         * Makefile.in: Rebuild.
12553
12554 2008-05-19  Ian Lance Taylor  <iant@google.com>
12555
12556         * options.h (class General_options): Add -z relro.
12557         * layout.cc (Layout::Layout): Initialize relro_segment_.
12558         (Layout::add_output_section_data): Return the output section.
12559         (Layout::make_output_section): Rcognize relro sections and mark
12560         them appropriately.
12561         (Layout::attach_allocated_section_to_segment): Put relro sections
12562         in a PT_GNU_RELRO segment.
12563         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12564         section as relro.
12565         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12566         PT_TLS segments.
12567         (Layout::linkonce_mapping): Map d.rel.ro.local to
12568         .data.rel.ro.local.
12569         (Layout::output_section_name): Us .data.rel.ro.local for any
12570         section which begins with that.
12571         * layout.h (class Layout): Update add_output_section_data
12572         declaration.  Add relro_segment_ field.
12573         * output.cc (Output_section::Output_section): Initialize is_relro_
12574         and is_relro_local_ fields.
12575         (Output_segment::add_output_section): Group relro sections.
12576         (Output_segment::is_first_section_relro): New function.
12577         (Output_segment::maximum_alignment): If there is a relro section,
12578         align the segment to the common page size.
12579         (Output_segment::set_section_addresses): Track whether we are
12580         looking at relro sections.  If the last section is a relro
12581         section, align to the common page size.
12582         (Output_segment::set_section_list_addresses): Add in_relro
12583         parameter.  Change all callers.  Align to the page size when
12584         moving from relro to non-relro section.
12585         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12586         segment.
12587         * output.h (class Output_section): Add is_relro_ and
12588         is_relro_local_ fields.
12589         (Output_section::is_relro): New function.
12590         (Output_section::set_is_relro): New function.
12591         (Output_section::is_relro_local): New function.
12592         (Output_section::set_is_relro_local): New function.
12593         (class Output_segment): Update declarations.
12594         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12595         * sparc.cc (Target_sparc::got_section): Likewise.
12596         * x86_64.cc (Target_x86_64::got_section): Likewise.
12597         * testsuite/relro_test_main.cc: New file.
12598         * testsuite/relro_test.cc: New file.
12599         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12600         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12601         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12602         (relro_test.so, relro_test_pic.o): New targets.
12603         * testsuite/Makefile.in: Rebuild.
12604
12605 2008-05-16  Ian Lance Taylor  <iant@google.com>
12606
12607         * output.cc (Output_segment::add_output_section): Remove front
12608         parameter.
12609         * output.h (class Output_segment): Remove
12610         add_initial_output_section and overloaded add_output_section.
12611         Update declaration of remaining add_output_section.
12612         * layout.cc (Layout::create_interp): Call add_output_section
12613         rather than add_initial_output_section.
12614         (Layout::finish_dynamic_section): Likewise.
12615
12616         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12617         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12618         know the dynamic type.
12619         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12620         field.  Initialize it in constructor.
12621         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12622         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12623         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12624         reloc.
12625
12626         * output.cc (Output_reloc::get_address): Change return type to
12627         Elf_Addr.
12628         * output.h (class Output_reloc): Update get_address declaration.
12629         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12630         for section addresses.
12631
12632 2008-05-09  Ian Lance Taylor  <iant@google.com>
12633
12634         PR 6493
12635         * gold.cc (gold_nomem): Use return value of write.
12636
12637 2008-05-08  Ian Lance Taylor  <iant@google.com>
12638
12639         * symtab.c (Symbol::init_base_output_data): Add version
12640         parameter.  Change all callers.
12641         (Symbol::init_base_output_segment): Likewise.
12642         (Symbol::init_base_constant): Likewise.
12643         (Symbol::init_base_undefined): Likewise.
12644         (Sized_symbol::init_output_data): Likewise.
12645         (Sized_symbol::init_output_segment): Likewise.
12646         (Sized_symbol::init_constant): Likewise.
12647         (Sized_symbol::init_undefined): Likewise.
12648         (Symbol_table::do_define_in_output_data): If the new symbol has a
12649         version, mark it as the default.
12650         (Symbol_table::do_define_in_output_segment): Likewise.
12651         (Symbol_table::do_define_as_constant): Likewise.
12652         * symtab.h (class Symbol): Update declarations.
12653         (class Sized_symbol): Likewise.
12654         * resolve.cc (Symbol::override_version): New function.
12655         (Symbol::override_base): Call override_version.
12656         (Symbol::override_base_with_special): Likewise.
12657         * testsuite/ver_script_8.script: New file.
12658         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12659         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12660         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12661         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12662
12663 2008-05-06  Ian Lance Taylor  <iant@google.com>
12664
12665         PR 6049
12666         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12667         functions.
12668         (class General_options): Remove existing --undefined, and add
12669         --no-undefined instead.  Add new --undefined as synonym for -u.
12670         * archive.cc (Archive::add_symbols): Check whether symbol was
12671         named with -u.
12672         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12673         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12674         all uses.  Add IS_UNDEFINED.  Update declarations to split
12675         different versions of init_base.  Declare init_base_undefined.
12676         (Symbol::is_defined): Handle IS_UNDEFINED.
12677         (Symbol::is_undefined): Likewise.
12678         (Symbol::is_weak_undefined): Call is_undefined.
12679         (Symbol::is_absolute): Handle IS_CONSTANT.
12680         (class Sized_symbol): Update declarations to split different
12681         versions of init.  Declare init_undefined.
12682         (class Symbol_table): Declare new functions.
12683         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12684         Change all callers.
12685         (Symbol::init_base_output_data): Likewise.
12686         (Symbol::init_base_output_segment): Likewise.
12687         (Symbol::init_base_constant): Likewise.
12688         (Symbol::init_base_undefined): New function.
12689         (Sized_symbol::init_object): Rename from init.  Change all
12690         callers.
12691         (Sized_symbol::init_output_data): Likewise.
12692         (Sized_symbol::init_output_segment): Likewise.
12693         (Sized_symbol::init_constant): Likewise.
12694         (Sized_symbol::init_undefined): New function.
12695         (Symbol_table::add_undefined_symbols_from_command_line): New
12696         function.
12697         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12698         function.
12699         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12700         (Symbol::output_section): Likewise.
12701         (Symbol::set_output_section): Likewise.
12702         (Symbol_table::sized_finalize_symbol): Likewise.
12703         (Symbol_table::sized_write_globals): Likewise.
12704         * resolve.cc (Symbol_table::should_override): Likewise.
12705         (Symbol::override_base_with_special): Likewise.
12706
12707         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12708         symbol, change it to have default visibility.
12709         * testsuite/protected_1.cc: New file.
12710         * testsuite/protected_2.cc: New file.
12711         * testsuite/protected_3.cc: New file.
12712         * testsuite/protected_main_1.cc: New file.
12713         * testsuite/protected_main_2.cc: New file.
12714         * testsuite/protected_main_3.cc: New file.
12715         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12716         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12717         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12718         (protected_1.so): New target.
12719         (protected_1_pic.o, protected_2_pic.o): New targets.
12720         (protected_3_pic.o): New target.
12721         (check_PROGRAMS): Add protected_2.
12722         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12723         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12724         * testsuite/Makefile.in: Rebuild.
12725
12726         * options.h (DEFINE_var): Add set_user_set_##varname__.
12727         (DEFINE_bool_alias): New macro.
12728         (class General_options): Define -Bstatic using DEFINE_bool_alias
12729         rather than DEFINE_special.  Add --undefined as an alias for -z
12730         defs.
12731         * options.cc (General_options::parse_Bstatic): Remove.
12732
12733         * options.h (class General_options): Add --fatal-warnings.
12734         * main.cc (main): Implement --fatal-warnings.
12735         * errors.h (Errors::warning_count): New function.
12736
12737         * options.h (class General_options): Add -Bsymbolic-functions.
12738         * symtab.h (Symbol::is_preemptible): Check for
12739         -Bsymbolic-functions.
12740
12741 2008-05-05  Ian Lance Taylor  <iant@google.com>
12742
12743         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12744         as noVARNAME rather than no-VARNAME.
12745         (class General_options): Add option -z combreloc.
12746         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12747         get_address.
12748         (Output_reloc::sort_before) [SHT_REL]: New function.
12749         (Output_reloc::sort_before) [SHT_RELA]: New function.
12750         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12751         Sort_relocs_comparison.
12752         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12753         parameter.  Change all callers.
12754         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12755         sort_relocs parameter.  Change all callers.
12756         * output.cc (Output_reloc::get_address): New function, broken out
12757         of write_rel.
12758         (Output_reloc::write_rel): Call it.
12759         (Output_reloc::compare): New function.
12760         (Output_data_reloc_base::do_write): Optionally sort relocs.
12761
12762         * configure.ac: If targ_extra_obj is set, link it in.
12763         * configure.tgt: Initialize all variables.
12764         (x86_64*): Set targ_extra_obj and targ_extra_size.
12765         * configure: Rebuild.
12766
12767         * object.cc (Sized_relobj::include_section_group): Adjust section
12768         indexes read from group data.  Build vector to pass to
12769         layout_group.
12770         * layout.cc (Layout::layout_group): Add flags and shndxes
12771         parameters.  Remove contents parameter.  Change caller.  Update
12772         explicit instantiations.
12773         * layout.h (class Layout): Update layout_group declaration.
12774         * output.cc (Output_data_group::Output_data_group): Add flags and
12775         input_shndxes parameters.  Remove contents parameter.  Change
12776         caller.
12777         (Output_data_group::do_write): Change input_sections_ to
12778         input_shndxes_.
12779         * output.h (class Output_data_group): Update constructor
12780         declaration.  Rename input_sections_ to input_shndxes_.
12781         * testsuite/many_sections_test.cc: Add template.
12782
12783 2008-04-30  Cary Coutant  <ccoutant@google.com>
12784
12785         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12786
12787         * layout.cc (Layout::include_section): Refactored check for debug
12788         info section.
12789         (Layout::add_comdat): Add new parameters.  Change type
12790         of signature parameter.  Add object and shndx to signatures table.
12791         (Layout::find_kept_object): New function.
12792         * layout.h: Include <cstring>.
12793         (Layout::is_debug_info_section): New function.
12794         (Layout::add_comdat): Add new parameters.
12795         (Layout::find_kept_object): New function.
12796         (Layout::Kept_section): New struct.
12797         (Layout::Signatures): Change type of map range.
12798         * object.cc (Relobj::output_section_address): New function.
12799         (Sized_relobj::include_section_group): Add new parameters.  Change
12800         calls to Layout::add_comdat.  Change to build table of kept comdat
12801         groups and table mapping discarded sections to kept sections.
12802         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12803         (Sized_relobj::do_layout): Change calls to include_section_group and
12804         include_linkonce_section.
12805         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12806         value to zero when section is discarded.
12807         (Sized_relobj::map_to_kept_section): New function.
12808         * object.h (Relobj::output_section_address): New function.
12809         (Relobj::Comdat_group): New type.
12810         (Relobj::find_comdat_group): New function.
12811         (Relobj::Comdat_group_table): New type.
12812         (Relobj::Kept_comdat_section): New type.
12813         (Relobj::Kept_comdat_section_table): New type.
12814         (Relobj::add_comdat_group): New function.
12815         (Relobj::set_kept_comdat_section): New function.
12816         (Relobj::get_kept_comdat_section): New function.
12817         (Relobj::comdat_groups_): New field.
12818         (Relobj::kept_comdat_sections_): New field.
12819         (Symbol_value::input_value): Update comment.
12820         (Sized_relobj::map_to_kept_section) New function.
12821         (Sized_relobj::include_linkonce_section): Add new parameter.
12822         * target-reloc.h (Comdat_behavior): New type.
12823         (get_comdat_behavior): New function.
12824         (relocate_section): Add code to map a discarded section to the
12825         corresponding kept section when applying a relocation.
12826
12827 2008-04-30  Craig Silverstein  <csilvers@google.com>
12828
12829         * dwarf_reader.cc (next_generation_count): New static var.
12830         (Addr2line_cache_entry): New struct.
12831         (addr2line_cache): New static var.
12832         (Dwarf_line_info::one_addr2line): Added caching.
12833         (Dwarf_line_info::clear_addr2line_cache): New function.
12834         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12835         cache-size parameter.
12836         (Dwarf_line_info::one_addr2line_cache): New function.
12837         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12838         new cache-size argument to one_addr2line(), and clear cache.
12839
12840 2008-04-28  Cary Coutant  <ccoutant@google.com>
12841
12842         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12843         R_386_PC8 relocations.
12844
12845 2008-04-23  Ian Lance Taylor  <iant@google.com>
12846
12847         * object.cc (Sized_relobj::include_section_group): Check for
12848         invalid section group.
12849
12850         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12851         header size.
12852
12853         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12854         than read for file header.
12855         * archive.cc (Archive::include_member): Likewise.
12856
12857 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12858
12859         * aclocal.m4: Regenerate.
12860         * configure: Regenerate.
12861
12862 2008-04-19  Ian Lance Taylor  <iant@google.com>
12863
12864         * version.cc (version_string): Bump to 1.6.
12865
12866         * testsuite/Makefile.am (many_sections_r_test): New target.
12867         (many_sections_r_test_SOURCES): Remove.
12868         (many_sections_r_test_DEPENDENCIES): Remove.
12869         (many_sections_r_test_LDFLAGS): Remove.
12870         (many_sections_r_test_LDADD): Remove.
12871
12872         * object.cc (Sized_relobj::do_add_symbols): Always pass
12873         local_symbol_count_ to add_from_relobj.
12874
12875         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12876         every thousand variables.
12877         * testsuite/Makefile.in: Rebuild.
12878
12879         * object.cc (Xindex::initialize_symtab_xindex): New function.
12880         (Xindex::read_symtab_xindex): New function.
12881         (Xindex::sym_xindex_to_shndx): New function.
12882         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12883         available.
12884         (Sized_relobj::do_initialize_xindex): New function.
12885         (Sized_relobj::do_read_symbols): Adjust section links.
12886         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12887         parameter.  Change all callers.
12888         (Sized_relobj::include_section_group): Adjust section links and
12889         symbol section indexes.
12890         (Sized_relobj::do_layout): Adjust section links.
12891         (Sized_relobj::do_count_local_symbols): Adjust section links and
12892         symbol section indexes.
12893         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12894         ordinary and special symbols.
12895         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12896         dynsym_xindex parameters.  Change all callers.  Adjust section
12897         links.  Use SHN_XINDEX when needed.
12898         (Sized_relobj::get_symbol_location_info): Adjust section links.
12899         Don't get fooled by special symbols.
12900         * object.h (class Xindex): Define.
12901         (class Object): Add xindex_ parameter.  Declare virtual functoin
12902         do_initialize_xindex.
12903         (Object::adjust_sym_shndx): New function.
12904         (Object::set_xindex): New protected function.
12905         (class Symbol_value): Add is_ordinary_shndx_ field.
12906         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12907         (Symbol_value::value): Assert ordinary section.
12908         (Symbol_value::initialize_input_to_output_map): Likewise.
12909         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12910         Change all callers.
12911         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12912         all callers.
12913         (class Sized_relobj): Update declarations.
12914         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12915         parameter.  Change all callers.
12916         (Sized_relobj::adjust_shndx): New function.
12917         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12918         field.
12919         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12920         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12921         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12922         (Sized_dynobj::read_dynsym_section): Adjust section links.
12923         (Sized_dynobj::read_dynamic): Likewise.
12924         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12925         section links.
12926         (Sized_dynobj::do_initialize_xindex): New function.
12927         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12928         do_initialize_xindex.
12929         (Sized_dynobj::adjust_shndx): New function.
12930         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12931         dynsym_xindex_ fields.
12932         (Layout::finalize): Add a call to set_section_indexes before
12933         creating the symtab sections.
12934         (Layout::set_section_indexes): Don't do anything if the section
12935         already has a section index.
12936         (Layout::create_symtab_sections): Add shnum parameter.  Change
12937         caller.  Create .symtab_shndx section if needed.
12938         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12939         caller.
12940         (Layout::allocated_output_section_count): New function.
12941         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12942         needed.
12943         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12944         fields.  Update declarations.
12945         (Layout::symtab_xindex): New function.
12946         (Layout::dynsym_xindex): New function.
12947         (class Write_symbols_task): Add layout_ field.
12948         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12949         Change caller.
12950         * output.cc (Output_section_headers::Output_section_headers): Add
12951         shstrtab_section parameter.  Change all callers.
12952         (Output_section_headers::do_sized_write): Store overflow values
12953         for section count and section string table section index in
12954         section header zero.
12955         (Output_file_header::do_sized_write): Check for overflow of
12956         section count and section string table section index.
12957         (Output_symtab_xindex::do_write): New function.
12958         (Output_symtab_xindex::endian_do_write): New function.
12959         * output.h (class Output_section_headers): Add shstrtab_section_.
12960         Update declarations.
12961         (class Output_symtab_xindex): Define.
12962         (Output_section::has_out_shndx): New function.
12963         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12964         field.
12965         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12966         Change all callers.
12967         (Sized_symbol::init): Likewise.
12968         (Symbol::output_section): Check for ordinary symbol.
12969         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12970         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12971         callers.
12972         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12973         Change all callers.  Simplify handling of symbols from sections
12974         not included in the link.
12975         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12976         distinction.
12977         (Weak_alias_sorter::operator()): Assert that symbols are
12978         ordinary.
12979         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12980         distinction.
12981         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12982         parameters.  Change all callers.
12983         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12984         symbol distinction.  Use SHN_XINDEX when needed.
12985         (Symbol_table::write_section_symbol): Add symtab_xindex
12986         parameter.  Change all callers.
12987         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12988         SHN_XINDEX when needed.
12989         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12990         declarations.
12991         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12992         (Symbol::is_defined): Check is_ordinary.
12993         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12994         (Symbol::is_absolute, Symbol::is_common): Likewise.
12995         (class Sized_symbol): Update declarations.
12996         (class Symbol_table): Update declarations.
12997         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12998         parameters.  Change all callers.
12999         (Sized_symbol::override): Likewise.
13000         (Symbol_table::override): Likewise.
13001         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13002         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13003         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13004         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13005         to be in an ordinary section.
13006         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13007         object and is_ordinary parameters.  Change all callers.
13008         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13009         Change all callers.  Don't add undefined or non-ordinary symbols
13010         to reloc_map_.
13011         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13012         Change all callers.
13013         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13014         declarations.
13015         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13016         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13017         (Sized_relobj::relocate_sections): Likewise.
13018         * target-reloc.h (scan_relocs): Adjust section symbol index.
13019         (scan_relocatable_relocs): Likewise.
13020         * i386.cc (Scan::local): Check for ordinary symbols.
13021         * sparc.cc (Scan::local): Likewise.
13022         * x86_64.cc (Scan::local): Likewise.
13023         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13024         to symbol_section_and_value.
13025         * testsuite/many_sections_test.cc: New file.
13026         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13027         (check_PROGRAMS): Add many_sections_test.
13028         (many_sections_test_SOURCES): Define.
13029         (many_sections_test_DEPENDENCIES): Define.
13030         (many_sections_test_LDFLAGS): Define.
13031         (BUILT_SOURCES): Add many_sections_define.h.
13032         (many_sections_define.h): New target.
13033         (BUILT_SOURCES): Add many_sections_check.h.
13034         (many_sections_check.h): New target.
13035         (check_PROGRAMS): Add many_sections_r_test.
13036         (many_sections_r_test_SOURCES): Define.
13037         (many_sections_r_test_DEPENDENCIES): Define.
13038         (many_sections_r_test_LDFLAGS): Define.
13039         (many_sections_r_test_LDADD): Define.
13040         (many_sections_r_test.o): New target.
13041         * testsuite/Makefile.in: Rebuild.
13042
13043 2008-04-17  Cary Coutant  <ccoutant@google.com>
13044
13045         * errors.cc (Errors::info): New function.
13046         (gold_info): New function.
13047         * errors.h (Errors::info): New function.
13048         * gold.h (gold_info): New function.
13049         * object.cc (Input_objects::add_object): Print trace output.
13050         * options.cc (options::parse_set): New function.
13051         (General_options::parse_wrap): Deleted.
13052         (General_options::General_options): Deleted initializer.
13053         * options.h (options::String_set): New typedef.
13054         (options::parse_set): New function.
13055         (DEFINE_set): New macro.
13056         (General_options::wrap): Changed to use DEFINE_set. Changed
13057         callers of any_wrap_symbols and is_wrap_symbol.
13058         (General_options::trace, General_options::trace_symbol):
13059         New options.
13060         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13061         (General_options::wrap_symbols_): Deleted.
13062         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13063
13064 2008-04-17  David S. Miller  <davem@davemloft.net>
13065
13066         * options.cc (General_options::parse_V): New function.
13067         * options.h: Add entries for -V and -Qy.
13068
13069 2008-04-17  Ian Lance Taylor  <iant@google.com>
13070
13071         * common.cc (Symbol_table::allocate_commons): Remove options
13072         parameter.  Change caller.
13073         (Symbol_table::do_allocate_commons): Remove options parameter.
13074         Change caller.  Just call do_allocate_commons_list twice.
13075         (Symbol_table::do_allocate_commons_list): New function, broken out
13076         of do_allocate_commons.
13077         * common.h (class Allocate_commons_task): Remove options_ field.
13078         Update constructor.
13079         * symtab.cc (Symbol_table::Symbol_table): Initialize
13080         tls_commons_.
13081         (Symbol_table::add_from_object): Put TLS common symbols on
13082         tls_commons_ list.
13083         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13084         which are IN_OUTPUT_DATA.
13085         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13086         allocate_commons and do_allocate_commons declarations.  Declare
13087         do_allocate_commons_list.
13088         * gold.cc (queue_middle_tasks): Update creation of
13089         Allocate_commons_task to not pass options.
13090         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13091         (TLS_TEST_C_FLAGS): New variable.
13092         (tls_test_c_pic.o): New target.
13093         (tls_test_shared.so): Link in tls_test_c_pic.o.
13094         (tls_test_c_pic_ie.o): New target.
13095         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13096         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13097         (tls_test_c.o): New target.
13098         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13099         (tls_pic_test_LDADD): Likewise.
13100         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13101         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13102         (tls_test_c_gnu2.o): New target.
13103         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13104         tls_test_c_gnu2.o.
13105         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13106         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13107         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13108         * testsuite/tls_test.cc: Include "config.h".
13109         (t_last): Call t11_last.
13110         * testsuite/tls_test.h (t11, t11_last): Declare.
13111         * testsuite/tls_test_c.c: New file.
13112         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13113         * configure.ac: Check for OpenMP support.
13114         * configure, config.in, Makefile.in: Rebuild.
13115         * testsuite/Makefile.in: Rebuild.
13116
13117 2008-04-16  Cary Coutant  <ccoutant@google.com>
13118
13119         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13120         (Target_i386::tls_base_symbol_defined_): New field.
13121         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13122         (Target_i386::Scan::global): Likewise.
13123         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13124         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13125         (Target_x86_64::tls_base_symbol_defined_): New field.
13126         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13127         (Target_x86_64::Scan::global): Likewise.
13128
13129 2008-04-16  Cary Coutant  <ccoutant@google.com>
13130
13131         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13132         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13133         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13134         building shared libraries.
13135         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13136         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13137         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13138         * testsuite/Makefile.in: Rebuild.
13139         * testsuite/weak_undef.h: New file.
13140         * testsuite/weak_undef_file1.cc: Add extra test cases.
13141         * testsuite/weak_undef_file2.cc: Likewise.
13142         * testsuite/weak_undef_test.cc: Likewise.
13143
13144 2008-04-16  David S. Miller  <davem@davemloft.net>
13145
13146         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13147         Add issued_non_pic_error_ field.  Declare check_non_pic.
13148         (Target_sparc::Scan::check_non_pic): New function.
13149         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13150         (Target_sparc::Scan::global): Likewise.
13151
13152         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13153         * configure: Rebuild.
13154
13155         * options.h (DEFINE_enable): New macro.
13156         (new_dtags): New enable option.
13157         (initfirst, interpose, loadfltr, nodefaultlib,
13158         nodelete, nodlopen, nodump): New -z options.
13159         * layout.cc (Layout:finish_dynamic_section): If new
13160         dtags enabled, emit DT_RUNPATH.  Also, emit a
13161         DT_FLAGS_1 containing any specified -z flags.
13162
13163 2008-04-16  Ian Lance Taylor  <iant@google.com>
13164
13165         * copy-relocs.cc: New file.
13166         * copy-relocs.h: New file.
13167         * reloc.cc: Remove Copy_relocs code.
13168         * reloc.h: Likewise.
13169         * reloc-types.h (struct Reloc_types) [both versions]: Add
13170         get_reloc_addend_noerror.
13171         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13172         variants of add_global which take an addend which must be zero.
13173         * i386.cc: Include "copy-relocs.h".
13174         (class Target_i386): Change type of copy_relocs_ to variable,
13175         update initializer.
13176         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13177         Change all callers.
13178         (Target_i386::do_finalize_sections): Change handling of
13179         copy_relocs_.
13180         * sparc.cc: Include "copy-relocs.h".
13181         (class Target_sparc): Change type of copy_relocs_ to variable,
13182         update initializer.
13183         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13184         Change all callers.
13185         (Target_sparc::do_finalize_sections): Change handling of
13186         copy_relocs_.
13187         * x86_64.cc: Include "copy-relocs.h".
13188         (class Target_x86_64): Change type of copy_relocs_ to variable,
13189         update initializer.
13190         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13191         class.  Change all callers.
13192         (Target_x86_64::do_finalize_sections): Change handling of
13193         copy_relocs_.
13194         * Makefile.am (CCFILES): Add copy-relocs.cc.
13195         (HFILES): Add copy-relocs.h.
13196
13197         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13198
13199         * testsuite/script_test_4.sh: Permit leading zeroes.
13200
13201 2008-04-15  Ian Lance Taylor  <iant@google.com>
13202
13203         * script-sections.cc (Script_sections::create_segments): Use
13204         header_size_adjustment even when there is enough room for the
13205         headers.
13206         * testsuite/script_test_4.sh: New file.
13207         * testsuite/script_test_4.t: New file.
13208         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13209         (check_DATA): Add script_test_4.stdout.
13210         (MOSTLYCLEANFILES): Likewise.
13211         (script_test_4): New target.
13212         (script_test_4.stdout): New target.
13213         * testsuite/Makefile.in: Rebuild.
13214
13215         * sparc.cc: Add definitions for Output_data_plt_sparc class
13216         constants.
13217
13218 2008-04-14  David S. Miller  <davem@davemloft.net>
13219
13220         * sparc.cc: New file.
13221         * Makefile.am (TARGETSOURCES): Add sparc.cc
13222         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13223         * configure.tgt: Document targ_extra_size and
13224         targ_extra_big_endian.  Add entries for sparc-* and
13225         sparc64-*.
13226         * configure.ac: Handle targ_extra_size and
13227         targ_extra_big_endian.
13228         * Makefile.in: Rebuild.
13229         * configure: Likewise.
13230         * po/POTFILES.in: Likewise.
13231         * po/gold.pot: Likewise.
13232
13233 2008-04-14  Ian Lance Taylor  <iant@google.com>
13234
13235         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13236         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13237         in the name/type/flags to section mapping.  Don't call
13238         allocate_output_section.
13239         (Layout::choose_output_section): Change parameter from adjust_name
13240         to is_input_section.  Don't permit input sections after sections
13241         are attached to segments.  Don't call allocate_output_section.
13242         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13243         not write_enable_output_section.
13244         (Layout::make_output_section): Don't push to
13245         unattached_section_list_ nor call attach_to_segment.  Call
13246         attach_section_to_segment if sections are attached.
13247         (Layout::attach_sections_to_segments): New function.
13248         (Layout::attach_section_to_segment): New function.
13249         (Layout::attach_allocated_section_to_segment): Rename from
13250         attach_to_segment.  Remove flags parameter.
13251         (Layout::allocate_output_section): Remove function.
13252         (Layout::write_enable_output_section): Remove function.
13253         * layout.h (class Layout): Update for above changes.  Add new
13254         field sections_are_attached_.
13255         * output.h (Output_section::update_flags_for_input_section): New
13256         function.
13257         * output.cc (Output_section::add_input_section): Call
13258         update_flags_for_input_section.
13259         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13260
13261 2008-04-11  Cary Coutant  <ccoutant@google.com>
13262
13263         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13264         thought unnecessary.
13265         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13266
13267 2008-04-11  Ian Lance Taylor  <iant@google.com>
13268
13269         * output.h (class Output_section_data): Remove inline definition
13270         of set_addralign.
13271         * output.cc (Output_section_data::set_addralign): New function.
13272
13273 2008-04-11  Cary Coutant  <ccoutant@google.com>
13274
13275         Add support for TLS descriptors for i386 and x86_64.
13276         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13277         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13278         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13279         GOT_TYPE_TLS_DESC.
13280         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13281         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13282         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13283         relocations.
13284         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13285         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13286         Fix problem with initial-exec relocations.
13287         (Target_i386::Relocate::relocate_tls): Likewise.
13288         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13289         relaxation.
13290         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13291         support for section-plus-offset dynamic table entries.
13292         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13293         (Output_data_dynamic::Dynamic_entry): Add support for
13294         section-plus-offset dynamic table entries.
13295         (Output_data_dynamic::Classification): Likewise.
13296         (Output_data_dynamic::classification_): Renamed offset_.
13297         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13298         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13299         (Target_x86_64::make_plt_section): New function.
13300         (Target_x86_64::reserve_tlsdesc_entries): New function.
13301         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13302         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13303         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13304         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13305         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13306         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13307         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13308         add extra PLT entry for TLS descriptors.
13309         (Output_data_plt_x86_64::got_): New field.
13310         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13311         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13312         fields.
13313         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13314         descriptors.
13315         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13316         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13317         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13318         R_386_TLS_DESC_CALL relocations.
13319         (Target_x86_64::Scan::global): Likewise.
13320         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13321         for TLS descriptors.
13322         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13323         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13324         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13325         GD-to-IE relaxation.
13326         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13327         and TLS_DESCRIPTORS.
13328         * Makefile.in: Rebuild.
13329         * configure: Rebuild.
13330         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13331         (tls_test_shared2.so): New target.
13332         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13333         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13334         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13335         (tls_shared_gd_to_ie_test_LDADD): New variable.
13336         (tls_shared_gnu2_gd_to_ie_test): New target.
13337         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13338         New targets.
13339         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13340         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13341         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13342         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13343         (tls_shared_gnu2_test): New target.
13344         (tls_test_gnu2_shared.so): New target.
13345         (tls_shared_gnu2_test_SOURCES): New variable.
13346         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13347         (tls_shared_gnu2_test_LDFLAGS): New variable.
13348         (tls_shared_gnu2_test_LDADD): New variable.
13349         * testsuite/Makefile.in: Rebuild.
13350         * testsuite/Makefile.
13351
13352 2008-04-11  Ian Lance Taylor  <iant@google.com>
13353
13354         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13355         justsyms.t.
13356         * testsuite/Makefile.in: Rebuild.
13357
13358         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13359         long.
13360         * testsuite/script_test_2.cc (main): Adjust test.
13361
13362 2008-04-11  David S. Miller  <davem@davemloft.net>
13363             Ian Lance Taylor  <iant@google.com>
13364
13365         * options.h (General_options): Add entries for '-Y' and
13366         '-relax'.
13367         * options.cc (General_options:finalize): If -Y was used, add those
13368         entries to the library path instead of the default "/lib" and
13369         "/usr/lib".
13370
13371 2008-04-11  David S. Miller  <davem@davemloft.net>
13372
13373         * testsuite/justsyms.t: Start at 0x100.
13374         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13375         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13376         long.
13377         * testsuite/script_test_2.cc: Adjust string and section length
13378         checks.
13379
13380 2008-04-09  Ian Lance Taylor  <iant@google.com>
13381
13382         PR gold/5996
13383         * script-sections.cc (Sections_element::allocate_to_segment): Add
13384         orphan parameter.
13385         (Output_section_definition::allocate_to_segment): Likewise.
13386         (Orphan_output_section::allocate_to_segment): Likewise.
13387         (Script_sections::attach_sections_using_phdrs_clause): Don't
13388         propagate non-PT_LOAD segments to orphan sections.
13389         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13390         readelf rather than objdump.
13391         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13392         .interp section and PT_INTERP segment are the same size.
13393         * testsuite/Makefile.in: Rebuild.
13394
13395         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13396         aliases for symbols defined in the same object.
13397         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13398         (weak_alias_test_SOURCES): New variable.
13399         (weak_alias_test_DEPENDENCIES): New variable.
13400         (weak_alias_test_LDFLAGS): New variable.
13401         (weak_alias_test_LDADD): New variable.
13402         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13403         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13404         (weak_alias_test_3.o): New target.
13405         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13406         * testsuite/weak_alias_test_main.cc: New file.
13407         * testsuite/weak_alias_test_1.cc: New file.
13408         * testsuite/weak_alias_test_2.cc: New file.
13409         * testsuite/weak_alias_test_3.cc: New file.
13410
13411 2008-04-08  Ian Lance Taylor  <iant@google.com>
13412
13413         * options.h (class General_options): Add --noinhibit-exec option.
13414         * main.cc (main): Check --noinhibit-exec.
13415
13416         * options.h (class General_options): Define --wrap as a special
13417         option.  Add wrap_symbols_ field.
13418         (General_options::any_wrap_symbols): New function.
13419         (General_options::is_wrap_symbol): New function.
13420         * options.cc (General_options::parse_wrap): New function.
13421         (General_options::General_options): Initialize wrap_symbols_.
13422         * symtab.cc (Symbol_table::wrap_symbol): New function.
13423         (Symbol_table::add_from_object): Handle --wrap.
13424         * symtab.h (class Symbol_table): Declare wrap_symbol.
13425         * target.h (Target::wrap_char): New function.
13426         (Target::Target_info): Add wrap_char field.
13427         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13428         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13429         * testsuite/testfile.cc (Target_test::test_target_info):
13430         Likewise.
13431
13432         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13433         there is one.
13434
13435         * layout.h (class Layout): Add added_eh_frame_data_ field.
13436         * layout.cc (Layout::Layout): Initialize new field.
13437         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13438         output section until we find a section we merged successfully.
13439         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13440         that the size be non-zero.
13441
13442         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13443         qualifier.
13444
13445 2008-04-08  Craig Silverstein  <csilvers@google.com>
13446
13447         * configure.ac: Export new conditional variable HAVE_ZLIB.
13448         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13449         on HAVE_ZLIB.
13450         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13451         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13452
13453 2008-04-07  Ian Lance Taylor  <iant@google.com>
13454
13455         * version.cc (version_string): Set to "1.5".
13456
13457         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13458         Add issued_non_pic_error_ field.  Declare check_non_pic.
13459         (Target_x86_64::Scan::check_non_pic): New function.
13460         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13461         (Target_x86_64::Scan::global): Likewise.
13462
13463         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13464         addend parameter.  Change caller.  Handle merge sections.
13465         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13466         Address to Addend.  Don't add in the result of
13467         local_section_offset, pass down the addend and use the returned
13468         value.
13469         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13470         Update declarations of local_section_offset and symbol_value.
13471         * testsuite/two_file_test_1.cc (t18): New function.
13472         * testsuite/two_file_test_2.cc (f18): New function.
13473         * testsuite/two_file_test_main.cc (main): Call t18.
13474         * testsuite/two_file_test.h (t18, f18): Declare.
13475
13476         * configure.ac: Don't test for objdump, c++filt, or readelf.
13477         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13478         conditionals.
13479         (TEST_READELF): New variable.
13480         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13481         (check_PROGRAMS): Add two_file_strip_test.
13482         (two_file_strip_test): New target.
13483         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13484         (two_file_same_shared_strip_test_SOURCES): New variable.
13485         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13486         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13487         (two_file_same_shared_strip_test_LDADD): New variable.
13488         (two_file_shared_strip.so): New target.
13489         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13490         (ver_test_5.syms, ver_test_7.syms): Likewise.
13491         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13492         (strip_test_3.stdout): Use TEST_OBJDUMP.
13493         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13494
13495 2008-04-04  Cary Coutant  <ccoutant@google.com>
13496
13497         * symtab.h (Symbol::is_weak_undefined): New function.
13498         (Symbol::is_strong_undefined): New function.
13499         (Symbol::is_absolute): New function.
13500         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13501         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13502         absolute symbols.
13503         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13504         (weak_undef_test): New target.
13505         * testsuite/Makefile.in: Rebuild.
13506         * testsuite/weak_undef_file1.cc: New file.
13507         * testsuite/weak_undef_file2.cc: New file.
13508         * testsuite/weak_undef_test.cc: New file.
13509
13510 2008-04-03  Craig Silverstein  <csilvers@google.com>
13511
13512         * compressed_output.h (class Output_compressed_section): Use
13513         unsigned buffer.
13514         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13515         add zlib header.
13516         (zlib_compressed_suffix): Removed.
13517         (Output_compressed_section::set_final_data_size): Use unsigned
13518         buffers.
13519         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13520         Fix linker invocation.
13521         (flagstest_o_specialfile_and_compress_debug_sections):
13522         Likewise.
13523         * testsuite/Makefile.in: Regenerated.
13524
13525 2008-04-02  David S. Miller  <davem@davemloft.net>
13526
13527         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13528         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13529
13530 2008-04-02  Craig Silverstein  <csilvers@google.com>
13531
13532         * TODO: New file.
13533
13534 2008-04-02  Ian Lance Taylor  <iant@google.com>
13535
13536         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13537         parameters.  Update for new key type to views_.  Change all
13538         callers.
13539         (File_read::read): Adjust for byteshift in returned view.
13540         (File_read::add_view): New function, broken out of
13541         find_and_make_view.
13542         (File_read::make_view): New function, broken out of
13543         find_and_make_view.
13544         (File_read::find_or_make_view): Add offset and aligned
13545         parameters.  Rewrite accordingly.  Change all callers.
13546         (File_read::get_view): Add offset and aligned parameters.  Adjust
13547         for byteshift in return value.
13548         (File_read::get_lasting_view): Likewise.
13549         * fileread.h (class File_read): Update declarations.
13550         (class File_read::View): Add byteshift_ field.  Add byteshift to
13551         constructor.  Add byteshift method.
13552         * archive.h (Archive::clear_uncached_views): New function.
13553         (Archive::get_view): Add aligned parameter.  Change all callers.
13554         * object.h (Object::get_view): Add aligned parameter.  Change all
13555         callers.
13556         (Object::get_lasting_view): Likewise.
13557
13558         * fileread.cc (File_read::release): Don't call clear_views if
13559         there are multiple objects.
13560         * fileread.h (File_read::clear_uncached_views): New function.
13561         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13562         on the archive.
13563
13564 2008-03-31  Cary Coutant  <ccoutant@google.com>
13565
13566         Add thin archive support.
13567         * archive.cc (Archive::armagt): New const.
13568         (Archive::setup): Remove task parameter and calls to unlock.
13569         (Archive::unlock_nested_archives): New function.
13570         (Archive::read_header): Add nested_off parameter. Change
13571         all callers.
13572         (Archive::interpret_header): Likewise.
13573         (Archive::include_all_members): Change to handle thin
13574         archives.
13575         (Archive::include_member): Likewise.
13576         * archive.h (Archive::Archive): Add new parameters and
13577         initializers.
13578         (Archive::armagt): New const.
13579         (Archive::setup): Remove task parameter.
13580         (Archive::unlock_nested_archives): New function.
13581         (Archive::read_header): Add nested_off parameter.
13582         (Archive::interpret_header): Likewise.
13583         (Archive::Nested_archive_table): New typedef.
13584         (Archive::is_thin_archive_): New field.
13585         (Archive::nested_archives_): New field.
13586         (Archive::options_): New field.
13587         (Archive::dirpath_): New field.
13588         (Archive::task_): New field.
13589         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13590         for thin archives.  Pass additional parameters to
13591         Archive::Archive.  Unlock the archive file after calling
13592         Archive::setup.
13593
13594 2008-03-29  Ian Lance Taylor  <iant@google.com>
13595
13596         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13597         version symbol to be local.
13598         * testsuite/ver_test_4.sh: New file.
13599         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13600         (check_DATA): Add ver_test_4.syms.
13601         (ver_test_4.syms): New target.
13602         * testsuite/Makefile.in: Rebuild.
13603
13604         * output.cc
13605         (Output_section::Input_section_sort_entry::has_priority): New
13606         function.
13607         (Output_section::Input_section_sort_entry::match_file_name): New
13608         function.
13609         (Output_section::Input_section_sort_entry::match_section_name):
13610         Remove.
13611         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13612         Remove.
13613         (Output_section::Input_section_sort_entry::match_section_file):
13614         Remove.
13615         (Output_section::Input_section_sort_compare::operator()): Rewrite
13616         using new Input_section_sort_entry functions.  Sort crtbegin and
13617         crtend first.  Sort sections with no priority before sections with
13618         a priority.
13619         * testsuite/initpri1.c (d3): Check j != 4.
13620         (cd5): New constructor/destructor function.
13621         (main): Check j != 2.
13622
13623         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13624         new symbol when resolving, don't call set_is_default.
13625         * testsuite/ver_test_7.cc: New file.
13626         * testsuite/ver_test_7.sh: New file.
13627         * testsuite/Makefile.am (ver_test_7.so): New target.
13628         (ver_test_7.o): New target.
13629         (check_SCRIPTS): Add ver_test_7.sh.
13630         (check_DATA): Add ver_test_7.syms.
13631         (ver_test_7.syms): New target.
13632
13633 2008-03-28  Ian Lance Taylor  <iant@google.com>
13634
13635         * layout.cc (Layout::layout): If we see an input section with a
13636         name that needs sorting, set the must_sort flag for the output
13637         section.
13638         (Layout::make_output_section): If the name of the output section
13639         indicates that it might require sorting, set the may_sort flag.
13640         * output.h (Output_section::may_sort_attached_input_sections): New
13641         function.
13642         (Output_section::set_may_sort_attached_input_sections): New
13643         function.
13644         (Output_section::must_sort_attached_input_sections): New
13645         function.
13646         (Output_section::set_must_sort_attached_input_sections): New
13647         function.
13648         (class Output_section): Declare Input_section_sort_entry.  Define
13649         Input_section_sort_compare.  Declare
13650         sort_attached_input_sections.  Add new fields:
13651         may_sort_attached_input_sections_,
13652         must_sort_attached_input_sections_,
13653         attached_input_sections_are_sorted_.
13654         * output.cc (Output_section::Output_section): Initialize new
13655         fields.
13656         (Output_section::add_input_section): Add an entry to
13657         input_sections_ if may_sort or must_sort are true.
13658         (Output_section::set_final_data_size): Call
13659         sort_attached_input_sections if necessary.
13660         (Output_section::Input_section_sort_entry): Define new class.
13661         (Output_section::Input_section_sort_compare::operator()): New
13662         function.
13663         (Output_section::sort_attached_input_sections): New function.
13664         * configure.ac: Check whether the compiler supports constructor
13665         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13666         * testsuite/initpri1.c: New file.
13667         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13668         CONSTRUCTOR_PRIORITY.
13669         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13670         (initpri1_LDFLAGS): New variable.
13671         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13672
13673 2008-03-27  Ian Lance Taylor  <iant@google.com>
13674
13675         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13676         * testsuite/common_test_1.c: New file.
13677         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13678         (common_test_1_SOURCES): New variable.
13679         (common_test_1_DEPENDENCIES): New variable.
13680         (common_test_1_LDFLAGS): New variable.
13681
13682         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13683         and commons_ correctly when NAME/VERSION does not override
13684         NAME/NULL.
13685         * testsuite/ver_test_6.c: New file.
13686         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13687         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13688         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13689
13690 2008-03-26  Ian Lance Taylor  <iant@google.com>
13691
13692         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13693         of an undefined symbol from a version script.
13694         * testsuite/Makefile.am (ver_test_5.so): New target.
13695         (ver_test_5.o): New target.
13696         (check_SCRIPTS): Add ver_test_5.sh.
13697         (check_DATA): Add ver_test_5.syms.
13698         (ver_test_5.syms): New target.
13699         * testsuite/ver_test_5.cc: New file.
13700         * testsuite/ver_test_5.script: New file.
13701         * testsuite/ver_test_5.sh: New file.
13702         * Makefile.in, testsuite/Makefile.in: Rebuild.
13703
13704         PR gold/5986
13705         Fix problems building gold with gcc 4.3.0.
13706         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13707         (gold_error_at_location, gold_warning_at_location): Use it.
13708         * configure.ac: Check whether we can compile and use a template
13709         function with a printf attribute.
13710         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13711         when jumping over bytes.
13712         * object.cc: Instantiate Object::read_section_data.
13713         * debug.h: Include <cstring>
13714         * dwarf_reader.cc: Include <algorithm>
13715         * main.cc: Include <cstring>.
13716         * options.cc: Include <cstring>.
13717         * output.cc: Include <cstring>.
13718         * script.cc: Include <cstring>.
13719         * script.h: Include <string>.
13720         * symtab.cc: Include <cstring> and <algorithm>.
13721         * target-select.cc: Include <cstring>.
13722         * version.cc: Include <string>.
13723         * testsuite/testmain.cc: Include <cstdlib>.
13724         * configure, config.in: Rebuild.
13725
13726 2008-03-25  Ian Lance Taylor  <iant@google.com>
13727
13728         * options.cc: Include "../bfd/bfdver.h".
13729         (options::help): Print bug reporting address.
13730
13731         * version.cc (print_version): Adjust output for current value of
13732         BFD_VERSION_STRING.
13733
13734         * NEWS: New file.
13735
13736         * options.cc (options::help): Print list of supported targets.
13737         * target-select.h: Include <vector>.
13738         (class Target_selector): Make machine_, size_, and is_big_endian_
13739         fields const.  Add bfd_name_ and instantiated_target_ fields.
13740         (Target_selector::Target_selector): Add bfd_name parameter.
13741         (Target_selector::recognize): Make non-virtual, call
13742         do_recognize.
13743         (Target_selector::recognize_by_name): Make non-virtual, call
13744         do_recognize_by_name.
13745         (Target_selector::supported_names): New function.
13746         (Target_selector::bfd_name): New function.
13747         (Target_selector::do_instantiate_target): New pure virtual
13748         function.
13749         (Target_selector::do_recognize): New virtual function.
13750         (Target_selector::do_recognize_by_name): New virtual function.
13751         (Target_selector::instantiate_target): New private function.
13752         (supported_target_names): Declare.
13753         * target-select.cc (Target_selector::Target_selector): Update for
13754         new parameter and fields.
13755         (select_target_by_name): Check that the name matches before
13756         calling recognize_by_name.
13757         (supported_target_names): New function.
13758         * i386.cc (class Target_selector_i386): Update Target_selector
13759         constructor call.  Remove recognize and recognize_by_name.  Add
13760         do_instantiate_target.
13761         * x86_64.cc (class Target_selector_x86_64): Likewise.
13762         * testsuite/testfile.cc (class Target_selector_test): Update for
13763         changes to Target_selector.
13764
13765         * README: Rewrite, with some notes on unsupported features.
13766
13767 2008-03-24  Cary Coutant  <ccoutant@google.com>
13768
13769         * i386.cc (Target_i386::Got_type): New enum declaration.
13770         (Target_i386::Scan::local): Updated callers of Output_data_got
13771         member functions.
13772         (Target_i386::Scan::global): Likewise.
13773         (Target_i386::Relocate::relocate): Likewise.
13774         (Target_i386::Relocate::relocate_tls): Likewise.
13775         * object.h (Got_offset_list): New class.
13776         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13777         (Sized_relobj::local_got_offset): Likewise.
13778         (Sized_relobj::set_local_got_offset): Likewise.
13779         (Sized_relobj::local_has_tls_got_offset): Removed.
13780         (Sized_relobj::local_tls_got_offset): Removed.
13781         (Sized_relobj::set_local_tls_got_offset): Removed.
13782         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13783         * output.cc (Output_data_got::add_global): Added got_type parameter.
13784         (Output_data_got::add_global_with_rel): Likewise.
13785         (Output_data_got::add_global_with_rela): Likewise.
13786         (Output_data_got::add_global_pair_with_rel): New function.
13787         (Output_data_got::add_global_pair_with_rela): New function.
13788         (Output_data_got::add_local): Added got_type parameter.
13789         (Output_data_got::add_local_with_rel): Likewise.
13790         (Output_data_got::add_local_with_rela): Likewise.
13791         (Output_data_got::add_local_pair_with_rel): New function.
13792         (Output_data_got::add_local_pair_with_rela): New function.
13793         (Output_data_got::add_global_tls): Removed.
13794         (Output_data_got::add_global_tls_with_rel): Removed.
13795         (Output_data_got::add_global_tls_with_rela): Removed.
13796         (Output_data_got::add_local_tls): Removed.
13797         (Output_data_got::add_local_tls_with_rel): Removed.
13798         (Output_data_got::add_local_tls_with_rela): Removed.
13799         * output.h (Output_data_got::add_global): Added got_type parameter.
13800         (Output_data_got::add_global_with_rel): Likewise.
13801         (Output_data_got::add_global_with_rela): Likewise.
13802         (Output_data_got::add_global_pair_with_rel): New function.
13803         (Output_data_got::add_global_pair_with_rela): New function.
13804         (Output_data_got::add_local): Added got_type parameter.
13805         (Output_data_got::add_local_with_rel): Likewise.
13806         (Output_data_got::add_local_with_rela): Likewise.
13807         (Output_data_got::add_local_pair_with_rel): New function.
13808         (Output_data_got::add_local_pair_with_rela): New function.
13809         (Output_data_got::add_global_tls): Removed.
13810         (Output_data_got::add_global_tls_with_rel): Removed.
13811         (Output_data_got::add_global_tls_with_rela): Removed.
13812         (Output_data_got::add_local_tls): Removed.
13813         (Output_data_got::add_local_tls_with_rel): Removed.
13814         (Output_data_got::add_local_tls_with_rela): Removed.
13815         * resolve.cc (Symbol::override_base_with_special): Removed
13816         reference to has_got_offset_ field.
13817         * symtab.cc (Symbol::init_fields): Replaced initialization
13818         of got_offset_ with got_offsets_.  Removed initialization
13819         of has_got_offset_
13820         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13821         (Symbol::got_offset): Likewise.
13822         (Symbol::set_got_offset): Likewise.
13823         (Symbol::has_tls_got_offset): Removed.
13824         (Symbol::tls_got_offset): Removed.
13825         (Symbol::set_tls_got_offset): Removed.
13826         (Symbol::got_offset_): Removed.
13827         (Symbol::tls_mod_got_offset_): Removed.
13828         (Symbol::tls_pair_got_offset_): Removed.
13829         (Symbol::got_offsets_): New field.
13830         (Symbol::has_got_offset): Removed.
13831         (Symbol::has_tls_mod_got_offset): Removed.
13832         (Symbol::has_tls_pair_got_offset): Removed.
13833         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13834         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13835         member functions.
13836         (Target_x86_64::Scan::global): Likewise.
13837         (Target_x86_64::Relocate::relocate): Likewise.
13838         (Target_x86_64::Relocate::relocate_tls): Likewise.
13839
13840 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13841
13842         * yyscript.y: Fix spelling error in comment.
13843
13844 2008-03-24  Ian Lance Taylor  <iant@google.com>
13845
13846         * options.h (class General_options): Define build_id option.
13847         * layout.h (class Layout): Declare write_build_id, create_note,
13848         create_build_id.  Add build_id_note_ member.
13849         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13850         "libiberty.h", "md5.h", "sha1.h".
13851         (Layout::Layout): Initialize eh_frame_data_,
13852         eh_frame_hdr_section_, and build_id_note_.
13853         (Layout::finalize): Call create_build_id.
13854         (Layout::create_note): New function, broken out of
13855         Layout::create_gold_note.
13856         (Layout::create_gold_note): Call create_note.
13857         (Layout::create_build_id): New function.
13858         (Layout::write_build_id): New function.
13859         (Close_task_runner::run): Call write_build_id.
13860
13861         * x86_64.cc: Correct license to GPLv3.
13862
13863 2008-03-23  Ian Lance Taylor  <iant@google.com>
13864
13865         * options.cc: Include "demangle.h".
13866         (parse_optional_string): New function.
13867         (parse_long_option): Handle takes_optional_argument.
13868         (parse_short_option): Update dash_z initializer.  Handle
13869         takes_optional_argument.
13870         (General_options::General_options): Initialize do_demangle_.
13871         (General_options::finalize): Set do_demangle_.  Handle demangling
13872         style.
13873         * options.h (parse_optional_string): Declare.
13874         (struct One_option): Add optional_arg field.  Update constructor.
13875         Update call constructor calls.  Add takes_optional_argument
13876         function.
13877         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13878         (DEFINE_optional_string): Define.
13879         (General_options::demangle): Change from DEFINE_bool to
13880         DEFINE_optional_string.
13881         (General_options::no_demangle): New function.
13882         (General_options::do_demangle): New function.
13883         (General_options::set_do_demangle): New function.
13884         (General_options::execstack_status_): Move definition to end of
13885         class definition.
13886         (General_options::static_): Likewise.
13887         (General_options::do_demangle_): New field.
13888         * object.cc (big_endian>::get_symbol_location_info): Call
13889         Options::do_demangle, not Options::demangle.
13890         * symtab.cc (demangle): Likewise.
13891
13892 2008-03-22  Ian Lance Taylor  <iant@google.com>
13893
13894         * gold.h: Include <cstddef> and <sys/types.h>
13895         * options.h: Include <cstring>.
13896
13897 2008-03-21  Ian Lance Taylor  <iant@google.com>
13898
13899         * Added source code to GNU binutils.