cbedb79ebc5ca2e9bb6d13cf264226298b89223e
[external/binutils.git] / gold / ChangeLog
1 2012-10-12  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4         add_local_ifunc_entry): Revert last change.
5         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
6
7 2012-10-05  Alan Modra  <amodra@gmail.com>
8
9         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
10         do_plt_address_for_global): New functions.
11         (Output_data_got_powerpc::do_write): Don't segfault when linking
12         statically.
13         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
14         add_local_ifunc_entry): Return true on adding entry..
15         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
16         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
17         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
18         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
19         set up symbols here.
20         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
21         syms here.  Do so even when no .iplt.  Don't segfault when linking
22         statically.
23         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
24         new variants without reloc param.
25         (Glink_sym_ent::Glink_sym_ent): Likewise.
26         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
27         reloc when refs will resolve to plt call stub.
28         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
29         R_PPC_PLTREL24 to resolve locally.
30         (Target_powerpc::Scan::global): Correct ifunc handling.
31         (Target_powerpc::Relocate::relocate): Correct local sym glink
32         lookup.  Don't destroy "value" when we have a plt call stub,
33         and when checking plt call validity.
34         (Target_powerpc::do_dynsym_value): Simplify.
35
36 2012-10-05  Alan Modra  <amodra@gmail.com>
37
38         * i386.cc (Output_data_plt_i386::address_for_global,
39         address_for_local): Add plt offset to returned value.  Adjust uses.
40         * sparc.cc (Output_data_plt_sparc::address_for_global,
41         address_for_local): Likewise.
42         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
43         address_for_local): Likewise.
44         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
45         address_for_local): Likewise.
46         * target.h (Target::plt_address_for_global, plt_address_for_local):
47         Update comment.
48         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
49         (Output_data_got::Got_entry::write): Nor here.
50         * output.h: Comment fix.
51
52 2012-10-02  Jiong Wang  <jiwang@tilera.com>
53
54         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
55         global_offset_table_ value for larget got.
56         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
57
58 2012-09-29  Alan Modra  <amodra@gmail.com>
59
60         * powerpc.cc (Target_powerpc::iplt_): New output section.
61         (Target_powerpc::iplt_section, make_iplt_section,
62         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
63         (Target_powerpc::make_plt_entry): Handle ifunc syms.
64         Target_powerpc::plt_entry_count): Count iplt entries too.
65         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
66         reloc section in constructor.  New params.
67         (Target_powerpc::make_plt_section): Create reloc section here instead.
68         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
69         functions.
70         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
71         (Output_data_glink::add_entry, find_entry): New functions to
72         deal with local syms.
73         (Glink_sym_ent): Add support for local syms.
74         (Output_data_glink::do_write): Handle ifunc plt entries.
75         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
76         (Target_powerpc::Scan::local, global): Handle ifunc syms.
77         (Target_powerpc::Relocate::relocate): Likewise.
78         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
79
80 2012-09-25  Alan Modra  <amodra@gmail.com>
81
82         * object.h (Sized_relobj_file::adjust_local_symbol,
83         do_adjust_local_symbol): New functions.
84         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
85         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
86         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
87         and irregular opd entry spacing.
88         (Powerpc_relobj::do_read_relocs): Add opd size checks.
89         (Global_symbol_visitor_opd): New functor.
90         (Target_powerpc::do_finalize_sections): Omit global symbols defined
91         on deleted opd entries.
92
93 2012-09-15  Jiong Wang  <jiwang@tilera.com>
94
95         * tilegx.cc: New file.
96         * Makefile.am (TARGETSOURCES): Add tilegx.cc
97         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
98         * configure.tgt: Add entries for tilegx*.
99         * configure.ac: Likewise.
100         * Makefile.in: Rebuild.
101         * configure: Likewise.
102         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
103         tilegx.
104
105 2012-09-13  Alan Modra  <amodra@gmail.com>
106
107         * target-reloc.h (scan_relocs): Call scan.local for relocs
108         against symbols in discarded sections.  Pass is_discarded
109         param.
110         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
111         Add is_discarded param.
112         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
113         is_discarded to flag opd entry as discarded.  Don't emit dyn
114         relocs on such entries.
115         (Target_powerpc::Scan::global): Similarly detect and handle
116         such opd entries.
117         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
118         opd_ent_.  Update all uses.
119         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
120         (Target_powerpc::relocate_section): Zero out discarded opd
121         entry relocs.
122
123 2012-09-12  Ian Lance Taylor  <iant@google.com>
124
125         PR gold/14570
126         * output.cc: Rename Output_data_got template parameter from size
127         to got_size for all functions.  Compile all variants of
128         Output_data_got.
129         (Output_data_got::Got_entry::write): Correct use of size for
130         symbol value.  Use local_is_tls rather than casting to
131         Sized_relobj_file.
132         * object.h (class Object): Add local_is_tls and do_local_is_tls.
133         (class Sized_relobj_file): Add do_local_is_tls.
134         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
135
136 2012-09-11  Alan Modra  <amodra@gmail.com>
137
138         PR gold/14566
139         * layout.cc (Layout::set_segment_offsets): When using
140         common-page-size alignment, ensure we are on a new max-page-size
141         page.
142         * output.cc (Output_segment::set_section_addresses): Use
143         abi_pagesize, not common_pagesize for relro boundary.
144         (Output_segment::set_offset): Likewise.
145
146 2012-09-11  Alan Modra  <amodra@gmail.com>
147
148         * output.h (Output_data_got::add_global_tls, add_local_tls,
149         add_local_tls_pair): New functions.
150         (Output_data_got::add_local_pair_with_rel): Remove second
151         reloc param.  Expand comment.
152         (Output_data_got::Got_entry): Rename use_plt_offset_ to
153         use_plt_or_tls_offset_, similarly for constructor param.
154         (Output_data_got::Got_entry::write): Add got_index param.
155         * output.cc (Output_data_got::add_global_tls, add_local_tls,
156         add_local_tls_pair): New functions.
157         (Output_data_got::Got_entry::write): Handle tls symbols
158         with use_plt_or_tls_offset_ set specially.
159         (Output_data_got::add_local_pair_with_rel): Only one reloc.
160         (Output_data_got::do_write): Replace iterator with index, pass
161         index to entry write function.
162         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
163         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
164         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
165         call.
166         * i386.cc (Target_i386::Scan::local): Likewise.
167         * sparc.cc (Target_sparc::Scan::local): Likewise.
168         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
169         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
170         do_tls_offset_for_global): New functions.
171         (Target_powerpc::Scan::local): Correct TLS relocations and got
172         entry values.
173         (Target_powerpc::Scan::global): Don't emit unnecessary
174         dynamic relocations on TLS GOT entries.
175
176 2012-09-10  Matthias Klose  <doko@ubuntu.com>
177
178         * config.in: Disable sanity check for kfreebsd.
179
180 2012-09-10  Sterling Augustine  <saugustine@google.com>
181
182         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
183         (Gdb_index::pubtypes_read): New parameter.
184         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
185         to calls.
186         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
187         pubtypes_object_.
188
189 2012-09-09  Alan Modra  <amodra@gmail.com>
190
191         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
192         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
193         * gc.h (gc_process_relocs): Call target gc_add_reference.
194         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
195         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
196         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
197         unnecessary cast.
198         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
199         to cater for when we don't need code offset.  Update use.
200         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
201         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
202         set_opd_valid): New functions.
203         (Target_powerpc::do_gc_add_reference): New function.
204         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
205         stashed refs.
206         (Target_powerpc::do_gc_mark_symbol): New function.
207
208 2012-09-06  Cary Coutant  <ccoutant@google.com>
209
210         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
211         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
212         (Dwarf_die::skip_attributes): Likewise.
213         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
214         * testsuite/gdb_index_test.cc (inline_func_1): New function.
215         (main): Call it.
216         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
217
218 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
219
220         * testsuite/script_test_3.t: Add .got.plt output section
221         statement.
222         * testsuite/script_test_4.t: Likewise.
223
224 2012-09-05  Alan Modra  <amodra@gmail.com>
225
226         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
227         update all uses and lose "enum" when using type.
228
229 2012-09-05  Alan Modra  <amodra@gmail.com>
230
231         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
232         * configure: Regenerate.
233         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
234         (plugin_final_layout.stdout): Likewise.
235         (memory_test): Set page sizes to 0x1000.
236         * testsuite/Makefile.in: Regenerate.
237         * testsuite/discard_locals_test.sh: Add FIXME comment.
238         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
239         * testsuite/pr14265.t: Add .got output section statement.
240         * testsuite/script_test_2.t: Likewise.
241         * testsuite/script_test_3.t: Likewise.
242         * testsuite/script_test_4.t: Likewise.
243         * testsuite/script_test_5.t: Likewise.
244         * testsuite/script_test_6.t: Likewise.
245         * testsuite/script_test_7.t: Likewise.
246         * testsuite/script_test_9.t: Likewise.
247
248 2012-09-05  Alan Modra  <amodra@gmail.com>
249
250         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
251         (Powerpc_relocate_functions::Status): New typedef.
252         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
253         (Target_powerpc::Scan::local): Handle REL64.
254         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
255         for REL32 and REL64.
256         (Target_powerpc::symval_for_branch): New function, extracted from..
257         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
258         checks.  Report overflow errors.
259
260 2012-09-05  Alan Modra  <amodra@gmail.com>
261
262         * object.h (Sized_relobj_file::emit_relocs): Delete.
263         (Sized_relobj_file::emit_relocs_reltype): Delete.
264         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
265         relocate_relocs for --emit-relocs.
266         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
267         * output.h: Update comment.
268         (Output_segment::first_section): New function.
269         (Output_segment::first_section_load_address): Use first_section.
270         * output.cc (Output_segment::first_section): New function extracted..
271         (Output_segment::first_section_load_address): ..from here.  Delete.
272         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
273         * target.h (Sized_target::relocate_for_relocatable): Likewise.
274         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
275         adjust call to target.h function.
276         * i386.cc (Target_i386): Likewise.
277         * sparc.cc (Target_sparc): Likewise.
278         * x86_64.cc (Target_x86_64): Likewise.
279         * powerpc.cc (Target_powerpc): Likewise.
280         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
281         first tls section has section symbol for optimised local dynamic
282         output relocs.
283         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
284         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
285         optimised tls code.
286         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
287         Rename to relocate_relocs.  Update error message.
288
289 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
290
291         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
292         --just-symbols.
293
294 2012-08-31  Alan Modra  <amodra@gmail.com>
295
296         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
297         (Powerpc_relobj::toc_base_offset): New stub function.
298         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
299         got_mod_index_offset to tlsld_got_offset.  Update all refs.
300         (Target_powerpc::Relocate::enum skip_tls): New.
301         (Target_powerpc::call_tls_get_addr_): New var.
302         (Target_powerpc::is_branch_reloc): Move to file scope.
303         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
304         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
305         New functions.
306         (Target_powerpc::enum Got_type): Delete old values, add new ones.
307         (powerpc_info): Correct common_pagesize for ppc64.
308         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
309         (Powerpc_relocate_functions): Add overflow check enums and functions.
310         Add non-shift version of rela, rela_ua.  Delete all rel public
311         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
312         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
313         addr16_ha3, addr14 functions.
314         (Output_data_got_powerpc::add_constant_pair): New function.
315         (Output_data_got_powerpc::got_base_offset): Likewise.
316         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
317         (instruction constants): Sort, add some more.
318         (Output_data_glink::do_write): Add and use Address typedef.  Use
319         object->toc_base_offset() stub for 64-bit.
320         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
321         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
322         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
323         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
324         Always treat .opd relocs as against locally defined symbol.
325         Correct condition for RELATIVE relocs.
326         (Target_powerpc::do_finalize_sections): Test for NULL sections.
327         (Target_powerpc::Relocate::relocate): Use plt call stub as value
328         for 32-bit syms with a plt entry.  Correct ppc64 toc base
329         calculations.  Handle TLS relocs, and more.  Add overflow
330         checking and adjust for Powerpc_relocate_functions changes.
331         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
332         Reinstate --emit-relocs code with FIXME.
333
334 2012-08-30  Alan Modra  <amodra@gmail.com>
335
336         * layout.cc (Layout::set_segment_offsets): Set p_align to
337         abi_pagesize, not common_pagesize.
338         (Layout::relaxation_loop_body): Similarly use abi_pagesize
339         to determine whether file header can go in segment.
340
341 2012-08-30  Alan Modra  <amodra@gmail.com>
342
343         * output.h (Output_reloc::Output_reloc <output section>): Add
344         is_relative param.  Adjust calls.
345         (Output_reloc::add_output_section_relative): New functions.
346         * output.cc (Output_reloc::Output_reloc <output section>): Handle
347         is_relative.
348         (Output_reloc::symbol_value): Handle SECTION_CODE.
349
350 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
351
352         * gold.cc (queue_middle_tasks): Call layout again when unique
353         segments for sections is desired.
354         * layout.cc (Layout::Layout): Initialize new members.
355         (Layout::get_output_section_flags): New function.
356         (Layout::choose_output_section): Call get_output_section_flags.
357         (Layout::layout): Make output section for mapping to a unique segment.
358         (Layout::insert_section_segment_map): New function.
359         (Layout::attach_allocated_section_to_segment): Make unique segment for
360         output sections marked so.
361         (Layout::segment_precedes): Check for unique segments when sorting.
362         * layout.h (Layout::Unique_segment_info): New struct.
363         (Layout::Section_segment_map): New typedef.
364         (Layout::insert_section_segment_map): New function.
365         (Layout::get_output_section_flags): New function.
366         (Layout::is_unique_segment_for_sections_specified): New function.
367         (Layout::set_unique_segment_for_sections_specified): New function.
368         (Layout::unique_segment_for_sections_specified_): New member.
369         (Layout::section_segment_map_): New member.
370         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
371         Rename is_gc_pass_one to is_pass_one.
372         Rename is_gc_pass_two to is_pass_two.
373         Rename is_gc_or_icf to is_two_pass.
374         Check for which pass based on whether symbols data is present.
375         Make it two pass when unique segments for sections is desired.
376         * output.cc (Output_section::Output_section): Initialize new
377         members.
378         * output.h (Output_section::is_unique_segment): New function.
379         (Output_section::set_is_unique_segment): New function.
380         (Output_section::is_unique_segment_): New member.
381         (Output_section::extra_segment_flags): New function.
382         (Output_section::set_extra_segment_flags): New function.
383         (Output_section::extra_segment_flags_): New member.
384         (Output_section::segment_alignment): New function.
385         (Output_section::set_segment_alignment): New function.
386         (Output_section::segment_alignment_): New member.
387         (Output_segment::Output_segment): Initialize is_unique_segment_.
388         (Output_segment::is_unique_segment): New function.
389         (Output_segment::set_is_unique_segment): New function.
390         (Output_segment::is_unique_segment_): New member.
391         * plugin.cc (allow_unique_segment_for_sections): New function.
392         (unique_segment_for_sections): New function.
393         (Plugin::load): Add new functions to transfer vector.
394         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
395         * Makefile.in: Regenerate.
396         * testsuite/plugin_final_layout.sh: Check if unique segment
397         functionality works.
398         * testsuite/plugin_section_order.c (onload): Check if new interfaces
399         are available.
400         (allow_unique_segment_for_sections): New global.
401         (unique_segment_for_sections): New global.
402         (claim_file_hook): Call allow_unique_segment_for_sections.
403         (all_symbols_read_hook): Call unique_segment_for_sections.
404
405 2012-08-22  Cary Coutant  <ccoutant@google.com>
406
407         * layout.cc (Layout::include_section): Don't assert on GROUP
408         sections with --emit-relocs.
409
410 2012-08-21  Cary Coutant  <ccoutant@google.com>
411
412         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
413         if --export-dynamic-symbol names an undef symbol.
414
415 2012-08-18  Alan Modra  <amodra@gmail.com>
416
417         * powerpc.cc: Formatting and white space.
418         (Powerpc_relobj): Rename got2_section_ to special_.
419         Add opd_ent_shndx_ and opd_ent_off_ vectors.
420         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
421         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
422         (Target_powerpc): Add Address typedef and invalid_address.  Use
423         throughout.
424         (Target_powerpc::is_branch_reloc): New function.
425         (Powerpc_relocate_functions): Add Address typedef, use throughout.
426         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
427         for dst_mask, value and addend.
428         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
429         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
430         (Output_data_glink::do_write): Correct toc base.  Don't try to use
431         uint16_t for 24-bit offset.  Use get_output_section_offset and
432         check return.
433         (Target_powerpc::Scan::local): Handle more relocs.
434         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
435         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
436         Plug in toc restoring insn after plt calls.  Translate branches
437         to function descriptor symbols to corresponding entry point.
438         (Target_powerpc::relocate_for_relocatable): Check return from
439         get_output_section_offset.
440         * symtab.h: Comment typo.
441
442 2012-08-14  Ian Lance Taylor  <iant@google.com>
443
444         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
445         unsupported_relocal_local to call unsupported_reloc_global.
446
447 2012-08-14  Nick Clifton  <nickc@redhat.com>
448
449         PR ld/14265
450         * script-sections.cc (Sections_element::output_section_name): Add
451         keep return parameter.
452         (Output_section_element::match_name): Add keep return parameter.
453         Return the value of the keep_ member.
454         * script-sections.h (class Output_section): Update
455         output_section_name prototype.
456         * layout.cc (Layout::keep_input_section): New public member
457         function.
458         (Layout::choose_output_section): Pass keep parameter to
459         output_section_name.
460         * layout.h (class Layout): Add keep_input_section.
461         * object.cc (Sized_relobj_file::do_layout): Check for kept input
462         sections.
463         * testsuite/Makefile.am: Add a test.
464         * testsuite/Makefile.in: Regenerate.
465         * testsuite/pr14265.c: Source file for the test.
466         * testsuite/pr14265.t: Linker script for the test.
467         * testsuite/pr14265.sh: Shell script for the test.
468
469 2012-08-14  Alan Modra  <amodra@gmail.com>
470
471         * target.h (Target::output_section_name): New function.
472         (Target::do_output_section_name): New function.
473         * layout.cc (Layout::choose_output_section): Call the above.
474         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
475
476 2012-08-14  Alan Modra  <amodra@gmail.com>
477
478         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
479         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
480         for replace_constant call.
481         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
482         (Output_data_glink::do_print_to_mapfile): New function.
483         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
484         (Target_powerpc::Relocate::relocate): Likewise.
485
486 2012-08-14  Alan Modra  <amodra@gmail.com>
487
488         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
489         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
490         (Output_data_glink::add_entry,find_entry): Remove shndx param.
491         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
492         all references to shndx_.  Handle special case for R_PPC_PLTREL24
493         here.
494         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
495         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
496         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
497         here.
498         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
499         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
500
501 2012-08-12  Alan Modra  <amodra@gmail.com>
502
503         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
504         (glink insn constants): Use uint32_t.
505         (Output_data_glink::add_entry): Use insert, not [] operator.
506
507 2012-08-11  Alan Modra  <amodra@gmail.com>
508
509         * object.h (Sized_relobj_file::find_shdr): New function.
510         (Sized_relobj_file::find_special_sections): New function.
511         * object.cc (Sized_relobj_file::find_shdr): New function.
512         (Sized_relobj_file::find_eh_frame): Use find_shdr.
513         (Sized_relobj_file::find_special_sections): New function, split out..
514         (Sized_relobj_file::do_read_symbols): ..from here.
515         * output.h (Output_data_got::replace_constant): New function.
516         (Output_data_got::num_entries): New function.
517         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
518         (Output_data_got::got_offset): Protected rather than private.
519         (Output_data_got::replace_got_entry): New function.
520         * output.cc (Output_data_got::replace_got_entry): New function.
521         * powerpc.cc (class Powerpc_relobj): New.
522         (class Powerpc_relocate_functions): Delete all psymval variants or
523         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
524         Implement _ha functions using corresponding _hi function.
525         (Powerpc_relobj::find_special_sections): New function.
526         (Target_powerpc::do_make_elf_object): New function.
527         (class Output_data_got_powerpc): New.
528         (class Output_data_glink): New.
529         (class Powerpc_scan_relocatable_reloc): New.
530         Many more changes througout file.
531
532 2012-08-09  Nick Clifton  <nickc@redhat.com>
533
534         * po/vi.po: Updated Vietnamese translation.
535
536 2012-08-07  Ian Lance Taylor  <iant@google.com>
537
538         * layout.cc (Layout::add_target_dynamic_tags): If
539         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
540         plt_rel.
541
542 2012-07-30  Nick Clifton  <nickc@redhat.com>
543
544         * po/gold.pot: Updated template.
545         * po/es.po: Updated Spanish translation.
546
547 2012-07-18  Cary Coutant  <ccoutant@google.com>
548
549         PR gold/14344
550         * configure.ac: Add check for -gpubnames support.
551         * configure: Regenerate.
552         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
553         support; force -gno-pubnames.
554         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
555         support.
556         (gdb_index_test_4): New test.
557         * testsuite/Makefile.in: Regenerate.
558         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
559         * testsuite/gdb_index_test_2.sh: Likewise.
560         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
561         * testsuite/gdb_index_test_4.sh: New script.
562         * testsuite/gdb_index_test_comm.sh: New script with common code;
563         don't look for space after colon.
564
565 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
566
567         * gold.cc (queue_middle_tasks): Update function order only after
568         deferred objects due to plugins are processed.
569
570 2012-07-11  Ian Lance Taylor  <iant@google.com>
571
572         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
573         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
574         (Target_arm::scan_reloc_for_stub): Likewise.
575         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
576         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
577         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
578         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
579         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
580
581 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
582             Ian Lance Taylor  <iant@google.com>
583
584         PR gold/14309
585         * configure.ac: Test whether std::tr1::hash<off_t> works.
586         * gold.h: Add a specialization for std::tr1::hash<off_t> if
587         needed.
588         * output.h (class Output_fill): Add virtual destructor.
589         * configure, config.in: Rebuild.
590
591 2012-06-22  Roland McGrath  <mcgrathr@google.com>
592
593         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
594
595 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
596
597         * plugin.cc (Plugin::load): Handle position independent executables.
598
599 2012-06-06  Cary Coutant  <ccoutant@google.com>
600
601         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
602         add .debug_macro.
603         (lines_only_debug_sections): Likewise.
604         (gdb_fast_lookup_sections): New static array.
605         (is_gdb_debug_section): Rename formal parameter.
606         (is_lines_only_debug_section): Likewise.
607         (is_gdb_fast_lookup_section): New function.
608         (Layout::include_section): Check for ".zdebug_" prefix; pass
609         section name suffix to is_gdb_debug_section, et al.; check for
610         fast-lookup sections when building .gdb_index.
611         * options.h (--strip-debug-gdb): Update GDB version number.
612
613 2012-06-06  Cary Coutant  <ccoutant@google.com>
614
615         * configure.ac: Add check for fallocate.
616         * configure: Regenerate.
617         * config.in: Regenerate.
618
619         * options.h (class General_options): Add --mmap-output-file and
620         --posix-fallocate options.
621         * output.cc: (posix_fallocate): Remove; replace with...
622         (gold_fallocate): New function.
623         (Output_file::map_no_anonymous): Call gold_fallocate.
624         (Output_file::map): Check --mmap-output-file option.
625
626 2012-06-05  Jing Yu  <jingyu@google.com>
627
628         * gold.h (textdomain): Add do {} to empty while(0).
629         (bindtextdomain): Likewise.
630
631 2012-06-04  Cary Coutant  <ccoutant@google.com>
632
633         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
634         has_dynsym_index.
635
636 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
637
638         * symtab.cc (Symbol_table::define_special_symbol):
639         Initialize *poldsym to prevent uninitialized variable errors.
640
641 2012-05-23  Cary Coutant  <ccoutant@google.com>
642
643         * layout.cc (Layout::section_name_mapping): Add rules to handle
644         exact match on .data.rel.ro.local or .data.rel.ro.
645         (Layout::output_section_name): Check for exact matches.
646
647 2012-05-23  Cary Coutant  <ccoutant@google.com>
648
649         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
650         more carefully.
651
652 2012-05-22  Cary Coutant  <ccoutant@google.com>
653
654         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
655         object before exporting symbol.
656
657 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
658
659         * testsuite/tls_test.cc: Include "config.h" first.
660         * testsuite/tls_test_c.c: Likewise.
661
662 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
663             Nick Clifton  <nickc@redhat.com>
664
665         PR 14072
666         * configure.in: Add check that sysdep.h has been included before
667         any system header files.
668         * configure: Regenerate.
669         * config.in: Regenerate.
670
671 2012-05-14  Cary Coutant  <ccoutant@google.com>
672
673         * layout.cc (Layout::make_output_section): Mark .tdata section
674         as RELRO.
675         * testsuite/relro_test.cc: Add a TLS variable.
676
677 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
678
679         PR gold/14091
680         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
681         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
682         R_X86_64_64.
683
684 2012-05-08  Cary Coutant  <ccoutant@google.com>
685
686         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
687         (lines_only_debug_sections): Likewise.
688
689 2012-05-02  Roland McGrath  <mcgrathr@google.com>
690
691         * nacl.cc: New file.
692         * nacl.h: New file.
693         * Makefile.am (CCFILES, HFILES): Add them.
694         * Makefile.in: Regenerate.
695         * i386.cc (Output_data_plt_i386_nacl): New class.
696         (Output_data_plt_i386_nacl_exec): New class.
697         (Output_data_plt_i386_nacl_dyn): New class.
698         (Target_i386_nacl): New class.
699         (Target_selector_i386_nacl): New class.
700         (target_selector_i386): Use it instead of Target_selector_i386.
701         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
702         (Target_x86_64_nacl): New class.
703         (Target_selector_x86_64_nacl): New class.
704         (target_selector_x86_64, target_selector_x32): Use it instead of
705         Target_selector_x86_64.
706         * arm.cc (Output_data_plt_arm_nacl): New class.
707         (Target_arm_nacl): New class.
708         (Target_selector_arm_nacl): New class.
709         (target_selector_arm, target_selector_armbe): Use it instead of
710         Target_selector_arm.
711
712         * target-select.cc (select_target): Take new Input_file* and off_t
713         arguments, pass them on to recognize method of selector.
714         * object.cc (make_elf_sized_object): Update caller.
715         * parameters.cc (parameters_force_valid_target): Likewise.
716         * incremental.cc (make_sized_incremental_binary): Likewise.
717         * target-select.h: Update decl.
718         (Target_selector::recognize): Take new Input_file* argument,
719         pass it on to do_recognize.
720         (Target_selector::do_recognize): Take new Input_file* argument.
721         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
722         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
723         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
724         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
725
726         * target.h (Target::Target_info): New members isolate_execinstr
727         and rosegment_gap.
728         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
729         * arm.cc (Target_arm::arm_info): Update initializer.
730         * i386.cc (Target_i386::i386_info): Likewise.
731         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
732         * sparc.cc (Target_sparc::sparc_info): Likewise.
733         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
734         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
735         * layout.cc (Layout::attach_allocated_section_to_segment):
736         Take new const Target* argument.  If target->isolate_execinstr(), act
737         like --rosegment.
738         (Layout::find_first_load_seg): Take new const Target* argument;
739         if target->isolate_execinstr(), reject PF_X segments.
740         (Layout::relaxation_loop_body): Update caller.
741         (Layout::set_segment_offsets): If target->isolate_execinstr(),
742         reset file offset to zero when we hit LOAD_SEG, and then do a second
743         loop over the segments before LOAD_SEG to reassign offsets after
744         addresses have been determined.  Handle target->rosegment_gap().
745         (Layout::attach_section_to_segment): Take new const Target* argument;
746         pass it to attach_allocated_section_to_segment.
747         (Layout::make_output_section): Update caller.
748         (Layout::attach_sections_to_segments): Take new const Target* argument;
749         pass it to attach_section_to_segment.
750         * gold.cc (queue_middle_tasks): Update caller.
751         * layout.h (Layout): Update method decls with new arguments.
752
753         * arm.cc (Target_arm::Target_arm): Take optional argument for the
754         Target_info pointer to use.
755         (Target_arm::do_make_data_plt): New virtual method.
756         (Target_arm::make_data_plt): New method that calls it.
757         (Target_arm::make_plt_entry): Use it.
758         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
759         for the section alignment.
760         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
761         method.
762         (Output_data_plt_arm::first_plt_entry_offset): Call it.
763         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
764         method.
765         (Output_data_plt_arm::get_plt_entry_size): Call it.
766         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
767         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
768         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
769         method.
770         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
771         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
772         method instead of sizeof(plt_entry).
773         (Output_data_plt_arm::add_entry): Likewise.
774         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
775         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
776         than static method.
777         (Target_arm::plt_entry_size): Likewise.
778         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
779         Move to ...
780         (Output_data_plt_arm_standard): ... here, new class.
781         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
782         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
783         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
784
785         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
786         Take additional argument for the PLT entry size.
787         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
788         Use get_plt_entry_size method rather than plt_entry_size variable.
789         (Output_data_plt_x86_64::reserve_slot): Likewise.
790         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
791         (Output_data_plt_x86_64::add_entry): Likewise.
792         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
793         (Output_data_plt_x86_64::address_for_global): Likewise.
794         (Output_data_plt_x86_64::address_for_local): Likewise.
795         (Output_data_plt_x86_64::set_final_data_size): Likewise.
796         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
797         Make method non-static.
798         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
799         method.
800         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
801         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
802         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
803         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
804         virtual method.
805         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
806         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
807         virtual method.
808         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
809         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
810         virtual method.
811         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
812         (Output_data_plt_x86_64::plt_entry_size)
813         (Output_data_plt_x86_64::first_plt_entry)
814         (Output_data_plt_x86_64::plt_entry)
815         (Output_data_plt_x86_64::tlsdesc_plt_entry)
816         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
817         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
818         (Output_data_plt_x86_64_standard): ... here, new class.
819         (Target_x86_64::Target_x86_64): Take optional argument for the
820         Target_info pointer to use.
821         (Target_x86_64::do_make_data_plt): New virtual method.
822         (Target_x86_64::make_data_plt): New method to call it.
823         (Target_x86_64::init_got_plt_for_update): Use that.
824         Call this->plt_->add_eh_frame method here.
825         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
826         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
827         rather than static method.
828         (Target_x86_64::plt_entry_size): Likewise.
829         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
830         rather than plt_entry_size variable.  Move guts of PLT filling to...
831         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
832         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
833         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
834
835         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
836         additional argument for the section alignment.
837         Don't do add_eh_frame_for_plt here.
838         (Output_data_plt_i386::first_plt_entry_offset): Make the method
839         non-static.  Use get_plt_entry_size method rather than plt_entry_size
840         variable.
841         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
842         method.
843         (Output_data_plt_i386::get_plt_entry_size): Call it.
844         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
845         (Output_data_plt_i386::add_eh_frame): New method to call it.
846         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
847         method.
848         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
849         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
850         method.
851         (Output_data_plt_i386::fill_plt_entry): New method to call it.
852         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
853         method instead of plt_entry_size.
854         (Output_data_plt_i386::plt_entry_size)
855         (Output_data_plt_i386::plt_eh_frame_fde_size)
856         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
857         (Output_data_plt_i386_standard): ... here, new class.
858         (Output_data_plt_i386_exec): New class.
859         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
860         (Output_data_plt_i386_exec::first_plt_entry): ... here.
861         (Output_data_plt_i386::exec_plt_entry): Move to ...
862         (Output_data_plt_i386_exec::plt_entry): ... here.
863         (Output_data_plt_i386_dyn): New class.
864         (Output_data_plt_i386::first_plt_entry): Move to ...
865         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
866         (Output_data_plt_i386::dyn_plt_entry): Move to ...
867         (Output_data_plt_i386_dyn::plt_entry): ... here.
868         (Target_i386::Target_i386): Take optional argument for the Target_info
869         pointer to use.
870         (Target_i386::do_make_data_plt): New virtual method.
871         (Target_i386::make_data_plt): New method to call it.
872         (Target_i386::make_plt_section): Use that.
873         Call this->plt_->add_eh_frame method here.
874         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
875         rather than plt_entry_size variable.
876         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
877         (Output_data_plt_i386::address_for_local): Likewise.
878         (Output_data_plt_i386::do_write): Likewise.
879         Move guts of PLT filling to...
880         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
881         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
882         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
883         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
884
885 2012-05-01  Cary Coutant  <ccoutant@google.com>
886
887         * dwarf_reader.cc (Dwarf_die::read_attributes)
888         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
889         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
890         * reduced_debug_output.cc
891         (Output_reduced_debug_info_section::get_die_end): Remove
892         DW_FORM_GNU_ref_index.  Add default case.
893
894 2012-04-26  Mark Wielaard  <mjw@redhat.com>
895
896         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
897         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
898         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
899         DW_AT_high_pc as offset from DW_AT_low_pc.
900
901         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
902         * testsuite/Makefile.in: Regenerate.
903         * testsuite/gdb_index_test_3.c: New test source file.
904         * testsuite/gdb_index_test_3.sh: New test source file.
905
906 2012-04-25  Ian Lance Taylor  <iant@google.com>
907
908         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
909         pointer.
910         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
911         as a class, not a struct.
912         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
913         (Target_arm::apply_cortex_a8_workaround): Likewise.
914         * gc.h: Declare Reloc_types as a struct, not a class.
915         * object.h: Declare Symbols_data as a struct.
916         * reloc.h: Declare Read_relocs_data as a struct.
917         * target.h: Declare Relocate_info as a struct.
918
919 2012-04-24  David S. Miller  <davem@davemloft.net>
920
921         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
922         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
923         and R_SPARC_WPLT30.
924
925 2012-04-24  Cary Coutant  <ccoutant@google.com>
926
927         * incremental-dump.cc (find_input_containing_global): Replace
928         magic number with symbolic constant.
929         (dump_incremental_inputs): Update version number.
930         * incremental.cc (Output_section_incremental_inputs): Update version
931         number; import symbolic constants from Incremental_inputs_reader.
932         (Incremental_inputs::create_data_sections): Align relocations
933         section correctly for 64-bit targets.
934         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
935         constants; add padding.
936         (Output_section_incremental_inputs::write_header): Add assert for
937         header_size.
938         (Output_section_incremental_inputs::write_input_files): Add assert
939         for input_entry_size.
940         (Output_section_incremental_inputs::write_info_blocks): Add padding;
941         add assert for object_info_size, input_section_entry_size,
942         global_sym_entry_size.
943         * incremental.h (Incremental_inputs_reader): Add symbolic constants
944         for data structure sizes; use them.
945         (Incremental_input_entry_reader): Import symbolic constants from
946         Incremental_inputs_reader; use them.
947
948 2012-04-23  David S. Miller  <davem@davemloft.net>
949
950         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
951         and elf_flags_set_.
952         (Target_sparc::Target_sparc): Initialize new fields.
953         (Target_sparc::do_make_elf_object): New function.
954         (Target_sparc::do_adjust_elf_header): New function.
955
956 2012-04-23  Cary Coutant  <ccoutant@google.com>
957
958         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
959         CU range table of gdb index.
960
961 2012-04-20  David S. Miller  <davem@davemloft.net>
962
963         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
964         instead of false.
965
966 2012-04-16  David S. Miller  <davem@davemloft.net>
967
968         * sparc.cc (Target_sparc::got_address): New function.
969         (Sparc_relocate_functions::gdop_hix22): New function.
970         (Sparc_relocate_functions::gdop_lox10): New function.
971         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
972         relocs.
973         (Target_sparc::Scan::local): Likewise if the global symbol is not
974         preemptible and is not IFUNC.
975         (Target_sparc::Relocate::relocate): Perform GOTDATA code
976         transformations for local and non-preemptible non-IFUNC global
977         symbols.
978
979         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
980         writing out 64-bit part of ranges.
981
982         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
983         -fpic and -fpie respectively.
984         * Makefile.in: Regenerate.
985
986         * sparc.cc (class Target_sparc): Add rela_ifunc_.
987         (Target_sparc::Target_sparc): Initialize new field.
988         (Target_sparc::do_plt_section_for_global): New function.
989         (Target_sparc::do_plt_section_for_local): New function.
990         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
991         (Target_sparc::make_plt_section): New function, broken out of
992         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
993         (Target_sparc::make_plt_entry): Call make_plt_section.
994         (Target_sparc::make_local_ifunc_plt_entry): New function.
995         (Target_sparc::rela_ifunc_section): New function.
996         (Target_sparc::plt_section): Remove const.
997         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
998         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
999         and ifunc_count_ fields.
1000         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1001         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1002         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1003         (Output_data_plt_sparc::rela_ifunc): New function.
1004         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1005         (Output_data_plt_sparc::has_ifunc_section): New function.
1006         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1007         (Output_data_plt_sparc::address_for_global): New function.
1008         (Output_data_plt_sparc::address_for_local): New function.
1009         (Output_data_plt_sparc::plt_index_to_offset): New function.
1010         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1011         and entry_count.
1012         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1013         entry_count.
1014         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1015         R_SPARC_JMP_IREL to switch.
1016         (Target_sparc::Scan::check_non_pic): Likewise.
1017         (Target_sparc::Scan::local): Handle IFUNC symbols.
1018         (Target_sparc::Scan::local): Likewise.
1019         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1020         and plt_address_for_local.
1021         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1022         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1023
1024         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1025         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1026         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1027         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1028         global relocs too.
1029         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1030         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1031         calls.
1032         * sparc.cc (Target_sparc::Scan::global): Likewise.
1033         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1034
1035 2012-04-16  Cary Coutant  <ccoutant@google.com>
1036
1037         * archive.cc (Library_base::should_include_member): Check for
1038         --export-dynamic-symbol.
1039         * options.h (class General_options): Add --export-dynamic-symbol.
1040         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1041         --export-dynamic-symbol.
1042         (Symbol_table::gc_mark_undef_symbols): Likewise.
1043         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1044
1045 2012-04-12  David S. Miller  <davem@davemloft.net>
1046
1047         * sparc.cc (Reloc::wdisp10): New relocation method.
1048         (Reloc::h34): Likewise.
1049         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1050         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1051         R_SPARC_WDISP10.
1052         (Target_sparc::Scan::local): Likewise.
1053         (Target_sparc::Scan::global): Likewise.
1054         (Target_sparc::Relocate::relocate): Likewise.
1055
1056 2012-04-09  Cary Coutant  <ccoutant@google.com>
1057
1058         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1059         low_pc == 0.
1060
1061 2012-04-06  Ian Lance Taylor  <iant@google.com>
1062
1063         * timer.cc: #include <unistd.h>.
1064
1065 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1066
1067         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1068         * config.in: Regenerate.
1069         * configure: Regenerate.
1070
1071 2012-04-05  Nick Clifton  <nickc@redhat.com>
1072
1073         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1074         (AM_LC_MESSAGES): Add.
1075         * aclocal.m4: Regenerate.
1076         * config.in: Regenerate.
1077         * configure: Regenerate.
1078
1079 2012-03-21  Cary Coutant  <ccoutant@google.com>
1080
1081         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1082         * Makefile.in: Regenerate.
1083         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1084         (Sized_elf_reloc_mapper::symbol_section): New function.
1085         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1086         (make_elf_reloc_mapper): New function.
1087         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1088         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1089         (Dwarf_abbrev_table::do_get_abbrev): New function.
1090         (Dwarf_ranges_table::read_ranges_table): New function.
1091         (Dwarf_ranges_table::read_range_list): New function.
1092         (Dwarf_pubnames_table::read_section): New function.
1093         (Dwarf_pubnames_table::read_header): New function.
1094         (Dwarf_pubnames_table::next_name): New function.
1095         (Dwarf_die::Dwarf_die): New function.
1096         (Dwarf_die::read_attributes): New function.
1097         (Dwarf_die::skip_attributes): New function.
1098         (Dwarf_die::set_name): New function.
1099         (Dwarf_die::set_linkage_name): New function.
1100         (Dwarf_die::attribute): New function.
1101         (Dwarf_die::string_attribute): New function.
1102         (Dwarf_die::int_attribute): New function.
1103         (Dwarf_die::uint_attribute): New function.
1104         (Dwarf_die::ref_attribute): New function.
1105         (Dwarf_die::child_offset): New function.
1106         (Dwarf_die::sibling_offset): New function.
1107         (Dwarf_info_reader::check_buffer): New function.
1108         (Dwarf_info_reader::parse): New function.
1109         (Dwarf_info_reader::do_parse): New function.
1110         (Dwarf_info_reader::do_read_string_table): New function.
1111         (Dwarf_info_reader::lookup_reloc): New function.
1112         (Dwarf_info_reader::get_string): New function.
1113         (Dwarf_info_reader::visit_compilation_unit): New function.
1114         (Dwarf_info_reader::visit_type_unit): New function.
1115         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1116         Sized_elf_reloc_mapper.
1117         (Sized_dwarf_line_info::symbol_section): Remove function.
1118         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1119         (Sized_dwarf_line_info::read_line_mappings): Remove object
1120         parameter, adjust callers.
1121         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1122         * dwarf_reader.h: Include <sys/types.h>.
1123         (class Track_relocs): Remove forward declaration.
1124         (class Elf_reloc_mapper): New class.
1125         (class Sized_elf_reloc_mapper): New class.
1126         (class Dwarf_abbrev_table): New class.
1127         (class Dwarf_range_list): New class.
1128         (class Dwarf_ranges_table): New class.
1129         (class Dwarf_pubnames_table): New class.
1130         (class Dwarf_die): New class.
1131         (class Dwarf_info_reader): New class.
1132         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1133         (Sized_dwarf_line_info::symbol_section): Remove member function.
1134         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1135         base class.
1136         * gdb-index.cc: New source file.
1137         * gdb-index.h: New source file.
1138         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1139         and .debug_types sections, call Layout::add_to_gdb_index.
1140         (Sized_relobj_incr::do_section_name): Implement.
1141         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1142         return type; Implement.
1143         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1144         return type.
1145         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1146         parameter list and return type.
1147         (Sized_incr_dynobj::do_section_contents): Likewise.
1148         * layout.cc: Include gdb-index.h.
1149         (Layout::Layout): Initialize gdb_index_data_.
1150         (Layout::init_fixed_output_section): Check for .gdb_index section.
1151         (Layout::add_to_gdb_index): New function. Instantiate.
1152         * layout.h: Add forward declaration for class Gdb_index.
1153         (Layout::add_to_gdb_index): New member function.
1154         (Layout::gdb_index_data_): New data member.
1155         * main.cc: Include gdb-index.h.
1156         (main): Print statistics for gdb index.
1157         * object.cc (Object::section_contents): Move code into
1158         do_section_contents.
1159         (need_decompressed_section): Check for sections needed when building
1160         gdb index.
1161         (build_compressed_section_map): Likewise.
1162         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1163         gdb index.
1164         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1165         sections; call Layout::add_to_gdb_index.
1166         (Sized_relobj_file::do_decompressed_section_contents): Call
1167         do_section_contents directly.
1168         * object.h (Object::do_section_contents): Adjust parameter list and
1169         return type.
1170         (Object::do_decompressed_section_contents): Call do_section_contents
1171         directly.
1172         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1173         return type.
1174         * options.h (class General_options): Add --gdb-index option.
1175         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1176         list and return type.
1177         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1178         * reloc.h (Track_relocs::checkpoint): New function.
1179         (Track_relocs::reset): New function.
1180
1181         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1182         New test cases.
1183         * testsuite/Makefile.in: Regenerate.
1184         * testsuite/gdb_index_test.cc: New test source file.
1185         * testsuite/gdb_index_test_1.sh: New test source file.
1186         * testsuite/gdb_index_test_2.sh: New test source file.
1187
1188 2012-03-19  Doug Kwan  <dougkwan@google.com>
1189
1190         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1191         (Target_arm::do_finalize_sections): Remove code which defines
1192         __exidx_start and __exidx_end.  Make symbol table parameter
1193         anonymous as it is not used.
1194         * gold.cc (queue_middle_tasks): Call target hook to define any
1195         target-specific symbols.
1196         * target.h (Target::define_standard_symbols): New method.
1197         (Target::do_define_standard_symbols): Same.
1198         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1199         * testsuite/Makefile.in: Regenerate.
1200         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1201         and __exidx_end.
1202         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1203         relocations are generated for __exidx_start and __exidx_end.
1204
1205 2012-03-16  Doug Kwan  <dougkwan@google.com>
1206
1207         * testsuite/Makefile.am: Disable test initpri3b.
1208         * testsuite/Makefile.in: Regenerate.
1209
1210 2012-03-15  Doug Kwan  <dougkwan@google.com>
1211
1212         * arm.cc (Target_arm::got_section): Make .got section read-only
1213         if -z now is given.
1214
1215 2012-03-15  Ian Lance Taylor  <iant@google.com>
1216
1217         PR gold/13850
1218         * layout.cc (Layout::make_output_section): Correctly mark
1219         SHT_INIT_ARRAY, et. al., as relro.
1220
1221 2012-03-14  Doug Kwan  <dougkwan@google.com>
1222
1223         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1224         dynamic relocations for protected symbols in shared objects.
1225
1226 2012-03-13  Ian Lance Taylor  <iant@google.com>
1227
1228         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1229         keep the larger alignment.
1230
1231 2012-03-12  Cary Coutant  <ccoutant@google.com>
1232
1233         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1234         handling of DW_LNE_define_file.
1235
1236 2012-03-12  Cary Coutant  <ccoutant@google.com>
1237
1238         * reduced_debug_output.cc
1239         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1240         codes to switch.
1241
1242 2012-02-29  Cary Coutant  <ccoutant@google.com>
1243
1244         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1245
1246 2012-02-29  Cary Coutant  <ccoutant@google.com>
1247
1248         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1249         Call Object::decompressed_section_contents.
1250         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1251         New dtor.
1252         (Sized_dwarf_line_info::buffer_start_): New data member.
1253         * merge.cc (Output_merge_data::do_add_input_section): Call
1254         Object::decompressed_section_contents.
1255         (Output_merge_string::do_add_input_section): Likewise.
1256         * object.cc (need_decompressed_section): New function.
1257         (build_compressed_section_map): Decompress sections needed later.
1258         (Sized_relobj_file::do_decompressed_section_contents): New function.
1259         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1260         * object.h (Object::decompressed_section_contents): New function.
1261         (Object::discard_decompressed_sections): New function.
1262         (Object::do_decompressed_section_contents): New function.
1263         (Object::do_discard_decompressed_sections): New function.
1264         (Compressed_section_info): New type.
1265         (Compressed_section_map): Include decompressed section contents.
1266         (Sized_relobj_file::do_decompressed_section_contents): New function.
1267         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1268
1269 2012-02-16  Cary Coutant  <ccoutant@google.com>
1270
1271         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1272         * testsuite/Makefile.in: Regenerate.
1273
1274 2012-02-14  Cary Coutant  <ccoutant@google.com>
1275
1276         * options.cc (General_options::finalize): Disallow -pie and -static.
1277
1278 2012-02-03  Doug Kwan  <dougkwan@google.com>
1279
1280         * arm.cc (Arm_relocate_functions::abs8,
1281         Arm_relocate_functions::abs16): Use
1282         Bits::has_signed_unsigned_overflow32.
1283         (Arm_relocate_functions::thm_abs8): Correct range of
1284         overflow check.
1285         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1286         in assertions.
1287
1288 2012-02-02  Doug Kwan  <dougkwan@google.com>
1289
1290         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1291         position independent outputs, not just shared objects.
1292
1293 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1294
1295         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1296         * configure: Regenerated.
1297
1298 2012-01-27  Ian Lance Taylor  <iant@google.com>
1299
1300         * reloc.h (Bits): New class with static functions, copied from
1301         namespace utils in arm.cc.
1302         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1303         instead.
1304
1305 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1306
1307         * incremental.cc (write_info_blocks): Correct relocation offset.
1308
1309 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1310
1311         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1312         (Relocate::tls_gd_to_le): Likewise.
1313
1314 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1315
1316         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1317
1318 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1319
1320         * configure.ac: Check if -mcmodel=medium works.
1321         * configure: Regenerated.
1322
1323 2012-01-24  Cary Coutant  <ccoutant@google.com>
1324
1325         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1326         definition and ...
1327         (read_unsigned_LEB_128_x): ... this new function.
1328         (read_signed_LEB_128): Replaced with inline definition and ...
1329         (read_signed_LEB_128_x): ... this new function.
1330         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1331         (read_unsigned_LEB_128): Add inline definition.
1332         (read_signed_LEB_128_x): New function.
1333         (read_signed_LEB_128): Add inline definition.
1334         * testsuite/Makefile.am (leb128_unittest): New unit test.
1335         * testsuite/Makefile.in: Regenerate.
1336         * testsuite/leb128_unittest.cc: New unit test.
1337
1338 2012-01-23  Ian Lance Taylor  <iant@google.com>
1339
1340         PR gold/13617
1341         * i386.cc (Target_i386::do_code_fill): When using a jmp
1342         instruction, pad with nop instructions.
1343         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1344
1345 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1346
1347         * x86_64.cc (gc_process_relocs): Add typename on types used in
1348         template.
1349         (scan_relocs): Likewise.
1350         (relocate_section): Likewise.
1351         (apply_relocation): Likewise.
1352
1353 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1354
1355         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1356         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1357         under x32.
1358
1359 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1360
1361         * x86_64.cc: Initial support for x32.
1362
1363 2012-01-03  Cary Coutant  <ccoutant@google.com>
1364
1365         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1366         Use abstract base class for GOT.
1367         * gold/output.h (class Output_data_got_base): New abstract base class.
1368         (class Output_data_got): Derive from new base class, adjust ctors.
1369         (Output_data_got::reserve_slot): Make virtual; rename to
1370         do_reserve_slot; Adjust callers.
1371         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1372         pointer to abstract base class.
1373         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1374
1375 2011-12-18  Ian Lance Taylor  <iant@google.com>
1376
1377         * object.h (Relobj::local_symbol_value): New function.
1378         (Relobj::local_plt_offset): New function.
1379         (Relobj::local_has_got_offset): New function.
1380         (Relobj::local_got_offset): New function.
1381         (Relobj::set_local_got_offset): New function.
1382         (Relobj::do_local_symbol_value): New pure virtual function.
1383         (Relobj::do_local_plt_offset): Likewise.
1384         (Relobj::do_local_has_got_offset): Likewise.
1385         (Relobj::do_local_got_offset): Likewise.
1386         (Relobj::do_set_local_got_offset): Likewise.
1387         (Sized_relobj::do_local_has_got_offset): Rename from
1388         local_has_got_offset.
1389         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1390         (Sized_relobj::do_set_local_got_offset): Rename from
1391         set_local_got_offset.
1392         (Sized_relobj_file::do_local_plt_offset): Rename from
1393         local_plt_offset.
1394         (Sized_relobj_file::do_local_symbol_value): New function.
1395         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1396         local_plt_offset.
1397         * output.cc (Output_data_got::Got_entry::write): Change object to
1398         Relobj.  Use local_symbol_value.
1399         (Output_data_got::add_global_with_rel): Change rel_dyn to
1400         Output_data_reloc_generic*.  Use add_global_generic.
1401         (Output_data_got::add_global_with_rela): Remove.  Change all
1402         callers to use add_global_with_rel.
1403         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1404         Output_data_reloc_generic*.  Use add_global_generic.
1405         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1406         callers to use add_global_pair_with_rel.
1407         (Output_data_got::add_local): Change object to Relobj*.
1408         (Output_data_got::add_local_plt): Likewise.
1409         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1410         change rel_dyn to Output_data_reloc_generic*.  Use
1411         add_local_generic.
1412         (Output_data_got::add_local_with_rela): Remove.  Change all
1413         callers to use all_local_with_rel.
1414         (Output_data_got::add_local_pair_with_rel): Change object to
1415         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1416         add_output_section_generic.
1417         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1418         callers to use add_local_pair_with_rel.
1419         (Output_data_got::reserve_local): Change object to Relobj*.
1420         * output.h: (class Output_data_reloc_generic): Add pure virtual
1421         declarations for add_global_generic, add_local_generic,
1422         add_output_section_generic.
1423         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1424         functions for Output_data_reloc_generic.  Update declarations for
1425         changes listed in output.cc.
1426         (class Output_data_got): Change template parameter to got_size.
1427         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1428         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1429         function.
1430         (Sized_relobj_incr::do_local_plt_offset): New function.
1431         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1432         add_global_generic.
1433
1434 2011-12-17  Cary Coutant  <ccoutant@google.com>
1435
1436         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1437         * resolve.cc (Symbol_table::resolve): Likewise.
1438         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1439         arrays.
1440         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1441
1442 2011-12-16  Ian Lance Taylor  <iant@google.com>
1443
1444         * output.h (Output_data_reloc_generic::add): Only call
1445         add_dynamic_reloc if this is a dynamic reloc section.
1446
1447 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1448
1449         PR gold/13505
1450         * target-reloc.h (apply_relocation): Replace <64, false> with
1451         <size, big_endian>.
1452
1453 2011-11-25  Nick Clifton  <nickc@redhat.com>
1454
1455         * po/it.po: New Italian translation.
1456
1457 2011-11-17  Sterling Augustine  <saugustine@google.com>
1458
1459         * script.cc (script_include_directive): Implement.
1460         (read_script_file): New local variables name and search_path. Update
1461         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1462         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1463         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1464
1465 2011-11-11  Sterling Augustine  <saugustine@google.com>
1466
1467         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1468         (file_or_sections_cmd): Likewise.
1469
1470 2011-11-11  Doug Kwan  <dougkwan@google.com>
1471
1472         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1473         if --just-symbols is given.
1474
1475 2011-11-10  Doug Kwan  <dougkwan@google.com>
1476
1477         PR gold/13362
1478         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1479         when processing data relocs.
1480         * reloc.h (Relocate_functions::rel_unaligned): New method.
1481         (Relocate_functions::pcrel_unaligned): Ditto.
1482         (Relocate_functions::rel32_unaligned): Ditto.
1483         (Relocate_functions::pcrel32_unaligned): Ditto.
1484
1485 2011-11-09  Doug Kwan  <dougkwan@google.com>
1486
1487         PR gold/13362
1488         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1489         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1490         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1491         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1492         (Relocate_functions::rel_unaligned): New.
1493         (Relocate_functions::rel32_unaligned): New.
1494         * target-reloc.h (relocate_for_relocatable): Add code to handle
1495         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1496         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1497         arm_unaligned_reloc_r): New targets.
1498         * testsuite/Makefile.in: Regenerate.
1499         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1500         linking.
1501
1502 2011-11-02  Ian Lance Taylor  <iant@google.com>
1503
1504         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1505         NATIVE_LINKER.
1506         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1507         * options.cc (General_options::finalize): Use library search path
1508         from configure script if specified.  If not native and no sysroot,
1509         only search TOOLLIBDIR.
1510         * options.h (Search_directory::Search_directory): Change name to
1511         const std::string&.
1512         (General_options::add_to_library_path_with_sysroot): Change arg to
1513         const std::string&.
1514         * configure, Makefile.in, config.in: Rebuild.
1515
1516 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1517
1518         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1519         we are working around the ARM1176 Erratum.
1520         * options.h (General_options::fix_arm1176): Add option.
1521         * testsuite/Makefile.am: Add testcases, and keep current ones
1522         working.
1523         * testsuite/Makefile.in: Regenerate.
1524         * testsuite/arm_fix_1176.s: New file.
1525         * testsuite/arm_fix_1176.sh: Likewise.
1526
1527 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1528
1529         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1530         may_use_blx_.
1531         (Target_arm::may_use_blx): Remove method.
1532         (Target_arm::set_may_use_blx): Likewise.
1533         (Target_arm::may_use_v4t_interworking): New method.
1534         (Target_arm::may_use_v5t_interworking): Likewise.
1535         (Target_arm::may_use_blx_): Remove member variable.
1536         (Arm_relocate_functions::arm_branch_common): Check for v5T
1537         interworking.
1538         (Arm_relocate_functions::thumb_branch_common): Likewise.
1539         (Reloc_stub::stub_type_for_reloc): Likewise.
1540         (Target_arm::do_finalize_sections): Correct interworking checks.
1541         * testsuite/Makefile.am: Add new tests.
1542         * testsuite/Makefile.in: Regenerate.
1543         * testsuite/arm_farcall_arm_arm.s: New test.
1544         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1545         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1546         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1547         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1548         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1549         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1550         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1551
1552 2011-10-31  Cary Coutant  <ccoutant@google.com>
1553
1554         PR gold/13023
1555         * expression.cc (Expression::eval_with_dot): Add
1556         is_section_dot_assignment parameter.
1557         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1558         absolute and assigning to dot within a section.
1559         * script-sections.cc
1560         (Output_section_element_assignment::set_section_addresses): Pass
1561         dot_section to set_if_absolute.
1562         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1563         as is_section_dot_assignment flag to eval_with_dot.
1564         (Output_section_element_dot_assignment::set_section_addresses):
1565         Likewise.
1566         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1567         parameter.  Also set value if relative to dot_section; set the
1568         symbol's output_section.
1569         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1570         parameter.  Adjust all callers.
1571         (Expression::eval_maybe_dot): Likewise.
1572         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1573         Adjust all callers.
1574         * testsuite/script_test_2.t: Test assignment of an absolute value
1575         to dot within an output section element.
1576
1577 2011-10-31  Cary Coutant  <ccoutant@google.com>
1578
1579         * options.h (class General_options): Add --[no-]gnu-unique options.
1580         * symtab.cc (Symbol_table::sized_write_globals): Convert
1581         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1582
1583 2011-10-31  Cary Coutant  <ccoutant@google.com>
1584
1585         PR gold/13359
1586         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1587         unnecessary assertion.
1588         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1589
1590 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1591
1592         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1593         gc_mark_symbol.
1594         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1595         gc_mark_symbol.
1596         Change to just keep the section associated with symbol.
1597         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1598         they are externally visible and --export-dynamic is turned on.
1599         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1600
1601 2011-10-19  Ian Lance Taylor  <iant@google.com>
1602
1603         PR gold/13163
1604         * script-sections.cc
1605         (Output_section_element_dot_assignment::needs_output_section): New
1606         function.
1607
1608 2011-10-19  Ian Lance Taylor  <iant@google.com>
1609
1610         PR gold/13204
1611         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1612         --section-start option was seen.
1613         * options.h (General_options::any_section_start): New function.
1614
1615 2011-10-18  David S. Miller  <davem@davemloft.net>
1616
1617         PR binutils/13301
1618         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1619         member to track relocation locations that have moved during TLS
1620         reloc optimizations.
1621         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1622         (Target_sparc::Relocate::relocate): Adjust view down by 4
1623         bytes if it matches reloc_adjust_addr_.
1624         (Target_sparc::Relocate::relocate_tls): Always move the
1625         __tls_get_addr call delay slot instruction forward 4 bytes when
1626         performing relaxation.
1627
1628 2011-10-18  Cary Coutant  <ccoutant@google.com>
1629
1630         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1631         (Output_file::map_no_anonymous): Check for non-zero
1632         return code from posix_fallocate.
1633
1634 2011-10-17  Cary Coutant  <ccoutant@google.com>
1635
1636         PR gold/13245
1637         * plugin.cc (is_visible_from_outside): Check for symbols
1638         referenced from dynamic objects.
1639         * resolve.cc (Symbol_table::resolve): Don't count references
1640         from dynamic objects as references from real ELF files.
1641         * testsuite/plugin_test_2.sh: Adjust expected result.
1642
1643 2011-10-17  Cary Coutant  <ccoutant@google.com>
1644
1645         * gold.cc: Include timer.h.
1646         (queue_middle_tasks): Stamp time.
1647         (queue_final_tasks): Likewise.
1648         * main.cc (main): Store timer in parameters.  Print timers
1649         for each pass.
1650         * parameters.cc (Parameters::Parameters): Initialize timer_.
1651         (Parameters::set_timer): New function.
1652         (set_parameters_timer): New function.
1653         * parameters.h (Parameters::set_timer): New function.
1654         (Parameters::timer): New function.
1655         (Parameters::timer_): New data member.
1656         (set_parameters_timer): New function.
1657         * timer.cc (Timer::stamp): New function.
1658         (Timer::get_pass_time): New function.
1659         * timer.h (Timer::stamp): New function.
1660         (Timer::get_pass_time): New function.
1661         (Timer::pass_times_): New data member.
1662
1663 2011-10-17  Cary Coutant  <ccoutant@google.com>
1664
1665         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1666         task for members of lib groups.
1667
1668 2011-10-17  Cary Coutant  <ccoutant@google.com>
1669
1670         PR gold/13288
1671         * fileread.cc (File_read::find_view): Add assert.
1672         (File_read::make_view): Move bounds check (replace with assert)...
1673         (File_read::find_or_make_view): ... to here.
1674
1675 2011-10-12  Cary Coutant  <ccoutant@google.com>
1676
1677         * output.cc (Output_file::open_base_file): Handle case where
1678         ::read returns less than requested size.
1679
1680 2011-10-10  Cary Coutant  <ccoutant@google.com>
1681
1682         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1683         Initialize defined_count_.
1684         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1685         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1686         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1687         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1688         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1689         * incremental.h (Sized_relobj_incr::defined_count_): New data
1690         member.
1691         (Sized_incr_dynobj::defined_count_): New data member.
1692         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1693         Return zeroes instead of internal error.
1694
1695 2011-10-10  Cary Coutant  <ccoutant@google.com>
1696
1697         PR gold/13249
1698         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1699         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1700         * output.h (class Output_reloc): Add use_plt_offset flag.
1701         (Output_reloc::type_): Adjust size of bit field.
1702         (Output_reloc::use_plt_offset_): New bit field.
1703         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1704         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1705         flag.  Adjust all callers.
1706         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1707         creating RELATIVE relocations.
1708
1709 2011-10-10  Nick Clifton  <nickc@redhat.com>
1710
1711         * po/es.po: Updated Spanish translation.
1712         * po/fi.po: Updated Finnish translation.
1713
1714 2011-10-03   Diego Novillo  <dnovillo@google.com>
1715
1716         * options.cc (parse_uint): Fix dereference of RETVAL.
1717
1718 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1719
1720         * layout.h (section_order_map_): New member.
1721         (get_section_order_map): New member function.
1722         * output.cc (Output_section::add_input_section): Check for patterns
1723         only when --section-ordering-file is specified.
1724         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1725         output_sections have been formed.
1726         * layout.cc (Layout_Layout): Initialize section_order_map_.
1727         * plugin.cc (update_section_order): Store order in order_map. Do not
1728         update the order.
1729         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1730         * testsuite/Makefile.in: Regenerate.
1731         * testsuite/plugin_section_order.c: New file.
1732         * testsuite/plugin_final_layout.cc: New file.
1733         * testsuite/plugin_final_layout.sh: New file.
1734
1735 2011-09-29  Cary Coutant  <ccoutant@google.com>
1736
1737         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1738         Check for NULL.
1739         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1740         symbols during incremental update.
1741         (Symbol_table::add_from_dynobj): Likewise.
1742
1743 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1744             Ian Lance Taylor  <iant@google.com>
1745
1746         * symtab.cc (Symbol_table::define_special_symbol): Always
1747         canonicalize version string.
1748
1749 2011-09-26  Cary Coutant  <ccoutant@google.com>
1750
1751         * gold.cc (queue_initial_tasks): Move option checks ...
1752         * options.cc (General_options::finalize): ... to here. Disable
1753         some options; make others fatal.
1754
1755 2011-09-26  Cary Coutant  <ccoutant@google.com>
1756
1757         gcc PR lto/47247
1758         * plugin.cc (get_symbols_v2): New function.
1759         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1760         (is_referenced_from_outside): New function.
1761         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1762         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1763         (get_symbols): Pass version parameter.
1764         (get_symbols_v2): New function.
1765         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1766         parameter.
1767         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1768         (onload): Add LDPT_GET_SYMBOLS_V2.
1769         (all_symbols_read_hook): Use get_symbols_v2; check for
1770         LDPR_PREVAILING_DEF_IRONLY_EXP.
1771         * testsuite/plugin_test_3.sh: Update expected results.
1772
1773 2011-09-23  Simon Baldwin  <simonb@google.com>
1774
1775         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1776         configuration options.
1777         * configure: Regenerate.
1778         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1779         * Makefile.in: Regenerate.
1780         * testsuite/Makefile.in: Regenerate.
1781
1782 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1783
1784         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1785
1786 2011-09-19  Cary Coutant  <ccoutant@google.com>
1787
1788         * incremental.cc (can_incremental_update): Fix typo in comment.
1789         * incremental.h (can_incremental_update): Likewise.
1790
1791 2011-09-18  Cary Coutant  <ccoutant@google.com>
1792
1793         * incremental.cc (can_incremental_update): New function.
1794         * incremental.h (can_incremental_update): New function.
1795         * layout.cc (Layout::init_fixed_output_section): Call it.
1796         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1797         * object.cc (Sized_relobj_file::do_layout): Call
1798         can_incremental_update.
1799
1800 2011-09-13  Cary Coutant  <ccoutant@google.com>
1801
1802         * configure.ac: Check for glibc support for gnu_indirect_function
1803         support with static linking, setting automake conditional
1804         IFUNC_STATIC.
1805         * Makefile.in: Regenerate.
1806         * configure: Regenerate.
1807
1808         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1809         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1810         for IFUNC_STATIC.
1811         * testsuite/Makefile.in: Regenerate.
1812
1813 2011-09-13  Cary Coutant  <ccoutant@google.com>
1814
1815         * incremental.cc (Sized_relobj_incr::do_layout): Call
1816         report_comdat_group for kept comdat sections.
1817         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1818         * testsuite/Makefile.in: Regenerate.
1819         * testsuite/incr_comdat_test_1.cc: New source file.
1820         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1821         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1822         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1823
1824 2011-09-13  Ian Lance Taylor  <iant@google.com>
1825
1826         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1827         variable external_symbols_offset.
1828
1829 2011-09-12  Ian Lance Taylor  <iant@google.com>
1830
1831         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1832         triggered if object has no symbols.
1833
1834 2011-09-09  David S. Miller  <davem@davemloft.net>
1835
1836         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1837         (Output_fill_debug_line::do_write): Likewise.
1838
1839 2011-08-29  Cary Coutant  <ccoutant@google.com>
1840
1841         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1842         casts to match formatting specs.
1843         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1844
1845 2011-08-26  Cary Coutant  <ccoutant@google.com>
1846
1847         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1848         remaining hole size when allocating.
1849         (Layout::make_output_section): Set fill methods for debug sections.
1850         * layout.h (Free_list::Free_list_node): Move from private to
1851         public.
1852         (Free_list::set_min_hole_size): New function.
1853         (Free_list::begin, Free_list::end): New functions.
1854         (Free_list::min_hole_): New data member.
1855         * output.cc: Include dwarf.h.
1856         (Output_fill_debug_info::do_minimum_hole_size): New function.
1857         (Output_fill_debug_info::do_write): New function.
1858         (Output_fill_debug_line::do_minimum_hole_size): New function.
1859         (Output_fill_debug_line::do_write): New function.
1860         (Output_section::Output_section): Initialize new data member.
1861         (Output_section::set_final_data_size): Ensure patch space is larger
1862         than minimum hole size.
1863         (Output_section::do_write): Fill holes in debug sections.
1864         * output.h (Output_fill): New class.
1865         (Output_fill_debug_info): New class.
1866         (Output_fill_debug_line): New class.
1867         (Output_section::set_free_space_fill): New function.
1868         (Output_section::free_space_fill_): New data member.
1869         * testsuite/Makefile.am (incremental_test_3): Add
1870         --incremental-patch option.
1871         (incremental_test_4): Likewise.
1872         (incremental_test_5): Likewise.
1873         (incremental_test_6): Likewise.
1874         (incremental_copy_test): Likewise.
1875         (incremental_common_test_1): Likewise.
1876         * testsuite/Makefile.in: Regenerate.
1877
1878 2011-08-26  Nick Clifton  <nickc@redhat.com>
1879
1880         * po/es.po: Updated Spanish translation.
1881
1882 2011-08-01  Cary Coutant  <ccoutant@google.com>
1883
1884         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1885         * gold/testsuite/Makefile.in: Regenerate.
1886         * gold/testsuite/justsyms_exec.c: New source file.
1887         * gold/testsuite/justsyms_lib.c: New source file.
1888
1889 2011-08-01  Cary Coutant  <ccoutant@google.com>
1890
1891         * layout.cc (Layout::set_segment_offsets): Don't realign text
1892         segment if -Ttext was specified.
1893         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1894         file type.
1895         * object.h (Sized_relobj_file::e_type): New function.
1896         (Sized_relobj_file::e_type_): New data member.
1897         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1898         base address for ET_EXEC files.
1899         * target.cc (Target::do_make_elf_object_implementation): Allow
1900         ET_EXEC files with --just-symbols option.
1901
1902 2011-07-28  Cary Coutant  <ccoutant@google.com>
1903
1904         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1905         Add thread_number parameter.
1906         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1907         * workqueue-threads.cc
1908         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1909         current thread if its thread number is greater than desired thread
1910         count.
1911         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1912         Add thread_number parameter.
1913         (Workqueue::should_cancel_thread): Likewise.
1914         (Workqueue::find_runnable_or_wait): Pass thread_number to
1915         should_cancel_thread.
1916         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1917         parameter.
1918
1919 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1920
1921         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1922         only after checking if it cannot be forced local.
1923         * symtab.h (is_externally_visible): Check if the symbol is not forced
1924         local.
1925
1926 2011-07-15  Ian Lance Taylor  <iant@google.com>
1927
1928         * options.h (class General_options): Add --print-output-format.
1929         Move -EL next to -EB, for  better --help output.
1930         * target-select.cc: Include <cstdio>, "options.h", and
1931         "parameters.h".
1932         (Target_selector::do_target_bfd_name): New function.
1933         (print_output_format): New function.
1934         * target-select.h (class Target_selector): Update declarations.
1935         (Target_selector::target_bfd_name): New function.
1936         (print_output_format): Declare.
1937         * main.cc: Include "target-select.h".
1938         (main): Handle --print-output-format.
1939         * gold.cc: Include "target-select.h".
1940         (queue_initial_tasks): Handle --print-output-format when there are
1941         no input files.
1942         * parameters.cc (parameters_force_valid_target): Give a better
1943         error message if -EB/-EL does not match target.
1944         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1945         function.
1946
1947 2011-07-15  Ian Lance Taylor  <iant@google.com>
1948
1949         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1950         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1951         (Output_data_plt_i386::do_write): Write address of .dynamic
1952         section to first entry in .got.plt section.
1953         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1954         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1955         Initialize layout_.
1956         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1957         section to first entry in .got.plt section.
1958         * layout.h (Layout::dynamic_section): New function.
1959
1960 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1961
1962         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1963         to claim_file call.
1964         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1965         input_section_position_, and input_section_glob_.
1966         (read_layout_from_file): Call function section_ordering_specified.
1967         * layout.h (is_section_ordering_specified): New function.
1968         (section_ordering_specified): New function.
1969         (section_ordering_specified_): New boolean member.
1970         * main.cc(main): Call load_plugins after layout object is defined.
1971         * output.cc (Output_section::add_input_section): Use
1972         function section_ordering_specified to check if section ordering is
1973         needed.
1974         * output.cc (Output_section::add_relaxed_input_section): Use
1975         function section_ordering_specified to check if section ordering is
1976         needed.
1977         (Output_section::update_section_layout): New function.
1978         (Output_section::sort_attached_input_sections): Check if input section
1979         must be reordered.
1980         * output.h (Output_section::update_section_layout): New function.
1981         * plugin.cc (get_section_count): New function.
1982         (get_section_type): New function.
1983         (get_section_name): New function.
1984         (get_section_contents): New function.
1985         (update_section_order): New function.
1986         (allow_section_ordering): New function.
1987         (Plugin::load): Add the new interfaces to the transfer vector.
1988         (Plugin_manager::load_plugins): New parameter.
1989         (Plugin_manager::all_symbols_read): New parameter.
1990         (Plugin_manager::claim_file): New parameter. Save the elf object for
1991         unclaimed objects.
1992         (Plugin_manager::get_elf_object): New function.
1993         (Plugin_manager::get_view): Change to directly use the bool to check
1994         if get_view is called from claim_file_hook.
1995         * plugin.h (input_objects): New function
1996         (Plugin__manager::load_plugins): New parameter.
1997         (Plugin_manager::claim_file): New parameter.
1998         (Plugin_manager::get_elf_object): New function.
1999         (Plugin_manager::in_claim_file_handler): New function.
2000         (Plugin_manager::in_claim_file_handler_): New member.
2001         (layout): New function.
2002         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2003         handler with an extra parameter. Make the elf object before calling
2004         claim_file handler.
2005         * testsuite/plugin_test.c (get_section_count): New function pointer.
2006         (get_section_type): New function pointer.
2007         (get_section_name): New function pointer.
2008         (get_section_contents): New function pointer.
2009         (update_section_order): New function pointer.
2010         (allow_section_ordering): New function pointer.
2011         (onload): Check if the new interfaces exist.
2012
2013 2011-07-13  Ian Lance Taylor  <iant@google.com>
2014
2015         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2016         relro section.
2017         * x86_64.cc (Target_x86_64::got_section): Likewise.
2018         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2019         (relro_now_test_SOURCES): New variable.
2020         (relro_now_test_DEPENDENCIES): New variable.
2021         (relro_now_test_LDFLAGS): New variable.
2022         (relro_now_test_LDADD): New variable.
2023         (relro_now_test.so): New target.
2024         * testsuite/Makefile.in: Rebuild.
2025
2026 2011-07-12  Ian Lance Taylor  <iant@google.com>
2027
2028         PR gold/12980
2029         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2030         GLOB_DAT relocation rather than a RELATIVE relocation for a
2031         protected symbol when creating a shared library.
2032         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2033         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2034         * testsuite/protected_main_1.cc (main): Test that protected
2035         function has same address.
2036
2037 2011-07-11  Ian Lance Taylor  <iant@google.com>
2038
2039         PR gold/12979
2040         * options.h (class General_options): Add -Bgroup.
2041         * options.cc (General_options::finalize): If -Bgroup is set,
2042         default to --unresolved-symbols=report-all.
2043         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2044         * target-reloc.h (issue_undefined_symbol_error): Handle
2045         --unresolved-symbols=report-all.
2046
2047 2011-07-08  Ian Lance Taylor  <iant@google.com>
2048
2049         PR gold/11985
2050         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2051         if linker script discards key sections.
2052         (Layout::create_dynamic_symtab): Likewise.
2053         (Layout::assign_local_dynsym_offsets): Likewise.
2054         (Layout::sized_create_version_sections): Likewise.
2055         (Layout::create_interp): Likewise.
2056         (Layout::finish_dynamic_section): Likewise.
2057         (Layout::set_dynamic_symbol_size): Likewise.
2058
2059 2011-07-08  Ian Lance Taylor  <iant@google.com>
2060
2061         PR gold/12386
2062         * options.h (class General_options): Add --unresolved-symbols.
2063         * target-reloc.h (issue_undefined_symbol_error): Check
2064         --unresolved-symbols.  Add comments.
2065
2066 2011-07-08  Ian Lance Taylor  <iant@google.com>
2067
2068         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2069         expression more complex.
2070
2071 2011-07-08  Ian Lance Taylor  <iant@google.com>
2072
2073         PR gold/11317
2074         * target-reloc.h (issue_undefined_symbol_error): New inline
2075         function, broken out of relocate_section.
2076         (relocate_section): Call issue_undefined_symbol_error.
2077         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2078         there is no TLS segment if we are about to issue an undefined
2079         symbol error.
2080         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2081
2082 2011-07-08  Ian Lance Taylor  <iant@google.com>
2083
2084         PR gold/12279
2085         * resolve.cc (Symbol_table::should_override): Add fromtype
2086         parameter.  Change all callers.  Give error when linking together
2087         TLS and non-TLS symbol.
2088         (Symbol_table::should_override_with_special): Add fromtype
2089         parameter.  Change all callers.
2090         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2091         there is no TLS segment if we have reported some errors.
2092         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2093
2094 2011-07-08  Ian Lance Taylor  <iant@google.com>
2095
2096         PR gold/12372
2097         * target.h (Target::plt_address_for_global): New function.
2098         (Target::plt_address_for_local): New function.
2099         (Target::plt_section_for_global): Remove.
2100         (Target::plt_section_for_local): Remove.
2101         (Target::do_plt_address_for_global): New virtual function.
2102         (Target::do_plt_address_for_local): New virtual function.
2103         (Target::do_plt_section_for_global): Remove.
2104         (Target::do_plt_section_for_local): Remove.
2105         (Target::register_global_plt_entry): Add Symbol_table and Layout
2106         parameters.
2107         * output.cc (Output_data_got::Got_entry::write): Use
2108         plt_address_for_global and plt_address_for_local.
2109         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2110         address of output section.
2111         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2112         got_irelative_, and irelative_count_ fields.  Update
2113         declarations.
2114         (Output_data_plt_i386::has_irelative_section): New function.
2115         (Output_data_plt_i386::entry_count): Add irelative_count_.
2116         (Output_data_plt_i386::set_final_data_size): Likewise.
2117         (class Target_i386): Add got_irelative_ and rel_irelative_
2118         fields.  Update declarations.
2119         (Target_i386::Target_i386): Initialize new fields.
2120         (Target_i386::do_plt_address_for_global): New function replacing
2121         do_plt_section_for_global.
2122         (Target_i386::do_plt_address_for_local): New function replacing
2123         do_plt_section_for_local.
2124         (Target_i386::got_section): Create got_irelative_.
2125         (Target_i386::rel_irelative_section): New function.
2126         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2127         fields.  Don't define __rel_iplt_{start,end}.
2128         (Output_data_plt_i386::add_entry): Add symtab and layout
2129         parameters.  Change all callers.  Use different PLT and GOT for
2130         IFUNC symbols.
2131         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2132         layout parameters.  Change all callers.  Use different PLT and
2133         GOT.
2134         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2135         (Output_data_plt_i386::rel_irelative): New function.
2136         (Output_data_plt_i386::address_for_global): New function.
2137         (Output_data_plt_i386::address_for_local): New function.
2138         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2139         IRELATIVE GOT when changing IFUNC GOT entries.
2140         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2141         reloc.
2142         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2143         if we didn't create an IRELATIVE GOT.
2144         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2145         plt_address_for_local.
2146         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2147         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2148         got_irelative_, and irelative_count_ fields.  Update
2149         declarations.
2150         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2151         Initialize new fields.  Remove symtab parameter.  Change all
2152         callers.
2153         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2154         irelative_count_.
2155         (Output_data_plt_x86_64::has_irelative_section): New function.
2156         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2157         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2158         fields.  Update declarations.
2159         (Target_x86_64::Target_x86_64): Initialize new fields.
2160         (Target_x86_64::do_plt_address_for_global): New function replacing
2161         do_plt_section_for_global.
2162         (Target_x86_64::do_plt_address_for_local): New function replacing
2163         do_plt_section_for_local.
2164         (Target_x86_64::got_section): Create got_irelative_.
2165         (Target_x86_64::rela_irelative_section): New function.
2166         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2167         all callers.  Don't create __rel_iplt_{start,end}.
2168         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2169         parameters.  Change all callers.  Use different PLT and GOT for
2170         IFUNC symbols.
2171         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2172         layout parameters.  Change all callers.  Use different PLT and
2173         GOT.
2174         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2175         parameters.  Change all callers.  Use different PLT and GOT for
2176         IFUNC symbols.
2177         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2178         (Output_data_plt_x86_64::rela_irelative): New function.
2179         (Output_data_plt_x86_64::address_for_global): New function.
2180         (Output_data_plt_x86_64::address_for_local): New function.
2181         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2182         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2183         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2184         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2185         parameters.
2186         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2187         reloc.
2188         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2189         symbols if we didn't create an IRELATIVE GOT.
2190         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2191         plt_address_for_local.
2192         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2193         * testsuite/ifuncvar1.c: New test file.
2194         * testsuite/ifuncvar2.c: New test file.
2195         * testsuite/ifuncvar3.c: New test file.
2196         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2197         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2198         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2199         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2200         * testsuite/Makefile.in: Rebuild.
2201
2202 2011-07-07  Cary Coutant  <ccoutant@google.com>
2203
2204         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2205         (two_file_test_1_ndebug.o): Likewise.
2206         (two_file_test_1b_ndebug.o): Likewise.
2207         (two_file_test_2_ndebug.o): Likewise.
2208         (two_file_test_main_ndebug.o): Likewise.
2209         (incremental_test_2): Link with no-debug versions.
2210
2211 2011-07-06  Cary Coutant  <ccoutant@google.com>
2212
2213         * gold/incremental.cc
2214         (Output_section_incremental_inputs::write_info_blocks): Check for
2215         hidden and internal symbols.
2216
2217 2011-07-06  Cary Coutant  <ccoutant@google.com>
2218
2219         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2220         Check disposition for startup file.
2221         (Incremental_inputs::report_command_line): Ignore
2222         --incremental-startup-unchanged option.
2223         * options.cc (General_options::parse_incremental_startup_unchanged):
2224         New function.
2225         (General_options::General_options): Initialize new data member.
2226         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2227         (General_options): Add --incremental-startup-unchanged option.
2228         (General_options::incremental_startup_disposition): New function.
2229         (General_options::incremental_startup_disposition_): New data member.
2230
2231 2011-07-06  Cary Coutant  <ccoutant@google.com>
2232
2233         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2234         input file index to Script_info ctor.
2235         (Sized_incremental_binary::do_file_has_changed): Find the
2236         command-line argument for files named in scripts.
2237         * incremental.h (Script_info::Script_info): New ctor
2238         with input file index.
2239         (Script_info::input_file_index): New function.
2240         (Script_info::input_file_index_): New data member.
2241         (Incremental_binary::get_library): Add const.
2242         (Incremental_binary::get_script_info): Add const.
2243         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2244         * testsuite/Makefile.am (incremental_test_5): New test case.
2245         (incremental_test_6): New test case.
2246         * testsuite/Makefile.in: Regenerate.
2247
2248 2011-07-06  Cary Coutant  <ccoutant@google.com>
2249
2250         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2251         debug output when command lines differ.
2252
2253 2011-07-06  Cary Coutant  <ccoutant@google.com>
2254
2255         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2256         --incremental-patch option.
2257         * layout.cc (Free_list::allocate): Extend allocation beyond original
2258         end if enabled.
2259         (Layout::make_output_section): Mark sections that should get
2260         patch space.
2261         * options.cc (parse_percent): New function.
2262         * options.h (parse_percent): New function.
2263         (DEFINE_percent): New macro.
2264         (General_options): Add --incremental-patch option.
2265         * output.cc (Output_section::Output_section): Initialize new data
2266         members.
2267         (Output_section::add_input_section): Print section name when out
2268         of patch space.
2269         (Output_section::add_output_section_data): Likewise.
2270         (Output_section::set_final_data_size): Add patch space when
2271         doing --incremental-full.
2272         (Output_section::do_reset_address_and_file_offset): Remove patch
2273         space.
2274         (Output_segment::set_section_list_addresses): Print debug output
2275         only if --incremental-update.
2276         * output.h (Output_section::set_is_patch_space_allowed): New function.
2277         (Output_section::is_patch_space_allowed_): New data member.
2278         (Output_section::patch_space_): New data member.
2279         * parameters.cc (Parameters::incremental_full): New function.
2280         * parameters.h (Parameters::incremental_full): New function
2281         * testsuite/Makefile.am (incremental_test_2): Add test for
2282         --incremental-patch option.
2283         * testsuite/Makefile.in: Regenerate.
2284         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2285         (t18): Remove function body.
2286
2287 2011-07-05  Doug Kwan  <dougkwan@google.com>
2288
2289         PR gold/12771
2290         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2291         Arm_Address type for relocation result.
2292         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2293         overflow check.
2294         (Arm_relocate_functions::abs32): Use unaligned access.
2295         (Arm_relocate_functions::rel32): Ditto.
2296         (Arm_relocate_functions::prel31): Ditto.
2297         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2298         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2299         static data relocations.
2300         * testsuite/Makefile.in: Regnerate.
2301         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2302
2303 2011-07-05  Ian Lance Taylor  <iant@google.com>
2304
2305         PR gold/12392
2306         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2307         symbols if necessary.
2308         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2309
2310 2011-07-05  Ian Lance Taylor  <iant@google.com>
2311
2312         PR gold/12952
2313         * resolve.cc (Symbol::override_base_with_special): Simply override
2314         version with special symbol version, ignoring previous version.
2315
2316 2011-07-05  Ian Lance Taylor  <iant@google.com>
2317
2318         * object.cc (Sized_relobj_file::include_section_group): Add
2319         information to comment about signature location.
2320
2321 2011-07-02  Ian Lance Taylor  <iant@google.com>
2322
2323         PR gold/12957
2324         * options.h (class General_options): Add -f and -F.
2325         * options.cc (General_options::finalize): Fatal error if -f/-F
2326         are used without -shared.
2327         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2328
2329 2011-07-02  Ian Lance Taylor  <iant@google.com>
2330
2331         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2332
2333 2011-07-01  Ian Lance Taylor  <iant@google.com>
2334
2335         PR gold/12525
2336         PR gold/12952
2337         * resolve.cc (Symbol::override_base_with_special): Don't override
2338         the version if the overriding symbol has a different name.
2339         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2340         all callers.  If we give an error about an undefined version,
2341         define the base version if necessary.
2342         * dynobj.h (class Versions): Update declaration.
2343         * testsuite/weak_alias_test_5.cc: New file.
2344         * testsuite/weak_alias_test.script: New file.
2345         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2346         and versioned_alias have the right value, and call t2.
2347         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2348         weak_alias_test_5.so.
2349         (weak_alias_test_LDADD): Likewise.
2350         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2351         * testsuite/Makefile.in: Rebuild.
2352
2353 2011-07-01  Ian Lance Taylor  <iant@google.com>
2354
2355         PR gold/12525
2356         * options.h (class General_options): Support -z notext.
2357         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2358         -Wl,-z,notext.
2359         (two_file_shared_nonpic.so): Likewise.
2360         (two_file_shared_mixed.so): Likewise.
2361         (two_file_shared_mixed_1.so): Likewise.
2362         (weak_undef_lib_nonpic.so): Likewise.
2363         (alt/weak_undef_lib_nonpic.so): Likewise.
2364         (tls_test_shared_nonpic.so): Likewise.
2365         * testsuite/Makefile.in: Rebuild.
2366
2367 2011-07-01  Ian Lance Taylor  <iant@google.com>
2368
2369         PR gold/12525
2370         * configure.ac: Test whether static linking works, setting
2371         the automake conditional HAVE_STATIC.
2372         * testsuite/Makefile.am: Disable tests using -static if
2373         HAVE_STATIC is not true.
2374         * configure, testsuite/Makefile.in: Rebuild.
2375
2376 2011-07-01  Ian Lance Taylor  <iant@google.com>
2377
2378         PR gold/12525
2379         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2380         Assert if we see DW_EH_PE_indirect.
2381         * target.h (Target::ehframe_datarel_base): New function.
2382         (Target::do_ehframe_datarel_base): New target function.
2383         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2384         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2385         function.
2386
2387 2011-07-01  Ian Lance Taylor  <iant@google.com>
2388
2389         PR gold/12571
2390         * options.h (class General_options): Add
2391         --ld-generated-unwind-info.
2392         * ehframe.cc (Fde::write): Add address parameter.  Change all
2393         callers.  If associated with PLT, fill in address and size.
2394         (Cie::set_output_offset): Only add merge mapping if there is an
2395         object.
2396         (Cie::write): Add address parameter.  Change all callers.
2397         (Eh_frame::add_ehframe_for_plt): New function.
2398         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2399         input_offset_ fields into union u_, with new plt field.
2400         (Fde::Fde): Adjust for new union field.
2401         (Fde::Fde) [Output_data version]: New constructor.
2402         (Fde::add_mapping): Only add merge mapping if there is an object.
2403         (class Cie): Update declarations.
2404         (class Eh_frame): Declare add_ehframe_for_plt.
2405         * layout.cc (Layout::layout_eh_frame): Break out code into
2406         make_eh_frame_section, and call it.
2407         (Layout::make_eh_frame_section): New function.
2408         (Layout::add_eh_frame_for_plt): New function.
2409         * layout.h (class Layout): Update declarations.
2410         * merge.cc (Merge_map::add_mapping): Add assertion.
2411         * i386.cc: Include "dwarf.h".
2412         (class Output_data_plt_i386): Make first_plt_entry,
2413         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2414         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2415         and plt_eh_frame_fde.
2416         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2417         boundary.  Call add_eh_frame_for_plt if appropriate.
2418         * x86_64.cc: Include "dwarf.h".
2419         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2420         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2421         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2422         and plt_eh_frame_fde.
2423         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2424         appropriate.
2425
2426 2011-06-29  Ian Lance Taylor  <iant@google.com>
2427
2428         PR gold/12629
2429         * object.cc (Sized_relobj_file::layout_section): Change shdr
2430         parameter to be const.
2431         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2432         out of do_layout.
2433         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2434         appropriate.  Call layout_eh_frame_section.
2435         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2436         sections.
2437         * object.h (class Sized_relobj_file): Update declarations.
2438
2439 2011-06-29  Ian Lance Taylor  <iant@google.com>
2440
2441         PR gold/12652
2442         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2443         modifier.
2444         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2445
2446 2011-06-29  Ian Lance Taylor  <iant@google.com>
2447
2448         PR gold/12675
2449         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2450         SHT_X86_64_UNWIND.
2451         * layout.cc (Layout::layout_eh_frame): Likewise.
2452
2453 2011-06-29  Ian Lance Taylor  <iant@google.com>
2454
2455         PR gold/12695
2456         * layout.cc (Layout::symtab_section_shndx): New function.
2457         * layout.h (class Layout): Declare symtab_section_shndx.
2458         * output.cc (Output_section::write_header): Call it.
2459
2460 2011-06-29  Ian Lance Taylor  <iant@google.com>
2461
2462         PR gold/12818
2463         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2464         symbols which are not used in a relocation.
2465
2466 2011-06-28  Ian Lance Taylor  <iant@google.com>
2467
2468         PR gold/12898
2469         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2470         script create indistinguishable segments.
2471         (Layout::set_segment_offsets): Use stable_sort when sorting
2472         segments.  Pass this to Compare_segments constructor.
2473         * layout.h (class Layout): Make segment_precedes non-static.
2474         (class Compare_segments): Change from struct to class.  Add
2475         layout_ field.  Add constructor.
2476         * script-sections.cc
2477         (Script_sections::attach_sections_using_phdrs_clause): Rename
2478         local orphan to is_orphan.  Don't report failure to put empty
2479         section in segment.  On attachment failure, report name of
2480         section, and attach to first PT_LOAD segment.
2481
2482 2011-06-28  Ian Lance Taylor  <iant@google.com>
2483
2484         PR gold/12934
2485         * target-select.cc (Target_selector::Target_selector): Add
2486         emulation parameter.  Change all callers.
2487         (select_target_by_bfd_name): Rename from select_target_by_name.
2488         Change all callers.
2489         (select_target_by_emulation): New function.
2490         (supported_emulation_names): New function.
2491         * target-select.h (class Target_selector): Add emulation_ field.
2492         Update declarations.
2493         (Target_selector::recognize_by_bfd_name): Rename from
2494         recognize_by_name.  Change all callers.
2495         (Target_selector::supported_bfd_names): Rename from
2496         supported_names.  Change all callers.
2497         (Target_selector::recognize_by_emulation): New function.
2498         (Target_selector::supported_emulations): New function.
2499         (Target_selector::emulation): New function.
2500         (Target_selector::do_recognize_by_bfd_name): Rename from
2501         do_recognize_by_name.  Change all callers.
2502         (Target_selector::do_supported_bfd_names): Rename from
2503         do_supported_names.  Change all callers.
2504         (Target_selector::do_recognize_by_emulation): New function.
2505         (Target_selector::do_supported_emulations): New function.
2506         (select_target_by_bfd_name): Change name in declaration.
2507         (select_target_by_emulation): Declare.
2508         (supported_emulation_names): Declare.
2509         * parameters.cc (parameters_force_valid_target): Try to find
2510         target based on emulation from -m option.
2511         * options.h (class General_options): Change doc string for -m.
2512         * options.cc (help): Print emulations.
2513         (General_options::parse_V): Likewise.
2514         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2515         Add emulation parameter.  Change all callers.
2516
2517 2011-06-28  Ian Lance Taylor  <iant@google.com>
2518
2519         * target.h (class Target): Add osabi_ field.
2520         (Target::osabi): New function.
2521         (Target::set_osabi): New function.
2522         (Target::Target): Initialize osabi_.
2523         (Target::do_adjust_elf_header): Make pure virtual.
2524         (Sized_target::do_adjust_elf_header): Declare.
2525         * target.cc (Sized_target::do_adjust_elf_header): New function.
2526         (class Sized_target): Instantiate all versions.
2527         * freebsd.h (class Target_freebsd): Remove.
2528         (Target_selector_freebsd::do_recognize): Call set_osabi on
2529         Target.
2530         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2531         (Target_selector_freebsd::set_osabi): Remove.
2532         * i386.cc (class Target_i386): Inherit from Sized_target rather
2533         than Target_freebsd.
2534         * x86_64.cc (class Target_x86_64): Likewise.
2535
2536 2011-06-28  Ian Lance Taylor  <iant@google.com>
2537
2538         * target.h (Target::can_check_for_function_pointers): Rewrite.
2539         Make non-virtual.
2540         (Target::can_icf_inline_merge_sections): Likewise.
2541         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2542         (Target::Target_info): Add can_icf_inline_merge_sections field.
2543         (Target::do_can_check_for_function_pointers): New virtual
2544         function.
2545         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2546         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2547         from can_check_for_function_pointers, move in file.
2548         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2549         section_may_have_icf_unsafe_poineters, move in file.
2550         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2551         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2552         Rename from can_check_for_function_pointers, move in file.
2553         (Target_i386::can_icf_inline_merge_sections): Remove.
2554         (Target_i386::i386_info): Initialize
2555         can_icf_inline_merge_sections.
2556         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2557         Initialize can_icf_inline_merge_sections.
2558         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2559         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2560         Rename from can_check_for_function_pointers, move in file.
2561         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2562         (Target_x86_64::x86_64_info): Initialize
2563         can_icf_inline_merge_sections.
2564         * testsuite/testfile.cc (Target_test::test_target_info):
2565         Likewise.
2566         * icf.cc (get_section_contents): Correct formatting.
2567
2568 2011-06-27  Ian Lance Taylor  <iant@google.com>
2569
2570         * symtab.cc (Symbol::versioned_name): New function.
2571         (Symbol_table::add_to_final_symtab): Use versioned_name when
2572         appropriate.
2573         (Symbol_table::sized_write_symbol): Likewise.
2574         * symtab.h (class Symbol): Declare versioned_name.
2575         * stringpool.h (class Stringpool_template): Add variant of add
2576         which takes a std::basic_string.
2577         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2578         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2579         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2580         (ver_test_12.o): New target.
2581         * testsuite/Makefile.in: Rebuild.
2582
2583 2011-06-27  Doug Kwan  <dougkwan@google.com>
2584
2585         * arm.cc (Arm_relocate_functions::thm_jump8,
2586         Arm_relocate_functions::thm_jump11): Use a wider signed
2587         type to compute offset.
2588         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2589         arm_thm_jump8.
2590         * testsuite/Makefile.in: Regenerate.
2591         * testsuite/arm_branch_in_range.sh: Check test results of
2592         arm_thm_jump11 and arm_thm_jump8.
2593         * testsuite/arm_thm_jump11.s: New test source file.
2594         * testsuite/arm_thm_jump11.t: New linker script.
2595         * testsuite/arm_thm_jump8.s: New test source file.
2596         * testsuite/arm_thm_jump8.t: New linker script.
2597
2598 2011-06-24  Ian Lance Taylor  <iant@google.com>
2599
2600         * layout.cc: Include "object.h".
2601         (ctors_sections_in_init_array): New static variable.
2602         (Layout::is_ctors_in_init_array): New function.
2603         (Layout::layout): Add entry to ctors_sections_in_init_array if
2604         appropriate.
2605         * layout.h (class Layout): Declare is_ctors_in_init_array.
2606         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2607         is_ctors_reverse_view is set.
2608         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2609         all callers.  Set is_ctors_reverse_view field of View_size.
2610         (Sized_relobj_file::reverse_words): New function.
2611         * object.h (Sized_relobj_file::View_size): Add
2612         is_ctors_reverse_view field.
2613         (class Sized_relobj_file): Update declarations.
2614         * testsuite/initpri3.c: New test.
2615         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2616         initpri3b.
2617         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2618         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2619         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2620         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2621         * testsuite/Makefile.in: Rebuild.
2622
2623 2011-06-24  Cary Coutant  <ccoutant@google.com>
2624
2625         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2626         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2627         (debug_msg_cdebug.err): New targets.
2628         * testsuite/Makefile.in: Regenerate.
2629         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2630         Fix checks for link with shared library.
2631
2632 2011-06-24  Doug Kwan  <dougkwan@google.com>
2633
2634         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2635         skip empty text sections.
2636         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2637
2638 2011-06-22  Ian Lance Taylor  <iant@google.com>
2639
2640         PR gold/12910
2641         * options.h (class General_options): Add --ctors-in-init-array.
2642         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2643         friends as SHT_PROGBITS for merging sections.
2644         (Layout::layout): Remove special handling of .init_array and
2645         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2646         and .dtors if ctors_in_init_array.
2647         (Layout::make_output_section): Force correct section types for
2648         .init_array and friends.  Don't sort if doing relocatable link,
2649         Don't sort .ctors and .dtors if ctors_in_init_array.
2650         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2651         (Layout::output_section_name): Add relobj parameter.  Change all
2652         callers.  Handle .ctors. and .dtors. in code rather than table.
2653         Handle .ctors and .dtors if ctors_in_init_array.
2654         (Layout::match_file_name): New function, moved from output.cc.
2655         * layout.h (class Layout): Update declarations.
2656         * output.cc: Include "layout.h".
2657         (Input_section_sort_entry::get_priority): New function.
2658         (Input_section_sort_entry::match_file_name): Just call
2659         Layout::match_file_name.
2660         (Output_section::Input_section_sort_init_fini_compare::operator()):
2661         Handle .ctors and .dtors.  Sort by explicit priority rather than
2662         by name.
2663         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2664         * testsuite/initpri2.c: New test.
2665         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2666         (check_PROGRAMS): Add initpri2.
2667         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2668         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2669         * configure, testsuite/Makefile.in: Rebuild.
2670
2671 2011-06-19  Ian Lance Taylor  <iant@google.com>
2672
2673         PR gold/12880
2674         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2675         .interp section to a PT_INTERP segment even if we have seen a
2676         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2677         clause in a linker script.
2678         (Layout::finalize): Don't create a .interp section if we've
2679         already create a PT_INTERP segment.
2680         (Layout::create_interp): Always call choose_output_section (revert
2681         patch of 2011-06-17).  Don't create PT_INTERP segment.
2682         * script-sections.cc
2683         (Script_sections::create_note_and_tls_segments): Add a .interp
2684         section to a PT_INTERP segment even if we have seen a
2685         --dynamic-linker option.
2686
2687 2011-06-18  Ian Lance Taylor  <iant@google.com>
2688
2689         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2690         merely because a non-PT_LOAD segment has a dynamic reloc.
2691
2692 2011-06-18  Ian Lance Taylor  <iant@google.com>
2693
2694         * layout.cc (Layout::finish_dynamic_section): Don't create
2695         DT_FLAGS entry if not needed.
2696
2697 2011-06-18  Ian Lance Taylor  <iant@google.com>
2698
2699         PR gold/12745
2700         * layout.cc (Layout::layout_eh_frame): Correct handling of
2701         writable .eh_frame section.
2702
2703 2011-06-17  Ian Lance Taylor  <iant@google.com>
2704
2705         PR gold/12893
2706         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2707         symbol is redefined with the exact same object and value.
2708
2709 2011-06-17  Ian Lance Taylor  <iant@google.com>
2710
2711         PR gold/12880
2712         * layout.h (class Layout): Add interp_segment_ field.
2713         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2714         (Layout::attach_allocated_section_to_segment): If making shared
2715         library, put .interp section in PT_INTERP segment.
2716         (Layout::finalize): Also call create_interp if -dynamic-linker
2717         option was used.
2718         (Layout::create_interp): Assert that there is no PT_INTERP
2719         segment.  If not using a SECTIONS clause, use make_output_section.
2720         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2721         * script-sections.cc
2722         (Script_sections::create_note_and_tls_segments): If making shared
2723         library, put .interp section in PT_INTERP segment.
2724
2725 2011-06-17  Ian Lance Taylor  <iant@google.com>
2726
2727         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2728         when making a shared library.
2729
2730 2011-06-17  Ian Lance Taylor  <iant@google.com>
2731
2732         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2733         parameter.  Change all callers.  Don't issue warning about PC32
2734         against locally defined symbol.
2735
2736 2011-06-16  Ian Lance Taylor  <iant@google.com>
2737
2738         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2739         occurs in same object.
2740
2741 2011-06-14  Alan Modra  <amodra@gmail.com>
2742
2743         * po/POTFILES.in: Regenerate.
2744
2745 2011-06-09  Ian Lance Taylor  <iant@google.com>
2746
2747         * script-sections.cc
2748         (Orphan_output_section::set_section_addresses): For a relocatable
2749         link set address to 0.
2750
2751 2011-06-09  Cary Coutant  <ccoutant@google.com>
2752
2753         PR gold/12804
2754         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2755         used with --compress-debug-sections.
2756         * gold/object.cc (Sized_relobj_file::do_layout): Report
2757         uncompressed size of compressed input sections.
2758
2759 2011-06-08  Cary Coutant  <ccoutant@google.com>
2760
2761         PR gold/12804
2762         * testsuite/two_file_test_2_v1.cc: Change initialization of
2763         v2 to keep it in .data.
2764
2765 2011-06-07  Cary Coutant  <ccoutant@google.com>
2766
2767         * common.cc (Symbol_table::do_allocate_commons_list): Call
2768         gold_fallback.
2769         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2770         (Errors::fallback): New function.
2771         (gold_fallback): New function.
2772         * errors.h (Errors::fallback): New function.
2773         * gold.cc (gold_exit): Change status parameter to enum; adjust
2774         all callers.
2775         (queue_initial_tasks): Call gold_fallback.
2776         * gold.h: Include cstdlib.
2777         (Exit_status): New enum type.
2778         (gold_exit): Change status parameter to enum.
2779         (gold_fallback): New function.
2780         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2781         (Layout::create_symtab_sections): Likewise.
2782         (Layout::create_shdrs): Likewise.
2783         * main.cc (main): Adjust call to gold_exit.
2784         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2785         (Output_data_got::add_got_entry_pair): Likewise.
2786         (Output_section::add_input_section): Likewise.
2787         (Output_section::add_output_section_data): Likewise.
2788         (Output_segment::set_section_list_addresses): Likewise.
2789         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2790
2791 2011-06-07  Cary Coutant  <ccoutant@google.com>
2792
2793         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2794         for incremental links.
2795         * output.cc (Output_segment::set_section_list_addresses): Remove
2796         FIXME and test for TLS or BSS.
2797
2798 2011-06-07  Cary Coutant  <ccoutant@google.com>
2799
2800         * testsuite/Makefile.am: Add incremental_copy_test,
2801         incremental_common_test_1.
2802         * testsuite/Makefile.in: Regenerate.
2803         * testsuite/common_test_1_v1.c: New source file.
2804         * testsuite/common_test_1_v2.c: New source file.
2805         * testsuite/copy_test_v1.cc: New source file.
2806
2807 2011-06-07  Cary Coutant  <ccoutant@google.com>
2808
2809         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2810         update, allocate common from bss section's free list.
2811         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2812         linker-defined symbols.
2813         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2814         Skip GOT and PLT entries that are no longer referenced.
2815         (Output_section_incremental_inputs::write_info_blocks): Mark
2816         linker-defined symbols.
2817         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2818         * output.cc (Output_section::allocate): New function.
2819         * output.h (Output_section::allocate): New function.
2820         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2821         linker-defined symbols.
2822         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2823         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2824         (Symbol::init_base_output_data): Likewise.
2825         (Symbol::init_base_output_segment): Likewise.
2826         (Symbol::init_base_constant): Likewise.
2827         (Sized_symbol::init_output_data): Likewise.
2828         (Sized_symbol::init_output_segment): Likewise.
2829         (Sized_symbol::init_constant): Likewise.
2830         (Symbol_table::do_define_in_output_data): Likewise.
2831         (Symbol_table::do_define_in_output_segment): Likewise.
2832         (Symbol_table::do_define_as_constant): Likewise.
2833         * symtab.h (Symbol::is_predefined): New function.
2834         (Symbol::init_base_output_data): Add is_predefined parameter.
2835         (Symbol::init_base_output_segment): Likewise.
2836         (Symbol::init_base_constant): Likewise.
2837         (Symbol::is_predefined_): New data member.
2838         (Sized_symbol::init_output_data): Add is_predefined parameter.
2839         (Sized_symbol::init_output_segment): Likewise.
2840         (Sized_symbol::init_constant): Likewise.
2841         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2842
2843 2011-06-07  Cary Coutant  <ccoutant@google.com>
2844
2845         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2846         instead of emit_copy_reloc.
2847         (Copy_relocs::emit_copy_reloc): Refactor.
2848         (Copy_relocs::make_copy_reloc): New function.
2849         (Copy_relocs::add_copy_reloc): Remove.
2850         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2851         section.
2852         (Copy_relocs::make_copy_reloc): New function.
2853         (Copy_relocs::add_copy_reloc): Remove.
2854         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2855         unchanged input files.
2856         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2857         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2858         Reserve BSS space for COPY relocations.
2859         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2860         (Output_section_incremental_inputs::write_info_blocks): Record
2861         whether a symbol is copied from a shared object.
2862         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2863         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2864         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2865         (Incremental_input_entry_reader::get_output_symbol_index): Add
2866         is_copy parameter.
2867         (Incremental_binary::emit_copy_relocs): New function.
2868         (Incremental_binary::do_emit_copy_relocs): New function.
2869         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2870         new data member.
2871         (Sized_incremental_binary::add_copy_reloc): New function.
2872         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2873         (Sized_incremental_binary::Copy_reloc): New struct.
2874         (Sized_incremental_binary::Copy_relocs): New typedef.
2875         (Sized_incremental_binary::copy_relocs_): New data member.
2876         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2877         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2878         * target.h (Sized_target::emit_copy_reloc): New function.
2879         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2880
2881 2011-06-02  Cary Coutant  <ccoutant@google.com>
2882
2883         PR gold/12163
2884         * gold/archive.cc (Archive::Archive): Initialize new data member.
2885         (Archive::include_all_members): Return if archive has already been
2886         included.
2887         * gold/archive.h (Archive::include_all_members_): New data member.
2888
2889 2011-06-02  Nick Clifton  <nickc@redhat.com>
2890
2891         * dynobj.h: Fix spelling mistake in comment.
2892         * output.cc: Likewise.
2893
2894 2011-05-31  Doug Kwan  <dougkwan@google.com>
2895             Asier Llano
2896
2897         PR gold/12826
2898         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2899         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2900         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2901         redundant arm_exidx_test.so.
2902         * testsuite/Makefile.in: Regenerate.
2903         (check_SCRIPTS): Add pr12826.sh
2904         (check_DATA): Add pr12826.stdout
2905         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2906         * testsuite/pr12826.sh: New file.
2907         * testsuite/pr12826_1.s: Ditto.
2908         * testsuite/pr12826_1.s: Ditto.
2909
2910 2011-05-30  Ian Lance Taylor  <iant@google.com>
2911
2912         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2913         sections.
2914
2915 2011-05-29  Ian Lance Taylor  <iant@google.com>
2916
2917         PR gold/12804
2918         * testsuite/Makefile.am: Use different file name for two_file_test
2919         temporary file for each incremental test.
2920         * testsuite/Makefile.in: Rebuild.
2921
2922 2011-05-29  Ian Lance Taylor  <iant@google.com>
2923
2924         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2925         binary input file is empty.
2926
2927 2011-05-27  Ian Lance Taylor  <iant@google.com>
2928
2929         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2930         (ver_test_9.so): Likewise.
2931         * testsuite/Makefile.in: Rebuild.
2932
2933 2011-05-26 Cary Coutant  <ccoutant@google.com>
2934
2935         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2936         * incremental.cc (Incremental_inputs::report_input_section): Fix
2937         comment, indentation.
2938         (Incremental_inputs::report_comdat_group): New function.
2939         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2940         of data for incremental input file entry.
2941         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2942         group count, COMDAT group signatures.
2943         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2944         an unchanged input file.
2945         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2946         Initialize new data member.
2947         (Incremental_object_entry::add_comdat_group): New function.
2948         (Incremental_object_entry::get_comdat_group_count): New function.
2949         (Incremental_object_entry::get_comdat_signature_key): New function.
2950         (Incremental_object_entry::groups_): New data member.
2951         (Incremental_inputs::report_comdat_group): New function.
2952         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2953         data for incremental input file entry.
2954         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2955         (Incremental_input_entry_reader::get_input_section): Adjust size of
2956         data for incremental input file entry.
2957         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2958         (Incremental_input_entry_reader::get_comdat_group_signature): New
2959         function.
2960         * object.cc (Sized_relobj::include_section_group): Report kept
2961         COMDAT groups for incremental links.
2962
2963 2011-05-24  David Meyer  <pdox@google.com>
2964
2965         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2966         with name parameter.  Add found_name parameter.
2967         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2968         * dirsearch.h (class Dirsearch): Update declaration.
2969
2970 2011-05-24  Ian Lance Taylor  <iant@google.com>
2971
2972         * archive.cc (Library_base::should_include_member): Pull in object
2973         from archive if it defines the entry symbol.
2974         * parameters.cc (Parameters::entry): New function.
2975         * parameters.h (class Parameters): Declare entry.
2976         * output.h (class Output_file_header): Remove entry_ field.
2977         * output.cc (Output_file_header::Output_file_header): Remove entry
2978         parameter.  Change all callers.
2979         (Output_file_header::entry): Use parameters->entry.
2980         * gold.cc (queue_middle_tasks): Likewise.
2981         * plugin.cc (Plugin_hook::run): Likewise.
2982
2983 2011-05-24 Cary Coutant  <ccoutant@google.com>
2984
2985         * gold.cc (queue_initial_tasks): Pass incremental base filename
2986         to Output_file::open_base_file; don't print error message.
2987         * incremental-dump.cc (main): Adjust call to
2988         Output_file::open_for_modification.
2989         * incremental-dump.cc (main): Likewise.
2990         * incremental.cc (Incremental_inputs::report_command_line):
2991         Ignore --incremental-base option when comparing command lines.
2992         Ignore parameter when given as separate argument.
2993         * options.h (class General_options): Add --incremental-base.
2994         * output.cc (Output_file::Output_file):
2995         (Output_file::open_base_file): Add base_name and writable parameters;
2996         read base file into new file; print error message here.
2997         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2998         callers.
2999         * output.h (Output_file::open_for_modification): Rename to...
3000         (Output_file::open_base_file): ...this; add base_name and
3001         writable parameters; adjust all callers.
3002         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3003         callers.
3004         * testsuite/Makefile.am (incremental_test_4): Test
3005         --incremental-base.
3006         * testsuite/Makefile.in: Regenerate.
3007
3008 2011-05-24 Cary Coutant  <ccoutant@google.com>
3009
3010         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3011         incremental_test_4.
3012         * testsuite/Makefile.in: Regenerate.
3013         * testsuite/two_file_test_1_v1.cc: New test source file.
3014         * testsuite/two_file_test_1b_v1.cc: New test source file.
3015         * testsuite/two_file_test_2_v1.cc: New test source file.
3016
3017 2011-05-24 Cary Coutant  <ccoutant@google.com>
3018
3019         * dynobj.h (Dynobj::do_dynobj): New function.
3020         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3021         flag and soname for shared objects.
3022         * incremental.cc (Incremental_inputs::report_object): Make
3023         either Incremental_object_entry or Incremental_dynobj_entry; add
3024         soname to string table.
3025         (Incremental_inputs::report_input_section): Add assertion.
3026         (Output_section_incremental_inputs::set_final_data_size): Adjust
3027         type of input file entry for shared libraries; adjust size of
3028         shared library info entry.
3029         (Output_section_incremental_inputs::write_input_files): Write
3030         as_needed flag for shared libraries.
3031         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3032         of input file entry for shared libraries; write soname.
3033         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3034         soname from incremental info.
3035         * incremental.h (enum Incremental_input_flags): Add
3036         INCREMENTAL_INPUT_AS_NEEDED.
3037         (Incremental_input_entry::Incremental_input_entry): Initialize new
3038         data member.
3039         (Incremental_input_entry::set_as_needed): New function.
3040         (Incremental_input_entry::as_needed): New function.
3041         (Incremental_input_entry::do_dynobj_entry): New function.
3042         (Incremental_input_entry::as_needed_): New data member.
3043         (Incremental_object_entry::Incremental_object_entry): Don't check
3044         for shared library.
3045         (Incremental_object_entry::do_type): Likewise.
3046         (class Incremental_dynobj_entry): New class.
3047         (Incremental_input_entry_reader::as_needed): New function.
3048         (Incremental_input_entry_reader::get_soname): New function.
3049         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3050         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3051         size of shared library info entry.
3052         * layout.cc (Layout::finish_dynamic_section): Don't test for
3053         incremental link when adding DT_NEEDED entries.
3054         * object.h (Object::Object): Initialize new data member.
3055         (Object::dynobj): New function.
3056         (Object::set_as_needed): New function.
3057         (Object::as_needed): New function.
3058         (Object::do_dynobj): New function.
3059         (Object::as_needed_): New data member.
3060
3061 2011-05-24 Cary Coutant  <ccoutant@google.com>
3062
3063         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3064         info; adjust display of GOT entries.
3065         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3066         vector of input objects; remove file_status_.
3067         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3068         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3069         got_plt reader; call target hooks to reserve GOT entries.
3070         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3071         of input file info header and GOT info entry.
3072         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3073         relocation info.
3074         (Got_plt_view_info::got_descriptor): Remove.
3075         (Got_plt_view_info::sym_index): New data member.
3076         (Got_plt_view_info::input_index): New data member.
3077         (Local_got_offset_visitor::visit): Write input file index.
3078         (Global_got_offset_visitor::visit): Write 0 for input file index.
3079         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3080         with sym_index and input_index.
3081         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3082         incremental info GOT entry; replace got_descriptor with input_index.
3083         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3084         map from input file index to object.
3085         (Sized_relobj_incr::do_layout): Replace direct data member reference
3086         with accessor function.
3087         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3088         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3089         Adjust size of input file info header.
3090         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3091         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3092         (Incremental_input_entry_reader::get_input_section): Adjust size of
3093         input file info header.
3094         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3095         of incremental info GOT entry.
3096         (Incremental_got_plt_reader::get_got_desc): Remove.
3097         (Incremental_got_plt_reader::get_got_symndx): New function.
3098         (Incremental_got_plt_reader::get_got_input_index): New function.
3099         (Sized_incremental_binary::Sized_incremental_binary): Remove
3100         file_status_; add input_objects_.
3101         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3102         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3103         (Sized_incremental_binary::file_is_unchanged): Remove.
3104         (Sized_incremental_binary::set_input_object): New function.
3105         (Sized_incremental_binary::input_object): New function.
3106         (Sized_incremental_binary::file_status_): Remove.
3107         (Sized_incremental_binary::input_objects_): New data member.
3108         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3109         references.
3110         (Sized_relobj_incr::invalid_address): Move to base class.
3111         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3112         class.
3113         (Sized_relobj_incr::do_output_section_offset): Likewise.
3114         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3115         (Sized_relobj_incr::section_offsets_): Likewise.
3116         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3117         function.
3118         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3119         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3120         with accessor function.
3121         (Sized_relobj_file::do_layout): Likewise.
3122         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3123         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3124         (Sized_relobj_file::compute_final_local_value): Replace refs to
3125         section_offsets_ with accessor function.
3126         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3127         * object.h (Relobj::Relobj): Initialize new data members.
3128         (Relobj::add_dyn_reloc): New function.
3129         (Relobj::first_dyn_reloc): New function.
3130         (Relobj::dyn_reloc_count): New function.
3131         (Relobj::first_dyn_reloc_): New data member.
3132         (Relobj::dyn_reloc_count_): New data member.
3133         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3134         references.
3135         (Sized_relobj::Address): New typedef.
3136         (Sized_relobj::invalid_address): Move here from child class.
3137         (Sized_relobj::Sized_relobj): Initialize new data members.
3138         (Sized_relobj::sized_relobj): New function.
3139         (Sized_relobj::is_output_section_offset_invalid): Move here from
3140         child class.
3141         (Sized_relobj::get_output_section_offset): Likewise.
3142         (Sized_relobj::local_has_got_offset): Likewise.
3143         (Sized_relobj::local_got_offset): Likewise.
3144         (Sized_relobj::set_local_got_offset): Likewise.
3145         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3146         (Sized_relobj::clear_got_offsets): New function.
3147         (Sized_relobj::section_offsets): Move here from child class.
3148         (Sized_relobj::do_output_section_offset): Likewise.
3149         (Sized_relobj::do_set_section_offset): Likewise.
3150         (Sized_relobj::Local_got_offsets): Likewise.
3151         (Sized_relobj::local_got_offsets_): Likewise.
3152         (Sized_relobj::section_offsets_): Likewise.
3153         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3154         references.
3155         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3156         class.
3157         (Sized_relobj_file::sized_relobj): New function
3158         (Sized_relobj_file::local_has_got_offset): Move to base class.
3159         (Sized_relobj_file::local_got_offset): Likewise.
3160         (Sized_relobj_file::set_local_got_offset): Likewise.
3161         (Sized_relobj_file::get_output_section_offset): Likewise.
3162         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3163         (Sized_relobj_file::do_output_section_offset): Likewise.
3164         (Sized_relobj_file::do_set_section_offset): Likewise.
3165         (Sized_relobj_file::Local_got_offsets): Likewise.
3166         (Sized_relobj_file::local_got_offsets_): Likewise.
3167         (Sized_relobj_file::section_offsets_): Likewise.
3168         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3169         (all constructors).
3170         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3171         (Output_reloc::get_symbol_index): Likewise.
3172         (Output_reloc::local_section_offset): Likewise.
3173         (Output_reloc::get_address): Likewise.
3174         (Output_reloc::symbol_value): Likewise.
3175         (Output_data_got::reserve_slot): Move to class definition.
3176         (Output_data_got::reserve_local): New function.
3177         (Output_data_got::reserve_slot_for_global): Remove.
3178         (Output_data_got::reserve_global): New function.
3179         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3180         (all constructors, two instantiations).
3181         (Output_reloc::get_relobj): New function (two instantiations).
3182         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3183         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3184         (Output_data_reloc::add_global): Adjust type of relobj.
3185         (Output_data_reloc::add_global_relative): Likewise.
3186         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3187         (Output_data_reloc::add_local): Likewise.
3188         (Output_data_reloc::add_local_relative): Likewise.
3189         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3190         (Output_data_reloc::add_local_section): Likewise.
3191         (Output_data_reloc::add_output_section): Likewise.
3192         (Output_data_reloc::add_absolute): Likewise.
3193         (Output_data_reloc::add_target_specific): Likewise.
3194         (Output_data_got::reserve_slot): Move definition here.
3195         (Output_data_got::reserve_local): New function.
3196         (Output_data_got::reserve_global): New function.
3197         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3198         section_offsets_ with accessor function.
3199         (Sized_relobj_file::write_sections): Likewise.
3200         (Sized_relobj_file::do_relocate_sections): Likewise.
3201         * target.h (Sized_target::reserve_local_got_entry): New function.
3202         (Sized_target::reserve_global_got_entry): New function.
3203         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3204         (Target_x86_64::reserve_global_got_entry): New function.
3205         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3206
3207 2011-05-23 Cary Coutant  <ccoutant@google.com>
3208
3209         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3210         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3211         bit when checking got_type.
3212         * incremental.cc (Sized_incremental_binary::setup_readers):
3213         Store symbol table and string table locations; initialize bit vector
3214         of file status flags.
3215         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3216         unchanged files.
3217         (Sized_incremental_binary::do_process_got_plt): New function.
3218         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3219         (Output_section_incremental_inputs::set_final_data_size): Record
3220         file index for each input file.
3221         (Output_section_incremental_inputs::write_got_plt): Store file index
3222         instead of input entry offset for each GOT entry.
3223         * incremental.h
3224         (Incremental_input_entry::Incremental_input_entry): Initialize new
3225         data member.
3226         (Incremental_input_entry::set_offset): Store file index.
3227         (Incremental_input_entry::get_file_index): New function.
3228         (Incremental_input_entry::file_index_): New data member.
3229         (Incremental_binary::process_got_plt): New function.
3230         (Incremental_binary::do_process_got_plt): New function.
3231         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3232         data members.
3233         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3234         (Sized_incremental_binary::set_file_is_unchanged): New function.
3235         (Sized_incremental_binary::file_is_unchanged): New function.
3236         (Sized_incremental_binary::do_process_got_plt): New function.
3237         (Sized_incremental_binary::file_status_): New data member.
3238         (Sized_incremental_binary::main_symtab_loc_): New data member.
3239         (Sized_incremental_binary::main_strtab_loc_): New data member.
3240         * output.cc (Output_data_got::Got_entry::write): Add case
3241         RESERVED_CODE.
3242         (Output_data_got::add_global): Call add_got_entry.
3243         (Output_data_got::add_global_plt): Likewise.
3244         (Output_data_got::add_global_with_rel): Likewise.
3245         (Output_data_got::add_global_with_rela): Likewise.
3246         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3247         (Output_data_got::add_global_pair_with_rela): Likewise.
3248         (Output_data_got::add_local): Call add_got_entry.
3249         (Output_data_got::add_local_plt): Likewise.
3250         (Output_data_got::add_local_with_rel): Likewise.
3251         (Output_data_got::add_local_with_rela): Likewise.
3252         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3253         (Output_data_got::add_local_pair_with_rela): Likewise.
3254         (Output_data_got::reserve_slot): New function.
3255         (Output_data_got::reserve_slot_for_global): New function.
3256         (Output_data_got::add_got_entry): New function.
3257         (Output_data_got::add_got_entry_pair): New function.
3258         (Output_section::add_output_section_data): Edit FIXME.
3259         * output.h
3260         (Output_section_data_build::Output_section_data_build): New
3261         constructor with size parameter.
3262         (Output_data_space::Output_data_space): Likewise.
3263         (Output_data_got::Output_data_got): Initialize new data member; new
3264         constructor with size parameter.
3265         (Output_data_got::add_constant): Call add_got_entry.
3266         (Output_data_got::reserve_slot): New function.
3267         (Output_data_got::reserve_slot_for_global): New function.
3268         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3269         (Output_data_got::add_got_entry): New function.
3270         (Output_data_got::add_got_entry_pair): New function.
3271         (Output_data_got::free_list_): New data member.
3272         * target.h (Sized_target::init_got_plt_for_update): New function.
3273         (Sized_target::register_global_plt_entry): New function.
3274         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3275         Initialize new data member; call init; add constructor with PLT count.
3276         (Output_data_plt_x86_64::init): New function.
3277         (Output_data_plt_x86_64::add_relocation): New function.
3278         (Output_data_plt_x86_64::reserve_slot): New function.
3279         (Output_data_plt_x86_64::free_list_): New data member.
3280         (Target_x86_64::init_got_plt_for_update): New function.
3281         (Target_x86_64::register_global_plt_entry): New function.
3282         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3283         incremental updates.
3284         (Output_data_plt_x86_64::add_relocation): New function.
3285         * testsuite/object_unittest.cc (Object_test): Set default options.
3286
3287 2011-05-16  Ian Lance Taylor  <iant@google.com>
3288
3289         * options.h (class General_options): Make -i a synonym for -r.
3290
3291 2011-05-16  Ian Lance Taylor  <iant@google.com>
3292
3293         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3294
3295 2011-05-10 Cary Coutant  <ccoutant@google.com>
3296
3297         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3298         strip_all (-s).
3299
3300 2011-05-06  Ian Lance Taylor  <iant@google.com>
3301
3302         * layout.cc (Layout::layout): If the output section flags change,
3303         update the ordering.
3304
3305 2011-04-25 Cary Coutant  <ccoutant@google.com>
3306
3307         * incremental-dump.cc (dump_incremental_inputs): Print local
3308         symbol info for each input file.
3309         * incremental.cc
3310         (Output_section_incremental_inputs::set_final_data_size): Add local
3311         symbol info to input file entries in incremental info.
3312         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3313         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3314         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3315         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3316         implementation.
3317         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3318         (Sized_incr_relobj::do_relocate): Write the local symbols.
3319         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3320         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3321         Adjust size of input file header.
3322         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3323         (Incremental_inputs_reader::get_local_symbol_count): New function.
3324         (Incremental_inputs_reader::get_input_section): Adjust size of input
3325         file header.
3326         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3327         (Sized_incr_relobj::This): New typedef.
3328         (Sized_incr_relobj::sym_size): New const data member.
3329         (Sized_incr_relobj::Local_symbol): New struct.
3330         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3331         (Sized_incr_relobj::do_local_symbol_offset): New function.
3332         (Sized_incr_relobj::local_symbol_count_): New data member.
3333         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3334         (Sized_incr_relobj::local_symbol_index_): New data member.
3335         (Sized_incr_relobj::local_symbol_offset_): New data member.
3336         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3337         (Sized_incr_relobj::local_symbols_): New data member.
3338         * object.h (Relobj::output_local_symbol_count): New function.
3339         (Relobj::local_symbol_offset): New function.
3340         (Relobj::do_output_local_symbol_count): New function.
3341         (Relobj::do_local_symbol_offset): New function.
3342         (Sized_relobj::do_output_local_symbol_count): New function.
3343         (Sized_relobj::do_local_symbol_offset): New function.
3344
3345 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3346
3347         * descriptors.cc (set_close_on_exec): New function.
3348         (Descriptors::open): Use set_close_on_exec.
3349         * output.cc (S_ISLNK): Define if not defined.
3350
3351 2011-04-22 Cary Coutant  <ccoutant@google.com>
3352
3353         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3354         global symbol map.
3355         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3356         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3357         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3358         relocations.
3359         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3360         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3361         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3362         * incremental.h
3363         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3364         function.
3365         (Incremental_binary::apply_incremental_relocs): New function.
3366         (Incremental_binary::do_apply_incremental_relocs): New function.
3367         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3368         data member.
3369         (Sized_incremental_binary::add_global_symbol): New function.
3370         (Sized_incremental_binary::global_symbol): New function.
3371         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3372         (Sized_incremental_binary::symbol_map_): New data member.
3373         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3374         * target.h (Sized_target::apply_relocation): New function.
3375         * target-reloc.h (apply_relocation): New function.
3376         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3377
3378 2011-04-22  Doug Kwan  <dougkwan@google.com>
3379
3380         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3381         flag of a SHT_ARM_EXIDX section.
3382         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3383         * testsuite/Makefile.in: Regenerate.
3384         * testsuite/arm_exidx_test.s: New file.
3385         * testsuite/arm_exidx_test.sh: Same.
3386
3387 2011-04-20 Cary Coutant  <ccoutant@google.com>
3388
3389         PR gold/12689
3390         * archive.h (Incremental_archive_entry::Archive_member):
3391         Initialize arg_serial_ (second constructor).
3392
3393 2011-04-17  Ian Lance Taylor  <iant@google.com>
3394
3395         * object.cc (Relocate_info::location): Simplify location string.
3396         * errors.cc (Errors::error_at_location): Don't print program
3397         name.
3398         (Errors::warning_at_location): Likewise.
3399         (Errors::undefined_symbol): Likewise.
3400         * testsuite/debug_msg.sh: Update accordingly.
3401
3402 2011-04-14 Cary Coutant  <ccoutant@google.com>
3403
3404         * gold/layout.cc (Layout::symtab_section_offset): New function.
3405         * gold/layout.h (Layout::symtab_section_offset): New function.
3406         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3407
3408 2011-04-12  Ian Lance Taylor  <iant@google.com>
3409
3410         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3411         with MREMAP_MAYMOVE.
3412         * output.h (class Output_file): Add map_is_allocated_ field.
3413         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3414         not available, provide stubs.  If mremap is not available, #define
3415         it to gold_mremap.
3416         (MREMAP_MAYMOVE): Define if not defined.
3417         (Output_file::Output_file): Initialize map_is_allocated_.
3418         (Output_file::resize): Check map_is_allocated_.
3419         (Output_file::map_anonymous): If mmap fails, use malloc.
3420         (Output_file::unmap): Don't do anything for an anonymous map.
3421         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3422         is not available, provide stubs.
3423         (File_read::View::~View): Use free rather than delete[].
3424         (File_read::make_view): Use malloc rather than new[].  If mmap
3425         fails, use malloc.
3426         (File_read::find_or_make_view): Use malloc rather than new[].
3427         * gold.h: Remove HAVE_REMAP code.
3428         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3429         exists.  Rename mremap to gold_mremap.  If mmap is not available
3430         don't do anything.
3431         * configure, config.in: Rebuild.
3432
3433 2011-04-11  Ian Lance Taylor  <iant@google.com>
3434
3435         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3436         initialize local variable v.
3437
3438 2011-04-11  Cary Coutant  <ccoutant@google.com>
3439
3440         * archive.cc (Archive::include_member): Adjust call to
3441         report_object.
3442         (Add_archive_symbols::run): Track argument serial numbers.
3443         (Lib_group::include_member): Likewise.
3444         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3445         * archive.h (Incremental_archive_entry::Archive_member):
3446         Initialize arg_serial_.
3447         (Archive_member::arg_serial_): New data member.
3448         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3449         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3450         incremental link.
3451         (Sized_dynobj::do_for_all_local_got_entries): New function.
3452         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3453         function.
3454         * fileread.cc (get_mtime): New function.
3455         * fileread.h (get_mtime): New function.
3456         * gold.cc (queue_initial_tasks): Check for incremental update.
3457         (process_incremental_input): New function.
3458         (queue_middle_tasks): Don't force valid target for incremental
3459         update.
3460         * incremental-dump.cc (find_input_containing_global): Adjust
3461         size of symbol info entry.
3462         (dump_incremental_inputs): Dump argument serial number and
3463         in_system_directory flag; bias shndx by 1; print symbol names
3464         when dumping per-file symbol lists; use new symbol info readers.
3465         * incremental.cc
3466         (Output_section_incremental_inputs:update_data_size): New function.
3467         (Sized_incremental_binary::setup_readers): Setup input readers
3468         for each input file; build maps for files added from libraries
3469         and scripts.
3470         (Sized_incremental_binary::check_input_args): New function.
3471         (Sized_incremental_binary::do_check_inputs): Build map of argument
3472         serial numbers to input arguments.
3473         (Sized_incremental_binary::do_file_has_changed): Rename
3474         do_file_is_unchanged to this; compare file modification times.
3475         (Sized_incremental_binary::do_init_layout): New function.
3476         (Sized_incremental_binary::do_reserve_layout): New function.
3477         (Sized_incremental_binary::do_get_input_reader): Remove.
3478         (Sized_incremental_binary::get_symtab_view): New function.
3479         (Incremental_checker::can_incrementally_link_output_file): Remove.
3480         (Incremental_inputs::report_command_line): Exclude --debug options.
3481         (Incremental_inputs::report_archive_begin): Add parameter; track
3482         argument serial numbers; don't put input file entry for archive
3483         before archive members.
3484         (Incremental_inputs::report_archive_end): Put input file entry
3485         for archive after archive members.
3486         (Incremental_inputs::report_object): Add parameter; track argument
3487         serial numbers and in_system_directory flag.
3488         (Incremental_inputs::report_script): Add parameter; track argument
3489         serial numbers.
3490         (Output_section_incremental_inputs::set_final_data_size): Adjust
3491         size of symbol info entry; check for forwarding symbols.
3492         (Output_section_incremental_inputs::write_input_files): Write
3493         in_system_directory flag and argument serial number.
3494         (Output_section_incremental_inputs::write_info_blocks): Map section
3495         indices between incremental info and original input file; store
3496         input section index for each symbol.
3497         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3498         change operator() to visit().
3499         (class Global_got_offset_visitor): Likewise.
3500         (class Global_symbol_visitor_got_plt):
3501         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3502         classes.
3503         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3504         (Sized_incr_relobj::do_read_symbols): New function.
3505         (Sized_incr_relobj::do_layout): New function.
3506         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3507         (Sized_incr_relobj::do_add_symbols): New function.
3508         (Sized_incr_relobj::do_should_include_member): New function.
3509         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3510         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3511         (Sized_incr_relobj::do_section_size): New function.
3512         (Sized_incr_relobj::do_section_name): New function.
3513         (Sized_incr_relobj::do_section_contents): New function.
3514         (Sized_incr_relobj::do_section_flags): New function.
3515         (Sized_incr_relobj::do_section_entsize): New function.
3516         (Sized_incr_relobj::do_section_address): New function.
3517         (Sized_incr_relobj::do_section_type): New function.
3518         (Sized_incr_relobj::do_section_link): New function.
3519         (Sized_incr_relobj::do_section_info): New function.
3520         (Sized_incr_relobj::do_section_addralign): New function.
3521         (Sized_incr_relobj::do_initialize_xindex): New function.
3522         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3523         (Sized_incr_relobj::do_read_relocs): New function.
3524         (Sized_incr_relobj::do_gc_process_relocs): New function.
3525         (Sized_incr_relobj::do_scan_relocs): New function.
3526         (Sized_incr_relobj::do_count_local_symbols): New function.
3527         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3528         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3529         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3530         (Sized_incr_relobj::do_relocate): New function.
3531         (Sized_incr_relobj::do_set_section_offset): New function.
3532         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3533         (Sized_incr_dynobj::do_read_symbols): New function.
3534         (Sized_incr_dynobj::do_layout): New function.
3535         (Sized_incr_dynobj::do_add_symbols): New function.
3536         (Sized_incr_dynobj::do_should_include_member): New function.
3537         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3538         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3539         (Sized_incr_dynobj::do_section_size): New function.
3540         (Sized_incr_dynobj::do_section_name): New function.
3541         (Sized_incr_dynobj::do_section_contents): New function.
3542         (Sized_incr_dynobj::do_section_flags): New function.
3543         (Sized_incr_dynobj::do_section_entsize): New function.
3544         (Sized_incr_dynobj::do_section_address): New function.
3545         (Sized_incr_dynobj::do_section_type): New function.
3546         (Sized_incr_dynobj::do_section_link): New function.
3547         (Sized_incr_dynobj::do_section_info): New function.
3548         (Sized_incr_dynobj::do_section_addralign): New function.
3549         (Sized_incr_dynobj::do_initialize_xindex): New function.
3550         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3551         (make_sized_incremental_object): New function.
3552         (Incremental_library::copy_unused_symbols): New function.
3553         (Incremental_library::do_for_all_unused_symbols): New function.
3554         * incremental.h (enum Incremental_input_flags): New type.
3555         (class Incremental_checker): Remove.
3556         (Incremental_input_entry::Incremental_input_entry): Add argument
3557         serial number.
3558         (Incremental_input_entry::arg_serial): New function.
3559         (Incremental_input_entry::set_is_in_system_directory): New function.
3560         (Incremental_input_entry::is_in_system_directory): New function.
3561         (Incremental_input_entry::arg_serial_): New data member.
3562         (Incremental_input_entry::is_in_system_directory_): New data member.
3563         (class Script_info): Move here from script.h.
3564         (Script_info::Script_info): Add filename parameter.
3565         (Script_info::filename): New function.
3566         (Script_info::filename_): New data member.
3567         (Incremental_script_entry::Incremental_script_entry): Add argument
3568         serial number.
3569         (Incremental_object_entry::Incremental_object_entry): Likewise.
3570         (Incremental_object_entry::add_input_section): Build list of input
3571         sections with map to original shndx.
3572         (Incremental_object_entry::get_input_section_index): New function.
3573         (Incremental_object_entry::shndx_): New data member.
3574         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3575         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3576         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3577         serial number.
3578         (Incremental_inputs::report_archive_begin): Likewise.
3579         (Incremental_inputs::report_object): Likewise.
3580         (Incremental_inputs::report_script): Likewise.
3581         (class Incremental_global_symbol_reader): New class.
3582         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3583         and store flags and input file type.
3584         (Incremental_input_entry_reader::arg_serial): New function.
3585         (Incremental_input_entry_reader::type): Extract type from flags.
3586         (Incremental_input_entry_reader::is_in_system_directory): New function.
3587         (Incremental_input_entry_reader::get_input_section_count): Call
3588         accessor function for type.
3589         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3590         function for type; adjust size of global symbol entry.
3591         (Incremental_input_entry_reader::get_global_symbol_count): Call
3592         accessor function for type.
3593         (Incremental_input_entry_reader::get_object_count): Likewise.
3594         (Incremental_input_entry_reader::get_object_offset): Likewise.
3595         (Incremental_input_entry_reader::get_member_count): Likewise.
3596         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3597         (Incremental_input_entry_reader::get_member_offset): Likewise.
3598         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3599         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3600         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3601         (Incremental_input_entry_reader::get_global_symbol_reader): New
3602         function.
3603         (Incremental_input_entry_reader::get_output_symbol_index): New
3604         function.
3605         (Incremental_input_entry_reader::type_): Remove.
3606         (Incremental_input_entry_reader::flags_): New data member.
3607         (Incremental_inputs_reader::input_file_offset): New function.
3608         (Incremental_inputs_reader::input_file_index): New function.
3609         (Incremental_inputs_reader::input_file): Call input_file_offset.
3610         (Incremental_inputs_reader::input_file_at_offset): New function.
3611         (Incremental_relocs_reader::get_r_type): Reformat.
3612         (Incremental_relocs_reader::get_r_shndx): Reformat.
3613         (Incremental_relocs_reader::get_r_offset): Reformat.
3614         (Incremental_relocs_reader::data): New function.
3615         (Incremental_binary::Incremental_binary): Initialize new data members.
3616         (Incremental_binary::check_inputs): Add cmdline parameter.
3617         (Incremental_binary::file_is_unchanged): Remove.
3618         (Input_reader::arg_serial): New function.
3619         (Input_reader::get_unused_symbol_count): New function.
3620         (Input_reader::get_unused_symbol): New function.
3621         (Input_reader::do_arg_serial): New function.
3622         (Input_reader::do_get_unused_symbol_count): New function.
3623         (Input_reader::do_get_unused_symbol): New function.
3624         (Incremental_binary::input_file_count): New function.
3625         (Incremental_binary::get_input_reader): Change signature to use
3626         index instead of filename.
3627         (Incremental_binary::file_has_changed): New function.
3628         (Incremental_binary::get_input_argument): New function.
3629         (Incremental_binary::get_library): New function.
3630         (Incremental_binary::get_script_info): New function.
3631         (Incremental_binary::init_layout): New function.
3632         (Incremental_binary::reserve_layout): New function.
3633         (Incremental_binary::output_file): New function.
3634         (Incremental_binary::do_check_inputs): New function.
3635         (Incremental_binary::do_file_is_unchanged): Remove.
3636         (Incremental_binary::do_file_has_changed): New function.
3637         (Incremental_binary::do_init_layout): New function.
3638         (Incremental_binary::do_reserve_layout): New function.
3639         (Incremental_binary::do_input_file_count): New function.
3640         (Incremental_binary::do_get_input_reader): Change signature.
3641         (Incremental_binary::input_args_map_): New data member.
3642         (Incremental_binary::library_map_): New data member.
3643         (Incremental_binary::script_map_): New data member.
3644         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3645         new data members.
3646         (Sized_incremental_binary::output_section): New function.
3647         (Sized_incremental_binary::inputs_reader): Add const.
3648         (Sized_incremental_binary::symtab_reader): Add const.
3649         (Sized_incremental_binary::relocs_reader): Add const.
3650         (Sized_incremental_binary::got_plt_reader): Add const.
3651         (Sized_incremental_binary::get_symtab_view): New function.
3652         (Sized_incremental_binary::Inputs_reader): New typedef.
3653         (Sized_incremental_binary::Input_entry_reader): New typedef.
3654         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3655         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3656         (Sized_incremental_binary::do_file_has_changed): New function.
3657         (Sized_incremental_binary::do_init_layout): New function.
3658         (Sized_incremental_binary::do_reserve_layout): New function.
3659         (Sized_input_reader::Inputs_reader): Remove.
3660         (Sized_input_reader::Input_entry_reader): Remove.
3661         (Sized_input_reader::do_arg_serial): New function.
3662         (Sized_input_reader::do_get_unused_symbol_count): New function.
3663         (Sized_input_reader::do_get_unused_symbol): New function.
3664         (Sized_incremental_binary::do_input_file_count): New function.
3665         (Sized_incremental_binary::do_get_input_reader): Change signature;
3666         use index instead of filename.
3667         (Sized_incremental_binary::section_map_): New data member.
3668         (Sized_incremental_binary::input_entry_readers_): New data member.
3669         (class Sized_incr_relobj): New class.
3670         (class Sized_incr_dynobj): New class.
3671         (make_sized_incremental_object): New function.
3672         (class Incremental_library): New class.
3673         * layout.cc (Free_list::num_lists): New static data member.
3674         (Free_list::num_nodes): New static data member.
3675         (Free_list::num_removes): New static data member.
3676         (Free_list::num_remove_visits): New static data member.
3677         (Free_list::num_allocates): New static data member.
3678         (Free_list::num_allocate_visits): New static data member.
3679         (Free_list::init): New function.
3680         (Free_list::remove): New function.
3681         (Free_list::allocate): New function.
3682         (Free_list::dump): New function.
3683         (Free_list::print_stats): New function.
3684         (Layout_task_runner::run): Resize output file for incremental updates.
3685         (Layout::Layout): Initialize new data members.
3686         (Layout::set_incremental_base): New function.
3687         (Layout::init_fixed_output_section): New function.
3688         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3689         incremental updates.
3690         (Layout::create_gold_note): Do not create gold note section for
3691         incremental updates.
3692         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3693         for incremental updates.
3694         (Layout::set_section_offsets): For incremental updates, allocate space
3695         from free list.
3696         (Layout::create_symtab_sections): Layout with offsets relative to
3697         start of section; for incremental updates, allocate space from free
3698         list.
3699         (Layout::create_shdrs): For incremental updates, allocate space from
3700         free list.
3701         (Layout::finish_dynamic_section): For incremental updates, do not
3702         check --as-needed (fixed in subsequent patch).
3703         * layout.h (class Free_list): New class.
3704         (Layout::set_incremental_base): New function.
3705         (Layout::incremental_base): New function.
3706         (Layout::init_fixed_output_section): New function.
3707         (Layout::allocate): New function.
3708         (Layout::incremental_base_): New data member.
3709         (Layout::free_list_): New data member.
3710         * main.cc (main): Print Free_list statistics.
3711         * object.cc (Relobj::finalize_incremental_relocs): Add
3712         clear_counts parameter; clear counts only when clear_counts is set.
3713         (Sized_relobj::Sized_relobj): Initialize new base class.
3714         (Sized_relobj::do_layout): Don't report special sections.
3715         (Sized_relobj::do_for_all_local_got_entries): New function.
3716         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3717         symtab_off to all symbol table offsets.
3718         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3719         * object.h (class Got_offset_list): Move to top of file.
3720         (Object::Object): Allow case where input_file == NULL.
3721         (Object::~Object): Likewise.
3722         (Object::input_file): Assert that input_file != NULL.
3723         (Object::lock): Allow case where input_file == NULL.
3724         (Object::unlock): Likewise.
3725         (Object::is_locked): Likewise.
3726         (Object::token): Likewise.
3727         (Object::release): Likewise.
3728         (Object::is_incremental): New function.
3729         (Object::get_mtime): New function.
3730         (Object::for_all_local_got_entries): New function.
3731         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3732         (Object::set_is_in_system_directory): New function.
3733         (Object::is_in_system_directory): New function.
3734         (Object::do_is_incremental): New function.
3735         (Object::do_get_mtime): New function.
3736         (Object::do_for_all_local_got_entries): New function.
3737         (Object::is_in_system_directory_): New data member.
3738         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3739         (class Sized_relobj_base): New class.
3740         (class Sized_relobj): Derive from Sized_relobj_base.
3741         (class Sized_relobj::Symbols): Redeclare from base class.
3742         (class Sized_relobj::local_got_offset_list): Remove.
3743         (class Sized_relobj::Output_sections): Redeclare from base class.
3744         (class Sized_relobj::do_for_all_local_got_entries): New function.
3745         (class Sized_relobj::write_local_symbols): Add offset parameter.
3746         (class Sized_relobj::local_symbol_offset_): Update comment.
3747         (class Sized_relobj::local_dynsym_offset_): Update comment.
3748         * options.cc (Input_arguments::add_file): Remove const.
3749         * options.h (Input_file_argument::Input_file_argument):
3750         Initialize arg_serial_ (all constructors).
3751         (Input_file_argument::set_arg_serial): New function.
3752         (Input_file_argument::arg_serial): New function.
3753         (Input_file_argument::arg_serial_): New data member.
3754         (Input_arguments::Input_arguments): Initialize file_count_.
3755         (Input_arguments::add_file): Remove const.
3756         (Input_arguments::number_of_input_files): New function.
3757         (Input_arguments::file_count_): New data member.
3758         (Command_line::number_of_input_files): Call
3759         Input_arguments::number_of_input_files.
3760         * output.cc (Output_segment_headers::Output_segment_headers):
3761         Set current size.
3762         (Output_section::Input_section::current_data_size): New function.
3763         (Output_section::Output_section): Initialize new data members.
3764         (Output_section::add_input_section): Don't do merge sections for
3765         an incremental link; allocate space from free list for an
3766         incremental update.
3767         (Output_section::add_output_section_data): Allocate space from
3768         free list for an incremental update.
3769         (Output_section::update_data_size): New function.
3770         (Output_section::set_fixed_layout): New function.
3771         (Output_section::reserve): New function.
3772         (Output_segment::set_section_addresses): Remove const.
3773         (Output_segment::set_section_list_addresses): Remove const; allocate
3774         space from free list for an incremental update.
3775         (Output_segment::set_offset): Adjust size of RELRO segment for an
3776         incremental update.
3777         * output.h (Output_data::current_data_size): Move here from
3778         child classes.
3779         (Output_data::pre_finalize_data_size): New function.
3780         (Output_data::update_data_size): New function.
3781         (Output_section_headers::update_data_size): new function.
3782         (Output_section_data_build::current_data_size): Move to Output_data.
3783         (Output_data_strtab::update_data_size): New function.
3784         (Output_section::current_data_size): Move to Output_data.
3785         (Output_section::set_fixed_layout): New function.
3786         (Output_section::has_fixed_layout): New function.
3787         (Output_section::reserve): New function.
3788         (Output_section::update_data_size): New function.
3789         (Output_section::has_fixed_layout_): New data member.
3790         (Output_section::free_list_): New data member.
3791         (Output_segment::set_section_addresses): Remove const.
3792         (Output_segment::set_section_list_addresses): Remove const.
3793         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3794         New function.
3795         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3796         New function.
3797         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3798         parameter when calling Add_symbols constructor; store argument
3799         serial number for members of a lib group.
3800         (Add_symbols::locks): Allow case where token == NULL.
3801         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3802         (Read_member::~Read_member): New function.
3803         (Read_member::is_runnable): New function.
3804         (Read_member::locks): New function.
3805         (Read_member::run): New function.
3806         (Check_script::~Check_script): New function.
3807         (Check_script::is_runnable): New function.
3808         (Check_script::locks): New function.
3809         (Check_script::run): New function.
3810         (Check_library::~Check_library): New function.
3811         (Check_library::is_runnable): New function.
3812         (Check_library::locks): New function.
3813         (Check_library::run): New function.
3814         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3815         (Add_symbols::library_): New data member.
3816         (class Read_member): New class.
3817         (class Check_script): New class.
3818         (class Check_library): New class.
3819         * reloc.cc (Read_relocs::is_runnable): Allow case where
3820         token == NULL.
3821         (Read_relocs::locks): Likewise.
3822         (Scan_relocs::locks): Likewise.
3823         (Relocate_task::locks): Likewise.
3824         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3825         to clear counters.
3826         (Sized_relobj::incremental_relocs_scan): Fix comment.
3827         (Sized_relobj::do_relocate): Pass output file offset to
3828         write_local_symbols.
3829         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3830         from class declaration.
3831         * script.cc (read_input_script): Allocate Script_info; pass
3832         argument serial number to report_script.
3833         * script.h (class Script_info): Move to incremental.h.
3834         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3835         * symtab.h (Symbol_table::add_from_incrobj): New function.
3836         (Symbol_table::set_file_offset): New function.
3837
3838 2011-04-05  Cary Coutant  <ccoutant@google.com>
3839
3840         * incremental-dump.cc (dump_incremental_inputs): Change signature
3841         to take a Sized_incremental_binary; change caller.  Use readers
3842         in Sized_incremental_binary.
3843         * incremental.cc
3844         (Sized_incremental_binary::find_incremental_inputs_sections):
3845         Rename do_find_incremental_inputs_sections to this.
3846         (Sized_incremental_binary::setup_readers): New function.
3847         (Sized_incremental_binary::do_check_inputs): Check
3848         has_incremental_info_ flag; move setup code to setup_readers;
3849         use input readers.
3850         (Sized_incremental_binary::do_file_is_unchanged): New function.
3851         (Sized_incremental_binary::do_get_input_reader): New function.
3852         * incremental.h (class Incremental_binary): Move to end of file.
3853         (Incremental_binary::file_is_unchanged): New function.
3854         (Incremental_binary::do_file_is_unchanged): New function.
3855         (Incremental_binary::Input_reader): New class.
3856         (Incremental_binary::get_input_reader): New function.
3857         (class Sized_incremental_binary): Move to end of file.
3858         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3859         input section reader classes.
3860         (Sized_incremental_binary::has_incremental_info): New function.
3861         (Sized_incremental_binary::inputs_reader): New function.
3862         (Sized_incremental_binary::symtab_reader): New function.
3863         (Sized_incremental_binary::relocs_reader): New function.
3864         (Sized_incremental_binary::got_plt_reader): New function.
3865         (Sized_incremental_binary::do_file_is_unchanged): New function.
3866         (Sized_incremental_binary::Sized_input_reader): New class.
3867         (Sized_incremental_binary::get_input_reader): New function.
3868         (Sized_incremental_binary::find_incremental_inputs_sections):
3869         Rename do_find_incremental_inputs_sections to this.
3870         (Sized_incremental_binary::setup_readers): New function.
3871         (Sized_incremental_binary::has_incremental_info_): New data member.
3872         (Sized_incremental_binary::inputs_reader_): New data member.
3873         (Sized_incremental_binary::symtab_reader_): New data member.
3874         (Sized_incremental_binary::relocs_reader_): New data member.
3875         (Sized_incremental_binary::got_plt_reader_): New data member.
3876         (Sized_incremental_binary::current_input_file_): New data member.
3877
3878 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3879
3880         PR gold/12640
3881         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3882         violation.
3883
3884 2011-03-30  Cary Coutant  <ccoutant@google.com>
3885
3886         * archive.cc (Archive::include_member): Adjust call to report_object.
3887         (Add_archive_symbols::run): Add script_info to call to
3888         report_archive_begin.
3889         (Lib_group::include_member): Adjust call to report_object.
3890         (Add_lib_group_symbols::run): Adjust call to report_object.
3891         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3892         blocks.  Add object count for script input files.
3893         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3894         script_info parameter; change all callers.
3895         (Incremental_inputs::report_object): Add script_info parameter;
3896         change all callers.
3897         (Incremental_inputs::report_script): Store backpointer to
3898         incremental info entry.
3899         (Output_section_incremental_inputs::set_final_data_size): Record
3900         additional information for scripts.
3901         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3902         * incremental.h (Incremental_script_entry::add_object): New function.
3903         (Incremental_script_entry::get_object_count): New function.
3904         (Incremental_script_entry::get_object): New function.
3905         (Incremental_script_entry::objects_): New data member; adjust
3906         constructor.
3907         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3908         (Incremental_inputs::report_object): Add script_info parameter.
3909         (Incremental_inputs_reader::get_object_count): New function.
3910         (Incremental_inputs_reader::get_object_offset): New function.
3911         * options.cc (Input_arguments::add_file): Return reference to
3912         new input argument.
3913         * options.h (Input_argument::set_script_info): New function.
3914         (Input_argument::script_info): New function.
3915         (Input_argument::script_info_): New data member; adjust all
3916         constructors.
3917         (Input_file_group::add_file): Return reference to new input argument.
3918         (Input_file_lib::add_file): Likewise.
3919         (Input_arguments::add_file): Likewise.
3920         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3921         * script.cc (Parser_closure::Parser_closure): Add script_info
3922         parameter; adjust all callers.
3923         (Parser_closure::script_info): New function.
3924         (Parser_closure::script_info_): New data member.
3925         (read_input_script): Report scripts earlier to incremental info.
3926         (script_add_file): Set script_info in Input_argument.
3927         (script_add_library): Likewise.
3928         * script.h (Script_options::Script_info): Rewrite class.
3929
3930 2011-03-29  Cary Coutant  <ccoutant@google.com>
3931
3932         * archive.cc (Library_base::should_include_member): Move
3933         method here from class Archive.
3934         (Archive::Archive): Initialize base class.
3935         (Archive::should_include_member): Move to base class.
3936         (Archive::do_for_all_unused_symbols): New function.
3937         (Add_archive_symbols::run): Remove redundant access to
3938         incremental_inputs.
3939         (Lib_group::Lib_group): Initialize base class.
3940         (Lib_group::do_filename): New function.
3941         (Lib_group::include_member): Pass pointer to Lib_group to
3942         report_object.
3943         (Lib_group::do_for_all_unused_symbols): New function.
3944         (Add_lib_group_symbols::run): Report archive information for
3945         incremental links.
3946         * archive.h (class Library_base): New base class.
3947         (class Archive): Derive from Library_base.
3948         (Archive::filename): Move to base class.
3949         (Archive::set_incremental_info): Likewise.
3950         (Archive::incremental_info): Likewise.
3951         (Archive::Should_include): Likewise.
3952         (Archive::should_include_member): Likewise.
3953         (Archive::Armap_entry): Remove.
3954         (Archive::Unused_symbol_iterator): Remove.
3955         (Archive::unused_symbols_begin): Remove.
3956         (Archive::unused_symbols_end): Remove.
3957         (Archive::do_filename): New function.
3958         (Archive::do_get_mtime): New function.
3959         (Archive::do_for_all_unused_symbols): New function.
3960         (Archive::task_): Move to base class.
3961         (Archive::incremental_info_): Likewise.
3962         (class Lib_group): Derive from Library_base.
3963         (Lib_group::do_filename): New function.
3964         (Lib_group::do_get_mtime): New function.
3965         (Lib_group::do_for_all_unused_symbols): New function.
3966         (Lib_group::task_): Move to base class.
3967         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3968         function.
3969         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3970         function.
3971         * incremental.cc (Incremental_inputs::report_archive_begin):
3972         Use Library_base; call library's get_mtime; add incremental inputs
3973         entry before members.
3974         (class Unused_symbol_visitor): New class.
3975         (Incremental_inputs::report_archive_end): Use Library_base; use
3976         visitor class to record unused symbols; don't add incremental inputs
3977         entry after members.
3978         (Incremental_inputs::report_object): Use Library_base.
3979         * incremental.h
3980         (Incremental_archive_entry::Incremental_archive_entry): Remove
3981         unused Archive parameter.
3982         (Incremental_inputs::report_archive_begin): Use Library_base.
3983         (Incremental_inputs::report_archive_end): Likewise.
3984         (Incremental_inputs::report_object): Likewise.
3985         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3986         function.
3987         * object.h (Object::for_all_global_symbols): New function.
3988         (Object::do_for_all_global_symbols): New function.
3989         (Sized_relobj::do_for_all_global_symbols): New function.
3990         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3991         function.
3992         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3993         function.
3994
3995 2011-03-27  Ian Lance Taylor  <iant@google.com>
3996
3997         * archive.cc (Archive::interpret_header): Return -1 if something
3998         goes wrong.  Change callers accordingly.
3999
4000 2011-03-25  Cary Coutant  <ccoutant@google.com>
4001
4002         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4003         * testsuite/Makefile.in: Regenerate.
4004
4005 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4006
4007         * plugin.cc (get_view): New.
4008         (Plugin::load): Pass get_view to the plugin.
4009         (Plugin_manager::get_view): New.
4010
4011 2011-03-21  Ian Lance Taylor  <iant@google.com>
4012
4013         * testsuite/final_layout.sh: Rewrite to not use dc.
4014         * testsuite/relro_test.sh: Fail if dc is not present.
4015
4016 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4017
4018         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4019         Change == to -eq.
4020         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4021         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4022         Change == to -eq.
4023         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4024         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4025
4026 2011-03-14  Ian Lance Taylor  <iant@google.com>
4027
4028         * script-sections.cc (Sort_output_sections::script_compare):
4029         Rename from is_before, change return type.
4030         (Sort_output_sections::operator()): Adjust accordingly.
4031
4032 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4033
4034         PR gold/12572
4035         * testsuite/odr_violation2.cc: Add comment to make all error line
4036         numbers double digits.
4037         * testsuite/debug_msg.sh: Adjust expected errors.
4038
4039 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4040
4041         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4042         but mark earlier ones as non-canonical
4043         (offset_to_iterator): Update search target and example
4044         (do_addr2line): Return extra lines in a vector*
4045         (format_file_lineno): Extract from do_addr2line
4046         (one_addr2line): Add vector* out-param
4047         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4048         when a lineno entry appeared last for its instruction
4049         (Dwarf_line_info): Add vector* out-param
4050         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4051         * symtab.cc (Odr_violation_compare): Include the lineno in the
4052         comparison again.
4053         (linenos_from_loc): New. Combine the canonical line for an
4054         address with its other lines.
4055         (True_if_intersect): New. Helper functor to make
4056         std::set_intersection a query.
4057         (detect_odr_violations): Compare sets of lines instead of just
4058         one line for each function. This became less deterministic, but
4059         has fewer false positives.
4060         * symtab.h: Declarations.
4061         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4062         mix an optimized and non-optimized object in the same binary
4063         (odr_violation2.so): Same.
4064         * testsuite/Makefile.in: Regenerate from Makefile.am.
4065         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4066         * testsuite/debug_msg.sh: Update line numbers and add
4067         assertions.
4068         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4069         non-optimized context.
4070         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4071         isn't inlined, and use OdrDerived in an optimized context.
4072         * testsuite/odr_header1.h: Defines OdrDerived, where
4073         optimization will change the
4074         first-instruction-in-the-destructor's file and line number.
4075         * testsuite/odr_header2.h: Defines OdrBase.
4076
4077 2011-03-09  Ian Lance Taylor  <iant@google.com>
4078
4079         * fileread.cc (File_read::clear_views): Don't delete the whole
4080         file view.
4081
4082 2011-03-08  Ian Lance Taylor  <iant@google.com>
4083
4084         PR gold/12525
4085         * fileread.cc: #include <climits>.
4086         (GOLD_IOV_MAX): Define.
4087         (File_read::read_multiple): Limit number of entries by iov_max.
4088         * fileread.h (class File_read): Always set max_readv_entries to
4089         128.
4090
4091 2011-03-07  Ian Lance Taylor  <iant@google.com>
4092
4093         PR gold/12525
4094         * options.h (class General_options): Add -dy and -dn.
4095
4096 2011-03-02  Cary Coutant  <ccoutant@google.com>
4097
4098         * testsuite/script_test_9.t: Add TLS segment.
4099
4100 2011-03-02  Simon Baldwin  <simonb@google.com>
4101
4102         * configure.ac: Add check for gnu_indirect_function support in
4103         the toolchain building binutils.
4104         * configure: Rebuild.
4105
4106 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4107
4108         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4109         plugin only symbols.
4110         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4111         in plugin files as not needed in the symbol table.
4112
4113 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4114
4115         * output.cc (Output_section::add_input_section): Delay fill
4116         generation for section ordering.
4117
4118 2011-02-09  Ian Lance Taylor  <iant@google.com>
4119
4120         PR gold/12316
4121         * object.h (class Sized_relobj): Remove clear_local_symbols.
4122         * reloc.cc (Sized_relobj::do_relocate): Don't call
4123         clear_local_symbols.
4124
4125 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4126
4127         * plugin.cc (is_visible_from_outside): Return true for symbols
4128         in the -u option.
4129
4130 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4131
4132         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4133         filename.
4134
4135 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4136
4137         * icf.h (is_section_foldable_candidate): Change type of parameter
4138         to std::string.
4139         * icf.cc (Icf::find_identical_sections): Change type of local variable
4140         section_name to be std::string.
4141         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4142
4143 2011-01-25  Ian Lance Taylor  <iant@google.com>
4144
4145         * script.cc (script_add_extern): Rewrite to use
4146         add_symbol_reference.
4147
4148 2011-01-25  Doug Kwan  <dougkwan@google.com>
4149
4150         * icf.cc (get_section_contents): Always lock section's object.
4151
4152 2011-01-24  Ian Lance Taylor  <iant@google.com>
4153
4154         * options.h (class General_options): Accept
4155         --no-detect-odr-violations.
4156
4157 2011-01-24  Ian Lance Taylor  <iant@google.com>
4158
4159         * version.cc (version_string): Bump to 1.11.
4160
4161 2011-01-24  Ian Lance Taylor  <iant@google.com>
4162
4163         * plugin.cc (class Plugin_rescan): Define new class.
4164         (Plugin_manager::claim_file): Set any_claimed_.
4165         (Plugin_manager::save_archive): New function.
4166         (Plugin_manager::save_input_group): New function.
4167         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4168         necessary.
4169         (Plugin_manager::new_undefined_symbol): New function.
4170         (Plugin_manager::rescan): New function.
4171         (Plugin_manager::rescannable_defines): New function.
4172         (Plugin_manager::add_input_file): Set any_added_.
4173         * plugin.h (class Plugin_manager): define new fields rescannable_,
4174         undefined_symbols_, any_claimed_, and any_added_.  Declare
4175         Plugin_rescan as friend.  Declare new functions.
4176         (Plugin_manager::Rescannable): Define type.
4177         (Plugin_manager::Rescannable_list): Define type.
4178         (Plugin_manager::Undefined_symbol_list): Define type.
4179         (Plugin_manager::Plugin_manager): Initialize new fields.
4180         * archive.cc (Archive::defines_symbol): New function.
4181         (Add_archive_symbols::run): Pass archive to plugins if any.
4182         * archive.h (class Archive): Declare defines_symbol.
4183         * readsyms.cc (Input_group::~Input_group): New function.
4184         (Finish_group::run): Pass input_group to plugins if any.
4185         * readsyms.h (class Input_group): Declare destructor.
4186         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4187         any.
4188
4189 2011-01-10  Ian Lance Taylor  <iant@google.com>
4190
4191         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4192         section as relro.
4193         (Layout::set_segment_offsets): Reset increase_relro before calling
4194         set_section_addresses a second time.
4195
4196 2011-01-04  Cary Coutant  <ccoutant@google.com>
4197
4198         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4199         sections before NOBITS sections.
4200
4201 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4202
4203         * version.cc (print_version): Update copyright to 2011.
4204
4205 2010-12-23  Cary Coutant  <ccoutant@google.com>
4206
4207         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4208         of OS to this->add.  Add OD parameter to second form of the function.
4209
4210 2010-12-20  Ian Lance Taylor  <iant@google.com>
4211
4212         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4213         second of two consecutive entries with same offset.
4214
4215 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4216
4217         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4218         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4219         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4220         to avoid unneeded links against $(LDADD).
4221         * testsuite/Makefile.in: Regenerate.
4222
4223 2010-12-15  Ian Lance Taylor  <iant@google.com>
4224
4225         PR gold/12324
4226         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4227         for R_X86_64_32 and R_X86_64_PC32.
4228         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4229         ver_matching_def_pic.o.
4230         (ver_matching_def_pic.o): New target.
4231
4232 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4233
4234         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4235         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4236         Move definition before File_read::View member definitions.
4237         (File_read::View::~View): Initialize and hold lock before
4238         updating current_mapped_bytes.
4239
4240 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4241
4242         * dwarf_reader.cc: Remove outdated comment.
4243         * gold-threads.cc: Fix typo in error message.
4244         * archive.cc: Fix typos in comments.
4245         * archive.h: Likewise.
4246         * arm-reloc-property.cc: Likewise.
4247         * arm-reloc-property.h: Likewise.
4248         * arm-reloc.def: Likewise.
4249         * arm.cc: Likewise.
4250         * attributes.h: Likewise.
4251         * cref.cc: Likewise.
4252         * ehframe.cc: Likewise.
4253         * fileread.h: Likewise.
4254         * gold.h: Likewise.
4255         * i386.cc: Likewise.
4256         * icf.cc: Likewise.
4257         * incremental.h: Likewise.
4258         * int_encoding.cc: Likewise.
4259         * layout.h: Likewise.
4260         * main.cc: Likewise.
4261         * merge.h: Likewise.
4262         * object.cc: Likewise.
4263         * object.h: Likewise.
4264         * options.cc: Likewise.
4265         * readsyms.cc: Likewise.
4266         * reduced_debug_output.cc: Likewise.
4267         * reloc.cc: Likewise.
4268         * script-sections.cc: Likewise.
4269         * sparc.cc: Likewise.
4270         * symtab.h: Likewise.
4271         * target-reloc.h: Likewise.
4272         * target.cc: Likewise.
4273         * target.h: Likewise.
4274         * timer.cc: Likewise.
4275         * timer.h: Likewise.
4276         * x86_64.cc: Likewise.
4277
4278 2010-12-09  Cary Coutant  <ccoutant@google.com>
4279
4280         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4281         stack.
4282         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4283         parameter; change all callers.
4284         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4285         * options.h (warn_execstack): New option.
4286
4287 2010-12-07  Doug Kwan  <dougkwan@google.com>
4288
4289         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4290         like function call relocations.
4291
4292 2010-12-07  Ian Lance Taylor  <iant@google.com>
4293
4294         * archive.cc (Archive::get_elf_object_for_member): Permit
4295         punconfigured to be NULL.
4296         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4297         (Archive::include_member): Pass NULL to get_elf_object_for_member
4298         if we searched for the archive and this is the first included
4299         object.
4300
4301 2010-12-01  Ian Lance Taylor  <iant@google.com>
4302
4303         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4304         track_relocs_type_ field.
4305         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4306         Set track_relocs_type_.
4307         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4308         contents when using RELA relocs.
4309         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4310         reloc_map_.
4311         * reloc.cc (Track_relocs::next_addend): New function.
4312         * reloc.h (class Track_relocs): Declare next_addend.
4313
4314 2010-12-01  Ian Lance Taylor  <iant@google.com>
4315
4316         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4317         virtual destructor.
4318
4319 2010-12-01  Ian Lance Taylor  <iant@google.com>
4320
4321         * README: Update compilers known to work and fail.
4322
4323 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4324
4325         * configure.in: For --enable-gold, handle value `default' instead of
4326         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4327         not the default.
4328         * configure: Regenerate.
4329
4330 2010-11-18  Doug Kwan  <dougkwan@google.com>
4331
4332         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4333         and right_alignment to be zero.  Store result alignment only if it is
4334         greater than existing alignment.
4335
4336 2010-11-16  Cary Coutant  <ccoutant@google.com>
4337
4338         PR gold/12220
4339         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4340         Check for ".zdebug_line".
4341
4342 2010-11-16  Doug Kwan  <dougkwan@google.com>
4343             Cary Coutant  <ccoutant@google.com>
4344
4345         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4346         by reference; adjust all callers.
4347         * output.cc (Output_segment::set_section_addresses): Adjust references
4348         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4349         list is empty.
4350         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4351         end at page boundary.
4352
4353 2010-11-16  Cary Coutant  <ccoutant@google.com>
4354
4355         PR gold/12220
4356         * layout.cc (Layout::choose_output_section): Transform names of
4357         compressed sections even when using a script with a SECTIONS clause.
4358         (Layout::output_section_name): Remove code to transform
4359         compressed debug section names.
4360         * output.cc (Output_section::add_input_section): Use uncompressed
4361         section size when tracking input sections.
4362
4363 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4364
4365         * symtab.h (Symbol::NON_PIC_REF): Remove.
4366         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4367         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4368         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4369         (Symbol::use_plt_offset): Take a flags argument and pass it
4370         directly to needs_dynamic_reloc.  Restrict check for undefined
4371         weak symbols to function calls.
4372         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4373         (Target_arm::Scan::global): Use it.
4374         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4375         (Target_arm::Relocate::relocate): Likewise.
4376         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4377         parameter with an r_type parameter.  Use get_reference_flags
4378         to get the flags.
4379         (Target_arm::Relocate::relocate): Update accordingly.
4380         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4381         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4382         (Target_i386::Scan::global): Likewise.
4383         (Target_i386::Relocate::relocate): Likewise.
4384         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4385         parameter with an r_type parameter.  Use get_reference_flags
4386         to get the flags.
4387         (Target_i386::Relocate::relocate): Update accordingly.
4388         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4389         (Target_powerpc::Scan::global): Use it.
4390         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4391         (Target_powerpc::Relocate::relocate): Likewise.
4392         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4393         (Target_sparc::Scan::global): Use it.
4394         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4395         (Target_sparc::Relocate::relocate): Likewise.
4396         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4397         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4398         (Target_x86_64::Scan::global): Likewise.
4399         (Target_x86_64::Relocate::relocate): Likewise.
4400
4401 2010-11-08  Doug Kwan  <dougkwan@google.com>
4402             Cary Coutant  <ccoutant@google.com>
4403
4404         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4405         (Arm_exidx_merge_section::section_contents_): New data member.
4406         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4407         (Arm_input_section::~Arm_input_section): De-allocate memory.
4408         (Arm_input_section::original_contents_): New data member.
4409         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4410         in parameters instead of calling Object::section_contents without
4411         locking.
4412         (Arm_output_section::group_section): New parameter TASK.  Pass it
4413         to callees that need locking objects.
4414         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4415         to lock EXIDX input sections.  Fix a formatting issue.  Call
4416         Arm_exidx_merged_section::build_contents to create merged section
4417         contents.
4418         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4419         to lock object of stub table owner.
4420         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4421         TEXT_SIZE to initialize data member TEXT_SIZE_.
4422         (Arm_exidx_input_section::addralign): Fix typo in comment.
4423         (Arm_exidx_input_section::text_size): New method.
4424         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4425         that require locking objects.  Lock objects before scanning for stubs
4426         and updating local symbols.
4427         (Arm_input_section<big_endian>::init): Copy contents of original
4428         input section.
4429         (Arm_input_section<big_endian>::do_write): Use saved contents of
4430         original input section instead of calling Object::section_contents
4431         without locking.
4432         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4433         size without calling Object::section_size().
4434         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4435         for size.  Allocate a buffer for merged EXIDX entries.
4436         (Arm_exidx_merged_section::build_contents): New method.
4437         (Arm_exidx_merged_section::do_write): Move merge section contents
4438         building code to Arm_exidx_merged_section::build_contetns.  Write
4439         out contetns in buffer instead of building it on the fly.
4440         (Arm_relobj::make_exidx_input_section): Also pass text section size
4441         to Arm_exidx_input_section constructor.
4442         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4443         (Arm_dynobj::do_read_symbols): Fix memory leak.
4444         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4445         * target.h: (class Task): Add forward declaration.
4446         (Target::relax): Add new parameter TASK and pass it to
4447         Target::do_relax().
4448         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4449
4450 2010-11-05  Cary Coutant  <ccoutant@google.com>
4451
4452         PR gold/10708
4453         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4454         object when reading from the file.
4455         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4456         second layout pass.
4457         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4458         when reading section contents.
4459         (get_section_contents): Likewise.
4460         (icf::find_identical_sections): Likewise.
4461         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4462         object when reading from the file.
4463         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4464         the object when doing deferred section layout.
4465
4466 2010-11-03  Nick Clifton  <nickc@redhat.com>
4467
4468         PR gold/12001
4469         * script.h (class Symbol_assignment: name): New member.  Returns
4470         the name of the symbol.
4471         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4472         Returns true if the given symbol name is on the list of
4473         assignments wating to be processed.
4474         * archive.cc (should_incldue_member): If the symbol is undefined,
4475         check to see if it is on the list of symbols pending assignment.
4476
4477 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4478
4479         * script-sections.cc (Script_sections::find_memory_region): Check
4480         for a NULL output section pointer.
4481
4482 2010-10-29  Doug Kwan  <dougkwan@google.com>
4483
4484         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4485         Output_section::add_relaxed_input_section.
4486         * output.cc (Output_section::add_relaxed_input_section): Add new
4487         arguments LAYOUT and NAME.  Set section order index.
4488         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4489         Copy section order index.
4490         * output.h (Output_section::add_relaxed_input_section): Add new
4491         arguments LAYOUT and NAME.
4492
4493 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4494
4495         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4496         NATIVE_OR_CROSS_LINKER.
4497         * testsuite/Makefile.in: Regenerate.
4498
4499 2010-10-20  Doug Kwan  <dougkwan@google.com>
4500
4501         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4502         without SHF_LINK_ORDER flags.
4503         * layout.cc (Layout::choose_output_section): Do not filter
4504         SHF_LINK_ORDER flag in a relocatable link.
4505
4506 2010-10-17  Cary Coutant  <ccoutant@google.com>
4507
4508         * output.h (Output_segment::set_section_addresses): Change function
4509         signature.  Update all callers.
4510         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4511         sections.
4512         (Output_segment::set_section_addresses): Align after last TLS
4513         section.  Add padding before last relro section instead of after.
4514
4515 2010-10-17  Doug Kwan  <dougkwan@google.com>
4516
4517         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4518         GOT output section to be writable.
4519
4520 2010-10-14  Cary Coutant  <ccoutant@google.com>
4521
4522         * debug.h (DEBUG_INCREMENTAL): New flag.
4523         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4524         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4525         mode.
4526         * incremental.cc (report_command_line): Ignore all forms of
4527         --incremental.
4528         * layout.cc (Layout::Layout): Check parameters for incremental link
4529         mode.
4530         * options.cc (General_options::parse_incremental): New function.
4531         (General_options::parse_no_incremental): New function.
4532         (General_options::parse_incremental_full): New function.
4533         (General_options::parse_incremental_update): New function.
4534         (General_options::incremental_mode_): New data member.
4535         (General_options::finalize): Check incremental_mode_.
4536         * options.h (General_options): Update help text for --incremental.
4537         Add --no-incremental, --incremental-full, --incremental-update.
4538         (General_options::Incremental_mode): New enum type.
4539         (General_options::incremental_mode): New function.
4540         (General_options::incremental_mode_): New data member.
4541         * parameters.cc (Parameters::incremental_mode_): New data member.
4542         (Parameters::set_options): Set incremental_mode_.
4543         (Parameters::set_incremental_full): New function.
4544         (Parameters::incremental): New function.
4545         (Parameters::incremental_update): New function.
4546         (set_parameters_incremental_full): New function.
4547         * parameters.h (Parameters::set_incremental_full): New function.
4548         (Parameters::incremental): New function.
4549         (Parameters::incremental_update): New function.
4550         (Parameters::incremental_mode_): New data member.
4551         (set_parameters_incremental_full): New function.
4552         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4553         incremental link mode.
4554         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4555         (Sized_relobj::do_relocate_sections): Likewise.
4556         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4557         option.
4558         * testsuite/Makefile.in: Regenerate.
4559         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4560
4561 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4562
4563         * script-sections.h (class Script_sections): Make
4564         Sections_elements typedef public.
4565         * script-sections.cc (class Sort_output_sections): Add elements_
4566         field.  Add constructor which sets it; change all callers.
4567         (Sort_output_sections::is_before): New function.
4568         (Sort_output_sections::operator()): Call is_before.
4569         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4570         conditional.
4571         * testsuite/script_test_10.sh: New test. Test script section
4572         order.
4573         * testsuite/script_test_10.t: Likewise.
4574         * testsuite/script_test_10.s: Likewise.
4575         * testsuite/Makefile.am: Wrap the cross linker tests and the
4576         common tests into NATIVE_OR_CROSS_LINKER.
4577         (check_SCRIPTS): Add script_test_10.sh.
4578         (check_DATA): Add script_test_10.stdout.
4579         (script_test_10.o, script_test_10): New targets.
4580         (script_test_10.stdout): New target.
4581         * configure, testsuite/Makefile.in: Regenerate.
4582
4583 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4584
4585         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4586         error for the deprecated relocations.
4587         (Target_arm::Scan::global): Likewise.
4588         (Target_arm::Relocate::relocate): Likewise.
4589
4590 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4591
4592         * fileread.cc (Input_file::find_file): Initialize *found_name
4593         and *namep when using the fallback search for case 4.
4594
4595 2010-10-11  Cary Coutant  <ccoutant@google.com>
4596
4597         * options.h (class General_options): Redefine -z lazy as an alias for
4598         the negation of -z now.
4599
4600 2010-10-11  Ian Lance Taylor  <iant@google.com>
4601
4602         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4603         binding.
4604
4605 2010-10-06  Nick Clifton  <nickc@redhat.com>
4606
4607         * script-sections.cc(class Memory_region): Remove
4608         current_lma_offset_ field.  Rename current_vma_offset_ to
4609         current_offset_.  Add last_section_ field.
4610         (Memory_region::get_current_vma_address): Rename to
4611         get_current_address.
4612         (Memory_region::get_current_lma_address): Delete.
4613         (Memory_region::increment_vma_offset): Rename to
4614         increment_offset.
4615         (Memory_region::increment_lma_offset): Delete.
4616         (Memory_region::attributes_compatible): New method.  Returns
4617         true if the provided section is compatible with the region.
4618         (Memory_region::get_last_section): New method.  Returns the last
4619         section to use the region.
4620         (Memory_region::set_last_section): New method.  Stores the last
4621         section to use the region.
4622         (Script_sections::block_in_region): New method.  Returns true if
4623         a block of memory is contained within a region.
4624         (Script_sections::find_memory_region): New method.  Locates a
4625         memory region to be used to set a VMA or LMA address.
4626         (Output_section_definition::set_section_addresses): Add code to
4627         check for addresses set by memory regions.
4628         (Output_segment::set_section_addresses): Remove memory region
4629         walking code.
4630         (Script_sections::create_segment): Add a warning if a header
4631         segment is created outside of any region.
4632         * script-sections.h (class Script_sections): Add prototypes for
4633         find_memory_region and block_in_region methods.
4634         * testsuite/memory_test.s: Use .long instead of .word.
4635         * testsuite/memory_test.t: Add some more output sections.
4636         * testsuite/memory_test.sh: Update expected output.
4637
4638 2010-10-02  Doug Kwan  <dougkwan@google.com>
4639
4640         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4641         defintion to symtab.h
4642         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4643         declaration to defintion.
4644
4645 2010-10-01  Nick Clifton  <nickc@redhat.com>
4646
4647         * expression.cc (eval): Replace dummy argument with NULL.
4648         (eval_maybe_dot): Check for a NULL result section pointer.
4649         (Symbol_expression::value): Likewise.
4650         (Dot_expression::value): Likewise.
4651         (BINARY_EXPRESSION): Likewise.
4652         (Max_expression::value): Likewise.
4653         (Min_expression::value): Likewise.
4654         (Absolute_expression::value): Likewise.
4655         (Addr_expression::value_from_output_section): Likewise.
4656         (Loaddddr_expression::value_from_output_section): Likewise.
4657         (Segment_start_expression::value): Likewise.
4658         * script-sections.cc
4659         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4660         argument with NULL.
4661         (Sections_elememt_dot_assignment::set_section_addresses):
4662         Likewise.
4663         (Output_data_expression::do_write_to_buffer): Likewise.
4664         (Output_section_definition::finalize_symbols): Likewise.
4665         (Output_section_definition::set_section_addresses): Likewise.
4666
4667 2010-09-30  Doug Kwan  <dougkwan@google.com>
4668
4669         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4670
4671 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4672
4673         * target.h (Target::can_icf_inline_merge_sections): New virtual
4674         function.
4675         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4676         virtual function.
4677         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4678         virtual function.
4679         * icf.cc (get_section_contents): Inline merge sections only when
4680         target allows it.
4681
4682 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4683
4684         * configure: Regenerate.
4685
4686 2010-09-17  Ian Lance Taylor  <iant@google.com>
4687
4688         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4689         * testsuite/Makefile.am (memory_test.o): New target.
4690         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4691         memory_test.t.
4692         * testsuite/Makefile.in: Rebuild.
4693
4694 2010-09-17  Doug Kwan  <dougkwan@google.com>
4695
4696         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4697         defintion if relocation uses GOT entries of the symbol.
4698         * testsuite/icf_safe_test.sh: Fix test.
4699         * testsuite/icf_safe_so_test.sh: Fix test.
4700
4701 2010-09-16  Cary Coutant  <ccoutant@google.com>
4702
4703         * script_sections.cc (class Memory_region): Remove "NULL" from
4704         vector initializations.
4705
4706 2010-09-15  Cary Coutant  <ccoutant@google.com>
4707
4708         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4709         Resolve forwarding symbols.
4710
4711 2010-09-15  Doug Kwan  <dougkwan@google.com>
4712
4713         * gold/testsuite/script_test_3.t: Add ARM special sections.
4714         * gold/testsuite/script_test_4.t: Same.
4715         * gold/testsuite/script_test_5.t: Same.
4716         * gold/testsuite/script_test_6.t: Same.
4717         * gold/testsuite/script_test_7.t: Same.
4718         * gold/testsuite/script_test_7.t: Same.
4719         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4720
4721 2010-09-14  Cary Coutant  <ccoutant@google.com>
4722
4723         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4724         (Target_x86_64::Relocate::relocate_tls): Replace check for
4725         saw_tls_block_reloc_ with test for executable section.
4726
4727 2010-09-12  Cary Coutant  <ccoutant@google.com>
4728
4729         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4730         position-independent executables to shared libraries need dynamic
4731         relocations.
4732         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4733         position-independent executables.
4734         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4735         * testsuite/Makefile.in: Regenerate.
4736
4737 2010-09-10  Nick Clifton  <nickc@redhat.com>
4738
4739         PR gold/11997
4740         * testsuite/memory_test.t: Discard any sections that are not
4741         needed.
4742
4743 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4744
4745         PR gold/11996
4746         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4747         "This::" to work around a bug in gcc 4.2.
4748
4749         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4750
4751 2010-09-09  Rafael Espindola  <espindola@google.com>
4752
4753         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4754         sections with different PF_X flags in the same segment.
4755         (Layout::find_first_load_seg): Search all segments to find the first
4756         one.
4757         * options.h (rosegment): New.
4758
4759 2010-09-08  Rafael Espindola  <espindola@google.com>
4760
4761         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4762
4763 2010-09-08  Doug Kwan  <dougkwan@google.com>
4764
4765         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4766         (Arm_relobj::do_relocate_sections): Add new parameter for output
4767         file to match the parent.
4768         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4769         of local symbols instead of input values.  Update code to track
4770         changes in gold::relocate_section.
4771         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4772         (Sized_relobj::compute_final_local_value_internal): New methods.
4773         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4774         body into private version of Sized_relobj::compute_final_local_value.
4775         Call the inline method.
4776         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4777         merged symbol value if there is one.
4778         (Symbol_value::has_output_value): New method defintiion.
4779         (Sized_relobj::Compute_final_local_value_status): New enum type.
4780         (Sized_relobj::compute_final_local_value): New methods.
4781         (Sized_relobj::compute_final_local_value_internal): New methods.
4782         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4783         and arm_cortex_a8.sh.
4784         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4785         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4786         New tests.
4787         * Makefile.in: Regenerate.
4788         * testsuite/arm_bl_out_of_range.s: Update test.
4789         * testsuite/thumb_bl_out_of_range.s: Ditto.
4790         * testsuite/thumb_blx_out_of_range.s: Ditto.
4791         * testsuite/arm_branch_out_of_range.sh: New file.
4792         * testsuite/arm_cortex_a8.sh: Ditto.
4793         * testsuite/arm_cortex_a8_b.s: Ditto.
4794         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4795         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4796         * testsuite/arm_cortex_a8_bl.s: Ditto.
4797         * testsuite/arm_cortex_a8_blx.s: Ditto.
4798         * testsuite/arm_cortex_a8_local.s: Ditto.
4799         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4800         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4801
4802 2010-09-08  Rafael Espindola  <espindola@google.com>
4803
4804         * Makefile.am (memory_test.stdout): Run readelf with -W.
4805         * Makefile.in: Regenerate.
4806         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4807         64 bit output.
4808
4809 2010-09-08  Rafael Espindola  <espindola@google.com>
4810
4811         * script-sections.cc (Script_sections::add_memory_region): Convert
4812         field precision to int.
4813         * script.cc (script_set_section_region, script_set_section_region):
4814         Convert field precision to int.
4815
4816 2010-09-08  Rafael Espindola  <espindola@google.com>
4817
4818         * arm.cc (do_finalize_sections): Create the __exidx_start and
4819         __exdix_end symbols even when the section is missing.
4820
4821 2010-09-08  Nick Clifton  <nickc@redhat.com>
4822
4823         * README: Remove claim that MEMORY is not supported.
4824         * expression.cc (script_exp_function_origin)
4825         (script_exp_function_length): Move from here to ...
4826         * script.cc: ... here.
4827         (script_set_section_region, script_add_memory)
4828         (script_parse_memory_attr, script_include_directive): New
4829         functions.
4830         * script-sections.cc
4831         (class Memory_region): New class.
4832         (class Output_section_definition): Add set_memory_region,
4833         set_section_vma, set_section_lma and get_section_name methods.
4834         (class Script_Sections): Add add_memory_region,
4835         find_memory_region, find_memory_region_origin,
4836         find_memory_region_length and set_memory_region methods.
4837         Have set_section_addresses method walk the list of set memory
4838         regions.
4839         Extend the print methos to display memory regions.
4840         * script-sections.h: Add prototypes for new methods.
4841         Add enum for MEMORY region attributes.
4842         * yyscript.y: Add support for parsing MEMORY regions.
4843         * script-c.h: Add prototypes for new functions.
4844         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4845         * testsuite/Makefile.in: Regenerate.
4846         * testsuite/memory_test.sh: New script.
4847         * testsuite/memory_test.s: New assembler source file.
4848         * testsuite/memory_test.t: New linker script.
4849
4850 2010-08-27  Doug Kwan  <dougkwan@google.com>
4851
4852         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4853         reference override an existing dynamic weak reference.
4854         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4855         * testsuite/Makefile.in: Regenerate.
4856         * testsuite/dyn_weak_ref.sh: New file.
4857         * testsuite/dyn_weak_ref_1.c: Ditto.
4858         * testsuite/dyn_weak_ref_2.c: Ditto.
4859
4860 2010-08-27  Ian Lance Taylor  <iant@google.com>
4861
4862         * incremental.h (class Incremental_input_entry): Add virtual
4863         destructor.
4864
4865 2010-08-27  Ian Lance Taylor  <iant@google.com>
4866
4867         * testsuite/start_lib_test_3.c: Mark t3 as used.
4868
4869 2010-08-27  Nick Clifton  <nickc@redhat.com>
4870
4871         * options.cc (version_script): Fix small typo in previous
4872         whitespace tidyup.
4873
4874 2010-08-25  Nick Clifton  <nickc@redhat.com>
4875
4876         * archive.cc: Formatting fixes: Remove whitespace between
4877         typename and following asterisk.  Remove whitespace between
4878         function name and opening parenthesis.
4879         * archive.h: Likewise.
4880         * arm.cc: Likewise.
4881         * attributes.cc: Likewise.
4882         * attributes.h: Likewise.
4883         * common.cc: Likewise.
4884         * copy-relocs.cc: Likewise.
4885         * dirsearch.h: Likewise.
4886         * dynobj.cc: Likewise.
4887         * ehframe.cc: Likewise.
4888         * ehframe.h: Likewise.
4889         * expression.cc: Likewise.
4890         * fileread.cc: Likewise.
4891         * fileread.h: Likewise.
4892         * gc.h: Likewise.
4893         * gold-threads.cc: Likewise.
4894         * gold.cc: Likewise.
4895         * i386.cc: Likewise.
4896         * icf.h: Likewise.
4897         * incremental-dump.cc: Likewise.
4898         * incremental.cc: Likewise.
4899         * layout.cc: Likewise.
4900         * layout.h: Likewise.
4901         * main.cc: Likewise.
4902         * merge.cc: Likewise.
4903         * merge.h: Likewise.
4904         * object.cc: Likewise.
4905         * object.h: Likewise.
4906         * options.cc: Likewise.
4907         * options.h: Likewise.
4908         * output.cc: Likewise.
4909         * output.h: Likewise.
4910         * plugin.cc: Likewise.
4911         * plugin.h: Likewise.
4912         * powerpc.cc: Likewise.
4913         * reloc.cc: Likewise.
4914         * script-c.h: Likewise.
4915         * script-sections.cc: Likewise.
4916         * script.cc: Likewise.
4917         * stringpool.cc: Likewise.
4918         * symtab.cc: Likewise.
4919         * symtab.h: Likewise.
4920         * target.cc: Likewise.
4921         * timer.cc: Likewise.
4922         * timer.h: Likewise.
4923         * version.cc: Likewise.
4924         * x86_64.cc: Likewise.
4925
4926 2010-08-24  Nick Clifton  <nickc@redhat.com>
4927
4928         PR 11899
4929         * layout.cc (segment_precedes): Sort segments by their physical
4930         addresses, if they have been set.
4931
4932 2010-08-23  Cary Coutant  <ccoutant@google.com>
4933
4934         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4935         symbols data.
4936         (Lib_group::include_member): Unlock object after deleting its
4937         symbols data.
4938         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4939         the bug fixed here.
4940
4941 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4942             Cary Coutant  <ccoutant@google.com>
4943
4944         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4945         constructor, and set_blocker.
4946         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4947         readsyms_blocker_.
4948         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4949         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4950         * testsuite/Makefile.am (start_lib_test): New test case.
4951         * testsuite/Makefile.in: Regenerate.
4952         * testsuite/start_lib_test_main.c: New file.
4953         * testsuite/start_lib_test_1.c: New file.
4954         * testsuite/start_lib_test_2.c: New file.
4955         * testsuite/start_lib_test_3.c: New file.
4956
4957 2010-08-19  Ian Lance Taylor  <iant@google.com>
4958
4959         * Makefile.in: Rebuild with automake 1.11.1.
4960         * aclocal.m4: Likewise.
4961         * testsuite/Makefile.in: Likewise.
4962
4963 2010-08-19  Ian Lance Taylor  <iant@google.com>
4964
4965         PR 10893
4966         * i386.cc (class Output_data_plt_i386): Update declarations.
4967         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4968         local_ifuncs_ fields.
4969         (Target_i386::do_plt_section_for_global): New function.
4970         (Target_i386::do_plt_section_for_local): New function.
4971         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4972         parameter; change all callers.  Initialize global_ifuncs_ and
4973         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4974         __rel_iplt_end.
4975         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4976         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4977         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4978         symbols.
4979         (Target_i386::make_plt_section): New function, broken out of
4980         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4981         (Target_i386::make_plt_entry): Call make_plt_section.
4982         (Target_i386::make_local_ifunc_plt_entry): New function.
4983         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4984         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4985         R_386_IRELATIVE to switch.
4986         (Target_i386::Scan::global): Likewise.
4987         (Target_i386::Relocate::relocate): Likewise.
4988         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4989         switch.
4990         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4991         (Target_x86_64::do_plt_section_for_global): New function.
4992         (Target_x86_64::do_plt_section_for_local): New function.
4993         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4994         parameter; change all callers.  If doing a static link define
4995         __rela_iplt_start and __rela_iplt_end.
4996         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4997         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4998         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4999         to point to .plt.
5000         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5001         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5002         switch.
5003         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5004         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5005         R_X86_64_IRELATIVE to switch.
5006         (Target_x86_64::Scan::global): Likewise.
5007         (Target_x86_64::Relocate::relocate): Likewise.
5008         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5009         switch.
5010         * target.h (class Target): Add plt_section_for_global and
5011         plt_section_for_local functions.  Add do_plt_section_for_global
5012         and do_plt_section_for_local virtual functions.
5013         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5014         clarifying comments.
5015         (Symbol::use_plt_offset): Handle IFUNC symbol.
5016         * object.cc (Sized_relobj::Sized_relobj): Initialize
5017         local_plt_offsets_.
5018         (Sized_relobj::local_has_plt_offset): New function.
5019         (Sized_relobj::local_plt_offset): New function.
5020         (Sized_relobj::set_local_plt_offset): New function.
5021         (Sized_relobj::do_count): Handle IFUNC symbol.
5022         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5023         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5024         is_ifunc_symbol functions.
5025         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5026         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5027         local_plt_offsets_ field.
5028         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5029         * output.h (class Output_section_data): Add non-const
5030         output_section function.
5031         (class Output_data_got): Update declarations.
5032         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5033         Add use_plt_offset parameter to global and local constructors.
5034         Change all callers.  Change local_sym_index_ field to 31 bits.
5035         Change GSYM_CODE and CONSTANT_CODE accordingly.
5036         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5037         doing a static link don't set sh_link field.
5038         (Output_data_got::Got_entry::write): Use PLT offset if
5039         appropriate.
5040         (Output_data_got::add_global_plt): New function.
5041         (Output_data_got::add_local_plt): New function.
5042         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5043         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5044         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5045         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5046         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5047         IFUNC conditional.
5048         * testsuite/ifunc-sel.h: New file.
5049         * testsuite/ifuncmain1.c: New file.
5050         * testsuite/ifuncmain1vis.c: New file.
5051         * testsuite/ifuncmod1.c: New file.
5052         * testsuite/ifuncdep2.c: New file.
5053         * testsuite/ifuncmain2.c: New file.
5054         * testsuite/ifuncmain3.c: New file.
5055         * testsuite/ifuncmod3.c: New file.
5056         * testsuite/ifuncmain4.c: New file.
5057         * testsuite/ifuncmain5.c: New file.
5058         * testsuite/ifuncmod5.c: New file.
5059         * testsuite/ifuncmain6pie.c: New file.
5060         * testsuite/ifuncmod6.c: New file.
5061         * testsuite/ifuncmain7.c: New file.
5062         * configure, testsuite/Makefile.in: Rebuild.
5063
5064 2010-08-18  Ian Lance Taylor  <iant@google.com>
5065
5066         * incremental.cc
5067         (Output_section_incremental_inputs::write_input_files): Add cast
5068         to avoid signed/unsigned comparison warning.
5069         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5070
5071 2010-08-12  Cary Coutant  <ccoutant@google.com>
5072
5073         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5074
5075 2010-08-13  Ian Lance Taylor  <iant@google.com>
5076
5077         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5078
5079 2010-08-12  Cary Coutant  <ccoutant@google.com>
5080             Doug Kwan  <dougkwan@google.com>
5081
5082         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5083         defintion overrides non-weak undef, remember that the original undef
5084         is not weak.
5085         * symtab.cc (Symbol_table::sized_write_global): For undef without
5086         an original weak binding, set binding to global in output.
5087         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5088         * testsuite/Makefile.in: Regenerate.
5089         * testsuite/strong_ref_weak_def.sh: New file.
5090         * testsuite/strong_ref_weak_def_1.c: Ditto.
5091         * testsuite/strong_ref_weak_def_2.c: Ditto.
5092
5093 2010-08-12  Cary Coutant  <ccoutant@google.com>
5094
5095         * testsuite/incremental_test.sh: Rewrite.
5096         * testsuite/incremental_test_1.c: Rewrite.
5097         * testsuite/incremental_test_2.c: Rewrite.
5098
5099 2010-08-12  Cary Coutant  <ccoutant@google.com>
5100
5101         * arm.cc (Target_arm::got_size): Add const.
5102         (Target_arm::got_entry_count): New function.
5103         (Target_arm::plt_entry_count): New function.
5104         (Target_arm::first_plt_entry_offset): New function.
5105         (Target_arm::plt_entry_size): New function.
5106         (Output_data_plt_arm::entry_count): New function.
5107         (Output_data_plt_arm::first_plt_entry_offset): New function.
5108         (Output_data_plt_arm::get_plt_entry_size): New function.
5109         * i386.cc (Target_i386::got_size): Add const.
5110         (Target_i386::got_entry_count): New function.
5111         (Target_i386::plt_entry_count): New function.
5112         (Target_i386::first_plt_entry_offset): New function.
5113         (Target_i386::plt_entry_size): New function.
5114         (Output_data_plt_i386::entry_count): New function.
5115         (Output_data_plt_i386::first_plt_entry_offset): New function.
5116         (Output_data_plt_i386::get_plt_entry_size): New function.
5117         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5118         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5119         * incremental.cc: Include target.h.
5120         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5121         parameter.  Adjust all callers.  Find incremental_got_plt section.
5122         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5123         section.
5124         (Output_section_incremental_inputs::set_final_data_size): Calculate
5125         size of incremental_got_plt section.
5126         (Output_section_incremental_inputs::do_write): Write the
5127         incremental_got_plt section.
5128         (Got_plt_view_info): New struct.
5129         (Local_got_offset_visitor): New class.
5130         (Global_got_offset_visitor): New class.
5131         (Global_symbol_visitor_got_plt): New class.
5132         (Output_section_incremental_inputs::write_got_plt): New function.
5133         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5134         Add parameter.  Adjust all callers.
5135         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5136         (Incremental_inputs::got_plt_section): New function.
5137         (Incremental_inputs::got_plt_section_): New data member.
5138         (Incremental_got_plt_reader): New class.
5139         * layout.cc (Layout::create_incremental_info_sections): Add the
5140         incremental_got_plt section.
5141         * object.h (Got_offset_list::get_list): New function.
5142         (Got offset_list::for_all_got_offsets): New function.
5143         (Sized_relobj::local_got_offset_list): New function.
5144         * powerpc.cc (Target_powerpc::got_size): Add const.
5145         (Target_powerpc::got_entry_count): New function.
5146         (Target_powerpc::plt_entry_count): New function.
5147         (Target_powerpc::first_plt_entry_offset): New function.
5148         (Target_powerpc::plt_entry_size): New function.
5149         (Output_data_plt_powerpc::entry_count): New function.
5150         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5151         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5152         * sparc.cc (Target_sparc::got_size): Add const.
5153         (Target_sparc::got_entry_count): New function.
5154         (Target_sparc::plt_entry_count): New function.
5155         (Target_sparc::first_plt_entry_offset): New function.
5156         (Target_sparc::plt_entry_size): New function.
5157         (Output_data_plt_sparc::entry_count): New function.
5158         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5159         (Output_data_plt_sparc::get_plt_entry_size): New function.
5160         * symtab.h (Symbol::got_offset_list): New function.
5161         (Symbol_table::for_all_symbols): New function.
5162         * target.h (Sized_target::got_entry_count): New function.
5163         (Sized_target::plt_entry_count): New function.
5164         (Sized_target::plt_entry_size): New function.
5165         * x86_64.cc (Target_x86_64::got_size): Add const.
5166         (Target_x86_64::got_entry_count): New function.
5167         (Target_x86_64::plt_entry_count): New function.
5168         (Target_x86_64::first_plt_entry_offset): New function.
5169         (Target_x86_64::plt_entry_size): New function.
5170         (Output_data_plt_x86_64::entry_count): New function.
5171         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5172         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5173
5174 2010-08-12  Cary Coutant  <ccoutant@google.com>
5175
5176         * archive.cc: Include incremental.h.
5177         (Archive::Archive): Initialize incremental_info_.
5178         (Archive::include_member): Record archive members in incremental info.
5179         (Add_archive_symbols::run): Record begin and end of an archive in
5180         incremental info.
5181         (Lib_group::include_member): Record objects in incremental info.
5182         * archive.h (Incremental_archive_entry): Forward declaration.
5183         (Archive::set_incremental_info): New member function.
5184         (Archive::incremental_info): New member function.
5185         (Archive::Unused_symbol_iterator): New class.
5186         (Archive::unused_symbols_begin): New member function.
5187         (Archive::unused_symbols_end): New member function.
5188         (Archive::incremental_info_): New data member.
5189         * incremental-dump.cc (find_input_containing_global): New function.
5190         (dump_incremental_inputs): Dump new incremental info sections.
5191         * incremental.cc: Include symtab.h.
5192         (Output_section_incremental_inputs): New class.
5193         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5194         new incremental info sections.
5195         (Sized_incremental_binary::do_check_inputs): Likewise.
5196         (Incremental_inputs::report_archive): Remove.
5197         (Incremental_inputs::report_archive_begin): New function.
5198         (Incremental_inputs::report_archive_end): New function.
5199         (Incremental_inputs::report_object): New function.
5200         (Incremental_inputs::finalize_inputs): Remove.
5201         (Incremental_inputs::report_input_section): New function.
5202         (Incremental_inputs::report_script): Rewrite.
5203         (Incremental_inputs::finalize): Do nothing but finalize string table.
5204         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5205         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5206         (Incremental_inputs::create_data_sections): New function.
5207         (Incremental_inputs::relocs_entsize): New function.
5208         (Output_section_incremental_inputs::set_final_data_size): New function.
5209         (Output_section_incremental_inputs::do_write): New function.
5210         (Output_section_incremental_inputs::write_header): New function.
5211         (Output_section_incremental_inputs::write_input_files): New function.
5212         (Output_section_incremental_inputs::write_info_blocks): New function.
5213         (Output_section_incremental_inputs::write_symtab): New function.
5214         * incremental.h (Incremental_script_entry): Forward declaration.
5215         (Incremental_object_entry): Forward declaration.
5216         (Incremental_archive_entry): Forward declaration.
5217         (Incremental_inputs): Forward declaration.
5218         (Incremental_inputs_header_data): Remove.
5219         (Incremental_inputs_header): Remove.
5220         (Incremental_inputs_header_write): Remove.
5221         (Incremental_inputs_entry_data): Remove.
5222         (Incremental_inputs_entry): Remove.
5223         (Incremental_inputs_entry_write): Remove.
5224         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5225         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5226         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5227         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5228         Likewise.
5229         (Incremental_input_entry): New class.
5230         (Incremental_script_entry): New class.
5231         (Incremental_object_entry): New class.
5232         (Incremental_archive_entry): New class.
5233         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5234         (Incremental_inputs::report_inputs): Remove.
5235         (Incremental_inputs::report_archive): Remove.
5236         (Incremental_inputs::report_archive_begin): New function.
5237         (Incremental_inputs::report_archive_end): New function.
5238         (Incremental_inputs::report_object): Change prototype.
5239         (Incremental_inputs::report_input_section): New function.
5240         (Incremental_inputs::report_script): Change prototype.
5241         (Incremental_inputs::get_reloc_count): New function.
5242         (Incremental_inputs::set_reloc_count): New function.
5243         (Incremental_inputs::create_data_sections): New function.
5244         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5245         (Incremental_inputs::inputs_section): New function.
5246         (Incremental_inputs::symtab_section): New function.
5247         (Incremental_inputs::relocs_section): New function.
5248         (Incremental_inputs::get_stringpool): Add const.
5249         (Incremental_inputs::command_line): Add const.
5250         (Incremental_inputs::inputs): Remove.
5251         (Incremental_inputs::command_line_key): New function.
5252         (Incremental_inputs::input_file_count): New function.
5253         (Incremental_inputs::input_files): New function.
5254         (Incremental_inputs::relocs_entsize): New function.
5255         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5256         (Incremental_inputs::finalize_inputs): Remove.
5257         (Incremental_inputs::Input_info): Remove.
5258         (Incremental_inputs::lock_): Remove.
5259         (Incremental_inputs::inputs_): Change type.
5260         (Incremental_inputs::inputs_map_): Remove.
5261         (Incremental_inputs::current_object_entry_): New data member.
5262         (Incremental_inputs::inputs_section_): New data member.
5263         (Incremental_inputs::symtab_section_): New data member.
5264         (Incremental_inputs::relocs_section_): New data member.
5265         (Incremental_inputs::reloc_count_): New data member.
5266         (Incremental_inputs_reader): New class.
5267         (Incremental_symtab_reader): New class.
5268         (Incremental_relocs_reader): New class.
5269         * layout.cc (Layout::finalize): Move finalization of incremental info
5270         and creation of incremental info sections to follow finalization of
5271         symbol table.  Set offsets for postprocessing sections.
5272         (Layout::create_incremental_info_sections): Call
5273         Incremental_inputs::create_data_sections.  Add incremental symtab
5274         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5275         sections to layout after input sections.
5276         * layout.h (struct Timespec): Forward declaration.
5277         (Layout::incremental_inputs): Add const.
5278         (Layout::create_incremental_info_sections): Add parameter.
5279         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5280         * object.cc: Include incremental.h.
5281         (Relobj::finalize_incremental_relocs): New function.
5282         (Sized_relobj::do_layout): Record input sections in incremental info.
5283         * object.h (Object::output_section): New function.
5284         (Object::output_section_offset): Moved from Relobj.
5285         (Object::get_incremental_reloc_base): New function.
5286         (Object::get_incremental_reloc_count): New function.
5287         (Object::do_output_section): New function.
5288         (Object::do_output_section_offset): Moved from Relobj.
5289         (Object::do_get_incremental_reloc_base): New function.
5290         (Object::do_get_incremental_reloc_count): New function.
5291         (Object::Object): Initialize new data members.
5292         (Relobj::output_section): Renamed do_output_section and moved to
5293         protected.
5294         (Relobj::output_section_offset): Moved to Object.
5295         (Relobj::do_get_incremental_reloc_base): New function.
5296         (Relobj::do_get_incremental_reloc_count): New function.
5297         (Relobj::allocate_incremental_reloc_counts): New function.
5298         (Relobj::count_incremental_reloc): New function.
5299         (Relobj::finalize_incremental_relocs): New function.
5300         (Relobj::next_incremental_reloc_index): New function.
5301         (Relobj::reloc_counts_): New data member.
5302         (Relobj::reloc_bases_): New data member.
5303         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5304         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5305         (Sized_relobj::incremental_relocs_scan): New function.
5306         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5307         (Sized_relobj::incremental_relocs_write): New function.
5308         (Sized_relobj::incremental_relocs_write_reltype): New function.
5309         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5310         incremental link.
5311         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5312         archives and object files elsewhere.
5313         (Add_symbols::run): Report object files here.
5314         (Finish_group::run): Report end of archive at end of group.
5315         * reloc.cc: Include layout.h, incremental.h.
5316         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5317         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5318         (Sized_relobj::incremental_relocs_scan): New function.
5319         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5320         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5321         (Sized_relobj::incremental_relocs_write): New function.
5322         (Sized_relobj::incremental_relocs_write_reltype): New function.
5323         * script.cc (read_input_script): Rewrite test for incremental link.
5324         Change call to Incremental_inputs::report_script.
5325         * symtab.h (Symbol_table::first_global_index): New function.
5326         (Symbol_table::output_count): New function.
5327
5328 2010-08-12  Doug Kwan  <dougkwan@google.com>
5329
5330         * arm.cc (Target_arm::merge_object_attributes): Check command line
5331         options --no-wchar-size-warning and --no-enum-size-warning.
5332         * options.h (General_options): Add ld-compatible options
5333         --no-enum-size-warning and --no-wchar-size-warning.
5334
5335 2010-08-04  Ian Lance Taylor  <iant@google.com>
5336
5337         * x86_64.cc (Target_x86_64::Scan::local): Use
5338         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5339         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5340         (Target_x86_64::Scan::global): Likewise.
5341         (Target_x86_64::Relocate::relocate): Likewise.
5342         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5343         Likewise.
5344
5345 2010-08-03  Cary Coutant  <ccoutant@google.com>
5346
5347         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5348         to reserve space in merged_strings vector. Keep total input size
5349         for stats.
5350         (Output_merge_string::do_print_merge_stats): Print total input size.
5351         * merge.h (Output_merge_string): Add input_size_ field.
5352         * stringpool.cc (Stringpool_template::string_length): Move
5353         implementations out of Stringpool_template class and place in
5354         stringpool.h.
5355         * stringpool.h (string_length): Move out of Stringpool_template.
5356
5357 2010-08-03  Ian Lance Taylor  <iant@google.com>
5358
5359         PR 11712
5360         * layout.cc (relaxation_loop_body): If address of load segment is
5361         set, adjust address to include headers if possible.
5362
5363 2010-08-03  Ian Lance Taylor  <iant@google.com>
5364
5365         * version.cc (version_string): Bump to 1.10.
5366
5367 2010-08-03  Ian Lance Taylor  <iant@google.com>
5368
5369         PR 11805
5370         * layout.h (enum Output_section_order): Define.
5371         (class Layout): Update declarations.
5372         * layout.cc (Layout::get_output_section): Add order parameter.
5373         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5374         is_first_non_relro parameters.  Change all callers.
5375         (Layout::choose_output_section): Likewise.
5376         (Layout::add_output_section_data): Likewise.
5377         (Layout::make_output_section): Likewise.  Set order.
5378         (Layout::default_section_order): New function.
5379         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5380         * output.cc (Output_section::Output_section): Initialize order_.
5381         Don't initialize deleted fields.
5382         (Output_segment::Output_segment): Don't initialize deleted
5383         fields.
5384         (Output_segment::add_output_section_to_load): New function
5385         replacing add_output_section.  Change all callers to call this or
5386         add_output_section_to_nonload.
5387         (Output_segment::add_output_section_to_nonload): New function.
5388         (Output_segment::remove_output_section): Rewrite.
5389         (Output_segment::add_initial_output_data): Likewise.
5390         (Output_segment::has_any_data_sections): Likewise.
5391         (Output_segment::is_first_section_relro): Likewise.
5392         (Output_segment::maximum_alignment): Likewise.
5393         (Output_segment::has_dynamic_reloc): New function replacing
5394         dynamic_reloc_count.  Change all callers.
5395         (Output_segment::has_dynamic_reloc_list): New function replacing
5396         dynamic_reloc_count_list.  Change all callers.
5397         (Output_segment::set_section_addresses): Rewrite.
5398         (Output_segment::set_offset): Rewrite.
5399         (Output_segment::find_first_and_last_list): Remove.
5400         (Output_segment::set_tls_offsets): Rewrite.
5401         (Output_segment::first_section_load_address): Likewise.
5402         (Output_segment::output_section_count): Likewise.
5403         (Output_segment::section_with_lowest_load_address): Likewise.
5404         (Output_segment::write_section_headers): Likewise.
5405         (Output_segment::print_sections_to_map): Likewise.
5406         * output.h (class Output_data): Remove dynamic_reloc_count_
5407         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5408         (Output_data::add_dynamic_reloc): Rewrite.
5409         (Output_data::has_dynamic_reloc): New function.
5410         (Output_data::dynamic_reloc_count): Remove.
5411         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5412         is_last_relro_, is_first_non_relro_, is_interp_,
5413         is_dynamic_linker_section_ fields.  Add order and set_order
5414         functions.  Remove is_relro_local, set_is_relro_local,
5415         is_last_relro, set_is_last_relro, is_first_non_relro,
5416         set_is_first_non_relro functions, is_interp, set_is_interp,
5417         is_dynamic_linker_section, and set_is_dynamic_linker_section
5418         functions.
5419         (class Output_segment): Change Output_data_list from std::list to
5420         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5421         output_bss_ fields.  Update declarations.
5422
5423 2010-08-02  Ian Lance Taylor  <iant@google.com>
5424
5425         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5426         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5427         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5428
5429 2010-08-02  Ian Lance Taylor  <iant@google.com>
5430
5431         PR 11855
5432         * script.cc (Script_options::Script_options): Initialize
5433         symbol_definitions_ and symbol_references_.
5434         (Script_options::add_symbol_assignment): Update
5435         symbol_definitions_ and symbol_references_.
5436         (Script_options::add_symbol_reference): New function.
5437         (script_symbol): New function.
5438         * script.h (class Script_options): Add symbol_definitions_ and
5439         symbol_references_ fields.
5440         (Script_options::referenced_const_iterator): New type.
5441         (Script_options::referenced_begin): New function.
5442         (Script_options::referenced_end): New function.
5443         (Script_options::is_referenced): New function.
5444         (Script_options::any_unreferenced): New function.
5445         * script-c.h (script_symbol): Declare.
5446         * yyscript.y (exp): Call script_symbol.
5447         * symtab.cc: Include "script.h".
5448         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5449         Change all callers.  Check symbols referenced by scripts.
5450         (Symbol_table::add_undefined_symbols_from_command_line): Add
5451         layout parameter.  Change all callers.
5452         (Symbol_table::do_add_undefined_symbols_from_command_line):
5453         Likewise.  Break out loop body.  Check symbols referenced by
5454         scripts.
5455         (Symbol_table::add_undefined_symbol_from_command_line): New
5456         function broken out of
5457         do_add_undefined_symbols_from_command_line.
5458         * symtab.h (class Symbol_table): Update declarations.
5459         * archive.cc: Include "layout.h".
5460         (Archive::should_include_member): Add layout parameter.  Change
5461         all callers.  Check for symbol mentioned in expression.
5462         * archive.h (class Archive): Update declaration.
5463         * object.cc (Sized_relobj::do_should_include_member): Add layout
5464         parameter.
5465         * object.h (Object::should_include_member): Add layout parameter.
5466         Change all callers.
5467         (Object::do_should_include_member): Add layout parameter.
5468         (class Sized_relobj): Update declaration.
5469         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5470         parameter.
5471         * dynobj.h (class Sized_dynobj): Update declaration.
5472         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5473         layout parameter.
5474         * plugin.h (class Sized_pluginobj): Update declaration.
5475
5476 2010-08-02  Ian Lance Taylor  <iant@google.com>
5477
5478         PR 11866
5479         * output.cc (Output_segment::set_offset): Search for the first and
5480         last sections rather than assuming that the list is in order.
5481         (Output_segment::find_first_and_last_list): New function.
5482         * output.h (class Output_segment): Update declarations.
5483         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5484         (relro_strip_test_SOURCES): New variable.
5485         (relro_strip_test_DEPENDENCIES): New variable.
5486         (relro_strip_test_LDFLAGS): New variable.
5487         (relro_strip_test_LDADD): New variable.
5488         (relro_strip_test.so): New target.
5489
5490 2010-08-02  Ian Lance Taylor  <iant@google.com>
5491
5492         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5493         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5494         (Target_i386::got_tlsdesc_section): New function.
5495         (Target_i386::got_section): Create space for GOT entries for
5496         TLSDESC relocations.
5497         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5498         R_386_TLS_GOTDESC.
5499         (Target_i386::Scan::global): Likewise.
5500         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5501         using TLSDESC GOT.
5502         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5503         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5504         (Target_x86_64::got_tlsdesc_section): New function.
5505         (Target_x86_64::got_section): Create space for GOT entries for
5506         TLSDESC relocations.
5507         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5508         R_386_TLS_GOTDESC.
5509         (Target_x86_64::Scan::global): Likewise.
5510         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5511         using TLSDESC GOT.
5512
5513 2010-08-02  Ian Lance Taylor  <iant@google.com>
5514
5515         * testsuite/final_layout.sh: Use dc to convert from hex to
5516         decimal.
5517
5518 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5519
5520         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5521         paramter to the call to gold::gc_process_relocs.
5522         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5523         paramter to the call to gold::gc_process_relocs.
5524         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5525         parameter to the call to gold::gc_process_relocs.
5526         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5527         template parameter to the call to gold::gc_process_relocs.
5528         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5529         paramter to the call to gold::gc_process_relocs.
5530         * gc.h (get_embedded_addend_size): New function.
5531         (gc_process_relocs): Save the size of the reloc for use by ICF.
5532         * icf.cc (get_section_contents): Get the addend from the text section
5533         for SHT_REL relocation sections.
5534         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5535         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5536         * int_encoding.h (read_from_pointer): New overloaded function.
5537         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5538         * testsuite/icf_sht_rel_addend_test.sh: New file.
5539         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5540         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5541
5542 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5543
5544         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5545         * Makefile.in: Regenerate.
5546         * testsuite/Makefile.in: Regenerate.
5547
5548 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5549
5550         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5551         * gold/testsuite/debug_msg.cc: Likewise.
5552         * gold/testsuite/odr_violation1.cc
5553         * gold/testsuite/odr_violation2.cc
5554
5555 2010-07-21  Cary Coutant  <ccoutant@google.com>
5556
5557         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5558         string, and length fields.
5559         (Output_merge_string::Merged_strings_list): New type.
5560         (Output_merge_string::Merged_strings_lists): New typedef.
5561         (Output_merge_string): Replace merged_strings_ with
5562         merged_strings_lists_.
5563         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5564         Merged_strings_list per input object and section.  Don't store pointer
5565         to the string.  Don't store length with each merged string entry.
5566         (Output_merge_string::finalize_merged_data): Loop over list of merged
5567         strings lists.  Recompute length of each merged string.
5568
5569 2010-07-15  Cary Coutant  <ccoutant@google.com>
5570
5571         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5572         here.
5573
5574 2010-07-14  Ian Lance Taylor  <iant@google.com>
5575
5576         * descriptors.cc (Descriptors::open): Report correct name in error
5577         message.
5578
5579 2010-07-13  Doug Kwan  <dougkwan@google.com>
5580
5581         * arm.cc (Arm_input_section::Arm_input_section): For a
5582         SHT_ARM_EXIDX section, always keeps the input sections.
5583         (Arm_input_section::set_exidx_section_link): New method.
5584         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5585         has_errors_ to false.
5586         (Arm_exidx_input_section::has_errors,
5587         Arm_exidx_input_section::set_has_errors): New methods.
5588         (Arm_exidx_input_section::has_errors_): New data member.
5589         (Arm_relobj::get_exidx_shndx_list): New method.
5590         (Arm_output_section::append_text_sections_to_list): Do not skip
5591         section without SHF_EXECINSTR.
5592         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5593         errors.
5594         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5595         section header.  Make error messages more verbose.  Check for
5596         a non-executable section linked to an EXIDX section.
5597         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5598         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5599         check that there is no deferred EXIDX section if we exit early.
5600         Instead of not making an EXIDX section in case of an error, make one
5601         and set the has_errors flag of it.
5602         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5603         in a relocatable link.
5604         (Target_arm::do_relax): Look for the EXIDX output section instead of
5605         assuming that it is called .ARM.exidx.
5606         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5607         section list.  Do not check for SHF_EXECINSTR section flags but
5608         skip any input section with errors.
5609         * output.cc (Output_section::Output_section): Initialize
5610         always_keeps_input_sections_ to false.
5611         (Output_section::add_input_section): Check for
5612         always_keeps_input_sections_.
5613         *  output.h (Output_section::always_keeps_input_sections,
5614         Output_section::set_always_keeps_input_sections): New methods.
5615         (Output_section::always_keeps_input_sections): New data member.
5616
5617 2010-07-13  Rafael Espindola  <espindola@google.com>
5618
5619         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5620         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5621
5622 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5623             Ian Lance Taylor  <iant@google.com>
5624
5625         * output.h (Output_section_lookup_maps::add_merge_section):
5626         Correct check of whether value was inserted.
5627         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5628         (Output_section_lookup_maps::add_relaxed_input_section):
5629         Likewise.
5630         * arm.cc (Target_arm::got_section): Remove used local os.
5631         * i386.cc (Target_i386::got_section): Likewise.
5632         * x86_64.cc (Target_x86_64::got_section): Likewise.
5633         * sparc.cc (Target_sparc::got_section): Likewise.
5634         (Target_sparc::relocate): Remove unused local have_got_offset.
5635         * powerpc.cc (Target_powerpc::relocate): Likewise.
5636
5637 2010-07-13  Ian Lance Taylor  <iant@google.com>
5638
5639         * compressed_output.cc (zlib_decompress): Fix signature in
5640         !HAVE_ZLIB_H case.
5641
5642         * archive.cc (Archive::include_member): Unlock an external member
5643         of a thin archive.  Don't bother to delete an object we know is
5644         NULL.
5645
5646 2010-07-12  Cary Coutant  <ccoutant@google.com>
5647
5648         * compressed_output.cc (zlib_decompress): New function.
5649         (get_uncompressed_size): New function.
5650         (decompress_input_section): New function.
5651         * compressed_output.h (get_uncompressed_size): New function.
5652         (decompress_input_section): New function.
5653         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5654         Handle compressed debug sections.
5655         * layout.cc (is_compressed_debug_section): New function.
5656         (Layout::output_section_name): Map compressed section names to
5657         canonical names.
5658         * layout.h (is_compressed_debug_section): New function.
5659         (is_debug_info_section): Recognize compressed debug sections.
5660         * merge.cc: Include compressed_output.h.
5661         (Output_merge_data::do_add_input_section): Handle compressed
5662         debug sections.
5663         (Output_merge_string::do_add_input_section): Handle compressed
5664         debug sections.
5665         * object.cc: Include compressed_output.h.
5666         (Sized_relobj::Sized_relobj): Initialize new data members.
5667         (build_compressed_section_map): New function.
5668         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5669         * object.h (Object::section_is_compressed): New method.
5670         (Object::do_section_is_compressed): New method.
5671         (Sized_relobj::Compressed_section_map): New type.
5672         (Sized_relobj::do_section_is_compressed): New method.
5673         (Sized_relobj::compressed_sections_): New data member.
5674         * output.cc (Output_section::add_input_section): Handle compressed
5675         debug sections.
5676         * reloc.cc: Include compressed_output.h.
5677         (Sized_relobj::write_sections): Handle compressed debug sections.
5678
5679 2010-07-08  Cary Coutant  <ccoutant@google.com>
5680
5681         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5682         weak when resolving to a dynamic def.
5683         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5684         for weak undef/dynamic def cases. Adjust callers.
5685         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5686         undef_binding_weak_.
5687         (Symbol_table::sized_write_globals): Adjust symbol binding.
5688         (Symbol_table::sized_write_symbol): Add binding parameter.
5689         * symtab.h (Symbol::set_undef_binding): New method.
5690         (Symbol::is_undef_binding_weak): New method.
5691         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5692         (Symbol_table::should_override): Add new parameter.
5693         (Symbol_table::sized_write_symbol): Add new parameter.
5694
5695         * testsuite/weak_undef_file1.cc: Add new test case.
5696         * testsuite/weak_undef_file2.cc: Fix header comment.
5697         * testsuite/weak_undef_test.cc: Add new test case.
5698
5699 2010-06-29  Doug Kwan  <dougkwan@google.com>
5700
5701         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5702         Initialize USE_SYMBOL_.
5703         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5704         definition.
5705         (Arm_reloc_property::uses_symbol_): New data member declaration.
5706         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5707         uses symbol value and symbol is undefined but not weakly undefined.
5708
5709 2010-06-28  Rafael Espindola  <espindola@google.com>
5710
5711         * plugin.cc (Plugin::load): Use dlerror.
5712
5713 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5714
5715         * symtab.cc (detect_odr_violations): When reporting an ODR
5716         violation, report an object where the symbol is defined.
5717
5718 2010-06-25  Doug Kwan  <dougkwan@google.com>
5719
5720         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5721         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5722         definition.
5723         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5724         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5725         target hook to detect function points.
5726         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5727         * icf.h (Icf::check_section_for_function_pointers): Change type of
5728         parameter SECTION_NAME to const reference to std::string.  Use
5729         target hook to determine if section may have unsafe pointers.
5730         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5731         method definition.
5732
5733 2010-06-21  Rafael Espindola  <espindola@google.com>
5734
5735         * fileread.cc (Input_file::find_fie): New
5736         (Input_file::open): Use Input_file::find_fie.
5737         * fileread.h (Input_file::find_fie): New
5738         * plugin.cc (set_extra_library_path): New.
5739         (Plugin::load): Add set_extra_library_path to the transfer vector.
5740         (Plugin_manager::set_extra_library_path): New.
5741         (Plugin_manager::add_input_file): Use the extra search path if set.
5742         (set_extra_library_path(): New.
5743         * plugin.h (Plugin_manager): Add set_extra_library_path and
5744         extra_search_path_.
5745
5746 2010-06-19  Cary Coutant  <ccoutant@google.com>
5747
5748         * layout.cc (gdb_sections): Add .debug_types.
5749         (lines_only_debug_sections): Likewise.
5750
5751 2010-06-18  Rafael Espindola  <espindola@google.com>
5752
5753         * plugin.cc (add_input_file,add_input_library)
5754         (Plugin_manager::add_input_file): Make filename arguments const.
5755         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5756         const.
5757
5758 2010-06-16  Doug Kwan  <dougkwan@google.com>
5759
5760         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5761         .ARM.attributes section if we have not merged any input
5762         attributes sections.
5763
5764 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5765
5766         * arm.cc: Allow combining objects with no EABI version
5767         information.
5768
5769 2010-06-15  Rafael Espindola  <espindola@google.com>
5770
5771         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5772
5773 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5774
5775         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5776         (struct iovec): Correct !HAVE_READV definition.
5777
5778 2010-06-10  Cary Coutant  <ccoutant@google.com>
5779
5780         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5781         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5782         reloc sections.
5783         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5784
5785         PR 11683
5786         * symtab.h (Symbol::is_placeholder): New member function.
5787         * target-reloc.h (relocate_section): Check for placeholder symbols.
5788
5789         * testsuite/Makefile.am (plugin_test_8): New test.
5790         (plugin_test_9): New test.
5791         * testsuite/Makefile.in: Regenerate.
5792
5793 2010-06-09  Nick Clifton  <nickc@redhat.com>
5794
5795         * yyscript.y (input_list_element): Allow strings prefixed with
5796         the '-' character.  Treat these as libraries.
5797         * script.cc (script_add_library): New function.  Adds a library
5798         specified by "-l<name>" found in an input script.
5799         * script-c.h: Add prototype for script_add_library.
5800
5801 2010-06-07  Doug Kwan  <dougkwan@google.com>
5802
5803         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5804         Restrict stub-group size to be within long conditional branch
5805         range when working around cortex-A8 erratum.
5806
5807 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5808
5809         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5810         #ifdef typo.
5811
5812 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5813
5814         PR gold/11658
5815         * output.cc
5816         (Output_section::Input_section_sort_entry::compare_section_ordering):
5817         Change to return non-zero correctly.
5818         (Output_section::Input_section_sort_section_order_index_compare
5819         ::operator()): Change to fix ambiguity in comparisons.
5820
5821 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5822
5823         * gold.h (is_wildcard_string): New function.
5824         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5825         (Layout::layout_eh_frame): Ditto.
5826         (Layout::find_section_order_index): New method.
5827         (Layout::read_layout_from_file): New method.
5828         * layout.h (Layout::find_section_order_index): New method.
5829         (Layout::read_layout_from_file): New method.
5830         (Layout::input_section_position_): New private member.
5831         (Layout::input_section_glob_): New private member.
5832         * main.cc (main): Call read_layout_from_file here.
5833         * options.h (--section-ordering-file): New option.
5834         * output.cc (Output_section::input_section_order_specified_): New
5835         member.
5836         (Output_section::Output_section): Initialize new member.
5837         (Output_section::add_input_section): Add new parameter.
5838         Keep input sections when --section-ordering-file is used.
5839         (Output_section::set_final_data_size): Sort input sections when
5840         section ordering file is specified.
5841         (Output_section::Input_section_sort_entry): Add new parameter.
5842         Check sorting type.
5843         (Output_section::Input_section_sort_entry::compare_section_ordering):
5844         New method.
5845         (Output_section::Input_section_sort_compare::operator()): Change to
5846         consider section_order_index.
5847         (Output_section::Input_section_sort_init_fini_compare::operator()):
5848         Change to consider section_order_index.
5849         (Output_section::Input_section_sort_section_order_index_compare
5850         ::operator()): New method.
5851         (Output_section::sort_attached_input_sections): Change to sort
5852         according to section order when specified.
5853         (Output_section::add_input_section<32, true>): Add new parameter.
5854         (Output_section::add_input_section<64, true>): Add new parameter.
5855         (Output_section::add_input_section<32, false>): Add new parameter.
5856         (Output_section::add_input_section<64, false>): Add new parameter.
5857         * output.h (Output_section::add_input_section): Add new parameter.
5858         (Output_section::input_section_order_specified): New
5859         method.
5860         (Output_section::set_input_section_order_specified): New method.
5861         (Input_section::Input_section): Initialize section_order_index_.
5862         (Input_section::section_order_index): New method.
5863         (Input_section::set_section_order_index): New method.
5864         (Input_section::section_order_index_): New member.
5865         (Input_section::Input_section_sort_section_order_index_compare): New
5866         struct.
5867         (Output_section::input_section_order_specified_): New member.
5868         * script-sections.cc (is_wildcard_string): Delete and move modified
5869         method to gold.h.
5870         (Output_section_element_input::Output_section_element_input): Modify
5871         call to is_wildcard_string.
5872         (Output_section_element_input::Input_section_pattern
5873         ::Input_section_pattern): Ditto.
5874         (Output_section_element_input::Output_section_element_input): Ditto.
5875         * testsuite/Makefile.am (final_layout): New test case.
5876         * testsuite/Makefile.in: Regenerate.
5877         * testsuite/final_layout.cc: New file.
5878         * testsuite/final_layout.sh: New file.
5879
5880 2010-06-01  Rafael Espindola  <espindola@google.com>
5881
5882         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5883
5884 2010-06-01  Rafael Espindola  <espindola@google.com>
5885
5886         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5887         visibility of symbols.
5888
5889 2010-05-27  Doug Kwan  <dougkwan@google.com>
5890
5891         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5892         from start of output section instead of address for a local symbol
5893         in a merged or relaxed section when doing a relocatable link.
5894
5895 2010-05-26  Rafael Espindola  <espindola@google.com>
5896
5897         PR 11604
5898         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5899         adding sections the garbage collector removed.
5900         * gold/testsuite/Makefile.am: Add test.
5901         * gold/testsuite/Makefile.in: Regenerate.
5902         * gold/testsuite/plugin_test_7.sh: New.
5903         * gold/testsuite/plugin_test_7_1.c: New.
5904         * gold/testsuite/plugin_test_7_2.c: New.
5905
5906 2010-05-26  Rafael Espindola  <espindola@google.com>
5907
5908         * script-sections.cc (Output_section_definition::set_section_addresses):
5909         Check for --section-start.
5910
5911 2010-05-26  Doug Kwan  <dougkwan@google.com>
5912
5913         * arm.cc (Arm_scan_relocatable_relocs): New class.
5914         (Target_arm::relocate_special_relocatable): New method.
5915         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5916         (Arm_relocate_functions::thumb_branch_common): Same.
5917         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5918         instead of Default_scan_relocatable_relocs.
5919         * target-reloc.h (relocate_for_relocatable): Let target handle
5920         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5921         * target.h (Sized_target::relocate_special_relocatable): New method.
5922
5923 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5924
5925         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5926
5927 2010-05-23  Doug Kwan  <dougkwan@google.com>
5928
5929         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5930         instead of a cast.
5931         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5932         with a direct branch, not a conditional branch, to a stub.
5933         * merge.cc (Output_merge_base::record_input_section): New method
5934         defintion.
5935         (Output_merge_data::do_add_input_section): Record input section if
5936         keeps-input-sections flag is set.
5937         (Output_merge_string::do_add_input_section): Ditto.
5938         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5939         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5940         INPUT_SECTIONS_.
5941         (Output_merge_base::keeps_input_sections,
5942         Output_merge_base::set_keeps_input_sections,
5943         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5944         method definitions.
5945         (Output_merge_base::Input_sections): New type declaration.
5946         (Output_merge_base::input_sections_begin,
5947         Output_merge_base::input_sections_end,
5948         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5949         (Output_merge_base::bool keeps_input_sections_,
5950         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5951         Output_merge_base::input_sections_): New data members.
5952         (Output_merge_data::do_set_keeps_input_sections): New method
5953         defintion.
5954         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5955         * output.cc (Output_section::Input_section::relobj): Move method
5956         defintion from class declaration to here and handle merge sections.
5957         (Output_section::Input_section::shndx): Ditto.
5958         (Output_section::Output_section): Remove initializations of removed
5959         data members and initialize new data member LOOKUP_MAPS_.
5960         (Output_section::add_input_section): Set keeps-input-sections flag
5961         for a newly created merge output section as appropriate.  Adjust code
5962         to use Output_section_lookup_maps class.
5963         (Output_section::add_relaxed_input_section): Adjst code for lookup
5964         maps code refactoring.
5965         (Output_section::add_merge_input_section): Add a new parameter
5966         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5967         class.  If adding input section to a newly created merge output
5968         section fails, remove the new merge section.
5969         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5970         Adjust code for use of the Output_section_lookup_maps class.
5971         (Output_section::find_merge_section): Ditto.
5972         (Output_section::build_lookup_maps): New method defintion.
5973         (Output_section::find_relaxed_input_section): Adjust code to use
5974         Output_section_lookup_maps class.
5975         (Output_section::get_input_sections): Export merge sections.  Adjust
5976         code to use Output_section_lookup_maps class.
5977         (Output_section:::add_script_input_section): Adjust code to use
5978         Output_section_lookup_maps class.  Update lookup maps for merge
5979         sections also.
5980         (Output_section::discard_states): Use Output_section_lookup_maps.
5981         (Output_section::restore_states): Same.
5982         * output.h (Merge_section_properties): Move class defintion out of
5983         Output_section.
5984         (Output_section_lookup_maps): New class.
5985         (Output_section::Input_section::is_merge_section): New method
5986         defintion.
5987         (Output_section::Input_section::relobj): Move defintion out of class
5988         defintion.  Declare method only.
5989         (Output_section::Input_section::shndx): Ditto.
5990         (Output_section::Input_section::output_merge_base): New method defintion.
5991         (Output_section::Input_section::u2_.pomb): New union field.
5992         (Output_section::Merge_section_by_properties_map,
5993         Output_section::Output_section_data_by_input_section_map,
5994         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5995         Remove types.
5996         (Output_section::add_merge_input_section): Add new parameter
5997         KEEPS_INPUT_SECTIONS.
5998         (Output_section::build_lookup_maps): New method declaration.
5999         (Output_section::merge_section_map_,
6000         Output_section::merge_section_by_properties_map_,
6001         Output_section::relaxed_input_section_map_,
6002         Output_section::is_relaxed_input_section_map_valid_): Remove data
6003         members.
6004         (Output_section::lookup_maps_): New data member.
6005
6006 2010-05-21  Doug Kwan  <dougkwan@google.com>
6007
6008         PR gold/11619
6009         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6010         avoid a compilation error.
6011
6012 2010-05-19  Rafael Espindola  <espindola@google.com>
6013
6014         * script-sections.cc (Output_section_definition::allocate_to_segment):
6015         Update the phdrs_list even when the output section is NULL.
6016         * testsuite/Makefile.am: Add test.
6017         * testsuite/Makefile.in: Regenerate.
6018         * testsuite/script_test_9.cc: New.
6019         * testsuite/script_test_9.sh: New.
6020         * testsuite/script_test_9.t: New.
6021
6022 2010-05-19  Doug Kwan  <dougkwan@google.com>
6023
6024         * arm.cc (Arm_input_section::original_size): New method.
6025         (Arm_input_section::do_addralign): Add a cast.
6026         (Arm_input_section::do_output_offset): Remove static cast.
6027         (Arm_input_section::original_addralign,
6028          Arm_input_section::original_size_): Change type to uint32_t.
6029         (Arm_input_section::init): Add safe casts for section alignment
6030         and size.
6031         (Arm_input_section::set_final_data_size): Do not set address and
6032         offset of stub table.
6033         (Arm_output_section::fix_exidx_coverage): Change use of of
6034         Output_section::Simple_input_section to that of
6035         Output_section::Input_section.
6036         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6037         except for the first pass.
6038         * output.cc (Output_section::get_input_sections): Change type of
6039         input_sections to std::list<Input_section>.
6040         (Output_section::add_script_input_section): Rename from
6041         Output_section::add_simple_input_section.  Change type of SIS
6042         parameter from Simple_input_section to Input_section.
6043         * output.h (Output_section::Simple_input_section): Remove class.
6044         (Output_section::Input_section): Change class visibility to public.
6045         (Output_section::Input_section::addralign): Use stored alignments
6046         for special input sections if set.
6047         (Output_section::Input_section::set_addralign): New method.
6048         (Output_section::get_input_sections): Change parameter type from
6049         list of Simple_input_section to list of Input_section.
6050         (Output_section::add_script_input_section): Rename from
6051         Output_section::add_simple_input_section. Change first parameter's
6052         type from Simple_input_section to Input_section and remove the
6053         second and third parameters.
6054         * script-sections.cc (Input_section::Input_section_list): Change
6055         type to list of Output_section::Input_section/
6056         (Input_section_info::Input_section_info): Change parameter type of
6057         INPUT_SECTION to Output_section::Input_section.
6058         (Input_section_info::input_section): Change return type.
6059         (Input_section_info::input_section_): Change type to
6060         Output_section::Input_section.
6061         (Output_section_element_input::set_section_addresses): Adjust code
6062         to use Output_section::Input_section instead of
6063         Output_section::Simple_input_section.  Adjust code for renaming
6064         of Output_section::add_simple_input_section.
6065         (Orphan_output_section::set_section_addresses): Ditto.
6066
6067 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6068
6069         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6070         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6071
6072 2010-05-18  Rafael Espindola  <espindola@google.com>
6073
6074         * options.cc (General_options::finalize): Handle -nostdlib.
6075         * options.h (nostdlib): New option.
6076         * script.cc (script_add_search_dir): Handle -nostdlib.
6077
6078 2010-05-12  Doug Kwan  <dougkwan@google.com>
6079
6080         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6081         attributes section only if there no attributes section after merging.
6082         (Target_arm::merge_object_attributes): Move value of
6083         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6084         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6085         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6086         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6087         and arm_attr_merge_7.stdout.
6088         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6089         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6090         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6091         arm_attr_merge_7b.o): New rules.
6092         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6093         arm_attr_merge_7
6094         * testsuite/Makefile.in: Regenerate.
6095         * testsuite/arm_attr_merge.sh: New file.
6096         * testsuite/arm_attr_merge_[67][ab].s: Same.
6097
6098 2010-05-05  Nick Clifton  <nickc@redhat.com>
6099
6100         * po/es.po: Updated Spanish translation.
6101
6102 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6103
6104         * Makefile.am (install-exec-local): Properly install gold as
6105         default cross linker.
6106         * Makefile.in: Regenerated.
6107
6108 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6109             Nick Clifton  <nickc@redhat.com>
6110
6111         * configure.ac (install_as_default): Define and set to false
6112         unless --enable-gold or --enable-gold=both/gold has been
6113         specified.
6114         * configure: Regenerate.
6115
6116         * Makefile.am (install-exec-local): Install the executable as
6117         'ld.gold'.  If install_as_default is true then also install it as
6118         'ld'.
6119         * Makefile.in: Regenerated.
6120
6121 2010-04-24  Ian Lance Taylor  <iant@google.com>
6122
6123         * layout.cc (Layout::layout_reloc): In relocatable link don't
6124         combine reloc sections for grouped sections.
6125
6126 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6127
6128         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6129         sections that are not ordinary to icf.
6130         * icf.cc (get_section_contents): Handle relocation pointing to section
6131         with no object or shndx information.
6132         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6133         * testsuite/Makefile.in: Regenerate.
6134         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6135         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6136
6137 2010-04-22  Ian Lance Taylor  <iant@google.com>
6138
6139         * expression.cc (Expression::Expression_eval_info): Add
6140         result_alignment_pointer field.
6141         (Expression::eval_with_dot): Add result_alignment_pointer
6142         parameter.  Change all callers.
6143         (Expression::eval_maybe_dot): Likewise.
6144         (class Binary_expression): Add alignment_pointer parameter to
6145         left_value and right_value.  Change all callers.
6146         (BINARY_EXPRESSION): Set result alignment.
6147         (class Trinary_expression): Add alignment_pointer parameter to
6148         arg2_value and arg3_value.  Change all callers.
6149         (Trinary_cond::value): Set result alignment.
6150         (Max_expression::value, Min_expression::value): Likewise.
6151         (Align_expression::value): Likewise.
6152         * script-sections.cc (class Sections_element): Add dot_alignment
6153         parameter to set_section_addresses virtual function.  Update
6154         instantiations.
6155         (class Output_section_element): Likewise.
6156         (Script_sections::create_segments): Add dot_alignment parameter.
6157         Change all callers.
6158         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6159         (Script_sections::set_phdrs_clause_addresses): Likewise.
6160         * script-sections.h: Update declarations.
6161         * script.h: Update declarations.
6162         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6163         min_p_align.
6164         * testsuite/script_test_3.t: Set large alignment.
6165         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6166         segment has expected alignment.
6167
6168 2010-04-22  Nick Clifton  <nickc@redhat.com>
6169
6170         * po/gold.pot: Updated by the Translation project.
6171         * po/vi.po: Updated Vietnamese translation.
6172
6173 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6174
6175         * testsuite/Makefile.am (check_PROGRAMS): Add
6176         icf_virtual_function_folding_test.
6177         * testsuite/Makefile.in: Regenerated.
6178
6179 2010-04-15  Andrew Haley  <aph@redhat.com>
6180
6181         * options.h (merge_exidx_entries): New option.
6182         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6183         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6184         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6185         (Target_arm::merge_exidx_entries): New function.
6186         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6187         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6188         to Arm_exidx_fixup constructor.
6189         Add new arg, merge_exidx_entries.
6190         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6191         Arm_output_section::fix_exidx_coverage.
6192
6193 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6194
6195         * icf.cc (get_section_contents): Check for preemptible functions.
6196         Ignore addend when appropriate.
6197         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6198         section folded.
6199         (add_from_relobj): Check for section folded.
6200         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6201         * symtab.h (should_add_dynsym_entry): Add new parameter.
6202         * target-reloc.h (scan_relocs): Check for section folded.
6203         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6204         Check reloc types for function pointers in shared objects.
6205         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6206         case.
6207         (icf_preemptible_functions_test): New test case.
6208         (icf_string_merge_test): New test case.
6209         * testsuite.Makefile.in: Regenerate.
6210         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6211         bar_glob.  Refactor code.
6212         * testsuite/icf_preemptible_functions_test.cc: New file.
6213         * testsuite/icf_preemptible_functions_test.sh: New file.
6214         * testsuite/icf_string_merge_test.cc: New file.
6215         * testsuite/icf_string_merge_test.sh: New file.
6216         * testsuite/icf_virtual_function_folding_test.cc: New file.
6217         * testsuite/icf_virtual_function_folding_test.sh: New file.
6218
6219 2010-04-14  Doug Kwan  <dougkwan@google.com>
6220
6221         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6222         for local symbol recounting if we remove a section due to ICF.
6223         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6224         there are no regular objects in input.
6225
6226 2010-04-13  Doug Kwan  <dougkwan@google.com>
6227
6228         * arm.cc (Arm_input_section::set_final_data_size): Compute
6229         accurate final data size instead of using current data size.
6230
6231 2010-04-09  Doug Kwan  <dougkwan@google.com>
6232
6233         * layout.cc (Layout::choose_output_section): Handle script section
6234         types.
6235         (Layout::make_output_section_for_script): Add section type parameter.
6236         Handle script section types.
6237         * layout.h (Layout::make_output_section_for_script): Add section
6238         type parameter.
6239         * output.cc (Output_section::Output_section): Initialize data member
6240         is_noload_.
6241         (Output_section::do_reset_address_and_file_offset): Do not set address
6242         to 0 if section is a NOLOAD section.
6243         * output.h (Output_section::is_noload): New method.
6244         (Output_section::set_is_noload): Ditto.
6245         (Output_section::is_noload_): New data member.
6246         * script-c.h (Script_section_type): New enum type.
6247         (struct Parser_output_section_header): Add new file section_type.
6248         * script-sections.cc (Sections_element::output_section_name): Add
6249         parameter for returning script section type.
6250         (Output_section_definition::output_section_name): Ditto.
6251         (Output_section_definition::section_type)P; New method.
6252         (Output_section_definiton::script_section_type_name): Ditto.
6253         (Output_section_definition::script_section_type_): New data member.
6254         (Output_section_definition::Output_section_definition): Initialize
6255         data member Output_section_definition::script_section_type_.
6256         (Output_section_definition::create_sections): Pass script section type
6257         to Layout::make_output_section_for_script.
6258         (Output_section_definition::output_section_name): Return script
6259         section type to caller.
6260         (Output_section_definition::set_section_address): Do not advance
6261         dot value and load address if section type is NOLOAD.  Set address
6262         of NOLOAD sections regardless of section flags.
6263         (Output_section_definition::print): Print section type if it is
6264         not SCRIPT_SECTION_TYPE_NONE.
6265         (Output_section_definition::section_type): New method.
6266         (Output_section_definition::script_section_type_name): Ditto.
6267         (Script_sections::output_section_name): Add new parameter
6268         PSECTION_TYPE for returning script section type.  Pass it to
6269         section elements.  Handle discard sections.
6270         (Sort_output_sections::operator()): Handle NOLOAD sections.
6271         * script-sections.h (Script_sections::Section_type): New enum type.
6272         (Script_sections::output_section_name): Add a new parameter for
6273         returning script section type.
6274         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6275         INFO and NOLOAD.
6276         * yyscript.y (union): Add new field SECTION_TYPE.
6277         (COPY, DSECT, INFO, NOLOAD): New tokens.
6278         (opt_address_and_section_type): Change type to output_section_header.
6279         (section_type): New non-terminal
6280         (section_header): Handle section type.
6281         (opt_address_and_section_type): Return section type value.
6282
6283 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6284
6285         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6286         * testsuite/plugin_common_test_2.c (foo): Likewise.
6287
6288 2010-04-08  Doug Kwan  <dougkwan@google.com>
6289
6290         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6291         Output_merge_data.
6292         * output.cc (Output_section::add_merge_input_section): Simplify
6293         code and return status of Output_merge_base::add_input_section.
6294         Update merge section map only if Output_merge_base::add_input_section
6295         returns true.
6296
6297 2010-04-07  Doug Kwan  <dougkwan@google.com>
6298
6299         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6300         if section is marked as containing instructions but has no mapping
6301         symbols.
6302         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6303         correct section index.
6304         (Arm_relobj::find_linked_text_section): Ditto.
6305
6306 2010-04-07  Cary Coutant  <ccoutant@google.com>
6307
6308         * archive.cc (include_member): Destroy Read_symbols_data object before
6309         releasing file.
6310         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6311         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6312         (Read_symbols_data::~Read_symbols_data) New destructor.
6313         (Section_relocs::Section_relocs) New constructor.
6314         (Section_relocs::~Section_relocs) New destructor.
6315         (Read_relocs_data::Read_relocs_data) New constructor.
6316         (Read_relocs_data::~Read_relocs_data) New destructor.
6317         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6318         pointers to NULL after deleting.
6319
6320 2010-04-07  Doug Kwan  <dougkwan@google.com>
6321
6322         * arm.cc: Replace "endianity" with "endianness" in comments.
6323         (Arm_exidx_cantunwind): Ditto.
6324         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6325         (Arm_relobj::merge_flags_and_attributes): New method.
6326         (Arm_relobj::merge_flags_and_attributes_): New data member.
6327         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6328         (Arm_relobj::scan_sections_for_stubs): Ditto.
6329         (Arm_relobj::do_read_symbols): Check to see if we really want to
6330         merge processor-specific flags and attributes.  Exit early if
6331         an object is empty except for section names and the undefined symbol.
6332         (Target_arm::do_finalize_sections): Move check for ELF format to
6333         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6334         attributes from a regular object only when we have determined that
6335         it is aapropriate.  Do not create an .ARM.attributes section in
6336         output if there is no regular input object.
6337         (Target_arm::merge_processor_specific_flags): Check
6338         --warn-mismatch before printing any error.
6339         (Target_arm::merge_object_attributes): Ditto.
6340         * gold.cc (queue_middle_tasks): Handle the case in which there is
6341         no regular object in input.
6342         * options.cc (General_options::parse_EB): New method.
6343         (General_options::parse_EL): Same.
6344         (General_options::General_options): Initialize endianness_.
6345         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6346         New options.
6347         (General_options::Endianness): New enum.
6348         (General_options::endianness): New method.
6349         (General_options::endianness_): New data member.
6350         * parameters.cc (Parameters::set_options): Check target endianness.
6351         (Parameters::set_target_once): Ditto.
6352         (Parameters::check_target_endianness): New method.
6353         (parameters_force_valid_target): If either -EL or -EB is specified,
6354         use it to define endianness of default target.
6355         * parameters.h (Parameters::check_target_endianness): New method
6356         declaration.
6357         * target.h (class Target): Change "endianity" to "endianness"
6358         in comments.
6359
6360 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6361
6362         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6363         * configure: Regenerate.
6364         * Makefile.in: Regenerate.
6365         * testsuite/Makefile.in: Regenerate.
6366
6367 2010-04-06  Cary Coutant  <ccoutant@google.com>
6368
6369         gcc PR lto/42757
6370         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6371         prevailing definitions of common symbols.
6372         * testsuite/plugin_test_6.sh: New test case.
6373         * testsuite/plugin_common_test_1.c: New test case.
6374         * testsuite/plugin_common_test_2.c: New test case.
6375         * testsuite/Makefile.am (plugin_test_6): New test case.
6376         * testsuite/Makefile.in: Regenerate.
6377
6378 2010-04-06  Nick Clifton  <nickc@redhat.com>
6379
6380         * po/vi.po: New Vietnamese translation.
6381
6382 2010-03-30  Doug Kwan  <dougkwan@google.com>
6383
6384         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6385
6386 2010-03-25  Doug Kwan  <dougkwan@google.com>
6387
6388         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6389         to avoid a conversion warning on a 32-bit host.
6390
6391 2010-03-24  Ian Lance Taylor  <iant@google.com>
6392
6393         * testsuite/script_test_3.t: Add a TLS segment.
6394         * testsuite/Makefile.am (check_PROGRAMS): Add
6395         tls_phdrs_script_test.
6396         (tls_phdrs_script_test_SOURCES): Define.
6397         (tls_phdrs_script_test_DEPENDENCIES): Define.
6398         (tls_phdrs_script_test_LDFLAGS): Define.
6399         (tls_phdrs_script_test_LDADD): Define.
6400         * testsuite/Makefile.in: Rebuild.
6401
6402 2010-03-23  Cary Coutant  <ccoutant@google.com>
6403
6404         * fileread.cc (find_or_make_view): Fix comment.
6405
6406 2010-03-23  Ian Lance Taylor  <iant@google.com>
6407
6408         * script-sections.cc (class Orphan_section_placement): Define
6409         PLACE_TLS and PLACE_TLS_BSS.
6410         (Orphan_section_placement::Orphan_section_placement): Initialize
6411         new places.
6412         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6413         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6414         (tls_script_test_SOURCES): Define.
6415         (tls_script_test_DEPENDENCIES): Define.
6416         (tls_script_test_LDFLAGS): Define.
6417         (tls_script_test_LDADD): Define.
6418         * testsuite/Makefile.in: Rebuild.
6419
6420 2010-03-22  Doug Kwan  <dougkwan@google.com>
6421
6422         * arm.cc (Arm_relocate_functions::abs8,
6423         Arm_relocate_functions::abs16): Use correct check for overflow
6424         specified in the ARM ELF specs.
6425         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6426         target of a BLX instruction specially.
6427         (Reloc_stub::stub_type_for_reloc): Ditto.
6428         (Relocate::relocate): Use symbolic names instead of numeric relocation
6429         codes to report error.
6430         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6431         workaround.
6432         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6433         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6434         thumb2_blx_out_of_range.stdout
6435         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6436         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6437         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6438         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6439         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6440         thumb2_blx_in_range, thumb2_blx_in_range.o,
6441         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6442         thumb2_blx_out_of_range.o): New rules.
6443         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6444         thumb2_blx_in_range and thumb2_blx_out_of_range.
6445         * testsuite/Makefile.in: Regenerate.
6446         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6447         * testsuite/thumb_blx_in_range.s: New file.
6448         * testsuite/thumb_blx_out_of_range.s: New file.
6449
6450 2010-03-22  Rafael Espindola  <espindola@google.com>
6451
6452         * archive.cc (Should_include): Move to archive.h.
6453         (should_include_member): Make it a member of Archive.
6454         (Lib_group): New.
6455         (Add_lib_group_symbols): New.
6456         * archive.h: Include options.h.
6457         (Archive_member): Moved from Archive.
6458         (Should_include): Moved from archive.cc.
6459         (Lib_group): New.
6460         (Add_lib_group_symbols): New.
6461         * dynobj.cc (do_should_include_member): New.
6462         * dynobj.h (do_should_include_member): New.
6463         * gold.cc (queue_initial_tasks): Update call to queue.
6464         * main.cc (main): Print lib group stats.
6465         * object.cc (do_should_include_member): New.
6466         * object.h: Include archive.h.
6467         (Object::should_include_member): New.
6468         (Object::do_should_include_member): New.
6469         (Sized_relobj::do_should_include_member): New.
6470         * options.cc (General_options::parse_start_lib): New.
6471         (General_options::parse_end_lib): New.
6472         (Input_arguments::add_file): Handle lib groups.
6473         (Input_arguments::start_group): Check we are not in a lib.
6474         (Input_arguments::start_lib): New.
6475         (Input_arguments::end_lib): New.
6476         * options.h (General_options): Add start_lib and end_lib.
6477         (Input_argument::lib_): New.
6478         (Input_argument::lib): New.
6479         (Input_argument::is_lib): New.
6480         (Input_file_lib): New.
6481         (Input_arguments::in_lib_): New.
6482         (Input_arguments::in_lib): New.
6483         (Input_arguments::start_lib): New.
6484         (Input_arguments::end_lib_): New.
6485         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6486         in unused members as preempted.
6487         (Sized_pluginobj::do_should_include_member): New.
6488         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6489         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6490         return the blocker.
6491         (Read_symbols::do_whole_lib_group): New.
6492         (Read_symbols::do_lib_group): New.
6493         (Read_symbols::do_read_symbols): Handle lib groups.
6494         (Read_symbols::get_name): Handle lib groups.
6495         * readsyms.h (Read_symbols): Add an archive member pointer.
6496         (Read_symbols::do_whole_lib_group): New.
6497         (Read_symbols::do_lib_group): New.
6498         (Read_symbols::member_): New.
6499         * script.cc (read_input_script): Update call to queue_soon.
6500
6501 2010-03-19  Doug Kwan  <dougkwan@google.com>
6502
6503         * arm.cc (Stub_table::Stub_table): Initialize new data members
6504         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6505         (Stub_table::add_reloc_stub): Assign stub offset and update
6506         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6507         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6508         New data members.
6509         (Stub_table::update_data_size_and_addralign): Use
6510         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6511         instead of going over all reloc stubs.
6512         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6513         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6514         Stringpool_template::offset_ to size of Stringpool_char.
6515         (Stringpool_template::new_key_offset): Remove code to initialize
6516         Stringpool_template::offset_.
6517         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6518         Stringpool_template::offset_ to zero.
6519
6520 2010-03-15  Doug Kwan  <dougkwan@google.com>
6521
6522         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6523         offset_.
6524         (Stringpool_template::new_key_offset): New method.
6525         (Stringpool_template::add_string): Assign offsets when adding new
6526         strings.
6527         (Stringpool_template::set_string_offsets): Do not set string offsets
6528         when not optimizing.
6529         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6530         member size_.
6531         (Chunked_vector::clear): Clear size_.
6532         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6533         (Chunked_vector::size): Return size_.
6534         (Chunked_vector::push_back): Use size_ to find insert position.
6535         (Chunked_vector::size_): New data member.
6536         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6537         (Stringpool_template::new_key_offset): New method declaration.
6538         (Stringpool_template::offset_): New data member.
6539
6540 2010-03-15   Rafael Espindola  <espindola@google.com>
6541
6542         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6543         Add_symbols' constructor.
6544         * readsyms.h (Add_symbols): Remove the input_group member.
6545
6546 2010-03-10  Ian Lance Taylor  <iant@google.com>
6547
6548         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6549         target to ask whether a reference to a symbol requires a stack
6550         split.
6551         * target.h (Target::is_call_to_non_split): New function.
6552         (Target::do_is_call_to_non_split): Declare virtual function.
6553         * target.cc: Include "symtab.h".
6554         (Target::do_is_call_to_non_split): New function.
6555         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6556
6557 2010-03-10  Cary Coutant  <ccoutant@google.com>
6558
6559         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6560         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6561         (File_read::open[2]): Add whole_file_view_ to list of views.
6562         (File_read::make_view): Remove test of whole_file_view_.
6563         (File_read::find_or_make_view): Create whole_file_view_ if
6564         necessary.
6565         (File_read::clear_views): Replace bool parameter with enum;
6566         adjust all callers.  Don't delete views with permanent data;
6567         do delete cached views and views from archives if
6568         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6569         if clearing the corresponding view.
6570         * fileread.h (File_read::Clear_views_mode): New enum.
6571         (File_read::View::is_permanent_view): New method.
6572         (File_read::clear_views): Replace bool parameter
6573         with enum; adjust all callers.
6574         * options.h (General_options): Change keep_files_mapped option;
6575         add map_whole_files.
6576         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6577         releasing the file.
6578         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6579         the file.
6580
6581 2010-03-10  David S. Miller  <davem@davemloft.net>
6582
6583         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6584
6585 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6586
6587         * icf.cc (get_section_contents): Add '@' marker after processing the
6588         merge reloc.
6589
6590 2010-03-08  Doug Kwan  <dougkwan@google.com>
6591
6592         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6593         due to a conversion warning.
6594         (Arm_relobj::update_output_local_symbol_count): Check for local
6595         symbol with unset output index.
6596
6597 2010-03-05  Ian Lance Taylor  <iant@google.com>
6598
6599         * options.h (class General_options): Add --spare-dynamic-tags.
6600         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6601         --spare-dynamic-tags.
6602
6603 2010-03-05  Ian Lance Taylor  <iant@google.com>
6604
6605         * incremental.cc: Include "libiberty.h".
6606
6607 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6608
6609         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6610         function, is_info_ member.
6611         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6612         (Versions::Versions): Update caller.
6613         (Versions::define_base_version): Likewise.
6614         (Versions::add_def): Likewise.
6615
6616 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6617
6618         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6619         (Scan::possible_function_pointer_reloc): New function.
6620         (Scan::local_reloc_may_be_function_pointer): Change to call
6621         possible_function_pointer_reloc.
6622         (Scan::global_reloc_may_be_function_pointer): Ditto.
6623         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6624         relocations in ".data.rel.ro._ZTV" section.
6625         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6626         * testsuite/icf_safe_so_test.cc: Ditto.
6627         * testsuite/icf_safe_test.cc: Ditto.
6628         * testsuite/icf_safe_test.sh: Ditto.
6629
6630 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6631             Ian Lance Taylor  <iant@google.com>
6632
6633         * target-reloc.h (relocate_section): Check the symbol table index
6634         for -1U before setting the local symbol index.
6635         (scan_relocatable_relocs): If copying the relocation, record that
6636         the local symbol is required.
6637         * object.h (Symbol_value::is_output_symtab_index_set): New
6638         function.
6639         (Symbol_value::may_be_discarded_from_output_symtab): New
6640         function.
6641         (Symbol_value::has_output_symtab_entry): New function.
6642         (Symbol_value::needs_output_symtab_entry): Remove.
6643         (Symbol_value::output_symtab_index): Make sure the symbol index is
6644         set.
6645         (Symbol_value::set_output_symtab_index): Make sure the symbol
6646         index is not set.  Make sure the new index is valid.
6647         (Symbol_value::set_must_have_output_symtab_entry): New function.
6648         (Symbol_value::has_output_dynsym_entry): New function.
6649         (Symbol_value::set_output_dynsym_index): Make sure the new index
6650         is valid.
6651         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6652         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6653         local symbol if permitted.
6654         (Sized_relobj::do_finalize_local_symbols): Call
6655         is_output_symtab_index_set rather than needs_output_symtab_entry.
6656         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6657         rather than needs_output_symtab_entry.  Call
6658         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6659         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6660         is_output_symtab_index_set rather than needs_output_symtab_entry.
6661         * testsuite/discard_locals_relocatable_test.c: New file.
6662         * testsuite/discard_locals_test.sh: Test -r.
6663         * testsuite/Makefile.am (check_DATA): Add
6664         discard_locals_relocatable_test1.syms,
6665         discard_local_relocatable_test2.syms.
6666         (MOSTLYCLEANFILES): Likewise.  Also add
6667         discard_locals_relocatable_test1.lout and
6668         discard_locals_relocatable_test2.out.
6669         (discard_locals_relocatable_test1.syms): New target.
6670         (discard_locals_relocatable_test.o): New target.
6671         (discard_locals_relocatable_test1.out): New target.
6672         (discard_locals_relocatable_test2.syms): New target.
6673         (discard_locals_relocatable_test2.out): New target.
6674         (various): Add missing ../ld-new dependencies.
6675         * testsuite/Makefile.in: Rebuild.
6676
6677 2010-03-03  Nick Clifton  <nickc@redhat.com>
6678
6679         * po/fi.po: New Finnish translation.
6680
6681 2010-03-01  Doug Kwan  <dougkwan@google.com>
6682
6683         * layout.cc (Layout::Layout): Force section types of .init_array*,
6684         .preinit_array* and .fini_array* sections.
6685         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6686         Fix check of return value of std::string::find.().
6687         (Output_section::Input_section_sort_compare::operator()): Remove
6688         comment about .init_array.
6689         (Output_section::Input_section_sort_init_fini_compare::operator()):
6690         New method.
6691         (Output_section::sort_attached_input_sections): Handle .init_array
6692         and .fini_array specially.
6693         * output.h (Output_section::Inut_section_sort_compare): Update
6694         comment.
6695         (Output_section::Input_section_sort_init_fini_compare): New struct.
6696
6697 2010-02-26  Doug Kwan  <dougkwan@google.com>
6698
6699         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6700         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6701         * testsuite/debug_msg.sh: Avoid matching source line number for
6702         use of global variable undef_int.
6703
6704 2010-02-26  Doug Kwan  <dougkwan@google.com>
6705
6706         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6707         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6708         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6709         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6710         * options.cc (General_options::General_options): Initialize member
6711         fix_v4bx_.
6712         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6713         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6714         and rm_no_fix_v4bx.stdout
6715         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6716         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6717         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6718         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6719         and arm_no_fix_v4bx.
6720         * Makefile.in: Regenerate.
6721         * testsuite/arm_fix_v4bx.s: New file.
6722         * testsuite/arm_fix_v4bx.sh: Ditto.
6723
6724 2010-02-24  Doug Kwan  <dougkwan@google.com>
6725
6726         * arm.cc (Target_arm::got_section): Make the .got section the first
6727         non RELRO section in the data segment.
6728         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6729         suffixes of section names.
6730
6731 2010-02-24  Doug Kwan  <dougkwan@google.com>
6732
6733         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6734         flags and attributes merging if an input file is a binary file.
6735         * fileread.cc (Input_file::open): Record format of original file.
6736         * fileread.h (Input_file::Format): New enum type.
6737         (Input_file::Input_file): Initialize data member format_.
6738         (Input_file::format): New method definition.
6739         (Input_file::format_):: New data member.
6740
6741 2010-02-24  Doug Kwan  <dougkwan@google.com>
6742
6743         * arm.cc (Arm_output_data_got): New class.
6744         (ARM_TCB_SIZE): New constant
6745         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6746         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6747         If user uses a script with a SECTIONS clause, issue only a warning
6748         for a misplaced EXIDX input section.  Otherwise, issue an error.
6749         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6750         garbage collection.
6751         (Target_arm::got_mode_index_entry): Handle static linking.
6752         (Target_arm::Scan::local): Ditto.
6753         (Target_arm::Scan::global): Ditto.
6754         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6755         all incorrectly implemented relocations.
6756         (Target_arm::fix_exidx_coverage): Pass layout to
6757         Arm_output_section::fix_exidx_coverage.
6758         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6759         from ".ARM.exidx." and ".ARM.extab.".
6760
6761 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6762
6763         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6764         section if it does not already exist.
6765         * attributes.cc (Attributes_section_data::Attributes_section_data):
6766         Don't crash if size is zero.
6767
6768 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6769             Ian Lance Taylor  <iant@google.com>
6770
6771         * gold.cc (queue_middle_tasks): If no input files were opened,
6772         exit.
6773         * workqueue.h (Task_function::Task_function): Assert that there is
6774         a blocker.
6775
6776 2010-02-22  Doug Kwan  <dougkwan@google.com>
6777
6778         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6779         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6780         types to avoid warnings due to different uint64_t implementations
6781         on different hosts.
6782
6783 2010-02-21  Doug Kwan  <dougkwan@google.com>
6784
6785         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6786         handling of the maximum backward branch offset.
6787         (Arm_relocate_functions::thumb_branch_common): Ditto.
6788         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6789         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6790         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6791         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6792         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6793         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6794         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6795         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6796         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6797         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6798         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6799         thumb2_bl_out_of_range.o): New rules.
6800         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6801         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6802         thumb2_bl_out_of_range
6803         * testsuite/Makefile.in: Regenerate.
6804         * testsuite/arm_bl_in_range.s: New file.
6805         * testsuite/arm_bl_out_of_range.s: Ditto.
6806         * testsuite/arm_branch_in_range.sh: Ditto.
6807         * testsuite/arm_branch_range.t: Ditto.
6808         * testsuite/thumb2_branch_range.t: Ditto.
6809         * testsuite/thumb_bl_in_range.s: Ditto.
6810         * testsuite/thumb_bl_out_of_range.s: Ditto.
6811         * testsuite/thumb_branch_range.t: Ditto.
6812
6813 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6814
6815         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6816         Add reloc offset information.
6817         * icf.cc (get_section_contents): Change iterators to point to the new
6818         vectors. Add reloc offset information to the contents.
6819         * icf.h (Icf::Sections_reachable_info): New typedef.
6820         (Icf::Sections_reachable_list): New typedef.
6821         (Icf::Offset_info): New typedef.
6822         (Icf::Reloc_info): New struct typedef.
6823         (Icf::Reloc_info_list): New typedef.
6824         (Icf::symbol_reloc_list): Delete method.
6825         (Icf::addend_reloc_list): Delete method.
6826         (Icf::section_reloc_list): Delete method.
6827         (Icf::reloc_info_list): New method.
6828         (Icf::reloc_info_list_): New member.
6829
6830 2010-02-19  Doug Kwan  <dougkwan@google.com>
6831
6832         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6833         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6834         * arm.cc (Arm_relocation_functions): New forward declaration.
6835         (Target_arm::Target_arm): Initialize new data members
6836         got_mod_index_offset_ and tls_base_symbol_defined_.
6837         (Target_arm::Relocate::relocate_tls): New method.
6838         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6839          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6840         New methods.
6841         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6842         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6843         (Target_arm::got_mod_index_offset_,
6844         Target_arm::tls_base_symbol_defined_): New data members.
6845         (Target_arm::Scan::local, Target::Scan::global,
6846         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6847         relocations.
6848
6849 2010-02-18  Doug Kwan  <dougkwan@google.com>
6850
6851         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6852         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6853         text section as a parameter becuase some broken tools may not set
6854         the link in section header.
6855         (Target_arm::has_got_section): New method.
6856         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6857         without any mapping symbol as data only.  Remove warning.
6858         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6859         link in its section header, try to discover the link by inspecting the
6860         REL31 relocation at the beginning of the section.
6861         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6862         in error message.
6863         (Target_arm::Scan::global): Treat any reference to the symbol
6864         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6865
6866 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6867
6868         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6869         (Scan::global_reloc_may_be_function_pointer): New function.
6870         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6871         (Scan::global_reloc_may_be_function_pointer): New function.
6872         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6873         (Scan::global_reloc_may_be_function_pointer): New function.
6874         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6875         (Scan::global_reloc_may_be_function_pointer): New function.
6876         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6877         (Scan::global_reloc_may_be_function_pointer): New function.
6878         (Scan::possible_function_pointer_reloc): New function.
6879         (Target_x86_64::can_check_for_function_pointers): New function.
6880         * gc.h (gc_process_relocs): Scan relocation types to determine if
6881         function pointers were taken for targets that support it.
6882         * icf.cc (Icf::find_identical_sections): Include functions for
6883         folding in safe ICF whose pointer is not taken.
6884         * icf.h (Secn_fptr_taken_set): New typedef.
6885         (fptr_section_id_): New member.
6886         (section_has_function_pointers): New function.
6887         (set_section_has_function_pointers): New function.
6888         (check_section_for_function_pointers): New function.
6889         * options.h: Fix comment for safe ICF option.
6890         * target.h (can_check_for_function_pointers): New function.
6891         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6892         Modify icf_safe_test for X86-64.
6893         * testsuite/Makefile.in: Regenerate.
6894         * testsuite/icf_safe_so_test.cc: New file.
6895         * testsuite/icf_safe_so_test.sh: New file.
6896         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6897         (main): Change to take pointer to function kept_func_3.
6898         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6899         folding is done correctly for X86-64.
6900
6901 2010-02-12  David S. Miller  <davem@davemloft.net>
6902
6903         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6904         is_symbolless parameter.
6905         (Output_reloc<SHT_REL>::is_symbolless): New.
6906         (Output_reloc<SHT_REL>::is_symbolless_): New.
6907         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6908         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6909         (Output_reloc<SHT_RELA>::is_symbolless): New.
6910         (Output_data_reloc::add_global): Handle is_symbolless.
6911         (Output_data_reloc::add_global_relative): Likewise.
6912         (Output_data_reloc::add_local): Likewise.
6913         (Output_data_reloc::add_local_relative): Likewise.
6914         (Output_data_reloc::add_symbolless_global_addend): New.
6915         (Output_data_reloc::add_symbolless_local_addend): New.
6916         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6917         is_symbolless.
6918         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6919         instead of ->is_relative_
6920         (Output_reloc::write): Likewise.
6921         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6922         (Output_reloc::write_rel): Simplify.
6923
6924         * sparc.cc (Target_sparc::Scan::local): Use
6925         ->add_symbolless_local_addend as needed.
6926         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6927         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6928         based upon relocation offset.
6929
6930 2010-02-11  Doug Kwan  <dougkwan@google.com>
6931
6932         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6933         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6934         beginning of function.
6935         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6936         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6937         parameter is_32bit in calls to should_apply_static_reloc.
6938         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6939         (check_DATA): Add arm_abs_global.stdout.
6940         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6941         arm_abs_global.stdout): New rules.
6942         (MOSTLLYCLEANFILES): Add arm_abs_global
6943         * Makefile.in: Regenerate.
6944         * testsuite/arm_abs_global.s: New file.
6945         * testsuite/arm_abs_global.sh: Ditto.
6946         * testsuite/arm_abs_lib.s: Ditto.
6947
6948 2010-02-11  Ian Lance Taylor  <iant@google.com>
6949
6950         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6951         Read_relocs task.
6952         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6953         Allocate_commons_task first.
6954         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6955         task, rather than symtab_lock_.
6956         (Gc_process_relocs::~Gc_process_relocs): New function.
6957         (Gc_process_relocs::is_runnable): Check this_blocker_.
6958         (Gc_process_relocs::locks): Use next_blocker_ rather than
6959         blocker_.
6960         (Scan_relocs::~Scan_relocs): New function.
6961         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6962         symtab_lock_.
6963         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6964         next_blocker_.
6965         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6966         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6967         constructor accordingly.
6968         (class Gc_process_relocs): Likewise.
6969         (class Scan_relocs): Likewise.
6970         * common.h (class Allocate_commons_task): Remove symtab_lock_
6971         field, and corresponding constructor parameter.
6972         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6973         symtab_lock_.
6974         (Allocate_commons_task::locks): Likewise.
6975
6976 2010-02-11  Ian Lance Taylor  <iant@google.com>
6977
6978         * gold-threads.h (class Once): Define.
6979         (class Initialize_lock): Rewrite as child of Once.
6980         * gold-threads.cc (class Once_initialize): Define.
6981         (once_pointer_control): New static variable.
6982         (once_pointer, once_arg): New static variables.
6983         (c_run_once): New static function.
6984         (Once::Once, Once::run_once, Once::internal_run): New functions.
6985         (class Initialize_lock_once): Remove.
6986         (initialize_lock_control): Remove.
6987         (initialize_lock_pointer): Remove.
6988         (initialize_lock_once): Remove.
6989         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6990         (Initialize_lock::initialize): Rewrite.
6991         (Initialize_lock::do_run_once): New function.
6992         * archive.cc (Archive::interpret_header): Only clear name if it is
6993         not already empty.
6994         * fileread.cc: Include "gold-threads.h"
6995         (file_counts_lock): New static variable.
6996         (file_counts_initialize_lock): Likewise.
6997         (File_read::release): Only increment counts when using --stats.
6998         Use a lock around the increment.
6999         * parameters.cc (class Set_parameters_target_once): Define.
7000         (set_parameters_target_once): New static variable.
7001         (Parameters::Parameters): Move here from parameters.h.
7002         (Parameters::set_target): Rewrite.
7003         (Parameters::set_target_once): New function.
7004         (Parameters::clear_target): Move here and rewrite.
7005         * parameters.h (class Parameters): Update declarations.  Add
7006         set_parameters_target_once_ field.
7007         (Parameters::Parameters): Move to parameters.cc.
7008         (Parameters::clear_target): Likewise.
7009         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7010         task.
7011         (Start_group::~Start_group): New function.
7012         (Start_group::is_runnable): New function.
7013         (Start_group::locks, Start_group::run): New functions.
7014         (Finish_group::run): Change saw_undefined to size_t.
7015         * readsyms.h (class Start_group): Define.
7016         (class Finish_group): Change saw_undefined_ field to size_t.
7017         (Finish_group::Finish_group): Remove saw_undefined and
7018         this_blocker parameters.  Change all callers.
7019         (Finish_group::set_saw_undefined): New function.
7020         (Finish_group::set_blocker): New function.
7021         * symtab.h (class Symbol_table): Change saw_undefined to return
7022         size_t.  Change saw_undefined_ field to size_t.
7023         * target-select.cc (Set_target_once::do_run_once): New function.
7024         (Target_selector::Target_selector): Initialize set_target_once_
7025         field.  Don't initialize lock_ and initialize_lock_ fields.
7026         (Target_selector::instantiate_target): Rewrite.
7027         (Target_selector::set_target): New function.
7028         * target-select.h (class Set_target_once): Define.
7029         (class Target_selector): Update declarations.  Make
7030         Set_target_once a friend.  Remove lock_ and initialize_lock_
7031         fields.  Add set_target_once_ field.
7032
7033 2010-02-10  Ian Lance Taylor  <iant@google.com>
7034
7035         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7036         queueing any tasks.
7037         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7038         (queue_middle_tasks): Add all blockers before queueing any tasks.
7039         (queue_final_tasks): Likewise.
7040         * token.h (Task_token::add_blockers): New function.
7041         * object.h (Input_objects::number_of_relobjs): New function.
7042
7043 2010-02-10  Ian Lance Taylor  <iant@google.com>
7044
7045         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7046         shared, not if not position independent.
7047         * x86_64.cc (Relocate::relocate_tls): Likewise.
7048         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7049         (tls_pie_pic_test): New target.
7050         * testsuite/Makefile.in: Rebuild.
7051
7052         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7053         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7054         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7055         * testsuite/Makefile.in: Rebuild.
7056
7057 2010-02-09  David S. Miller  <davem@davemloft.net>
7058
7059         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7060         R_SPARC_RELATIVE using ->add_local_relative().
7061         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7062
7063         * output.h (Output_data_dynamic::add_section_size): New method
7064         that takes two Output_data objects.
7065         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7066         entry param.  Handle it in initializers.
7067         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7068         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7069         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7070         arg.
7071         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7072         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7073         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7074         for dynrel_includes_plt.
7075         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7076         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7077         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7078         before .rela.plt
7079         (Target_sparc::do_finalize_sections): Update to pass true for
7080         dynrel_includes_plt.
7081         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7082         output before .rela.plt
7083         (Target_powerpc::do_finalize_sections): Update to pass true for
7084         dynrel_includes_plt when 32-bit.
7085
7086 2010-02-08  Doug Kwan  <dougkwan@google.com>
7087
7088         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7089         method.
7090         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7091         Arm_relobj::scan_section_for_cortex_a8_stubs,
7092         Arm_relobj::do_relocation_section): Instead of calling
7093         Output_section::output_address, use faster
7094         Arm_relobj::simple_input_section_output_address.
7095
7096 2010-02-08  David S. Miller  <davem@davemloft.net>
7097
7098         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7099         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7100         relocation helper function.
7101
7102         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7103         just like R_SPARC_GOT{10,13,22}.
7104         (Target_sparc::Scan::local): Likewise.
7105         (Target_sparc::Relocate:relocate): Likewise.
7106
7107 2010-02-06  Ian Lance Taylor  <iant@google.com>
7108
7109         * configure.ac: Rewrite targetobjs duplicate removal code to use
7110         only shell constructs.
7111         * configure: Rebuild.
7112
7113 2010-02-05  Doug Kwan  <dougkwan@google.com>
7114
7115         PR 11247
7116         * arm.cc (Arm_relobj::section_is_scannable): New method.
7117         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7118         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7119
7120 2010-02-04  Doug Kwan  <dougkwan@google.com>
7121
7122         PR 11247
7123         * arm-reloc-property.cc (cstdio): Include.
7124         * configure.ac (targetobjs): Remove duplicates.
7125         * configure: Regenerate.
7126         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7127         big and little endian version for a given address size.
7128
7129 2010-02-03  Doug Kwan  <dougkwan@google.com>
7130
7131         * arm-reloc-property.cc
7132         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7133         definition.
7134         * arm-reloc-property.h
7135         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7136         New method definition.
7137         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7138         declaration.
7139         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7140         overflow to N.
7141         (GOT_PREL): Change implemented to Y.
7142         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7143         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7144         (Arm_relocate_functions::movw_abs_nc): Remove method.
7145         (Arm_relocate_functions::movt_abs): Ditto.
7146         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7147         (Arm_relocate_functions::thm_movt_abs): Ditto.
7148         (Arm_relocate_functions::movw_rel_nc): Ditto.
7149         (Arm_relocate_functions::movw_rel): Ditto.
7150         (Arm_relocate_functions::movt_rel): Ditto.
7151         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7152         (Arm_relocate_functions:thm_movw_rel): Ditto.
7153         (Arm_relocate_functions:thm_movt_rel): Ditto.
7154         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7155         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7156         New method definitions.
7157         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7158         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7159         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7160         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7161         (Target_arm::Relocate::relocate): Check for non-static or
7162         unimplemented relocation code and exit early.  Change calls to
7163         Target_arm::reloc_uses_thumb_bit and
7164         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7165         instead.  Refactor code to handle similar relocations to increase
7166         code sharing.  Remove check for unsupported relocation code in switch
7167         statement.
7168         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7169         relocation property table to find out size.  Change error message to
7170         print out the name of a relocation code instead of the numeric value.
7171         (Target_arm::scan_reloc_for_stub): Use relocation property table
7172         instead of calling Target_arm::reloc_uses_thumb_bit().
7173
7174 2010-02-02  Doug Kwan  <dougkwan@google.com>
7175
7176         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7177         types of relaxed input section.
7178
7179 2010-02-02  Doug Kwan  <dougkwan@google.com>
7180
7181         * Makefile.am (HFILES): Add arm-reloc-property.h.
7182         (DEFFILES): New.
7183         (TARGETSOURCES): Add arm-reloc-property.cc
7184         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7185         (libgold_a_SOURCES): $(DEFFILES)
7186         * Makefile.in: Regenerate.
7187         * arm-reloc-property.cc: New file.
7188         * arm-reloc-property.h: New file.
7189         * arm-reloc.def: New file.
7190         * arm.cc: Update comments.
7191         (arm-reloc-property.h): New included header.
7192         (arm_reloc_property_table): New global variable.
7193         (Target_arm::do_select_as_default_target): New method definition.
7194         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7195         arm-reloc-property to targ_extra_obj.
7196         * parameters.cc (set_parameters_target): Call
7197         Target::select_as_default_target().
7198         * target.h (Target::select_as_default_target): New method definition.
7199         (Target::do_select_as_default_target): Same.
7200
7201 2010-02-01  Doug Kwan  <dougkwan@google.com>
7202
7203         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7204         first_output_text_section_.
7205         (Arm_exidx_fixup::first_output_text_section): New method definition.
7206         (Arm_exidx_fixup::first_output_text_section_): New data member.
7207         (Arm_exidx_fixup::process_exidx_section): Record the first text
7208         output section seen.
7209         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7210         and entsize in output section header.
7211
7212 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7213
7214         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7215         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7216         (Arm_relocate_functions::thm_alu11): New Method.
7217         (Arm_relocate_functions::thm_pc8): New Method.
7218         (Arm_relocate_functions::thm_pc12): New Method.
7219         (Target_arm::Scan::local): Handle the relocations.
7220         (Target_arm::Scan::global): Likewise.
7221         (Target_arm::Relocate::relocate): Likewise.
7222         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7223
7224 2010-01-29  Doug Kwan  <dougkwan@google.com>
7225
7226         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7227         of relocation types as ld.
7228
7229 2010-01-29  Doug Kwan  <dougkwan@google.com>
7230
7231         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7232         to public.
7233         (Arm_relocate_functions::thumb_branch_common): Ditto.
7234         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7235         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7236         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7237         Arm_relocate_functions::jump24): Remove.
7238         (Target_arm::Relocate::relocate): Adjust code to call
7239         Arm_relocation_functions::arm_branch_common and
7240         Arm_relocation_functions::thumb_branch_common instead of their removed
7241         wrappers.  Merge switch-cases together to reduce source code size.
7242
7243 2010-01-29  Doug Kwan  <dougkwan@google.com>
7244
7245         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7246         output_local_symbol_count_needs_update_.
7247         (Arm_relobj::output_local_symbol_count_needs_update,
7248          Arm_relobj::set_output_local_symbol_count_needs_update,
7249          Arm_relobj::update_output_local_symbol_count): New methods.
7250         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7251         member.
7252         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7253         of pointed function as in a R_ARM_PREL31 relocation.
7254         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7255         for output local symbol count updating.
7256         (Target_arm::do_relax): Update output local symbol counts in objects
7257         if necessary.
7258         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7259
7260 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7261
7262         * arm.cc: Added support for the ARM relocations:
7263         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7264         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7265         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7266         movw_prel_nc).
7267         (Arm_relocate_functions::movw_rel): New method.
7268         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7269         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7270         thm_movw_prel_nc).
7271         (Arm_relocate_functions::thm_movw_rel): New method.
7272         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7273         thm_movt_prel).
7274         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7275         relocations.
7276         (Target_arm::Scan::global): Likewise.
7277         (Target_arm::Relocate::relocate): Likewise.
7278         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7279         Likewise.
7280
7281 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7282
7283         * arm.cc: Added support for ARM group relocations.
7284         (Target_arm::reloc_needs_sym_origin): New method.
7285         (Arm_relocate_functions::calc_grp_kn): New method.
7286         (Arm_relocate_functions::calc_grp_residual): New method.
7287         (Arm_relocate_functions::calc_grp_gn): New method.
7288         (Arm_relocate_functions::arm_grp_alu): New Method.
7289         (Arm_relocate_functions::arm_grp_ldr): New Method.
7290         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7291         (Arm_relocate_functions::arm_grp_ldc): New Method.
7292         (Target_arm::Scan::local): Handle the ARM group relocations.
7293         (Target_arm::Scan::global): Likewise.
7294         (Target_arm::Relocate::relocate): Likewise.
7295         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7296         Likewise.
7297
7298 2010-01-26  Doug Kwan  <dougkwan@google.com>
7299
7300         * arm.cc (set): Include.
7301         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7302         pointer type.
7303         (Arm_output_section::Text_section_list): New type.
7304         (Arm_output_section::append_text_sections_to_list): New method.
7305         (Arm_output_section::fix_exidx_coverage): Ditto.
7306         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7307         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7308         Relobj::set_section_offset() instead of
7309         Sized_relobj::invalidate_section_offset().
7310         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7311         parameter for section headers. Ignore relocation sections for
7312         unallocated sections and EXIDX sections.
7313         (Target_arm::fix_exidx_coverage): New method.
7314         (Target_arm::output_section_address_less_than): New type.
7315         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7316         linked text section instead of the EXIDX section.
7317         (Arm_output_section::create_stub_group): Add an assertion to check
7318         that this is not an EXIDX output section.
7319         (Arm_output_section::append_text_sections_to_list): New method.
7320         (Arm_output_section::fix_exidx_coverage): Ditto.
7321         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7322         Arm_relobj::section_needs_reloc_stub_scanning.
7323         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7324         first pass.
7325         (Target_arm::fix_exidx_coverage): New method.
7326         * object.h (Relobj::set_output_section): New method.
7327         (Sized_relobj::invalidate_section_offset): Remove method.
7328         (Sized_relobj::do_invalidate_section_offset): Remove method.
7329         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7330
7331 2010-01-25  Doug Kwan  <dougkwan@google.com>
7332
7333         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7334         Fix warning due to signed and unsigned comparison on a 32-bit host.
7335
7336 2010-01-22  Doug Kwan  <dougkwan@google.com>
7337
7338         * arm.cc (Target_arm::do_relax): Record an output section for section
7339         offset adjustment it contains any stub table that has changed.
7340         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7341         offsets in an output section if necessary.
7342         * output.cc (Output_section::Output_section): Initialize
7343         section_offsets_need_adjustments_.
7344         (Output_section::add_input_section_for_script): Renamed to
7345         Output_section::add_simple_input_section.
7346         (Output_section::save_states): Add a comment.
7347         (Output_section::discard_states): New method defintion.
7348         (Output_section::adjust_section_offsets): Same.
7349         * output.h (Output_section::add_input_section_for_script): Renamed to
7350         Output_section::add_simple_input_section.
7351         (Output_section::discard_states): New method declaration.
7352         (Output_section::adjust_section_offsets): Same.
7353         (Output_section::section_offsets_need_adjustment,
7354         Output_section::set_section_offsets_need_adjustment): New method
7355         definitions.
7356         (Output_section::section_offsets_need_adjustment_): New data member.
7357         * script-sections.cc
7358         (Output_section_element_input::set_section_address): Adjust code for
7359         renaming of Output_section::add_input_section_for_script.
7360         (Orphan_output_section::set_section_address): Same.
7361
7362 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7363
7364         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7365         Fix_v4bx enum values .
7366         * gold/options.h (General_options): New option definitions.
7367         (General_options::fix_v4bx): New method.
7368         (General_options::Fix_v4bx): New enum.
7369         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7370         (General_options::parse_fix_v4bx_interworking): New method.
7371
7372 2010-01-22  Doug Kwan  <dougkwan@google.com>
7373
7374         * arm.cc (Arm_exidx_fixup): New class.
7375
7376 2010-01-21  Doug Kwan  <dougkwan@google.com>
7377
7378         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7379         classes.
7380         (Arm_exidx_section_offset_map): New type.
7381
7382 2010-01-21  Doug Kwan  <dougkwan@google.com>
7383
7384         * arm.cc (Arm_exidx_input_section): New class.
7385         (Arm_relobj::exidx_input_section_by_link,
7386         Arm_relobj::exidx_input_section_by_shndx,
7387         Arm_relobj::make_exidx_input_section): New methods.
7388         (read_arm_attributes_section): Remove.
7389         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7390         information about them.
7391         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7392         to here.
7393
7394 2010-01-20  Doug Kwan  <dougkwan@google.com>
7395
7396         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7397         Input_section_specifier to Section_id.
7398         (Target_arm::new_arm_input_section: Adjust code for change of key
7399         type.
7400         (Target_arm::find_arm_input_section): Ditto.
7401         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7402         (Section_id): Remove.
7403         (Garbage_collection::Section_id_hash): Remove.
7404         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7405         (Section_id): Remove.
7406         (Icf::Section_id_hash): Remove.
7407         * object.h (Section_id, Const_section_id, Section_id_hash,
7408         Const_section_id_hash): New type definitions.
7409         * output.cc (Output_section::add_relaxed_input_section): Change to
7410         use Const_section_id instead of Input_section_specifier as key type.
7411         (Output_section::add_merge_input_section): Ditto.
7412         (Output_section::build_relaxation_map): Change to use Section_id
7413         instead of Input_section_specifier as key type.
7414         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7415         Ditto.
7416         (Output_section::convert_input_sections_to_relaxed_sections): Change
7417         to use Const_section_id instead of Input_section_specifier as key type.
7418         (Output_section::find_merge_section): Ditto.
7419         (Output_section::find_relaxed_input_section): Ditto.
7420         * output.h (Input_section_specifier): Remove class.
7421         (Output_section::Output_section_data_by_input_section_map): Change
7422         key type to Const_section_id.
7423         (Output_section::Output_relaxed_input_section_by_input_section_map):
7424         Ditto.
7425         (Output_section::Relaxation_map): Change key type to Section_id.
7426
7427 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7428
7429         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7430         (class Arm_v4bx_stub): New class.
7431         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7432         (Stub_factory::make_arm_v4bx_stub): New method.
7433         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7434         (Stub_table::empty): Handle v4bx stubs.
7435         (Stub_table::add_arm_v4bx_stub): New method.
7436         (Stub_table::find_arm_v4bx_stub): New method.
7437         (Arm_relocate_functions::v4bx): New method.
7438         (Target_arm::fix_v4bx): New method.
7439         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7440         (Stub_table::relocate_stubs): Likewise.
7441         (Stub_table::do_write): Likewise.
7442         (Stub_table::update_data_size_and_addralign): Likewise.
7443         (Stub_table::finalize_stubs):  Likewise.
7444         (Target_arm::Scan::local): Likewise.
7445         (Target_arm::Scan::global): Likewise.
7446         (Target_arm::do_finalize_sections): Likewise.
7447         (Target_arm::Relocate::relocate): Likewise.
7448         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7449         Likewise.
7450         (Target_arm::scan_reloc_for_stub): Likewise.
7451         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7452
7453 2010-01-19  Ian Lance Taylor  <iant@google.com>
7454
7455         * output.cc (Output_section_headers::do_sized_write): Write large
7456         segment count to sh_info field.
7457         (Output_file_header::do_sized_write): For large segment count,
7458         write PN_XNUM to e_phnum field.
7459
7460 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7461
7462         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7463         (Arm_relocate_functions::thm_jump8): New function.
7464         (Arm_relocate_functions::thm_jump11): New function.
7465         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7466         R_ARM_THM_JUMP11.
7467         (Target_arm::Scan::global): Likewise.
7468         (Target_arm::Relocate::relocate): Likewise.
7469         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7470         Likewise.
7471
7472 2010-01-14  Doug Kwan  <dougkwan@google.com>
7473
7474         * arm.cc (map, utility): Include headers.
7475         (Target_arm::apply_cortex_a8_workaround): New method.
7476         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7477         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7478         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7479         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7480         the --[no-]fix-cortex-a8 command line options.
7481         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7482         (Target_arm::relocate_stub): Use addend in instruction template.
7483         * options.h (DEFINE_bool): Set the user-set flag.
7484         (General_options): Add --[no-]-fix-cortex options.
7485         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7486         : Update fast look-up map after conversion.
7487
7488 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7489
7490         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7491         in the first pass of do_layout.
7492
7493 2010-01-13  Doug Kwan  <dougkwan@google.com>
7494
7495         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7496         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7497         apparent compiler problem of not folding static constant integral
7498         data members of elfcpp::Elf_sizes<32>.
7499
7500 2010-01-13  Doug Kwan  <dougkwan@google.com>
7501
7502         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7503         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7504         Arm_relobj::scan_section_for_cortex_a8_erratum,
7505         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7506         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7507         sections to scan for relocation stubs into a new method
7508         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7509         relocation and Cortex-A8 stub scanning.
7510         (Target_arm::do_relax): Force stubs to be after stubbed sections
7511         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7512         the beginning of a new relaxation pass.  Update a comment.
7513         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7514
7515 2010-01-12  Ian Lance Taylor  <iant@google.com>
7516
7517         * target-reloc.h (visibility_error): New inline function.
7518         (relocate_section): Call visibility_error.
7519         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7520         (MOSTLYCLEANFILES): Likewise.
7521         (protected_4_pic.o, protected_3.err): New targets.
7522         * testsuite/protected_4.cc: New file.
7523
7524 2010-01-12  Doug Kwan  <dougkwan@google.com>
7525
7526         * arm.cc (Cortex_a8_reloc): New class.
7527         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7528         and cortex_a8_relocs_info_.
7529         (Target_arm::fix_cortex_a8): New method definition.
7530         (Target_arm::Cortex_a8_relocs_info): New type.
7531         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7532         New data member declarations.
7533         (Target_arm::scan_reloc_for_stub): Record information about
7534         relocations for THUMB branches that might be exempted from the
7535         Cortex-A8 workaround.
7536         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7537         at the beginning of a relaxation pass.
7538
7539 2010-01-12  Doug Kwan  <dougkwan@google.com>
7540
7541         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7542         (Arm_relobj::Mapping_symbol_position,
7543          Arm_reloj::Mapping_symbol_position_less,
7544          Arm_relobj::Mapping_symbols_info): New types.
7545         (Target_arm::is_mapping_symbol_name): New method definition.
7546         (Arm_relobj::do_count_local_symbols): Save information about mapping
7547         symbols.
7548
7549 2010-01-11  Doug Kwan  <dougkwan@google.com>
7550
7551         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7552         Arm_relocate_functions::thumb32_branch_upper,
7553         Arm_relocate_functions::thumb32_branch_lower,
7554         Arm_relocate_functions::thumb32_cond_branch_offset,
7555         Arm_relocate_functions::thumb32_cond_branch_upper,
7556         Arm_relocate_functions::thumb32_cond_branch_lower,
7557         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7558         branch offset encoding.
7559         (Arm_relocate_functions::thumb_branch_common): Use new branch
7560         offset encoding methods to avoid code duplication.
7561         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7562         (Stub_addend_reader::operator()): Use new branch encoding method
7563         to avoid code duplication.
7564
7565 2010-01-11  Doug Kwan  <dougkwan@google.com>
7566
7567         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7568         (Target_arm::do_finalize_sections): Define special EXIDX section
7569         symbols only if referenced.
7570         * gc.h (Garbage_collection::add_reference): New method.
7571         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7572         code duplication.
7573
7574 2010-01-11  Ian Lance Taylor  <iant@google.com>
7575
7576         * script.cc (Version_script_info::build_expression_list_lookup):
7577         Change complaing about duplicate wildcard match from error to
7578         warning.
7579
7580         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7581         of 2009-12-30.
7582         (Version_script_info::Version_script_info): Initialize globs_,
7583         default_version_, default_is_global_, and exact_.  Don't
7584         initialize globals_ or locals_.
7585         (Version_script_info::build_lookup_tables): Build local symbols
7586         first.
7587         (Version_script_info::unquote): New function.
7588         (Version_script_info::add_exact_match): New function.
7589         (Version_script_info::build_expression_list_lookup): Remove lookup
7590         parameter.  Add is_global parameter.  Change all callers.  Handle
7591         wildcard pattern specially.  Unquote pattern.  Call
7592         add_exact_match.
7593         (Version_script_info::get_name_to_match): New function.
7594         (Version_script_info::get_symbol_version): New function.
7595         (Version_script_info::get_symbol_version_helper): Remove.
7596         (Version_script_info::check_unmatched_names): Call unquote.
7597         * script.h (class Version_script_info): Change get_symbol_version
7598         to be non-inline and add is_global parameter; change all callers.
7599         Rewrite symbol_is_local.  Update declarations.  Define struct
7600         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7601         Remove globals_ and locals_ members.  Add exact_, globs_,
7602         default_version_, is_global_.
7603         (Version_script_info::Glob): Remove pattern, add expression and
7604         is_global.  Update constructor.  Change all callers.
7605         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7606         default version.
7607         (Versions::symbol_section_contents): If a symbol is undefined, or
7608         defined in a dynamic object, set the version index to
7609         VER_NDX_LOCAL.
7610         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7611         symbol_is_local.
7612         (Symbol_table::add_from_pluginobj): Likewise.
7613         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7614
7615 2010-01-11  Doug Kwan  <dougkwan@google.com>
7616
7617         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7618         (incremental_dump_LDADD): Add linking option for libintl.
7619         * Makefile.in: Regenerate.
7620
7621 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7622
7623         PR gold/11144
7624         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7625         instead of -Ds.
7626         * testsuite/Makefile.in: Regenerated.
7627
7628 2010-01-10  Doug Kwan  <dougkwan@google.com>
7629
7630         * options.h (DEFINE_var): Use parentheses around argument varname__
7631         in macro body to avoid any unintended subsequent substitutions.
7632
7633 2010-01-10  Ian Lance Taylor  <iant@google.com>
7634
7635         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7636         candidates before doing symbol resolution.
7637
7638         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7639         ODR candidates if only one is weak.
7640
7641 2010-01-08  Ian Lance Taylor  <iant@google.com>
7642
7643         * script.cc (Version_script_info::build_expression_list_lookup):
7644         Don't warn about ambiguous version, just record the ambiguity.
7645         (Version_script_info::get_symbol_version_helper): Give error if
7646         version is ambiguous.
7647
7648 2010-01-08  Doug Kwan  <dougkwan@google.com>
7649
7650         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7651         prev_data_size_ and prev_addralign_.  Remove initializer for
7652         deleted data member has_been_changed_.
7653         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7654         to determine if the table is empty.
7655         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7656         Remove.
7657         (Stub_table::add_reloc_stub): Define method in class definition
7658         instead of just declaring it there.
7659         (Stub_table::add_cortex_a8_stub): New method definition.
7660         (Stub_table::update_data_size_and_addralign): Ditto.
7661         (Stub_table::finalize_stubs): Ditto.
7662         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7663         (Stub_table::do_addralign_): Return address alignment in the
7664         (Stub_table::do_reset_address_and_file_offset): Define method in
7665         class definition instead of declaring it there.  Set current data
7666         size to be the data size of the previous pass.
7667         (Stub_table::set_final_data_size): Use current data size as the
7668         final data size.
7669         (Stub_table::relocate_stub): Change parameter type of stub from
7670         Reloc_stub pointer to Stub pointer.
7671         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7672         (Stub_table::Cortex_a8_stub_list): New typedef.
7673         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7674          Stub_table::prev_addralign_): New data member.
7675         (Arm_relobj::Arm_relobj): Initialize data member
7676         section_has_cortex_a8_workaround_.
7677         (Arm_relobj::section_has_cortex_a8_workaround,
7678          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7679          definitions.
7680         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7681         declarations.
7682         (Target_arm::relocate_stub): Change parameter type of stub from
7683         Reloc_stub pointer to Stub pointer.
7684         (Insn_template::size, Insn_template::alignment): Handle
7685         THUMB16_SPECIAL_TYPE.
7686         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7687          Stub_table::update_data_size_and_addralign,
7688          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7689         definitions.
7690         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7691         (Stub_table::do_write): Ditto.
7692         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7693
7694 2010-01-08  Ian Lance Taylor  <iant@google.com>
7695
7696         PR 11108
7697         * symtab.h (class Symbol): Remove fields is_target_special_ and
7698         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7699         (Symbol::is_defined_in_discarded_section): New function.
7700         (Symbol::set_is_defined_in_discarded_section): New function.
7701         (Symbol::has_plt_offset): Rewrite.
7702         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7703         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7704         Don't initialize is_target_special_ or has_plt_offset_.
7705         Initialize is_defined_in_discarded_section_.
7706         (Symbol_table::add_from_relobj): If appropriate, set
7707         is_defined_in_discarded_section.
7708         * resolve.cc (Symbol::override_base_with_special): Don't test
7709         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7710         * target-reloc.h (relocate_section): Do special handling for
7711         symbols defined in discarded sections for global symbols as well
7712         as local symbols.
7713
7714 2010-01-08  Ian Lance Taylor  <iant@google.com>
7715
7716         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7717         the SHT_SYMTAB case.
7718
7719 2010-01-08  Ian Lance Taylor  <iant@google.com>
7720
7721         * object.cc (Sized_relobj::do_layout): Don't get confused if
7722         layout_eh_frame returns NULL.
7723
7724 2010-01-08  Ian Lance Taylor  <iant@google.com>
7725
7726         PR 11084
7727         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7728         dynamic symbol table, use the normal symbol table.
7729         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7730         symbol table.
7731
7732 2010-01-08  Ian Lance Taylor  <iant@google.com>
7733
7734         PR 11072
7735         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7736         sections.
7737
7738 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7739
7740         * version.cc (print_version): Change to "Copyright 2010".
7741
7742 2010-01-08  Ian Lance Taylor  <iant@google.com>
7743
7744         PR 10287
7745         PR 11063
7746         * i386.cc (class Target_i386): Change return type of plt_section
7747         to be non-const.
7748         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7749         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7750         tls_desc_rel_ field.
7751         (Output_data_plt_i386::rel_tls_desc): New function.
7752         (Target_i386::rel_tls_desc_section): New function.
7753         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7754         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7755         R_386_TLS_DESC reloc in rel_tls_desc_section.
7756         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7757         Define struct Tlsdesc_info.
7758         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7759         (Target_x86_64::do_reloc_symbol_index): New function.
7760         (Target_x86_64::add_tlsdesc_info): New function.
7761         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7762         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7763         tlsdesc_rel_ field.
7764         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7765         all callers.
7766         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7767         (Target_x86_64::rela_tlsdesc_section): New function.
7768         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7769         handling.
7770         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7771         (Target_x86_64::do_reloc_addend): New function.
7772         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7773         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7774         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7775         (Output_reloc::type): New function.
7776         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7777         (Output_reloc::is_target_specific): New function.
7778         (Output_reloc::target_arg): New function.
7779         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7780         absolute relocs and target specific relocs.
7781         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7782         add_target_specific.
7783         (class Output_data_reloc) [SHT_RELA]: Likewise.
7784         * output.cc (Output_reloc::Output_reloc): Add four new versions
7785         for absolute relocs and target specific relocs.
7786         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7787         (Output_reloc::get_symbol_index): Likewise.
7788         (Output_reloc::local_section_offset): Check that local_sym_index_
7789         is not TARGET_CODE or 0.
7790         (Output_reloc::symbol_value): Likewise.
7791         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7792         reloc.
7793         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7794         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7795         functions.
7796         * layout.cc (add_target_dynamic_tags): Use output section for
7797         DT_PLTRELSZ and DT_JMPREL.
7798
7799 2010-01-07  Ian Lance Taylor  <iant@google.com>
7800
7801         PR 11061
7802         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7803         function.
7804         (class Output_data_reloc_generic): Define.
7805         (class Output_data_reloc_base): Change base class to
7806         Output_data_reloc_generic.  Change add() method to call
7807         bump_relative_reloc_count for a relative reloc.  Remove
7808         sort_relocs_ field.
7809         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7810         to sort_relocs().
7811         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7812         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7813         appropriate.
7814         * layout.h (class Layout): Update declaration.
7815
7816 2010-01-07  Ian Lance Taylor  <iant@google.com>
7817
7818         * output.h (class Output_data): Add const version of
7819         output_section and do_output_section.
7820         (class Output_section_data): Add const version of
7821         do_output_section.
7822         (class Output_section): Likewise.
7823         * layout.cc (Layout::add_target_dynamic_tags): New function.
7824         * layout.h (class Layout): Update declarations.
7825         * arm.cc (Target_arm::do_finalize_sections): Use
7826         add_target_dynamic_tags.
7827         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7828         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7829         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7830         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7831
7832 2010-01-07  Ian Lance Taylor  <iant@google.com>
7833
7834         PR 11042
7835         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7836         object as needed.
7837
7838 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7839             Ian Lance Taylor  <iant@google.com>
7840
7841         PR 11019
7842         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7843         Xindex::read_symtab_xindex.
7844
7845 2010-01-07  Doug Kwan  <dougkwan@google.com>
7846
7847         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7848         (Insn_template::thumb16_bcond_insn): New method declaration.
7849         (Insn_template): Fix spelling.
7850         (Stub::thumb16_special): New method declaration.
7851         (Stub::do_write): Define virtual method which was previously pure
7852         virtual.
7853         (Stub::do_thumb16_special): New method declaration.
7854         (Stub::do_fixed_endian_write): New template member.
7855         (Reloc_stub::do_write): Remove.
7856         (Reloc_stub::do_fixed_endian_write): Remove.
7857         (Cortex_a8_stub): New class definition.
7858         (Stub_factory::make_cortex_a8_stub): New method definition.
7859         (Stub_factory::Stub_factory): Add missing static storage class
7860         qualifier for elf32_arm_stub_a8_veneer_blx.
7861
7862 2010-01-07  Ian Lance Taylor  <iant@google.com>
7863
7864         PR 10980
7865         * options.h (class General_options): Add --warn-unresolved-symbols
7866         and --error-unresolved-symbols.
7867         * errors.cc (Errors::undefined_symbol): Implement
7868         --warn-unresolved-symbols.
7869
7870         * options.h (class General_options): Add -z text and -z textoff.
7871         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7872
7873 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7874
7875         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7876         (Garbage_collection::cident_sections): New function.
7877         (Garbage_collection::add_cident_section): New function.
7878         (Garbage_collection::cident_sections_): New member.
7879         (gc_process_relocs): Add references to sections whose names are C
7880         identifiers.
7881         * gold.h (cident_section_start_prefix): New constant.
7882         (cident_section_stop_prefix): New constant.
7883         (is_cident): New function.
7884         * layout.cc (Layout::define_section_symbols): Replace string constants
7885         with the newly defined constants.
7886         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7887         C identifiers.
7888         * testsuite/Makefile.am: Add gc_orphan_section_test.
7889         * testsuite/Makefile.in: Regenerate.
7890         * testsuite/gc_orphan_section_test.cc: New file.
7891         * testsuite/gc_orphan_section_test.sh: New file.
7892
7893 2010-01-06  Ian Lance Taylor  <iant@google.com>
7894
7895         PR 10980
7896         * options.h (class General_options): Add --warn-shared-textrel.
7897         * layout.cc (Layout::finish_dynamic_section): Implement
7898         --warn-shared-textrel.
7899
7900         PR 10980
7901         * options.h (class General_options): Add --warn-multiple-gp.
7902
7903 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7904
7905         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7906         $(THREADSLIB) and $(LIBDL).
7907         * Makefile.in: Rebuild.
7908
7909 2010-01-06  Ian Lance Taylor  <iant@google.com>
7910
7911         PR 10980
7912         * options.cc (General_options::parse_section_start): New function.
7913         (General_options::section_start): New function.
7914         (General_options::General_options): Initialize all members.
7915         * options.h: Include <map>
7916         (class General_options): Add --section-start.  Add section_starts_
7917         member.
7918         * layout.cc (Layout::attach_allocated_section_to_segment): If
7919         --section-start was used, set the address of the segment.  Remove
7920         local sort_sections.
7921         (Layout::relaxation_loop_body): If the address of the load segment
7922         has been set by --section-start, don't use it.
7923         * output.h (Output_segment::update_flags_for_output_section): New
7924         function.
7925         * output.cc (Output_segment::add_output_section): Call
7926         update_flags_for_output_section.
7927
7928 2010-01-05  Ian Lance Taylor  <iant@google.com>
7929
7930         PR 10980
7931         * options.h (class General_options): Add --undefined-version.
7932         * script.cc (struct Version_expression): Add was_matched_by_symbol
7933         field.
7934         (Version_script_info::matched_symbol): New function.
7935         (Version_script_info::get_symbol_version_helper): Call
7936         matched_symbol.
7937         (Version_script_info::check_unmatched_names): New function.
7938         * script.h (class Version_script_info): Update declarations.
7939         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7940
7941         * options.h (class General_options): Use DEFINE_bool_alias for
7942         allow_multiple_definition.
7943         * resolve.cc (Symbol_table::should_override): Don't test
7944         allow_multiple_definition.
7945
7946         PR 10980
7947         * options.h (class General_options): Add --cref.
7948         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7949         until after printing cref table.
7950         * cref.cc: Include "symtab.h".
7951         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7952         (Cref_table_compare::operator()): New function.
7953         (Cref_inputs::gather_cref): New function.
7954         (filecol): New static const.
7955         (Cref_inputs::print_cref): New function.
7956         (Cref::print_cref): New function.
7957         * cref.h: Include <cstdio>.
7958         (class Cref): Update declarations.
7959         * mapfile.h (Mapfile::file): New function.
7960         * object.h (class Object): Define Symbols.  Declare virtual
7961         do_get_global_symbols.
7962         (Object::get_global_symbols): New function.
7963         * object.cc (Input_objects::add_object): Pass object to cref_ if
7964         --cref.
7965         (Input_objects::archive_start): Likewise.
7966         (Input_objects::archive_stop): Likewise.
7967         (Input_objects::print_cref): New function.
7968         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7969         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7970         --cref.
7971         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7972         function.
7973         * plugin.h (class Sized_pluginobj): Update declarations.
7974
7975 2010-01-05  Ian Lance Taylor  <iant@google.com>
7976
7977         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7978         to is_default_version.  Rename insdef to insdefault.
7979         (Symbol_table::add_from_relobj): Rename def to is_default_version
7980         and local to is_forced_local.
7981         (Symbol_table::add_from_pluginobj): Likewise.
7982         (Symbol_table::add_from_dynobj): Likewise.
7983         (Symbol_table::define_special_symbol): Rename insdef to
7984         insdefault.
7985
7986 2010-01-04  Ian Lance Taylor  <iant@google.com>
7987
7988         PR 10980
7989         * options.h (class General_options): Add
7990         --allow-multiple-definition and -z muldefs.
7991         * resolve.cc (Symbol_table::should_override): Don't warn about a
7992         multiple symbol definition if --allow-multiple-definition or -z
7993         muldefs.
7994
7995         PR 10980
7996         * options.h (class General_options): Add --add-needed and
7997         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7998         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7999         error if --copy-dt-needed-entries aka --add-needed is used and
8000         would cause a change in behaviour.
8001
8002         PR 10980
8003         * options.h (class General_options): Add -G as a short version of
8004         --shared.  Add no-op options -assert, -g, and -i.
8005
8006 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8007
8008         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8009         check for .text or .gnu.linkonce.t sections.
8010         * icf.cc (Icf::find_identical_sections): Ditto.
8011         Change the detection for mangled function name within the section
8012         name.
8013         * icf.h (is_section_foldable_candidate): New function.
8014
8015 2009-12-30  Ian Lance Taylor  <iant@google.com>
8016
8017         PR 10980
8018         * options.h (class General_options): Permit two dashes with
8019         --retain-symbols-file.
8020
8021 2009-12-30  Ian Lance Taylor  <iant@google.com>
8022
8023         PR 10979
8024         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8025         don't put the file header and segment headers in the text
8026         segment.
8027
8028         PR 10979
8029         * common.cc (Sort_commons::operator()): Stabilize sort when both
8030         entries are NULL.
8031         (Symbol_table::do_allocate_commons_list): When allocating common
8032         symbols, skip a symbol which is no longer common.
8033         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8034         an object before checking its type.
8035         * testsuite/common_test_2.c: New file.
8036         * testsuite/common_test_3.c: New file.
8037         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8038         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8039         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8040         (common_test_2_pic.o, common_test_2.so): New targets.
8041         (common_test_3_pic.o, common_test_3.so): New targets.
8042         * testsuite/Makefile.in: Rebuild.
8043
8044         PR 10979
8045         * script.cc (read_input_script): If we see a new SECTIONS clause,
8046         and we have added an input section, give an error.
8047         * layout.h (class Layout): Add have_added_input_section function.
8048         Add have_added_input_section_ field.
8049         * layout.cc (Layout::Layout): Initialize
8050         have_added_input_section_.
8051         (Layout::layout): Set have_added_input_section_.
8052         (Layout::layout_eh_frame): Likewise.
8053
8054 2009-12-30  Ian Lance Taylor  <iant@google.com>
8055
8056         PR 10931
8057         * options.h (class General_options): Add --sort-common option.
8058         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8059         * common.cc (Sort_common): Add sort_order parameter to
8060         constructor.  Add sort_order_ field.
8061         (Sort_commons::operator): Check sort_order_.
8062         (Symbol_table::allocate_commons): Determine the sort order.
8063         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8064         Change all callers.
8065         (Symbol_table::do_allocate_commons_list): Likewise.
8066
8067 2009-12-30  Ian Lance Taylor  <iant@google.com>
8068
8069         PR 10916
8070         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8071         symbols from this object, don't change the visibility of an
8072         undefined symbol.
8073         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8074
8075 2009-12-30  Ian Lance Taylor  <iant@google.com>
8076
8077         PR 10861
8078         * script.h (class Version_script_info): Define Language enum.
8079         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8080         new fields globals_, locals_, and is_finalized_.
8081         * script.cc: Various formatting fixes.
8082         (class Parser_closure): Change language_stack_ from a vector of
8083         std::string to one of Version_script_info::Language.  Adjust all
8084         uses accordingly.
8085         (class Lazy_demangler): Remove.
8086         (struct Version_expression): Change language from std::string to
8087         Version_script_info::Language.
8088         (Version_script_info::Version_script_info): New function.
8089         (Version_script_info::~Version_script_info): Don't call clear.
8090         (Version_script_info::finalize): New function.
8091         (Version_script_info::build_lookup_tables): New function.
8092         (Version_script_info::build_expression_list_lookup): New
8093         function.
8094         (Version_script_info::get_symbol_version_helper): Rewrite to use
8095         lookup tables.
8096         (Version_script_info::print_expression_list): Adjust to use
8097         Version_script_info::Language.
8098         (script_push_lex_into_version_mode): Check that the version script
8099         has not been finalized.
8100         (version_script_push_lang): Change language string to
8101         Version_script_info::Language.
8102         * options.cc (Command_line::version_script): New function.
8103         * options.h (class General_options): Add finalize_dynamic_list
8104         function.  Change version_script from declaration to definition.
8105         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8106         * testsuite/version_script.map: Remove duplicate def of foo.
8107         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8108         version_script.map.
8109         * testsuite/Makefile.in: Rebuild.
8110
8111 2009-12-30  Ian Lance Taylor  <iant@google.com>
8112
8113         PR 10843
8114         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8115         if the input symbol index is 0, make the output symbol index 0.
8116
8117 2009-12-30  Ian Lance Taylor  <iant@google.com>
8118
8119         PR 10670
8120         * options.h (class General_options): Add -x/--discard-all.
8121         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8122         --discard-all.  If the local symbol needs a dynamic entry, check
8123         that before handling --discard-locals.
8124
8125 2009-12-30  Ian Lance Taylor  <iant@google.com>
8126
8127         PR 10450
8128         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8129         flags to PF_R.
8130         (Output_segment::add_output_section): Don't change the flags if
8131         the type is PT_TLS.
8132
8133         PR 10450
8134         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8135         GNU hash table if they need a dynamic value.  Otherwise, don't add
8136         them if they are defined in a dynamic object or are forced local.
8137
8138 2009-12-29  Ian Lance Taylor  <iant@google.com>
8139
8140         PR 10450
8141         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8142         .gnu.hash table for a 32-bit target.
8143
8144         PR 10450
8145         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8146         regular and a dynamic object only needs a dynamic symbol table
8147         entry if it is externally visible.
8148
8149         PR 10450
8150         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8151         constructor.  Add global_offset_table_ field.
8152         (Target_i386::got_section): Set global_offset_table_.
8153         (Target_i386::do_finalize_sections): Set global_offset_table_
8154         size.
8155         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8156         in constructor.  Add global_offset_table_ field.
8157         (Target_x86_64::got_section): Set global_offset_table_.
8158         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8159         size.
8160
8161         * layout.cc (Layout::Layout): Initialize increase_relro_.
8162         (Layout::get_output_section): Add is_relro, is_last_relro, and
8163         is_first_non_relro parameters.  Change all callers.
8164         (Layout::choose_output_section): Likewise.
8165         (Layout::add_output_section_data): Likewise.
8166         (Layout::make_output_section): Likewise.
8167         (Layout::set_segment_offsets): Clear increase_relro when using a
8168         linker script.
8169         * layout.h (class Layout): Add increase_relro method.  Add
8170         increase_relro_ field.  Update declarations.
8171         * output.cc (Output_section::Output_section): Initialize
8172         is_last_relro_ and is_first_non_relro_.
8173         (Output_segment::add_output_section): Group relro sections is
8174         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8175         (Output_segment::maximum_alignment): Remove relro handling.
8176         (Output_segment::set_section_addresses): Add increase_relro
8177         parameter.  Change all callers.  Add initial alignment to align
8178         relro sections on separate page.  Remove old relro handling.
8179         (Output_segment::set_section_list_addresses): Remove in_relro
8180         parameter.  Change all callers.
8181         (Output_segment::set_offset): Add increase parameter.  Change all
8182         callers.  Remove old relro handling.
8183         * output.h (class Output_section): Add new methods: is_last_relro,
8184         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8185         Add is_last_relro_ and is_first_non_relro_ fields.
8186         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8187         Create separate .got.plt section.  Call increase_relro.
8188         * x86_64.cc (Target_x86_64::got_section): Likewise.
8189         * testsuite/relro_script_test.t: Add .got.plt.
8190
8191         PR 10450
8192         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8193         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8194         (Layout::finalize): Call set_dynamic_symbol_size.
8195         (Layout::set_dynamic_symbol_size): New function.
8196         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8197         set_dynamic_symbol_size.
8198
8199         PR 10450
8200         * output.h (class Output_section): Add is_entsize_zero_ field.
8201         * output.cc (Output_section::Output_section): Initialize
8202         is_entsize_zero_.
8203         (Output_section::set_entsize): If two different entsizes are
8204         requested, force it to zero.
8205         (Output_section::add_input_section): Set flags for .debug_str
8206         before updating section flags.  Set entsize.
8207         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8208         and SHF_STRING if all input sections have those flags.
8209
8210 2009-12-29   Rafael Espindola  <espindola@google.com>
8211
8212         * main.cc (main): Fix the sys time reporting.
8213         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8214         reporting.
8215
8216 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8217
8218         * options.cc (General_options::parse_version): Allow -v to exit
8219         without an error if there is nothing to link.
8220
8221 2009-12-29  Ian Lance Taylor  <iant@google.com>
8222
8223         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8224         using a version of gcc before 4.1.
8225         * configure: Rebuild.
8226
8227 2009-12-28  Chris Demetriou  <cgd@google.com>
8228
8229         * attributes.cc (Output_attributes_section_data::do_write): Use
8230         std::vector::front rather than std::vector::data.
8231
8232 2009-12-28  Ian Lance Taylor  <iant@google.com>
8233
8234         * symtab.h (class Symbol_table): Add enum Defined.
8235         * resolve.cc (Symbol_table::should_override): Add defined
8236         parameter.  Change all callers.  Test whether object is NULL
8237         before calling a method on it.
8238         (Symbol_table::report_resolve_problem): Add defined parameter.
8239         Change all callers.
8240         (Symbol_table::should_override_with_special): Likewise.
8241         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8242         parameter.  Change all callers.
8243         (Symbol_table::do_define_in_output_data): Likewise.
8244         (Symbol_table::define_in_output_segment): Likewise.
8245         (Symbol_table::do_define_in_output_segment): Likewise.
8246         (Symbol_table::define_as_constant): Likewise.
8247         (Symbol_table::do_define_as_constant): Likewise.
8248         * script.h (class Symbol_assignment): Add is_defsym parameter to
8249         constructor; change all callers.
8250         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8251         parameter.  Change all callers.  Add is_defsym_ field.
8252         (class Parser_closure): Add parsing_defsym parameter to
8253         constructor; change all callers.  Add parsing_defsym accessor
8254         function.  Add parsing_defsym_ field.
8255
8256 2009-12-28  Ian Lance Taylor  <iant@google.com>
8257
8258         * gold.cc (queue_middle_tasks): Fix formatting.
8259         * object.cc (Relobj::is_section_name_included): Likewise.
8260
8261 2009-12-23  Ian Lance Taylor  <iant@google.com>
8262
8263         * i386.cc (Target_i386::do_calls_non_split): Recognize
8264         -fsplit-stack prologue for a function with a static chain.
8265         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8266         -fsplit-stack prologue when using %r11.
8267
8268 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8269
8270         * options.cc (General_options::parse_version): Make -v continue and do
8271         the link like GNU ld does.
8272
8273 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8274
8275         * Makefile.am (CCFILES): Add timer.cc.
8276         (HFILES): Add timer.h.
8277         * configure.ac: Check for sysconf and times.
8278         * main.cc: include timer.h.
8279         (main): Use Timer instead of get_run_time.
8280         * timer.cc: New.
8281         * timer.h: New.
8282         * workqueue.cc: include timer.h.
8283         (Workqueue::find_and_run_task):
8284         Report user, sys and wall time.
8285         * Makefile.in: Regenerate.
8286         * config.in: Regenerate.
8287         * configure: Regenerate.
8288
8289 2009-12-16  Doug Kwan  <dougkwan@google.com>
8290
8291         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8292         sections.
8293         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8294         relaxed input sections.
8295         * output.cc (Output_section::find_relaxed_input_section): Change
8296         return type to Output_relaxed_input_section pointer.  Adjust code
8297         for new type of relaxed_input_section_map_.
8298         * output.h (Output_section::find_relaxed_input_section): Change
8299         return type to Output_relaxed_input_section pointer.
8300         (Output_section::Output_relaxed_input_section_by_input_section_map):
8301         New type.
8302         (Output_section::relaxed_input_section_map_): Change type to
8303         Output_section::Output_relaxed_input_section_by_input_section_map.
8304         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8305         input section.
8306
8307 2009-12-15  Ian Lance Taylor  <iant@google.com>
8308
8309         * layout.cc (Layout::create_shstrtab): Only write out after input
8310         sections if we are compressing debug sections.
8311
8312 2009-12-15  Ian Lance Taylor  <iant@google.com>
8313
8314         * archive.cc (Archive::add_symbols): Only look up a symbol without
8315         a version if there is, in fact, a version.
8316
8317 2009-12-14  Ian Lance Taylor  <iant@google.com>
8318
8319         Revert -Wshadow changes, all changes from:
8320         2009-12-11  Doug Kwan  <dougkwan@google.com>
8321         2009-12-11  Nick Clifton  <nickc@redhat.com>
8322         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8323
8324 2009-12-11  Doug Kwan  <dougkwan@google.com>
8325
8326         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8327         due to -Wshadow.
8328         * attributes.cc (Object_attribute::size): Ditto.
8329         (Attributes_section_data::size): Ditto.
8330         (Attributes_section_data::Attributes_section_data): Ditto.
8331         (Output_attributes_section_data::do_write): Ditto.
8332         * attributes.h (Object_attribute::set_type): Ditto.
8333         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8334
8335 2009-12-11  Nick Clifton  <nickc@redhat.com>
8336
8337         * archive.cc: Fix shadowed variable warnings.
8338         * arm.cc: Likewise.
8339         * compressed_output.cc: Likewise.
8340         * compressed_output.h: Likewise.
8341         * configure: Likewise.
8342         * dwarf_reader.cc: Likewise.
8343         * dynobj.cc: Likewise.
8344         * dynobj.h: Likewise.
8345         * ehframe.cc: Likewise.
8346         * ehframe.h: Likewise.
8347         * errors.cc: Likewise.
8348         * expression.cc: Likewise.
8349         * fileread.cc: Likewise.
8350         * fileread.h: Likewise.
8351         * freebsd.h: Likewise.
8352         * i386.cc: Likewise.
8353         * icf.cc: Likewise.
8354         * incremental.h: Likewise.
8355         * layout.cc: Likewise.
8356         * layout.h: Likewise.
8357         * mapfile.cc: Likewise.
8358         * merge.cc: Likewise.
8359         * merge.h: Likewise.
8360         * object.cc: Likewise.
8361         * object.h: Likewise.
8362         * options.h: Likewise.
8363         * output.cc: Likewise.
8364         * output.h: Likewise.
8365         * parameters.cc: Likewise.
8366         * plugin.cc: Likewise.
8367         * powerpc.cc: Likewise.
8368         * reduced_debug_output.cc: Likewise.
8369         * reduced_debug_output.h: Likewise.
8370         * reloc.cc: Likewise.
8371         * reloc.h: Likewise.
8372         * resolve.cc: Likewise.
8373         * script-sections.cc: Likewise.
8374         * script.cc: Likewise.
8375         * script.h: Likewise.
8376         * sparc.cc: Likewise.
8377         * symtab.cc: Likewise.
8378         * symtab.h: Likewise.
8379         * target-select.cc: Likewise.
8380         * target-select.h: Likewise.
8381         * token.h: Likewise.
8382         * workqueue.cc: Likewise.
8383         * workqueue.h: Likewise.
8384         * x86_64.cc: Likewise.
8385
8386 2009-12-10  Doug Kwan  <dougkwan@google.com>
8387
8388         * arm.cc (attributes.h): New include.
8389         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8390         (Arm_relobj::~Arm_relobj): Delete object pointed by
8391         attributes_section_data_.
8392         (Arm_relobj::attributes_section_data): New method definition.
8393         (Arm_relobj::attributes_section_data_): New data member declaration.
8394         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8395         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8396         attributes_section_data_.
8397         (Arm_dynobj::attributes_section_data): New method definition.
8398         (Arm_dynobj::attributes_section_data_): New data member declaration.
8399         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8400         initialization value of may_use_blx_ to false.
8401         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8402         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8403         object attributes to compute results instead of hard-coding.
8404         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8405         Target_arm::get_secondary_compatible_arch,
8406         Target_arm::set_secondary_compatible_arch
8407         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8408         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8409         New method declarations.
8410         (Target_arm::get_aeabi_object_attribute): New method definition.
8411         (Target_arm::attributes_section_data_): New data member declaration.
8412         (read_arm_attributes_section): New template definition.
8413         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8414         (Arm_dynobj::do_read_symbols): Ditto.
8415         (Target_arm::do_finalize_sections): Merge attributes sections from
8416         input.  Check for BLX use after attributes section merging.
8417         Fix __exidx_start and __exidx_end visibility.  Create an
8418         .ARM.attributes section if necessary.
8419         (Target_arm::get_secondary_compatible_arch,
8420         Target_arm::set_secondary_compatible_arch,
8421         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8422         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8423         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8424         New method definitions.
8425
8426 2009-12-09  Ian Lance Taylor  <iant@google.com>
8427
8428         * plugin.cc (Plugin::load): Don't cast from void* to a function
8429         pointer.
8430
8431 2009-12-09  Ian Lance Taylor  <iant@google.com>
8432
8433         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8434         information fields.
8435
8436 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8437
8438         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8439         Replace two_file_shared_1.so with two_file_shared_2.so.
8440         * testsuite/Makefile.in: Regenerated.
8441
8442 2009-12-08  Doug Kwan  <dougkwan@google.com>
8443
8444         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8445         (HFILES): Add attributes.h and int_encoding.h.
8446         * Makefile.in: Regenerate.
8447         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8448         function definitions to int_encoding.cc
8449         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8450         prototypes to int_encoding.h
8451         * reduced_debug_output.cc (int_encoding.h): New include.
8452         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8453         function definitions to int_encoding.cc
8454         (insert_into_vector, read_from_pointer): Move template definitions to
8455         int_encoding.h
8456         * attributes.cc: New file.
8457         * attributes.h: New file.
8458         * int_encoding.cc: New file.
8459         * int_encoding.h: New file.
8460
8461 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8462
8463         PR gold/11055
8464         * incremental-dump.cc (dump_incremental_inputs): New.
8465         (main): Use dump_incremental_inputs.
8466
8467 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8468
8469         PR gold/10893
8470         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8471         checking elfcpp::STT_FUNC.
8472         (Target_i386::Relocate::relocate): Likewise.
8473         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8474
8475         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8476         symbols from shared libraries into normal FUNC symbols.
8477
8478         * symtab.h (Symbol): Add is_func and use it.
8479
8480 2009-12-05  Doug Kwan  <dougkwan@google.com>
8481
8482         * arm.cc (Target_arm::arm_info): Initialize new fields
8483         attributes_section and attributes_vendor.
8484         * i386.cc (Target_i386::i386_info): Same.
8485         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8486         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8487         fields attributes_section and attributes_vendor.
8488         * sparc.cc (Target_sparc::sparc_info): Same.
8489         * target.h (Target::attributes_section, Target::attributes_vendor,
8490         Target::is_attributes_section, Target::attribute_arg_type,
8491         Target::attributes_order): New method definitions.
8492         (Target::Target_info::attributes_section,
8493         Target::Target_info::attributes_vendor): New fields.
8494         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8495         virtual method definitions.
8496         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8497         attributes_section and attributes_vendor.
8498         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8499
8500 2009-12-05  Doug Kwan  <dougkwan@google.com>
8501
8502         * arm.cc: Update comments about interworking and stub generation.
8503         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8504         considered as non-PIC.
8505         (Arm_relocate_functions::base_abs): Fix formatting.
8506         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8507         of function to use GOT entry address instead of offset.
8508         (Target_arm::Scan::global): Issue an error if a symbol would need a
8509         PLT does not get one because it is untyped.  Remove code to create
8510         dynamic symbols for relative branches.
8511         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8512         takes unsigned integer instead of boolean.
8513
8514 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8515
8516         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8517         (two_file_test_LDADD): Likewise.
8518         (common_test_1_LDADD): Likewise.
8519         (exception_test_LDADD) Likewise.
8520         (weak_test_LDADD): Likewise.
8521         (many_sections_test_LDADD): Likewise.
8522         (initpri1_LDADD): Likewise.
8523         (script_test_1_LDADD): Likewise.
8524         (script_test_2_LDADD): Likewise.
8525         (justsyms_LDADD): Likewise.
8526         (binary_test_LDADD): Likewise.
8527         (large_LDADD): Likewise.
8528         * testsuite/Makefile.in: Regenerated.
8529
8530 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8531
8532         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8533         (Symbol_table::override_with_special): Likewise.
8534         (Symbol_table::add_from_object): Likewise.
8535
8536 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8537
8538         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8539         Don't set the data_offset twice.
8540
8541 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8542
8543         * testsuite/Makefile.in: Regenerate.
8544
8545 2009-12-03  Doug Kwan  <dougkwan@google.com>
8546
8547         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8548         (Target_arm::do_finalize_sections): Add parameter for symbol table
8549         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8550         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8551         parameter for symbol table pointer.
8552         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8553         an additional parameter for a pointer to symbol table.
8554         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8555         parameter for a symbol table pointer.
8556         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8557         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8558         Ditto.
8559         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8560         parameter for a symbol table pointer.
8561
8562 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8563
8564         * incremental.cc (Incremental_inputs_header)
8565         (Incremental_inputs_header_write, Incremental_inputs_entry)
8566         (Incremental_inputs_entry_write): Move ...
8567         * incremental.h (Incremental_inputs_header)
8568         (Incremental_inputs_header_write, Incremental_inputs_entry)
8569         (Incremental_inputs_entry_write): here.
8570
8571 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8572
8573         * incremental.cc (make_sized_incremental_binary): Set the target.
8574         Error if it is incompatible.
8575         * output.h (Output_file): Add filename method.
8576
8577 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8578
8579         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8580         from the get_* methods.
8581
8582 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8583
8584         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8585         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8586         Write 0 for the data_offset of scripts.
8587
8588 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8589
8590         * testsuite/Makefile.am: Add the incremental_test.sh test.
8591         * testsuite/incremental_test.sh: New.
8592         * testsuite/incremental_test_1.c: New.
8593         * testsuite/incremental_test_2.c: New.
8594
8595 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8596
8597         * incremental-dump.cc (main): Fix typos.
8598
8599 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8600
8601         PR gold/11025
8602         * incremental-dump.cc (main): Use llu to print 64 bit values.
8603
8604 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8605             H.J. Lu  <hongjiu.lu@intel.com>
8606
8607         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8608         $(LIBDL).
8609         (incremental_dump_LDADD): Likewise.
8610         * Makefile.in: Regenerated.
8611
8612 2009-11-25  Doug Kwan  <dougkwan@google.com>
8613
8614         Revert:
8615
8616         2009-11-25  Doug Kwan  <dougkwan@google.com>
8617
8618                 * arm.cc (Target_arm::Target_arm): Move method definition
8619                 outside of class definition.  Add code to handle
8620                 --target1-rel, --target1-abs and --target2= options.
8621                 (Target_arm::get_reloc_reloc_type): Change method to be
8622                 non-static and const.
8623                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8624                 New data member declaration.
8625                 (Target_arm::Scan::local, Target_arm::Scan::global,
8626                 Target_arm::Relocate::relocate,
8627                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8628                 Adjust call to Target_arm::get_real_reloc_type.
8629                 (Target_arm::get_real_reloc_type): Use command line options
8630                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8631                 * options.h (--target1-rel, --target1-abs, --target2): New
8632                 ARM-only options.
8633
8634 2009-11-25  Doug Kwan  <dougkwan@google.com>
8635
8636         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8637         class definition.  Add code to handle --target1-rel, --target1-abs
8638         and --target2= options.
8639         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8640         and const.
8641         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8642         member declaration.
8643         (Target_arm::Scan::local, Target_arm::Scan::global,
8644         Target_arm::Relocate::relocate,
8645         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8646         call to Target_arm::get_real_reloc_type.
8647         (Target_arm::get_real_reloc_type): Use command line options to
8648         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8649         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8650         options.
8651
8652 2009-11-25  Doug Kwan  <dougkwan@google.com>
8653
8654         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8655         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8656         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8657         formatting.
8658         (Arm_relocate_functions::thm_call): Replace body with a call to
8659         Arm_relocate_functions::thumb_branch_common.
8660         (Arm_relocate_functions::thm_jump24,
8661         Arm_relocate_functions::thm_xpc22): New method definitions.
8662         (Arm_relocate_functions::thumb_branch_common): New method definition.
8663         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8664         operator.
8665         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8666         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8667
8668 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8669
8670         * Makefile.am: Build incremental-dump
8671         * Makefile.in: Regenerate.
8672         * incremental-dump.cc: New.
8673         * incremental.cc (Incremental_inputs_header_data,
8674         Incremental_inputs_entry_data): Move to incremental.h
8675         * incremental.h: (Incremental_inputs_header_data,
8676         Incremental_inputs_entry_data): Move from incremental.cc
8677
8678 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8679
8680         * incremental.cc (Incremental_inputs_header,
8681         Incremental_inputs_header_write, Incremental_inputs_entry,
8682         Incremental_inputs_entry_write): Add a typedef with the data type.
8683
8684 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8685
8686         * incremental.cc (Incremental_inputs_header,
8687         Incremental_inputs_header_write, Incremental_inputs_entry,
8688         Incremental_inputs_entry_write): Update comment about which
8689         type has the filed descriptions.
8690
8691 2009-11-15  Doug Kwan  <dougkwan@google.com>
8692
8693         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8694         (Arm_relocate_functions::arm_branch_common): Change method defintion
8695         in class definition to a method declaration and update list of formal
8696         parameters.
8697         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8698         Arm_relocation_functions::jump24): Adjust call to
8699         Arm_relocate_functions::arm_branch_common.  Update list of formal
8700         parameters.
8701         (Arm_relocate_functions::xpc25): New method definition.
8702         (Arm_relocate_functions::arm_branch_common): Move method defintion
8703         out from class definition.  Use stubs for mode-switching and extending
8704         branch ranges.
8705         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8706         specially.  Change code to enable use of stubs in ARM branches.
8707
8708 2009-11-10  Doug Kwan  <dougkwan@google.com>
8709
8710         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8711         in method declaration.
8712         (Target_arm::relocate_stub): New method declaration.
8713         (Target_arm::default_target): Change to return a pointer instead of
8714         a const reference.
8715         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8716         Target_arm::default_target.
8717         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8718         method definition.
8719         (Target_arm::relocate_section): Adjust view.
8720         (Target_arm::relocate_stub): New method definition.
8721
8722 2009-11-10  Doug Kwan  <dougkwan@google.com>
8723
8724         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8725         a format warning.
8726         * incremental.cc (open_incremental_binary): Initialized local
8727         variables to avoid warnings.
8728         * object.cc (make_elf_object): Ditto.
8729         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8730         a format warning.
8731
8732 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8733
8734         PR gold/10930
8735         * testsuite/plugin_test.c: Include "config.h".
8736
8737 2009-11-09  Doug Kwan  <dougkwan@google.com>
8738
8739         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8740         (arm_symbol_value): Remove.
8741         (Arm_relocate_functions::arm_branch_common,
8742         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8743         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8744         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8745         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8746         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8747         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8748         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8749         Arm_relocate_functions::thm_mobw_abs_nc,
8750         Arm_relocate_functions::thm_mov_abs,
8751         Arm_relocate_functions::movw_prel_nc,
8752         Arm_relocate_functions::thm_movt_abs,
8753         Arm_relocate_functions::movt_prel,
8754         Arm_relocate_functions::thm_movw_prel_nc,
8755         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8756         (Target_arm::Relocate::relocate): Only decompose address into two
8757         parts if relocation type uses the thumb-bit and pass the actual
8758         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8759         calls to methods in Arm_relocate_functions for this change.
8760
8761 2009-11-08  Ian Lance Taylor  <iant@google.com>
8762
8763         PR 10925
8764         * reloc.cc: Instantiate
8765         Sized_relobj::initialize_input_to_output_maps and
8766         Sized_relobj:free_input_to_output_maps.
8767
8768 2009-11-06  Ian Lance Taylor  <iant@google.com>
8769
8770         PR 10876
8771         * defstd.cc (in_segment): Set only_if_ref true for "end".
8772
8773 2009-11-06  Doug Kwan  <dougkwan@google.com>
8774
8775         * arm.cc (class Reloc_stub): Correct a comment.
8776         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8777         (Target_arm::scan_section_for_stubs): New method declaration.
8778         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8779         Change methods from private to protected.
8780         (Target_arm::do_may_relax): New method definition.
8781         (Target_arm::do_relax, Target_arm::group_sections,
8782         Target_arm::scan_reloc_for_stub,
8783         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8784         (Target_arm::arm_input_section_map_): New data member declaration.
8785         (Target_arm::scan_reloc_for_stub,
8786         Target_arm::scan_reloc_section_for_stubs,
8787         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8788         Target_arm::do_relax): New method definitions.
8789
8790 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8791
8792         * configure.ac: Check for (struct stat)::st_mtim
8793         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8794         * config.in: Regenerate.
8795         * configure: Regenerate.
8796
8797 2009-11-05  Ian Lance Taylor  <iant@google.com>
8798
8799         PR 10910
8800         * output.cc (Output_segment::add_output_section): Add missing
8801         return statement.
8802
8803 2009-11-04  Ian Lance Taylor  <iant@google.com>
8804
8805         PR 10880
8806         * object.h (class Object): Add is_needed and set_is_needed
8807         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8808         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8809         defined in a dynamic object and referenced by a regular object,
8810         set is_needed for the dynamic object.
8811         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8812         if the file is marked with as_needed and it is not needed.
8813
8814 2009-11-04  Ian Lance Taylor  <iant@google.com>
8815
8816         PR 10887
8817         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8818         tags if data is discarded by linker script.
8819         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8820         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8821         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8822         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8823
8824 2009-11-04  Ian Lance Taylor  <iant@google.com>
8825
8826         * layout.cc (Layout::get_output_section): Add is_interp and
8827         is_dynamic_linker_section parameters.  Change all callers.
8828         (Layout::choose_output_section): Likewise.
8829         (Layout::make_output_section): Likewise.
8830         (Layout::add_output_section_data): Add is_dynamic_linker_section
8831         parameter.  Change all callers.
8832         * layout.h (class Layout): Update declarations.
8833         * output.h (class Output_section): Add is_interp, set_is_interp,
8834         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8835         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8836         generate_code_fills_at_write_ to a bitfield.
8837         * output.cc (Output_section::Output_sections): Initialize new
8838         fields.
8839         (Output_segment::add_output_section): Add do_sort parameter.
8840         Change all callers.
8841
8842 2009-11-03  Ian Lance Taylor  <iant@google.com>
8843
8844         PR 10860
8845         * options.h (class General_options): Add --warn-common.
8846         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8847         merging two common symbols.
8848         (Symbol_table::should_override): Handle --warn-common when merging
8849         a common symbol with a defined symbol.  Use report_resolve_problem
8850         for multiple definitions.
8851         (Symbol_table::report_resolve_problem): New function.
8852         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8853
8854 2009-11-03  Doug Kwan  <dougkwan@google.com>
8855
8856         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8857         stub_factory_.
8858         (Target_arm::stub_factory): New method definition.
8859         (Target_arm::new_arm_input_section,
8860         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8861         Target_arm::reloc_uses_thumb_bit): New method declarations.
8862         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8863         New type definitions.
8864         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8865         member declarations.
8866         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8867         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8868         New method definitions.
8869
8870 2009-11-03  Ian Lance Taylor  <iant@google.com>
8871
8872         * options.h (class General_options): Add --warn_constructors.
8873
8874 2009-11-03  Ian Lance Taylor  <iant@google.com>
8875
8876         PR 10893
8877         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8878         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8879
8880 2009-11-03  Ian Lance Taylor  <iant@google.com>
8881
8882         PR 10895
8883         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8884         --msgid-bugs-address.
8885         (install-pdf): New target.
8886         (install-data_yes): Look up one directory to find mkinstalldirs.
8887
8888 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8889
8890         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8891         tree.
8892
8893 2009-10-30  Doug Kwan  <dougkwan@google.com>
8894
8895         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8896
8897 2009-10-30  Doug Kwan  <dougkwan@google.com>
8898
8899         * arm.cc (Stub_addend_reader): New struct template definition
8900         and partial specializations.
8901         (Stub_addend_reader::operator()): New method definition for a
8902         partially specialized template.
8903
8904 2009-10-30  Doug Kwan  <dougkwan@google.com>
8905
8906         * arm.cc (Arm_relobj::processor_specific_flags): New method
8907         definition.
8908         (Arm_relobj::do_read_symbols): New method declaration.
8909         (Arm_relobj::processor_specific_flags_): New data member declaration.
8910         (Arm_dynobj): New class definition.
8911         (Target_arm::do_finalize_sections): Add input_objects parameter.
8912         (Target_arm::do_adjust_elf_header): New method declaration.
8913         (Target_arm::are_eabi_versions_compatible,
8914         (Target_arm::merge_processor_specific_flags): New method declaration.
8915         (Target_arm::do_make_elf_object): New overloaded method definitions
8916         and declaration.
8917         (Arm_relobj::do_read_symbols): New method definition.
8918         (Arm_dynobj::do_read_symbols): Ditto.
8919         (Target_arm::do_finalize_sections): Add input_objects parameters.
8920         Merge processor-specific flags from all input objects.
8921         (Target_arm::are_eabi_versions_compatible,
8922         Target_arm::merge_processor_specific_flags,
8923         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8924         New method definitions.
8925         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8926         Input_objects pointer type parameter.
8927         * layout.cc (Layout::finalize): Pass input objects to target's.
8928         finalize_sections function.
8929         * output.cc (Output_file_header::do_sized_write): Set ELF file
8930         header's processor-specific flags.
8931         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8932         Input_objects pointer type parameter.
8933         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8934         * target.h (Input_objects): New forward class declaration.
8935         (Target::processor_specific_flags,
8936         Target::are_processor_specific_flags_sect): New method definitions.
8937         (Target::finalize_sections): Add input_objects parameter.
8938         (Target::Target): Initialize processor_specific_flags_ and
8939         are_processor_specific_flags_set_.
8940         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8941         parameter.
8942         (Target::set_processor_specific_flags): New method definition.
8943         (Target::processor_specific_flags_,
8944         Target::are_processor_specific_flags_set_): New data member
8945         declarations.
8946         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8947         Input_objects pointer type parameter.
8948
8949 2009-10-30  Doug Kwan  <dougkwan@google.com>
8950
8951         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8952
8953 2009-10-28  Ian Lance Taylor  <iant@google.com>
8954
8955         * object.h (class Relobj): Drop options parameter from
8956         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8957         do_scan_relocs, do_relocate.  Change all callers.
8958         (class Sized_relobj): Drop options parameters from
8959         do_gc_process_relocs, do_scan_relocs, do_relocate,
8960         do_relocate_sections, relocate_sections, emit_relocs_scan,
8961         emit_relocs_scan_reltype.  Change all callers.
8962         (struct Relocate_info): Remove options field and all references to
8963         it.
8964         * reloc.h (class Read_relocs): Remove options constructor
8965         parameter and options_ field.  Change all callers.
8966         (class Gc_process_relocs, class Scan_relocs): Likewise.
8967         (class Relocate_task): Likewise.
8968         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8969         all callers.
8970         (scan_relocatable_relocs): Likewise.
8971         * target.h (class Sized_target): Remove options parameter from
8972         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8973         all callers.
8974         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8975         callers.
8976         * arm.cc: Update functions to remove options parameters.
8977         * i386.cc: Likewise.
8978         * powerpc.cc: Likewise.
8979         * sparc.cc: Likewise.
8980         * x86_64.cc: Likewise.
8981         * testsuite/testfile.cc: Likewise.
8982
8983 2009-10-28  Doug Kwan  <dougkwan@google.com>
8984
8985         * arm.cc (Arm_relobj): New class definition.
8986         (Arm_relobj::scan_sections_for_stubs,
8987         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8988         New method definitions.
8989
8990 2009-10-28  Cary Coutant  <ccoutant@google.com>
8991
8992         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8993         (Plugin::cleanup_done_): New member.
8994         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8995         (Plugin_manager::cleanup_done_): Remove.
8996         (Plugin_manager::add_input_file): Edit error message.
8997         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8998         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8999
9000 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9001
9002         * fileread.cc: (File_read::View::~View): Use the new
9003         data_ownership_ filed.
9004         (File_read::~File_read): Dispose the new whole_file_view_.
9005         (File_read::open): Mmap the whole file if needed.
9006         (File_read::open): Use whole_file_view_ instead of contents_.
9007         (File_read::find_view): Use whole_file_view_ if applicable.
9008         (File_read::do_read): Use whole_file_view_ instead of contents_.
9009         (File_read::make_view): Use whole_file_view_ instead of contents_,
9010         update File_read::View::View call.
9011         (File_read::find_or_make_view): Update File_read::View::View
9012         call.
9013         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9014         remove contents_
9015         (File_read::View::Data_ownership): New enum.
9016         (File_read::View::View): Replace bool mapped_ with Data_ownership
9017         argument.
9018         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9019         (File_read::View::data_ownership_): New field.
9020         (File_read::contents_): Remove (replaced by whole_file_view_).
9021         (File_read::whole_file_view_): New field.
9022         * options.h (class General_options): Add --keep-files-mapped.
9023
9024 2009-10-27  Cary Coutant  <ccoutant@google.com>
9025
9026         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9027         * testsuite/Makefile.am (plugin_test_5): New test case.
9028         * testsuite/Makefile.in: Regenerate.
9029
9030 2009-10-25  Doug Kwan  <dougkwan@google.com>
9031
9032         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9033         from private to protected to allow access by child class.
9034         (Sized_relobj::do_relocate_sections): New method declaration.
9035         (Sized_relobj::relocate_sections): Virtualize.
9036         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9037         Sized_relobj::relocate_sections.  Instantiate template explicitly
9038         for different target sizes and endianity.
9039
9040 2009-10-24  Doug Kwan  <dougkwan@google.com>
9041
9042         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9043         (Arm_input_section::as_arm_input_section): New method.
9044         (Arm_output_section): New class definition.
9045         (Arm_output_section::create_stub_group,
9046         Arm_output_section::group_sections): New method definitions.
9047
9048 2009-10-22  Doug Kwan  <dougkwan@google.com>
9049
9050         * arm.cc (Arm_input_section): New class definition.
9051         (Arm_input_section::init, Arm_input_section:do_write,
9052         Arm_input_section::set_final_data_size,
9053         Arm_input_section::do_reset_address_and_file_offset): New method
9054         definitions.
9055
9056 2009-10-21  Doug Kwan  <dougkwan@google.com>
9057
9058         * arm.cc (Stub_table, Arm_input_section): New forward class
9059         declarations.
9060         (Stub_table): New class defintion.
9061         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9062         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9063         New method definition.
9064
9065 2009-10-21  Doug Kwan  <dougkwan@google.com>
9066
9067         * arm.cc: Update copyright comments.
9068         (Target_arm): New forward class template declaration.
9069         (Arm_address): New type.
9070         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9071         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9072         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9073         constants.
9074         (Insn_template): Same.
9075         (DEF_STUBS): New macro.
9076         (Stub_type): New enum type.
9077         (Stub_template): New class definition.
9078         (Stub): Same.
9079         (Reloc_stub): Same.
9080         (Stub_factory): Same.
9081         (Target_arm::Target_arm): Initialize may_use_blx_ and
9082         should_force_pic_veneer_.
9083         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9084         Target_arm::should_force_pic_veneer,
9085         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9086         Target_arm::using_thumb_only, Target_arm:;default_target): New
9087         method defintions.
9088         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9089         New data member declarations.
9090         (Insn_template::size, Insn_template::alignment): New method defintions.
9091         (Stub_template::Stub_template): New method definition.
9092         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9093         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9094         (Stub_factory::Stub_factory): New method definition.
9095         * gold.h (string_hash): New template.
9096         * output.h (Input_section_specifier::hash_value): Use
9097         gold::string_hash.
9098         (Input_section_specifier::string_hash): Remove.
9099         * stringpool.cc (Stringpool_template::string_hash): Use
9100         gold::string_hash.
9101
9102 2009-10-20  Doug Kwan  <dougkwan@google.com>
9103
9104         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9105         symbols of relaxed input sections.
9106         * output.h (Output_section::find_relaxed_input_section): Make
9107         method public.
9108
9109 2009-10-16  Doug Kwan  <dougkwan@google.com>
9110
9111         * dynobj.cc (Versions::Versions): Initialize version_script_.
9112         Only insert base version symbol definition for a shared object
9113         if version script defines any version versions.
9114         (Versions::define_base_version): New method definition.
9115         (Versions::add_def): Check that base version is not needed.
9116         (Versions::add_need): Define base version lazily.
9117         * dynobj.h (Versions::define_base_version): New method declaration.
9118         (Versions::needs_base_version_): New data member declaration.
9119         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9120         (check_DATA): Add no_version_test.stdout.
9121         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9122         New make rules.
9123         * testsuite/Makefile.in: Regenerate.
9124         * testsuite/no_version_test.c: New file.
9125         * testsuite/no_version_test.sh: Ditto.
9126
9127 2009-10-16  Doug Kwan  <dougkwan@google.com>
9128
9129         * expression.cc (class Segment_start_expression): New class definition.
9130         (Segment_start_expression::value): New method definition.
9131         (script_exp_function_segment_start): Return a new
9132         Segment_start_expression.
9133         * gold/script-c.h (script_saw_segment_start_expression): New function
9134         prototype.
9135         * script-sections.cc (Script_sections::Script_sections): Initialize
9136         SAW_SEGMENT_START_EXPRESSION_ to false.
9137         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9138         and -Tbbs options to specify section addresses if given in
9139         command line and no SEGMENT_START expression is seen in a script.
9140         * script-sections.h (Script_sections::saw_segment_start_expression,
9141         Script_sections::set_saw_segment_start_expression): New method
9142         definition.
9143         (Script_sections::saw_segment_start_expression_): New data member
9144         declaration.
9145         * script.cc (script_saw_segment_start_expression): New function.
9146         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9147         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9148         script_test_7.sh and script_test_8.sh.
9149         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9150         script_test_8.stdout.
9151         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9152         (script_test_6, script_test_6.stdout, script_test_7,
9153         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9154         * Makefile.in: Regenerate.
9155         * testsuite/script_test_6.sh: New file.
9156         * testsuite/script_test_6.t: Same.
9157         * testsuite/script_test_7.sh: Same.
9158         * testsuite/script_test_7.t: Same.
9159         * testsuite/script_test_8.sh: Same.
9160
9161 2009-10-16  Doug Kwan  <dougkwan@google.com>
9162
9163         * output.cc (Output_segment::set_section_list_address): Cast
9164         expressions to unsigned long long type to avoid format warnings.
9165
9166 2009-10-15  Ian Lance Taylor  <iant@google.com>
9167
9168         * script.cc (Script_options::add_symbol_assignment): Always add a
9169         dot assignment to script_sections_.
9170         * script-sections.cc (Script_sections::add_dot_assignment):
9171         Initialize if necessary.
9172
9173         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9174         program headers with no load segment if there is a linker script.
9175
9176         * layout.cc (Layout::set_segment_offsets): Align the file offset
9177         to the segment aligment for -N or -n with no load segment.
9178         * output.cc (Output_segment::add_output_section): Don't crash if
9179         the first section is a TLS section.
9180         (Output_segment::set_section_list_addresses): Print an error
9181         message if the address moves backward in a linker script.
9182         * script-sections.cc
9183         (Output_section_element_input::set_section_addresses): Don't
9184         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9185         (Orphan_output_section::set_section_addresses): Likewise.
9186
9187 2009-10-15  Doug Kwan  <dougkwan@google.com>
9188
9189         * layout.cc (Layout::finish_dynamic_section): Generate tags
9190         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9191         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9192         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9193
9194 2009-10-14  Ian Lance Taylor  <iant@google.com>
9195
9196         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9197         fields.
9198         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9199         data_shdr fields of relinfo.
9200         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9201         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9202         R_386_TLS_LDO_32, adjust based on section flags.
9203         (Target_i386::Relocate::fix_up_ldo): Remove.
9204
9205 2009-10-13  Ian Lance Taylor  <iant@google.com>
9206
9207         Add support for -pie.
9208         * options.h (class General_options): Add -pie and
9209         --pic-executable.
9210         (General_options::output_is_position_independent): Test -pie.
9211         (General_options::output_is_executable): Return true if not shared
9212         and not relocatable.
9213         (General_options::output_is_pie): Remove.
9214         * options.cc (General_options::finalize): Reject incompatible uses
9215         of -pie.
9216         * gold.cc (queue_middle_tasks): A -pie link is not static.
9217         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9218         * symtab.cc (Symbol::final_value_is_known): Return false if
9219         output_is_position_independent.
9220         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9221         output_is_position_independent.
9222         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9223         output_is_position_independent.
9224         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9225         output_is_position_independent.
9226         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9227         two_file_pie_test.
9228         (basic_pie_test.o, basic_pie_test): New targets.
9229         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9230         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9231         (two_file_pie_test): New target.
9232         * testsuite/Makefile.in: Rebuild.
9233         * README: Remove note saying that -pie is not supported.
9234
9235 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9236
9237         * options.h (class General_options): Add -init and -fini.
9238         * layout.cc (Layout::finish_dynamic_section): Emit
9239         given init and fini functions.
9240
9241 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9242
9243         * gc.h (gc_process_relocs): Check if icf is enabled using new
9244         function.
9245         * gold.cc (queue_initial_tasks): Likewise.
9246         (queue_middle_tasks): Likewise.
9247         * object.cc (do_layout): Likewise.
9248         * symtab.cc (is_section_folded): Likewise.
9249         * main.cc (main): Likewise.
9250         * reloc.cc (Read_relocs::run): Likewise.
9251         (Sized_relobj::do_scan_relocs): Likewise.
9252         * icf.cc (is_function_ctor_or_dtor): New function.
9253         (Icf::find_identical_sections): Check if function is ctor or dtor when
9254         safe icf is chosen.
9255         * options.h (General_options::icf): Change option to be an enum.
9256         (Icf_status): New enum.
9257         (icf_enabled): New method.
9258         (icf_safe_folding): New method.
9259         (set_icf_status): New method.
9260         (icf_status_): New variable.
9261         * (options.cc) (General_options::finalize): Set icf_status_.
9262         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9263         icf_test and icf_keep_unique_test to use the --icf enum flag.
9264         * testsuite/icf_safe_test.sh: New file.
9265         * testsuite/icf_safe_test.cc: New file.
9266
9267 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9268
9269         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9270         includes to gc.h and icf.h.
9271         * arm.cc: Include gc.h.
9272         * gold.cc: Likewise.
9273         * i386.cc: Likewise.
9274         * powerpc.cc: Likewise.
9275         * sparc.cc: Likewise.
9276         * x86_64.cc: Likewise.
9277         * gc.h: Include icf.h.
9278
9279 2009-10-11  Ian Lance Taylor  <iant@google.com>
9280
9281         * plugin.cc: Include "gold.h" before other header files.
9282
9283 2009-10-10  Chris Demetriou  <cgd@google.com>
9284
9285         * options.h (Input_file_argument::Input_file_type): New enum.
9286         (Input_file_argument::is_lib_): Replace with...
9287         (Input_file_argument::type_): New member.
9288         (Input_file_argument::Input_file_argument): Take Input_file_type
9289         'type' rather than boolean 'is_lib' as second argument.
9290         (Input_file_argument::is_lib): Use type_.
9291         (Input_file_argument::is_searched_file): New function.
9292         (Input_file_argument::may_need_search): Handle is_searched_file.
9293         * options.cc (General_options::parse_library): Support -l:filename.
9294         (General_options::parse_just_symbols): Update for Input_file_argument
9295         changes.
9296         (Command_line::process): Likewise.
9297         * archive.cc (Archive::get_file_and_offset): Likewise.
9298         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9299         * script.cc (read_script_file, script_add_file): Likewise.
9300         * fileread.cc (Input_file::Input_file): Likewise.
9301         (Input_file::will_search_for): Handle is_searched_file.
9302         (Input_file::open): Likewise.
9303         * readsyms.cc (Read_symbols::get_name): Likewise.
9304         * testsuite/Makefile.am (searched_file_test): New test.
9305         * testsuite/Makefile.in: Regenerate.
9306         * testsuite/searched_file_test.cc: New file.
9307         * testsuite/searched_file_test_lib.cc: New file.
9308
9309 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9310             Ian Lance Taylor  <iant@google.com>
9311
9312         * descriptor.cc: Include <cstdio> and "binary-io.h".
9313         (Descriptors::open): Open the files in binary mode always.
9314         * script.cc (Lex::get_token): Treat \r as whitespace.
9315
9316 2009-10-09  Ian Lance Taylor  <iant@google.com>
9317
9318         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9319
9320 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9321             Ian Lance Taylor  <iant@google.com>
9322
9323         * configure.ac: Check for readv function also.
9324         * fileread.cc (readv): Define if not HAVE_READV.
9325         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9326         does not exist.
9327         * config.in: Regenerate.
9328         * configure: Regenerate.
9329
9330 2009-10-09  Doug Kwan  <dougkwan@google.com>
9331
9332         * layout.cc (Layout::make_output_section): Call target hook to make
9333         ordinary output section.
9334         (Layout::finalize): Adjust parameter list of call the
9335         Target::may_relax().
9336         * layout.h (class Layout::section_list): New method.
9337         * merge.h (Output_merge_base::entsize): Change visibility to public.
9338         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9339         New methods.
9340         (Output_merge_string::do_is_string): New method.
9341         * object.cc (Sized_relobj::do_setup): renamed from
9342         Sized_relobj::set_up.
9343         * object.h (Sized_relobj::adjust_shndx,
9344         Sized_relobj::initializ_input_to_output_maps,
9345         Sized_relobj::free_input_to_output_maps): Change visibilities to
9346         protected.
9347         (Sized_relobj::setup): Virtualize.
9348         (Sized_relobj::do_setup): New method declaration.
9349         (Sized_relobj::invalidate_section_offset,
9350         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9351         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9352         * options.cc (parse_int): New function.
9353         * options.h (parse_int): New declaration.
9354         (DEFINE_int): New macro.
9355         (stub_group_size): New option.
9356         * output.cc (Output_section::Output_section): Initialize memebers
9357         merge_section_map_, merge_section_by_properties_map_,
9358         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9359         (Output_section::add_input_section): Handled deferred code-fill
9360         generation and remove an old comment.
9361         (Output_section::add_relaxed_input_section): New method definition.
9362         (Output_section::add_merge_input_section): Use merge section by
9363         properties map to speed to search.  Update merge section maps
9364         as appropriate.
9365         (Output_section::build_relaxation_map): New method definition.
9366         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9367         Same.
9368         (Output_section::relax_input_section): Renamed to
9369         Output_section::convert_input_sections_to_relaxed_sections and change
9370         interface to take a vector of pointers to relaxed sections.
9371         (Output_section::find_merge_section,
9372         Output_section::find_relaxed_input_section): New method definitions.
9373         (Output_section::is_input_address_mapped,
9374         Output_section::output_offset, Output_section::output_address):
9375         Use output section data maps to speed up searching.
9376         (Output_section::find_starting_output_address): Add comments.
9377         (Output_section::do_write,
9378         Output_section::write_to_postprocessing_buffer): Do code-fill
9379         generation as appropriate.
9380         (Output_section::get_input_sections): Invalidate relaxed input section
9381         map.
9382         (Output_section::restore_states): Adjust type of checkpoint .
9383         Invalidate relaxed input section map.
9384         * output.h (Output_merge_base): New class declaration.
9385         (Input_section_specifier): New class defintion.
9386         (class Output_relaxed_input_section) Change base class to
9387         Output_section_data_build.
9388         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9389         base class initializer.
9390         (Output_section::add_relaxed_input_section): New method declaration.
9391         (Output_section::Input_section): Change visibility to protected.
9392         (Output_section::Input_section::relobj,
9393         Output_section::Input_section::shndx): Handle relaxed input sections.
9394         Output_section::input_sections) Change visibility to protected.  Also
9395         define overload to return a non-const pointer.
9396         (Output_section::Merge_section_properties): New class defintion.
9397         (Output_section::Merge_section_by_properties_map,
9398         Output_section::Output_section_data_by_input_section_map,
9399         Output_section::Relaxation_map): New types.
9400         (Output_section::relax_input_section): Rename method to
9401         Output_section::convert_input_sections_to_relaxed_sections and change
9402         interface to take a vector of relaxed section pointers.
9403         (Output_section::find_merge_section,
9404         Output_section::find_relaxed_input_section,
9405         Output_section::build_relaxation_map,
9406         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9407         New method declarations.
9408         (Output_section::merge_section_map_
9409         Output_section::merge_section_by_properties_map_,
9410         Output_section::relaxed_input_section_map_,
9411         Output_section::is_relaxed_input_section_map_valid_,
9412         Output_section::generate_code_fills_at_write_): New data members.
9413         * script-sections.cc
9414         (Output_section_element_input::set_section_addresses): Call
9415         current_data_size and addralign methods of relaxed input sections.
9416         (Orphan_output_section::set_section_addresses): Call current_data_size
9417         and addralign methods of relaxed input sections.
9418         * symtab.cc (Symbol_table::compute_final_value): Extract template
9419         from the body of Symbol_table::sized_finalize_symbol.
9420         (Symbol_table::sized_finalized_symbol): Call
9421         Symbol_table::compute_final_value.
9422         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9423         (Symbol_table::compute_final_value): New templated method declaration.
9424         * target.cc (Target::do_make_output_section): New method defintion.
9425         * target.h (Target::make_output_section): New method declaration.
9426         (Target::relax): Add more parameters for input objects, symbol table
9427         and layout.  Adjust call to do_relax.
9428         (Target::do_make_output_section): New method declaration.
9429         (Target::do_relax): Add parameters for input objects, symbol table
9430         and layout.
9431
9432 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9433
9434         * pread.c: Include stdio.h.
9435
9436 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9437
9438         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9439         defined.
9440
9441 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9442
9443         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9444         Change read_shndx type to unsigned int.
9445         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9446         int.
9447         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9448         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9449         Change read_shndx type to unsigned int.
9450         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9451         int.
9452         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9453         * layout.cc (Layout::create_symtab_sections): Cast the result of
9454         local_symcount * symsize to off_t in the gold_assert.
9455
9456 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9457
9458         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9459         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9460         R_ARM_BASE_ABS.
9461         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9462         (Arm_relocate_functions::thm_abs5): New function.
9463         (Arm_relocate_functions::abs12): New function.
9464         (Arm_relocate_functions::abs16): New function.
9465         (Arm_relocate_functions::base_abs): New function.
9466         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9467         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9468         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9469         R_ARM_BASE_ABS.
9470         (Scan::global): Likewise.
9471         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9472         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9473         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9474         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9475         R_ARM_BASE_ABS.
9476
9477 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9478
9479         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9480         (Arm_relocate_functions::movt_prel): New function.
9481         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9482         (Arm_relocate_functions::thm_movt_prel): New function.
9483         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9484         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9485         (Scan::global, Relocate::relocate): Likewise.
9486         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9487
9488 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9489
9490         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9491         Incremental_checker.
9492         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9493         unsigned int.
9494         (class Incremental_inputs_header): New class.
9495         (Incremental_inputs_header_writer): Edit comment.
9496         (Incremental_inputs_entry): New class.
9497         (Incremental_inputs_entry_writer): Edit comment.
9498         (Sized_incremental_binary::do_find_incremental_inputs_section):
9499         Add *strtab_shndx parameter, fill it.
9500         (Sized_incremental_binary::do_check_inputs): New method.
9501         (Incremental_checker::can_incrementally_link_output_file): Use
9502         Sized_incremental_binary::check_inputs.
9503         (Incremental_inputs::report_command_line): Save command line in
9504         command_line_.
9505         * incremental.h:
9506         (Incremental_binary::find_incremental_inputs_section): New
9507         method.
9508         (Incremental_binary::do_find_incremental_inputs_section): Add
9509         strtab_shndx parameter.
9510         (Incremental_binary::do_check_inputs): New pure virtual method.
9511         (Sized_incremental_binary::do_check_inputs): Declare.
9512         (Incremental_checker::Incremental_checker): Add incremental_inputs
9513         parameter, use it to initialize incremental_inputs_.
9514         (Incremental_checker::incremental_inputs_): New field.
9515         (Incremental_checker::command_line): New method.
9516         (Incremental_checker::inputs): New method.
9517         (Incremental_checker::command_line_): New field.
9518
9519 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9520
9521         * incremental.cc: Include <cstdarg> and "target-select.h".
9522         (vexplain_no_incremental): New function.
9523         (explain_no_incremental): New function.
9524         (Incremental_binary::error): New method.
9525         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9526         method.
9527         (make_sized_incremental_binary): New function.
9528         (open_incremental_binary): New function.
9529         (can_incrementally_link_file): Add checks if output is ELF and has
9530         inputs section.
9531         * incremental.h: Include "elfcpp_file.h" and "output.h".
9532         (Incremental_binary): New class.
9533         (Sized_incremental_binary): New class.
9534         (open_incremental_binary): Declare.
9535         * object.cc (is_elf_object): Use
9536         elfcpp::Elf_recognizer::is_elf_file.
9537         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9538         * output.h (Output_file::filesize): New method.
9539
9540 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9541
9542         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9543         New function.
9544         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9545         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9546         function.
9547         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9548         function.
9549         (Arm_relocate_functions::movw_abs_nc): New function.
9550         (Arm_relocate_functions::movt_abs): New function.
9551         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9552         (Arm_relocate_functions::thm_movt_abs): New function.
9553         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9554         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9555         (Scan::global): Likewise.
9556         (Relocate::relocate): Likewise.
9557         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9558
9559 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9560
9561         * arm.cc (Arm_relocate_functions::got_prel) New function.
9562         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9563         (Relocate::relocate): Likewise.
9564         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9565
9566 2009-10-06  Ian Lance Taylor  <iant@google.com>
9567
9568         * options.h (class General_options): Define
9569         split_stack_adjust_size parameter.
9570         * object.h (class Object): Add uses_split_stack_ and
9571         has_no_split_stack_ fields.  Add uses_split_stack and
9572         has_no_split_stack accessor functions.  Declare
9573         handle_split_stack_section.
9574         (class Reloc_symbol_changes): Define.
9575         (class Sized_relobj): Define Function_offsets.  Declare
9576         split_stack_adjust, split_stack_adjust_reltype, and
9577         find_functions.
9578         * object.cc (Object::handle_split_stack_section): New function.
9579         (Sized_relobj::do_layout): Call handle_split_stack_section.
9580         * dynobj.cc (Sized_dynobj::do_layout): Call
9581         handle_split_stack_section.
9582         * reloc.cc (Sized_relobj::relocate_sections): Call
9583         split_stack_adjust for executable sections in split_stack
9584         objects.  Pass reloc_map to relocate_section.
9585         (Sized_relobj::split_stack_adjust): New function.
9586         (Sized_relobj::split_stack_adjust_reltype): New function.
9587         (Sized_relobj::find_functions): New function.
9588         * target-reloc.h: Include "object.h".
9589         (relocate_section): Add reloc_symbol_changes parameter.  Change
9590         all callers.
9591         * target.h (class Target): Add calls_non_split method.  Declare
9592         do_calls_non_split virtual method.  Declare match_view and
9593         set_view_to_nop.
9594         * target.cc: Include "elfcpp.h".
9595         (Target::do_calls_non_split): New function.
9596         (Target::match_view): New function.
9597         (Target::set_view_to_nop): New function.
9598         * gold.cc (queue_middle_tasks): Give an error if mixing
9599         split-stack and non-split-stack objects with -r.
9600         * i386.cc (Target_i386::relocate_section): Add
9601         reloc_symbol_changes parameter.
9602         (Target_i386::do_calls_non_split): New function.
9603         * x86_64.cc (Target_x86_64::relocate_section): Add
9604         reloc_symbol_changes parameter.
9605         (Target_x86_64::do_calls_non_split): New function.
9606         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9607         parameter.
9608         * powerpc.cc (Target_powerpc::relocate_section): Add
9609         reloc_symbol_changes parameter.
9610         * sparc.cc (Target_sparc::relocate_section): Add
9611         reloc_symbol_changes parameter.
9612         * configure.ac: Call AM_CONDITIONAL for the default target.
9613         * configure: Rebuild.
9614         * testsuite/Makefile.am (TEST_AS): New variable.
9615         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9616         (check_DATA): Add split_i386 and split_x86_64 files.
9617         (SPLIT_DEFSYMS): Define.
9618         (split_i386_[1234n].o): New targets.
9619         (split_i386_[124]): New targets.
9620         (split_i386_[1234r].stdout): New targets.
9621         (split_x86_64_[1234n].o): New targets.
9622         (split_x86_64_[124]): New targets.
9623         (split_x86_64_[1234r].stdout): New targets.
9624         (MOSTLYCLEANFILES): Add new executables.
9625         * testsuite/split_i386.sh: New file.
9626         * testsuite/split_x86_64.sh: New file.
9627         * testsuite/split_i386_1.s: New file.
9628         * testsuite/split_i386_2.s: New file.
9629         * testsuite/split_i386_3.s: New file.
9630         * testsuite/split_i386_4.s: New file.
9631         * testsuite/split_i386_n.s: New file.
9632         * testsuite/split_x86_64_1.s: New file.
9633         * testsuite/split_x86_64_2.s: New file.
9634         * testsuite/split_x86_64_3.s: New file.
9635         * testsuite/split_x86_64_4.s: New file.
9636         * testsuite/split_x86_64_n.s: New file.
9637         * testsuite/testfile.cc (Target_test): Update relocation_section
9638         function.
9639         * testsuite/Makefile.in: Rebuild.
9640
9641 2009-10-06  Ian Lance Taylor  <iant@google.com>
9642
9643         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9644         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9645         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9646         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9647         the address on ldo_addrs_.
9648         (Target_i386::Relocate::fix_up_ldo): New function.
9649
9650 2009-10-06   Rafael Espindola  <espindola@google.com>
9651
9652         * plugin.cc (add_input_library): New.
9653         (Plugin::load): Add add_input_library to tv.
9654         (Plugin_manager::add_input_file): Add the is_lib argument.
9655         (add_input_file): Update call to Plugin_manager::add_input_file.
9656         (add_input_library): New.
9657         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9658
9659 2009-09-30  Doug Kwan  <dougkwan@google.com>
9660
9661         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9662         symbol and call Symbol::may_need_copy_reloc to determine if
9663         a copy reloc is needed.
9664         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9665         nocopyreloc is given in command line.
9666         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9667         given in command line.
9668         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9669         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9670         of the removed Target_i386::may_need_copy_reloc.
9671         * options.h (copyreloc): New option with default value false.
9672         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9673         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9674         instead of the removed Target_powerpc::may_need_copy_reloc.
9675         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9676         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9677         instead of the removed Target_sparc::may_need_copy_reloc.
9678         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9679         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9680         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9681         instead of the removed Target_x86_64::may_need_copy_reloc.
9682
9683 2009-09-30  Ian Lance Taylor  <iant@google.com>
9684
9685         * object.h (class Object): Remove target_ field, and target,
9686         sized_target, and set_target methods.
9687         (Object::sized_target): Remove.
9688         (class Sized_relobj): Update declarations.  Remove sized_target.
9689         * object.cc (Sized_relobj::setup): Remove target parameter.
9690         Change all callers.
9691         (Input_objects::add_object): Don't do anything with the target.
9692         (make_elf_sized_object): Add punconfigured parameter.  Change all
9693         callers.  Set or test parameter target.
9694         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9695         Change all callers.
9696         * parameters.cc (Parameters::set_target): Change parameter type to
9697         be non-const.
9698         (Parameters::default_target): Remove.
9699         (set_parameters_target): Change parameter type to be non-const.
9700         (parameters_force_valid_target): New function.
9701         (parameters_clear_target): New function.
9702         * parameters.h (class Parameters): Update declarations.  Remove
9703         default_target method.  Add sized_target and clear_target
9704         methods.  Change target_ to be non-const.
9705         (set_parameters_target): Update declaration.
9706         (parameters_force_valid_target): Declare.
9707         (parameters_clear_target): Declare.
9708         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9709         as NULL if we aren't searching.
9710         (Add_symbols::run): Don't check for compatible target.
9711         * fileread.cc (Input_file::open_binary): Call
9712         parameters_force_valid_target.
9713         * gold.cc (queue_middle_tasks): Likewise.
9714         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9715         set_target on object.
9716         * dynobj.h (class Sized_dynobj): Update declarations.
9717         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9718         make_elf_object returns NULL.
9719         (Archive::include_member): Don't check whether object target is
9720         compatible.
9721         * output.cc (Output_section::add_input_section): Get target from
9722         parameters.
9723         (Output_section::relax_input_section): Likewise.
9724         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9725         parameters.
9726         (Sized_relobj::do_scan_relocs): Likewise.
9727         (Sized_relobj::relocate_sections): Likewise.
9728         * resolve.cc (Symbol_table::resolve): Likewise.
9729         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9730         parameter.  Change all callers.
9731         (Symbol_table::add_from_object): Get target from parameters.
9732         (Symbol_table::add_from_relobj): Don't check object target.
9733         (Symbol_table::add_from_dynobj): Likewise.
9734         (Symbol_table::define_special_symbol): Get target from
9735         parameters.
9736         * symtab.h (class Symbol_table): Update declaration.
9737         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9738         parameter.  Change all callers.  Clear parameter target.
9739         (Binary_test): Test target here.
9740         * testsuite/object_unittest.cc (gold_testsuite): Remove
9741         target_test_pointer parameter.  Change all callers.
9742         (Object_test): Test target here.
9743
9744 2009-09-26  Ian Lance Taylor  <iant@google.com>
9745
9746         * testsuite/initpri1.c: Don't try to use constructor priorities if
9747         compiling with gcc before 4.3.
9748
9749 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9750
9751         * testsuite/retain_symbols_file_test.sh (check_present): Change
9752         output file name to retain_symbols_file_test.stdout.
9753         (check_absent): Likewise.
9754
9755 2009-09-18  Craig Silverstein  <csilvers@google.com>
9756
9757         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9758         * options.cc: Include <cerrno> and <fstream>.
9759         (General_options::finalize): Parse -retain-symbols-file tag.
9760         * options.h: New flag.
9761         (General_options): New method should_retain_symbol, new
9762         variable symbols_to_retain.
9763         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9764         should_retain_symbol map.
9765         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9766         * testsuite/Makefile.in: Regenerate.
9767         * testsuite/retain_symbols_file_test.sh: New file.
9768
9769 2009-09-18  Nick Clifton  <nickc@redhat.com>
9770
9771         * po/es.po: Updated Spanish translation.
9772
9773 2009-09-17  Doug Kwan  <dougkwan@google.com>
9774
9775         * debug.h (DEBUG_RELAXATION): New constant.
9776         (DEBUG_ALL): Add DEBUG_RELAXATION.
9777         (debug_string_to_enum): Add relaxation debug option.
9778         * layout.cc
9779         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9780         Layout::Relaxation_debug_check::read_sections,
9781         Layout::Relaxation_debug_check::read_sections): New method definitions.
9782         (Layout::Layout): Initialize data members
9783         record_output_section_data_from_scrips_,
9784         script_output_section_data_list_ and relaxation_debug_check_.
9785         (Layout::save_segments, Layout::restore_segments,
9786         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9787         Layout::relaxation_loop_body): New method definitions.
9788         (Layout::finalize): Support relaxation.  Move section layout code to
9789         Layout::relaxation_loop_body.
9790         (Layout::set_asection_address_from_script): Move code for orphan
9791         section placement out.
9792         (Layout::place_orphan_sections_in_script): New method definition.
9793         * layout.h (Output_segment_headers, Output_file_header):
9794         New forward class declarations.
9795         (Layout::~Layout): Define.
9796         (Layout::new_output_section_data_from_script): New method definition.
9797         (Layout::place_orphan_sections_in_script): New method declaration.
9798         (Layout::Segment_states): New type declaration.
9799         (Layout::save_segments, Layout::restore_segments,
9800         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9801         Layout::relaxation_loop_body): New method declarations.
9802         (Layout::Output_section_data_list): New type declaration.
9803         (Layout::Relaxation_debug_check): New class definition.
9804         (Layout::record_output_section_data_from_script_,
9805         Layout::script_output_section_data_list_, Layout::segment_states_,
9806         Layout::relaxation_debug_check_): New data members.
9807         * output.cc: (Output_section_headers::do_size): New method definition.
9808         (Output_section_headers::Output_section_headers): Move size
9809         computation to Output_section_headers::do_size.
9810         (Output_segment_headers::do_size): New method definition.
9811         (Output_file_header::Output_file_header): Move size computation to
9812         Output_file_header::do_size and call it.
9813         (Output_file_header::do_size): New method definition.
9814         (Output_data_group::Output_data_group): Adjust call to
9815         Output_section_data.
9816         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9817         (Output_symtab_xindex::do_write): Add array bound check.
9818         (Output_section::Input_section::print_to_mapfile): Handle
9819         RELAXED_INPUT_SECTION_CODE.
9820         (Output_section::Output_section): Initialize data member checkpoint_.
9821         (Output_section::~Output_section): Delete checkpoint object pointed
9822         by checkpoint_.
9823         (Output_section::add_input_section): Always add an Input_section if
9824         relaxing.
9825         (Output_section::add_merge_input_section): Add assert.
9826         (Output_section::relax_input_section): New method definition.
9827         (Output_section::set_final_data_size): Set load address to zero for
9828         an unallocated section.
9829         (Output_section::do_address_and_file_offset_have_reset_values):
9830         New method definition.
9831         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9832         Handle relaxed input section.
9833         (Output_section::sort_attached_input_sections): Checkpoint input
9834         section list lazily.
9835         (Output_section::get_input_sections): Change type of input_sections to
9836         list of Simple_input_section pointers.  Checkpoint input section list
9837         lazily.  Also handle relaxed input sections.
9838         (Output_section::add_input_section_for_script): Take a reference to
9839         a Simple_input_section object instead of Relobj pointer and section
9840         index as parameter.  Handle relaxed input sections.
9841         (Output_section::save_states, Output_section::restore_states): New
9842         method definitions.
9843         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9844         (Output_data::is_data_size_fixed): New method definition.
9845         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9846         if it is fixed.
9847         (Output_data::address_and_file_offset_have_reset_values): New method
9848         definition.
9849         (Output_data::do_address_and_file_offset_have_reset_values): New method
9850         definition.
9851         (Output_data::set_data_size): Check that data size is not fixed.
9852         (Output_data::fix_data_size): New method definition.
9853         (Output_data::is_data_size_fixed_): New data member.
9854         (Output_section_headers::set_final_data_size): New method definition.
9855         (Output_section_headers::do_size): New method declaration.
9856         (Output_segment_headers::set_final_data_size): New method definition.
9857         (Output_segment_headers::do_size): New method declaration.
9858         (Output_file_header::set_final_data_size)::New method definition.
9859         (Output_file_header::do_size)::New method declaration.
9860         (Output_section_data::Output_section_data): Add new parameter
9861         is_data_size_fixed and use it to fix data size.
9862         (Output_data_const::Output_data_const): Adjust call to base class
9863         constructor and fix data size.
9864         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9865         base class constructor and fix data size.
9866         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9867         base class constructor and fix data size.
9868         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9869         class constructor and fix data size.
9870         (Output_data_group::set_final_data_size): New method definition.
9871         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9872         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9873         class constructor and fix data size.
9874         (Output_relaxed_input_section): New class definition.
9875         (Output_section::Simple_input_section): New class definition.
9876         (Output_section::get_input_sections): Adjust parameter list.
9877         (Output_section::add_input_section_for_script): Same.
9878         (Output_section::save_states, Output_section::restore_states,
9879         Output_section::do_address_and_file_offset_have_reset_values,
9880         (Output_section::Input_section::Input_section): Handle
9881         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9882         Output_relaxed_input_section.
9883         (Output_section::Input_section::is_input_section,
9884         Output_section::Input_section::set_output_section): Handle relaxed
9885         input section.
9886         (Output_section::Input_section::is_relaxed_input_section,
9887         Output_section::Input_section::output_section_data,
9888         Output_section::Input_section::relaxed_input_section): New method
9889         definitions.
9890         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9891         value.
9892         (Output_section::Input_section::u1_): Update comments.
9893         (Output_section::Input_section::u2_): Add new union member poris.
9894         (Output_section::Checkpoint_output_section): New classs definition.
9895         (Output_section::relax_input_section): New method declaration.
9896         (Output_section::checkpoint_): New data member.
9897         (Output_segment): Update comments.
9898         (Output_segment::Output_segment): Un-privatize copy constructor.
9899         (Output_segment::operator=): Un-privatize.
9900         * script-sections.cc (Output_section_element::Input_section_list):
9901         Change element type to Output_section::Simple_input_section.
9902         (Output_section_element_dot_assignment::set_section_addresses):
9903         Register output section data for relaxation clean up.
9904         (Output_data_exression::Output_data_expression): Adjust call to base
9905         constructor to fix data size.
9906         (Output_section_element_data::set_section_addresses): Register
9907         Output_data_expression object for relaxation clean up.
9908         (struct Input_section_info): Replace Relobj pointer and section index
9909         pair with Output_section::Simple_input_section and Convert struct to a
9910         class.
9911         (Input_section_sorter::operator()): Adjust access to
9912         Input_section_info data member to use accessors.
9913         (Output_section_element_input::set_section_addresses): Use layout
9914         parameter.  Adjust code to use Output_section::Simple_input_section
9915         and Input_secction_info classes.  Register filler for relaxation
9916         clean up.
9917         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9918         and section index pair with Output_section::Simple_input_section
9919         class.  Adjust code accordingly.
9920         (Phdrs_element::release_segment): New method definition.
9921         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9922         segment list.
9923         (Script_sections::release_segments): New method definition.
9924         * gold/script-sections.h (Script_sections::release_segments): New
9925         method declaration.
9926         * gold/target.h (Target::may_relax, Target::relax,
9927         Target::do_may_relax, Target::do_relax): New method definitions.
9928
9929 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9930
9931         * arm.cc (has_signed_unsigned_overflow): New function.
9932         (Arm_relocate_functions::abs8): New function.
9933         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9934         (Target_arm::Scan::global): Likewise.
9935         (Target_arm::relocate::relocate): Likewise.
9936         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9937         Likewise.
9938
9939 2009-09-16  Cary Coutant  <ccoutant@google.com>
9940
9941         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9942         * testsuite/Makefile.in: Regenerate.
9943
9944 2009-09-11  Nick Clifton  <nickc@redhat.com>
9945
9946         * po/gold.pot: Updated by the Translation project.
9947
9948 2009-09-08  Cary Coutant  <ccoutant@google.com>
9949
9950         * output.cc (Output_file::open): Add execute permission to empty file.
9951         * testsuite/Makefile.am (permission_test): New test.
9952         * testsuite/Makefile.in: Regenerate.
9953
9954 2009-09-02  Ian Lance Taylor  <iant@google.com>
9955
9956         * output.cc (Output_file::resize): Call map_no_anonymous rather
9957         than map.
9958
9959 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9960
9961         * gold.cc: Include "incremental.h".
9962         (queue_initial_tasks): Call Incremental_checker methods.
9963         * incremental.cc: Include "output.h".
9964         (Incremental_checker::can_incrementally_link_output_file): New
9965         method.
9966         * incremental.h (Incremental_checker): New class.
9967
9968         * output.cc (Output_file::open_for_modification): New method.
9969         (Output_file::map_anonymous): Changed return type to bool.  Record
9970         map in base_ field.
9971         (Output_file::map_no_anonymous): New method, broken out of map.
9972         (Output_file::map): Use map_no_anonymous and map_anonymous.
9973         * output.h (class Output_file): Update declarations.
9974
9975 2009-08-24  Cary Coutant  <ccoutant@google.com>
9976
9977         * options.h (Command_line::Pre_options): New class.
9978         (Command_line::pre_options): New member.
9979         * options.cc (gold::options::ready_to_register): New variable.
9980         (One_option::register_option): Do nothing if not registering options.
9981         Assert if same short option registered twice.
9982         (General_options::General_options): Turn off option registration when
9983         done constructing.
9984         (Command_line::Pre_options::Pre_options): New constructor.
9985
9986 2009-08-24  Cary Coutant  <ccoutant@google.com>
9987
9988         * options.h (General_options::no_keep_memory): Remove incorrect
9989         short option.
9990
9991 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9992
9993         * Makefile.am (am__skiplex, am__skipyacc): New.
9994         * Makefile.in: Regenerate.
9995
9996 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9997
9998         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9999         (INCLUDES): ... this.
10000         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10001         (AM_CPPFLAGS): Renamed from ...
10002         (INCLUDE): ... this.
10003         * Makefile.in, testsuite/Makefile.in: Regenerate.
10004
10005         * Makefile.in: Regenerate.
10006         * aclocal.m4: Likewise.
10007         * config.in: Likewise.
10008         * configure: Likewise.
10009         * testsuite/Makefile.in: Likewise.
10010
10011         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10012         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10013         * Makefile.in: Regenerate.
10014         * testsuite/Makefile.in: Regenerate.
10015
10016 2009-08-19  Cary Coutant  <ccoutant@google.com>
10017
10018         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10019         symbols in shared libraries overridden by hidden or internal symbols
10020         in the main program.
10021
10022 2009-08-19  Chris Demetriou  <cgd@google.com>
10023
10024         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10025         checking source file names in error messages.
10026
10027 2009-08-18  Doug Kwan  <dougkwan@google.com>
10028
10029         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10030         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10031         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10032         an elfcpp::Ehdr as parameter.
10033         * object.cc (Object::set_target): Remove the version that looks up
10034         a target and sets it.
10035         (Sized_relobj::setup): Take a Target object instead of
10036         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10037         (make_elf_sized_object): Find target and ask target to
10038         make an ELF object.
10039         * object.h: (Object::set_target): Remove the version that looks up
10040         a target and sets it.
10041         (Sized_relobj::setup): Take a Target object instead of
10042         an elfcpp:Ehdr as parameter.
10043         * target.cc: Include dynobj.h.
10044         (Target::do_make_elf_object_implementation): New.
10045         (Target::do_make_elf_object): New.
10046         * target.h (Target::make_elf_object): New template declaration.
10047         (Target::do_make_elf_object): New method declarations.
10048         (Target::do_make_elf_object_implementation): New template declaration.
10049
10050 2009-08-14  Ian Lance Taylor  <iant@google.com>
10051
10052         * gold.h (FUNCTION_NAME): Define.
10053         (gold_unreachable): Use FUNCTION_NAME.
10054
10055 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10056
10057         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10058         symbol in the --keep-unique list is not found.
10059
10060 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10061
10062         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10063         been maked as --keep-unique.
10064         (Icf::unfold_section): New function.
10065         * icf.h (Icf::unfold_section): New function.
10066         * options.h (General_options::keep_unique): New option.
10067         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10068         * testsuite/Makefile.in: Regenerate.
10069         * testsuite/icf_keep_unique_test.sh: New file.
10070         * testsuite/icf_keep_unique_test.cc: New file.
10071
10072 2009-08-12  Cary Coutant  <ccoutant@google.com>
10073
10074         PR 10471
10075         * resolve.cc (Symbol_table::resolve): Check for references from
10076         dynamic objects to hidden and internal symbols.
10077         * testsuite/Makefile.am (hidden_test.sh): New test.
10078         * testsuite/Makefile.in: Regenerate.
10079         * testsuite/hidden_test.sh: New script.
10080         * testsuite/hidden_test_1.c: New test source.
10081         * testsuite/hidden_test_main.c: New test source.
10082
10083 2009-08-11  Doug Kwan  <dougkwan@google.com>
10084
10085         * arm.cc: Update comments.
10086         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10087         segment to locate the .ARM.exidx section if present.
10088
10089 2009-08-09  Doug Kwan  <dougkwan@google.com>
10090
10091         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10092         patch.
10093
10094 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10095         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10096         compiler warnings.
10097
10098 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10099
10100         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10101         valid tls_segment only for non-debug-section relocations.
10102         * testsuite/Makefile.am: Add gc_tls_test.
10103         * testsuite/Makefile.in: Regenerate.
10104         * testsuite/gc_tls_test.cc: New file.
10105         * testsuite/gc_tls_test.sh: New file.
10106
10107 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10108
10109         * icf.cc: New file.
10110         * icf.h: New file.
10111         * Makefile.am (CCFILES): Add icf.cc.
10112         (HFILES): Add icf.h
10113         * Makefile.in: Regenerate.
10114         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10115         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10116         section, symbol and addend information for the relocs.
10117         * gold.cc (queue_middle_tasks): Call identical code folding.
10118         * gold.h: Add defines for multimap.
10119         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10120         to the call of finalize_local_symbols.
10121         * main.cc (main): Create object of class Icf.
10122         * object.cc (Sized_relobj::do_layout): Allow this function to be
10123         called twice during icf.
10124         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10125         to sections marked as identical by icf.
10126         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10127         when available.
10128         (Sized_relobj::do_section_entsize): New function.
10129         * object.h (Object::section_entsize): New function.
10130         (Object::do_section_entsize): New pure virtual function.
10131         (Relobj::finalize_local_symbols): Add new parameter.
10132         (Relobj::do_section_entsize): New function.
10133         * options.h (General_options::icf): New option.
10134         (General_options::icf_iterations): New option.
10135         (General_options::print_icf_sections): New option.
10136         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10137         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10138         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10139         icf.
10140         * symtab.cc (Symbol_table::is_section_folded): New function.
10141         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10142         to sections marked as identical by icf.
10143         * symtab.h (Symbol_table::set_icf): New function.
10144         (Symbol_table::icf): New function.
10145         (Symbol_table::is_section_folded): New function.
10146         (Symbol_table::icf_): New data member.
10147         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10148         * testsuite/Makefile.am: Add commands to build icf_test.
10149         * testsuite/Makefile.in: Regenerate.
10150         * testsuite/icf_test.sh: New file.
10151         * testsuite/icf_test.cc: New file.
10152
10153 2009-07-24  Chris Demetriou  <cgd@google.com>
10154
10155         * layout.cc (is_compressible_debug_section): Fix incorrect
10156         comment about compressed section names.
10157
10158 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10159
10160         PR 10419
10161         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10162
10163 2009-07-16  Ian Lance Taylor  <iant@google.com>
10164
10165         PR 10400
10166         * layout.h: #include <map>.
10167         (class Kept_section): Change from struct to class.  Add accessors
10168         and setters.  Add section size to Comdat_group mapping.  Change
10169         Comdat_group to std::map.  Add is_comdat_ field.  Add
10170         linkonce_size field in union.
10171         (class Layout): Update declaration of find_or_add_kept_section.
10172         Don't declare find_kept_object.
10173         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10174         parameter.  Add object, shndx, is_comdat, and is_group_name
10175         parameters.  Change all callers.  Adjust for new Kept_section.
10176         (Layout::find_kept_object): Remove.
10177         * object.cc (Sized_relobj::include_section_group): Update use of
10178         Kept_section.  Rename secnum to shndx.  Only record
10179         Kept_comdat_section if sections are the same size.
10180         (Sized_relobj::include_linkonce_section): Update use of
10181         Kept_section.  Only record Kept_comdat_section if sections are the
10182         same size.  Set size of linkonce section.
10183         (Sized_relobj::map_to_kept_section): Update call to
10184         get_kept_comdat_section.
10185         * object.h (class Sized_relobj): Rename fields in
10186         Kept_comdat_section to drop trailing underscores; change object
10187         field to Relobj*.  Change Kept_comdat_section_table to store
10188         struct rather than pointer.
10189         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10190         Add kept_object and kept_shndx parameters.  Change all callers.
10191         (Sized_relobj::get_kept_comdat_section): Change return type to
10192         bool.  Add kept_object and kept_shndx parameters.  Change all
10193         callers.
10194         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10195         Layout::find_or_add_kept_section.
10196
10197 2009-07-09  Ian Lance Taylor  <iant@google.com>
10198
10199         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10200         Reserve space in the hash table.
10201
10202 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10203
10204         * fileread.cc (File_read::get_mtime): New method.
10205         * fileread.h (Timespec): New structure.
10206         (File_read::get_mtime): New method.
10207         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10208         Renamed from timestamp_nsec.
10209         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10210         Elf_Xword.
10211         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10212         timestamp_nsec.
10213         (Incremental_inputs::report_archive): Save mtime; style fix.
10214         (Incremental_inputs::report_obejct): Save mtime; style fix.
10215         (Incremental_inputs::report_script): Save mtime; style fix.
10216         (Incremental_inputs::finalize_inputs): Style fix.
10217         (Incremental_inputs::finalize): Style fix.
10218         (Incremental_inputs::create_input_section_data): Store inputs
10219         mtime.
10220         * incremental.h (Incremental_inputs::report_script): Add mtime
10221         argument.
10222         (Incremental_inputs::Input_info::Input_info): Intialize only one
10223         union member.
10224         (Incremental_inputs::Input_info::archive): Move to nameless
10225         union.
10226         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10227         (Incremental_inputs::Input_info::script): Move to nameless union.
10228         (Incremental_inputs::mtime): New field.
10229         * script.cc (read_input_script): Pass file mtime to
10230         Incremental_input.
10231         * script.h (Script_info::inputs): Style fix.
10232
10233 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10234
10235         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10236         instead of 32.
10237
10238 2009-06-24  Ian Lance Taylor  <iant@google.com>
10239
10240         PR 10156
10241         * layout.cc (Layout::choose_output_section): If we find an
10242         existing section, update the flags.
10243         (Layout::create_notes): New function, broken out of
10244         Layout::finalize.
10245         (Layout::finalize): Don't create note sections.
10246         (Layout::create_note): Don't crash if linker script discards
10247         section.
10248         (Layout::create_gold_note): Likewise.
10249         (Layout::create_build_id): Likewise.  Don't set
10250         after_input_sections on the section.
10251         (Layout::create_executable_stack_info): Remove target parameter.
10252         Change caller.
10253         * layout.h (class Layout): Declare create_notes.  Update
10254         declaration of create_executable_stack_info.
10255         * gold.cc (queue_middle_tasks): Call create_notes.
10256         * output.cc (Output_section::update_flags_for_input_section): Move
10257         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10258         invalid.
10259         * output.h (Output_data::mark_address_invalid): New function.
10260         (class Output_section): Only declare, not define,
10261         update_flags_for_input_section.  Remove set_flags.
10262
10263 2009-06-24  Ian Lance Taylor  <iant@google.com>
10264
10265         * script-sections.cc (Output_section_definition::
10266         set_section_addresses): Rename shadowing local load_address to
10267         laddr.
10268
10269 2009-06-24  Ian Lance Taylor  <iant@google.com>
10270
10271         PR 10244
10272         * reloc.cc (relocate_sections): Skip empty relocation sections.
10273
10274 2009-06-23  Ian Lance Taylor  <iant@google.com>
10275
10276         PR 10156
10277         * layout.cc (Layout::create_note): Use choose_output_section
10278         rather than make_output_section.
10279
10280 2009-06-23  Ian Lance Taylor  <iant@google.com>
10281
10282         PR 10237
10283         * options.cc (General_options::parse_V): Set printed_version_.
10284         (General_options::General_options): Initialize printed_version_.
10285         * options.h (class General_options): Add printed_version_ field.
10286         * gold.cc (queue_initial_tasks): If there are no input files,
10287         don't give a fatal error if we printed the version information.
10288         (queue_middle_tasks): If using -r with a shared object, give a
10289         fatal error rather than an ordinary error.
10290
10291 2009-06-23  Ian Lance Taylor  <iant@google.com>
10292
10293         PR 10219
10294         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10295         (Layout::make_output_section): Set have_stabstr_section_ if we see
10296         a .stab*str section.
10297         (Layout::finalize): Call link_stabs_sections.
10298         (Layout::link_stabs_sections): New file.
10299         * layout.h (class Layout): Add have_stabstr_section_ field.
10300         Declare link_stabs_sections.
10301
10302 2009-06-23  Doug Kwan  <dougkwan@google.com>
10303
10304         * Makefile.am (libgold_a_LIBADD): New.
10305         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10306         * Makefile.in: Regenerate.
10307         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10308         * configure: Regenerate.
10309         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10310         * fileread.cc: Include sys/state.h
10311         * gold.h: Declare memmem and strndup if found missing.
10312         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10313
10314 2009-06-23  Ian Lance Taylor  <iant@google.com>
10315
10316         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10317         * configure: Rebuild.
10318
10319 2009-06-23  Ian Lance Taylor  <iant@google.com>
10320
10321         PR 10147
10322         * object.cc (Object::section_contents): Don't try to get a view if
10323         the section has length zero.
10324         (Object::handle_gnu_warning_section): If the section is empty, use
10325         the name of the section as the warning.
10326
10327 2009-06-23  Ian Lance Taylor  <iant@google.com>
10328
10329         PR 10133
10330         * stringpool.h (class Stringpool_template): Add optimize_ field.
10331         (Stringpool_template::set_optimize): New function.
10332         * stringpool.cc (Stringpool_template::Stringpool_template):
10333         Initialize optimize_ field.
10334         (Stringpool_template::set_string_offsets): Test local optimize
10335         fild rather than parameter.
10336         * layout.cc (Layout::Layout): Call set_optimize on the section
10337         name stringpool.
10338
10339 2009-06-22  Ian Lance Taylor  <iant@google.com>
10340
10341         PR 10030
10342         * yyscript.y: Parse TARGET.
10343         * script.cc (script_set_target): New function.
10344         * script-c.h (script_set_target): Declare.
10345         * options.cc (General_options::string_to_object_format): Rename
10346         from string_to_object_format in anonymous namespace.  Change
10347         callers.
10348         * options.h (class General_options): Declare
10349         string_to_object_format.
10350
10351 2009-06-22  Ian Lance Taylor  <iant@google.com>
10352
10353         * script-sections.cc (Script_sections::create_segments): Don't put
10354         program headers in a PT_LOAD segment if -n or -N.
10355
10356 2009-06-22  Ian Lance Taylor  <iant@google.com>
10357
10358         PR 10141
10359         * options.h (class General_options): Add -z lazy and -z now.  Sort
10360         -z options into alphabetical order.
10361         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10362
10363 2009-06-21  Ian Lance Taylor  <iant@google.com>
10364
10365         * layout.cc (Layout::make_output_section): Call
10366         Target::new_output_section.
10367         (Layout::attach_allocated_section_to_segment): Put large section
10368         sections in a separate load segment with the large segment flag
10369         set.
10370         (Layout::segment_precedes): Sort large data segments after other
10371         load segments.
10372         (align_file_offset): New static function.
10373         (Layout::set_segment_offsets): Use align_file_offset.
10374         * output.h (class Output_section): Add is_small_section_ and
10375         is_large_section_ fields.
10376         (Output_section::is_small_section): New function.
10377         (Output_section::set_is_small_section):  New function.
10378         (Output_section::is_large_section): New function.
10379         (Output_section::set_is_large_section): New function.
10380         (Output_section::is_large_data_section): New function.
10381         (class Output_segment): Add is_large_data_segment_ field.
10382         (Output_segment::is_large_data_segment): New function.
10383         (Output_segment::set_is_large_data_segment): New function.
10384         * output.cc (Output_section::Output_section): Initialize new
10385         fields.
10386         (Output_segment::Output_segment): Likewise.
10387         (Output_segment::add_output_section): Add assertion that large
10388         data sections always go in large data segments.  Force small data
10389         sections to the end of the list of data sections.  Force small BSS
10390         sections to the start of the list of BSS sections.  For large BSS
10391         sections to the end of the list of BSS sections.
10392         * symtab.h (class Symbol): Declare is_common_shndx.
10393         (Symbol::is_defined): Check Symbol::is_common_shndx.
10394         (Symbol::is_common): Likewise.
10395         (class Symbol_table): Define enum Commons_section_type.  Update
10396         declarations.  Add small_commons_ and large_commons_ fields.
10397         * symtab.cc (Symbol::is_common_shndx): New function.
10398         (Symbol_table::Symbol_table): Initialize new fields.
10399         (Symbol_table::add_from_object): Put small and large common
10400         symbols in the right list.
10401         (Symbol_table::sized_finalized_symbol): Check
10402         Symbol::is_common_shndx.
10403         (Symbol_table::sized_write_globals): Likewise.
10404         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10405         common symbol lists.  Don't call do_allocate_commons_list if the
10406         list is empty.
10407         (Symbol_table::do_allocate_commons_list): Remove is_tls
10408         parameter.  Add comons_section_type parameter.  Change all
10409         callers.  Handle small and large common symbols.
10410         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10411         Symbol::is_common_shndx.
10412         * resolve.cc (symbol_to_bits): Likewise.
10413         * target.h (Target::small_common_shndx): New function.
10414         (Target::small_common_section_flags): New function.
10415         (Target::large_common_shndx): New function.
10416         (Target::large_common_section_flags): New function.
10417         (Target::new_output_section): New function.
10418         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10419         small_common_section_flags, and large_common_section_flags
10420         fields.
10421         (Target::do_new_output_section): New virtual function.
10422         * arm.cc (Target_arm::arm_info): Initialize new fields.
10423         * i386.cc (Target_i386::i386_info): Likewise.
10424         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10425         Likewise.
10426         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10427         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10428         (Target_x86_64::do_new_output_section): New function.
10429         * configure.ac: Define conditional MCMODEL_MEDIUM.
10430         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10431         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10432         (large_LDFLAGS): Define.
10433         * testsuite/large.c: New file.
10434         * testsuite/testfile.cc (Target_test::test_target_info):
10435         Initialize new fields.
10436         * configure, testsuite/Makefile.in: Rebuild.
10437
10438 2009-06-05  Doug Kwan  <dougkwan@google.com>
10439
10440         * Makefile.am (CCFILES): Add target.cc.
10441         * Makefile.in: Regenerate.
10442         * i386.cc (class Target_i386): Define new virtual method to
10443         override do_is_local_label_name in parent.
10444         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10445         local symbols if --discard-locals or -X is given.
10446         * options.h (class General_options): Declare new options
10447         '--discard-locals' and '-X' for discarding locals.
10448         * target.h (class Target): Define new methods is_local_label_name.
10449         Declare new virtual method do_is_local_label_name.
10450         * target.cc: New file.
10451         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10452         (check_SCRIPTS): Add discard_locals_test.sh.
10453         (check_DATA): Add discard_local_tests.syms.
10454         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10455         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10456         * testsuite/Makefile.in: Regenerate.
10457         * testsuite/discard_locals_test.c: New file.
10458         * testsuite/discard_locals_test.sh: Same.
10459
10460 2009-06-05  Doug Kwan  <dougkwan@google.com>
10461
10462         * object.cc (Sized_relobj::Sized_relobj): Initialize
10463         discarded_eh_frame_shndx_ to -1U.
10464         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10465         section.
10466         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10467         a discarded .eh_frame section.
10468         (Sized_relobj::do_finalize_local_symbols): Ditto.
10469         * object.h (class Sized_relobj): Declare new member
10470         discarded_eh_frame_shndx_.
10471         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10472         (local_labels_test.o, local_labels_test): New rules.
10473         * testsuite/Makefile.in: Regenerate.
10474
10475 2009-06-04  Doug Kwan  <dougkwan@google.com>
10476
10477         * layout.cc (Layout::section_name_mapping): Add mapping for
10478         special ARM sections.
10479
10480 2009-06-03  Doug Kwan  <dougkwan@google.com>
10481
10482         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10483         (utils::has_overflow): Same.
10484
10485 2009-06-03  Ian Lance Taylor  <iant@google.com>
10486
10487         * layout.cc (Layout::section_name_mapping): New array, replacing
10488         Layout::linkonce_mapping.
10489         (Layout::section_name_mapping_count): New variable, replacing
10490         Layout::linkonce_mapping_count.
10491         (Layout::linkonce_output_name): Remove.
10492         (Layout::output_section_name): Rewrite.
10493         * layout.h (class Layout): Rename Linkonce_mapping to
10494         Section_name_mapping, linkonce_mapping to section_name_mapping,
10495         linkonce_mapping_count to section_name_mapping_count.  Don't
10496         declare linkonce_output_name.
10497
10498 2009-06-03  Doug Kwan  <dougkwan@google.com>
10499
10500         * gold/arm.cc (namespace utils): New.
10501         (Target_arm::reloc_is_non_pic): Define new method.
10502         (class Arm_relocate_functions): New.
10503         (Target_arm::Relocate::relocate): Handle relocation types used by
10504         Android.
10505
10506 2009-06-03  Ian Lance Taylor  <iant@google.com>
10507
10508         * arm.cc (Target_arm::scan::global): Use || instead of |.
10509
10510 2009-06-02  Doug Kwan  <dougkwan@google.com>
10511
10512         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10513         issued_non_pic_error_.
10514         (class Target_arm::Scan): Declare new method check_non_pic.
10515         Define new method symbol_needs_plt_entry.
10516         Declare new data member issued_non_pic_error_.
10517         (class Target_arm::Relocate): Declare new method
10518         should_apply_static_reloc.
10519         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10520         (Target_arm::Scan::check_non_pic): Define new method.
10521         (Target_arm::Scan::local): Handle a small subset of reloc types used
10522         by Android.
10523         (Target_arm::Scan::local): Same.
10524         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10525
10526 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10527
10528         * incremental.cc (Incremental_inputs::report_command_line): Filter
10529         out --incremental-* options.
10530
10531 2009-05-29  Doug Kwan  <dougkwan@google.com>
10532
10533         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10534         template class.
10535         (class Target_arm): Update comment.
10536         (Target_arm::Target_arm): Initialize new data members GOT_,
10537         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10538         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10539         and Target_arm::rel_dyn_section.
10540         Declare new_enum Target_arm::Got_type.
10541         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10542         and DYNBSS_.
10543         Update commments for member do_dynsym_value.
10544         (Target_arm::got_size, Target_arm::plt_section,
10545         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10546         new methods inside class defintion.
10547         (Target_arm::got_section): Define new method.
10548         (Target_arm::rel_dyn_section): Same.
10549         (Output_data_plt_arm): New template class.
10550         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10551         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10552         (Output_data_plt_arm::add_entry): Same.
10553         (Output_data_plt_arm::first_plt_entry): Define new
10554         static data member for PLT instruction template.
10555         (Output_data_plt_arm::plt_entry): Same.
10556         (Output_data_plt_arm::do_write): Define new method.
10557         (Target_arm::make_plt_entry): Same.
10558         (Target_arm::do_finalize_sections): Same.
10559         (Target_arm::do_dynsym_value): Same.
10560
10561 2009-05-28  Doug Kwan  <dougkwan@google.com>
10562
10563         * Makefile.am (TARGETSOURCES): Add arm.cc.
10564         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10565         * Makefile.in: Regenerate.
10566         * arm.cc: New file.
10567         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10568
10569 2009-05-26  Doug Kwan  <dougkwan@google.com>
10570
10571         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10572         (General_options::check_excluded_libs): Strip off directories in
10573         archive name before matching like GNU ld does.
10574         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10575         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10576         (exclude_libs_test_LDFLAGS): Add linker option
10577         -Wl,--exclude-libs,libexclude_libs_test_3
10578         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10579         an explicit archive without using -l.
10580         (alt/libexclude_libs_test_3.a): New make rule.
10581         * testsuite/Makefile.in: Regenerate.
10582         * testsuite/exclude_libs_test.c : Declare lib3_default().
10583         (main): Call it.
10584         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10585         * exclude_libs_test_3.c: New file.
10586
10587 2009-05-26  Nick Clifton  <nickc@redhat.com>
10588
10589         * po/id.po: New Indonesian translation.
10590         * po/gold.pot: Updated template file.
10591
10592 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10593
10594         * testsuite/Makefile.am: Add -ffunction-sections to compile
10595         gc_comdat_test files.  Add -Wl,--gc-sections to build
10596         gc_comdat_test.
10597         * testsuite/Makefile.in: Regenerate.
10598         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10599
10600 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10601
10602         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10603         kept comdat section was garbage collected.
10604         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10605         * testsuite/Makefile.in: Regenerate.
10606         * testsuite/gc_comdat_test.sh: New file.
10607         * testsuite/gc_comdat_test_1.cc: New file.
10608         * testsuite/gc_comdat_test_2.cc: New file.
10609
10610 2009-05-19  Doug Kwan  <dougkwan@google.com>
10611
10612         * archive.cc (Archive::Archive): Move constructor from archive.h
10613         to here.  Initialize no_export_.
10614         (Archive::get_elf_object_for_member): Set no_export flag of object.
10615         * archive.h (Archive::Archive): Move constructor body to
10616         archive.cc.
10617         (Archive::no_export): New method.
10618         (Archive::no_export_): New field.
10619         * object.h (Object::Object): Initialize no_export_ to false.
10620         (Object::no_export, Object::set_no_export): New methods.
10621         (Object::no_export_): New field.
10622         * options.cc (General_options::parse_exclude_libs): New method.
10623         (General_options::check_excluded_libs) Same.
10624         * options.h (exclude_libs): New option.
10625         (General_options::check_excluded_libs): New method declaration.
10626         (General_options::excluded_libs_): New field.
10627         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10628         default or protected visibility if an object has no-export flag set.
10629         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10630         (check_SCRIPTS): Add exclude_libs_test.sh.
10631         (check_DATA): Add exclude_libs_test.syms.
10632         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10633         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10634         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10635         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10636         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10637         libexclude_libs_test_2.a): New rules.
10638         * testsuite/Makefile.in: Regenerate.
10639         * testsuite/exclude_libs_test.c: New file.
10640         * testsuite/exclude_libs_test.sh: Ditto.
10641         * testsuite/exclude_libs_test_1.c: Ditto.
10642         * testsuite/exclude_libs_test_2.c: Ditto.
10643
10644 2009-05-15  Ian Lance Taylor  <iant@google.com>
10645
10646         * configure.ac: Check for declarations for cases where libiberty.h
10647         checks HAVE_DECL_xxx.
10648         * configure, config.in: Rebuild.
10649
10650 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10651
10652         * gold.h (Incremental_argument_list): Remove (invalid) forward
10653         declaration.
10654         * incremental.cc (Incremental_inputs::report_achive): New method.
10655         (Incremental_inputs::report_object): New method.
10656         (Incremental_inputs::report_script): New method.
10657         (Incremental_inputs::finalize_inputs): New method.
10658         (Incremental_inputs::finalize): Call finalize_inputs().
10659         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10660         Create inputs entries.
10661         * incremental.h (Incremental_input_type): New enum.
10662         (Incremental_inputs::Incremental_input): Initialize new fields.
10663         (Incremental_inputs::report_inputs): New method.
10664         (Incremental_inputs::report_achive): New method.
10665         (Incremental_inputs::report_object): New method.
10666         (Incremental_inputs::report_script): New method.
10667         (Incremental_inputs::finalize_inputs): New method.
10668         (Incremental_inputs::Input_info): New struct.
10669         (Incremental_inputs::Input_info_map): New typedef.
10670         (Incremental_inputs::lock_): New field.
10671         (Incremental_inputs::Inputs_): New field.
10672         (Incremental_inputs::Inputs_map): New field.
10673         * main.cc (main): Call Incremental_input::report_inputs.
10674         * options.h (Input_argument_list): Typedef moved from
10675         Input_arguments.
10676         (Input_file_group::Files): Remove, use ::Input_argument_list.
10677         (Input_file_group::Input_argument_list): Remove, use
10678         ::Input_argument_list.
10679         * plugin.cc (Plugin_manager::add_input_file): Add error in
10680         incremental build.
10681         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10682         functions.
10683         * script.cc (read_input_script): Call
10684         Incremental_input::report_script.
10685         * script.h (Script_info): New class.
10686
10687 2009-04-27  Ian Lance Taylor  <iant@google.com>
10688
10689         * x86_64.cc (do_adjust_output_section): Set entsize to
10690         plt_entry_size.
10691
10692 2009-04-23  Elliott Hughes  <enh@google.com>
10693
10694         * output.cc (Output_file::close): After short writes, continue
10695         writing from the correct offset in the buffer being written.
10696
10697 2009-04-23  Chris Demetriou  <cgd@google.com>
10698
10699         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10700         * configure: Regenerate.
10701         * config.in: Regenerate.
10702         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10703         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10704
10705 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10706
10707         * incremental.cc (Incremental_inputs_header_data): Renamed from
10708         Incremental_input_header_data.
10709         (Incremental_inputs_header_data::data_size): New field.
10710         (Incremental_inputs_header_data::put_input_file_count): Renamed
10711         from input_file_count.
10712         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10713         from command_line_offset.
10714         (Incremental_inputs_header_data::put_reserved): Renamed from
10715         put_reserved.
10716         (Incremental_inputs_entry_data): Renamed from
10717         Incremental_input_entry_data.
10718         (Incremental_inputs_entry_data::data_size): New field.
10719         (Incremental_inputs::report_command_line): New method.
10720         (Incremental_inputs::finalize): New method.
10721         (Incremental_inputs::create_incremental_inputs_data): New method.
10722         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10723         * incremental.h: New file.
10724         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10725         (Layout::finalize): Create incremental inputs section in
10726         incremental builds.
10727         (Layout::create_incremental_info_sections): New method.
10728         * layout.h (Layout::incremental_inputs): New method.
10729         (Layout::create_incremental_info_sections): New method.
10730         (Layout::incremental_inputs_): New field.
10731         * main.cc (main): Notify Incremental_input of the command line.
10732
10733 2009-04-01  Ian Lance Taylor  <iant@google.com>
10734             Mikolaj Zalewski  <mikolajz@google.com>
10735
10736         * gold.h (reserve_unordered_map): Define, three versions, one for
10737         each version of Unordered_map.
10738         * layout.cc (Layout::Layout): Remove options parameter.  Add
10739         number_of_input_files parameter.  Don't initialize options_.
10740         Initialize number_of_input_files_ and resized_signatures_.  Move
10741         sections_are_attached_.
10742         (Layout::layout_group): Reserve space for group_signatures_.
10743         (Layout::find_or_add_kept_section): Change name parameter to be a
10744         reference.  Resize signatures_ map when it gets large enough.
10745         (Layout::layout_eh_frame): Use parameters->options() instead of
10746         this->options_.
10747         (Layout::make_output_section): Likewise.
10748         (Layout::attach_allocated_section_to_segment): Likewise.
10749         (Layout::finalize, Layout::create_executable_stack): Likewise.
10750         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10751         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10752         * layout.h (class Layout): Update declarations.  Remove options_
10753         field.  Add number_of_input_files_ and resized_signatures_
10754         fields.  Move sections_are_attached_ field.
10755         * main.cc (main): Pass number of input files to Layout
10756         constructor.  Don't pass options.
10757
10758 2009-03-30  Ian Lance Taylor  <iant@google.com>
10759
10760         * ffsll.c (ffsll): Correct implementation.
10761
10762 2009-03-27  Ian Lance Taylor  <iant@google.com>
10763
10764         * ffsll.c: New file.
10765         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10766         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10767         * ftruncate.c (ftruncate): Declare before definition.
10768         * mremap.c (mremap): Likewise.
10769         * pread.c (pread): Likewise.
10770         * configure, Makefile.in, config.in: Rebuild.
10771
10772         * mremap.c: New file.
10773         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10774         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10775         (mremap): Declare if HAVE_MREMAP is not defined.
10776         * configure, Makefile.in, config.in: Rebuild.
10777
10778 2009-03-27  Cary Coutant  <ccoutant@google.com>
10779
10780         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10781         position independent.
10782         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10783         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10784
10785 2009-03-24  Cary Coutant  <ccoutant@google.com>
10786
10787         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10788         an executable.
10789         (needs_dynamic_reloc): Likewise.
10790
10791 2009-03-24  Ian Lance Taylor  <iant@google.com>
10792
10793         * yyscript.y (file_cmd): Recognize EXTERN.
10794         (extern_name_list, extern_name_list_body): New nonterminals.
10795         * script.cc (script_add_extern): Define.
10796         * script-c.h (script_add_extern): Declare.
10797
10798 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10799
10800         * object.cc (is_elf_object): Define.
10801         * object.h (is_elf_object): Declare.
10802         * archive.cc (Archive::get_elf_object_for_member): Call
10803         is_elf_object.
10804         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10805
10806 2009-03-24  Elliott Hughes  <enh@google.com>
10807
10808         * output.cc (Output_file::map_anonymous): Define.
10809         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10810         try an anonymous one.  Report the size if the mmap fails.
10811         * output.h (class Output_file): Declare map_anonymous.
10812
10813 2009-03-24  Ian Lance Taylor  <iant@google.com>
10814
10815         * target-select.cc (instantiate_target): Don't acquire the lock if
10816         the instantiated_target_ field has already been set.
10817
10818 2009-03-23  Ian Lance Taylor  <iant@google.com>
10819
10820         * gold-threads.h (class Initialize_lock): Define.
10821         * gold-threads.cc (class Initialize_lock_once): Define.
10822         (initialize_lock_control): New static variable.
10823         (initialize_lock_pointer): New static variable.
10824         (initialize_lock_once): New static function.
10825         (Initialize_lock::Initialize_lock): Define.
10826         (Initialize_lock::initialize): Define.
10827         * target-select.h: Include "gold-threads.h".
10828         (class Target_selector): Add lock_ and initialize_lock_ fields.
10829         Don't define instantiate_target, just declare it.
10830         * target-select.cc (Target_selector::Target_selector): Initialize
10831         new fields.
10832         (Target_selector::instantiate_target): Define.
10833         * descriptors.h: Include "gold-threads.h".
10834         (class Descriptors): Add initialize_lock_ field.
10835         * descriptors.cc (Descriptors::Descriptors): Initialize new
10836         field.
10837         (Descriptors::open): Use initialize_lock_ field
10838         * errors.h (class Errors): Add initialize_lock_ field.
10839         * errors.cc (Errors::Errors): Initialize new field.
10840         (Errors::initialize_lock): Use initialize_lock_ field.
10841         * powerpc.cc (class Target_selector_powerpc): Remove
10842         instantiated_target_ field.  In do_recognize call
10843         instantiate_target rather than do_instantiate_target.  In
10844         do_instantiate_target just allocate a new target.
10845         * sparc.cc (class Target_selector_sparc): Likewise.
10846
10847         * freebsd.h: New file.
10848         * i386.cc: Include "freebsd.h".
10849         (Target_i386): Derive from Target_freebsd rather than
10850         Sized_target.
10851         (Target_selector_i386): Derive from Target_selector_freebsd rather
10852         than Target_selector.
10853         * x86_64.cc: Include "freebsd.h".
10854         (Target_x86_64): Derive from Target_freebsd rather than
10855         Sized_target.
10856         (Target_selector_x86_64): Derive from Target_selector_freebsd
10857         rather than Target_selector.
10858         * target.h (class Target): Add adjust_elf_header and
10859         do_adjust_elf_header.
10860         * output.cc (Output_file_header:: do_sized_write): Call target
10861         adjust_elf_header routine.
10862         * configure.tgt: Set targ_osabi.
10863         * configure.ac: Define GOLD_DEFAULT_OSABI.
10864         * parameters.cc (Parameters::default_target): Pass
10865         GOLD_DEFAULT_OSABI to select_target.
10866         * target-select.h (class Target_selector): Make instantiate_target
10867         protected rather than private.
10868         * Makefile.am (HFILES): Add freebsd.h.
10869         * configure, Makefile.in, config.in: Rebuild.
10870
10871         * merge.cc (do_add_input_section): Correct pend value.  Change
10872         message about last entry not being null terminated from error to
10873         warning.
10874
10875 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10876
10877         * incremental.cc: New file.
10878         * Makefile.am (CCFILES): Add incremental.cc.
10879         * Makefile.in: Rebuild.
10880
10881 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10882
10883         * layout.cc (Layout::output_section_name): Preserve names
10884         of '.note.' sections.
10885
10886 2009-03-19  Ian Lance Taylor  <iant@google.com>
10887
10888         * descriptors.cc (Descriptors::open): Check that the options are
10889         valid before using them.
10890
10891 2009-03-18  Ian Lance Taylor  <iant@google.com>
10892
10893         * script-sections.h: Include <list>.
10894         (class Script_sections): Change Sections_elements from std::vector
10895         to std::list.  Typedef public Elements_iterator.  Add
10896         orphan_section_placement_, data_segment_align_start_, and
10897         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10898         field.
10899         * script-sections.cc (class Orphan_section_placement): New class.
10900         (class Sections_element): Add virtual functions is_relro and
10901         orphan_section_init.  Remove virtual function place_orphan_here.
10902         (class Output_section_definition): Add is_relro and
10903         orphan_section_init.  Remove place_orphan_here.
10904         (class Orphan_output_section): Likewise.
10905         (Script_sections::Script_sections): Update for field changes.
10906         (Script_sections::data_segment_align): Set saw_data_segment_align_
10907         and data_segment_align_start_, not data_segment_align_index.
10908         (Script_sections::data_segment_relro_end): Check
10909         saw_data_segment_align_.  Use data_segment_align_start_ rather
10910         than data_segment_align_index_.
10911         (Script_sections::place_orphan): Rewrite to use
10912         Orphan_section_placement.
10913
10914 2009-03-17  Ian Lance Taylor  <iant@google.com>
10915
10916         * archive.cc (Archive::add_symbols): Check for a version attached
10917         to the symbol name in the archive map.
10918         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10919         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10920         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10921         (ver_test_11.a): New target.
10922         * testsuite/Makefile.in: Rebuild.
10923
10924         * configure.ac: Check for chsize and posix_fallocate.  Replace
10925         ftruncate.
10926         * ftruncate.c: New file, from gnulib.
10927         * output.cc (posix_fallocate): Define dummy version if not
10928         HAVE_POSIX_FALLOCATE.
10929         (Output_file::map): Call posix_fallocate rather than lseek and
10930         write.
10931         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10932         * configure, Makefile.in, config.in: Rebuild.
10933
10934 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10935
10936         * layout.h (Layout::create_note): Add section_name parameter.
10937         * layout.cc (Layout::create_note): Likewise.
10938         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10939
10940 2009-03-17  Ian Lance Taylor  <iant@google.com>
10941
10942         * descriptors.cc: Include "options.h".
10943         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10944         (Descriptors::open): Always use O_CLOEXEC when opening a new
10945         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10946         then set FD_CLOEXEC.
10947
10948         * sparc.cc (class Target_sparc): Add has_got_section.
10949         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10950         make sure we have a GOT section.
10951
10952         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10953         (Target_sparc::Scan::local): Likewise.
10954         (Target_sparc::Scan::global): Likewise.
10955         (Target_sparc::Relocate::relocate): Likewise.
10956         (Target_sparc::Relocate::relocate_tls): Likewise.
10957
10958         * symtab.cc (Symbol_table::define_default_version): New function,
10959         broken out of add_from_object.
10960         (Symbol_table::add_from_object): Call define_default_version.
10961         (Symbol_table::define_special_symbol): Add resolve_oldsym
10962         parameter.  Change all callers.  If the version for a symbol comes
10963         from a version script, resolve it with the symbol with the same
10964         name with no version.  Also add the symbol without a version if
10965         appropriate.
10966         (do_define_in_output_data): If resolving with oldsym, don't delete
10967         sym.
10968         (do_define_in_output_segment): Likewise.
10969         (do_define_as_constant): Likewise.
10970         * symtab.h (class Symbol_table): Update declarations.
10971
10972 2009-03-13  Ian Lance Taylor  <iant@google.com>
10973
10974         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10975         (Read_symbols::requeue): New function.
10976         (Read_symbols::do_read_symbols): If make_elf_object fails because
10977         the target type is not configured, and the file was searched for,
10978         issue a warning and retry with the next directory.
10979         (Add_symbols::run): If the file has an incompatible format, and
10980         it was searched for, requeue the Read_symbols task.  On error,
10981         release the object.
10982         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10983         dirindex parameter to constructor.  Change all callers.  Declare
10984         incompatible_warning and requeue.
10985         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10986         input_argument_ and input_group_ fields.  Add them to
10987         constructor.  Change all callers.
10988         (class Read_script): Add dirindex_ field.  Add it to constructor.
10989         Change all callers.
10990         * archive.cc (Archive::setup): Remove input_objects parameter.
10991         Change all callers.
10992         (Archive::get_file_and_offset): Likewise.
10993         (Archive::read_all_symbols): Likewise.
10994         (Archive::read_symbols): Likewise.
10995         (Archive::get_elf_object_for_member): Remove input_objects
10996         parameter.  Add punconfigured parameter.  Change all callers.
10997         (Archive::add_symbols): Change return type to bool.  Check return
10998         value of include_member.
10999         (Archive::include_all_members): Likewise.
11000         (Archive::include_member): Change return type to bool.  Return
11001         false if first included object has incompatible target.  Set
11002         included_member_ field.
11003         (Add_archive_symbols::run): If add_symbols returns false, requeue
11004         Read_symbols task.
11005         * archive.h (class Archive): Add included_member_ field.
11006         Initialize it in constructor.  Add input_file and searched_for
11007         methods.  Update declarations.
11008         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11009         input_argument_ fields.  Add them to constructor.  Change all
11010         callers.
11011         * script.cc: Include "target-select.h".
11012         (class Parser_closure): Add skip_on_incompatible_target_ and
11013         found_incompatible_target_ fields.  Add
11014         skip_on_incompatible_target parameter to constructor.  Change all
11015         callers.  Add methods skip_on_incompatible_target,
11016         clear_skip_on_incompatible_target, found_incompatible_target, and
11017         set_found_incompatible_target.
11018         (read_input_script): Add dirindex parameter.  Change all callers.
11019         If parser finds an incompatible target, requeue Read_symbols
11020         task.
11021         (script_set_symbol): Clear skip_on_incompatible_target in
11022         closure.
11023         (script_add_assertion, script_parse_option): Likewise.
11024         (script_start_sections, script_add_phdr): Likewise.
11025         (script_check_output_format): New function.
11026         * script.h (read_input_script): Update declaration.
11027         * script-c.h (script_check_output_format): Declare.
11028         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11029         (ignore_cmd): Remove OUTPUT_FORMAT.
11030         * fileread.cc (Input_file::Input_file): Add explicit this.
11031         (Input_file::will_search_for): New function.
11032         (Input_file::open): Add pindex parameter.  Change all callers.
11033         * fileread.h (class Input_file): Add input_file_argument method.
11034         Declare will_search_for.  Update declarations.
11035         * object.cc (make_elf_object): Add punconfigured parameter.
11036         Change all callers.
11037         * object.h (class Object): Make input_file public.  Add
11038         searched_for method.
11039         (make_elf_object): Update declaration.
11040         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11041         restart search.
11042         * dirsearch.h (class Dirsearch): Update declaration.
11043         * options.h (class General_options): Add --warn-search-mismatch.
11044         * parameters.cc (Parameters::is_compatible_target): New function.
11045         * parameters.h (class Parameters): Declare is_compatible_target.
11046         * workqueue.cc (Workqueue::add_blocker): New function.
11047         * workqueue.h (class Workqueue): Declare add_blocker.
11048
11049         * fileread.cc (Input_file::open): Remove options parameter.
11050         Change all callers.
11051         (Input_file::open_binary): Likewise.
11052         * script.cc (read_input_script): Likewise.
11053         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11054         options parameter from constructor.  Change all callers.
11055         (class Read_script): Likewise.
11056         * fileread.h (class Input_file): Update declarations.
11057         * script.h (read_input_script): Update declaration.
11058
11059 2009-03-10  Nick Clifton  <nickc@redhat.com>
11060
11061         * po/es.po: New Spanish translation.
11062
11063 2009-03-06  Cary Coutant  <ccoutant@google.com>
11064
11065         * options.cc (parse_short_option): Keep dash_z from registering itself.
11066
11067 2009-03-03  Ian Lance Taylor  <iant@google.com>
11068
11069         PR 9918
11070         * target-reloc.h (relocate_section): Pass output_section to
11071         relocate.
11072         * i386.cc (Target_i386::should_apply_static_reloc): Add
11073         output_section parameter.  Change all callers.
11074         (Target_i386::Relocate::relocate): Add output_section parameter.
11075         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11076         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11077         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11078         * testsuite/two_file_shared.sh: New script.
11079         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11080         (check_DATA): Add two_file_shared.dbg.
11081         (two_file_shared.dbg): New target.
11082         * testsuite/Makefile.in: Rebuild.
11083
11084 2009-03-01  Ian Lance Taylor  <iant@google.com>
11085
11086         * configure.ac: Check for byteswap.h.
11087         * configure: Rebuild.
11088         * config.in: Rebuild.
11089
11090 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11091
11092         * layout.cc (Layout::find_or_add_kept_section): New function.
11093         (Layout::add_comdat): Removed.
11094         * layout.h (struct Kept_section): Move out of class Layout.
11095         Remove trailing underscores from field names.  Add group_sections
11096         field.  Rename group_ field to is_group.  Change all uses.
11097         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11098         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11099         comdat_groups_ field.
11100         (Sized_relobj::include_section_group): Use
11101         find_or_add_kept_section and Kept_section::group_sections.
11102         (Sized_relobj::include_linkonce_section): Likewise.
11103         * object.cc (class Sized_relobj): Don't define Comdat_group or
11104         Comdat_group_table.  Remove find_comdat_group and
11105         add_comdat_group.  Remove comdat_groups_ field.
11106         * plugin.cc (include_comdat_group): Use
11107         Layout::find_or_add_kept_section.
11108
11109 2009-02-28  Ian Lance Taylor  <iant@google.com>
11110
11111         * README: --gc-sections and map files are now supported.  Document
11112         some build requirements.
11113
11114         PR 6992
11115         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11116         relocatable link set the value of the section symbol to zero.
11117         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11118         relocatable link don't include the section address in the local
11119         symbol value.
11120
11121 2009-02-27  Ian Lance Taylor  <iant@google.com>
11122
11123         PR 6811
11124         * options.h (class Search_directory): Add is_system_directory.
11125         (class General_options): Declare is_in_system_directory.
11126         * options.cc (get_relative_sysroot): Make static.
11127         (get_default_sysroot): Make static.
11128         (General_optoins::is_in_system_directory): New function.
11129         * fileread.cc (Input_file::is_in_system_directory): New function.
11130         * fileread.h (class Input_file): Declare is_in_system_directory.
11131         * object.h (class Object): Add is_in_system_directory.
11132         (class Input_objects): Remove system_library_directory_ field.
11133         * object.cc (Input_objects::add_object): Don't set
11134         system_library_directory_.
11135         (input_objects::found_in_system_library_directory): Remove.
11136         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11137         parameter.  Change all callers.
11138         (Symbol_table::sized_write_globals): Likewise.
11139         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11140         Call Object::is_in_system_directory.
11141         * symtab.h (class Symbol_table): Update declarations.
11142
11143         PR 5990
11144         * descriptors.h (Open_descriptor): Add is_on_stack field.
11145         * descriptors.cc (Descriptors::open): If the descriptor is on the
11146         top of the stack, remove it.  Initialize is_on_stack field.
11147         (Descriptors::release): Only add pod to stack if it is not on the
11148         stack already.
11149         (Descriptors::close_some_descriptor): Clear stack_next and
11150         is_on_stack fields.
11151
11152         PR 7091
11153         * output.cc (Output_section::find_starting_output_address): Rename
11154         from starting_output_address; add PADDR parameter; change return
11155         type.
11156         * output.h (class Output_section): Declare
11157         find_starting_output_address instead of starting_output_address.
11158         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11159         section symbol for which we can't find a merge section.
11160
11161         PR 9836
11162         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11163         hidden or internal, force the symbol to be local.
11164         * resolve.cc (Symbol::override_visibility): Define.
11165         (Symbol::override_base): Use override_visibility.
11166         (Symbol_table::resolve): Likewise.
11167         (Symbol::override_base_with_special): Likewise.
11168         (Symbol_table::override_with_special): If the visibility is hidden
11169         or internal, force the symbol to be local.
11170         * symtab.h (class Symbol): Add set_visibility and
11171         override_visibility.
11172         * testsuite/ver_test_1.sh: New file.
11173         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11174         (check_DATA): Add ver_test_1.syms.
11175         (ver_test_1.syms): New target.
11176         * testsuite/Makefile.in: Rebuild.
11177
11178 2009-02-25  Cary Coutant  <ccoutant@google.com>
11179
11180         * layout.cc (Layout::choose_output_section): Don't rename sections
11181         when using a linker script that has a SECTIONS clause.
11182         * Makefile.in: Regenerate.
11183
11184         * testsuite/Makefile.am (script_test_5.sh): New test case.
11185         * testsuite/Makefile.in: Regenerate.
11186         * testsuite/script_test_5.cc: New file.
11187         * testsuite/script_test_5.sh: New file.
11188         * testsuite/script_test_5.t: New file.
11189
11190 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11191
11192         * archive.cc (Archive::include_member): Update calls to add_symbols.
11193         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11194         the Layout argument.
11195         * dynobj.h (do_add_symbols): Add the Layout argument.
11196         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11197         Layout argument.
11198         * object.h (Object::add_symbols): Add the Layout argument.
11199         (Object::do_add_symbols): Add the Layout argument.
11200         (Sized_relobj::do_add_symbols): Add the Layout argument.
11201         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11202         Unify the two versions.
11203         (Add_plugin_symbols): Remove.
11204         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11205         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11206         (Add_plugin_symbols): Remove.
11207         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11208         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11209         (Add_symbols::run): Make it work with Pulginobj.
11210
11211 2009-02-06  Ian Lance Taylor  <iant@google.com>
11212
11213         * object.cc (Sized_relobj::do_layout): Make info message start
11214         with lower case letter.
11215
11216 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11217
11218         * binary.cc: Fix file comment.
11219
11220         * options.h (enum Incremental_disposition): Define.
11221         (class General_options): Add new options: --incremental,
11222         --incremental_changed, --incremental_unchanged,
11223         --incremental_unknown.  Add incremental_disposition_ and
11224         implicit_incremental_ fields.
11225         (General_options::incremental_disposition): New function.
11226         (class Position_dependent_options): Add incremental_disposition
11227         option.
11228         (Position_dependent_options::copy_from_options): Set incremental
11229         dispositions.
11230         * options.cc (General_options::parse_incremental_changed): New
11231         function.
11232         (General_options::parse_incremental_unchanged): New function.
11233         (General_options::parse_incremental_unknown): New function.
11234         (General_options::General_options): Initialize new fields
11235         incremental_disposition_ and implicit_incremental_.
11236         (General_options::finalize): Check for uasge of --incremental-*
11237         without --incremental.
11238
11239 2009-02-06  Chris Demetriou  <cgd@google.com>
11240
11241         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11242         pointer and to report location as the file name associated with
11243         the symbol.
11244         (gold_undefined_symbol_at_location): New function to replace the
11245         old gold_undefined_symbol functionality.
11246         * target-reloc.h (relocate_section): Update to use
11247         gold_undefined_symbol_at_location.
11248         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11249         Call gold_undefined_symbol function rather than gold_error.
11250         * errors.h (Errors::undefined_symbol): Take location as a
11251         string, rather than calculating it from a relocation.
11252         * errors.cc (Errors::fatal): Print "fatal error:" before the
11253         formatted message.
11254         (Errors::error, Errors::error_at_location): Print "error: "
11255         before the formatted message.
11256         (Errors::undefined_symbol): Take location as a string, rather
11257         than calculating it from a relocation.
11258         (gold_undefined_symbol_at_location): New function akin to
11259         old gold_undefined_symbol, calculates location from relocation.
11260         (gold_undefined_symbol): Change to take only a Symbol pointer
11261         and to report location as the file name associated with the symbol.
11262         * testsuite/debug_msg.sh: Update for changed error messages.
11263         * testsuite/undef_symbol.sh: Likewise.
11264
11265 2009-02-04  Duncan Sands  <baldrick@free.fr>
11266
11267         PR 9812
11268         * reduced_debug_output.h
11269         (Output_reduced_debug_abbrev_section::failed): Use format for
11270         gold_warning.
11271         (Output_reduced_debug_info_section::faild): Likewise.
11272
11273 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11274
11275         * script.cc (Lazy_demangler): New class.
11276         (Version_script_info::get_symbol_version_helper): Demangle a
11277         symbol only once.
11278
11279 2009-01-29  Cary Coutant  <ccoutant@google.com>
11280
11281         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11282         to __tls_get_addr.
11283         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11284
11285 2009-01-28  Ian Lance Taylor  <iant@google.com>
11286
11287         * version.cc (version_string): Bump to 1.9.
11288
11289         * gold.h: Include <cstring> and <stdint.h>.
11290         * version.cc: Include <cstdio>.
11291         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11292         warning.
11293         * reduced_debug_output.cc (insert_into_vector): Rename from
11294         Insert_into_vector; change all callers.  Use Swap_unaligned to
11295         avoid aliasing issue; remove union since it is unnecessary.
11296
11297 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11298
11299         * Makefile.am (CCFILES): Add gc.cc.
11300         (HFILES): Add gc.h.
11301         * Makefile.in: Regenerate.
11302         * gold.cc (Gc_runner): New class.
11303         (queue_initial_tasks): Call garbage collection related tasks
11304         when corresponding options are invoked.
11305         (queue_middle_gc_tasks): New function.
11306         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11307         processed early before laying out sections during garbage collection.
11308         * gold.h (queue_middle_gc_tasks): New function.
11309         (is_prefix_of): Move from "layout.cc".
11310         * i386.cc (Target_i386::gc_process_relocs): New function.
11311         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11312         * main.cc (main): Create object of class "Garbage_collection".
11313         * object.cc (Relobj::copy_symbols_data): New function.
11314         (Relobj::is_section_name_included): New function.
11315         (Sized_relobj::do_layout): Allow this function to be called twice
11316         during garbage collection and defer layout of section during the
11317         first call.
11318         * object.h (Relobj::get_symbols_data): New function.
11319         (Relobj::is_section_name_included): New function.
11320         (Relobj::copy_symbols_data): New function.
11321         (Relobj::set_symbols_data): New function.
11322         (Relobj::get_relocs_data): New function.
11323         (Relobj::set_relocs_data): New function.
11324         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11325         (Relobj::gc_process_relocs): New function.
11326         (Relobj::do_gc_process_relocs): New pure virtual function.
11327         (Relobj::sd_): New data member.
11328         (Sized_relobj::is_output_section_offset_invalid): New function.
11329         (Sized_relobj::do_gc_process_relocs): New function.
11330         * options.h (General_options::gc_sections): Modify to not be a no-op.
11331         (General_options::print_gc_sections): New option.
11332         * plugin.cc (Plugin_finish::run): Remove function call to
11333         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11334         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11335         * reloc.cc (Read_relocs::run): Add task to process relocs and
11336         determine unreferenced sections when doing garbage collection.
11337         (Gc_process_relocs): New class.
11338         (Sized_relobj::do_gc_process_relocs): New function.
11339         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11340         sections that are garbage collected.
11341         * reloc.h (Gc_process_relocs): New class.
11342         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11343         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11344         symbols whose corresponding sections are garbage collected.
11345         (Symbol_table::Symbol_table): Add new parameter for the garbage
11346         collection object.
11347         (Symbol_table::gc_mark_undef_symbols): New function.
11348         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11349         (Symbol_table::gc_mark_dyn_syms): New function.
11350         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11351         as garbage.
11352         (Symbol_table::add_from_object): Likewise.
11353         (Symbol_table::add_from_relobj): When building shared objects, do not
11354         treat externally visible symbols as garbage.
11355         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11356         table information for static and relocatable links.
11357         * symtab.h (Symbol_table::set_gc): New function.
11358         (Symbol_table::gc): New function.
11359         (Symbol_table::gc_mark_undef_symbols): New function.
11360         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11361         (Symbol_table::gc_mark_dyn_syms): New function.
11362         (Symbol_table::gc_): New data member.
11363         * target.h (Sized_target::gc_process_relocs): New pure virtual
11364         function.
11365         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11366         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11367
11368 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11369
11370         * options.h (General_options::gc_sections): Define as a no-op for now.
11371         (General_options::no_keep_memory): Ditto.
11372         (General_options::Bshareable): Define.
11373         * options.cc (General_options::finalize): Honor -Bshareable.
11374
11375 2009-01-20  Andreas Schwab  <schwab@suse.de>
11376
11377         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11378         read the value in the contents, since we don't use it.  Use the
11379         template endianness when writing.
11380         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11381
11382 2009-01-19  Andreas Schwab  <schwab@suse.de>
11383
11384         * configure.tgt (powerpc64-*): Fix targ_obj.
11385
11386 2009-01-15  Ian Lance Taylor  <iant@google.com>
11387
11388         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11389         local symbols when stripping all symbols.
11390
11391 2009-01-14  Cary Coutant  <ccoutant@google.com>
11392
11393         * output.cc (Output_reloc): Add explicit instantiations.
11394
11395 2009-01-14  Cary Coutant  <ccoutant@google.com>
11396
11397         * archive.cc (Archive::get_elf_object_for_member): Remove call
11398         to File_read::claim_for_plugin.
11399         * descriptors.cc (Descriptors::open): Remove reference to
11400         is_claimed.
11401         (Descriptors::claim_for_plugin): Remove.
11402         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11403         (Descriptors::is_claimed): Remove.
11404         (claim_descriptor_for_plugin): Remove.
11405         * fileread.cc (File_read::claim_for_plugin): Remove.
11406         * fileread.h (File_read::claim_for_plugin): Remove.
11407         (File_read::descriptor): Reopen descriptor if necessary.
11408         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11409         (Plugin_manager::all_symbols_read): Add task parameter. Change
11410         all callers.
11411         (Plugin_manager::get_input_file): New function.
11412         (Plugin_manager::release_input_file): New function.
11413         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11414         corresponding data member.
11415         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11416         and pass to base constructor. Change all callers.
11417         (get_input_file, release_input_file): New functions.
11418         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11419         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11420         (Plugin_manager::all_symbols_read): Add task parameter.
11421         (Plugin_manager::get_input_file): New function.
11422         (Plugin_manager::release_input_file): New function.
11423         (Plugin_manager::task_): New data member.
11424         (Pluginobj::Pluginobj): Add filesize parameter.
11425         (Pluginobj::filename): New function.
11426         (Pluginobj::descriptor): New function.
11427         (Pluginobj::filesize): New function.
11428         (Pluginobj::filesize_): New data member.
11429         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11430         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11431         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11432
11433         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11434         with archive libraries.
11435         * testsuite/Makefile.in: Regenerate.
11436         * testsuite/plugin_test.c (struct sym_info): New type.
11437         (get_input_file, release_input_file): New static variables.
11438         (onload): Capture new transfer vector entries.
11439         (claim_file_hook): Stop reading at end of file according to filesize.
11440         Factor out parsing of readelf output into separate function.
11441         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11442         APIs and get the source file name from the symbol table.  Convert
11443         source file name to corresponding object file name.  Print info
11444         message when adding new input files.
11445         (parse_readelf_line): New function.
11446         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11447         * testsuite/plugin_test_2.sh: Likewise.
11448         * testsuite/plugin_test_3.sh: Likewise.
11449         * testsuite/plugin_test_4.sh: New test case.
11450
11451 2009-01-07  Ian Lance Taylor  <iant@google.com>
11452
11453         * version.cc (version_string): Bump to 1.8.
11454
11455 2008-12-23  Cary Coutant  <ccoutant@google.com>
11456
11457         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11458         * plugin.cc (Plugin_manager::finish): Rename as
11459         layout_deferred_objects.  Move cleanup to separate function.
11460         (Plugin_manager::cleanup): New function.
11461         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11462         separately.
11463         * plugin.h (Plugin_manager::finish): Rename as
11464         layout_deferred_objects.
11465         (Plugin_manager::cleanup): New function.
11466         (Plugin_manager::cleanup_done): New field.
11467
11468 2008-12-23  Cary Coutant  <ccoutant@google.com>
11469
11470         * plugin.cc (is_visible_from_outside): New function.
11471         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11472         so we don't return "IR only" status for exported symbols or -r links.
11473
11474         * testsuite/Makefile.am (plugin_test_3): New test case.
11475         * testsuite/Makefile.in: Regenerate.
11476         * testsuite/plugin_test_3.sh: New file.
11477
11478 2008-12-22  Cary Coutant  <ccoutant@google.com>
11479
11480         * object.cc (Sized_relobj::layout_section): New function.
11481         (Sized_relobj::do_layout): Defer layout of input sections until after
11482         plugin has provided replacement files.
11483         (Sized_relobj::do_layout_deferred_sections): New function.
11484         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11485         (Relobj::layout_deferred_sections): New function.
11486         (Relobj::do_layout_deferred_sections): New function.
11487         (Sized_relobj::do_layout_deferred_sections): New function.
11488         (Sized_relobj::layout_section): New function.
11489         (Sized_relobj::Deferred_layout): New structure.
11490         (Sized_relobj::deferred_layout_): New field.
11491         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11492         Change all callers.  Layout deferred sections.
11493         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11494         references.
11495         (Plugin_hook::run): Move code from do_plugin_hook inline.
11496         (Plugin_hook::do_plugin_hook): Remove.
11497         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11498         (Plugin_manager::finish): Renamed, was cleanup.
11499         (Plugin_manager::should_defer_layout): New function.
11500         (Plugin_manager::add_deferred_layout_object): New function.
11501         (Plugin_manager::Deferred_layout_list): New type.
11502         (Plugin_manager::deferred_layout_objects_): New field.
11503         (Plugin_hook::do_plugin_hook): Remove.
11504
11505 2008-12-17  Ian Lance Taylor  <iant@google.com>
11506
11507         * options.h (class General_options): Add --no case for
11508         --export-dynamic.
11509
11510 2008-12-16  Cary Coutant  <ccoutant@google.com>
11511
11512         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11513         vector.
11514         (Plugin_manager::claim_file): Create plugin object even if
11515         plugin did not call the add_symbols callback.
11516         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11517         asking for more symbols than were added.
11518         * testsuite/Makefile.am (plugin_test_1): Add test case with
11519         no global symbols.
11520         (empty.syms): New target.
11521         * testsuite/Makefile.in: Regenerate.
11522         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11523         message. Don't call add_symbols if no globals.
11524         (all_symbols_read_hook): Don't provide replacement for empty
11525         claimed file.
11526
11527 2008-12-12  Ian Lance Taylor  <iant@google.com>
11528
11529         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11530         r_type == 0 for a local symbol with r_sym == 0.
11531         (scan_relocatable_relocs): Pass r_sym to
11532         local_non_section_strategy.
11533         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11534         r_sym parameter.
11535
11536         * configure.ac: Update test for TLS descriptors: they are
11537         supported as of glibc 2.9.
11538         * configure: Rebuild.
11539
11540 2008-12-11  Ian Lance Taylor  <iant@google.com>
11541
11542         PR 7091
11543         * target-reloc.h (Default_scan_relocatable_relocs): For each
11544         function, map r_type == 0 to RELOC_DISCARD.
11545
11546 2008-12-10  Cary Coutant  <ccoutant@google.com>
11547
11548         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11549         object to override a kept COMDAT group from a plugin object.
11550
11551 2008-12-09  Ian Lance Taylor  <iant@google.com>
11552
11553         PR 7088
11554         * yyscript.y (file_cmd): Handle INPUT.
11555
11556         * testsuite/initpri1.c: Change all declarations to be full
11557         prototypes by adding void, to avoid compiler warnings.
11558
11559 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11560
11561         * options.cc (General_options::parse_plugin_opt): New.
11562         (General_options::add_plugin): The argument now is just the filename.
11563         (General_options::add_plugin_option): New.
11564         * options.h (plugin_opt): New.
11565         (add_plugin): Change argument name.
11566         (add_plugin_option): New.
11567         * plugin.cc (Plugin::load): Don't parse the plugin option.
11568         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11569         (Plugin::add_option): New.
11570         (Plugin::args_): Change type.
11571         (Plugin::filename_): New.
11572         (Plugin_manager::add_plugin_option): New.
11573         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11574         * testsuite/Makefile.in: Regenerate.
11575
11576 2008-12-05  Cary Coutant  <ccoutant@google.com>
11577
11578         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11579         Handle --strip-lto-sections option.
11580         * options.h (strip_lto_sections): New option.
11581
11582 2008-12-01  Cary Coutant  <ccoutant@google.com>
11583
11584         * plugin.cc (ld_plugin_message): Change format parameter to const.
11585         Fix mismatch between new[] and delete.
11586
11587 2008-11-14  Cary Coutant  <ccoutant@google.com>
11588
11589         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11590         instead of -1U.
11591
11592 2008-11-05  Craig Silverstein  <csilvers@google.com>
11593
11594         * options.cc (General_options::parse_dynamic_list): New function.
11595         * options.h (General_options): New flags dynamic_list,
11596         dynamic_list_data, dynamic_list_cpp_new, and
11597         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11598         (General_options::in_dynamic_list): New function.
11599         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11600         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11601         (Lex::can_continue_name): Likewise.
11602         (yylex): Likewise.
11603         (read_script_file): New parameter script_options.
11604         (read_dynamic_list): New function.
11605         (Script_options::define_dynamic_list): New function.
11606         (dynamic_list_keyword_parsecodes): New variable.
11607         (dynamic_list_keywords): New variable.
11608         * script.h (Script_options::define_dynamic_list): New function
11609         prototype.
11610         (read_dynamic_list): New function prototype.
11611         * symtab.cc (strprefix): New macro.
11612         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11613         dynamic_list_data, dynamic_list_cpp_new, and
11614         dynamic_list_cpp_typeinfo.
11615         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11616         (dynamic_list_expr): New rule.
11617         (dynamic_list_nodes): Likewise.
11618         (dynamic_list_node): Likewise.
11619         * testsuite/Makefile.am (dynamic_list): New test.
11620         * testsuite/Makefile.in: Regenerated.
11621         * testsuite/dynamic_list.t: New file.
11622         * testsuite/dynamic_list.sh: New file.
11623
11624 2008-11-05  Craig Silverstein  <csilvers@google.com>
11625
11626         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11627         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11628         (t11_last): Likewise.
11629         * testsuite/ver_test_6.c (main): Likewise.
11630
11631 2008-10-07  Cary Coutant  <ccoutant@google.com>
11632
11633         * options.c (General_options::finalize): Add check for -static and
11634         -shared.
11635         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11636         is not empty.
11637
11638 2008-10-02  Cary Coutant  <ccoutant@google.com>
11639
11640         * plugin.cc (make_sized_plugin_object): Fix conditional
11641         compilation to work when not all targets are enabled.
11642
11643 2008-09-29  Cary Coutant  <ccoutant@google.com>
11644
11645         * archive.cc (Archive::get_file_and_offset): Use filename instead
11646         of name to get library path.
11647         (Archive::include_member): Unlock external member of a thin archive.
11648
11649         * testsuite/Makefile.am (TEST_AR): New variable.
11650         (thin_archive_test_1): New test.
11651         (thin_archive_test_2): New test.
11652         * testsuite/Makefile.in: Regenerate.
11653         * testsuite/thin_archive_main.cc: New file.
11654         * testsuite/thin_archive_test_1.cc: New file.
11655         * testsuite/thin_archive_test_2.cc: New file.
11656         * testsuite/thin_archive_test_3.cc: New file.
11657         * testsuite/thin_archive_test_4.cc: New file.
11658
11659 2008-09-29  Cary Coutant  <ccoutant@google.com>
11660
11661         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11662         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11663         instead of -1U.
11664         (Sized_relobj::do_finalize_local_symbols): Likewise.
11665         (Sized_relobj::map_to_kept_section): Likewise.
11666         * object.h (Sized_relobj::invalid_address): New constant.
11667         (Sized_relobj::do_output_section_offset): Check for invalid_address
11668         and return -1ULL.
11669         * output.cc (Output_reloc::local_section_offset): Use constant
11670         invalid_address instead of -1U.
11671         (Output_reloc::get_address): Likewise.
11672         (Output_section::output_address): Change -1U to -1ULL.
11673         * output.h (Output_reloc::invalid_address): New constant.
11674         * reloc.cc (Sized_relobj::write_sections): Use constant
11675         invalid_address instead of -1U.
11676         (Sized_relobj::relocate_sections): Likewise.
11677         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11678         values for merge sections.
11679         * target-reloc.h (relocate_for_relocatable): Use constant
11680         invalid_address instead of -1U.
11681
11682 2008-09-19  Cary Coutant  <ccoutant@google.com>
11683
11684         Add plugin functionality for link-time optimization (LTO).
11685         * configure.ac (plugins): Add --enable-plugins option.
11686         * configure: Regenerate.
11687         * config.in: Regenerate.
11688         * Makefile.am (LIBDL): New variable.
11689         (CCFILES): Add plugin.cc.
11690         (HFILES): Add plugin.h.
11691         (ldadd_var): Add LIBDL.
11692         * Makefile.in: Regenerate.
11693
11694         * archive.cc: Include "plugin.h".
11695         (Archive::setup): Don't preread archive symbols when using a plugin.
11696         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11697         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11698         files.
11699         (Archive::include_member): Add symbols from plugin objects.
11700         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11701         * descriptors.cc (Descriptors::open): Check for file descriptors
11702         abandoned by plugins.
11703         (Descriptors::claim_for_plugin): New function.
11704         * descriptors.h (Descriptors::claim_for_plugin): New function.
11705         (Open_descriptor::is_claimed): New field.
11706         (claim_descriptor_for_plugin): New function.
11707         * fileread.cc (File_read::claim_for_plugin): New function.
11708         * fileread.h (File_read::claim_for_plugin): New function.
11709         (File_read::descriptor): New function.
11710         * gold.cc: Include "plugin.h".
11711         (queue_initial_tasks): Add task to call plugin hooks for generating
11712         new object files.
11713         * main.cc: Include "plugin.h".
11714         (main): Load plugin libraries.
11715         * object.h (Pluginobj): Declare.
11716         (Object::pluginobj): New function.
11717         (Object::do_pluginobj): New function.
11718         (Object::set_target): New function.
11719         * options.cc: Include "plugin.h".
11720         (General_options::parse_plugin): New function.
11721         (General_options::General_options): Initialize plugins_ field.
11722         (General_options::add_plugin): New function.
11723         * options.h (Plugin_manager): Declare.
11724         (General_options): Add --plugin option.
11725         (General_options::has_plugins): New function.
11726         (General_options::plugins): New function.
11727         (General_options::add_plugin): New function.
11728         (General_options::plugins_): New field.
11729         * plugin.cc: New file.
11730         * plugin.h: New file.
11731         * readsyms.cc: Include "plugin.h".
11732         (Read_symbols::do_read_symbols): Check for archive before checking
11733         for ELF file.  Call plugin hooks to claim files.
11734         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11735         from a real object file; force override when processing replacement
11736         files.
11737         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11738         (Symbol::init_base_object): Likewise.
11739         (Symbol::init_base_output_data): Likewise.
11740         (Symbol::init_base_output_segment): Likewise.
11741         (Symbol::init_base_constant): Likewise.
11742         (Symbol::init_base_undefined): Likewise.
11743         (Symbol::output_section): Assert that object is not a plugin.
11744         (Symbol_table::add_from_pluginobj): New function.
11745         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11746         undefined.
11747         (Symbol_table::sized_write_globals): Likewise.
11748         (Symbol_table::add_from_pluginobj): Instantiate template.
11749         * symtab.h (Sized_pluginobj): Declare.
11750         (Symbol::in_real_elf): New function.
11751         (Symbol::set_in_real_elf): New function.
11752         (Symbol::in_real_elf_): New field.
11753         (Symbol_table::add_from_pluginobj): New function.
11754
11755         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11756         (LIBDL): New variable.
11757         (LDADD): Add LIBDL.
11758         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11759         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11760         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11761         (MOSTLYCLEANFILES): Likewise.
11762         * testsuite/Makefile.in: Regenerate.
11763         * testsuite/plugin_test.c: New file.
11764         * testsuite/plugin_test_1.sh: New file.
11765         * testsuite/plugin_test_2.sh: New file.
11766
11767 2008-09-16  Ian Lance Taylor  <iant@google.com>
11768
11769         * target-reloc.h (relocate_section): Check whether a symbol is
11770         defined by the ABI before reporting an undefined symbol error.
11771         * target.h (Target::is_defined_by_abi): Make parameter const.
11772         (Target::do_is_defined_by_abi): Likewise.
11773         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11774         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11775         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11776         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11777         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11778         * testsuite/Makefile.in: Rebuild.
11779
11780         * fileread.cc (make_view): Add casts to avoid warning.
11781
11782 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11783
11784         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11785         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11786
11787 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11788
11789         * options.h (General_options::output_is_executable): New.
11790         (General_options::output_is_pie): New.
11791         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11792         for shared libraries.
11793         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11794
11795 2008-09-11  Chris Demetriou  <cgd@google.com>
11796
11797         * options.h (origin): New -z option.
11798         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11799         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11800         in DT_FLAGS_1.
11801
11802 2008-09-05  Cary Coutant  <ccoutant@google.com>
11803
11804         * fileread.cc (File_read::make_view): Add check for attempt to map
11805         beyond end of file.
11806
11807 2008-09-05  Cary Coutant  <ccoutant@google.com>
11808
11809         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11810         explicit instantiations.
11811
11812 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11813
11814         PR gold/6858
11815         * options.cc (General_options::finalize): Allow undefined symbols
11816         in shlibs if linking -shared.
11817
11818         PR gold/6859
11819         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11820         symbols as not needing a dynsym entry.
11821
11822 2008-08-20  Craig Silverstein  <csilvers@google.com>
11823
11824         * fileread.cc (File_read::open): Do not lock the file unless it
11825         was successfully opened.
11826
11827 2008-08-14  Cary Coutant  <ccoutant@google.com>
11828
11829         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11830         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11831         * testsuite/tls_test.cc (struct int128): 128-bit struct
11832         for testing TLS relocs with non-zero addend.
11833         (v12): New TLS variable.
11834         (t12): New test.
11835         (t_last): Add check for v12.
11836         * testsuite/tls_test.h (t12): New function.
11837         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11838
11839 2008-08-13  Ian Lance Taylor  <iant@google.com>
11840
11841         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11842         set tls_segment_ or relro_segment_.
11843         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11844         when appropriate.
11845         * output.h (Output_section::clear_is_relro): New function.
11846         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11847         sections specially even when output_data_ is empty.
11848         (Output_segment::maximum_alignment): When first section is relro,
11849         only force alignment for PT_LOAD segments.
11850         * script.cc (script_data_segment_align): New function.
11851         (script_data_segment_relro_end): New function.
11852         * script-c.h (script_data_segment_align): Declare.
11853         (script_data_segment_relro_end): Declare.
11854         * script-sections.h (class Script_sections): Declare
11855         data_segment_align and data_segment_relro_end.  Add fields
11856         segment_align_index_ and saw_relro_end_.
11857         * script-sections.cc (class Sections_element): Add set_is_relro
11858         virtual function.  Add new bool* parameter to place_orphan_here.
11859         Add get_output_section virtual function.
11860         (class Output_section_definition): Add set_is_relro.  Add new
11861         bool* parameter to place_orphan_here.  Add get_output_section.
11862         Add is_relro_ field.
11863         (Output_section_definition::Output_section_definition): Initialize
11864         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11865         and is_relro_ fields.
11866         (Output_section_definition::place_orphan_here): Add is_relro
11867         parameter.
11868         (Output_section_definition::set_section_addresses): Set relro for
11869         output section.
11870         (Output_section_definition::alternate_constraint): Likewise.
11871         (class Orphan_output_section): Add new bool* parameter to
11872         place_orphan_here.  Add get_output_section.
11873         (Orphan_output_section::place_orphan_here): Add is_relro
11874         parameter.
11875         (Script_sections::Script_sections): Initialize
11876         data_segment_align_index_ and saw_relro_end_.
11877         (Script_sections::data_segment_align): New function.
11878         (Script_sections::data_segment_relro_end): New function.
11879         (Script_sections::place_orphan): Set or clear is_relro.
11880         (Script_sections::set_section_addresses): Force alignment of first
11881         TLS section.
11882         * yyscript.y (exp): Call script_data_segment_align and
11883         script_data_segment_relro_end.
11884         * testsuite/relro_script_test.t: New file.
11885         * testsuite/relro_test.cc (using_script): Declare.
11886         (t1, t2): Test using_script.
11887         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11888         (relro_script_test_SOURCES): Define.
11889         (relro_script_test_DEPENDENCIES): Define.
11890         (relro_script_test_LDFLAGS): Define.
11891         (relro_script_test_LDADD): Define.
11892         (relro_script_test.so): New target.
11893         * testsuite/Makefile.in: Rebuild.
11894
11895 2008-08-06  Cary Coutant <ccoutant@google.com>
11896
11897         * archive.cc (Archive::total_archives, Archive::total_members)
11898         (Archive::total_members_loaded): New variables.
11899         (Archive::setup): Add parameter.  Add option to preread
11900         archive symbols.
11901         (Archive::read_armap): Add counter.
11902         (Archive::get_file_and_offset): New function.
11903         (Archive::get_elf_object_for_member): New function.
11904         (Archive::read_all_symbols): New function.
11905         (Archive::read_symbols): New function.
11906         (Archive::add_symbols): Add counters.
11907         (Archive::include_all_members): Use armap to find members if it's
11908         already built.
11909         (Archive::include_member): Skip reading symbols if already read.
11910         Factored code into Archive::get_file_and_offset and
11911         Archive::get_elf_object_for_member.  Changed call to
11912         Mapfile::report_include_archive_member.
11913         (Archive::print_stats): New function.
11914         * archive.h: Declare Object and Read_symbols_data classes.
11915         (Archive::Archive): Add initializers for new members.
11916         (Archive::setup): Add parameter.
11917         (Archive::print_stats): New function.
11918         (Archive::total_archives, Archive::total_members)
11919         (Archive::total_members_loaded): New variables.
11920         (Archive::get_file_and_offset): New function.
11921         (Archive::get_elf_object_for_member): New function.
11922         (Archive::read_all_symbols): New function.
11923         (Archive::read_symbols): New function.
11924         (Archive::Archive_member): New class.
11925         (Archive::members_): New member.
11926         (Archive::num_members_): New member.
11927         * main.cc: Include archive.h.
11928         (main): Call Archive::print_stats.
11929         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11930         archive parameter; member_name is now the fully-decorated name.
11931         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11932         * options.h: (General_options): Add --preread-archive-symbols option.
11933         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11934         Archive::setup.
11935
11936 2008-08-04  Ian Lance Taylor  <iant@google.com>
11937
11938         * symtab.h (Symbol::use_plt_offset): New function.
11939         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11940         * powerpc.cc (Relocate::relocate): Likewise.
11941         * sparc.cc (Relocate::relocate): Likewise.
11942         * x86_64.cc (Relocate::relocate): Likewise.
11943         * testsuite/weak_plt.sh: New test.
11944         * testsuite/weak_plt_main.cc: New test.
11945         * testsuite/weak_plt_shared.cc: New test.
11946         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11947         (check_PROGRAMS): Add weak_plt.
11948         (check_DATA): Add weak_plt_shared.so.
11949         (weak_plt_main_pic.o, weak_plt): New targets.
11950         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11951         * testsuite/Makefile.in: Rebuild.
11952
11953         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11954         gcctestdir/ld.
11955         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11956         * testsuite/Makefile.in: Rebuild.
11957
11958 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11959
11960         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11961         * Makefile.in: Regenerate.
11962         * po/POTFILES.in: Regenerate.
11963
11964 2008-07-29  Ian Lance Taylor  <iant@google.com>
11965
11966         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11967         symbols before other symbols.
11968         * testsuite/script_test_2.cc (test_addr): Declare.
11969         (test_addr_alias): Declare.
11970         (main): Check that test_addr and test_addr_alias have the right
11971         values.
11972         * testsuite/script_test_2.t: Define test_addr_alias and
11973         test_addr.
11974
11975 2008-07-24  Ian Lance Taylor  <iant@google.com>
11976
11977         PR 5990
11978         * descriptors.cc: New file.
11979         * descriptors.h: New file.
11980         * gold-threads.h (class Hold_optional_lock): New class.
11981         * fileread.cc: Include "descriptors.h".
11982         (File_read::~File_read): Release descriptor rather than closing
11983         it.
11984         (File_read::open) [file]: Call open_descriptor rather than open.
11985         Set is_descriptor_opened_.
11986         (File_read::open) [memory]: Assert that descriptor is not open.
11987         (File_read::reopen_descriptor): New function.
11988         (File_read::release): Release descriptor.
11989         (File_read::do_read): Make non-const.  Reopen descriptor.
11990         (File_read::read): Make non-const.
11991         (File_read::make_view): Reopen descriptor.
11992         (File_read::do_readv): Likewise.
11993         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11994         Update declarations.
11995         * layout.cc: Include "descriptors.h".
11996         (Layout::create_build_id): Use open_descriptor rather than open.
11997         * output.cc: Include "descriptors.h".
11998         (Output_file::open): Use open_descriptor rather than open.
11999         * archive.cc (Archive::const_iterator): Change Archive to be
12000         non-const.
12001         (Archive::begin, Archive::end): Make non-const.
12002         (Archive::count_members): Likewise.
12003         * archive.h (class Archive): Update declarations.
12004         * object.h (Object::read): Make non-const.
12005         * Makefile.am (CCFILES): Add descriptors.cc.
12006         (HFILES): Add descriptors.h.
12007         * Makefile.in: Rebuild.
12008
12009         PR 6716
12010         * gold.h: Always include <clocale>.  Add Solaris workarounds
12011         following code in binutils/sysdep.h.
12012
12013         PR 6048
12014         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12015         this->eh_frame_hdr_ is NULL before using it.
12016
12017         * dynobj.cc (Versions::Versions): Update comment.
12018
12019         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12020         the base version name.
12021
12022         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12023         array size plus one.
12024         (Stringpool_template::set_string_offsets): Subtract one from key
12025         before using it as an array index.
12026         (Stringpool_template::get_offset_with_length): Likewise.
12027         (Stringpool_template::write_to_buffer): Likewise.
12028         * stringpool.h (Stringpool_template::get_offset_from_key):
12029         Likewise.
12030
12031 2008-07-23  Ian Lance Taylor  <iant@google.com>
12032
12033         PR 6658
12034         * object.h (Merged_symbol_value::value): Do our best to handle a
12035         negative addend.
12036
12037         PR 6647
12038         * script.cc (Version_script_info::get_versions): Don't add empty
12039         version tag to return value.
12040         (Version_script_info::get_symbol_version_helper): Change return
12041         type to bool.  Add pversion parameter.  Change all callers.
12042         (script_register_vers_node): Don't require a non-NULL tag.
12043         * script.h (class Version_script_info): Update declarations.
12044         (Version_script_info::get_symbol_version): Change return type to
12045         bool.  Add version parameter.  Change all callers.
12046         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12047         handling.  Handle an empty version from a version script.
12048         (Symbol_table::define_special_symbol): Likewise.
12049         * testsuite/ver_test_10.script: New file.
12050         * testsuite/ver_test_10.sh: New file.
12051         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12052         (check_DATA): Add ver_test_10.syms.
12053         (ver_test_10.syms, ver_test_10.so): New target.
12054         * testsuite/Makefile.in: Rebuild.
12055
12056 2008-07-23  Simon Baldwin  <simonb@google.com>
12057
12058         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12059         to zero for undefined symbols from dynamic libraries.
12060
12061 2008-07-23  Ian Lance Taylor  <iant@google.com>
12062
12063         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12064         Change all callers.
12065         * symtab.h (class Symbol_table): Update declaration.
12066         * testsuite/ver_test_9.cc: New file.
12067         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12068         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12069         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12070         (ver_test_9.so, ver_test_9.o): New targets.
12071         * testsuite/Makefile.in: Rebuild.
12072
12073 2008-07-22  Ian Lance Taylor  <iant@google.com>
12074
12075         * options.h (class General_options): Define --check-sections.
12076         * layout.cc (Layout::set_segment_offsets): Handle
12077         --check-sections.
12078
12079         * options.h (class General_options): Define -n/--nmagic and
12080         -N/--omagic.
12081         * options.cc (General_options::finalize): For -n/--nmagic or
12082         -N/--omagic, set -static.
12083         * layout.cc (Layout::attach_allocated_section_to_segment): If
12084         -N/--omagic, don't put read-only and read-write sections in
12085         different segments.
12086         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12087         finding a read-only segment.
12088         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12089         don't set the minimum segment alignment to the common page size,
12090         and don't set the file offset to the address modulo the page size.
12091         * script-sections.cc (Script_sections::create_segments): If
12092         -n/--omagic, don't put read-only and read-write sections in
12093         different segments.
12094
12095         * cref.cc: New file.
12096         * cref.h: New file.
12097         * options.h (class General_options): Add --print-symbol-counts.
12098         * main.cc (main): Issue defined symbol report if requested.
12099         * archive.cc (Archive::interpret_header): Make into a const member
12100         function.
12101         (Archive::add_symbols): Call Input_objects::archive_start and
12102         archive_stop.
12103         (Archive::const_iterator): Define new class.
12104         (Archive::begin, Archive::end): New functions.
12105         (Archive::include_all_members): Rewrite to use iterator.
12106         (Archive::count_members): New function.
12107         * archive.h (class Archive): Update declarations.
12108         (Archive::filename): New function.
12109         * object.cc: Include "cref.h".
12110         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12111         (Sized_relobj::do_get_global_symbol_counts): New function.
12112         (Input_objects::add_object): Add object to cross-referencer.
12113         (Input_objects::archive_start): New function.
12114         (Input_objects::archive_stop): New function.
12115         (Input_objects::print_symbol_counts): New function.
12116         * object.h: Declare Cref and Archive.
12117         (Object::get_global_symbol_counts): New function.
12118         (Object::do_get_global_symbol_counts): New pure virtual function.
12119         (class Sized_relobj): Add defined_count_ field.  Update
12120         declarations.
12121         (class Input_objects): Add cref_ field.  Update constructor.
12122         Update declarations.
12123         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12124         defined_count_.
12125         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12126         symbol counts.
12127         (Sized_dynobj::do_get_global_symbol_counts): New function.
12128         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12129         defined_count_.  Update declarations.  Define Symbols typedef.
12130         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12131         parameter.  Change all callers.
12132         (Symbol_table::add_from_dynobj): Add sympointers and defined
12133         parameters.  Change all callers.
12134         * symtab.h (class Symbol_table): Update declarations.
12135         * Makefile.am (CCFILES): Add cref.cc.
12136         (HFILES): Add cref.h.
12137         * Makefile.in: Rebuild.
12138
12139 2008-07-22  Simon Baldwin  <simonb@google.com>
12140
12141         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12142         to zero when writing undefined symbols.
12143
12144 2008-07-22  Ian Lance Taylor  <iant@google.com>
12145
12146         * output.cc (Output_section::add_input_section): Don't try to
12147         merge empty merge sections.
12148
12149 2008-07-21  Craig Silverstein  <csilvers@google.com>
12150
12151         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12152         Include symbol version in error message.
12153
12154 2008-07-20  Chris Demetriou  <cgd@google.com>
12155
12156         * configure.ac (gold_cv_c_random_seed): New configured variable.
12157         (RANDOM_SEED_CFLAGS): New substituted variable.
12158         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12159         * configure: Rebuild.
12160         * Makefile.in: Likewise.
12161         * testsuite/Makefile.in: Likewise.
12162
12163 2008-07-18  Ian Lance Taylor  <iant@google.com>
12164
12165         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12166         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12167         * testsuite/ver_test_main.cc (main): Call t4.
12168         (t4, t4_2a): Define.
12169         * testsuite/ver_test_2.cc (t4_2): Define.
12170         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12171         * testsuite/ver_test_4.cc (t4_2a): Define.
12172         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12173         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12174
12175 2008-07-17  Ian Lance Taylor  <iant@google.com>
12176
12177         * dynobj.cc (Versions::add_def): If we give an error about a
12178         missing version, go ahead and create the version anyhow.
12179
12180 2008-07-10  Ian Lance Taylor  <iant@google.com>
12181
12182         Handle output sections with more than 0x7fffffff bytes.
12183         * object.h (class Relobj): Change map_to_output_ to
12184         output_sections_, and just keep a section pointer.  Change all
12185         uses.  Move comdat group support to Sized_relobj.
12186         (Relobj::is_section_specially_mapped): Remove.
12187         (Relobj::output_section): Remove poff parameter.  Change all
12188         callers.
12189         (Relobj::output_section_offset): New function.
12190         (Relobj::set_section_offset): Rewrite.
12191         (Relobj::map_to_output): Remove.
12192         (Relobj::output_sections): New function.
12193         (Relobj::do_output_section_offset): New pure virtual function.
12194         (Relobj::do_set_section_offset): Likewise.
12195         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12196         group support from Relobj.  Update declarations.
12197         (Sized_relobj::get_output_section_offset): New function.
12198         (Sized_relobj::do_output_section_offset): New function.
12199         (Sized_relobj::do_set_section_offset): New function.
12200         * object.cc (Relobj::output_section_address): Remove.
12201         (Sized_relobj::Sized_relobj): Initialize new fields.
12202         (Sized_relobj::include_section_group): Cast find_kept_object to
12203         Sized_relobj.
12204         (Sized_relobj::include_linkonce_section): Likewise.
12205         (Sized_relobj::do_layout): Use separate arrays for output section
12206         and output offset.
12207         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12208         output_sections.
12209         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12210         output_sections and section_offsets.
12211         (Sized_relobj::write_local_symbols): Likewise.
12212         (map_to_kept_section): Compute output address directly.
12213         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12214         output_sections and section_offsets.
12215         (Sized_relobj::write_sections): Likewise.
12216         (Sized_relobj::relocate_sections): Likewise.
12217         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12218         * output.h (class Output_reloc): Update declarations.  Change
12219         u2_.relobj to Sized_relobj*.
12220         (class Output_data_reloc): Change add functions to use
12221         Sized_relobj*.
12222         * output.cc (Output_reloc::Output_reloc): Change relobj to
12223         Sized_relobj*.
12224         (Output_reloc::local_section_offset): Change return type to
12225         Elf_Addr.  Use get_output_section_offset.
12226         (Output_reloc::get_address): Likewise.
12227         (Output_section::is_input_address_mapped): Don't call
12228         is_section_specially_mapped.
12229         (Output_section::output_offset): Likewise.
12230         (Output_section::output_address): Likewise.
12231         (Output_section::starting_output_address): Likewise.
12232         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12233         parameter to Sized_relobj*.
12234         (Copy_relocs::need_copy_reloc): Likewise.
12235         (Copy_relocs::save): Likewise.
12236         * copy-relocs.h (class Copy_relocs): Update declarations.
12237         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12238         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12239         * target-reloc.h (relocate_for_relocatable): Change
12240         offset_in_output_section type to Elf_Addr.  Change code that uses
12241         it as well.
12242         * layout.cc (Layout::layout): Always set *off.
12243         * mapfile.cc (Mapfile::print_input_section): Use
12244         output_section_offset.
12245         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12246         Sized_relobj*.
12247         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12248         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12249         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12250
12251 2008-07-03  Ian Lance Taylor  <iant@google.com>
12252
12253         * layout.cc (Layout::include_section): Do not discard unrecognized
12254         SHT_STRTAB sections.
12255
12256 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12257
12258         * script.cc (Lex::can_continue_name): Make '?' allowable in
12259         version-script names.
12260         * testsuite/version_script.map: Change glob pattern to use '?'
12261
12262 2008-06-30  Manish Singh  <yosh@gimp.org>
12263
12264         PR 6585
12265         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12266         Correct typo.
12267
12268 2008-06-30  Ian Lance Taylor  <iant@google.com>
12269
12270         PR 6660
12271         PR 6682
12272         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12273         versions]: Don't try to read the value in the contents, since we
12274         don't use it.  Use the template endianness when writing.
12275
12276 2008-06-25  Cary Coutant  <ccoutant@google.com>
12277
12278         * fileread.cc (File_read::make_view): Assert on zero-length view.
12279         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12280         symbol table when there are no symbols to read.
12281
12282 2008-06-23  Craig Silverstein  <csilvers@google.com>
12283
12284         * version.cc (version_string): Bump to 1.7
12285
12286 2008-06-18  Craig Silverstein  <csilvers@google.com>
12287
12288         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12289         constant 0xFFFF to type Valtype.
12290         (Powerpc_relocate_functions::rel16_ha): Likewise.
12291
12292 2008-06-17  Ian Lance Taylor  <iant@google.com>
12293
12294         * output.h (Output_section::Input_section): Initialize p2align_ to
12295         zero for Output_section_data constructors.
12296         (Output_section::Input_section::addralign): If not an input
12297         section, return the alignment of the Output_section_data.
12298         * testsuite/copy_test.cc: New file.
12299         * testsuite/copy_test_1.cc: New file.
12300         * testsuite/copy_test_2.cc: New file.
12301         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12302         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12303         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12304         (copy_test_1_pic.o, copy_test_1.so): New targets.
12305         (copy_test_2_pic.o, copy_test_2.so): New targets.
12306         * testsuite/Makefile.in: Rebuild.
12307
12308         * script-sections.cc (Script_sections::place_orphan): Initialize
12309         local variable exact.
12310
12311 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12312
12313         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12314
12315 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12316             David S. Miller  <davem@davemloft.net>
12317
12318         * powerpc.cc: New file.
12319         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12320         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12321         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12322         * Makefile.in: Rebuild.
12323
12324 2008-06-09  Ian Lance Taylor  <iant@google.com>
12325
12326         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12327         <exception>.
12328         (throwing, orig_terminate): New static variables.
12329         (terminate_handler): New static function.
12330         (t2): Set terminate handler.
12331
12332 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12333
12334         PR 6584
12335         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12336         alignment.
12337
12338 2008-05-30  Cary Coutant  <ccoutant@google.com>
12339
12340         * archive.cc (Archive::include_all_members) Correct to step
12341         over symbol table and extended name table in thin archives.
12342
12343 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12344
12345         PR 6407
12346         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12347         calculation.
12348
12349 2008-05-28  Caleb Howe  <cshowe@google.com>
12350
12351         * reduced_debug_output.cc: New file.
12352         * reduced_debug_output.h: New file.
12353         * options.h (class General_options): Add --strip-debug-non-line.
12354         * options.cc (General_options::finalize): Add strip_debug_non_line
12355         to the strip heirarchy.
12356         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12357         fields.
12358         * layout.cc: Include "reduced_debug_output.h".
12359         (Layout::Layout): Initialize new fields.
12360         (line_only_debug_sections): New static array.
12361         (is_lines_only_debug_sections): New static inline function.
12362         (Layout::include_section): Handle --strip-debug-non-line.
12363         (Layout::make_output_section): If --strip-debug-non-line, build
12364         new output sections for .debug_abbrev and .debug_info.
12365         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12366         gold.  Warn about possible overflow.
12367         (read_signed_LEB_128): Likewise.
12368         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12369         (read_signed_LEB_128): Declare.
12370         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12371         (HFILES): Add reduced_debug_output.h.
12372         * Makefile.in: Rebuild.
12373
12374 2008-05-21  Ian Lance Taylor  <iant@google.com>
12375
12376         * mapfile.cc: New file.
12377         * mapfile.h: New file.
12378         * options.h (class General_options): Add -M/--print-map and -Map.
12379         * options.cc (General_options::finalize): Make -M equivalent to
12380         -Map -.
12381         * main.cc: Include <cstdio> and "mapfile.h".
12382         (main): Open mapfile if requested.
12383         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12384         constructor.  Change caller.
12385         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12386         (queue_middle_tasks): Likewise.
12387         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12388         declarations.
12389         * archive.cc: Include "mapfile.h".
12390         (Archive::add_symbols): Add mapfile parameter.  Change all
12391         callers.  Pass mapfile, symbol, and reason to include_member.
12392         (Archive::include_all_members): Add mapfile parameter.  Change all
12393         callers.
12394         (Archive::include_member): Add mapfile, sym, and why parameters.
12395         Change all callers.  Report inclusion to map file.
12396         * archive.h: Include "fileread.h".
12397         (class Archive): Update declarations.
12398         (Archive::file): New const method.
12399         (class Add_archive_symbols): Add mapfile_ field.  Update
12400         constructor.  Change all callers.
12401         * readsyms.h (class Read_symbols): Likewise.
12402         (class Finish_group): Likewise.
12403         (class Read_script): Likewise.
12404         * common.cc: Include "mapfile.h".
12405         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12406         all callers.
12407         (Symbol_table::do_allocate_commons): Likewise.
12408         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12409         symbol allocation to mapfile.
12410         * common.h (class Allocate_commons_task): Add mapfile_ field.
12411         Update constructor.  Change all callers.
12412         * symtab.h (class Symbol_table): Update declarations.
12413         * layout.cc: Include "mapfile.h".
12414         (Layout_task_runner::run): Print information to mapfile.
12415         (Layout::create_gold_note): Change Output_data_fixed_space to
12416         Output_data_zero_fill.
12417         (Layout::create_build_id): Likewise.
12418         (Layout::print_to_mapfile): New function.
12419         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12420         constructor.  Change caller.
12421         (class Layout): Declare print_to_mapfile.
12422         * output.cc (Output_section::Input_section::print_to_mapfile): New
12423         function.
12424         (Output_section::add_input_section): If producing a map, always
12425         add to input_sections_ list.
12426         (Output_section::do_print_to_mapfile): New function.
12427         (Output_segment::print_sections_to_mapfile): New function.
12428         (Output_segment::print_section_list_to_mapfile): New function.
12429         * output.h: Include "mapfile.h".
12430         (Output_data::print_to_mapfile): New function.
12431         (Output_data::do_print_to_mapfile): New virtual function.
12432         (Output_segment_headers::do_print_to_mapfile): New function.
12433         (Output_file_header::do_print_to_mapfile): New function.
12434         (Output_data_const::do_print_to_mapfile): New function.
12435         (class Output_data_const_buffer): Add map_name_ field.  Update
12436         constructor.  Change all callers.  Add do_print_to_mapfile
12437         function.
12438         (class Output_data_fixed_space): Likewise.
12439         (class Output_data_space): Likewise.
12440         (class Output_data_zero_fill): New class.
12441         (Output_data_strtab::do_print_to_mapfile): New function.
12442         (Output_data_reloc_base::do_print_to_mapfile): New function.
12443         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12444         (Output_data_group::do_print_to_mapfile): New function.
12445         (Output_data_got::do_print_to_mapfile): New function.
12446         (Output_data_dynamic::do_print_to_mapfile): New function.
12447         (Output_symtab_xindex::do_print_to_mapfile): New function.
12448         (class Output_section): Declare do_print_to_mapflie.  Declare
12449         print_to_mapfile in Input_section.
12450         (class Output_segment): Declare new functions.
12451         * object.h (Sized_relobj::symbol_count): New function.
12452         * script-sections.cc
12453         (Output_section_element_dot_assignment::set_section_addresses):
12454         Change Output_data_fixed_space to Output_data_zero_fill.
12455         (Output_data_expression::do_print_to_mapfile): New function.
12456         * script.cc (read_input_script): Add mapfile parameter.  Change
12457         all callers.
12458         * script.h (read_input_script): Update declaration.
12459         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12460         (Eh_frame::do_print_to_mapfile): New function.
12461         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12462         (Output_merge_string::do_print_to_mapfile): New function.
12463         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12464         function.
12465         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12466         function.
12467         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12468         function.
12469         * Makefile.am (CCFILES): Add mapfile.cc.
12470         (HFILES): Add mapfile.h.
12471         * Makefile.in: Rebuild.
12472
12473 2008-05-19  Ian Lance Taylor  <iant@google.com>
12474
12475         * options.h (class General_options): Add -z relro.
12476         * layout.cc (Layout::Layout): Initialize relro_segment_.
12477         (Layout::add_output_section_data): Return the output section.
12478         (Layout::make_output_section): Rcognize relro sections and mark
12479         them appropriately.
12480         (Layout::attach_allocated_section_to_segment): Put relro sections
12481         in a PT_GNU_RELRO segment.
12482         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12483         section as relro.
12484         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12485         PT_TLS segments.
12486         (Layout::linkonce_mapping): Map d.rel.ro.local to
12487         .data.rel.ro.local.
12488         (Layout::output_section_name): Us .data.rel.ro.local for any
12489         section which begins with that.
12490         * layout.h (class Layout): Update add_output_section_data
12491         declaration.  Add relro_segment_ field.
12492         * output.cc (Output_section::Output_section): Initialize is_relro_
12493         and is_relro_local_ fields.
12494         (Output_segment::add_output_section): Group relro sections.
12495         (Output_segment::is_first_section_relro): New function.
12496         (Output_segment::maximum_alignment): If there is a relro section,
12497         align the segment to the common page size.
12498         (Output_segment::set_section_addresses): Track whether we are
12499         looking at relro sections.  If the last section is a relro
12500         section, align to the common page size.
12501         (Output_segment::set_section_list_addresses): Add in_relro
12502         parameter.  Change all callers.  Align to the page size when
12503         moving from relro to non-relro section.
12504         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12505         segment.
12506         * output.h (class Output_section): Add is_relro_ and
12507         is_relro_local_ fields.
12508         (Output_section::is_relro): New function.
12509         (Output_section::set_is_relro): New function.
12510         (Output_section::is_relro_local): New function.
12511         (Output_section::set_is_relro_local): New function.
12512         (class Output_segment): Update declarations.
12513         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12514         * sparc.cc (Target_sparc::got_section): Likewise.
12515         * x86_64.cc (Target_x86_64::got_section): Likewise.
12516         * testsuite/relro_test_main.cc: New file.
12517         * testsuite/relro_test.cc: New file.
12518         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12519         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12520         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12521         (relro_test.so, relro_test_pic.o): New targets.
12522         * testsuite/Makefile.in: Rebuild.
12523
12524 2008-05-16  Ian Lance Taylor  <iant@google.com>
12525
12526         * output.cc (Output_segment::add_output_section): Remove front
12527         parameter.
12528         * output.h (class Output_segment): Remove
12529         add_initial_output_section and overloaded add_output_section.
12530         Update declaration of remaining add_output_section.
12531         * layout.cc (Layout::create_interp): Call add_output_section
12532         rather than add_initial_output_section.
12533         (Layout::finish_dynamic_section): Likewise.
12534
12535         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12536         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12537         know the dynamic type.
12538         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12539         field.  Initialize it in constructor.
12540         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12541         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12542         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12543         reloc.
12544
12545         * output.cc (Output_reloc::get_address): Change return type to
12546         Elf_Addr.
12547         * output.h (class Output_reloc): Update get_address declaration.
12548         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12549         for section addresses.
12550
12551 2008-05-09  Ian Lance Taylor  <iant@google.com>
12552
12553         PR 6493
12554         * gold.cc (gold_nomem): Use return value of write.
12555
12556 2008-05-08  Ian Lance Taylor  <iant@google.com>
12557
12558         * symtab.c (Symbol::init_base_output_data): Add version
12559         parameter.  Change all callers.
12560         (Symbol::init_base_output_segment): Likewise.
12561         (Symbol::init_base_constant): Likewise.
12562         (Symbol::init_base_undefined): Likewise.
12563         (Sized_symbol::init_output_data): Likewise.
12564         (Sized_symbol::init_output_segment): Likewise.
12565         (Sized_symbol::init_constant): Likewise.
12566         (Sized_symbol::init_undefined): Likewise.
12567         (Symbol_table::do_define_in_output_data): If the new symbol has a
12568         version, mark it as the default.
12569         (Symbol_table::do_define_in_output_segment): Likewise.
12570         (Symbol_table::do_define_as_constant): Likewise.
12571         * symtab.h (class Symbol): Update declarations.
12572         (class Sized_symbol): Likewise.
12573         * resolve.cc (Symbol::override_version): New function.
12574         (Symbol::override_base): Call override_version.
12575         (Symbol::override_base_with_special): Likewise.
12576         * testsuite/ver_script_8.script: New file.
12577         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12578         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12579         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12580         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12581
12582 2008-05-06  Ian Lance Taylor  <iant@google.com>
12583
12584         PR 6049
12585         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12586         functions.
12587         (class General_options): Remove existing --undefined, and add
12588         --no-undefined instead.  Add new --undefined as synonym for -u.
12589         * archive.cc (Archive::add_symbols): Check whether symbol was
12590         named with -u.
12591         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12592         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12593         all uses.  Add IS_UNDEFINED.  Update declarations to split
12594         different versions of init_base.  Declare init_base_undefined.
12595         (Symbol::is_defined): Handle IS_UNDEFINED.
12596         (Symbol::is_undefined): Likewise.
12597         (Symbol::is_weak_undefined): Call is_undefined.
12598         (Symbol::is_absolute): Handle IS_CONSTANT.
12599         (class Sized_symbol): Update declarations to split different
12600         versions of init.  Declare init_undefined.
12601         (class Symbol_table): Declare new functions.
12602         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12603         Change all callers.
12604         (Symbol::init_base_output_data): Likewise.
12605         (Symbol::init_base_output_segment): Likewise.
12606         (Symbol::init_base_constant): Likewise.
12607         (Symbol::init_base_undefined): New function.
12608         (Sized_symbol::init_object): Rename from init.  Change all
12609         callers.
12610         (Sized_symbol::init_output_data): Likewise.
12611         (Sized_symbol::init_output_segment): Likewise.
12612         (Sized_symbol::init_constant): Likewise.
12613         (Sized_symbol::init_undefined): New function.
12614         (Symbol_table::add_undefined_symbols_from_command_line): New
12615         function.
12616         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12617         function.
12618         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12619         (Symbol::output_section): Likewise.
12620         (Symbol::set_output_section): Likewise.
12621         (Symbol_table::sized_finalize_symbol): Likewise.
12622         (Symbol_table::sized_write_globals): Likewise.
12623         * resolve.cc (Symbol_table::should_override): Likewise.
12624         (Symbol::override_base_with_special): Likewise.
12625
12626         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12627         symbol, change it to have default visibility.
12628         * testsuite/protected_1.cc: New file.
12629         * testsuite/protected_2.cc: New file.
12630         * testsuite/protected_3.cc: New file.
12631         * testsuite/protected_main_1.cc: New file.
12632         * testsuite/protected_main_2.cc: New file.
12633         * testsuite/protected_main_3.cc: New file.
12634         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12635         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12636         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12637         (protected_1.so): New target.
12638         (protected_1_pic.o, protected_2_pic.o): New targets.
12639         (protected_3_pic.o): New target.
12640         (check_PROGRAMS): Add protected_2.
12641         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12642         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12643         * testsuite/Makefile.in: Rebuild.
12644
12645         * options.h (DEFINE_var): Add set_user_set_##varname__.
12646         (DEFINE_bool_alias): New macro.
12647         (class General_options): Define -Bstatic using DEFINE_bool_alias
12648         rather than DEFINE_special.  Add --undefined as an alias for -z
12649         defs.
12650         * options.cc (General_options::parse_Bstatic): Remove.
12651
12652         * options.h (class General_options): Add --fatal-warnings.
12653         * main.cc (main): Implement --fatal-warnings.
12654         * errors.h (Errors::warning_count): New function.
12655
12656         * options.h (class General_options): Add -Bsymbolic-functions.
12657         * symtab.h (Symbol::is_preemptible): Check for
12658         -Bsymbolic-functions.
12659
12660 2008-05-05  Ian Lance Taylor  <iant@google.com>
12661
12662         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12663         as noVARNAME rather than no-VARNAME.
12664         (class General_options): Add option -z combreloc.
12665         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12666         get_address.
12667         (Output_reloc::sort_before) [SHT_REL]: New function.
12668         (Output_reloc::sort_before) [SHT_RELA]: New function.
12669         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12670         Sort_relocs_comparison.
12671         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12672         parameter.  Change all callers.
12673         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12674         sort_relocs parameter.  Change all callers.
12675         * output.cc (Output_reloc::get_address): New function, broken out
12676         of write_rel.
12677         (Output_reloc::write_rel): Call it.
12678         (Output_reloc::compare): New function.
12679         (Output_data_reloc_base::do_write): Optionally sort relocs.
12680
12681         * configure.ac: If targ_extra_obj is set, link it in.
12682         * configure.tgt: Initialize all variables.
12683         (x86_64*): Set targ_extra_obj and targ_extra_size.
12684         * configure: Rebuild.
12685
12686         * object.cc (Sized_relobj::include_section_group): Adjust section
12687         indexes read from group data.  Build vector to pass to
12688         layout_group.
12689         * layout.cc (Layout::layout_group): Add flags and shndxes
12690         parameters.  Remove contents parameter.  Change caller.  Update
12691         explicit instantiations.
12692         * layout.h (class Layout): Update layout_group declaration.
12693         * output.cc (Output_data_group::Output_data_group): Add flags and
12694         input_shndxes parameters.  Remove contents parameter.  Change
12695         caller.
12696         (Output_data_group::do_write): Change input_sections_ to
12697         input_shndxes_.
12698         * output.h (class Output_data_group): Update constructor
12699         declaration.  Rename input_sections_ to input_shndxes_.
12700         * testsuite/many_sections_test.cc: Add template.
12701
12702 2008-04-30  Cary Coutant  <ccoutant@google.com>
12703
12704         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12705
12706         * layout.cc (Layout::include_section): Refactored check for debug
12707         info section.
12708         (Layout::add_comdat): Add new parameters.  Change type
12709         of signature parameter.  Add object and shndx to signatures table.
12710         (Layout::find_kept_object): New function.
12711         * layout.h: Include <cstring>.
12712         (Layout::is_debug_info_section): New function.
12713         (Layout::add_comdat): Add new parameters.
12714         (Layout::find_kept_object): New function.
12715         (Layout::Kept_section): New struct.
12716         (Layout::Signatures): Change type of map range.
12717         * object.cc (Relobj::output_section_address): New function.
12718         (Sized_relobj::include_section_group): Add new parameters.  Change
12719         calls to Layout::add_comdat.  Change to build table of kept comdat
12720         groups and table mapping discarded sections to kept sections.
12721         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12722         (Sized_relobj::do_layout): Change calls to include_section_group and
12723         include_linkonce_section.
12724         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12725         value to zero when section is discarded.
12726         (Sized_relobj::map_to_kept_section): New function.
12727         * object.h (Relobj::output_section_address): New function.
12728         (Relobj::Comdat_group): New type.
12729         (Relobj::find_comdat_group): New function.
12730         (Relobj::Comdat_group_table): New type.
12731         (Relobj::Kept_comdat_section): New type.
12732         (Relobj::Kept_comdat_section_table): New type.
12733         (Relobj::add_comdat_group): New function.
12734         (Relobj::set_kept_comdat_section): New function.
12735         (Relobj::get_kept_comdat_section): New function.
12736         (Relobj::comdat_groups_): New field.
12737         (Relobj::kept_comdat_sections_): New field.
12738         (Symbol_value::input_value): Update comment.
12739         (Sized_relobj::map_to_kept_section) New function.
12740         (Sized_relobj::include_linkonce_section): Add new parameter.
12741         * target-reloc.h (Comdat_behavior): New type.
12742         (get_comdat_behavior): New function.
12743         (relocate_section): Add code to map a discarded section to the
12744         corresponding kept section when applying a relocation.
12745
12746 2008-04-30  Craig Silverstein  <csilvers@google.com>
12747
12748         * dwarf_reader.cc (next_generation_count): New static var.
12749         (Addr2line_cache_entry): New struct.
12750         (addr2line_cache): New static var.
12751         (Dwarf_line_info::one_addr2line): Added caching.
12752         (Dwarf_line_info::clear_addr2line_cache): New function.
12753         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12754         cache-size parameter.
12755         (Dwarf_line_info::one_addr2line_cache): New function.
12756         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12757         new cache-size argument to one_addr2line(), and clear cache.
12758
12759 2008-04-28  Cary Coutant  <ccoutant@google.com>
12760
12761         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12762         R_386_PC8 relocations.
12763
12764 2008-04-23  Ian Lance Taylor  <iant@google.com>
12765
12766         * object.cc (Sized_relobj::include_section_group): Check for
12767         invalid section group.
12768
12769         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12770         header size.
12771
12772         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12773         than read for file header.
12774         * archive.cc (Archive::include_member): Likewise.
12775
12776 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12777
12778         * aclocal.m4: Regenerate.
12779         * configure: Regenerate.
12780
12781 2008-04-19  Ian Lance Taylor  <iant@google.com>
12782
12783         * version.cc (version_string): Bump to 1.6.
12784
12785         * testsuite/Makefile.am (many_sections_r_test): New target.
12786         (many_sections_r_test_SOURCES): Remove.
12787         (many_sections_r_test_DEPENDENCIES): Remove.
12788         (many_sections_r_test_LDFLAGS): Remove.
12789         (many_sections_r_test_LDADD): Remove.
12790
12791         * object.cc (Sized_relobj::do_add_symbols): Always pass
12792         local_symbol_count_ to add_from_relobj.
12793
12794         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12795         every thousand variables.
12796         * testsuite/Makefile.in: Rebuild.
12797
12798         * object.cc (Xindex::initialize_symtab_xindex): New function.
12799         (Xindex::read_symtab_xindex): New function.
12800         (Xindex::sym_xindex_to_shndx): New function.
12801         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12802         available.
12803         (Sized_relobj::do_initialize_xindex): New function.
12804         (Sized_relobj::do_read_symbols): Adjust section links.
12805         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12806         parameter.  Change all callers.
12807         (Sized_relobj::include_section_group): Adjust section links and
12808         symbol section indexes.
12809         (Sized_relobj::do_layout): Adjust section links.
12810         (Sized_relobj::do_count_local_symbols): Adjust section links and
12811         symbol section indexes.
12812         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12813         ordinary and special symbols.
12814         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12815         dynsym_xindex parameters.  Change all callers.  Adjust section
12816         links.  Use SHN_XINDEX when needed.
12817         (Sized_relobj::get_symbol_location_info): Adjust section links.
12818         Don't get fooled by special symbols.
12819         * object.h (class Xindex): Define.
12820         (class Object): Add xindex_ parameter.  Declare virtual functoin
12821         do_initialize_xindex.
12822         (Object::adjust_sym_shndx): New function.
12823         (Object::set_xindex): New protected function.
12824         (class Symbol_value): Add is_ordinary_shndx_ field.
12825         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12826         (Symbol_value::value): Assert ordinary section.
12827         (Symbol_value::initialize_input_to_output_map): Likewise.
12828         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12829         Change all callers.
12830         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12831         all callers.
12832         (class Sized_relobj): Update declarations.
12833         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12834         parameter.  Change all callers.
12835         (Sized_relobj::adjust_shndx): New function.
12836         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12837         field.
12838         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12839         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12840         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12841         (Sized_dynobj::read_dynsym_section): Adjust section links.
12842         (Sized_dynobj::read_dynamic): Likewise.
12843         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12844         section links.
12845         (Sized_dynobj::do_initialize_xindex): New function.
12846         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12847         do_initialize_xindex.
12848         (Sized_dynobj::adjust_shndx): New function.
12849         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12850         dynsym_xindex_ fields.
12851         (Layout::finalize): Add a call to set_section_indexes before
12852         creating the symtab sections.
12853         (Layout::set_section_indexes): Don't do anything if the section
12854         already has a section index.
12855         (Layout::create_symtab_sections): Add shnum parameter.  Change
12856         caller.  Create .symtab_shndx section if needed.
12857         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12858         caller.
12859         (Layout::allocated_output_section_count): New function.
12860         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12861         needed.
12862         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12863         fields.  Update declarations.
12864         (Layout::symtab_xindex): New function.
12865         (Layout::dynsym_xindex): New function.
12866         (class Write_symbols_task): Add layout_ field.
12867         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12868         Change caller.
12869         * output.cc (Output_section_headers::Output_section_headers): Add
12870         shstrtab_section parameter.  Change all callers.
12871         (Output_section_headers::do_sized_write): Store overflow values
12872         for section count and section string table section index in
12873         section header zero.
12874         (Output_file_header::do_sized_write): Check for overflow of
12875         section count and section string table section index.
12876         (Output_symtab_xindex::do_write): New function.
12877         (Output_symtab_xindex::endian_do_write): New function.
12878         * output.h (class Output_section_headers): Add shstrtab_section_.
12879         Update declarations.
12880         (class Output_symtab_xindex): Define.
12881         (Output_section::has_out_shndx): New function.
12882         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12883         field.
12884         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12885         Change all callers.
12886         (Sized_symbol::init): Likewise.
12887         (Symbol::output_section): Check for ordinary symbol.
12888         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12889         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12890         callers.
12891         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12892         Change all callers.  Simplify handling of symbols from sections
12893         not included in the link.
12894         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12895         distinction.
12896         (Weak_alias_sorter::operator()): Assert that symbols are
12897         ordinary.
12898         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12899         distinction.
12900         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12901         parameters.  Change all callers.
12902         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12903         symbol distinction.  Use SHN_XINDEX when needed.
12904         (Symbol_table::write_section_symbol): Add symtab_xindex
12905         parameter.  Change all callers.
12906         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12907         SHN_XINDEX when needed.
12908         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12909         declarations.
12910         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12911         (Symbol::is_defined): Check is_ordinary.
12912         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12913         (Symbol::is_absolute, Symbol::is_common): Likewise.
12914         (class Sized_symbol): Update declarations.
12915         (class Symbol_table): Update declarations.
12916         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12917         parameters.  Change all callers.
12918         (Sized_symbol::override): Likewise.
12919         (Symbol_table::override): Likewise.
12920         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12921         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12922         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12923         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12924         to be in an ordinary section.
12925         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12926         object and is_ordinary parameters.  Change all callers.
12927         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12928         Change all callers.  Don't add undefined or non-ordinary symbols
12929         to reloc_map_.
12930         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12931         Change all callers.
12932         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12933         declarations.
12934         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12935         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12936         (Sized_relobj::relocate_sections): Likewise.
12937         * target-reloc.h (scan_relocs): Adjust section symbol index.
12938         (scan_relocatable_relocs): Likewise.
12939         * i386.cc (Scan::local): Check for ordinary symbols.
12940         * sparc.cc (Scan::local): Likewise.
12941         * x86_64.cc (Scan::local): Likewise.
12942         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12943         to symbol_section_and_value.
12944         * testsuite/many_sections_test.cc: New file.
12945         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12946         (check_PROGRAMS): Add many_sections_test.
12947         (many_sections_test_SOURCES): Define.
12948         (many_sections_test_DEPENDENCIES): Define.
12949         (many_sections_test_LDFLAGS): Define.
12950         (BUILT_SOURCES): Add many_sections_define.h.
12951         (many_sections_define.h): New target.
12952         (BUILT_SOURCES): Add many_sections_check.h.
12953         (many_sections_check.h): New target.
12954         (check_PROGRAMS): Add many_sections_r_test.
12955         (many_sections_r_test_SOURCES): Define.
12956         (many_sections_r_test_DEPENDENCIES): Define.
12957         (many_sections_r_test_LDFLAGS): Define.
12958         (many_sections_r_test_LDADD): Define.
12959         (many_sections_r_test.o): New target.
12960         * testsuite/Makefile.in: Rebuild.
12961
12962 2008-04-17  Cary Coutant  <ccoutant@google.com>
12963
12964         * errors.cc (Errors::info): New function.
12965         (gold_info): New function.
12966         * errors.h (Errors::info): New function.
12967         * gold.h (gold_info): New function.
12968         * object.cc (Input_objects::add_object): Print trace output.
12969         * options.cc (options::parse_set): New function.
12970         (General_options::parse_wrap): Deleted.
12971         (General_options::General_options): Deleted initializer.
12972         * options.h (options::String_set): New typedef.
12973         (options::parse_set): New function.
12974         (DEFINE_set): New macro.
12975         (General_options::wrap): Changed to use DEFINE_set. Changed
12976         callers of any_wrap_symbols and is_wrap_symbol.
12977         (General_options::trace, General_options::trace_symbol):
12978         New options.
12979         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12980         (General_options::wrap_symbols_): Deleted.
12981         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12982
12983 2008-04-17  David S. Miller  <davem@davemloft.net>
12984
12985         * options.cc (General_options::parse_V): New function.
12986         * options.h: Add entries for -V and -Qy.
12987
12988 2008-04-17  Ian Lance Taylor  <iant@google.com>
12989
12990         * common.cc (Symbol_table::allocate_commons): Remove options
12991         parameter.  Change caller.
12992         (Symbol_table::do_allocate_commons): Remove options parameter.
12993         Change caller.  Just call do_allocate_commons_list twice.
12994         (Symbol_table::do_allocate_commons_list): New function, broken out
12995         of do_allocate_commons.
12996         * common.h (class Allocate_commons_task): Remove options_ field.
12997         Update constructor.
12998         * symtab.cc (Symbol_table::Symbol_table): Initialize
12999         tls_commons_.
13000         (Symbol_table::add_from_object): Put TLS common symbols on
13001         tls_commons_ list.
13002         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13003         which are IN_OUTPUT_DATA.
13004         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13005         allocate_commons and do_allocate_commons declarations.  Declare
13006         do_allocate_commons_list.
13007         * gold.cc (queue_middle_tasks): Update creation of
13008         Allocate_commons_task to not pass options.
13009         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13010         (TLS_TEST_C_FLAGS): New variable.
13011         (tls_test_c_pic.o): New target.
13012         (tls_test_shared.so): Link in tls_test_c_pic.o.
13013         (tls_test_c_pic_ie.o): New target.
13014         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13015         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13016         (tls_test_c.o): New target.
13017         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13018         (tls_pic_test_LDADD): Likewise.
13019         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13020         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13021         (tls_test_c_gnu2.o): New target.
13022         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13023         tls_test_c_gnu2.o.
13024         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13025         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13026         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13027         * testsuite/tls_test.cc: Include "config.h".
13028         (t_last): Call t11_last.
13029         * testsuite/tls_test.h (t11, t11_last): Declare.
13030         * testsuite/tls_test_c.c: New file.
13031         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13032         * configure.ac: Check for OpenMP support.
13033         * configure, config.in, Makefile.in: Rebuild.
13034         * testsuite/Makefile.in: Rebuild.
13035
13036 2008-04-16  Cary Coutant  <ccoutant@google.com>
13037
13038         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13039         (Target_i386::tls_base_symbol_defined_): New field.
13040         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13041         (Target_i386::Scan::global): Likewise.
13042         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13043         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13044         (Target_x86_64::tls_base_symbol_defined_): New field.
13045         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13046         (Target_x86_64::Scan::global): Likewise.
13047
13048 2008-04-16  Cary Coutant  <ccoutant@google.com>
13049
13050         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13051         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13052         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13053         building shared libraries.
13054         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13055         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13056         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13057         * testsuite/Makefile.in: Rebuild.
13058         * testsuite/weak_undef.h: New file.
13059         * testsuite/weak_undef_file1.cc: Add extra test cases.
13060         * testsuite/weak_undef_file2.cc: Likewise.
13061         * testsuite/weak_undef_test.cc: Likewise.
13062
13063 2008-04-16  David S. Miller  <davem@davemloft.net>
13064
13065         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13066         Add issued_non_pic_error_ field.  Declare check_non_pic.
13067         (Target_sparc::Scan::check_non_pic): New function.
13068         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13069         (Target_sparc::Scan::global): Likewise.
13070
13071         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13072         * configure: Rebuild.
13073
13074         * options.h (DEFINE_enable): New macro.
13075         (new_dtags): New enable option.
13076         (initfirst, interpose, loadfltr, nodefaultlib,
13077         nodelete, nodlopen, nodump): New -z options.
13078         * layout.cc (Layout:finish_dynamic_section): If new
13079         dtags enabled, emit DT_RUNPATH.  Also, emit a
13080         DT_FLAGS_1 containing any specified -z flags.
13081
13082 2008-04-16  Ian Lance Taylor  <iant@google.com>
13083
13084         * copy-relocs.cc: New file.
13085         * copy-relocs.h: New file.
13086         * reloc.cc: Remove Copy_relocs code.
13087         * reloc.h: Likewise.
13088         * reloc-types.h (struct Reloc_types) [both versions]: Add
13089         get_reloc_addend_noerror.
13090         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13091         variants of add_global which take an addend which must be zero.
13092         * i386.cc: Include "copy-relocs.h".
13093         (class Target_i386): Change type of copy_relocs_ to variable,
13094         update initializer.
13095         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13096         Change all callers.
13097         (Target_i386::do_finalize_sections): Change handling of
13098         copy_relocs_.
13099         * sparc.cc: Include "copy-relocs.h".
13100         (class Target_sparc): Change type of copy_relocs_ to variable,
13101         update initializer.
13102         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13103         Change all callers.
13104         (Target_sparc::do_finalize_sections): Change handling of
13105         copy_relocs_.
13106         * x86_64.cc: Include "copy-relocs.h".
13107         (class Target_x86_64): Change type of copy_relocs_ to variable,
13108         update initializer.
13109         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13110         class.  Change all callers.
13111         (Target_x86_64::do_finalize_sections): Change handling of
13112         copy_relocs_.
13113         * Makefile.am (CCFILES): Add copy-relocs.cc.
13114         (HFILES): Add copy-relocs.h.
13115
13116         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13117
13118         * testsuite/script_test_4.sh: Permit leading zeroes.
13119
13120 2008-04-15  Ian Lance Taylor  <iant@google.com>
13121
13122         * script-sections.cc (Script_sections::create_segments): Use
13123         header_size_adjustment even when there is enough room for the
13124         headers.
13125         * testsuite/script_test_4.sh: New file.
13126         * testsuite/script_test_4.t: New file.
13127         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13128         (check_DATA): Add script_test_4.stdout.
13129         (MOSTLYCLEANFILES): Likewise.
13130         (script_test_4): New target.
13131         (script_test_4.stdout): New target.
13132         * testsuite/Makefile.in: Rebuild.
13133
13134         * sparc.cc: Add definitions for Output_data_plt_sparc class
13135         constants.
13136
13137 2008-04-14  David S. Miller  <davem@davemloft.net>
13138
13139         * sparc.cc: New file.
13140         * Makefile.am (TARGETSOURCES): Add sparc.cc
13141         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13142         * configure.tgt: Document targ_extra_size and
13143         targ_extra_big_endian.  Add entries for sparc-* and
13144         sparc64-*.
13145         * configure.ac: Handle targ_extra_size and
13146         targ_extra_big_endian.
13147         * Makefile.in: Rebuild.
13148         * configure: Likewise.
13149         * po/POTFILES.in: Likewise.
13150         * po/gold.pot: Likewise.
13151
13152 2008-04-14  Ian Lance Taylor  <iant@google.com>
13153
13154         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13155         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13156         in the name/type/flags to section mapping.  Don't call
13157         allocate_output_section.
13158         (Layout::choose_output_section): Change parameter from adjust_name
13159         to is_input_section.  Don't permit input sections after sections
13160         are attached to segments.  Don't call allocate_output_section.
13161         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13162         not write_enable_output_section.
13163         (Layout::make_output_section): Don't push to
13164         unattached_section_list_ nor call attach_to_segment.  Call
13165         attach_section_to_segment if sections are attached.
13166         (Layout::attach_sections_to_segments): New function.
13167         (Layout::attach_section_to_segment): New function.
13168         (Layout::attach_allocated_section_to_segment): Rename from
13169         attach_to_segment.  Remove flags parameter.
13170         (Layout::allocate_output_section): Remove function.
13171         (Layout::write_enable_output_section): Remove function.
13172         * layout.h (class Layout): Update for above changes.  Add new
13173         field sections_are_attached_.
13174         * output.h (Output_section::update_flags_for_input_section): New
13175         function.
13176         * output.cc (Output_section::add_input_section): Call
13177         update_flags_for_input_section.
13178         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13179
13180 2008-04-11  Cary Coutant  <ccoutant@google.com>
13181
13182         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13183         thought unnecessary.
13184         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13185
13186 2008-04-11  Ian Lance Taylor  <iant@google.com>
13187
13188         * output.h (class Output_section_data): Remove inline definition
13189         of set_addralign.
13190         * output.cc (Output_section_data::set_addralign): New function.
13191
13192 2008-04-11  Cary Coutant  <ccoutant@google.com>
13193
13194         Add support for TLS descriptors for i386 and x86_64.
13195         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13196         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13197         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13198         GOT_TYPE_TLS_DESC.
13199         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13200         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13201         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13202         relocations.
13203         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13204         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13205         Fix problem with initial-exec relocations.
13206         (Target_i386::Relocate::relocate_tls): Likewise.
13207         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13208         relaxation.
13209         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13210         support for section-plus-offset dynamic table entries.
13211         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13212         (Output_data_dynamic::Dynamic_entry): Add support for
13213         section-plus-offset dynamic table entries.
13214         (Output_data_dynamic::Classification): Likewise.
13215         (Output_data_dynamic::classification_): Renamed offset_.
13216         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13217         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13218         (Target_x86_64::make_plt_section): New function.
13219         (Target_x86_64::reserve_tlsdesc_entries): New function.
13220         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13221         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13222         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13223         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13224         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13225         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13226         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13227         add extra PLT entry for TLS descriptors.
13228         (Output_data_plt_x86_64::got_): New field.
13229         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13230         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13231         fields.
13232         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13233         descriptors.
13234         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13235         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13236         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13237         R_386_TLS_DESC_CALL relocations.
13238         (Target_x86_64::Scan::global): Likewise.
13239         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13240         for TLS descriptors.
13241         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13242         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13243         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13244         GD-to-IE relaxation.
13245         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13246         and TLS_DESCRIPTORS.
13247         * Makefile.in: Rebuild.
13248         * configure: Rebuild.
13249         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13250         (tls_test_shared2.so): New target.
13251         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13252         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13253         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13254         (tls_shared_gd_to_ie_test_LDADD): New variable.
13255         (tls_shared_gnu2_gd_to_ie_test): New target.
13256         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13257         New targets.
13258         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13259         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13260         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13261         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13262         (tls_shared_gnu2_test): New target.
13263         (tls_test_gnu2_shared.so): New target.
13264         (tls_shared_gnu2_test_SOURCES): New variable.
13265         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13266         (tls_shared_gnu2_test_LDFLAGS): New variable.
13267         (tls_shared_gnu2_test_LDADD): New variable.
13268         * testsuite/Makefile.in: Rebuild.
13269         * testsuite/Makefile.
13270
13271 2008-04-11  Ian Lance Taylor  <iant@google.com>
13272
13273         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13274         justsyms.t.
13275         * testsuite/Makefile.in: Rebuild.
13276
13277         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13278         long.
13279         * testsuite/script_test_2.cc (main): Adjust test.
13280
13281 2008-04-11  David S. Miller  <davem@davemloft.net>
13282             Ian Lance Taylor  <iant@google.com>
13283
13284         * options.h (General_options): Add entries for '-Y' and
13285         '-relax'.
13286         * options.cc (General_options:finalize): If -Y was used, add those
13287         entries to the library path instead of the default "/lib" and
13288         "/usr/lib".
13289
13290 2008-04-11  David S. Miller  <davem@davemloft.net>
13291
13292         * testsuite/justsyms.t: Start at 0x100.
13293         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13294         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13295         long.
13296         * testsuite/script_test_2.cc: Adjust string and section length
13297         checks.
13298
13299 2008-04-09  Ian Lance Taylor  <iant@google.com>
13300
13301         PR gold/5996
13302         * script-sections.cc (Sections_element::allocate_to_segment): Add
13303         orphan parameter.
13304         (Output_section_definition::allocate_to_segment): Likewise.
13305         (Orphan_output_section::allocate_to_segment): Likewise.
13306         (Script_sections::attach_sections_using_phdrs_clause): Don't
13307         propagate non-PT_LOAD segments to orphan sections.
13308         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13309         readelf rather than objdump.
13310         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13311         .interp section and PT_INTERP segment are the same size.
13312         * testsuite/Makefile.in: Rebuild.
13313
13314         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13315         aliases for symbols defined in the same object.
13316         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13317         (weak_alias_test_SOURCES): New variable.
13318         (weak_alias_test_DEPENDENCIES): New variable.
13319         (weak_alias_test_LDFLAGS): New variable.
13320         (weak_alias_test_LDADD): New variable.
13321         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13322         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13323         (weak_alias_test_3.o): New target.
13324         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13325         * testsuite/weak_alias_test_main.cc: New file.
13326         * testsuite/weak_alias_test_1.cc: New file.
13327         * testsuite/weak_alias_test_2.cc: New file.
13328         * testsuite/weak_alias_test_3.cc: New file.
13329
13330 2008-04-08  Ian Lance Taylor  <iant@google.com>
13331
13332         * options.h (class General_options): Add --noinhibit-exec option.
13333         * main.cc (main): Check --noinhibit-exec.
13334
13335         * options.h (class General_options): Define --wrap as a special
13336         option.  Add wrap_symbols_ field.
13337         (General_options::any_wrap_symbols): New function.
13338         (General_options::is_wrap_symbol): New function.
13339         * options.cc (General_options::parse_wrap): New function.
13340         (General_options::General_options): Initialize wrap_symbols_.
13341         * symtab.cc (Symbol_table::wrap_symbol): New function.
13342         (Symbol_table::add_from_object): Handle --wrap.
13343         * symtab.h (class Symbol_table): Declare wrap_symbol.
13344         * target.h (Target::wrap_char): New function.
13345         (Target::Target_info): Add wrap_char field.
13346         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13347         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13348         * testsuite/testfile.cc (Target_test::test_target_info):
13349         Likewise.
13350
13351         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13352         there is one.
13353
13354         * layout.h (class Layout): Add added_eh_frame_data_ field.
13355         * layout.cc (Layout::Layout): Initialize new field.
13356         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13357         output section until we find a section we merged successfully.
13358         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13359         that the size be non-zero.
13360
13361         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13362         qualifier.
13363
13364 2008-04-08  Craig Silverstein  <csilvers@google.com>
13365
13366         * configure.ac: Export new conditional variable HAVE_ZLIB.
13367         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13368         on HAVE_ZLIB.
13369         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13370         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13371
13372 2008-04-07  Ian Lance Taylor  <iant@google.com>
13373
13374         * version.cc (version_string): Set to "1.5".
13375
13376         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13377         Add issued_non_pic_error_ field.  Declare check_non_pic.
13378         (Target_x86_64::Scan::check_non_pic): New function.
13379         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13380         (Target_x86_64::Scan::global): Likewise.
13381
13382         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13383         addend parameter.  Change caller.  Handle merge sections.
13384         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13385         Address to Addend.  Don't add in the result of
13386         local_section_offset, pass down the addend and use the returned
13387         value.
13388         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13389         Update declarations of local_section_offset and symbol_value.
13390         * testsuite/two_file_test_1.cc (t18): New function.
13391         * testsuite/two_file_test_2.cc (f18): New function.
13392         * testsuite/two_file_test_main.cc (main): Call t18.
13393         * testsuite/two_file_test.h (t18, f18): Declare.
13394
13395         * configure.ac: Don't test for objdump, c++filt, or readelf.
13396         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13397         conditionals.
13398         (TEST_READELF): New variable.
13399         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13400         (check_PROGRAMS): Add two_file_strip_test.
13401         (two_file_strip_test): New target.
13402         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13403         (two_file_same_shared_strip_test_SOURCES): New variable.
13404         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13405         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13406         (two_file_same_shared_strip_test_LDADD): New variable.
13407         (two_file_shared_strip.so): New target.
13408         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13409         (ver_test_5.syms, ver_test_7.syms): Likewise.
13410         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13411         (strip_test_3.stdout): Use TEST_OBJDUMP.
13412         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13413
13414 2008-04-04  Cary Coutant  <ccoutant@google.com>
13415
13416         * symtab.h (Symbol::is_weak_undefined): New function.
13417         (Symbol::is_strong_undefined): New function.
13418         (Symbol::is_absolute): New function.
13419         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13420         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13421         absolute symbols.
13422         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13423         (weak_undef_test): New target.
13424         * testsuite/Makefile.in: Rebuild.
13425         * testsuite/weak_undef_file1.cc: New file.
13426         * testsuite/weak_undef_file2.cc: New file.
13427         * testsuite/weak_undef_test.cc: New file.
13428
13429 2008-04-03  Craig Silverstein  <csilvers@google.com>
13430
13431         * compressed_output.h (class Output_compressed_section): Use
13432         unsigned buffer.
13433         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13434         add zlib header.
13435         (zlib_compressed_suffix): Removed.
13436         (Output_compressed_section::set_final_data_size): Use unsigned
13437         buffers.
13438         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13439         Fix linker invocation.
13440         (flagstest_o_specialfile_and_compress_debug_sections):
13441         Likewise.
13442         * testsuite/Makefile.in: Regenerated.
13443
13444 2008-04-02  David S. Miller  <davem@davemloft.net>
13445
13446         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13447         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13448
13449 2008-04-02  Craig Silverstein  <csilvers@google.com>
13450
13451         * TODO: New file.
13452
13453 2008-04-02  Ian Lance Taylor  <iant@google.com>
13454
13455         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13456         parameters.  Update for new key type to views_.  Change all
13457         callers.
13458         (File_read::read): Adjust for byteshift in returned view.
13459         (File_read::add_view): New function, broken out of
13460         find_and_make_view.
13461         (File_read::make_view): New function, broken out of
13462         find_and_make_view.
13463         (File_read::find_or_make_view): Add offset and aligned
13464         parameters.  Rewrite accordingly.  Change all callers.
13465         (File_read::get_view): Add offset and aligned parameters.  Adjust
13466         for byteshift in return value.
13467         (File_read::get_lasting_view): Likewise.
13468         * fileread.h (class File_read): Update declarations.
13469         (class File_read::View): Add byteshift_ field.  Add byteshift to
13470         constructor.  Add byteshift method.
13471         * archive.h (Archive::clear_uncached_views): New function.
13472         (Archive::get_view): Add aligned parameter.  Change all callers.
13473         * object.h (Object::get_view): Add aligned parameter.  Change all
13474         callers.
13475         (Object::get_lasting_view): Likewise.
13476
13477         * fileread.cc (File_read::release): Don't call clear_views if
13478         there are multiple objects.
13479         * fileread.h (File_read::clear_uncached_views): New function.
13480         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13481         on the archive.
13482
13483 2008-03-31  Cary Coutant  <ccoutant@google.com>
13484
13485         Add thin archive support.
13486         * archive.cc (Archive::armagt): New const.
13487         (Archive::setup): Remove task parameter and calls to unlock.
13488         (Archive::unlock_nested_archives): New function.
13489         (Archive::read_header): Add nested_off parameter. Change
13490         all callers.
13491         (Archive::interpret_header): Likewise.
13492         (Archive::include_all_members): Change to handle thin
13493         archives.
13494         (Archive::include_member): Likewise.
13495         * archive.h (Archive::Archive): Add new parameters and
13496         initializers.
13497         (Archive::armagt): New const.
13498         (Archive::setup): Remove task parameter.
13499         (Archive::unlock_nested_archives): New function.
13500         (Archive::read_header): Add nested_off parameter.
13501         (Archive::interpret_header): Likewise.
13502         (Archive::Nested_archive_table): New typedef.
13503         (Archive::is_thin_archive_): New field.
13504         (Archive::nested_archives_): New field.
13505         (Archive::options_): New field.
13506         (Archive::dirpath_): New field.
13507         (Archive::task_): New field.
13508         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13509         for thin archives.  Pass additional parameters to
13510         Archive::Archive.  Unlock the archive file after calling
13511         Archive::setup.
13512
13513 2008-03-29  Ian Lance Taylor  <iant@google.com>
13514
13515         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13516         version symbol to be local.
13517         * testsuite/ver_test_4.sh: New file.
13518         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13519         (check_DATA): Add ver_test_4.syms.
13520         (ver_test_4.syms): New target.
13521         * testsuite/Makefile.in: Rebuild.
13522
13523         * output.cc
13524         (Output_section::Input_section_sort_entry::has_priority): New
13525         function.
13526         (Output_section::Input_section_sort_entry::match_file_name): New
13527         function.
13528         (Output_section::Input_section_sort_entry::match_section_name):
13529         Remove.
13530         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13531         Remove.
13532         (Output_section::Input_section_sort_entry::match_section_file):
13533         Remove.
13534         (Output_section::Input_section_sort_compare::operator()): Rewrite
13535         using new Input_section_sort_entry functions.  Sort crtbegin and
13536         crtend first.  Sort sections with no priority before sections with
13537         a priority.
13538         * testsuite/initpri1.c (d3): Check j != 4.
13539         (cd5): New constructor/destructor function.
13540         (main): Check j != 2.
13541
13542         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13543         new symbol when resolving, don't call set_is_default.
13544         * testsuite/ver_test_7.cc: New file.
13545         * testsuite/ver_test_7.sh: New file.
13546         * testsuite/Makefile.am (ver_test_7.so): New target.
13547         (ver_test_7.o): New target.
13548         (check_SCRIPTS): Add ver_test_7.sh.
13549         (check_DATA): Add ver_test_7.syms.
13550         (ver_test_7.syms): New target.
13551
13552 2008-03-28  Ian Lance Taylor  <iant@google.com>
13553
13554         * layout.cc (Layout::layout): If we see an input section with a
13555         name that needs sorting, set the must_sort flag for the output
13556         section.
13557         (Layout::make_output_section): If the name of the output section
13558         indicates that it might require sorting, set the may_sort flag.
13559         * output.h (Output_section::may_sort_attached_input_sections): New
13560         function.
13561         (Output_section::set_may_sort_attached_input_sections): New
13562         function.
13563         (Output_section::must_sort_attached_input_sections): New
13564         function.
13565         (Output_section::set_must_sort_attached_input_sections): New
13566         function.
13567         (class Output_section): Declare Input_section_sort_entry.  Define
13568         Input_section_sort_compare.  Declare
13569         sort_attached_input_sections.  Add new fields:
13570         may_sort_attached_input_sections_,
13571         must_sort_attached_input_sections_,
13572         attached_input_sections_are_sorted_.
13573         * output.cc (Output_section::Output_section): Initialize new
13574         fields.
13575         (Output_section::add_input_section): Add an entry to
13576         input_sections_ if may_sort or must_sort are true.
13577         (Output_section::set_final_data_size): Call
13578         sort_attached_input_sections if necessary.
13579         (Output_section::Input_section_sort_entry): Define new class.
13580         (Output_section::Input_section_sort_compare::operator()): New
13581         function.
13582         (Output_section::sort_attached_input_sections): New function.
13583         * configure.ac: Check whether the compiler supports constructor
13584         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13585         * testsuite/initpri1.c: New file.
13586         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13587         CONSTRUCTOR_PRIORITY.
13588         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13589         (initpri1_LDFLAGS): New variable.
13590         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13591
13592 2008-03-27  Ian Lance Taylor  <iant@google.com>
13593
13594         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13595         * testsuite/common_test_1.c: New file.
13596         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13597         (common_test_1_SOURCES): New variable.
13598         (common_test_1_DEPENDENCIES): New variable.
13599         (common_test_1_LDFLAGS): New variable.
13600
13601         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13602         and commons_ correctly when NAME/VERSION does not override
13603         NAME/NULL.
13604         * testsuite/ver_test_6.c: New file.
13605         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13606         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13607         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13608
13609 2008-03-26  Ian Lance Taylor  <iant@google.com>
13610
13611         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13612         of an undefined symbol from a version script.
13613         * testsuite/Makefile.am (ver_test_5.so): New target.
13614         (ver_test_5.o): New target.
13615         (check_SCRIPTS): Add ver_test_5.sh.
13616         (check_DATA): Add ver_test_5.syms.
13617         (ver_test_5.syms): New target.
13618         * testsuite/ver_test_5.cc: New file.
13619         * testsuite/ver_test_5.script: New file.
13620         * testsuite/ver_test_5.sh: New file.
13621         * Makefile.in, testsuite/Makefile.in: Rebuild.
13622
13623         PR gold/5986
13624         Fix problems building gold with gcc 4.3.0.
13625         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13626         (gold_error_at_location, gold_warning_at_location): Use it.
13627         * configure.ac: Check whether we can compile and use a template
13628         function with a printf attribute.
13629         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13630         when jumping over bytes.
13631         * object.cc: Instantiate Object::read_section_data.
13632         * debug.h: Include <cstring>
13633         * dwarf_reader.cc: Include <algorithm>
13634         * main.cc: Include <cstring>.
13635         * options.cc: Include <cstring>.
13636         * output.cc: Include <cstring>.
13637         * script.cc: Include <cstring>.
13638         * script.h: Include <string>.
13639         * symtab.cc: Include <cstring> and <algorithm>.
13640         * target-select.cc: Include <cstring>.
13641         * version.cc: Include <string>.
13642         * testsuite/testmain.cc: Include <cstdlib>.
13643         * configure, config.in: Rebuild.
13644
13645 2008-03-25  Ian Lance Taylor  <iant@google.com>
13646
13647         * options.cc: Include "../bfd/bfdver.h".
13648         (options::help): Print bug reporting address.
13649
13650         * version.cc (print_version): Adjust output for current value of
13651         BFD_VERSION_STRING.
13652
13653         * NEWS: New file.
13654
13655         * options.cc (options::help): Print list of supported targets.
13656         * target-select.h: Include <vector>.
13657         (class Target_selector): Make machine_, size_, and is_big_endian_
13658         fields const.  Add bfd_name_ and instantiated_target_ fields.
13659         (Target_selector::Target_selector): Add bfd_name parameter.
13660         (Target_selector::recognize): Make non-virtual, call
13661         do_recognize.
13662         (Target_selector::recognize_by_name): Make non-virtual, call
13663         do_recognize_by_name.
13664         (Target_selector::supported_names): New function.
13665         (Target_selector::bfd_name): New function.
13666         (Target_selector::do_instantiate_target): New pure virtual
13667         function.
13668         (Target_selector::do_recognize): New virtual function.
13669         (Target_selector::do_recognize_by_name): New virtual function.
13670         (Target_selector::instantiate_target): New private function.
13671         (supported_target_names): Declare.
13672         * target-select.cc (Target_selector::Target_selector): Update for
13673         new parameter and fields.
13674         (select_target_by_name): Check that the name matches before
13675         calling recognize_by_name.
13676         (supported_target_names): New function.
13677         * i386.cc (class Target_selector_i386): Update Target_selector
13678         constructor call.  Remove recognize and recognize_by_name.  Add
13679         do_instantiate_target.
13680         * x86_64.cc (class Target_selector_x86_64): Likewise.
13681         * testsuite/testfile.cc (class Target_selector_test): Update for
13682         changes to Target_selector.
13683
13684         * README: Rewrite, with some notes on unsupported features.
13685
13686 2008-03-24  Cary Coutant  <ccoutant@google.com>
13687
13688         * i386.cc (Target_i386::Got_type): New enum declaration.
13689         (Target_i386::Scan::local): Updated callers of Output_data_got
13690         member functions.
13691         (Target_i386::Scan::global): Likewise.
13692         (Target_i386::Relocate::relocate): Likewise.
13693         (Target_i386::Relocate::relocate_tls): Likewise.
13694         * object.h (Got_offset_list): New class.
13695         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13696         (Sized_relobj::local_got_offset): Likewise.
13697         (Sized_relobj::set_local_got_offset): Likewise.
13698         (Sized_relobj::local_has_tls_got_offset): Removed.
13699         (Sized_relobj::local_tls_got_offset): Removed.
13700         (Sized_relobj::set_local_tls_got_offset): Removed.
13701         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13702         * output.cc (Output_data_got::add_global): Added got_type parameter.
13703         (Output_data_got::add_global_with_rel): Likewise.
13704         (Output_data_got::add_global_with_rela): Likewise.
13705         (Output_data_got::add_global_pair_with_rel): New function.
13706         (Output_data_got::add_global_pair_with_rela): New function.
13707         (Output_data_got::add_local): Added got_type parameter.
13708         (Output_data_got::add_local_with_rel): Likewise.
13709         (Output_data_got::add_local_with_rela): Likewise.
13710         (Output_data_got::add_local_pair_with_rel): New function.
13711         (Output_data_got::add_local_pair_with_rela): New function.
13712         (Output_data_got::add_global_tls): Removed.
13713         (Output_data_got::add_global_tls_with_rel): Removed.
13714         (Output_data_got::add_global_tls_with_rela): Removed.
13715         (Output_data_got::add_local_tls): Removed.
13716         (Output_data_got::add_local_tls_with_rel): Removed.
13717         (Output_data_got::add_local_tls_with_rela): Removed.
13718         * output.h (Output_data_got::add_global): Added got_type parameter.
13719         (Output_data_got::add_global_with_rel): Likewise.
13720         (Output_data_got::add_global_with_rela): Likewise.
13721         (Output_data_got::add_global_pair_with_rel): New function.
13722         (Output_data_got::add_global_pair_with_rela): New function.
13723         (Output_data_got::add_local): Added got_type parameter.
13724         (Output_data_got::add_local_with_rel): Likewise.
13725         (Output_data_got::add_local_with_rela): Likewise.
13726         (Output_data_got::add_local_pair_with_rel): New function.
13727         (Output_data_got::add_local_pair_with_rela): New function.
13728         (Output_data_got::add_global_tls): Removed.
13729         (Output_data_got::add_global_tls_with_rel): Removed.
13730         (Output_data_got::add_global_tls_with_rela): Removed.
13731         (Output_data_got::add_local_tls): Removed.
13732         (Output_data_got::add_local_tls_with_rel): Removed.
13733         (Output_data_got::add_local_tls_with_rela): Removed.
13734         * resolve.cc (Symbol::override_base_with_special): Removed
13735         reference to has_got_offset_ field.
13736         * symtab.cc (Symbol::init_fields): Replaced initialization
13737         of got_offset_ with got_offsets_.  Removed initialization
13738         of has_got_offset_
13739         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13740         (Symbol::got_offset): Likewise.
13741         (Symbol::set_got_offset): Likewise.
13742         (Symbol::has_tls_got_offset): Removed.
13743         (Symbol::tls_got_offset): Removed.
13744         (Symbol::set_tls_got_offset): Removed.
13745         (Symbol::got_offset_): Removed.
13746         (Symbol::tls_mod_got_offset_): Removed.
13747         (Symbol::tls_pair_got_offset_): Removed.
13748         (Symbol::got_offsets_): New field.
13749         (Symbol::has_got_offset): Removed.
13750         (Symbol::has_tls_mod_got_offset): Removed.
13751         (Symbol::has_tls_pair_got_offset): Removed.
13752         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13753         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13754         member functions.
13755         (Target_x86_64::Scan::global): Likewise.
13756         (Target_x86_64::Relocate::relocate): Likewise.
13757         (Target_x86_64::Relocate::relocate_tls): Likewise.
13758
13759 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13760
13761         * yyscript.y: Fix spelling error in comment.
13762
13763 2008-03-24  Ian Lance Taylor  <iant@google.com>
13764
13765         * options.h (class General_options): Define build_id option.
13766         * layout.h (class Layout): Declare write_build_id, create_note,
13767         create_build_id.  Add build_id_note_ member.
13768         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13769         "libiberty.h", "md5.h", "sha1.h".
13770         (Layout::Layout): Initialize eh_frame_data_,
13771         eh_frame_hdr_section_, and build_id_note_.
13772         (Layout::finalize): Call create_build_id.
13773         (Layout::create_note): New function, broken out of
13774         Layout::create_gold_note.
13775         (Layout::create_gold_note): Call create_note.
13776         (Layout::create_build_id): New function.
13777         (Layout::write_build_id): New function.
13778         (Close_task_runner::run): Call write_build_id.
13779
13780         * x86_64.cc: Correct license to GPLv3.
13781
13782 2008-03-23  Ian Lance Taylor  <iant@google.com>
13783
13784         * options.cc: Include "demangle.h".
13785         (parse_optional_string): New function.
13786         (parse_long_option): Handle takes_optional_argument.
13787         (parse_short_option): Update dash_z initializer.  Handle
13788         takes_optional_argument.
13789         (General_options::General_options): Initialize do_demangle_.
13790         (General_options::finalize): Set do_demangle_.  Handle demangling
13791         style.
13792         * options.h (parse_optional_string): Declare.
13793         (struct One_option): Add optional_arg field.  Update constructor.
13794         Update call constructor calls.  Add takes_optional_argument
13795         function.
13796         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13797         (DEFINE_optional_string): Define.
13798         (General_options::demangle): Change from DEFINE_bool to
13799         DEFINE_optional_string.
13800         (General_options::no_demangle): New function.
13801         (General_options::do_demangle): New function.
13802         (General_options::set_do_demangle): New function.
13803         (General_options::execstack_status_): Move definition to end of
13804         class definition.
13805         (General_options::static_): Likewise.
13806         (General_options::do_demangle_): New field.
13807         * object.cc (big_endian>::get_symbol_location_info): Call
13808         Options::do_demangle, not Options::demangle.
13809         * symtab.cc (demangle): Likewise.
13810
13811 2008-03-22  Ian Lance Taylor  <iant@google.com>
13812
13813         * gold.h: Include <cstddef> and <sys/types.h>
13814         * options.h: Include <cstring>.
13815
13816 2008-03-21  Ian Lance Taylor  <iant@google.com>
13817
13818         * Added source code to GNU binutils.