gold/
[external/binutils.git] / gold / ChangeLog
1 2012-10-23  Cary Coutant  <ccoutant@google.com>
2
3         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4         from object, not parameters.
5         (Dwarf_info_reader::parse): Likewise.
6         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
7         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
8         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
9         methods.
10
11 2012-10-23  Cary Coutant  <ccoutant@google.com>
12
13         * fileread.cc (Input_file::Input_file): New constructor.
14         * fileread.h (class Input_file): Add new constructor.
15
16 2012-10-18  Alan Modra  <amodra@gmail.com>
17
18         PR gold/14727
19         * object.cc (Relobj::is_section_name_included): Also match
20         .sdata personality section.
21
22 2012-10-18  Alan Modra  <amodra@gmail.com>
23
24         * target-reloc.h (class Default_comdat_behavior): New, package up..
25         (get_comdat_behaviour): ..this.
26         (relocate_section): Add Relocate_comdat_behavior template arg,
27         adjust code to suit.
28         * arm.cc (Target_arm::relocate_section): Adjust to suit.
29         (Target_arm::scan_reloc_section): Likewise.
30         * i386.cc (Target_i386::relocate_section): Likewise.
31         * sparc.cc (Target_sparc::relocate_section): Likewise.
32         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
33         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
34         * powerpc.cc (class Relocate_comdat_behavior): New.
35         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
36         gold::relocate_section with new template arg.
37
38 2012-10-18  Alan Modra  <amodra@gmail.com>
39
40         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
41         dynamic relocs for GOT_TPREL got entries, without symbol if
42         resolving locally.
43         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
44         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
45         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
46
47 2012-10-17  Alan Modra  <amodra@gmail.com>
48
49         PR gold/14726
50         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
51
52 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
53
54         * layout.cc (Layout::include_section): Keep sections marked
55         SHF_EXCLUDE when doing relocatable links.
56
57 2012-10-16  Alan Modra  <amodra@gmail.com>
58
59         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
60         (Target_powerpc::do_finalize_sections): Call it.
61         (Output_data_save_res): New class and supporting functions.
62         (Target_powerpc::symval_for_branch): Only look up .opd entry for
63         normal symbols defined in object files.
64
65 2012-10-12  Alan Modra  <amodra@gmail.com>
66
67         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
68         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
69         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
70         section if scan_opd_relocs not yet called.
71         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
72
73 2012-10-12  Alan Modra  <amodra@gmail.com>
74
75         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
76         add_local_ifunc_entry): Revert last change.
77         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
78
79 2012-10-05  Alan Modra  <amodra@gmail.com>
80
81         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
82         do_plt_address_for_global): New functions.
83         (Output_data_got_powerpc::do_write): Don't segfault when linking
84         statically.
85         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
86         add_local_ifunc_entry): Return true on adding entry..
87         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
88         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
89         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
90         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
91         set up symbols here.
92         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
93         syms here.  Do so even when no .iplt.  Don't segfault when linking
94         statically.
95         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
96         new variants without reloc param.
97         (Glink_sym_ent::Glink_sym_ent): Likewise.
98         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
99         reloc when refs will resolve to plt call stub.
100         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
101         R_PPC_PLTREL24 to resolve locally.
102         (Target_powerpc::Scan::global): Correct ifunc handling.
103         (Target_powerpc::Relocate::relocate): Correct local sym glink
104         lookup.  Don't destroy "value" when we have a plt call stub,
105         and when checking plt call validity.
106         (Target_powerpc::do_dynsym_value): Simplify.
107
108 2012-10-05  Alan Modra  <amodra@gmail.com>
109
110         * i386.cc (Output_data_plt_i386::address_for_global,
111         address_for_local): Add plt offset to returned value.  Adjust uses.
112         * sparc.cc (Output_data_plt_sparc::address_for_global,
113         address_for_local): Likewise.
114         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
115         address_for_local): Likewise.
116         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
117         address_for_local): Likewise.
118         * target.h (Target::plt_address_for_global, plt_address_for_local):
119         Update comment.
120         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
121         (Output_data_got::Got_entry::write): Nor here.
122         * output.h: Comment fix.
123
124 2012-10-02  Jiong Wang  <jiwang@tilera.com>
125
126         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
127         global_offset_table_ value for larget got.
128         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
129
130 2012-09-29  Alan Modra  <amodra@gmail.com>
131
132         * powerpc.cc (Target_powerpc::iplt_): New output section.
133         (Target_powerpc::iplt_section, make_iplt_section,
134         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
135         (Target_powerpc::make_plt_entry): Handle ifunc syms.
136         Target_powerpc::plt_entry_count): Count iplt entries too.
137         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
138         reloc section in constructor.  New params.
139         (Target_powerpc::make_plt_section): Create reloc section here instead.
140         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
141         functions.
142         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
143         (Output_data_glink::add_entry, find_entry): New functions to
144         deal with local syms.
145         (Glink_sym_ent): Add support for local syms.
146         (Output_data_glink::do_write): Handle ifunc plt entries.
147         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
148         (Target_powerpc::Scan::local, global): Handle ifunc syms.
149         (Target_powerpc::Relocate::relocate): Likewise.
150         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
151
152 2012-09-25  Alan Modra  <amodra@gmail.com>
153
154         * object.h (Sized_relobj_file::adjust_local_symbol,
155         do_adjust_local_symbol): New functions.
156         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
157         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
158         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
159         and irregular opd entry spacing.
160         (Powerpc_relobj::do_read_relocs): Add opd size checks.
161         (Global_symbol_visitor_opd): New functor.
162         (Target_powerpc::do_finalize_sections): Omit global symbols defined
163         on deleted opd entries.
164
165 2012-09-15  Jiong Wang  <jiwang@tilera.com>
166
167         * tilegx.cc: New file.
168         * Makefile.am (TARGETSOURCES): Add tilegx.cc
169         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
170         * configure.tgt: Add entries for tilegx*.
171         * configure.ac: Likewise.
172         * Makefile.in: Rebuild.
173         * configure: Likewise.
174         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
175         tilegx.
176
177 2012-09-13  Alan Modra  <amodra@gmail.com>
178
179         * target-reloc.h (scan_relocs): Call scan.local for relocs
180         against symbols in discarded sections.  Pass is_discarded
181         param.
182         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
183         Add is_discarded param.
184         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
185         is_discarded to flag opd entry as discarded.  Don't emit dyn
186         relocs on such entries.
187         (Target_powerpc::Scan::global): Similarly detect and handle
188         such opd entries.
189         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
190         opd_ent_.  Update all uses.
191         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
192         (Target_powerpc::relocate_section): Zero out discarded opd
193         entry relocs.
194
195 2012-09-12  Ian Lance Taylor  <iant@google.com>
196
197         PR gold/14570
198         * output.cc: Rename Output_data_got template parameter from size
199         to got_size for all functions.  Compile all variants of
200         Output_data_got.
201         (Output_data_got::Got_entry::write): Correct use of size for
202         symbol value.  Use local_is_tls rather than casting to
203         Sized_relobj_file.
204         * object.h (class Object): Add local_is_tls and do_local_is_tls.
205         (class Sized_relobj_file): Add do_local_is_tls.
206         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
207
208 2012-09-11  Alan Modra  <amodra@gmail.com>
209
210         PR gold/14566
211         * layout.cc (Layout::set_segment_offsets): When using
212         common-page-size alignment, ensure we are on a new max-page-size
213         page.
214         * output.cc (Output_segment::set_section_addresses): Use
215         abi_pagesize, not common_pagesize for relro boundary.
216         (Output_segment::set_offset): Likewise.
217
218 2012-09-11  Alan Modra  <amodra@gmail.com>
219
220         * output.h (Output_data_got::add_global_tls, add_local_tls,
221         add_local_tls_pair): New functions.
222         (Output_data_got::add_local_pair_with_rel): Remove second
223         reloc param.  Expand comment.
224         (Output_data_got::Got_entry): Rename use_plt_offset_ to
225         use_plt_or_tls_offset_, similarly for constructor param.
226         (Output_data_got::Got_entry::write): Add got_index param.
227         * output.cc (Output_data_got::add_global_tls, add_local_tls,
228         add_local_tls_pair): New functions.
229         (Output_data_got::Got_entry::write): Handle tls symbols
230         with use_plt_or_tls_offset_ set specially.
231         (Output_data_got::add_local_pair_with_rel): Only one reloc.
232         (Output_data_got::do_write): Replace iterator with index, pass
233         index to entry write function.
234         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
235         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
236         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
237         call.
238         * i386.cc (Target_i386::Scan::local): Likewise.
239         * sparc.cc (Target_sparc::Scan::local): Likewise.
240         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
241         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
242         do_tls_offset_for_global): New functions.
243         (Target_powerpc::Scan::local): Correct TLS relocations and got
244         entry values.
245         (Target_powerpc::Scan::global): Don't emit unnecessary
246         dynamic relocations on TLS GOT entries.
247
248 2012-09-10  Matthias Klose  <doko@ubuntu.com>
249
250         * config.in: Disable sanity check for kfreebsd.
251
252 2012-09-10  Sterling Augustine  <saugustine@google.com>
253
254         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
255         (Gdb_index::pubtypes_read): New parameter.
256         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
257         to calls.
258         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
259         pubtypes_object_.
260
261 2012-09-09  Alan Modra  <amodra@gmail.com>
262
263         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
264         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
265         * gc.h (gc_process_relocs): Call target gc_add_reference.
266         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
267         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
268         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
269         unnecessary cast.
270         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
271         to cater for when we don't need code offset.  Update use.
272         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
273         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
274         set_opd_valid): New functions.
275         (Target_powerpc::do_gc_add_reference): New function.
276         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
277         stashed refs.
278         (Target_powerpc::do_gc_mark_symbol): New function.
279
280 2012-09-06  Cary Coutant  <ccoutant@google.com>
281
282         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
283         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
284         (Dwarf_die::skip_attributes): Likewise.
285         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
286         * testsuite/gdb_index_test.cc (inline_func_1): New function.
287         (main): Call it.
288         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
289
290 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
291
292         * testsuite/script_test_3.t: Add .got.plt output section
293         statement.
294         * testsuite/script_test_4.t: Likewise.
295
296 2012-09-05  Alan Modra  <amodra@gmail.com>
297
298         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
299         update all uses and lose "enum" when using type.
300
301 2012-09-05  Alan Modra  <amodra@gmail.com>
302
303         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
304         * configure: Regenerate.
305         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
306         (plugin_final_layout.stdout): Likewise.
307         (memory_test): Set page sizes to 0x1000.
308         * testsuite/Makefile.in: Regenerate.
309         * testsuite/discard_locals_test.sh: Add FIXME comment.
310         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
311         * testsuite/pr14265.t: Add .got output section statement.
312         * testsuite/script_test_2.t: Likewise.
313         * testsuite/script_test_3.t: Likewise.
314         * testsuite/script_test_4.t: Likewise.
315         * testsuite/script_test_5.t: Likewise.
316         * testsuite/script_test_6.t: Likewise.
317         * testsuite/script_test_7.t: Likewise.
318         * testsuite/script_test_9.t: Likewise.
319
320 2012-09-05  Alan Modra  <amodra@gmail.com>
321
322         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
323         (Powerpc_relocate_functions::Status): New typedef.
324         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
325         (Target_powerpc::Scan::local): Handle REL64.
326         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
327         for REL32 and REL64.
328         (Target_powerpc::symval_for_branch): New function, extracted from..
329         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
330         checks.  Report overflow errors.
331
332 2012-09-05  Alan Modra  <amodra@gmail.com>
333
334         * object.h (Sized_relobj_file::emit_relocs): Delete.
335         (Sized_relobj_file::emit_relocs_reltype): Delete.
336         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
337         relocate_relocs for --emit-relocs.
338         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
339         * output.h: Update comment.
340         (Output_segment::first_section): New function.
341         (Output_segment::first_section_load_address): Use first_section.
342         * output.cc (Output_segment::first_section): New function extracted..
343         (Output_segment::first_section_load_address): ..from here.  Delete.
344         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
345         * target.h (Sized_target::relocate_for_relocatable): Likewise.
346         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
347         adjust call to target.h function.
348         * i386.cc (Target_i386): Likewise.
349         * sparc.cc (Target_sparc): Likewise.
350         * x86_64.cc (Target_x86_64): Likewise.
351         * powerpc.cc (Target_powerpc): Likewise.
352         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
353         first tls section has section symbol for optimised local dynamic
354         output relocs.
355         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
356         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
357         optimised tls code.
358         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
359         Rename to relocate_relocs.  Update error message.
360
361 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
362
363         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
364         --just-symbols.
365
366 2012-08-31  Alan Modra  <amodra@gmail.com>
367
368         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
369         (Powerpc_relobj::toc_base_offset): New stub function.
370         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
371         got_mod_index_offset to tlsld_got_offset.  Update all refs.
372         (Target_powerpc::Relocate::enum skip_tls): New.
373         (Target_powerpc::call_tls_get_addr_): New var.
374         (Target_powerpc::is_branch_reloc): Move to file scope.
375         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
376         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
377         New functions.
378         (Target_powerpc::enum Got_type): Delete old values, add new ones.
379         (powerpc_info): Correct common_pagesize for ppc64.
380         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
381         (Powerpc_relocate_functions): Add overflow check enums and functions.
382         Add non-shift version of rela, rela_ua.  Delete all rel public
383         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
384         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
385         addr16_ha3, addr14 functions.
386         (Output_data_got_powerpc::add_constant_pair): New function.
387         (Output_data_got_powerpc::got_base_offset): Likewise.
388         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
389         (instruction constants): Sort, add some more.
390         (Output_data_glink::do_write): Add and use Address typedef.  Use
391         object->toc_base_offset() stub for 64-bit.
392         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
393         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
394         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
395         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
396         Always treat .opd relocs as against locally defined symbol.
397         Correct condition for RELATIVE relocs.
398         (Target_powerpc::do_finalize_sections): Test for NULL sections.
399         (Target_powerpc::Relocate::relocate): Use plt call stub as value
400         for 32-bit syms with a plt entry.  Correct ppc64 toc base
401         calculations.  Handle TLS relocs, and more.  Add overflow
402         checking and adjust for Powerpc_relocate_functions changes.
403         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
404         Reinstate --emit-relocs code with FIXME.
405
406 2012-08-30  Alan Modra  <amodra@gmail.com>
407
408         * layout.cc (Layout::set_segment_offsets): Set p_align to
409         abi_pagesize, not common_pagesize.
410         (Layout::relaxation_loop_body): Similarly use abi_pagesize
411         to determine whether file header can go in segment.
412
413 2012-08-30  Alan Modra  <amodra@gmail.com>
414
415         * output.h (Output_reloc::Output_reloc <output section>): Add
416         is_relative param.  Adjust calls.
417         (Output_reloc::add_output_section_relative): New functions.
418         * output.cc (Output_reloc::Output_reloc <output section>): Handle
419         is_relative.
420         (Output_reloc::symbol_value): Handle SECTION_CODE.
421
422 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
423
424         * gold.cc (queue_middle_tasks): Call layout again when unique
425         segments for sections is desired.
426         * layout.cc (Layout::Layout): Initialize new members.
427         (Layout::get_output_section_flags): New function.
428         (Layout::choose_output_section): Call get_output_section_flags.
429         (Layout::layout): Make output section for mapping to a unique segment.
430         (Layout::insert_section_segment_map): New function.
431         (Layout::attach_allocated_section_to_segment): Make unique segment for
432         output sections marked so.
433         (Layout::segment_precedes): Check for unique segments when sorting.
434         * layout.h (Layout::Unique_segment_info): New struct.
435         (Layout::Section_segment_map): New typedef.
436         (Layout::insert_section_segment_map): New function.
437         (Layout::get_output_section_flags): New function.
438         (Layout::is_unique_segment_for_sections_specified): New function.
439         (Layout::set_unique_segment_for_sections_specified): New function.
440         (Layout::unique_segment_for_sections_specified_): New member.
441         (Layout::section_segment_map_): New member.
442         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
443         Rename is_gc_pass_one to is_pass_one.
444         Rename is_gc_pass_two to is_pass_two.
445         Rename is_gc_or_icf to is_two_pass.
446         Check for which pass based on whether symbols data is present.
447         Make it two pass when unique segments for sections is desired.
448         * output.cc (Output_section::Output_section): Initialize new
449         members.
450         * output.h (Output_section::is_unique_segment): New function.
451         (Output_section::set_is_unique_segment): New function.
452         (Output_section::is_unique_segment_): New member.
453         (Output_section::extra_segment_flags): New function.
454         (Output_section::set_extra_segment_flags): New function.
455         (Output_section::extra_segment_flags_): New member.
456         (Output_section::segment_alignment): New function.
457         (Output_section::set_segment_alignment): New function.
458         (Output_section::segment_alignment_): New member.
459         (Output_segment::Output_segment): Initialize is_unique_segment_.
460         (Output_segment::is_unique_segment): New function.
461         (Output_segment::set_is_unique_segment): New function.
462         (Output_segment::is_unique_segment_): New member.
463         * plugin.cc (allow_unique_segment_for_sections): New function.
464         (unique_segment_for_sections): New function.
465         (Plugin::load): Add new functions to transfer vector.
466         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
467         * Makefile.in: Regenerate.
468         * testsuite/plugin_final_layout.sh: Check if unique segment
469         functionality works.
470         * testsuite/plugin_section_order.c (onload): Check if new interfaces
471         are available.
472         (allow_unique_segment_for_sections): New global.
473         (unique_segment_for_sections): New global.
474         (claim_file_hook): Call allow_unique_segment_for_sections.
475         (all_symbols_read_hook): Call unique_segment_for_sections.
476
477 2012-08-22  Cary Coutant  <ccoutant@google.com>
478
479         * layout.cc (Layout::include_section): Don't assert on GROUP
480         sections with --emit-relocs.
481
482 2012-08-21  Cary Coutant  <ccoutant@google.com>
483
484         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
485         if --export-dynamic-symbol names an undef symbol.
486
487 2012-08-18  Alan Modra  <amodra@gmail.com>
488
489         * powerpc.cc: Formatting and white space.
490         (Powerpc_relobj): Rename got2_section_ to special_.
491         Add opd_ent_shndx_ and opd_ent_off_ vectors.
492         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
493         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
494         (Target_powerpc): Add Address typedef and invalid_address.  Use
495         throughout.
496         (Target_powerpc::is_branch_reloc): New function.
497         (Powerpc_relocate_functions): Add Address typedef, use throughout.
498         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
499         for dst_mask, value and addend.
500         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
501         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
502         (Output_data_glink::do_write): Correct toc base.  Don't try to use
503         uint16_t for 24-bit offset.  Use get_output_section_offset and
504         check return.
505         (Target_powerpc::Scan::local): Handle more relocs.
506         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
507         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
508         Plug in toc restoring insn after plt calls.  Translate branches
509         to function descriptor symbols to corresponding entry point.
510         (Target_powerpc::relocate_for_relocatable): Check return from
511         get_output_section_offset.
512         * symtab.h: Comment typo.
513
514 2012-08-14  Ian Lance Taylor  <iant@google.com>
515
516         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
517         unsupported_relocal_local to call unsupported_reloc_global.
518
519 2012-08-14  Nick Clifton  <nickc@redhat.com>
520
521         PR ld/14265
522         * script-sections.cc (Sections_element::output_section_name): Add
523         keep return parameter.
524         (Output_section_element::match_name): Add keep return parameter.
525         Return the value of the keep_ member.
526         * script-sections.h (class Output_section): Update
527         output_section_name prototype.
528         * layout.cc (Layout::keep_input_section): New public member
529         function.
530         (Layout::choose_output_section): Pass keep parameter to
531         output_section_name.
532         * layout.h (class Layout): Add keep_input_section.
533         * object.cc (Sized_relobj_file::do_layout): Check for kept input
534         sections.
535         * testsuite/Makefile.am: Add a test.
536         * testsuite/Makefile.in: Regenerate.
537         * testsuite/pr14265.c: Source file for the test.
538         * testsuite/pr14265.t: Linker script for the test.
539         * testsuite/pr14265.sh: Shell script for the test.
540
541 2012-08-14  Alan Modra  <amodra@gmail.com>
542
543         * target.h (Target::output_section_name): New function.
544         (Target::do_output_section_name): New function.
545         * layout.cc (Layout::choose_output_section): Call the above.
546         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
547
548 2012-08-14  Alan Modra  <amodra@gmail.com>
549
550         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
551         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
552         for replace_constant call.
553         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
554         (Output_data_glink::do_print_to_mapfile): New function.
555         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
556         (Target_powerpc::Relocate::relocate): Likewise.
557
558 2012-08-14  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
561         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
562         (Output_data_glink::add_entry,find_entry): Remove shndx param.
563         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
564         all references to shndx_.  Handle special case for R_PPC_PLTREL24
565         here.
566         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
567         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
568         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
569         here.
570         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
571         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
572
573 2012-08-12  Alan Modra  <amodra@gmail.com>
574
575         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
576         (glink insn constants): Use uint32_t.
577         (Output_data_glink::add_entry): Use insert, not [] operator.
578
579 2012-08-11  Alan Modra  <amodra@gmail.com>
580
581         * object.h (Sized_relobj_file::find_shdr): New function.
582         (Sized_relobj_file::find_special_sections): New function.
583         * object.cc (Sized_relobj_file::find_shdr): New function.
584         (Sized_relobj_file::find_eh_frame): Use find_shdr.
585         (Sized_relobj_file::find_special_sections): New function, split out..
586         (Sized_relobj_file::do_read_symbols): ..from here.
587         * output.h (Output_data_got::replace_constant): New function.
588         (Output_data_got::num_entries): New function.
589         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
590         (Output_data_got::got_offset): Protected rather than private.
591         (Output_data_got::replace_got_entry): New function.
592         * output.cc (Output_data_got::replace_got_entry): New function.
593         * powerpc.cc (class Powerpc_relobj): New.
594         (class Powerpc_relocate_functions): Delete all psymval variants or
595         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
596         Implement _ha functions using corresponding _hi function.
597         (Powerpc_relobj::find_special_sections): New function.
598         (Target_powerpc::do_make_elf_object): New function.
599         (class Output_data_got_powerpc): New.
600         (class Output_data_glink): New.
601         (class Powerpc_scan_relocatable_reloc): New.
602         Many more changes througout file.
603
604 2012-08-09  Nick Clifton  <nickc@redhat.com>
605
606         * po/vi.po: Updated Vietnamese translation.
607
608 2012-08-07  Ian Lance Taylor  <iant@google.com>
609
610         * layout.cc (Layout::add_target_dynamic_tags): If
611         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
612         plt_rel.
613
614 2012-07-30  Nick Clifton  <nickc@redhat.com>
615
616         * po/gold.pot: Updated template.
617         * po/es.po: Updated Spanish translation.
618
619 2012-07-18  Cary Coutant  <ccoutant@google.com>
620
621         PR gold/14344
622         * configure.ac: Add check for -gpubnames support.
623         * configure: Regenerate.
624         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
625         support; force -gno-pubnames.
626         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
627         support.
628         (gdb_index_test_4): New test.
629         * testsuite/Makefile.in: Regenerate.
630         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
631         * testsuite/gdb_index_test_2.sh: Likewise.
632         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
633         * testsuite/gdb_index_test_4.sh: New script.
634         * testsuite/gdb_index_test_comm.sh: New script with common code;
635         don't look for space after colon.
636
637 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
638
639         * gold.cc (queue_middle_tasks): Update function order only after
640         deferred objects due to plugins are processed.
641
642 2012-07-11  Ian Lance Taylor  <iant@google.com>
643
644         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
645         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
646         (Target_arm::scan_reloc_for_stub): Likewise.
647         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
648         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
649         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
650         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
651         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
652
653 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
654             Ian Lance Taylor  <iant@google.com>
655
656         PR gold/14309
657         * configure.ac: Test whether std::tr1::hash<off_t> works.
658         * gold.h: Add a specialization for std::tr1::hash<off_t> if
659         needed.
660         * output.h (class Output_fill): Add virtual destructor.
661         * configure, config.in: Rebuild.
662
663 2012-06-22  Roland McGrath  <mcgrathr@google.com>
664
665         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
666
667 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
668
669         * plugin.cc (Plugin::load): Handle position independent executables.
670
671 2012-06-06  Cary Coutant  <ccoutant@google.com>
672
673         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
674         add .debug_macro.
675         (lines_only_debug_sections): Likewise.
676         (gdb_fast_lookup_sections): New static array.
677         (is_gdb_debug_section): Rename formal parameter.
678         (is_lines_only_debug_section): Likewise.
679         (is_gdb_fast_lookup_section): New function.
680         (Layout::include_section): Check for ".zdebug_" prefix; pass
681         section name suffix to is_gdb_debug_section, et al.; check for
682         fast-lookup sections when building .gdb_index.
683         * options.h (--strip-debug-gdb): Update GDB version number.
684
685 2012-06-06  Cary Coutant  <ccoutant@google.com>
686
687         * configure.ac: Add check for fallocate.
688         * configure: Regenerate.
689         * config.in: Regenerate.
690
691         * options.h (class General_options): Add --mmap-output-file and
692         --posix-fallocate options.
693         * output.cc: (posix_fallocate): Remove; replace with...
694         (gold_fallocate): New function.
695         (Output_file::map_no_anonymous): Call gold_fallocate.
696         (Output_file::map): Check --mmap-output-file option.
697
698 2012-06-05  Jing Yu  <jingyu@google.com>
699
700         * gold.h (textdomain): Add do {} to empty while(0).
701         (bindtextdomain): Likewise.
702
703 2012-06-04  Cary Coutant  <ccoutant@google.com>
704
705         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
706         has_dynsym_index.
707
708 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
709
710         * symtab.cc (Symbol_table::define_special_symbol):
711         Initialize *poldsym to prevent uninitialized variable errors.
712
713 2012-05-23  Cary Coutant  <ccoutant@google.com>
714
715         * layout.cc (Layout::section_name_mapping): Add rules to handle
716         exact match on .data.rel.ro.local or .data.rel.ro.
717         (Layout::output_section_name): Check for exact matches.
718
719 2012-05-23  Cary Coutant  <ccoutant@google.com>
720
721         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
722         more carefully.
723
724 2012-05-22  Cary Coutant  <ccoutant@google.com>
725
726         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
727         object before exporting symbol.
728
729 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
730
731         * testsuite/tls_test.cc: Include "config.h" first.
732         * testsuite/tls_test_c.c: Likewise.
733
734 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
735             Nick Clifton  <nickc@redhat.com>
736
737         PR 14072
738         * configure.in: Add check that sysdep.h has been included before
739         any system header files.
740         * configure: Regenerate.
741         * config.in: Regenerate.
742
743 2012-05-14  Cary Coutant  <ccoutant@google.com>
744
745         * layout.cc (Layout::make_output_section): Mark .tdata section
746         as RELRO.
747         * testsuite/relro_test.cc: Add a TLS variable.
748
749 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
750
751         PR gold/14091
752         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
753         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
754         R_X86_64_64.
755
756 2012-05-08  Cary Coutant  <ccoutant@google.com>
757
758         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
759         (lines_only_debug_sections): Likewise.
760
761 2012-05-02  Roland McGrath  <mcgrathr@google.com>
762
763         * nacl.cc: New file.
764         * nacl.h: New file.
765         * Makefile.am (CCFILES, HFILES): Add them.
766         * Makefile.in: Regenerate.
767         * i386.cc (Output_data_plt_i386_nacl): New class.
768         (Output_data_plt_i386_nacl_exec): New class.
769         (Output_data_plt_i386_nacl_dyn): New class.
770         (Target_i386_nacl): New class.
771         (Target_selector_i386_nacl): New class.
772         (target_selector_i386): Use it instead of Target_selector_i386.
773         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
774         (Target_x86_64_nacl): New class.
775         (Target_selector_x86_64_nacl): New class.
776         (target_selector_x86_64, target_selector_x32): Use it instead of
777         Target_selector_x86_64.
778         * arm.cc (Output_data_plt_arm_nacl): New class.
779         (Target_arm_nacl): New class.
780         (Target_selector_arm_nacl): New class.
781         (target_selector_arm, target_selector_armbe): Use it instead of
782         Target_selector_arm.
783
784         * target-select.cc (select_target): Take new Input_file* and off_t
785         arguments, pass them on to recognize method of selector.
786         * object.cc (make_elf_sized_object): Update caller.
787         * parameters.cc (parameters_force_valid_target): Likewise.
788         * incremental.cc (make_sized_incremental_binary): Likewise.
789         * target-select.h: Update decl.
790         (Target_selector::recognize): Take new Input_file* argument,
791         pass it on to do_recognize.
792         (Target_selector::do_recognize): Take new Input_file* argument.
793         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
794         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
795         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
796         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
797
798         * target.h (Target::Target_info): New members isolate_execinstr
799         and rosegment_gap.
800         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
801         * arm.cc (Target_arm::arm_info): Update initializer.
802         * i386.cc (Target_i386::i386_info): Likewise.
803         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
804         * sparc.cc (Target_sparc::sparc_info): Likewise.
805         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
806         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
807         * layout.cc (Layout::attach_allocated_section_to_segment):
808         Take new const Target* argument.  If target->isolate_execinstr(), act
809         like --rosegment.
810         (Layout::find_first_load_seg): Take new const Target* argument;
811         if target->isolate_execinstr(), reject PF_X segments.
812         (Layout::relaxation_loop_body): Update caller.
813         (Layout::set_segment_offsets): If target->isolate_execinstr(),
814         reset file offset to zero when we hit LOAD_SEG, and then do a second
815         loop over the segments before LOAD_SEG to reassign offsets after
816         addresses have been determined.  Handle target->rosegment_gap().
817         (Layout::attach_section_to_segment): Take new const Target* argument;
818         pass it to attach_allocated_section_to_segment.
819         (Layout::make_output_section): Update caller.
820         (Layout::attach_sections_to_segments): Take new const Target* argument;
821         pass it to attach_section_to_segment.
822         * gold.cc (queue_middle_tasks): Update caller.
823         * layout.h (Layout): Update method decls with new arguments.
824
825         * arm.cc (Target_arm::Target_arm): Take optional argument for the
826         Target_info pointer to use.
827         (Target_arm::do_make_data_plt): New virtual method.
828         (Target_arm::make_data_plt): New method that calls it.
829         (Target_arm::make_plt_entry): Use it.
830         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
831         for the section alignment.
832         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
833         method.
834         (Output_data_plt_arm::first_plt_entry_offset): Call it.
835         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
836         method.
837         (Output_data_plt_arm::get_plt_entry_size): Call it.
838         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
839         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
840         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
841         method.
842         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
843         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
844         method instead of sizeof(plt_entry).
845         (Output_data_plt_arm::add_entry): Likewise.
846         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
847         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
848         than static method.
849         (Target_arm::plt_entry_size): Likewise.
850         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
851         Move to ...
852         (Output_data_plt_arm_standard): ... here, new class.
853         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
854         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
855         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
856
857         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
858         Take additional argument for the PLT entry size.
859         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
860         Use get_plt_entry_size method rather than plt_entry_size variable.
861         (Output_data_plt_x86_64::reserve_slot): Likewise.
862         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
863         (Output_data_plt_x86_64::add_entry): Likewise.
864         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
865         (Output_data_plt_x86_64::address_for_global): Likewise.
866         (Output_data_plt_x86_64::address_for_local): Likewise.
867         (Output_data_plt_x86_64::set_final_data_size): Likewise.
868         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
869         Make method non-static.
870         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
871         method.
872         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
873         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
874         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
875         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
876         virtual method.
877         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
878         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
879         virtual method.
880         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
881         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
882         virtual method.
883         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
884         (Output_data_plt_x86_64::plt_entry_size)
885         (Output_data_plt_x86_64::first_plt_entry)
886         (Output_data_plt_x86_64::plt_entry)
887         (Output_data_plt_x86_64::tlsdesc_plt_entry)
888         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
889         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
890         (Output_data_plt_x86_64_standard): ... here, new class.
891         (Target_x86_64::Target_x86_64): Take optional argument for the
892         Target_info pointer to use.
893         (Target_x86_64::do_make_data_plt): New virtual method.
894         (Target_x86_64::make_data_plt): New method to call it.
895         (Target_x86_64::init_got_plt_for_update): Use that.
896         Call this->plt_->add_eh_frame method here.
897         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
898         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
899         rather than static method.
900         (Target_x86_64::plt_entry_size): Likewise.
901         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
902         rather than plt_entry_size variable.  Move guts of PLT filling to...
903         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
904         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
905         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
906
907         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
908         additional argument for the section alignment.
909         Don't do add_eh_frame_for_plt here.
910         (Output_data_plt_i386::first_plt_entry_offset): Make the method
911         non-static.  Use get_plt_entry_size method rather than plt_entry_size
912         variable.
913         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
914         method.
915         (Output_data_plt_i386::get_plt_entry_size): Call it.
916         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
917         (Output_data_plt_i386::add_eh_frame): New method to call it.
918         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
919         method.
920         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
921         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
922         method.
923         (Output_data_plt_i386::fill_plt_entry): New method to call it.
924         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
925         method instead of plt_entry_size.
926         (Output_data_plt_i386::plt_entry_size)
927         (Output_data_plt_i386::plt_eh_frame_fde_size)
928         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
929         (Output_data_plt_i386_standard): ... here, new class.
930         (Output_data_plt_i386_exec): New class.
931         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
932         (Output_data_plt_i386_exec::first_plt_entry): ... here.
933         (Output_data_plt_i386::exec_plt_entry): Move to ...
934         (Output_data_plt_i386_exec::plt_entry): ... here.
935         (Output_data_plt_i386_dyn): New class.
936         (Output_data_plt_i386::first_plt_entry): Move to ...
937         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
938         (Output_data_plt_i386::dyn_plt_entry): Move to ...
939         (Output_data_plt_i386_dyn::plt_entry): ... here.
940         (Target_i386::Target_i386): Take optional argument for the Target_info
941         pointer to use.
942         (Target_i386::do_make_data_plt): New virtual method.
943         (Target_i386::make_data_plt): New method to call it.
944         (Target_i386::make_plt_section): Use that.
945         Call this->plt_->add_eh_frame method here.
946         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
947         rather than plt_entry_size variable.
948         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
949         (Output_data_plt_i386::address_for_local): Likewise.
950         (Output_data_plt_i386::do_write): Likewise.
951         Move guts of PLT filling to...
952         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
953         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
954         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
955         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
956
957 2012-05-01  Cary Coutant  <ccoutant@google.com>
958
959         * dwarf_reader.cc (Dwarf_die::read_attributes)
960         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
961         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
962         * reduced_debug_output.cc
963         (Output_reduced_debug_info_section::get_die_end): Remove
964         DW_FORM_GNU_ref_index.  Add default case.
965
966 2012-04-26  Mark Wielaard  <mjw@redhat.com>
967
968         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
969         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
970         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
971         DW_AT_high_pc as offset from DW_AT_low_pc.
972
973         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
974         * testsuite/Makefile.in: Regenerate.
975         * testsuite/gdb_index_test_3.c: New test source file.
976         * testsuite/gdb_index_test_3.sh: New test source file.
977
978 2012-04-25  Ian Lance Taylor  <iant@google.com>
979
980         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
981         pointer.
982         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
983         as a class, not a struct.
984         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
985         (Target_arm::apply_cortex_a8_workaround): Likewise.
986         * gc.h: Declare Reloc_types as a struct, not a class.
987         * object.h: Declare Symbols_data as a struct.
988         * reloc.h: Declare Read_relocs_data as a struct.
989         * target.h: Declare Relocate_info as a struct.
990
991 2012-04-24  David S. Miller  <davem@davemloft.net>
992
993         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
994         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
995         and R_SPARC_WPLT30.
996
997 2012-04-24  Cary Coutant  <ccoutant@google.com>
998
999         * incremental-dump.cc (find_input_containing_global): Replace
1000         magic number with symbolic constant.
1001         (dump_incremental_inputs): Update version number.
1002         * incremental.cc (Output_section_incremental_inputs): Update version
1003         number; import symbolic constants from Incremental_inputs_reader.
1004         (Incremental_inputs::create_data_sections): Align relocations
1005         section correctly for 64-bit targets.
1006         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1007         constants; add padding.
1008         (Output_section_incremental_inputs::write_header): Add assert for
1009         header_size.
1010         (Output_section_incremental_inputs::write_input_files): Add assert
1011         for input_entry_size.
1012         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1013         add assert for object_info_size, input_section_entry_size,
1014         global_sym_entry_size.
1015         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1016         for data structure sizes; use them.
1017         (Incremental_input_entry_reader): Import symbolic constants from
1018         Incremental_inputs_reader; use them.
1019
1020 2012-04-23  David S. Miller  <davem@davemloft.net>
1021
1022         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1023         and elf_flags_set_.
1024         (Target_sparc::Target_sparc): Initialize new fields.
1025         (Target_sparc::do_make_elf_object): New function.
1026         (Target_sparc::do_adjust_elf_header): New function.
1027
1028 2012-04-23  Cary Coutant  <ccoutant@google.com>
1029
1030         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1031         CU range table of gdb index.
1032
1033 2012-04-20  David S. Miller  <davem@davemloft.net>
1034
1035         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1036         instead of false.
1037
1038 2012-04-16  David S. Miller  <davem@davemloft.net>
1039
1040         * sparc.cc (Target_sparc::got_address): New function.
1041         (Sparc_relocate_functions::gdop_hix22): New function.
1042         (Sparc_relocate_functions::gdop_lox10): New function.
1043         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1044         relocs.
1045         (Target_sparc::Scan::local): Likewise if the global symbol is not
1046         preemptible and is not IFUNC.
1047         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1048         transformations for local and non-preemptible non-IFUNC global
1049         symbols.
1050
1051         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1052         writing out 64-bit part of ranges.
1053
1054         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1055         -fpic and -fpie respectively.
1056         * Makefile.in: Regenerate.
1057
1058         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1059         (Target_sparc::Target_sparc): Initialize new field.
1060         (Target_sparc::do_plt_section_for_global): New function.
1061         (Target_sparc::do_plt_section_for_local): New function.
1062         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1063         (Target_sparc::make_plt_section): New function, broken out of
1064         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1065         (Target_sparc::make_plt_entry): Call make_plt_section.
1066         (Target_sparc::make_local_ifunc_plt_entry): New function.
1067         (Target_sparc::rela_ifunc_section): New function.
1068         (Target_sparc::plt_section): Remove const.
1069         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1070         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1071         and ifunc_count_ fields.
1072         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1073         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1074         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1075         (Output_data_plt_sparc::rela_ifunc): New function.
1076         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1077         (Output_data_plt_sparc::has_ifunc_section): New function.
1078         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1079         (Output_data_plt_sparc::address_for_global): New function.
1080         (Output_data_plt_sparc::address_for_local): New function.
1081         (Output_data_plt_sparc::plt_index_to_offset): New function.
1082         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1083         and entry_count.
1084         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1085         entry_count.
1086         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1087         R_SPARC_JMP_IREL to switch.
1088         (Target_sparc::Scan::check_non_pic): Likewise.
1089         (Target_sparc::Scan::local): Handle IFUNC symbols.
1090         (Target_sparc::Scan::local): Likewise.
1091         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1092         and plt_address_for_local.
1093         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1094         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1095
1096         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1097         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1098         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1099         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1100         global relocs too.
1101         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1102         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1103         calls.
1104         * sparc.cc (Target_sparc::Scan::global): Likewise.
1105         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1106
1107 2012-04-16  Cary Coutant  <ccoutant@google.com>
1108
1109         * archive.cc (Library_base::should_include_member): Check for
1110         --export-dynamic-symbol.
1111         * options.h (class General_options): Add --export-dynamic-symbol.
1112         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1113         --export-dynamic-symbol.
1114         (Symbol_table::gc_mark_undef_symbols): Likewise.
1115         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1116
1117 2012-04-12  David S. Miller  <davem@davemloft.net>
1118
1119         * sparc.cc (Reloc::wdisp10): New relocation method.
1120         (Reloc::h34): Likewise.
1121         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1122         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1123         R_SPARC_WDISP10.
1124         (Target_sparc::Scan::local): Likewise.
1125         (Target_sparc::Scan::global): Likewise.
1126         (Target_sparc::Relocate::relocate): Likewise.
1127
1128 2012-04-09  Cary Coutant  <ccoutant@google.com>
1129
1130         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1131         low_pc == 0.
1132
1133 2012-04-06  Ian Lance Taylor  <iant@google.com>
1134
1135         * timer.cc: #include <unistd.h>.
1136
1137 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1138
1139         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1140         * config.in: Regenerate.
1141         * configure: Regenerate.
1142
1143 2012-04-05  Nick Clifton  <nickc@redhat.com>
1144
1145         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1146         (AM_LC_MESSAGES): Add.
1147         * aclocal.m4: Regenerate.
1148         * config.in: Regenerate.
1149         * configure: Regenerate.
1150
1151 2012-03-21  Cary Coutant  <ccoutant@google.com>
1152
1153         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1154         * Makefile.in: Regenerate.
1155         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1156         (Sized_elf_reloc_mapper::symbol_section): New function.
1157         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1158         (make_elf_reloc_mapper): New function.
1159         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1160         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1161         (Dwarf_abbrev_table::do_get_abbrev): New function.
1162         (Dwarf_ranges_table::read_ranges_table): New function.
1163         (Dwarf_ranges_table::read_range_list): New function.
1164         (Dwarf_pubnames_table::read_section): New function.
1165         (Dwarf_pubnames_table::read_header): New function.
1166         (Dwarf_pubnames_table::next_name): New function.
1167         (Dwarf_die::Dwarf_die): New function.
1168         (Dwarf_die::read_attributes): New function.
1169         (Dwarf_die::skip_attributes): New function.
1170         (Dwarf_die::set_name): New function.
1171         (Dwarf_die::set_linkage_name): New function.
1172         (Dwarf_die::attribute): New function.
1173         (Dwarf_die::string_attribute): New function.
1174         (Dwarf_die::int_attribute): New function.
1175         (Dwarf_die::uint_attribute): New function.
1176         (Dwarf_die::ref_attribute): New function.
1177         (Dwarf_die::child_offset): New function.
1178         (Dwarf_die::sibling_offset): New function.
1179         (Dwarf_info_reader::check_buffer): New function.
1180         (Dwarf_info_reader::parse): New function.
1181         (Dwarf_info_reader::do_parse): New function.
1182         (Dwarf_info_reader::do_read_string_table): New function.
1183         (Dwarf_info_reader::lookup_reloc): New function.
1184         (Dwarf_info_reader::get_string): New function.
1185         (Dwarf_info_reader::visit_compilation_unit): New function.
1186         (Dwarf_info_reader::visit_type_unit): New function.
1187         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1188         Sized_elf_reloc_mapper.
1189         (Sized_dwarf_line_info::symbol_section): Remove function.
1190         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1191         (Sized_dwarf_line_info::read_line_mappings): Remove object
1192         parameter, adjust callers.
1193         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1194         * dwarf_reader.h: Include <sys/types.h>.
1195         (class Track_relocs): Remove forward declaration.
1196         (class Elf_reloc_mapper): New class.
1197         (class Sized_elf_reloc_mapper): New class.
1198         (class Dwarf_abbrev_table): New class.
1199         (class Dwarf_range_list): New class.
1200         (class Dwarf_ranges_table): New class.
1201         (class Dwarf_pubnames_table): New class.
1202         (class Dwarf_die): New class.
1203         (class Dwarf_info_reader): New class.
1204         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1205         (Sized_dwarf_line_info::symbol_section): Remove member function.
1206         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1207         base class.
1208         * gdb-index.cc: New source file.
1209         * gdb-index.h: New source file.
1210         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1211         and .debug_types sections, call Layout::add_to_gdb_index.
1212         (Sized_relobj_incr::do_section_name): Implement.
1213         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1214         return type; Implement.
1215         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1216         return type.
1217         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1218         parameter list and return type.
1219         (Sized_incr_dynobj::do_section_contents): Likewise.
1220         * layout.cc: Include gdb-index.h.
1221         (Layout::Layout): Initialize gdb_index_data_.
1222         (Layout::init_fixed_output_section): Check for .gdb_index section.
1223         (Layout::add_to_gdb_index): New function. Instantiate.
1224         * layout.h: Add forward declaration for class Gdb_index.
1225         (Layout::add_to_gdb_index): New member function.
1226         (Layout::gdb_index_data_): New data member.
1227         * main.cc: Include gdb-index.h.
1228         (main): Print statistics for gdb index.
1229         * object.cc (Object::section_contents): Move code into
1230         do_section_contents.
1231         (need_decompressed_section): Check for sections needed when building
1232         gdb index.
1233         (build_compressed_section_map): Likewise.
1234         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1235         gdb index.
1236         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1237         sections; call Layout::add_to_gdb_index.
1238         (Sized_relobj_file::do_decompressed_section_contents): Call
1239         do_section_contents directly.
1240         * object.h (Object::do_section_contents): Adjust parameter list and
1241         return type.
1242         (Object::do_decompressed_section_contents): Call do_section_contents
1243         directly.
1244         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1245         return type.
1246         * options.h (class General_options): Add --gdb-index option.
1247         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1248         list and return type.
1249         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1250         * reloc.h (Track_relocs::checkpoint): New function.
1251         (Track_relocs::reset): New function.
1252
1253         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1254         New test cases.
1255         * testsuite/Makefile.in: Regenerate.
1256         * testsuite/gdb_index_test.cc: New test source file.
1257         * testsuite/gdb_index_test_1.sh: New test source file.
1258         * testsuite/gdb_index_test_2.sh: New test source file.
1259
1260 2012-03-19  Doug Kwan  <dougkwan@google.com>
1261
1262         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1263         (Target_arm::do_finalize_sections): Remove code which defines
1264         __exidx_start and __exidx_end.  Make symbol table parameter
1265         anonymous as it is not used.
1266         * gold.cc (queue_middle_tasks): Call target hook to define any
1267         target-specific symbols.
1268         * target.h (Target::define_standard_symbols): New method.
1269         (Target::do_define_standard_symbols): Same.
1270         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1271         * testsuite/Makefile.in: Regenerate.
1272         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1273         and __exidx_end.
1274         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1275         relocations are generated for __exidx_start and __exidx_end.
1276
1277 2012-03-16  Doug Kwan  <dougkwan@google.com>
1278
1279         * testsuite/Makefile.am: Disable test initpri3b.
1280         * testsuite/Makefile.in: Regenerate.
1281
1282 2012-03-15  Doug Kwan  <dougkwan@google.com>
1283
1284         * arm.cc (Target_arm::got_section): Make .got section read-only
1285         if -z now is given.
1286
1287 2012-03-15  Ian Lance Taylor  <iant@google.com>
1288
1289         PR gold/13850
1290         * layout.cc (Layout::make_output_section): Correctly mark
1291         SHT_INIT_ARRAY, et. al., as relro.
1292
1293 2012-03-14  Doug Kwan  <dougkwan@google.com>
1294
1295         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1296         dynamic relocations for protected symbols in shared objects.
1297
1298 2012-03-13  Ian Lance Taylor  <iant@google.com>
1299
1300         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1301         keep the larger alignment.
1302
1303 2012-03-12  Cary Coutant  <ccoutant@google.com>
1304
1305         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1306         handling of DW_LNE_define_file.
1307
1308 2012-03-12  Cary Coutant  <ccoutant@google.com>
1309
1310         * reduced_debug_output.cc
1311         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1312         codes to switch.
1313
1314 2012-02-29  Cary Coutant  <ccoutant@google.com>
1315
1316         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1317
1318 2012-02-29  Cary Coutant  <ccoutant@google.com>
1319
1320         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1321         Call Object::decompressed_section_contents.
1322         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1323         New dtor.
1324         (Sized_dwarf_line_info::buffer_start_): New data member.
1325         * merge.cc (Output_merge_data::do_add_input_section): Call
1326         Object::decompressed_section_contents.
1327         (Output_merge_string::do_add_input_section): Likewise.
1328         * object.cc (need_decompressed_section): New function.
1329         (build_compressed_section_map): Decompress sections needed later.
1330         (Sized_relobj_file::do_decompressed_section_contents): New function.
1331         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1332         * object.h (Object::decompressed_section_contents): New function.
1333         (Object::discard_decompressed_sections): New function.
1334         (Object::do_decompressed_section_contents): New function.
1335         (Object::do_discard_decompressed_sections): New function.
1336         (Compressed_section_info): New type.
1337         (Compressed_section_map): Include decompressed section contents.
1338         (Sized_relobj_file::do_decompressed_section_contents): New function.
1339         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1340
1341 2012-02-16  Cary Coutant  <ccoutant@google.com>
1342
1343         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1344         * testsuite/Makefile.in: Regenerate.
1345
1346 2012-02-14  Cary Coutant  <ccoutant@google.com>
1347
1348         * options.cc (General_options::finalize): Disallow -pie and -static.
1349
1350 2012-02-03  Doug Kwan  <dougkwan@google.com>
1351
1352         * arm.cc (Arm_relocate_functions::abs8,
1353         Arm_relocate_functions::abs16): Use
1354         Bits::has_signed_unsigned_overflow32.
1355         (Arm_relocate_functions::thm_abs8): Correct range of
1356         overflow check.
1357         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1358         in assertions.
1359
1360 2012-02-02  Doug Kwan  <dougkwan@google.com>
1361
1362         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1363         position independent outputs, not just shared objects.
1364
1365 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1366
1367         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1368         * configure: Regenerated.
1369
1370 2012-01-27  Ian Lance Taylor  <iant@google.com>
1371
1372         * reloc.h (Bits): New class with static functions, copied from
1373         namespace utils in arm.cc.
1374         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1375         instead.
1376
1377 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1378
1379         * incremental.cc (write_info_blocks): Correct relocation offset.
1380
1381 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1382
1383         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1384         (Relocate::tls_gd_to_le): Likewise.
1385
1386 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1387
1388         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1389
1390 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1391
1392         * configure.ac: Check if -mcmodel=medium works.
1393         * configure: Regenerated.
1394
1395 2012-01-24  Cary Coutant  <ccoutant@google.com>
1396
1397         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1398         definition and ...
1399         (read_unsigned_LEB_128_x): ... this new function.
1400         (read_signed_LEB_128): Replaced with inline definition and ...
1401         (read_signed_LEB_128_x): ... this new function.
1402         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1403         (read_unsigned_LEB_128): Add inline definition.
1404         (read_signed_LEB_128_x): New function.
1405         (read_signed_LEB_128): Add inline definition.
1406         * testsuite/Makefile.am (leb128_unittest): New unit test.
1407         * testsuite/Makefile.in: Regenerate.
1408         * testsuite/leb128_unittest.cc: New unit test.
1409
1410 2012-01-23  Ian Lance Taylor  <iant@google.com>
1411
1412         PR gold/13617
1413         * i386.cc (Target_i386::do_code_fill): When using a jmp
1414         instruction, pad with nop instructions.
1415         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1416
1417 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1418
1419         * x86_64.cc (gc_process_relocs): Add typename on types used in
1420         template.
1421         (scan_relocs): Likewise.
1422         (relocate_section): Likewise.
1423         (apply_relocation): Likewise.
1424
1425 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1426
1427         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1428         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1429         under x32.
1430
1431 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1432
1433         * x86_64.cc: Initial support for x32.
1434
1435 2012-01-03  Cary Coutant  <ccoutant@google.com>
1436
1437         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1438         Use abstract base class for GOT.
1439         * gold/output.h (class Output_data_got_base): New abstract base class.
1440         (class Output_data_got): Derive from new base class, adjust ctors.
1441         (Output_data_got::reserve_slot): Make virtual; rename to
1442         do_reserve_slot; Adjust callers.
1443         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1444         pointer to abstract base class.
1445         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1446
1447 2011-12-18  Ian Lance Taylor  <iant@google.com>
1448
1449         * object.h (Relobj::local_symbol_value): New function.
1450         (Relobj::local_plt_offset): New function.
1451         (Relobj::local_has_got_offset): New function.
1452         (Relobj::local_got_offset): New function.
1453         (Relobj::set_local_got_offset): New function.
1454         (Relobj::do_local_symbol_value): New pure virtual function.
1455         (Relobj::do_local_plt_offset): Likewise.
1456         (Relobj::do_local_has_got_offset): Likewise.
1457         (Relobj::do_local_got_offset): Likewise.
1458         (Relobj::do_set_local_got_offset): Likewise.
1459         (Sized_relobj::do_local_has_got_offset): Rename from
1460         local_has_got_offset.
1461         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1462         (Sized_relobj::do_set_local_got_offset): Rename from
1463         set_local_got_offset.
1464         (Sized_relobj_file::do_local_plt_offset): Rename from
1465         local_plt_offset.
1466         (Sized_relobj_file::do_local_symbol_value): New function.
1467         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1468         local_plt_offset.
1469         * output.cc (Output_data_got::Got_entry::write): Change object to
1470         Relobj.  Use local_symbol_value.
1471         (Output_data_got::add_global_with_rel): Change rel_dyn to
1472         Output_data_reloc_generic*.  Use add_global_generic.
1473         (Output_data_got::add_global_with_rela): Remove.  Change all
1474         callers to use add_global_with_rel.
1475         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1476         Output_data_reloc_generic*.  Use add_global_generic.
1477         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1478         callers to use add_global_pair_with_rel.
1479         (Output_data_got::add_local): Change object to Relobj*.
1480         (Output_data_got::add_local_plt): Likewise.
1481         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1482         change rel_dyn to Output_data_reloc_generic*.  Use
1483         add_local_generic.
1484         (Output_data_got::add_local_with_rela): Remove.  Change all
1485         callers to use all_local_with_rel.
1486         (Output_data_got::add_local_pair_with_rel): Change object to
1487         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1488         add_output_section_generic.
1489         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1490         callers to use add_local_pair_with_rel.
1491         (Output_data_got::reserve_local): Change object to Relobj*.
1492         * output.h: (class Output_data_reloc_generic): Add pure virtual
1493         declarations for add_global_generic, add_local_generic,
1494         add_output_section_generic.
1495         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1496         functions for Output_data_reloc_generic.  Update declarations for
1497         changes listed in output.cc.
1498         (class Output_data_got): Change template parameter to got_size.
1499         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1500         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1501         function.
1502         (Sized_relobj_incr::do_local_plt_offset): New function.
1503         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1504         add_global_generic.
1505
1506 2011-12-17  Cary Coutant  <ccoutant@google.com>
1507
1508         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1509         * resolve.cc (Symbol_table::resolve): Likewise.
1510         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1511         arrays.
1512         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1513
1514 2011-12-16  Ian Lance Taylor  <iant@google.com>
1515
1516         * output.h (Output_data_reloc_generic::add): Only call
1517         add_dynamic_reloc if this is a dynamic reloc section.
1518
1519 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1520
1521         PR gold/13505
1522         * target-reloc.h (apply_relocation): Replace <64, false> with
1523         <size, big_endian>.
1524
1525 2011-11-25  Nick Clifton  <nickc@redhat.com>
1526
1527         * po/it.po: New Italian translation.
1528
1529 2011-11-17  Sterling Augustine  <saugustine@google.com>
1530
1531         * script.cc (script_include_directive): Implement.
1532         (read_script_file): New local variables name and search_path. Update
1533         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1534         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1535         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1536
1537 2011-11-11  Sterling Augustine  <saugustine@google.com>
1538
1539         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1540         (file_or_sections_cmd): Likewise.
1541
1542 2011-11-11  Doug Kwan  <dougkwan@google.com>
1543
1544         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1545         if --just-symbols is given.
1546
1547 2011-11-10  Doug Kwan  <dougkwan@google.com>
1548
1549         PR gold/13362
1550         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1551         when processing data relocs.
1552         * reloc.h (Relocate_functions::rel_unaligned): New method.
1553         (Relocate_functions::pcrel_unaligned): Ditto.
1554         (Relocate_functions::rel32_unaligned): Ditto.
1555         (Relocate_functions::pcrel32_unaligned): Ditto.
1556
1557 2011-11-09  Doug Kwan  <dougkwan@google.com>
1558
1559         PR gold/13362
1560         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1561         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1562         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1563         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1564         (Relocate_functions::rel_unaligned): New.
1565         (Relocate_functions::rel32_unaligned): New.
1566         * target-reloc.h (relocate_for_relocatable): Add code to handle
1567         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1568         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1569         arm_unaligned_reloc_r): New targets.
1570         * testsuite/Makefile.in: Regenerate.
1571         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1572         linking.
1573
1574 2011-11-02  Ian Lance Taylor  <iant@google.com>
1575
1576         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1577         NATIVE_LINKER.
1578         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1579         * options.cc (General_options::finalize): Use library search path
1580         from configure script if specified.  If not native and no sysroot,
1581         only search TOOLLIBDIR.
1582         * options.h (Search_directory::Search_directory): Change name to
1583         const std::string&.
1584         (General_options::add_to_library_path_with_sysroot): Change arg to
1585         const std::string&.
1586         * configure, Makefile.in, config.in: Rebuild.
1587
1588 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1589
1590         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1591         we are working around the ARM1176 Erratum.
1592         * options.h (General_options::fix_arm1176): Add option.
1593         * testsuite/Makefile.am: Add testcases, and keep current ones
1594         working.
1595         * testsuite/Makefile.in: Regenerate.
1596         * testsuite/arm_fix_1176.s: New file.
1597         * testsuite/arm_fix_1176.sh: Likewise.
1598
1599 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1600
1601         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1602         may_use_blx_.
1603         (Target_arm::may_use_blx): Remove method.
1604         (Target_arm::set_may_use_blx): Likewise.
1605         (Target_arm::may_use_v4t_interworking): New method.
1606         (Target_arm::may_use_v5t_interworking): Likewise.
1607         (Target_arm::may_use_blx_): Remove member variable.
1608         (Arm_relocate_functions::arm_branch_common): Check for v5T
1609         interworking.
1610         (Arm_relocate_functions::thumb_branch_common): Likewise.
1611         (Reloc_stub::stub_type_for_reloc): Likewise.
1612         (Target_arm::do_finalize_sections): Correct interworking checks.
1613         * testsuite/Makefile.am: Add new tests.
1614         * testsuite/Makefile.in: Regenerate.
1615         * testsuite/arm_farcall_arm_arm.s: New test.
1616         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1617         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1618         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1619         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1620         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1621         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1622         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1623
1624 2011-10-31  Cary Coutant  <ccoutant@google.com>
1625
1626         PR gold/13023
1627         * expression.cc (Expression::eval_with_dot): Add
1628         is_section_dot_assignment parameter.
1629         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1630         absolute and assigning to dot within a section.
1631         * script-sections.cc
1632         (Output_section_element_assignment::set_section_addresses): Pass
1633         dot_section to set_if_absolute.
1634         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1635         as is_section_dot_assignment flag to eval_with_dot.
1636         (Output_section_element_dot_assignment::set_section_addresses):
1637         Likewise.
1638         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1639         parameter.  Also set value if relative to dot_section; set the
1640         symbol's output_section.
1641         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1642         parameter.  Adjust all callers.
1643         (Expression::eval_maybe_dot): Likewise.
1644         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1645         Adjust all callers.
1646         * testsuite/script_test_2.t: Test assignment of an absolute value
1647         to dot within an output section element.
1648
1649 2011-10-31  Cary Coutant  <ccoutant@google.com>
1650
1651         * options.h (class General_options): Add --[no-]gnu-unique options.
1652         * symtab.cc (Symbol_table::sized_write_globals): Convert
1653         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1654
1655 2011-10-31  Cary Coutant  <ccoutant@google.com>
1656
1657         PR gold/13359
1658         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1659         unnecessary assertion.
1660         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1661
1662 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1663
1664         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1665         gc_mark_symbol.
1666         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1667         gc_mark_symbol.
1668         Change to just keep the section associated with symbol.
1669         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1670         they are externally visible and --export-dynamic is turned on.
1671         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1672
1673 2011-10-19  Ian Lance Taylor  <iant@google.com>
1674
1675         PR gold/13163
1676         * script-sections.cc
1677         (Output_section_element_dot_assignment::needs_output_section): New
1678         function.
1679
1680 2011-10-19  Ian Lance Taylor  <iant@google.com>
1681
1682         PR gold/13204
1683         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1684         --section-start option was seen.
1685         * options.h (General_options::any_section_start): New function.
1686
1687 2011-10-18  David S. Miller  <davem@davemloft.net>
1688
1689         PR binutils/13301
1690         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1691         member to track relocation locations that have moved during TLS
1692         reloc optimizations.
1693         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1694         (Target_sparc::Relocate::relocate): Adjust view down by 4
1695         bytes if it matches reloc_adjust_addr_.
1696         (Target_sparc::Relocate::relocate_tls): Always move the
1697         __tls_get_addr call delay slot instruction forward 4 bytes when
1698         performing relaxation.
1699
1700 2011-10-18  Cary Coutant  <ccoutant@google.com>
1701
1702         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1703         (Output_file::map_no_anonymous): Check for non-zero
1704         return code from posix_fallocate.
1705
1706 2011-10-17  Cary Coutant  <ccoutant@google.com>
1707
1708         PR gold/13245
1709         * plugin.cc (is_visible_from_outside): Check for symbols
1710         referenced from dynamic objects.
1711         * resolve.cc (Symbol_table::resolve): Don't count references
1712         from dynamic objects as references from real ELF files.
1713         * testsuite/plugin_test_2.sh: Adjust expected result.
1714
1715 2011-10-17  Cary Coutant  <ccoutant@google.com>
1716
1717         * gold.cc: Include timer.h.
1718         (queue_middle_tasks): Stamp time.
1719         (queue_final_tasks): Likewise.
1720         * main.cc (main): Store timer in parameters.  Print timers
1721         for each pass.
1722         * parameters.cc (Parameters::Parameters): Initialize timer_.
1723         (Parameters::set_timer): New function.
1724         (set_parameters_timer): New function.
1725         * parameters.h (Parameters::set_timer): New function.
1726         (Parameters::timer): New function.
1727         (Parameters::timer_): New data member.
1728         (set_parameters_timer): New function.
1729         * timer.cc (Timer::stamp): New function.
1730         (Timer::get_pass_time): New function.
1731         * timer.h (Timer::stamp): New function.
1732         (Timer::get_pass_time): New function.
1733         (Timer::pass_times_): New data member.
1734
1735 2011-10-17  Cary Coutant  <ccoutant@google.com>
1736
1737         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1738         task for members of lib groups.
1739
1740 2011-10-17  Cary Coutant  <ccoutant@google.com>
1741
1742         PR gold/13288
1743         * fileread.cc (File_read::find_view): Add assert.
1744         (File_read::make_view): Move bounds check (replace with assert)...
1745         (File_read::find_or_make_view): ... to here.
1746
1747 2011-10-12  Cary Coutant  <ccoutant@google.com>
1748
1749         * output.cc (Output_file::open_base_file): Handle case where
1750         ::read returns less than requested size.
1751
1752 2011-10-10  Cary Coutant  <ccoutant@google.com>
1753
1754         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1755         Initialize defined_count_.
1756         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1757         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1758         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1759         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1760         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1761         * incremental.h (Sized_relobj_incr::defined_count_): New data
1762         member.
1763         (Sized_incr_dynobj::defined_count_): New data member.
1764         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1765         Return zeroes instead of internal error.
1766
1767 2011-10-10  Cary Coutant  <ccoutant@google.com>
1768
1769         PR gold/13249
1770         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1771         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1772         * output.h (class Output_reloc): Add use_plt_offset flag.
1773         (Output_reloc::type_): Adjust size of bit field.
1774         (Output_reloc::use_plt_offset_): New bit field.
1775         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1776         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1777         flag.  Adjust all callers.
1778         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1779         creating RELATIVE relocations.
1780
1781 2011-10-10  Nick Clifton  <nickc@redhat.com>
1782
1783         * po/es.po: Updated Spanish translation.
1784         * po/fi.po: Updated Finnish translation.
1785
1786 2011-10-03   Diego Novillo  <dnovillo@google.com>
1787
1788         * options.cc (parse_uint): Fix dereference of RETVAL.
1789
1790 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1791
1792         * layout.h (section_order_map_): New member.
1793         (get_section_order_map): New member function.
1794         * output.cc (Output_section::add_input_section): Check for patterns
1795         only when --section-ordering-file is specified.
1796         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1797         output_sections have been formed.
1798         * layout.cc (Layout_Layout): Initialize section_order_map_.
1799         * plugin.cc (update_section_order): Store order in order_map. Do not
1800         update the order.
1801         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1802         * testsuite/Makefile.in: Regenerate.
1803         * testsuite/plugin_section_order.c: New file.
1804         * testsuite/plugin_final_layout.cc: New file.
1805         * testsuite/plugin_final_layout.sh: New file.
1806
1807 2011-09-29  Cary Coutant  <ccoutant@google.com>
1808
1809         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1810         Check for NULL.
1811         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1812         symbols during incremental update.
1813         (Symbol_table::add_from_dynobj): Likewise.
1814
1815 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1816             Ian Lance Taylor  <iant@google.com>
1817
1818         * symtab.cc (Symbol_table::define_special_symbol): Always
1819         canonicalize version string.
1820
1821 2011-09-26  Cary Coutant  <ccoutant@google.com>
1822
1823         * gold.cc (queue_initial_tasks): Move option checks ...
1824         * options.cc (General_options::finalize): ... to here. Disable
1825         some options; make others fatal.
1826
1827 2011-09-26  Cary Coutant  <ccoutant@google.com>
1828
1829         gcc PR lto/47247
1830         * plugin.cc (get_symbols_v2): New function.
1831         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1832         (is_referenced_from_outside): New function.
1833         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1834         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1835         (get_symbols): Pass version parameter.
1836         (get_symbols_v2): New function.
1837         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1838         parameter.
1839         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1840         (onload): Add LDPT_GET_SYMBOLS_V2.
1841         (all_symbols_read_hook): Use get_symbols_v2; check for
1842         LDPR_PREVAILING_DEF_IRONLY_EXP.
1843         * testsuite/plugin_test_3.sh: Update expected results.
1844
1845 2011-09-23  Simon Baldwin  <simonb@google.com>
1846
1847         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1848         configuration options.
1849         * configure: Regenerate.
1850         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1851         * Makefile.in: Regenerate.
1852         * testsuite/Makefile.in: Regenerate.
1853
1854 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1855
1856         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1857
1858 2011-09-19  Cary Coutant  <ccoutant@google.com>
1859
1860         * incremental.cc (can_incremental_update): Fix typo in comment.
1861         * incremental.h (can_incremental_update): Likewise.
1862
1863 2011-09-18  Cary Coutant  <ccoutant@google.com>
1864
1865         * incremental.cc (can_incremental_update): New function.
1866         * incremental.h (can_incremental_update): New function.
1867         * layout.cc (Layout::init_fixed_output_section): Call it.
1868         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1869         * object.cc (Sized_relobj_file::do_layout): Call
1870         can_incremental_update.
1871
1872 2011-09-13  Cary Coutant  <ccoutant@google.com>
1873
1874         * configure.ac: Check for glibc support for gnu_indirect_function
1875         support with static linking, setting automake conditional
1876         IFUNC_STATIC.
1877         * Makefile.in: Regenerate.
1878         * configure: Regenerate.
1879
1880         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1881         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1882         for IFUNC_STATIC.
1883         * testsuite/Makefile.in: Regenerate.
1884
1885 2011-09-13  Cary Coutant  <ccoutant@google.com>
1886
1887         * incremental.cc (Sized_relobj_incr::do_layout): Call
1888         report_comdat_group for kept comdat sections.
1889         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1890         * testsuite/Makefile.in: Regenerate.
1891         * testsuite/incr_comdat_test_1.cc: New source file.
1892         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1893         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1894         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1895
1896 2011-09-13  Ian Lance Taylor  <iant@google.com>
1897
1898         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1899         variable external_symbols_offset.
1900
1901 2011-09-12  Ian Lance Taylor  <iant@google.com>
1902
1903         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1904         triggered if object has no symbols.
1905
1906 2011-09-09  David S. Miller  <davem@davemloft.net>
1907
1908         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1909         (Output_fill_debug_line::do_write): Likewise.
1910
1911 2011-08-29  Cary Coutant  <ccoutant@google.com>
1912
1913         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1914         casts to match formatting specs.
1915         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1916
1917 2011-08-26  Cary Coutant  <ccoutant@google.com>
1918
1919         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1920         remaining hole size when allocating.
1921         (Layout::make_output_section): Set fill methods for debug sections.
1922         * layout.h (Free_list::Free_list_node): Move from private to
1923         public.
1924         (Free_list::set_min_hole_size): New function.
1925         (Free_list::begin, Free_list::end): New functions.
1926         (Free_list::min_hole_): New data member.
1927         * output.cc: Include dwarf.h.
1928         (Output_fill_debug_info::do_minimum_hole_size): New function.
1929         (Output_fill_debug_info::do_write): New function.
1930         (Output_fill_debug_line::do_minimum_hole_size): New function.
1931         (Output_fill_debug_line::do_write): New function.
1932         (Output_section::Output_section): Initialize new data member.
1933         (Output_section::set_final_data_size): Ensure patch space is larger
1934         than minimum hole size.
1935         (Output_section::do_write): Fill holes in debug sections.
1936         * output.h (Output_fill): New class.
1937         (Output_fill_debug_info): New class.
1938         (Output_fill_debug_line): New class.
1939         (Output_section::set_free_space_fill): New function.
1940         (Output_section::free_space_fill_): New data member.
1941         * testsuite/Makefile.am (incremental_test_3): Add
1942         --incremental-patch option.
1943         (incremental_test_4): Likewise.
1944         (incremental_test_5): Likewise.
1945         (incremental_test_6): Likewise.
1946         (incremental_copy_test): Likewise.
1947         (incremental_common_test_1): Likewise.
1948         * testsuite/Makefile.in: Regenerate.
1949
1950 2011-08-26  Nick Clifton  <nickc@redhat.com>
1951
1952         * po/es.po: Updated Spanish translation.
1953
1954 2011-08-01  Cary Coutant  <ccoutant@google.com>
1955
1956         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1957         * gold/testsuite/Makefile.in: Regenerate.
1958         * gold/testsuite/justsyms_exec.c: New source file.
1959         * gold/testsuite/justsyms_lib.c: New source file.
1960
1961 2011-08-01  Cary Coutant  <ccoutant@google.com>
1962
1963         * layout.cc (Layout::set_segment_offsets): Don't realign text
1964         segment if -Ttext was specified.
1965         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1966         file type.
1967         * object.h (Sized_relobj_file::e_type): New function.
1968         (Sized_relobj_file::e_type_): New data member.
1969         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1970         base address for ET_EXEC files.
1971         * target.cc (Target::do_make_elf_object_implementation): Allow
1972         ET_EXEC files with --just-symbols option.
1973
1974 2011-07-28  Cary Coutant  <ccoutant@google.com>
1975
1976         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1977         Add thread_number parameter.
1978         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1979         * workqueue-threads.cc
1980         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1981         current thread if its thread number is greater than desired thread
1982         count.
1983         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1984         Add thread_number parameter.
1985         (Workqueue::should_cancel_thread): Likewise.
1986         (Workqueue::find_runnable_or_wait): Pass thread_number to
1987         should_cancel_thread.
1988         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1989         parameter.
1990
1991 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1992
1993         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1994         only after checking if it cannot be forced local.
1995         * symtab.h (is_externally_visible): Check if the symbol is not forced
1996         local.
1997
1998 2011-07-15  Ian Lance Taylor  <iant@google.com>
1999
2000         * options.h (class General_options): Add --print-output-format.
2001         Move -EL next to -EB, for  better --help output.
2002         * target-select.cc: Include <cstdio>, "options.h", and
2003         "parameters.h".
2004         (Target_selector::do_target_bfd_name): New function.
2005         (print_output_format): New function.
2006         * target-select.h (class Target_selector): Update declarations.
2007         (Target_selector::target_bfd_name): New function.
2008         (print_output_format): Declare.
2009         * main.cc: Include "target-select.h".
2010         (main): Handle --print-output-format.
2011         * gold.cc: Include "target-select.h".
2012         (queue_initial_tasks): Handle --print-output-format when there are
2013         no input files.
2014         * parameters.cc (parameters_force_valid_target): Give a better
2015         error message if -EB/-EL does not match target.
2016         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2017         function.
2018
2019 2011-07-15  Ian Lance Taylor  <iant@google.com>
2020
2021         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2022         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2023         (Output_data_plt_i386::do_write): Write address of .dynamic
2024         section to first entry in .got.plt section.
2025         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2026         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2027         Initialize layout_.
2028         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2029         section to first entry in .got.plt section.
2030         * layout.h (Layout::dynamic_section): New function.
2031
2032 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2033
2034         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2035         to claim_file call.
2036         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2037         input_section_position_, and input_section_glob_.
2038         (read_layout_from_file): Call function section_ordering_specified.
2039         * layout.h (is_section_ordering_specified): New function.
2040         (section_ordering_specified): New function.
2041         (section_ordering_specified_): New boolean member.
2042         * main.cc(main): Call load_plugins after layout object is defined.
2043         * output.cc (Output_section::add_input_section): Use
2044         function section_ordering_specified to check if section ordering is
2045         needed.
2046         * output.cc (Output_section::add_relaxed_input_section): Use
2047         function section_ordering_specified to check if section ordering is
2048         needed.
2049         (Output_section::update_section_layout): New function.
2050         (Output_section::sort_attached_input_sections): Check if input section
2051         must be reordered.
2052         * output.h (Output_section::update_section_layout): New function.
2053         * plugin.cc (get_section_count): New function.
2054         (get_section_type): New function.
2055         (get_section_name): New function.
2056         (get_section_contents): New function.
2057         (update_section_order): New function.
2058         (allow_section_ordering): New function.
2059         (Plugin::load): Add the new interfaces to the transfer vector.
2060         (Plugin_manager::load_plugins): New parameter.
2061         (Plugin_manager::all_symbols_read): New parameter.
2062         (Plugin_manager::claim_file): New parameter. Save the elf object for
2063         unclaimed objects.
2064         (Plugin_manager::get_elf_object): New function.
2065         (Plugin_manager::get_view): Change to directly use the bool to check
2066         if get_view is called from claim_file_hook.
2067         * plugin.h (input_objects): New function
2068         (Plugin__manager::load_plugins): New parameter.
2069         (Plugin_manager::claim_file): New parameter.
2070         (Plugin_manager::get_elf_object): New function.
2071         (Plugin_manager::in_claim_file_handler): New function.
2072         (Plugin_manager::in_claim_file_handler_): New member.
2073         (layout): New function.
2074         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2075         handler with an extra parameter. Make the elf object before calling
2076         claim_file handler.
2077         * testsuite/plugin_test.c (get_section_count): New function pointer.
2078         (get_section_type): New function pointer.
2079         (get_section_name): New function pointer.
2080         (get_section_contents): New function pointer.
2081         (update_section_order): New function pointer.
2082         (allow_section_ordering): New function pointer.
2083         (onload): Check if the new interfaces exist.
2084
2085 2011-07-13  Ian Lance Taylor  <iant@google.com>
2086
2087         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2088         relro section.
2089         * x86_64.cc (Target_x86_64::got_section): Likewise.
2090         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2091         (relro_now_test_SOURCES): New variable.
2092         (relro_now_test_DEPENDENCIES): New variable.
2093         (relro_now_test_LDFLAGS): New variable.
2094         (relro_now_test_LDADD): New variable.
2095         (relro_now_test.so): New target.
2096         * testsuite/Makefile.in: Rebuild.
2097
2098 2011-07-12  Ian Lance Taylor  <iant@google.com>
2099
2100         PR gold/12980
2101         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2102         GLOB_DAT relocation rather than a RELATIVE relocation for a
2103         protected symbol when creating a shared library.
2104         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2105         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2106         * testsuite/protected_main_1.cc (main): Test that protected
2107         function has same address.
2108
2109 2011-07-11  Ian Lance Taylor  <iant@google.com>
2110
2111         PR gold/12979
2112         * options.h (class General_options): Add -Bgroup.
2113         * options.cc (General_options::finalize): If -Bgroup is set,
2114         default to --unresolved-symbols=report-all.
2115         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2116         * target-reloc.h (issue_undefined_symbol_error): Handle
2117         --unresolved-symbols=report-all.
2118
2119 2011-07-08  Ian Lance Taylor  <iant@google.com>
2120
2121         PR gold/11985
2122         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2123         if linker script discards key sections.
2124         (Layout::create_dynamic_symtab): Likewise.
2125         (Layout::assign_local_dynsym_offsets): Likewise.
2126         (Layout::sized_create_version_sections): Likewise.
2127         (Layout::create_interp): Likewise.
2128         (Layout::finish_dynamic_section): Likewise.
2129         (Layout::set_dynamic_symbol_size): Likewise.
2130
2131 2011-07-08  Ian Lance Taylor  <iant@google.com>
2132
2133         PR gold/12386
2134         * options.h (class General_options): Add --unresolved-symbols.
2135         * target-reloc.h (issue_undefined_symbol_error): Check
2136         --unresolved-symbols.  Add comments.
2137
2138 2011-07-08  Ian Lance Taylor  <iant@google.com>
2139
2140         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2141         expression more complex.
2142
2143 2011-07-08  Ian Lance Taylor  <iant@google.com>
2144
2145         PR gold/11317
2146         * target-reloc.h (issue_undefined_symbol_error): New inline
2147         function, broken out of relocate_section.
2148         (relocate_section): Call issue_undefined_symbol_error.
2149         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2150         there is no TLS segment if we are about to issue an undefined
2151         symbol error.
2152         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2153
2154 2011-07-08  Ian Lance Taylor  <iant@google.com>
2155
2156         PR gold/12279
2157         * resolve.cc (Symbol_table::should_override): Add fromtype
2158         parameter.  Change all callers.  Give error when linking together
2159         TLS and non-TLS symbol.
2160         (Symbol_table::should_override_with_special): Add fromtype
2161         parameter.  Change all callers.
2162         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2163         there is no TLS segment if we have reported some errors.
2164         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2165
2166 2011-07-08  Ian Lance Taylor  <iant@google.com>
2167
2168         PR gold/12372
2169         * target.h (Target::plt_address_for_global): New function.
2170         (Target::plt_address_for_local): New function.
2171         (Target::plt_section_for_global): Remove.
2172         (Target::plt_section_for_local): Remove.
2173         (Target::do_plt_address_for_global): New virtual function.
2174         (Target::do_plt_address_for_local): New virtual function.
2175         (Target::do_plt_section_for_global): Remove.
2176         (Target::do_plt_section_for_local): Remove.
2177         (Target::register_global_plt_entry): Add Symbol_table and Layout
2178         parameters.
2179         * output.cc (Output_data_got::Got_entry::write): Use
2180         plt_address_for_global and plt_address_for_local.
2181         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2182         address of output section.
2183         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2184         got_irelative_, and irelative_count_ fields.  Update
2185         declarations.
2186         (Output_data_plt_i386::has_irelative_section): New function.
2187         (Output_data_plt_i386::entry_count): Add irelative_count_.
2188         (Output_data_plt_i386::set_final_data_size): Likewise.
2189         (class Target_i386): Add got_irelative_ and rel_irelative_
2190         fields.  Update declarations.
2191         (Target_i386::Target_i386): Initialize new fields.
2192         (Target_i386::do_plt_address_for_global): New function replacing
2193         do_plt_section_for_global.
2194         (Target_i386::do_plt_address_for_local): New function replacing
2195         do_plt_section_for_local.
2196         (Target_i386::got_section): Create got_irelative_.
2197         (Target_i386::rel_irelative_section): New function.
2198         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2199         fields.  Don't define __rel_iplt_{start,end}.
2200         (Output_data_plt_i386::add_entry): Add symtab and layout
2201         parameters.  Change all callers.  Use different PLT and GOT for
2202         IFUNC symbols.
2203         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2204         layout parameters.  Change all callers.  Use different PLT and
2205         GOT.
2206         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2207         (Output_data_plt_i386::rel_irelative): New function.
2208         (Output_data_plt_i386::address_for_global): New function.
2209         (Output_data_plt_i386::address_for_local): New function.
2210         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2211         IRELATIVE GOT when changing IFUNC GOT entries.
2212         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2213         reloc.
2214         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2215         if we didn't create an IRELATIVE GOT.
2216         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2217         plt_address_for_local.
2218         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2219         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2220         got_irelative_, and irelative_count_ fields.  Update
2221         declarations.
2222         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2223         Initialize new fields.  Remove symtab parameter.  Change all
2224         callers.
2225         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2226         irelative_count_.
2227         (Output_data_plt_x86_64::has_irelative_section): New function.
2228         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2229         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2230         fields.  Update declarations.
2231         (Target_x86_64::Target_x86_64): Initialize new fields.
2232         (Target_x86_64::do_plt_address_for_global): New function replacing
2233         do_plt_section_for_global.
2234         (Target_x86_64::do_plt_address_for_local): New function replacing
2235         do_plt_section_for_local.
2236         (Target_x86_64::got_section): Create got_irelative_.
2237         (Target_x86_64::rela_irelative_section): New function.
2238         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2239         all callers.  Don't create __rel_iplt_{start,end}.
2240         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2241         parameters.  Change all callers.  Use different PLT and GOT for
2242         IFUNC symbols.
2243         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2244         layout parameters.  Change all callers.  Use different PLT and
2245         GOT.
2246         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2247         parameters.  Change all callers.  Use different PLT and GOT for
2248         IFUNC symbols.
2249         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2250         (Output_data_plt_x86_64::rela_irelative): New function.
2251         (Output_data_plt_x86_64::address_for_global): New function.
2252         (Output_data_plt_x86_64::address_for_local): New function.
2253         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2254         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2255         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2256         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2257         parameters.
2258         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2259         reloc.
2260         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2261         symbols if we didn't create an IRELATIVE GOT.
2262         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2263         plt_address_for_local.
2264         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2265         * testsuite/ifuncvar1.c: New test file.
2266         * testsuite/ifuncvar2.c: New test file.
2267         * testsuite/ifuncvar3.c: New test file.
2268         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2269         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2270         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2271         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2272         * testsuite/Makefile.in: Rebuild.
2273
2274 2011-07-07  Cary Coutant  <ccoutant@google.com>
2275
2276         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2277         (two_file_test_1_ndebug.o): Likewise.
2278         (two_file_test_1b_ndebug.o): Likewise.
2279         (two_file_test_2_ndebug.o): Likewise.
2280         (two_file_test_main_ndebug.o): Likewise.
2281         (incremental_test_2): Link with no-debug versions.
2282
2283 2011-07-06  Cary Coutant  <ccoutant@google.com>
2284
2285         * gold/incremental.cc
2286         (Output_section_incremental_inputs::write_info_blocks): Check for
2287         hidden and internal symbols.
2288
2289 2011-07-06  Cary Coutant  <ccoutant@google.com>
2290
2291         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2292         Check disposition for startup file.
2293         (Incremental_inputs::report_command_line): Ignore
2294         --incremental-startup-unchanged option.
2295         * options.cc (General_options::parse_incremental_startup_unchanged):
2296         New function.
2297         (General_options::General_options): Initialize new data member.
2298         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2299         (General_options): Add --incremental-startup-unchanged option.
2300         (General_options::incremental_startup_disposition): New function.
2301         (General_options::incremental_startup_disposition_): New data member.
2302
2303 2011-07-06  Cary Coutant  <ccoutant@google.com>
2304
2305         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2306         input file index to Script_info ctor.
2307         (Sized_incremental_binary::do_file_has_changed): Find the
2308         command-line argument for files named in scripts.
2309         * incremental.h (Script_info::Script_info): New ctor
2310         with input file index.
2311         (Script_info::input_file_index): New function.
2312         (Script_info::input_file_index_): New data member.
2313         (Incremental_binary::get_library): Add const.
2314         (Incremental_binary::get_script_info): Add const.
2315         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2316         * testsuite/Makefile.am (incremental_test_5): New test case.
2317         (incremental_test_6): New test case.
2318         * testsuite/Makefile.in: Regenerate.
2319
2320 2011-07-06  Cary Coutant  <ccoutant@google.com>
2321
2322         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2323         debug output when command lines differ.
2324
2325 2011-07-06  Cary Coutant  <ccoutant@google.com>
2326
2327         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2328         --incremental-patch option.
2329         * layout.cc (Free_list::allocate): Extend allocation beyond original
2330         end if enabled.
2331         (Layout::make_output_section): Mark sections that should get
2332         patch space.
2333         * options.cc (parse_percent): New function.
2334         * options.h (parse_percent): New function.
2335         (DEFINE_percent): New macro.
2336         (General_options): Add --incremental-patch option.
2337         * output.cc (Output_section::Output_section): Initialize new data
2338         members.
2339         (Output_section::add_input_section): Print section name when out
2340         of patch space.
2341         (Output_section::add_output_section_data): Likewise.
2342         (Output_section::set_final_data_size): Add patch space when
2343         doing --incremental-full.
2344         (Output_section::do_reset_address_and_file_offset): Remove patch
2345         space.
2346         (Output_segment::set_section_list_addresses): Print debug output
2347         only if --incremental-update.
2348         * output.h (Output_section::set_is_patch_space_allowed): New function.
2349         (Output_section::is_patch_space_allowed_): New data member.
2350         (Output_section::patch_space_): New data member.
2351         * parameters.cc (Parameters::incremental_full): New function.
2352         * parameters.h (Parameters::incremental_full): New function
2353         * testsuite/Makefile.am (incremental_test_2): Add test for
2354         --incremental-patch option.
2355         * testsuite/Makefile.in: Regenerate.
2356         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2357         (t18): Remove function body.
2358
2359 2011-07-05  Doug Kwan  <dougkwan@google.com>
2360
2361         PR gold/12771
2362         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2363         Arm_Address type for relocation result.
2364         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2365         overflow check.
2366         (Arm_relocate_functions::abs32): Use unaligned access.
2367         (Arm_relocate_functions::rel32): Ditto.
2368         (Arm_relocate_functions::prel31): Ditto.
2369         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2370         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2371         static data relocations.
2372         * testsuite/Makefile.in: Regnerate.
2373         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2374
2375 2011-07-05  Ian Lance Taylor  <iant@google.com>
2376
2377         PR gold/12392
2378         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2379         symbols if necessary.
2380         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2381
2382 2011-07-05  Ian Lance Taylor  <iant@google.com>
2383
2384         PR gold/12952
2385         * resolve.cc (Symbol::override_base_with_special): Simply override
2386         version with special symbol version, ignoring previous version.
2387
2388 2011-07-05  Ian Lance Taylor  <iant@google.com>
2389
2390         * object.cc (Sized_relobj_file::include_section_group): Add
2391         information to comment about signature location.
2392
2393 2011-07-02  Ian Lance Taylor  <iant@google.com>
2394
2395         PR gold/12957
2396         * options.h (class General_options): Add -f and -F.
2397         * options.cc (General_options::finalize): Fatal error if -f/-F
2398         are used without -shared.
2399         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2400
2401 2011-07-02  Ian Lance Taylor  <iant@google.com>
2402
2403         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2404
2405 2011-07-01  Ian Lance Taylor  <iant@google.com>
2406
2407         PR gold/12525
2408         PR gold/12952
2409         * resolve.cc (Symbol::override_base_with_special): Don't override
2410         the version if the overriding symbol has a different name.
2411         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2412         all callers.  If we give an error about an undefined version,
2413         define the base version if necessary.
2414         * dynobj.h (class Versions): Update declaration.
2415         * testsuite/weak_alias_test_5.cc: New file.
2416         * testsuite/weak_alias_test.script: New file.
2417         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2418         and versioned_alias have the right value, and call t2.
2419         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2420         weak_alias_test_5.so.
2421         (weak_alias_test_LDADD): Likewise.
2422         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2423         * testsuite/Makefile.in: Rebuild.
2424
2425 2011-07-01  Ian Lance Taylor  <iant@google.com>
2426
2427         PR gold/12525
2428         * options.h (class General_options): Support -z notext.
2429         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2430         -Wl,-z,notext.
2431         (two_file_shared_nonpic.so): Likewise.
2432         (two_file_shared_mixed.so): Likewise.
2433         (two_file_shared_mixed_1.so): Likewise.
2434         (weak_undef_lib_nonpic.so): Likewise.
2435         (alt/weak_undef_lib_nonpic.so): Likewise.
2436         (tls_test_shared_nonpic.so): Likewise.
2437         * testsuite/Makefile.in: Rebuild.
2438
2439 2011-07-01  Ian Lance Taylor  <iant@google.com>
2440
2441         PR gold/12525
2442         * configure.ac: Test whether static linking works, setting
2443         the automake conditional HAVE_STATIC.
2444         * testsuite/Makefile.am: Disable tests using -static if
2445         HAVE_STATIC is not true.
2446         * configure, testsuite/Makefile.in: Rebuild.
2447
2448 2011-07-01  Ian Lance Taylor  <iant@google.com>
2449
2450         PR gold/12525
2451         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2452         Assert if we see DW_EH_PE_indirect.
2453         * target.h (Target::ehframe_datarel_base): New function.
2454         (Target::do_ehframe_datarel_base): New target function.
2455         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2456         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2457         function.
2458
2459 2011-07-01  Ian Lance Taylor  <iant@google.com>
2460
2461         PR gold/12571
2462         * options.h (class General_options): Add
2463         --ld-generated-unwind-info.
2464         * ehframe.cc (Fde::write): Add address parameter.  Change all
2465         callers.  If associated with PLT, fill in address and size.
2466         (Cie::set_output_offset): Only add merge mapping if there is an
2467         object.
2468         (Cie::write): Add address parameter.  Change all callers.
2469         (Eh_frame::add_ehframe_for_plt): New function.
2470         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2471         input_offset_ fields into union u_, with new plt field.
2472         (Fde::Fde): Adjust for new union field.
2473         (Fde::Fde) [Output_data version]: New constructor.
2474         (Fde::add_mapping): Only add merge mapping if there is an object.
2475         (class Cie): Update declarations.
2476         (class Eh_frame): Declare add_ehframe_for_plt.
2477         * layout.cc (Layout::layout_eh_frame): Break out code into
2478         make_eh_frame_section, and call it.
2479         (Layout::make_eh_frame_section): New function.
2480         (Layout::add_eh_frame_for_plt): New function.
2481         * layout.h (class Layout): Update declarations.
2482         * merge.cc (Merge_map::add_mapping): Add assertion.
2483         * i386.cc: Include "dwarf.h".
2484         (class Output_data_plt_i386): Make first_plt_entry,
2485         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2486         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2487         and plt_eh_frame_fde.
2488         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2489         boundary.  Call add_eh_frame_for_plt if appropriate.
2490         * x86_64.cc: Include "dwarf.h".
2491         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2492         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2493         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2494         and plt_eh_frame_fde.
2495         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2496         appropriate.
2497
2498 2011-06-29  Ian Lance Taylor  <iant@google.com>
2499
2500         PR gold/12629
2501         * object.cc (Sized_relobj_file::layout_section): Change shdr
2502         parameter to be const.
2503         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2504         out of do_layout.
2505         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2506         appropriate.  Call layout_eh_frame_section.
2507         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2508         sections.
2509         * object.h (class Sized_relobj_file): Update declarations.
2510
2511 2011-06-29  Ian Lance Taylor  <iant@google.com>
2512
2513         PR gold/12652
2514         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2515         modifier.
2516         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2517
2518 2011-06-29  Ian Lance Taylor  <iant@google.com>
2519
2520         PR gold/12675
2521         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2522         SHT_X86_64_UNWIND.
2523         * layout.cc (Layout::layout_eh_frame): Likewise.
2524
2525 2011-06-29  Ian Lance Taylor  <iant@google.com>
2526
2527         PR gold/12695
2528         * layout.cc (Layout::symtab_section_shndx): New function.
2529         * layout.h (class Layout): Declare symtab_section_shndx.
2530         * output.cc (Output_section::write_header): Call it.
2531
2532 2011-06-29  Ian Lance Taylor  <iant@google.com>
2533
2534         PR gold/12818
2535         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2536         symbols which are not used in a relocation.
2537
2538 2011-06-28  Ian Lance Taylor  <iant@google.com>
2539
2540         PR gold/12898
2541         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2542         script create indistinguishable segments.
2543         (Layout::set_segment_offsets): Use stable_sort when sorting
2544         segments.  Pass this to Compare_segments constructor.
2545         * layout.h (class Layout): Make segment_precedes non-static.
2546         (class Compare_segments): Change from struct to class.  Add
2547         layout_ field.  Add constructor.
2548         * script-sections.cc
2549         (Script_sections::attach_sections_using_phdrs_clause): Rename
2550         local orphan to is_orphan.  Don't report failure to put empty
2551         section in segment.  On attachment failure, report name of
2552         section, and attach to first PT_LOAD segment.
2553
2554 2011-06-28  Ian Lance Taylor  <iant@google.com>
2555
2556         PR gold/12934
2557         * target-select.cc (Target_selector::Target_selector): Add
2558         emulation parameter.  Change all callers.
2559         (select_target_by_bfd_name): Rename from select_target_by_name.
2560         Change all callers.
2561         (select_target_by_emulation): New function.
2562         (supported_emulation_names): New function.
2563         * target-select.h (class Target_selector): Add emulation_ field.
2564         Update declarations.
2565         (Target_selector::recognize_by_bfd_name): Rename from
2566         recognize_by_name.  Change all callers.
2567         (Target_selector::supported_bfd_names): Rename from
2568         supported_names.  Change all callers.
2569         (Target_selector::recognize_by_emulation): New function.
2570         (Target_selector::supported_emulations): New function.
2571         (Target_selector::emulation): New function.
2572         (Target_selector::do_recognize_by_bfd_name): Rename from
2573         do_recognize_by_name.  Change all callers.
2574         (Target_selector::do_supported_bfd_names): Rename from
2575         do_supported_names.  Change all callers.
2576         (Target_selector::do_recognize_by_emulation): New function.
2577         (Target_selector::do_supported_emulations): New function.
2578         (select_target_by_bfd_name): Change name in declaration.
2579         (select_target_by_emulation): Declare.
2580         (supported_emulation_names): Declare.
2581         * parameters.cc (parameters_force_valid_target): Try to find
2582         target based on emulation from -m option.
2583         * options.h (class General_options): Change doc string for -m.
2584         * options.cc (help): Print emulations.
2585         (General_options::parse_V): Likewise.
2586         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2587         Add emulation parameter.  Change all callers.
2588
2589 2011-06-28  Ian Lance Taylor  <iant@google.com>
2590
2591         * target.h (class Target): Add osabi_ field.
2592         (Target::osabi): New function.
2593         (Target::set_osabi): New function.
2594         (Target::Target): Initialize osabi_.
2595         (Target::do_adjust_elf_header): Make pure virtual.
2596         (Sized_target::do_adjust_elf_header): Declare.
2597         * target.cc (Sized_target::do_adjust_elf_header): New function.
2598         (class Sized_target): Instantiate all versions.
2599         * freebsd.h (class Target_freebsd): Remove.
2600         (Target_selector_freebsd::do_recognize): Call set_osabi on
2601         Target.
2602         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2603         (Target_selector_freebsd::set_osabi): Remove.
2604         * i386.cc (class Target_i386): Inherit from Sized_target rather
2605         than Target_freebsd.
2606         * x86_64.cc (class Target_x86_64): Likewise.
2607
2608 2011-06-28  Ian Lance Taylor  <iant@google.com>
2609
2610         * target.h (Target::can_check_for_function_pointers): Rewrite.
2611         Make non-virtual.
2612         (Target::can_icf_inline_merge_sections): Likewise.
2613         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2614         (Target::Target_info): Add can_icf_inline_merge_sections field.
2615         (Target::do_can_check_for_function_pointers): New virtual
2616         function.
2617         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2618         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2619         from can_check_for_function_pointers, move in file.
2620         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2621         section_may_have_icf_unsafe_poineters, move in file.
2622         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2623         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2624         Rename from can_check_for_function_pointers, move in file.
2625         (Target_i386::can_icf_inline_merge_sections): Remove.
2626         (Target_i386::i386_info): Initialize
2627         can_icf_inline_merge_sections.
2628         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2629         Initialize can_icf_inline_merge_sections.
2630         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2631         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2632         Rename from can_check_for_function_pointers, move in file.
2633         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2634         (Target_x86_64::x86_64_info): Initialize
2635         can_icf_inline_merge_sections.
2636         * testsuite/testfile.cc (Target_test::test_target_info):
2637         Likewise.
2638         * icf.cc (get_section_contents): Correct formatting.
2639
2640 2011-06-27  Ian Lance Taylor  <iant@google.com>
2641
2642         * symtab.cc (Symbol::versioned_name): New function.
2643         (Symbol_table::add_to_final_symtab): Use versioned_name when
2644         appropriate.
2645         (Symbol_table::sized_write_symbol): Likewise.
2646         * symtab.h (class Symbol): Declare versioned_name.
2647         * stringpool.h (class Stringpool_template): Add variant of add
2648         which takes a std::basic_string.
2649         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2650         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2651         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2652         (ver_test_12.o): New target.
2653         * testsuite/Makefile.in: Rebuild.
2654
2655 2011-06-27  Doug Kwan  <dougkwan@google.com>
2656
2657         * arm.cc (Arm_relocate_functions::thm_jump8,
2658         Arm_relocate_functions::thm_jump11): Use a wider signed
2659         type to compute offset.
2660         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2661         arm_thm_jump8.
2662         * testsuite/Makefile.in: Regenerate.
2663         * testsuite/arm_branch_in_range.sh: Check test results of
2664         arm_thm_jump11 and arm_thm_jump8.
2665         * testsuite/arm_thm_jump11.s: New test source file.
2666         * testsuite/arm_thm_jump11.t: New linker script.
2667         * testsuite/arm_thm_jump8.s: New test source file.
2668         * testsuite/arm_thm_jump8.t: New linker script.
2669
2670 2011-06-24  Ian Lance Taylor  <iant@google.com>
2671
2672         * layout.cc: Include "object.h".
2673         (ctors_sections_in_init_array): New static variable.
2674         (Layout::is_ctors_in_init_array): New function.
2675         (Layout::layout): Add entry to ctors_sections_in_init_array if
2676         appropriate.
2677         * layout.h (class Layout): Declare is_ctors_in_init_array.
2678         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2679         is_ctors_reverse_view is set.
2680         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2681         all callers.  Set is_ctors_reverse_view field of View_size.
2682         (Sized_relobj_file::reverse_words): New function.
2683         * object.h (Sized_relobj_file::View_size): Add
2684         is_ctors_reverse_view field.
2685         (class Sized_relobj_file): Update declarations.
2686         * testsuite/initpri3.c: New test.
2687         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2688         initpri3b.
2689         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2690         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2691         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2692         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2693         * testsuite/Makefile.in: Rebuild.
2694
2695 2011-06-24  Cary Coutant  <ccoutant@google.com>
2696
2697         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2698         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2699         (debug_msg_cdebug.err): New targets.
2700         * testsuite/Makefile.in: Regenerate.
2701         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2702         Fix checks for link with shared library.
2703
2704 2011-06-24  Doug Kwan  <dougkwan@google.com>
2705
2706         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2707         skip empty text sections.
2708         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2709
2710 2011-06-22  Ian Lance Taylor  <iant@google.com>
2711
2712         PR gold/12910
2713         * options.h (class General_options): Add --ctors-in-init-array.
2714         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2715         friends as SHT_PROGBITS for merging sections.
2716         (Layout::layout): Remove special handling of .init_array and
2717         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2718         and .dtors if ctors_in_init_array.
2719         (Layout::make_output_section): Force correct section types for
2720         .init_array and friends.  Don't sort if doing relocatable link,
2721         Don't sort .ctors and .dtors if ctors_in_init_array.
2722         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2723         (Layout::output_section_name): Add relobj parameter.  Change all
2724         callers.  Handle .ctors. and .dtors. in code rather than table.
2725         Handle .ctors and .dtors if ctors_in_init_array.
2726         (Layout::match_file_name): New function, moved from output.cc.
2727         * layout.h (class Layout): Update declarations.
2728         * output.cc: Include "layout.h".
2729         (Input_section_sort_entry::get_priority): New function.
2730         (Input_section_sort_entry::match_file_name): Just call
2731         Layout::match_file_name.
2732         (Output_section::Input_section_sort_init_fini_compare::operator()):
2733         Handle .ctors and .dtors.  Sort by explicit priority rather than
2734         by name.
2735         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2736         * testsuite/initpri2.c: New test.
2737         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2738         (check_PROGRAMS): Add initpri2.
2739         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2740         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2741         * configure, testsuite/Makefile.in: Rebuild.
2742
2743 2011-06-19  Ian Lance Taylor  <iant@google.com>
2744
2745         PR gold/12880
2746         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2747         .interp section to a PT_INTERP segment even if we have seen a
2748         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2749         clause in a linker script.
2750         (Layout::finalize): Don't create a .interp section if we've
2751         already create a PT_INTERP segment.
2752         (Layout::create_interp): Always call choose_output_section (revert
2753         patch of 2011-06-17).  Don't create PT_INTERP segment.
2754         * script-sections.cc
2755         (Script_sections::create_note_and_tls_segments): Add a .interp
2756         section to a PT_INTERP segment even if we have seen a
2757         --dynamic-linker option.
2758
2759 2011-06-18  Ian Lance Taylor  <iant@google.com>
2760
2761         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2762         merely because a non-PT_LOAD segment has a dynamic reloc.
2763
2764 2011-06-18  Ian Lance Taylor  <iant@google.com>
2765
2766         * layout.cc (Layout::finish_dynamic_section): Don't create
2767         DT_FLAGS entry if not needed.
2768
2769 2011-06-18  Ian Lance Taylor  <iant@google.com>
2770
2771         PR gold/12745
2772         * layout.cc (Layout::layout_eh_frame): Correct handling of
2773         writable .eh_frame section.
2774
2775 2011-06-17  Ian Lance Taylor  <iant@google.com>
2776
2777         PR gold/12893
2778         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2779         symbol is redefined with the exact same object and value.
2780
2781 2011-06-17  Ian Lance Taylor  <iant@google.com>
2782
2783         PR gold/12880
2784         * layout.h (class Layout): Add interp_segment_ field.
2785         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2786         (Layout::attach_allocated_section_to_segment): If making shared
2787         library, put .interp section in PT_INTERP segment.
2788         (Layout::finalize): Also call create_interp if -dynamic-linker
2789         option was used.
2790         (Layout::create_interp): Assert that there is no PT_INTERP
2791         segment.  If not using a SECTIONS clause, use make_output_section.
2792         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2793         * script-sections.cc
2794         (Script_sections::create_note_and_tls_segments): If making shared
2795         library, put .interp section in PT_INTERP segment.
2796
2797 2011-06-17  Ian Lance Taylor  <iant@google.com>
2798
2799         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2800         when making a shared library.
2801
2802 2011-06-17  Ian Lance Taylor  <iant@google.com>
2803
2804         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2805         parameter.  Change all callers.  Don't issue warning about PC32
2806         against locally defined symbol.
2807
2808 2011-06-16  Ian Lance Taylor  <iant@google.com>
2809
2810         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2811         occurs in same object.
2812
2813 2011-06-14  Alan Modra  <amodra@gmail.com>
2814
2815         * po/POTFILES.in: Regenerate.
2816
2817 2011-06-09  Ian Lance Taylor  <iant@google.com>
2818
2819         * script-sections.cc
2820         (Orphan_output_section::set_section_addresses): For a relocatable
2821         link set address to 0.
2822
2823 2011-06-09  Cary Coutant  <ccoutant@google.com>
2824
2825         PR gold/12804
2826         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2827         used with --compress-debug-sections.
2828         * gold/object.cc (Sized_relobj_file::do_layout): Report
2829         uncompressed size of compressed input sections.
2830
2831 2011-06-08  Cary Coutant  <ccoutant@google.com>
2832
2833         PR gold/12804
2834         * testsuite/two_file_test_2_v1.cc: Change initialization of
2835         v2 to keep it in .data.
2836
2837 2011-06-07  Cary Coutant  <ccoutant@google.com>
2838
2839         * common.cc (Symbol_table::do_allocate_commons_list): Call
2840         gold_fallback.
2841         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2842         (Errors::fallback): New function.
2843         (gold_fallback): New function.
2844         * errors.h (Errors::fallback): New function.
2845         * gold.cc (gold_exit): Change status parameter to enum; adjust
2846         all callers.
2847         (queue_initial_tasks): Call gold_fallback.
2848         * gold.h: Include cstdlib.
2849         (Exit_status): New enum type.
2850         (gold_exit): Change status parameter to enum.
2851         (gold_fallback): New function.
2852         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2853         (Layout::create_symtab_sections): Likewise.
2854         (Layout::create_shdrs): Likewise.
2855         * main.cc (main): Adjust call to gold_exit.
2856         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2857         (Output_data_got::add_got_entry_pair): Likewise.
2858         (Output_section::add_input_section): Likewise.
2859         (Output_section::add_output_section_data): Likewise.
2860         (Output_segment::set_section_list_addresses): Likewise.
2861         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2862
2863 2011-06-07  Cary Coutant  <ccoutant@google.com>
2864
2865         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2866         for incremental links.
2867         * output.cc (Output_segment::set_section_list_addresses): Remove
2868         FIXME and test for TLS or BSS.
2869
2870 2011-06-07  Cary Coutant  <ccoutant@google.com>
2871
2872         * testsuite/Makefile.am: Add incremental_copy_test,
2873         incremental_common_test_1.
2874         * testsuite/Makefile.in: Regenerate.
2875         * testsuite/common_test_1_v1.c: New source file.
2876         * testsuite/common_test_1_v2.c: New source file.
2877         * testsuite/copy_test_v1.cc: New source file.
2878
2879 2011-06-07  Cary Coutant  <ccoutant@google.com>
2880
2881         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2882         update, allocate common from bss section's free list.
2883         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2884         linker-defined symbols.
2885         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2886         Skip GOT and PLT entries that are no longer referenced.
2887         (Output_section_incremental_inputs::write_info_blocks): Mark
2888         linker-defined symbols.
2889         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2890         * output.cc (Output_section::allocate): New function.
2891         * output.h (Output_section::allocate): New function.
2892         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2893         linker-defined symbols.
2894         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2895         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2896         (Symbol::init_base_output_data): Likewise.
2897         (Symbol::init_base_output_segment): Likewise.
2898         (Symbol::init_base_constant): Likewise.
2899         (Sized_symbol::init_output_data): Likewise.
2900         (Sized_symbol::init_output_segment): Likewise.
2901         (Sized_symbol::init_constant): Likewise.
2902         (Symbol_table::do_define_in_output_data): Likewise.
2903         (Symbol_table::do_define_in_output_segment): Likewise.
2904         (Symbol_table::do_define_as_constant): Likewise.
2905         * symtab.h (Symbol::is_predefined): New function.
2906         (Symbol::init_base_output_data): Add is_predefined parameter.
2907         (Symbol::init_base_output_segment): Likewise.
2908         (Symbol::init_base_constant): Likewise.
2909         (Symbol::is_predefined_): New data member.
2910         (Sized_symbol::init_output_data): Add is_predefined parameter.
2911         (Sized_symbol::init_output_segment): Likewise.
2912         (Sized_symbol::init_constant): Likewise.
2913         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2914
2915 2011-06-07  Cary Coutant  <ccoutant@google.com>
2916
2917         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2918         instead of emit_copy_reloc.
2919         (Copy_relocs::emit_copy_reloc): Refactor.
2920         (Copy_relocs::make_copy_reloc): New function.
2921         (Copy_relocs::add_copy_reloc): Remove.
2922         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2923         section.
2924         (Copy_relocs::make_copy_reloc): New function.
2925         (Copy_relocs::add_copy_reloc): Remove.
2926         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2927         unchanged input files.
2928         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2929         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2930         Reserve BSS space for COPY relocations.
2931         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2932         (Output_section_incremental_inputs::write_info_blocks): Record
2933         whether a symbol is copied from a shared object.
2934         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2935         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2936         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2937         (Incremental_input_entry_reader::get_output_symbol_index): Add
2938         is_copy parameter.
2939         (Incremental_binary::emit_copy_relocs): New function.
2940         (Incremental_binary::do_emit_copy_relocs): New function.
2941         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2942         new data member.
2943         (Sized_incremental_binary::add_copy_reloc): New function.
2944         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2945         (Sized_incremental_binary::Copy_reloc): New struct.
2946         (Sized_incremental_binary::Copy_relocs): New typedef.
2947         (Sized_incremental_binary::copy_relocs_): New data member.
2948         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2949         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2950         * target.h (Sized_target::emit_copy_reloc): New function.
2951         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2952
2953 2011-06-02  Cary Coutant  <ccoutant@google.com>
2954
2955         PR gold/12163
2956         * gold/archive.cc (Archive::Archive): Initialize new data member.
2957         (Archive::include_all_members): Return if archive has already been
2958         included.
2959         * gold/archive.h (Archive::include_all_members_): New data member.
2960
2961 2011-06-02  Nick Clifton  <nickc@redhat.com>
2962
2963         * dynobj.h: Fix spelling mistake in comment.
2964         * output.cc: Likewise.
2965
2966 2011-05-31  Doug Kwan  <dougkwan@google.com>
2967             Asier Llano
2968
2969         PR gold/12826
2970         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2971         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2972         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2973         redundant arm_exidx_test.so.
2974         * testsuite/Makefile.in: Regenerate.
2975         (check_SCRIPTS): Add pr12826.sh
2976         (check_DATA): Add pr12826.stdout
2977         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2978         * testsuite/pr12826.sh: New file.
2979         * testsuite/pr12826_1.s: Ditto.
2980         * testsuite/pr12826_1.s: Ditto.
2981
2982 2011-05-30  Ian Lance Taylor  <iant@google.com>
2983
2984         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2985         sections.
2986
2987 2011-05-29  Ian Lance Taylor  <iant@google.com>
2988
2989         PR gold/12804
2990         * testsuite/Makefile.am: Use different file name for two_file_test
2991         temporary file for each incremental test.
2992         * testsuite/Makefile.in: Rebuild.
2993
2994 2011-05-29  Ian Lance Taylor  <iant@google.com>
2995
2996         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2997         binary input file is empty.
2998
2999 2011-05-27  Ian Lance Taylor  <iant@google.com>
3000
3001         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3002         (ver_test_9.so): Likewise.
3003         * testsuite/Makefile.in: Rebuild.
3004
3005 2011-05-26 Cary Coutant  <ccoutant@google.com>
3006
3007         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3008         * incremental.cc (Incremental_inputs::report_input_section): Fix
3009         comment, indentation.
3010         (Incremental_inputs::report_comdat_group): New function.
3011         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3012         of data for incremental input file entry.
3013         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3014         group count, COMDAT group signatures.
3015         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3016         an unchanged input file.
3017         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3018         Initialize new data member.
3019         (Incremental_object_entry::add_comdat_group): New function.
3020         (Incremental_object_entry::get_comdat_group_count): New function.
3021         (Incremental_object_entry::get_comdat_signature_key): New function.
3022         (Incremental_object_entry::groups_): New data member.
3023         (Incremental_inputs::report_comdat_group): New function.
3024         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3025         data for incremental input file entry.
3026         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3027         (Incremental_input_entry_reader::get_input_section): Adjust size of
3028         data for incremental input file entry.
3029         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3030         (Incremental_input_entry_reader::get_comdat_group_signature): New
3031         function.
3032         * object.cc (Sized_relobj::include_section_group): Report kept
3033         COMDAT groups for incremental links.
3034
3035 2011-05-24  David Meyer  <pdox@google.com>
3036
3037         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3038         with name parameter.  Add found_name parameter.
3039         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3040         * dirsearch.h (class Dirsearch): Update declaration.
3041
3042 2011-05-24  Ian Lance Taylor  <iant@google.com>
3043
3044         * archive.cc (Library_base::should_include_member): Pull in object
3045         from archive if it defines the entry symbol.
3046         * parameters.cc (Parameters::entry): New function.
3047         * parameters.h (class Parameters): Declare entry.
3048         * output.h (class Output_file_header): Remove entry_ field.
3049         * output.cc (Output_file_header::Output_file_header): Remove entry
3050         parameter.  Change all callers.
3051         (Output_file_header::entry): Use parameters->entry.
3052         * gold.cc (queue_middle_tasks): Likewise.
3053         * plugin.cc (Plugin_hook::run): Likewise.
3054
3055 2011-05-24 Cary Coutant  <ccoutant@google.com>
3056
3057         * gold.cc (queue_initial_tasks): Pass incremental base filename
3058         to Output_file::open_base_file; don't print error message.
3059         * incremental-dump.cc (main): Adjust call to
3060         Output_file::open_for_modification.
3061         * incremental-dump.cc (main): Likewise.
3062         * incremental.cc (Incremental_inputs::report_command_line):
3063         Ignore --incremental-base option when comparing command lines.
3064         Ignore parameter when given as separate argument.
3065         * options.h (class General_options): Add --incremental-base.
3066         * output.cc (Output_file::Output_file):
3067         (Output_file::open_base_file): Add base_name and writable parameters;
3068         read base file into new file; print error message here.
3069         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3070         callers.
3071         * output.h (Output_file::open_for_modification): Rename to...
3072         (Output_file::open_base_file): ...this; add base_name and
3073         writable parameters; adjust all callers.
3074         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3075         callers.
3076         * testsuite/Makefile.am (incremental_test_4): Test
3077         --incremental-base.
3078         * testsuite/Makefile.in: Regenerate.
3079
3080 2011-05-24 Cary Coutant  <ccoutant@google.com>
3081
3082         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3083         incremental_test_4.
3084         * testsuite/Makefile.in: Regenerate.
3085         * testsuite/two_file_test_1_v1.cc: New test source file.
3086         * testsuite/two_file_test_1b_v1.cc: New test source file.
3087         * testsuite/two_file_test_2_v1.cc: New test source file.
3088
3089 2011-05-24 Cary Coutant  <ccoutant@google.com>
3090
3091         * dynobj.h (Dynobj::do_dynobj): New function.
3092         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3093         flag and soname for shared objects.
3094         * incremental.cc (Incremental_inputs::report_object): Make
3095         either Incremental_object_entry or Incremental_dynobj_entry; add
3096         soname to string table.
3097         (Incremental_inputs::report_input_section): Add assertion.
3098         (Output_section_incremental_inputs::set_final_data_size): Adjust
3099         type of input file entry for shared libraries; adjust size of
3100         shared library info entry.
3101         (Output_section_incremental_inputs::write_input_files): Write
3102         as_needed flag for shared libraries.
3103         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3104         of input file entry for shared libraries; write soname.
3105         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3106         soname from incremental info.
3107         * incremental.h (enum Incremental_input_flags): Add
3108         INCREMENTAL_INPUT_AS_NEEDED.
3109         (Incremental_input_entry::Incremental_input_entry): Initialize new
3110         data member.
3111         (Incremental_input_entry::set_as_needed): New function.
3112         (Incremental_input_entry::as_needed): New function.
3113         (Incremental_input_entry::do_dynobj_entry): New function.
3114         (Incremental_input_entry::as_needed_): New data member.
3115         (Incremental_object_entry::Incremental_object_entry): Don't check
3116         for shared library.
3117         (Incremental_object_entry::do_type): Likewise.
3118         (class Incremental_dynobj_entry): New class.
3119         (Incremental_input_entry_reader::as_needed): New function.
3120         (Incremental_input_entry_reader::get_soname): New function.
3121         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3122         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3123         size of shared library info entry.
3124         * layout.cc (Layout::finish_dynamic_section): Don't test for
3125         incremental link when adding DT_NEEDED entries.
3126         * object.h (Object::Object): Initialize new data member.
3127         (Object::dynobj): New function.
3128         (Object::set_as_needed): New function.
3129         (Object::as_needed): New function.
3130         (Object::do_dynobj): New function.
3131         (Object::as_needed_): New data member.
3132
3133 2011-05-24 Cary Coutant  <ccoutant@google.com>
3134
3135         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3136         info; adjust display of GOT entries.
3137         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3138         vector of input objects; remove file_status_.
3139         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3140         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3141         got_plt reader; call target hooks to reserve GOT entries.
3142         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3143         of input file info header and GOT info entry.
3144         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3145         relocation info.
3146         (Got_plt_view_info::got_descriptor): Remove.
3147         (Got_plt_view_info::sym_index): New data member.
3148         (Got_plt_view_info::input_index): New data member.
3149         (Local_got_offset_visitor::visit): Write input file index.
3150         (Global_got_offset_visitor::visit): Write 0 for input file index.
3151         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3152         with sym_index and input_index.
3153         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3154         incremental info GOT entry; replace got_descriptor with input_index.
3155         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3156         map from input file index to object.
3157         (Sized_relobj_incr::do_layout): Replace direct data member reference
3158         with accessor function.
3159         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3160         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3161         Adjust size of input file info header.
3162         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3163         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3164         (Incremental_input_entry_reader::get_input_section): Adjust size of
3165         input file info header.
3166         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3167         of incremental info GOT entry.
3168         (Incremental_got_plt_reader::get_got_desc): Remove.
3169         (Incremental_got_plt_reader::get_got_symndx): New function.
3170         (Incremental_got_plt_reader::get_got_input_index): New function.
3171         (Sized_incremental_binary::Sized_incremental_binary): Remove
3172         file_status_; add input_objects_.
3173         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3174         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3175         (Sized_incremental_binary::file_is_unchanged): Remove.
3176         (Sized_incremental_binary::set_input_object): New function.
3177         (Sized_incremental_binary::input_object): New function.
3178         (Sized_incremental_binary::file_status_): Remove.
3179         (Sized_incremental_binary::input_objects_): New data member.
3180         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3181         references.
3182         (Sized_relobj_incr::invalid_address): Move to base class.
3183         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3184         class.
3185         (Sized_relobj_incr::do_output_section_offset): Likewise.
3186         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3187         (Sized_relobj_incr::section_offsets_): Likewise.
3188         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3189         function.
3190         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3191         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3192         with accessor function.
3193         (Sized_relobj_file::do_layout): Likewise.
3194         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3195         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3196         (Sized_relobj_file::compute_final_local_value): Replace refs to
3197         section_offsets_ with accessor function.
3198         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3199         * object.h (Relobj::Relobj): Initialize new data members.
3200         (Relobj::add_dyn_reloc): New function.
3201         (Relobj::first_dyn_reloc): New function.
3202         (Relobj::dyn_reloc_count): New function.
3203         (Relobj::first_dyn_reloc_): New data member.
3204         (Relobj::dyn_reloc_count_): New data member.
3205         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3206         references.
3207         (Sized_relobj::Address): New typedef.
3208         (Sized_relobj::invalid_address): Move here from child class.
3209         (Sized_relobj::Sized_relobj): Initialize new data members.
3210         (Sized_relobj::sized_relobj): New function.
3211         (Sized_relobj::is_output_section_offset_invalid): Move here from
3212         child class.
3213         (Sized_relobj::get_output_section_offset): Likewise.
3214         (Sized_relobj::local_has_got_offset): Likewise.
3215         (Sized_relobj::local_got_offset): Likewise.
3216         (Sized_relobj::set_local_got_offset): Likewise.
3217         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3218         (Sized_relobj::clear_got_offsets): New function.
3219         (Sized_relobj::section_offsets): Move here from child class.
3220         (Sized_relobj::do_output_section_offset): Likewise.
3221         (Sized_relobj::do_set_section_offset): Likewise.
3222         (Sized_relobj::Local_got_offsets): Likewise.
3223         (Sized_relobj::local_got_offsets_): Likewise.
3224         (Sized_relobj::section_offsets_): Likewise.
3225         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3226         references.
3227         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3228         class.
3229         (Sized_relobj_file::sized_relobj): New function
3230         (Sized_relobj_file::local_has_got_offset): Move to base class.
3231         (Sized_relobj_file::local_got_offset): Likewise.
3232         (Sized_relobj_file::set_local_got_offset): Likewise.
3233         (Sized_relobj_file::get_output_section_offset): Likewise.
3234         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3235         (Sized_relobj_file::do_output_section_offset): Likewise.
3236         (Sized_relobj_file::do_set_section_offset): Likewise.
3237         (Sized_relobj_file::Local_got_offsets): Likewise.
3238         (Sized_relobj_file::local_got_offsets_): Likewise.
3239         (Sized_relobj_file::section_offsets_): Likewise.
3240         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3241         (all constructors).
3242         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3243         (Output_reloc::get_symbol_index): Likewise.
3244         (Output_reloc::local_section_offset): Likewise.
3245         (Output_reloc::get_address): Likewise.
3246         (Output_reloc::symbol_value): Likewise.
3247         (Output_data_got::reserve_slot): Move to class definition.
3248         (Output_data_got::reserve_local): New function.
3249         (Output_data_got::reserve_slot_for_global): Remove.
3250         (Output_data_got::reserve_global): New function.
3251         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3252         (all constructors, two instantiations).
3253         (Output_reloc::get_relobj): New function (two instantiations).
3254         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3255         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3256         (Output_data_reloc::add_global): Adjust type of relobj.
3257         (Output_data_reloc::add_global_relative): Likewise.
3258         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3259         (Output_data_reloc::add_local): Likewise.
3260         (Output_data_reloc::add_local_relative): Likewise.
3261         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3262         (Output_data_reloc::add_local_section): Likewise.
3263         (Output_data_reloc::add_output_section): Likewise.
3264         (Output_data_reloc::add_absolute): Likewise.
3265         (Output_data_reloc::add_target_specific): Likewise.
3266         (Output_data_got::reserve_slot): Move definition here.
3267         (Output_data_got::reserve_local): New function.
3268         (Output_data_got::reserve_global): New function.
3269         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3270         section_offsets_ with accessor function.
3271         (Sized_relobj_file::write_sections): Likewise.
3272         (Sized_relobj_file::do_relocate_sections): Likewise.
3273         * target.h (Sized_target::reserve_local_got_entry): New function.
3274         (Sized_target::reserve_global_got_entry): New function.
3275         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3276         (Target_x86_64::reserve_global_got_entry): New function.
3277         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3278
3279 2011-05-23 Cary Coutant  <ccoutant@google.com>
3280
3281         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3282         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3283         bit when checking got_type.
3284         * incremental.cc (Sized_incremental_binary::setup_readers):
3285         Store symbol table and string table locations; initialize bit vector
3286         of file status flags.
3287         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3288         unchanged files.
3289         (Sized_incremental_binary::do_process_got_plt): New function.
3290         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3291         (Output_section_incremental_inputs::set_final_data_size): Record
3292         file index for each input file.
3293         (Output_section_incremental_inputs::write_got_plt): Store file index
3294         instead of input entry offset for each GOT entry.
3295         * incremental.h
3296         (Incremental_input_entry::Incremental_input_entry): Initialize new
3297         data member.
3298         (Incremental_input_entry::set_offset): Store file index.
3299         (Incremental_input_entry::get_file_index): New function.
3300         (Incremental_input_entry::file_index_): New data member.
3301         (Incremental_binary::process_got_plt): New function.
3302         (Incremental_binary::do_process_got_plt): New function.
3303         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3304         data members.
3305         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3306         (Sized_incremental_binary::set_file_is_unchanged): New function.
3307         (Sized_incremental_binary::file_is_unchanged): New function.
3308         (Sized_incremental_binary::do_process_got_plt): New function.
3309         (Sized_incremental_binary::file_status_): New data member.
3310         (Sized_incremental_binary::main_symtab_loc_): New data member.
3311         (Sized_incremental_binary::main_strtab_loc_): New data member.
3312         * output.cc (Output_data_got::Got_entry::write): Add case
3313         RESERVED_CODE.
3314         (Output_data_got::add_global): Call add_got_entry.
3315         (Output_data_got::add_global_plt): Likewise.
3316         (Output_data_got::add_global_with_rel): Likewise.
3317         (Output_data_got::add_global_with_rela): Likewise.
3318         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3319         (Output_data_got::add_global_pair_with_rela): Likewise.
3320         (Output_data_got::add_local): Call add_got_entry.
3321         (Output_data_got::add_local_plt): Likewise.
3322         (Output_data_got::add_local_with_rel): Likewise.
3323         (Output_data_got::add_local_with_rela): Likewise.
3324         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3325         (Output_data_got::add_local_pair_with_rela): Likewise.
3326         (Output_data_got::reserve_slot): New function.
3327         (Output_data_got::reserve_slot_for_global): New function.
3328         (Output_data_got::add_got_entry): New function.
3329         (Output_data_got::add_got_entry_pair): New function.
3330         (Output_section::add_output_section_data): Edit FIXME.
3331         * output.h
3332         (Output_section_data_build::Output_section_data_build): New
3333         constructor with size parameter.
3334         (Output_data_space::Output_data_space): Likewise.
3335         (Output_data_got::Output_data_got): Initialize new data member; new
3336         constructor with size parameter.
3337         (Output_data_got::add_constant): Call add_got_entry.
3338         (Output_data_got::reserve_slot): New function.
3339         (Output_data_got::reserve_slot_for_global): New function.
3340         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3341         (Output_data_got::add_got_entry): New function.
3342         (Output_data_got::add_got_entry_pair): New function.
3343         (Output_data_got::free_list_): New data member.
3344         * target.h (Sized_target::init_got_plt_for_update): New function.
3345         (Sized_target::register_global_plt_entry): New function.
3346         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3347         Initialize new data member; call init; add constructor with PLT count.
3348         (Output_data_plt_x86_64::init): New function.
3349         (Output_data_plt_x86_64::add_relocation): New function.
3350         (Output_data_plt_x86_64::reserve_slot): New function.
3351         (Output_data_plt_x86_64::free_list_): New data member.
3352         (Target_x86_64::init_got_plt_for_update): New function.
3353         (Target_x86_64::register_global_plt_entry): New function.
3354         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3355         incremental updates.
3356         (Output_data_plt_x86_64::add_relocation): New function.
3357         * testsuite/object_unittest.cc (Object_test): Set default options.
3358
3359 2011-05-16  Ian Lance Taylor  <iant@google.com>
3360
3361         * options.h (class General_options): Make -i a synonym for -r.
3362
3363 2011-05-16  Ian Lance Taylor  <iant@google.com>
3364
3365         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3366
3367 2011-05-10 Cary Coutant  <ccoutant@google.com>
3368
3369         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3370         strip_all (-s).
3371
3372 2011-05-06  Ian Lance Taylor  <iant@google.com>
3373
3374         * layout.cc (Layout::layout): If the output section flags change,
3375         update the ordering.
3376
3377 2011-04-25 Cary Coutant  <ccoutant@google.com>
3378
3379         * incremental-dump.cc (dump_incremental_inputs): Print local
3380         symbol info for each input file.
3381         * incremental.cc
3382         (Output_section_incremental_inputs::set_final_data_size): Add local
3383         symbol info to input file entries in incremental info.
3384         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3385         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3386         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3387         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3388         implementation.
3389         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3390         (Sized_incr_relobj::do_relocate): Write the local symbols.
3391         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3392         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3393         Adjust size of input file header.
3394         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3395         (Incremental_inputs_reader::get_local_symbol_count): New function.
3396         (Incremental_inputs_reader::get_input_section): Adjust size of input
3397         file header.
3398         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3399         (Sized_incr_relobj::This): New typedef.
3400         (Sized_incr_relobj::sym_size): New const data member.
3401         (Sized_incr_relobj::Local_symbol): New struct.
3402         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3403         (Sized_incr_relobj::do_local_symbol_offset): New function.
3404         (Sized_incr_relobj::local_symbol_count_): New data member.
3405         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3406         (Sized_incr_relobj::local_symbol_index_): New data member.
3407         (Sized_incr_relobj::local_symbol_offset_): New data member.
3408         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3409         (Sized_incr_relobj::local_symbols_): New data member.
3410         * object.h (Relobj::output_local_symbol_count): New function.
3411         (Relobj::local_symbol_offset): New function.
3412         (Relobj::do_output_local_symbol_count): New function.
3413         (Relobj::do_local_symbol_offset): New function.
3414         (Sized_relobj::do_output_local_symbol_count): New function.
3415         (Sized_relobj::do_local_symbol_offset): New function.
3416
3417 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3418
3419         * descriptors.cc (set_close_on_exec): New function.
3420         (Descriptors::open): Use set_close_on_exec.
3421         * output.cc (S_ISLNK): Define if not defined.
3422
3423 2011-04-22 Cary Coutant  <ccoutant@google.com>
3424
3425         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3426         global symbol map.
3427         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3428         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3429         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3430         relocations.
3431         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3432         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3433         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3434         * incremental.h
3435         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3436         function.
3437         (Incremental_binary::apply_incremental_relocs): New function.
3438         (Incremental_binary::do_apply_incremental_relocs): New function.
3439         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3440         data member.
3441         (Sized_incremental_binary::add_global_symbol): New function.
3442         (Sized_incremental_binary::global_symbol): New function.
3443         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3444         (Sized_incremental_binary::symbol_map_): New data member.
3445         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3446         * target.h (Sized_target::apply_relocation): New function.
3447         * target-reloc.h (apply_relocation): New function.
3448         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3449
3450 2011-04-22  Doug Kwan  <dougkwan@google.com>
3451
3452         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3453         flag of a SHT_ARM_EXIDX section.
3454         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3455         * testsuite/Makefile.in: Regenerate.
3456         * testsuite/arm_exidx_test.s: New file.
3457         * testsuite/arm_exidx_test.sh: Same.
3458
3459 2011-04-20 Cary Coutant  <ccoutant@google.com>
3460
3461         PR gold/12689
3462         * archive.h (Incremental_archive_entry::Archive_member):
3463         Initialize arg_serial_ (second constructor).
3464
3465 2011-04-17  Ian Lance Taylor  <iant@google.com>
3466
3467         * object.cc (Relocate_info::location): Simplify location string.
3468         * errors.cc (Errors::error_at_location): Don't print program
3469         name.
3470         (Errors::warning_at_location): Likewise.
3471         (Errors::undefined_symbol): Likewise.
3472         * testsuite/debug_msg.sh: Update accordingly.
3473
3474 2011-04-14 Cary Coutant  <ccoutant@google.com>
3475
3476         * gold/layout.cc (Layout::symtab_section_offset): New function.
3477         * gold/layout.h (Layout::symtab_section_offset): New function.
3478         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3479
3480 2011-04-12  Ian Lance Taylor  <iant@google.com>
3481
3482         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3483         with MREMAP_MAYMOVE.
3484         * output.h (class Output_file): Add map_is_allocated_ field.
3485         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3486         not available, provide stubs.  If mremap is not available, #define
3487         it to gold_mremap.
3488         (MREMAP_MAYMOVE): Define if not defined.
3489         (Output_file::Output_file): Initialize map_is_allocated_.
3490         (Output_file::resize): Check map_is_allocated_.
3491         (Output_file::map_anonymous): If mmap fails, use malloc.
3492         (Output_file::unmap): Don't do anything for an anonymous map.
3493         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3494         is not available, provide stubs.
3495         (File_read::View::~View): Use free rather than delete[].
3496         (File_read::make_view): Use malloc rather than new[].  If mmap
3497         fails, use malloc.
3498         (File_read::find_or_make_view): Use malloc rather than new[].
3499         * gold.h: Remove HAVE_REMAP code.
3500         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3501         exists.  Rename mremap to gold_mremap.  If mmap is not available
3502         don't do anything.
3503         * configure, config.in: Rebuild.
3504
3505 2011-04-11  Ian Lance Taylor  <iant@google.com>
3506
3507         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3508         initialize local variable v.
3509
3510 2011-04-11  Cary Coutant  <ccoutant@google.com>
3511
3512         * archive.cc (Archive::include_member): Adjust call to
3513         report_object.
3514         (Add_archive_symbols::run): Track argument serial numbers.
3515         (Lib_group::include_member): Likewise.
3516         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3517         * archive.h (Incremental_archive_entry::Archive_member):
3518         Initialize arg_serial_.
3519         (Archive_member::arg_serial_): New data member.
3520         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3521         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3522         incremental link.
3523         (Sized_dynobj::do_for_all_local_got_entries): New function.
3524         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3525         function.
3526         * fileread.cc (get_mtime): New function.
3527         * fileread.h (get_mtime): New function.
3528         * gold.cc (queue_initial_tasks): Check for incremental update.
3529         (process_incremental_input): New function.
3530         (queue_middle_tasks): Don't force valid target for incremental
3531         update.
3532         * incremental-dump.cc (find_input_containing_global): Adjust
3533         size of symbol info entry.
3534         (dump_incremental_inputs): Dump argument serial number and
3535         in_system_directory flag; bias shndx by 1; print symbol names
3536         when dumping per-file symbol lists; use new symbol info readers.
3537         * incremental.cc
3538         (Output_section_incremental_inputs:update_data_size): New function.
3539         (Sized_incremental_binary::setup_readers): Setup input readers
3540         for each input file; build maps for files added from libraries
3541         and scripts.
3542         (Sized_incremental_binary::check_input_args): New function.
3543         (Sized_incremental_binary::do_check_inputs): Build map of argument
3544         serial numbers to input arguments.
3545         (Sized_incremental_binary::do_file_has_changed): Rename
3546         do_file_is_unchanged to this; compare file modification times.
3547         (Sized_incremental_binary::do_init_layout): New function.
3548         (Sized_incremental_binary::do_reserve_layout): New function.
3549         (Sized_incremental_binary::do_get_input_reader): Remove.
3550         (Sized_incremental_binary::get_symtab_view): New function.
3551         (Incremental_checker::can_incrementally_link_output_file): Remove.
3552         (Incremental_inputs::report_command_line): Exclude --debug options.
3553         (Incremental_inputs::report_archive_begin): Add parameter; track
3554         argument serial numbers; don't put input file entry for archive
3555         before archive members.
3556         (Incremental_inputs::report_archive_end): Put input file entry
3557         for archive after archive members.
3558         (Incremental_inputs::report_object): Add parameter; track argument
3559         serial numbers and in_system_directory flag.
3560         (Incremental_inputs::report_script): Add parameter; track argument
3561         serial numbers.
3562         (Output_section_incremental_inputs::set_final_data_size): Adjust
3563         size of symbol info entry; check for forwarding symbols.
3564         (Output_section_incremental_inputs::write_input_files): Write
3565         in_system_directory flag and argument serial number.
3566         (Output_section_incremental_inputs::write_info_blocks): Map section
3567         indices between incremental info and original input file; store
3568         input section index for each symbol.
3569         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3570         change operator() to visit().
3571         (class Global_got_offset_visitor): Likewise.
3572         (class Global_symbol_visitor_got_plt):
3573         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3574         classes.
3575         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3576         (Sized_incr_relobj::do_read_symbols): New function.
3577         (Sized_incr_relobj::do_layout): New function.
3578         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3579         (Sized_incr_relobj::do_add_symbols): New function.
3580         (Sized_incr_relobj::do_should_include_member): New function.
3581         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3582         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3583         (Sized_incr_relobj::do_section_size): New function.
3584         (Sized_incr_relobj::do_section_name): New function.
3585         (Sized_incr_relobj::do_section_contents): New function.
3586         (Sized_incr_relobj::do_section_flags): New function.
3587         (Sized_incr_relobj::do_section_entsize): New function.
3588         (Sized_incr_relobj::do_section_address): New function.
3589         (Sized_incr_relobj::do_section_type): New function.
3590         (Sized_incr_relobj::do_section_link): New function.
3591         (Sized_incr_relobj::do_section_info): New function.
3592         (Sized_incr_relobj::do_section_addralign): New function.
3593         (Sized_incr_relobj::do_initialize_xindex): New function.
3594         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3595         (Sized_incr_relobj::do_read_relocs): New function.
3596         (Sized_incr_relobj::do_gc_process_relocs): New function.
3597         (Sized_incr_relobj::do_scan_relocs): New function.
3598         (Sized_incr_relobj::do_count_local_symbols): New function.
3599         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3600         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3601         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3602         (Sized_incr_relobj::do_relocate): New function.
3603         (Sized_incr_relobj::do_set_section_offset): New function.
3604         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3605         (Sized_incr_dynobj::do_read_symbols): New function.
3606         (Sized_incr_dynobj::do_layout): New function.
3607         (Sized_incr_dynobj::do_add_symbols): New function.
3608         (Sized_incr_dynobj::do_should_include_member): New function.
3609         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3610         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3611         (Sized_incr_dynobj::do_section_size): New function.
3612         (Sized_incr_dynobj::do_section_name): New function.
3613         (Sized_incr_dynobj::do_section_contents): New function.
3614         (Sized_incr_dynobj::do_section_flags): New function.
3615         (Sized_incr_dynobj::do_section_entsize): New function.
3616         (Sized_incr_dynobj::do_section_address): New function.
3617         (Sized_incr_dynobj::do_section_type): New function.
3618         (Sized_incr_dynobj::do_section_link): New function.
3619         (Sized_incr_dynobj::do_section_info): New function.
3620         (Sized_incr_dynobj::do_section_addralign): New function.
3621         (Sized_incr_dynobj::do_initialize_xindex): New function.
3622         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3623         (make_sized_incremental_object): New function.
3624         (Incremental_library::copy_unused_symbols): New function.
3625         (Incremental_library::do_for_all_unused_symbols): New function.
3626         * incremental.h (enum Incremental_input_flags): New type.
3627         (class Incremental_checker): Remove.
3628         (Incremental_input_entry::Incremental_input_entry): Add argument
3629         serial number.
3630         (Incremental_input_entry::arg_serial): New function.
3631         (Incremental_input_entry::set_is_in_system_directory): New function.
3632         (Incremental_input_entry::is_in_system_directory): New function.
3633         (Incremental_input_entry::arg_serial_): New data member.
3634         (Incremental_input_entry::is_in_system_directory_): New data member.
3635         (class Script_info): Move here from script.h.
3636         (Script_info::Script_info): Add filename parameter.
3637         (Script_info::filename): New function.
3638         (Script_info::filename_): New data member.
3639         (Incremental_script_entry::Incremental_script_entry): Add argument
3640         serial number.
3641         (Incremental_object_entry::Incremental_object_entry): Likewise.
3642         (Incremental_object_entry::add_input_section): Build list of input
3643         sections with map to original shndx.
3644         (Incremental_object_entry::get_input_section_index): New function.
3645         (Incremental_object_entry::shndx_): New data member.
3646         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3647         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3648         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3649         serial number.
3650         (Incremental_inputs::report_archive_begin): Likewise.
3651         (Incremental_inputs::report_object): Likewise.
3652         (Incremental_inputs::report_script): Likewise.
3653         (class Incremental_global_symbol_reader): New class.
3654         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3655         and store flags and input file type.
3656         (Incremental_input_entry_reader::arg_serial): New function.
3657         (Incremental_input_entry_reader::type): Extract type from flags.
3658         (Incremental_input_entry_reader::is_in_system_directory): New function.
3659         (Incremental_input_entry_reader::get_input_section_count): Call
3660         accessor function for type.
3661         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3662         function for type; adjust size of global symbol entry.
3663         (Incremental_input_entry_reader::get_global_symbol_count): Call
3664         accessor function for type.
3665         (Incremental_input_entry_reader::get_object_count): Likewise.
3666         (Incremental_input_entry_reader::get_object_offset): Likewise.
3667         (Incremental_input_entry_reader::get_member_count): Likewise.
3668         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3669         (Incremental_input_entry_reader::get_member_offset): Likewise.
3670         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3671         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3672         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3673         (Incremental_input_entry_reader::get_global_symbol_reader): New
3674         function.
3675         (Incremental_input_entry_reader::get_output_symbol_index): New
3676         function.
3677         (Incremental_input_entry_reader::type_): Remove.
3678         (Incremental_input_entry_reader::flags_): New data member.
3679         (Incremental_inputs_reader::input_file_offset): New function.
3680         (Incremental_inputs_reader::input_file_index): New function.
3681         (Incremental_inputs_reader::input_file): Call input_file_offset.
3682         (Incremental_inputs_reader::input_file_at_offset): New function.
3683         (Incremental_relocs_reader::get_r_type): Reformat.
3684         (Incremental_relocs_reader::get_r_shndx): Reformat.
3685         (Incremental_relocs_reader::get_r_offset): Reformat.
3686         (Incremental_relocs_reader::data): New function.
3687         (Incremental_binary::Incremental_binary): Initialize new data members.
3688         (Incremental_binary::check_inputs): Add cmdline parameter.
3689         (Incremental_binary::file_is_unchanged): Remove.
3690         (Input_reader::arg_serial): New function.
3691         (Input_reader::get_unused_symbol_count): New function.
3692         (Input_reader::get_unused_symbol): New function.
3693         (Input_reader::do_arg_serial): New function.
3694         (Input_reader::do_get_unused_symbol_count): New function.
3695         (Input_reader::do_get_unused_symbol): New function.
3696         (Incremental_binary::input_file_count): New function.
3697         (Incremental_binary::get_input_reader): Change signature to use
3698         index instead of filename.
3699         (Incremental_binary::file_has_changed): New function.
3700         (Incremental_binary::get_input_argument): New function.
3701         (Incremental_binary::get_library): New function.
3702         (Incremental_binary::get_script_info): New function.
3703         (Incremental_binary::init_layout): New function.
3704         (Incremental_binary::reserve_layout): New function.
3705         (Incremental_binary::output_file): New function.
3706         (Incremental_binary::do_check_inputs): New function.
3707         (Incremental_binary::do_file_is_unchanged): Remove.
3708         (Incremental_binary::do_file_has_changed): New function.
3709         (Incremental_binary::do_init_layout): New function.
3710         (Incremental_binary::do_reserve_layout): New function.
3711         (Incremental_binary::do_input_file_count): New function.
3712         (Incremental_binary::do_get_input_reader): Change signature.
3713         (Incremental_binary::input_args_map_): New data member.
3714         (Incremental_binary::library_map_): New data member.
3715         (Incremental_binary::script_map_): New data member.
3716         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3717         new data members.
3718         (Sized_incremental_binary::output_section): New function.
3719         (Sized_incremental_binary::inputs_reader): Add const.
3720         (Sized_incremental_binary::symtab_reader): Add const.
3721         (Sized_incremental_binary::relocs_reader): Add const.
3722         (Sized_incremental_binary::got_plt_reader): Add const.
3723         (Sized_incremental_binary::get_symtab_view): New function.
3724         (Sized_incremental_binary::Inputs_reader): New typedef.
3725         (Sized_incremental_binary::Input_entry_reader): New typedef.
3726         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3727         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3728         (Sized_incremental_binary::do_file_has_changed): New function.
3729         (Sized_incremental_binary::do_init_layout): New function.
3730         (Sized_incremental_binary::do_reserve_layout): New function.
3731         (Sized_input_reader::Inputs_reader): Remove.
3732         (Sized_input_reader::Input_entry_reader): Remove.
3733         (Sized_input_reader::do_arg_serial): New function.
3734         (Sized_input_reader::do_get_unused_symbol_count): New function.
3735         (Sized_input_reader::do_get_unused_symbol): New function.
3736         (Sized_incremental_binary::do_input_file_count): New function.
3737         (Sized_incremental_binary::do_get_input_reader): Change signature;
3738         use index instead of filename.
3739         (Sized_incremental_binary::section_map_): New data member.
3740         (Sized_incremental_binary::input_entry_readers_): New data member.
3741         (class Sized_incr_relobj): New class.
3742         (class Sized_incr_dynobj): New class.
3743         (make_sized_incremental_object): New function.
3744         (class Incremental_library): New class.
3745         * layout.cc (Free_list::num_lists): New static data member.
3746         (Free_list::num_nodes): New static data member.
3747         (Free_list::num_removes): New static data member.
3748         (Free_list::num_remove_visits): New static data member.
3749         (Free_list::num_allocates): New static data member.
3750         (Free_list::num_allocate_visits): New static data member.
3751         (Free_list::init): New function.
3752         (Free_list::remove): New function.
3753         (Free_list::allocate): New function.
3754         (Free_list::dump): New function.
3755         (Free_list::print_stats): New function.
3756         (Layout_task_runner::run): Resize output file for incremental updates.
3757         (Layout::Layout): Initialize new data members.
3758         (Layout::set_incremental_base): New function.
3759         (Layout::init_fixed_output_section): New function.
3760         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3761         incremental updates.
3762         (Layout::create_gold_note): Do not create gold note section for
3763         incremental updates.
3764         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3765         for incremental updates.
3766         (Layout::set_section_offsets): For incremental updates, allocate space
3767         from free list.
3768         (Layout::create_symtab_sections): Layout with offsets relative to
3769         start of section; for incremental updates, allocate space from free
3770         list.
3771         (Layout::create_shdrs): For incremental updates, allocate space from
3772         free list.
3773         (Layout::finish_dynamic_section): For incremental updates, do not
3774         check --as-needed (fixed in subsequent patch).
3775         * layout.h (class Free_list): New class.
3776         (Layout::set_incremental_base): New function.
3777         (Layout::incremental_base): New function.
3778         (Layout::init_fixed_output_section): New function.
3779         (Layout::allocate): New function.
3780         (Layout::incremental_base_): New data member.
3781         (Layout::free_list_): New data member.
3782         * main.cc (main): Print Free_list statistics.
3783         * object.cc (Relobj::finalize_incremental_relocs): Add
3784         clear_counts parameter; clear counts only when clear_counts is set.
3785         (Sized_relobj::Sized_relobj): Initialize new base class.
3786         (Sized_relobj::do_layout): Don't report special sections.
3787         (Sized_relobj::do_for_all_local_got_entries): New function.
3788         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3789         symtab_off to all symbol table offsets.
3790         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3791         * object.h (class Got_offset_list): Move to top of file.
3792         (Object::Object): Allow case where input_file == NULL.
3793         (Object::~Object): Likewise.
3794         (Object::input_file): Assert that input_file != NULL.
3795         (Object::lock): Allow case where input_file == NULL.
3796         (Object::unlock): Likewise.
3797         (Object::is_locked): Likewise.
3798         (Object::token): Likewise.
3799         (Object::release): Likewise.
3800         (Object::is_incremental): New function.
3801         (Object::get_mtime): New function.
3802         (Object::for_all_local_got_entries): New function.
3803         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3804         (Object::set_is_in_system_directory): New function.
3805         (Object::is_in_system_directory): New function.
3806         (Object::do_is_incremental): New function.
3807         (Object::do_get_mtime): New function.
3808         (Object::do_for_all_local_got_entries): New function.
3809         (Object::is_in_system_directory_): New data member.
3810         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3811         (class Sized_relobj_base): New class.
3812         (class Sized_relobj): Derive from Sized_relobj_base.
3813         (class Sized_relobj::Symbols): Redeclare from base class.
3814         (class Sized_relobj::local_got_offset_list): Remove.
3815         (class Sized_relobj::Output_sections): Redeclare from base class.
3816         (class Sized_relobj::do_for_all_local_got_entries): New function.
3817         (class Sized_relobj::write_local_symbols): Add offset parameter.
3818         (class Sized_relobj::local_symbol_offset_): Update comment.
3819         (class Sized_relobj::local_dynsym_offset_): Update comment.
3820         * options.cc (Input_arguments::add_file): Remove const.
3821         * options.h (Input_file_argument::Input_file_argument):
3822         Initialize arg_serial_ (all constructors).
3823         (Input_file_argument::set_arg_serial): New function.
3824         (Input_file_argument::arg_serial): New function.
3825         (Input_file_argument::arg_serial_): New data member.
3826         (Input_arguments::Input_arguments): Initialize file_count_.
3827         (Input_arguments::add_file): Remove const.
3828         (Input_arguments::number_of_input_files): New function.
3829         (Input_arguments::file_count_): New data member.
3830         (Command_line::number_of_input_files): Call
3831         Input_arguments::number_of_input_files.
3832         * output.cc (Output_segment_headers::Output_segment_headers):
3833         Set current size.
3834         (Output_section::Input_section::current_data_size): New function.
3835         (Output_section::Output_section): Initialize new data members.
3836         (Output_section::add_input_section): Don't do merge sections for
3837         an incremental link; allocate space from free list for an
3838         incremental update.
3839         (Output_section::add_output_section_data): Allocate space from
3840         free list for an incremental update.
3841         (Output_section::update_data_size): New function.
3842         (Output_section::set_fixed_layout): New function.
3843         (Output_section::reserve): New function.
3844         (Output_segment::set_section_addresses): Remove const.
3845         (Output_segment::set_section_list_addresses): Remove const; allocate
3846         space from free list for an incremental update.
3847         (Output_segment::set_offset): Adjust size of RELRO segment for an
3848         incremental update.
3849         * output.h (Output_data::current_data_size): Move here from
3850         child classes.
3851         (Output_data::pre_finalize_data_size): New function.
3852         (Output_data::update_data_size): New function.
3853         (Output_section_headers::update_data_size): new function.
3854         (Output_section_data_build::current_data_size): Move to Output_data.
3855         (Output_data_strtab::update_data_size): New function.
3856         (Output_section::current_data_size): Move to Output_data.
3857         (Output_section::set_fixed_layout): New function.
3858         (Output_section::has_fixed_layout): New function.
3859         (Output_section::reserve): New function.
3860         (Output_section::update_data_size): New function.
3861         (Output_section::has_fixed_layout_): New data member.
3862         (Output_section::free_list_): New data member.
3863         (Output_segment::set_section_addresses): Remove const.
3864         (Output_segment::set_section_list_addresses): Remove const.
3865         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3866         New function.
3867         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3868         New function.
3869         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3870         parameter when calling Add_symbols constructor; store argument
3871         serial number for members of a lib group.
3872         (Add_symbols::locks): Allow case where token == NULL.
3873         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3874         (Read_member::~Read_member): New function.
3875         (Read_member::is_runnable): New function.
3876         (Read_member::locks): New function.
3877         (Read_member::run): New function.
3878         (Check_script::~Check_script): New function.
3879         (Check_script::is_runnable): New function.
3880         (Check_script::locks): New function.
3881         (Check_script::run): New function.
3882         (Check_library::~Check_library): New function.
3883         (Check_library::is_runnable): New function.
3884         (Check_library::locks): New function.
3885         (Check_library::run): New function.
3886         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3887         (Add_symbols::library_): New data member.
3888         (class Read_member): New class.
3889         (class Check_script): New class.
3890         (class Check_library): New class.
3891         * reloc.cc (Read_relocs::is_runnable): Allow case where
3892         token == NULL.
3893         (Read_relocs::locks): Likewise.
3894         (Scan_relocs::locks): Likewise.
3895         (Relocate_task::locks): Likewise.
3896         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3897         to clear counters.
3898         (Sized_relobj::incremental_relocs_scan): Fix comment.
3899         (Sized_relobj::do_relocate): Pass output file offset to
3900         write_local_symbols.
3901         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3902         from class declaration.
3903         * script.cc (read_input_script): Allocate Script_info; pass
3904         argument serial number to report_script.
3905         * script.h (class Script_info): Move to incremental.h.
3906         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3907         * symtab.h (Symbol_table::add_from_incrobj): New function.
3908         (Symbol_table::set_file_offset): New function.
3909
3910 2011-04-05  Cary Coutant  <ccoutant@google.com>
3911
3912         * incremental-dump.cc (dump_incremental_inputs): Change signature
3913         to take a Sized_incremental_binary; change caller.  Use readers
3914         in Sized_incremental_binary.
3915         * incremental.cc
3916         (Sized_incremental_binary::find_incremental_inputs_sections):
3917         Rename do_find_incremental_inputs_sections to this.
3918         (Sized_incremental_binary::setup_readers): New function.
3919         (Sized_incremental_binary::do_check_inputs): Check
3920         has_incremental_info_ flag; move setup code to setup_readers;
3921         use input readers.
3922         (Sized_incremental_binary::do_file_is_unchanged): New function.
3923         (Sized_incremental_binary::do_get_input_reader): New function.
3924         * incremental.h (class Incremental_binary): Move to end of file.
3925         (Incremental_binary::file_is_unchanged): New function.
3926         (Incremental_binary::do_file_is_unchanged): New function.
3927         (Incremental_binary::Input_reader): New class.
3928         (Incremental_binary::get_input_reader): New function.
3929         (class Sized_incremental_binary): Move to end of file.
3930         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3931         input section reader classes.
3932         (Sized_incremental_binary::has_incremental_info): New function.
3933         (Sized_incremental_binary::inputs_reader): New function.
3934         (Sized_incremental_binary::symtab_reader): New function.
3935         (Sized_incremental_binary::relocs_reader): New function.
3936         (Sized_incremental_binary::got_plt_reader): New function.
3937         (Sized_incremental_binary::do_file_is_unchanged): New function.
3938         (Sized_incremental_binary::Sized_input_reader): New class.
3939         (Sized_incremental_binary::get_input_reader): New function.
3940         (Sized_incremental_binary::find_incremental_inputs_sections):
3941         Rename do_find_incremental_inputs_sections to this.
3942         (Sized_incremental_binary::setup_readers): New function.
3943         (Sized_incremental_binary::has_incremental_info_): New data member.
3944         (Sized_incremental_binary::inputs_reader_): New data member.
3945         (Sized_incremental_binary::symtab_reader_): New data member.
3946         (Sized_incremental_binary::relocs_reader_): New data member.
3947         (Sized_incremental_binary::got_plt_reader_): New data member.
3948         (Sized_incremental_binary::current_input_file_): New data member.
3949
3950 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3951
3952         PR gold/12640
3953         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3954         violation.
3955
3956 2011-03-30  Cary Coutant  <ccoutant@google.com>
3957
3958         * archive.cc (Archive::include_member): Adjust call to report_object.
3959         (Add_archive_symbols::run): Add script_info to call to
3960         report_archive_begin.
3961         (Lib_group::include_member): Adjust call to report_object.
3962         (Add_lib_group_symbols::run): Adjust call to report_object.
3963         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3964         blocks.  Add object count for script input files.
3965         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3966         script_info parameter; change all callers.
3967         (Incremental_inputs::report_object): Add script_info parameter;
3968         change all callers.
3969         (Incremental_inputs::report_script): Store backpointer to
3970         incremental info entry.
3971         (Output_section_incremental_inputs::set_final_data_size): Record
3972         additional information for scripts.
3973         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3974         * incremental.h (Incremental_script_entry::add_object): New function.
3975         (Incremental_script_entry::get_object_count): New function.
3976         (Incremental_script_entry::get_object): New function.
3977         (Incremental_script_entry::objects_): New data member; adjust
3978         constructor.
3979         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3980         (Incremental_inputs::report_object): Add script_info parameter.
3981         (Incremental_inputs_reader::get_object_count): New function.
3982         (Incremental_inputs_reader::get_object_offset): New function.
3983         * options.cc (Input_arguments::add_file): Return reference to
3984         new input argument.
3985         * options.h (Input_argument::set_script_info): New function.
3986         (Input_argument::script_info): New function.
3987         (Input_argument::script_info_): New data member; adjust all
3988         constructors.
3989         (Input_file_group::add_file): Return reference to new input argument.
3990         (Input_file_lib::add_file): Likewise.
3991         (Input_arguments::add_file): Likewise.
3992         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3993         * script.cc (Parser_closure::Parser_closure): Add script_info
3994         parameter; adjust all callers.
3995         (Parser_closure::script_info): New function.
3996         (Parser_closure::script_info_): New data member.
3997         (read_input_script): Report scripts earlier to incremental info.
3998         (script_add_file): Set script_info in Input_argument.
3999         (script_add_library): Likewise.
4000         * script.h (Script_options::Script_info): Rewrite class.
4001
4002 2011-03-29  Cary Coutant  <ccoutant@google.com>
4003
4004         * archive.cc (Library_base::should_include_member): Move
4005         method here from class Archive.
4006         (Archive::Archive): Initialize base class.
4007         (Archive::should_include_member): Move to base class.
4008         (Archive::do_for_all_unused_symbols): New function.
4009         (Add_archive_symbols::run): Remove redundant access to
4010         incremental_inputs.
4011         (Lib_group::Lib_group): Initialize base class.
4012         (Lib_group::do_filename): New function.
4013         (Lib_group::include_member): Pass pointer to Lib_group to
4014         report_object.
4015         (Lib_group::do_for_all_unused_symbols): New function.
4016         (Add_lib_group_symbols::run): Report archive information for
4017         incremental links.
4018         * archive.h (class Library_base): New base class.
4019         (class Archive): Derive from Library_base.
4020         (Archive::filename): Move to base class.
4021         (Archive::set_incremental_info): Likewise.
4022         (Archive::incremental_info): Likewise.
4023         (Archive::Should_include): Likewise.
4024         (Archive::should_include_member): Likewise.
4025         (Archive::Armap_entry): Remove.
4026         (Archive::Unused_symbol_iterator): Remove.
4027         (Archive::unused_symbols_begin): Remove.
4028         (Archive::unused_symbols_end): Remove.
4029         (Archive::do_filename): New function.
4030         (Archive::do_get_mtime): New function.
4031         (Archive::do_for_all_unused_symbols): New function.
4032         (Archive::task_): Move to base class.
4033         (Archive::incremental_info_): Likewise.
4034         (class Lib_group): Derive from Library_base.
4035         (Lib_group::do_filename): New function.
4036         (Lib_group::do_get_mtime): New function.
4037         (Lib_group::do_for_all_unused_symbols): New function.
4038         (Lib_group::task_): Move to base class.
4039         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4040         function.
4041         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4042         function.
4043         * incremental.cc (Incremental_inputs::report_archive_begin):
4044         Use Library_base; call library's get_mtime; add incremental inputs
4045         entry before members.
4046         (class Unused_symbol_visitor): New class.
4047         (Incremental_inputs::report_archive_end): Use Library_base; use
4048         visitor class to record unused symbols; don't add incremental inputs
4049         entry after members.
4050         (Incremental_inputs::report_object): Use Library_base.
4051         * incremental.h
4052         (Incremental_archive_entry::Incremental_archive_entry): Remove
4053         unused Archive parameter.
4054         (Incremental_inputs::report_archive_begin): Use Library_base.
4055         (Incremental_inputs::report_archive_end): Likewise.
4056         (Incremental_inputs::report_object): Likewise.
4057         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4058         function.
4059         * object.h (Object::for_all_global_symbols): New function.
4060         (Object::do_for_all_global_symbols): New function.
4061         (Sized_relobj::do_for_all_global_symbols): New function.
4062         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4063         function.
4064         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4065         function.
4066
4067 2011-03-27  Ian Lance Taylor  <iant@google.com>
4068
4069         * archive.cc (Archive::interpret_header): Return -1 if something
4070         goes wrong.  Change callers accordingly.
4071
4072 2011-03-25  Cary Coutant  <ccoutant@google.com>
4073
4074         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4075         * testsuite/Makefile.in: Regenerate.
4076
4077 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4078
4079         * plugin.cc (get_view): New.
4080         (Plugin::load): Pass get_view to the plugin.
4081         (Plugin_manager::get_view): New.
4082
4083 2011-03-21  Ian Lance Taylor  <iant@google.com>
4084
4085         * testsuite/final_layout.sh: Rewrite to not use dc.
4086         * testsuite/relro_test.sh: Fail if dc is not present.
4087
4088 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4089
4090         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4091         Change == to -eq.
4092         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4093         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4094         Change == to -eq.
4095         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4096         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4097
4098 2011-03-14  Ian Lance Taylor  <iant@google.com>
4099
4100         * script-sections.cc (Sort_output_sections::script_compare):
4101         Rename from is_before, change return type.
4102         (Sort_output_sections::operator()): Adjust accordingly.
4103
4104 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4105
4106         PR gold/12572
4107         * testsuite/odr_violation2.cc: Add comment to make all error line
4108         numbers double digits.
4109         * testsuite/debug_msg.sh: Adjust expected errors.
4110
4111 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4112
4113         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4114         but mark earlier ones as non-canonical
4115         (offset_to_iterator): Update search target and example
4116         (do_addr2line): Return extra lines in a vector*
4117         (format_file_lineno): Extract from do_addr2line
4118         (one_addr2line): Add vector* out-param
4119         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4120         when a lineno entry appeared last for its instruction
4121         (Dwarf_line_info): Add vector* out-param
4122         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4123         * symtab.cc (Odr_violation_compare): Include the lineno in the
4124         comparison again.
4125         (linenos_from_loc): New. Combine the canonical line for an
4126         address with its other lines.
4127         (True_if_intersect): New. Helper functor to make
4128         std::set_intersection a query.
4129         (detect_odr_violations): Compare sets of lines instead of just
4130         one line for each function. This became less deterministic, but
4131         has fewer false positives.
4132         * symtab.h: Declarations.
4133         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4134         mix an optimized and non-optimized object in the same binary
4135         (odr_violation2.so): Same.
4136         * testsuite/Makefile.in: Regenerate from Makefile.am.
4137         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4138         * testsuite/debug_msg.sh: Update line numbers and add
4139         assertions.
4140         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4141         non-optimized context.
4142         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4143         isn't inlined, and use OdrDerived in an optimized context.
4144         * testsuite/odr_header1.h: Defines OdrDerived, where
4145         optimization will change the
4146         first-instruction-in-the-destructor's file and line number.
4147         * testsuite/odr_header2.h: Defines OdrBase.
4148
4149 2011-03-09  Ian Lance Taylor  <iant@google.com>
4150
4151         * fileread.cc (File_read::clear_views): Don't delete the whole
4152         file view.
4153
4154 2011-03-08  Ian Lance Taylor  <iant@google.com>
4155
4156         PR gold/12525
4157         * fileread.cc: #include <climits>.
4158         (GOLD_IOV_MAX): Define.
4159         (File_read::read_multiple): Limit number of entries by iov_max.
4160         * fileread.h (class File_read): Always set max_readv_entries to
4161         128.
4162
4163 2011-03-07  Ian Lance Taylor  <iant@google.com>
4164
4165         PR gold/12525
4166         * options.h (class General_options): Add -dy and -dn.
4167
4168 2011-03-02  Cary Coutant  <ccoutant@google.com>
4169
4170         * testsuite/script_test_9.t: Add TLS segment.
4171
4172 2011-03-02  Simon Baldwin  <simonb@google.com>
4173
4174         * configure.ac: Add check for gnu_indirect_function support in
4175         the toolchain building binutils.
4176         * configure: Rebuild.
4177
4178 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4179
4180         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4181         plugin only symbols.
4182         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4183         in plugin files as not needed in the symbol table.
4184
4185 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4186
4187         * output.cc (Output_section::add_input_section): Delay fill
4188         generation for section ordering.
4189
4190 2011-02-09  Ian Lance Taylor  <iant@google.com>
4191
4192         PR gold/12316
4193         * object.h (class Sized_relobj): Remove clear_local_symbols.
4194         * reloc.cc (Sized_relobj::do_relocate): Don't call
4195         clear_local_symbols.
4196
4197 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4198
4199         * plugin.cc (is_visible_from_outside): Return true for symbols
4200         in the -u option.
4201
4202 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4203
4204         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4205         filename.
4206
4207 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4208
4209         * icf.h (is_section_foldable_candidate): Change type of parameter
4210         to std::string.
4211         * icf.cc (Icf::find_identical_sections): Change type of local variable
4212         section_name to be std::string.
4213         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4214
4215 2011-01-25  Ian Lance Taylor  <iant@google.com>
4216
4217         * script.cc (script_add_extern): Rewrite to use
4218         add_symbol_reference.
4219
4220 2011-01-25  Doug Kwan  <dougkwan@google.com>
4221
4222         * icf.cc (get_section_contents): Always lock section's object.
4223
4224 2011-01-24  Ian Lance Taylor  <iant@google.com>
4225
4226         * options.h (class General_options): Accept
4227         --no-detect-odr-violations.
4228
4229 2011-01-24  Ian Lance Taylor  <iant@google.com>
4230
4231         * version.cc (version_string): Bump to 1.11.
4232
4233 2011-01-24  Ian Lance Taylor  <iant@google.com>
4234
4235         * plugin.cc (class Plugin_rescan): Define new class.
4236         (Plugin_manager::claim_file): Set any_claimed_.
4237         (Plugin_manager::save_archive): New function.
4238         (Plugin_manager::save_input_group): New function.
4239         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4240         necessary.
4241         (Plugin_manager::new_undefined_symbol): New function.
4242         (Plugin_manager::rescan): New function.
4243         (Plugin_manager::rescannable_defines): New function.
4244         (Plugin_manager::add_input_file): Set any_added_.
4245         * plugin.h (class Plugin_manager): define new fields rescannable_,
4246         undefined_symbols_, any_claimed_, and any_added_.  Declare
4247         Plugin_rescan as friend.  Declare new functions.
4248         (Plugin_manager::Rescannable): Define type.
4249         (Plugin_manager::Rescannable_list): Define type.
4250         (Plugin_manager::Undefined_symbol_list): Define type.
4251         (Plugin_manager::Plugin_manager): Initialize new fields.
4252         * archive.cc (Archive::defines_symbol): New function.
4253         (Add_archive_symbols::run): Pass archive to plugins if any.
4254         * archive.h (class Archive): Declare defines_symbol.
4255         * readsyms.cc (Input_group::~Input_group): New function.
4256         (Finish_group::run): Pass input_group to plugins if any.
4257         * readsyms.h (class Input_group): Declare destructor.
4258         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4259         any.
4260
4261 2011-01-10  Ian Lance Taylor  <iant@google.com>
4262
4263         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4264         section as relro.
4265         (Layout::set_segment_offsets): Reset increase_relro before calling
4266         set_section_addresses a second time.
4267
4268 2011-01-04  Cary Coutant  <ccoutant@google.com>
4269
4270         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4271         sections before NOBITS sections.
4272
4273 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4274
4275         * version.cc (print_version): Update copyright to 2011.
4276
4277 2010-12-23  Cary Coutant  <ccoutant@google.com>
4278
4279         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4280         of OS to this->add.  Add OD parameter to second form of the function.
4281
4282 2010-12-20  Ian Lance Taylor  <iant@google.com>
4283
4284         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4285         second of two consecutive entries with same offset.
4286
4287 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4288
4289         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4290         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4291         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4292         to avoid unneeded links against $(LDADD).
4293         * testsuite/Makefile.in: Regenerate.
4294
4295 2010-12-15  Ian Lance Taylor  <iant@google.com>
4296
4297         PR gold/12324
4298         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4299         for R_X86_64_32 and R_X86_64_PC32.
4300         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4301         ver_matching_def_pic.o.
4302         (ver_matching_def_pic.o): New target.
4303
4304 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4305
4306         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4307         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4308         Move definition before File_read::View member definitions.
4309         (File_read::View::~View): Initialize and hold lock before
4310         updating current_mapped_bytes.
4311
4312 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4313
4314         * dwarf_reader.cc: Remove outdated comment.
4315         * gold-threads.cc: Fix typo in error message.
4316         * archive.cc: Fix typos in comments.
4317         * archive.h: Likewise.
4318         * arm-reloc-property.cc: Likewise.
4319         * arm-reloc-property.h: Likewise.
4320         * arm-reloc.def: Likewise.
4321         * arm.cc: Likewise.
4322         * attributes.h: Likewise.
4323         * cref.cc: Likewise.
4324         * ehframe.cc: Likewise.
4325         * fileread.h: Likewise.
4326         * gold.h: Likewise.
4327         * i386.cc: Likewise.
4328         * icf.cc: Likewise.
4329         * incremental.h: Likewise.
4330         * int_encoding.cc: Likewise.
4331         * layout.h: Likewise.
4332         * main.cc: Likewise.
4333         * merge.h: Likewise.
4334         * object.cc: Likewise.
4335         * object.h: Likewise.
4336         * options.cc: Likewise.
4337         * readsyms.cc: Likewise.
4338         * reduced_debug_output.cc: Likewise.
4339         * reloc.cc: Likewise.
4340         * script-sections.cc: Likewise.
4341         * sparc.cc: Likewise.
4342         * symtab.h: Likewise.
4343         * target-reloc.h: Likewise.
4344         * target.cc: Likewise.
4345         * target.h: Likewise.
4346         * timer.cc: Likewise.
4347         * timer.h: Likewise.
4348         * x86_64.cc: Likewise.
4349
4350 2010-12-09  Cary Coutant  <ccoutant@google.com>
4351
4352         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4353         stack.
4354         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4355         parameter; change all callers.
4356         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4357         * options.h (warn_execstack): New option.
4358
4359 2010-12-07  Doug Kwan  <dougkwan@google.com>
4360
4361         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4362         like function call relocations.
4363
4364 2010-12-07  Ian Lance Taylor  <iant@google.com>
4365
4366         * archive.cc (Archive::get_elf_object_for_member): Permit
4367         punconfigured to be NULL.
4368         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4369         (Archive::include_member): Pass NULL to get_elf_object_for_member
4370         if we searched for the archive and this is the first included
4371         object.
4372
4373 2010-12-01  Ian Lance Taylor  <iant@google.com>
4374
4375         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4376         track_relocs_type_ field.
4377         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4378         Set track_relocs_type_.
4379         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4380         contents when using RELA relocs.
4381         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4382         reloc_map_.
4383         * reloc.cc (Track_relocs::next_addend): New function.
4384         * reloc.h (class Track_relocs): Declare next_addend.
4385
4386 2010-12-01  Ian Lance Taylor  <iant@google.com>
4387
4388         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4389         virtual destructor.
4390
4391 2010-12-01  Ian Lance Taylor  <iant@google.com>
4392
4393         * README: Update compilers known to work and fail.
4394
4395 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4396
4397         * configure.in: For --enable-gold, handle value `default' instead of
4398         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4399         not the default.
4400         * configure: Regenerate.
4401
4402 2010-11-18  Doug Kwan  <dougkwan@google.com>
4403
4404         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4405         and right_alignment to be zero.  Store result alignment only if it is
4406         greater than existing alignment.
4407
4408 2010-11-16  Cary Coutant  <ccoutant@google.com>
4409
4410         PR gold/12220
4411         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4412         Check for ".zdebug_line".
4413
4414 2010-11-16  Doug Kwan  <dougkwan@google.com>
4415             Cary Coutant  <ccoutant@google.com>
4416
4417         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4418         by reference; adjust all callers.
4419         * output.cc (Output_segment::set_section_addresses): Adjust references
4420         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4421         list is empty.
4422         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4423         end at page boundary.
4424
4425 2010-11-16  Cary Coutant  <ccoutant@google.com>
4426
4427         PR gold/12220
4428         * layout.cc (Layout::choose_output_section): Transform names of
4429         compressed sections even when using a script with a SECTIONS clause.
4430         (Layout::output_section_name): Remove code to transform
4431         compressed debug section names.
4432         * output.cc (Output_section::add_input_section): Use uncompressed
4433         section size when tracking input sections.
4434
4435 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4436
4437         * symtab.h (Symbol::NON_PIC_REF): Remove.
4438         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4439         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4440         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4441         (Symbol::use_plt_offset): Take a flags argument and pass it
4442         directly to needs_dynamic_reloc.  Restrict check for undefined
4443         weak symbols to function calls.
4444         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4445         (Target_arm::Scan::global): Use it.
4446         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4447         (Target_arm::Relocate::relocate): Likewise.
4448         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4449         parameter with an r_type parameter.  Use get_reference_flags
4450         to get the flags.
4451         (Target_arm::Relocate::relocate): Update accordingly.
4452         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4453         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4454         (Target_i386::Scan::global): Likewise.
4455         (Target_i386::Relocate::relocate): Likewise.
4456         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4457         parameter with an r_type parameter.  Use get_reference_flags
4458         to get the flags.
4459         (Target_i386::Relocate::relocate): Update accordingly.
4460         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4461         (Target_powerpc::Scan::global): Use it.
4462         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4463         (Target_powerpc::Relocate::relocate): Likewise.
4464         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4465         (Target_sparc::Scan::global): Use it.
4466         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4467         (Target_sparc::Relocate::relocate): Likewise.
4468         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4469         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4470         (Target_x86_64::Scan::global): Likewise.
4471         (Target_x86_64::Relocate::relocate): Likewise.
4472
4473 2010-11-08  Doug Kwan  <dougkwan@google.com>
4474             Cary Coutant  <ccoutant@google.com>
4475
4476         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4477         (Arm_exidx_merge_section::section_contents_): New data member.
4478         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4479         (Arm_input_section::~Arm_input_section): De-allocate memory.
4480         (Arm_input_section::original_contents_): New data member.
4481         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4482         in parameters instead of calling Object::section_contents without
4483         locking.
4484         (Arm_output_section::group_section): New parameter TASK.  Pass it
4485         to callees that need locking objects.
4486         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4487         to lock EXIDX input sections.  Fix a formatting issue.  Call
4488         Arm_exidx_merged_section::build_contents to create merged section
4489         contents.
4490         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4491         to lock object of stub table owner.
4492         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4493         TEXT_SIZE to initialize data member TEXT_SIZE_.
4494         (Arm_exidx_input_section::addralign): Fix typo in comment.
4495         (Arm_exidx_input_section::text_size): New method.
4496         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4497         that require locking objects.  Lock objects before scanning for stubs
4498         and updating local symbols.
4499         (Arm_input_section<big_endian>::init): Copy contents of original
4500         input section.
4501         (Arm_input_section<big_endian>::do_write): Use saved contents of
4502         original input section instead of calling Object::section_contents
4503         without locking.
4504         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4505         size without calling Object::section_size().
4506         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4507         for size.  Allocate a buffer for merged EXIDX entries.
4508         (Arm_exidx_merged_section::build_contents): New method.
4509         (Arm_exidx_merged_section::do_write): Move merge section contents
4510         building code to Arm_exidx_merged_section::build_contetns.  Write
4511         out contetns in buffer instead of building it on the fly.
4512         (Arm_relobj::make_exidx_input_section): Also pass text section size
4513         to Arm_exidx_input_section constructor.
4514         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4515         (Arm_dynobj::do_read_symbols): Fix memory leak.
4516         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4517         * target.h: (class Task): Add forward declaration.
4518         (Target::relax): Add new parameter TASK and pass it to
4519         Target::do_relax().
4520         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4521
4522 2010-11-05  Cary Coutant  <ccoutant@google.com>
4523
4524         PR gold/10708
4525         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4526         object when reading from the file.
4527         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4528         second layout pass.
4529         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4530         when reading section contents.
4531         (get_section_contents): Likewise.
4532         (icf::find_identical_sections): Likewise.
4533         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4534         object when reading from the file.
4535         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4536         the object when doing deferred section layout.
4537
4538 2010-11-03  Nick Clifton  <nickc@redhat.com>
4539
4540         PR gold/12001
4541         * script.h (class Symbol_assignment: name): New member.  Returns
4542         the name of the symbol.
4543         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4544         Returns true if the given symbol name is on the list of
4545         assignments wating to be processed.
4546         * archive.cc (should_incldue_member): If the symbol is undefined,
4547         check to see if it is on the list of symbols pending assignment.
4548
4549 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4550
4551         * script-sections.cc (Script_sections::find_memory_region): Check
4552         for a NULL output section pointer.
4553
4554 2010-10-29  Doug Kwan  <dougkwan@google.com>
4555
4556         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4557         Output_section::add_relaxed_input_section.
4558         * output.cc (Output_section::add_relaxed_input_section): Add new
4559         arguments LAYOUT and NAME.  Set section order index.
4560         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4561         Copy section order index.
4562         * output.h (Output_section::add_relaxed_input_section): Add new
4563         arguments LAYOUT and NAME.
4564
4565 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4566
4567         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4568         NATIVE_OR_CROSS_LINKER.
4569         * testsuite/Makefile.in: Regenerate.
4570
4571 2010-10-20  Doug Kwan  <dougkwan@google.com>
4572
4573         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4574         without SHF_LINK_ORDER flags.
4575         * layout.cc (Layout::choose_output_section): Do not filter
4576         SHF_LINK_ORDER flag in a relocatable link.
4577
4578 2010-10-17  Cary Coutant  <ccoutant@google.com>
4579
4580         * output.h (Output_segment::set_section_addresses): Change function
4581         signature.  Update all callers.
4582         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4583         sections.
4584         (Output_segment::set_section_addresses): Align after last TLS
4585         section.  Add padding before last relro section instead of after.
4586
4587 2010-10-17  Doug Kwan  <dougkwan@google.com>
4588
4589         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4590         GOT output section to be writable.
4591
4592 2010-10-14  Cary Coutant  <ccoutant@google.com>
4593
4594         * debug.h (DEBUG_INCREMENTAL): New flag.
4595         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4596         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4597         mode.
4598         * incremental.cc (report_command_line): Ignore all forms of
4599         --incremental.
4600         * layout.cc (Layout::Layout): Check parameters for incremental link
4601         mode.
4602         * options.cc (General_options::parse_incremental): New function.
4603         (General_options::parse_no_incremental): New function.
4604         (General_options::parse_incremental_full): New function.
4605         (General_options::parse_incremental_update): New function.
4606         (General_options::incremental_mode_): New data member.
4607         (General_options::finalize): Check incremental_mode_.
4608         * options.h (General_options): Update help text for --incremental.
4609         Add --no-incremental, --incremental-full, --incremental-update.
4610         (General_options::Incremental_mode): New enum type.
4611         (General_options::incremental_mode): New function.
4612         (General_options::incremental_mode_): New data member.
4613         * parameters.cc (Parameters::incremental_mode_): New data member.
4614         (Parameters::set_options): Set incremental_mode_.
4615         (Parameters::set_incremental_full): New function.
4616         (Parameters::incremental): New function.
4617         (Parameters::incremental_update): New function.
4618         (set_parameters_incremental_full): New function.
4619         * parameters.h (Parameters::set_incremental_full): New function.
4620         (Parameters::incremental): New function.
4621         (Parameters::incremental_update): New function.
4622         (Parameters::incremental_mode_): New data member.
4623         (set_parameters_incremental_full): New function.
4624         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4625         incremental link mode.
4626         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4627         (Sized_relobj::do_relocate_sections): Likewise.
4628         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4629         option.
4630         * testsuite/Makefile.in: Regenerate.
4631         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4632
4633 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4634
4635         * script-sections.h (class Script_sections): Make
4636         Sections_elements typedef public.
4637         * script-sections.cc (class Sort_output_sections): Add elements_
4638         field.  Add constructor which sets it; change all callers.
4639         (Sort_output_sections::is_before): New function.
4640         (Sort_output_sections::operator()): Call is_before.
4641         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4642         conditional.
4643         * testsuite/script_test_10.sh: New test. Test script section
4644         order.
4645         * testsuite/script_test_10.t: Likewise.
4646         * testsuite/script_test_10.s: Likewise.
4647         * testsuite/Makefile.am: Wrap the cross linker tests and the
4648         common tests into NATIVE_OR_CROSS_LINKER.
4649         (check_SCRIPTS): Add script_test_10.sh.
4650         (check_DATA): Add script_test_10.stdout.
4651         (script_test_10.o, script_test_10): New targets.
4652         (script_test_10.stdout): New target.
4653         * configure, testsuite/Makefile.in: Regenerate.
4654
4655 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4656
4657         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4658         error for the deprecated relocations.
4659         (Target_arm::Scan::global): Likewise.
4660         (Target_arm::Relocate::relocate): Likewise.
4661
4662 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4663
4664         * fileread.cc (Input_file::find_file): Initialize *found_name
4665         and *namep when using the fallback search for case 4.
4666
4667 2010-10-11  Cary Coutant  <ccoutant@google.com>
4668
4669         * options.h (class General_options): Redefine -z lazy as an alias for
4670         the negation of -z now.
4671
4672 2010-10-11  Ian Lance Taylor  <iant@google.com>
4673
4674         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4675         binding.
4676
4677 2010-10-06  Nick Clifton  <nickc@redhat.com>
4678
4679         * script-sections.cc(class Memory_region): Remove
4680         current_lma_offset_ field.  Rename current_vma_offset_ to
4681         current_offset_.  Add last_section_ field.
4682         (Memory_region::get_current_vma_address): Rename to
4683         get_current_address.
4684         (Memory_region::get_current_lma_address): Delete.
4685         (Memory_region::increment_vma_offset): Rename to
4686         increment_offset.
4687         (Memory_region::increment_lma_offset): Delete.
4688         (Memory_region::attributes_compatible): New method.  Returns
4689         true if the provided section is compatible with the region.
4690         (Memory_region::get_last_section): New method.  Returns the last
4691         section to use the region.
4692         (Memory_region::set_last_section): New method.  Stores the last
4693         section to use the region.
4694         (Script_sections::block_in_region): New method.  Returns true if
4695         a block of memory is contained within a region.
4696         (Script_sections::find_memory_region): New method.  Locates a
4697         memory region to be used to set a VMA or LMA address.
4698         (Output_section_definition::set_section_addresses): Add code to
4699         check for addresses set by memory regions.
4700         (Output_segment::set_section_addresses): Remove memory region
4701         walking code.
4702         (Script_sections::create_segment): Add a warning if a header
4703         segment is created outside of any region.
4704         * script-sections.h (class Script_sections): Add prototypes for
4705         find_memory_region and block_in_region methods.
4706         * testsuite/memory_test.s: Use .long instead of .word.
4707         * testsuite/memory_test.t: Add some more output sections.
4708         * testsuite/memory_test.sh: Update expected output.
4709
4710 2010-10-02  Doug Kwan  <dougkwan@google.com>
4711
4712         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4713         defintion to symtab.h
4714         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4715         declaration to defintion.
4716
4717 2010-10-01  Nick Clifton  <nickc@redhat.com>
4718
4719         * expression.cc (eval): Replace dummy argument with NULL.
4720         (eval_maybe_dot): Check for a NULL result section pointer.
4721         (Symbol_expression::value): Likewise.
4722         (Dot_expression::value): Likewise.
4723         (BINARY_EXPRESSION): Likewise.
4724         (Max_expression::value): Likewise.
4725         (Min_expression::value): Likewise.
4726         (Absolute_expression::value): Likewise.
4727         (Addr_expression::value_from_output_section): Likewise.
4728         (Loaddddr_expression::value_from_output_section): Likewise.
4729         (Segment_start_expression::value): Likewise.
4730         * script-sections.cc
4731         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4732         argument with NULL.
4733         (Sections_elememt_dot_assignment::set_section_addresses):
4734         Likewise.
4735         (Output_data_expression::do_write_to_buffer): Likewise.
4736         (Output_section_definition::finalize_symbols): Likewise.
4737         (Output_section_definition::set_section_addresses): Likewise.
4738
4739 2010-09-30  Doug Kwan  <dougkwan@google.com>
4740
4741         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4742
4743 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4744
4745         * target.h (Target::can_icf_inline_merge_sections): New virtual
4746         function.
4747         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4748         virtual function.
4749         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4750         virtual function.
4751         * icf.cc (get_section_contents): Inline merge sections only when
4752         target allows it.
4753
4754 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4755
4756         * configure: Regenerate.
4757
4758 2010-09-17  Ian Lance Taylor  <iant@google.com>
4759
4760         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4761         * testsuite/Makefile.am (memory_test.o): New target.
4762         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4763         memory_test.t.
4764         * testsuite/Makefile.in: Rebuild.
4765
4766 2010-09-17  Doug Kwan  <dougkwan@google.com>
4767
4768         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4769         defintion if relocation uses GOT entries of the symbol.
4770         * testsuite/icf_safe_test.sh: Fix test.
4771         * testsuite/icf_safe_so_test.sh: Fix test.
4772
4773 2010-09-16  Cary Coutant  <ccoutant@google.com>
4774
4775         * script_sections.cc (class Memory_region): Remove "NULL" from
4776         vector initializations.
4777
4778 2010-09-15  Cary Coutant  <ccoutant@google.com>
4779
4780         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4781         Resolve forwarding symbols.
4782
4783 2010-09-15  Doug Kwan  <dougkwan@google.com>
4784
4785         * gold/testsuite/script_test_3.t: Add ARM special sections.
4786         * gold/testsuite/script_test_4.t: Same.
4787         * gold/testsuite/script_test_5.t: Same.
4788         * gold/testsuite/script_test_6.t: Same.
4789         * gold/testsuite/script_test_7.t: Same.
4790         * gold/testsuite/script_test_7.t: Same.
4791         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4792
4793 2010-09-14  Cary Coutant  <ccoutant@google.com>
4794
4795         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4796         (Target_x86_64::Relocate::relocate_tls): Replace check for
4797         saw_tls_block_reloc_ with test for executable section.
4798
4799 2010-09-12  Cary Coutant  <ccoutant@google.com>
4800
4801         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4802         position-independent executables to shared libraries need dynamic
4803         relocations.
4804         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4805         position-independent executables.
4806         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4807         * testsuite/Makefile.in: Regenerate.
4808
4809 2010-09-10  Nick Clifton  <nickc@redhat.com>
4810
4811         PR gold/11997
4812         * testsuite/memory_test.t: Discard any sections that are not
4813         needed.
4814
4815 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4816
4817         PR gold/11996
4818         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4819         "This::" to work around a bug in gcc 4.2.
4820
4821         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4822
4823 2010-09-09  Rafael Espindola  <espindola@google.com>
4824
4825         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4826         sections with different PF_X flags in the same segment.
4827         (Layout::find_first_load_seg): Search all segments to find the first
4828         one.
4829         * options.h (rosegment): New.
4830
4831 2010-09-08  Rafael Espindola  <espindola@google.com>
4832
4833         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4834
4835 2010-09-08  Doug Kwan  <dougkwan@google.com>
4836
4837         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4838         (Arm_relobj::do_relocate_sections): Add new parameter for output
4839         file to match the parent.
4840         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4841         of local symbols instead of input values.  Update code to track
4842         changes in gold::relocate_section.
4843         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4844         (Sized_relobj::compute_final_local_value_internal): New methods.
4845         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4846         body into private version of Sized_relobj::compute_final_local_value.
4847         Call the inline method.
4848         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4849         merged symbol value if there is one.
4850         (Symbol_value::has_output_value): New method defintiion.
4851         (Sized_relobj::Compute_final_local_value_status): New enum type.
4852         (Sized_relobj::compute_final_local_value): New methods.
4853         (Sized_relobj::compute_final_local_value_internal): New methods.
4854         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4855         and arm_cortex_a8.sh.
4856         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4857         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4858         New tests.
4859         * Makefile.in: Regenerate.
4860         * testsuite/arm_bl_out_of_range.s: Update test.
4861         * testsuite/thumb_bl_out_of_range.s: Ditto.
4862         * testsuite/thumb_blx_out_of_range.s: Ditto.
4863         * testsuite/arm_branch_out_of_range.sh: New file.
4864         * testsuite/arm_cortex_a8.sh: Ditto.
4865         * testsuite/arm_cortex_a8_b.s: Ditto.
4866         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4867         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4868         * testsuite/arm_cortex_a8_bl.s: Ditto.
4869         * testsuite/arm_cortex_a8_blx.s: Ditto.
4870         * testsuite/arm_cortex_a8_local.s: Ditto.
4871         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4872         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4873
4874 2010-09-08  Rafael Espindola  <espindola@google.com>
4875
4876         * Makefile.am (memory_test.stdout): Run readelf with -W.
4877         * Makefile.in: Regenerate.
4878         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4879         64 bit output.
4880
4881 2010-09-08  Rafael Espindola  <espindola@google.com>
4882
4883         * script-sections.cc (Script_sections::add_memory_region): Convert
4884         field precision to int.
4885         * script.cc (script_set_section_region, script_set_section_region):
4886         Convert field precision to int.
4887
4888 2010-09-08  Rafael Espindola  <espindola@google.com>
4889
4890         * arm.cc (do_finalize_sections): Create the __exidx_start and
4891         __exdix_end symbols even when the section is missing.
4892
4893 2010-09-08  Nick Clifton  <nickc@redhat.com>
4894
4895         * README: Remove claim that MEMORY is not supported.
4896         * expression.cc (script_exp_function_origin)
4897         (script_exp_function_length): Move from here to ...
4898         * script.cc: ... here.
4899         (script_set_section_region, script_add_memory)
4900         (script_parse_memory_attr, script_include_directive): New
4901         functions.
4902         * script-sections.cc
4903         (class Memory_region): New class.
4904         (class Output_section_definition): Add set_memory_region,
4905         set_section_vma, set_section_lma and get_section_name methods.
4906         (class Script_Sections): Add add_memory_region,
4907         find_memory_region, find_memory_region_origin,
4908         find_memory_region_length and set_memory_region methods.
4909         Have set_section_addresses method walk the list of set memory
4910         regions.
4911         Extend the print methos to display memory regions.
4912         * script-sections.h: Add prototypes for new methods.
4913         Add enum for MEMORY region attributes.
4914         * yyscript.y: Add support for parsing MEMORY regions.
4915         * script-c.h: Add prototypes for new functions.
4916         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4917         * testsuite/Makefile.in: Regenerate.
4918         * testsuite/memory_test.sh: New script.
4919         * testsuite/memory_test.s: New assembler source file.
4920         * testsuite/memory_test.t: New linker script.
4921
4922 2010-08-27  Doug Kwan  <dougkwan@google.com>
4923
4924         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4925         reference override an existing dynamic weak reference.
4926         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4927         * testsuite/Makefile.in: Regenerate.
4928         * testsuite/dyn_weak_ref.sh: New file.
4929         * testsuite/dyn_weak_ref_1.c: Ditto.
4930         * testsuite/dyn_weak_ref_2.c: Ditto.
4931
4932 2010-08-27  Ian Lance Taylor  <iant@google.com>
4933
4934         * incremental.h (class Incremental_input_entry): Add virtual
4935         destructor.
4936
4937 2010-08-27  Ian Lance Taylor  <iant@google.com>
4938
4939         * testsuite/start_lib_test_3.c: Mark t3 as used.
4940
4941 2010-08-27  Nick Clifton  <nickc@redhat.com>
4942
4943         * options.cc (version_script): Fix small typo in previous
4944         whitespace tidyup.
4945
4946 2010-08-25  Nick Clifton  <nickc@redhat.com>
4947
4948         * archive.cc: Formatting fixes: Remove whitespace between
4949         typename and following asterisk.  Remove whitespace between
4950         function name and opening parenthesis.
4951         * archive.h: Likewise.
4952         * arm.cc: Likewise.
4953         * attributes.cc: Likewise.
4954         * attributes.h: Likewise.
4955         * common.cc: Likewise.
4956         * copy-relocs.cc: Likewise.
4957         * dirsearch.h: Likewise.
4958         * dynobj.cc: Likewise.
4959         * ehframe.cc: Likewise.
4960         * ehframe.h: Likewise.
4961         * expression.cc: Likewise.
4962         * fileread.cc: Likewise.
4963         * fileread.h: Likewise.
4964         * gc.h: Likewise.
4965         * gold-threads.cc: Likewise.
4966         * gold.cc: Likewise.
4967         * i386.cc: Likewise.
4968         * icf.h: Likewise.
4969         * incremental-dump.cc: Likewise.
4970         * incremental.cc: Likewise.
4971         * layout.cc: Likewise.
4972         * layout.h: Likewise.
4973         * main.cc: Likewise.
4974         * merge.cc: Likewise.
4975         * merge.h: Likewise.
4976         * object.cc: Likewise.
4977         * object.h: Likewise.
4978         * options.cc: Likewise.
4979         * options.h: Likewise.
4980         * output.cc: Likewise.
4981         * output.h: Likewise.
4982         * plugin.cc: Likewise.
4983         * plugin.h: Likewise.
4984         * powerpc.cc: Likewise.
4985         * reloc.cc: Likewise.
4986         * script-c.h: Likewise.
4987         * script-sections.cc: Likewise.
4988         * script.cc: Likewise.
4989         * stringpool.cc: Likewise.
4990         * symtab.cc: Likewise.
4991         * symtab.h: Likewise.
4992         * target.cc: Likewise.
4993         * timer.cc: Likewise.
4994         * timer.h: Likewise.
4995         * version.cc: Likewise.
4996         * x86_64.cc: Likewise.
4997
4998 2010-08-24  Nick Clifton  <nickc@redhat.com>
4999
5000         PR 11899
5001         * layout.cc (segment_precedes): Sort segments by their physical
5002         addresses, if they have been set.
5003
5004 2010-08-23  Cary Coutant  <ccoutant@google.com>
5005
5006         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5007         symbols data.
5008         (Lib_group::include_member): Unlock object after deleting its
5009         symbols data.
5010         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5011         the bug fixed here.
5012
5013 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5014             Cary Coutant  <ccoutant@google.com>
5015
5016         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5017         constructor, and set_blocker.
5018         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5019         readsyms_blocker_.
5020         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5021         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5022         * testsuite/Makefile.am (start_lib_test): New test case.
5023         * testsuite/Makefile.in: Regenerate.
5024         * testsuite/start_lib_test_main.c: New file.
5025         * testsuite/start_lib_test_1.c: New file.
5026         * testsuite/start_lib_test_2.c: New file.
5027         * testsuite/start_lib_test_3.c: New file.
5028
5029 2010-08-19  Ian Lance Taylor  <iant@google.com>
5030
5031         * Makefile.in: Rebuild with automake 1.11.1.
5032         * aclocal.m4: Likewise.
5033         * testsuite/Makefile.in: Likewise.
5034
5035 2010-08-19  Ian Lance Taylor  <iant@google.com>
5036
5037         PR 10893
5038         * i386.cc (class Output_data_plt_i386): Update declarations.
5039         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5040         local_ifuncs_ fields.
5041         (Target_i386::do_plt_section_for_global): New function.
5042         (Target_i386::do_plt_section_for_local): New function.
5043         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5044         parameter; change all callers.  Initialize global_ifuncs_ and
5045         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5046         __rel_iplt_end.
5047         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5048         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5049         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5050         symbols.
5051         (Target_i386::make_plt_section): New function, broken out of
5052         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5053         (Target_i386::make_plt_entry): Call make_plt_section.
5054         (Target_i386::make_local_ifunc_plt_entry): New function.
5055         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5056         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5057         R_386_IRELATIVE to switch.
5058         (Target_i386::Scan::global): Likewise.
5059         (Target_i386::Relocate::relocate): Likewise.
5060         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5061         switch.
5062         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5063         (Target_x86_64::do_plt_section_for_global): New function.
5064         (Target_x86_64::do_plt_section_for_local): New function.
5065         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5066         parameter; change all callers.  If doing a static link define
5067         __rela_iplt_start and __rela_iplt_end.
5068         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5069         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5070         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5071         to point to .plt.
5072         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5073         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5074         switch.
5075         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5076         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5077         R_X86_64_IRELATIVE to switch.
5078         (Target_x86_64::Scan::global): Likewise.
5079         (Target_x86_64::Relocate::relocate): Likewise.
5080         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5081         switch.
5082         * target.h (class Target): Add plt_section_for_global and
5083         plt_section_for_local functions.  Add do_plt_section_for_global
5084         and do_plt_section_for_local virtual functions.
5085         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5086         clarifying comments.
5087         (Symbol::use_plt_offset): Handle IFUNC symbol.
5088         * object.cc (Sized_relobj::Sized_relobj): Initialize
5089         local_plt_offsets_.
5090         (Sized_relobj::local_has_plt_offset): New function.
5091         (Sized_relobj::local_plt_offset): New function.
5092         (Sized_relobj::set_local_plt_offset): New function.
5093         (Sized_relobj::do_count): Handle IFUNC symbol.
5094         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5095         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5096         is_ifunc_symbol functions.
5097         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5098         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5099         local_plt_offsets_ field.
5100         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5101         * output.h (class Output_section_data): Add non-const
5102         output_section function.
5103         (class Output_data_got): Update declarations.
5104         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5105         Add use_plt_offset parameter to global and local constructors.
5106         Change all callers.  Change local_sym_index_ field to 31 bits.
5107         Change GSYM_CODE and CONSTANT_CODE accordingly.
5108         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5109         doing a static link don't set sh_link field.
5110         (Output_data_got::Got_entry::write): Use PLT offset if
5111         appropriate.
5112         (Output_data_got::add_global_plt): New function.
5113         (Output_data_got::add_local_plt): New function.
5114         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5115         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5116         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5117         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5118         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5119         IFUNC conditional.
5120         * testsuite/ifunc-sel.h: New file.
5121         * testsuite/ifuncmain1.c: New file.
5122         * testsuite/ifuncmain1vis.c: New file.
5123         * testsuite/ifuncmod1.c: New file.
5124         * testsuite/ifuncdep2.c: New file.
5125         * testsuite/ifuncmain2.c: New file.
5126         * testsuite/ifuncmain3.c: New file.
5127         * testsuite/ifuncmod3.c: New file.
5128         * testsuite/ifuncmain4.c: New file.
5129         * testsuite/ifuncmain5.c: New file.
5130         * testsuite/ifuncmod5.c: New file.
5131         * testsuite/ifuncmain6pie.c: New file.
5132         * testsuite/ifuncmod6.c: New file.
5133         * testsuite/ifuncmain7.c: New file.
5134         * configure, testsuite/Makefile.in: Rebuild.
5135
5136 2010-08-18  Ian Lance Taylor  <iant@google.com>
5137
5138         * incremental.cc
5139         (Output_section_incremental_inputs::write_input_files): Add cast
5140         to avoid signed/unsigned comparison warning.
5141         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5142
5143 2010-08-12  Cary Coutant  <ccoutant@google.com>
5144
5145         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5146
5147 2010-08-13  Ian Lance Taylor  <iant@google.com>
5148
5149         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5150
5151 2010-08-12  Cary Coutant  <ccoutant@google.com>
5152             Doug Kwan  <dougkwan@google.com>
5153
5154         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5155         defintion overrides non-weak undef, remember that the original undef
5156         is not weak.
5157         * symtab.cc (Symbol_table::sized_write_global): For undef without
5158         an original weak binding, set binding to global in output.
5159         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5160         * testsuite/Makefile.in: Regenerate.
5161         * testsuite/strong_ref_weak_def.sh: New file.
5162         * testsuite/strong_ref_weak_def_1.c: Ditto.
5163         * testsuite/strong_ref_weak_def_2.c: Ditto.
5164
5165 2010-08-12  Cary Coutant  <ccoutant@google.com>
5166
5167         * testsuite/incremental_test.sh: Rewrite.
5168         * testsuite/incremental_test_1.c: Rewrite.
5169         * testsuite/incremental_test_2.c: Rewrite.
5170
5171 2010-08-12  Cary Coutant  <ccoutant@google.com>
5172
5173         * arm.cc (Target_arm::got_size): Add const.
5174         (Target_arm::got_entry_count): New function.
5175         (Target_arm::plt_entry_count): New function.
5176         (Target_arm::first_plt_entry_offset): New function.
5177         (Target_arm::plt_entry_size): New function.
5178         (Output_data_plt_arm::entry_count): New function.
5179         (Output_data_plt_arm::first_plt_entry_offset): New function.
5180         (Output_data_plt_arm::get_plt_entry_size): New function.
5181         * i386.cc (Target_i386::got_size): Add const.
5182         (Target_i386::got_entry_count): New function.
5183         (Target_i386::plt_entry_count): New function.
5184         (Target_i386::first_plt_entry_offset): New function.
5185         (Target_i386::plt_entry_size): New function.
5186         (Output_data_plt_i386::entry_count): New function.
5187         (Output_data_plt_i386::first_plt_entry_offset): New function.
5188         (Output_data_plt_i386::get_plt_entry_size): New function.
5189         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5190         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5191         * incremental.cc: Include target.h.
5192         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5193         parameter.  Adjust all callers.  Find incremental_got_plt section.
5194         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5195         section.
5196         (Output_section_incremental_inputs::set_final_data_size): Calculate
5197         size of incremental_got_plt section.
5198         (Output_section_incremental_inputs::do_write): Write the
5199         incremental_got_plt section.
5200         (Got_plt_view_info): New struct.
5201         (Local_got_offset_visitor): New class.
5202         (Global_got_offset_visitor): New class.
5203         (Global_symbol_visitor_got_plt): New class.
5204         (Output_section_incremental_inputs::write_got_plt): New function.
5205         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5206         Add parameter.  Adjust all callers.
5207         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5208         (Incremental_inputs::got_plt_section): New function.
5209         (Incremental_inputs::got_plt_section_): New data member.
5210         (Incremental_got_plt_reader): New class.
5211         * layout.cc (Layout::create_incremental_info_sections): Add the
5212         incremental_got_plt section.
5213         * object.h (Got_offset_list::get_list): New function.
5214         (Got offset_list::for_all_got_offsets): New function.
5215         (Sized_relobj::local_got_offset_list): New function.
5216         * powerpc.cc (Target_powerpc::got_size): Add const.
5217         (Target_powerpc::got_entry_count): New function.
5218         (Target_powerpc::plt_entry_count): New function.
5219         (Target_powerpc::first_plt_entry_offset): New function.
5220         (Target_powerpc::plt_entry_size): New function.
5221         (Output_data_plt_powerpc::entry_count): New function.
5222         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5223         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5224         * sparc.cc (Target_sparc::got_size): Add const.
5225         (Target_sparc::got_entry_count): New function.
5226         (Target_sparc::plt_entry_count): New function.
5227         (Target_sparc::first_plt_entry_offset): New function.
5228         (Target_sparc::plt_entry_size): New function.
5229         (Output_data_plt_sparc::entry_count): New function.
5230         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5231         (Output_data_plt_sparc::get_plt_entry_size): New function.
5232         * symtab.h (Symbol::got_offset_list): New function.
5233         (Symbol_table::for_all_symbols): New function.
5234         * target.h (Sized_target::got_entry_count): New function.
5235         (Sized_target::plt_entry_count): New function.
5236         (Sized_target::plt_entry_size): New function.
5237         * x86_64.cc (Target_x86_64::got_size): Add const.
5238         (Target_x86_64::got_entry_count): New function.
5239         (Target_x86_64::plt_entry_count): New function.
5240         (Target_x86_64::first_plt_entry_offset): New function.
5241         (Target_x86_64::plt_entry_size): New function.
5242         (Output_data_plt_x86_64::entry_count): New function.
5243         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5244         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5245
5246 2010-08-12  Cary Coutant  <ccoutant@google.com>
5247
5248         * archive.cc: Include incremental.h.
5249         (Archive::Archive): Initialize incremental_info_.
5250         (Archive::include_member): Record archive members in incremental info.
5251         (Add_archive_symbols::run): Record begin and end of an archive in
5252         incremental info.
5253         (Lib_group::include_member): Record objects in incremental info.
5254         * archive.h (Incremental_archive_entry): Forward declaration.
5255         (Archive::set_incremental_info): New member function.
5256         (Archive::incremental_info): New member function.
5257         (Archive::Unused_symbol_iterator): New class.
5258         (Archive::unused_symbols_begin): New member function.
5259         (Archive::unused_symbols_end): New member function.
5260         (Archive::incremental_info_): New data member.
5261         * incremental-dump.cc (find_input_containing_global): New function.
5262         (dump_incremental_inputs): Dump new incremental info sections.
5263         * incremental.cc: Include symtab.h.
5264         (Output_section_incremental_inputs): New class.
5265         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5266         new incremental info sections.
5267         (Sized_incremental_binary::do_check_inputs): Likewise.
5268         (Incremental_inputs::report_archive): Remove.
5269         (Incremental_inputs::report_archive_begin): New function.
5270         (Incremental_inputs::report_archive_end): New function.
5271         (Incremental_inputs::report_object): New function.
5272         (Incremental_inputs::finalize_inputs): Remove.
5273         (Incremental_inputs::report_input_section): New function.
5274         (Incremental_inputs::report_script): Rewrite.
5275         (Incremental_inputs::finalize): Do nothing but finalize string table.
5276         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5277         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5278         (Incremental_inputs::create_data_sections): New function.
5279         (Incremental_inputs::relocs_entsize): New function.
5280         (Output_section_incremental_inputs::set_final_data_size): New function.
5281         (Output_section_incremental_inputs::do_write): New function.
5282         (Output_section_incremental_inputs::write_header): New function.
5283         (Output_section_incremental_inputs::write_input_files): New function.
5284         (Output_section_incremental_inputs::write_info_blocks): New function.
5285         (Output_section_incremental_inputs::write_symtab): New function.
5286         * incremental.h (Incremental_script_entry): Forward declaration.
5287         (Incremental_object_entry): Forward declaration.
5288         (Incremental_archive_entry): Forward declaration.
5289         (Incremental_inputs): Forward declaration.
5290         (Incremental_inputs_header_data): Remove.
5291         (Incremental_inputs_header): Remove.
5292         (Incremental_inputs_header_write): Remove.
5293         (Incremental_inputs_entry_data): Remove.
5294         (Incremental_inputs_entry): Remove.
5295         (Incremental_inputs_entry_write): Remove.
5296         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5297         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5298         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5299         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5300         Likewise.
5301         (Incremental_input_entry): New class.
5302         (Incremental_script_entry): New class.
5303         (Incremental_object_entry): New class.
5304         (Incremental_archive_entry): New class.
5305         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5306         (Incremental_inputs::report_inputs): Remove.
5307         (Incremental_inputs::report_archive): Remove.
5308         (Incremental_inputs::report_archive_begin): New function.
5309         (Incremental_inputs::report_archive_end): New function.
5310         (Incremental_inputs::report_object): Change prototype.
5311         (Incremental_inputs::report_input_section): New function.
5312         (Incremental_inputs::report_script): Change prototype.
5313         (Incremental_inputs::get_reloc_count): New function.
5314         (Incremental_inputs::set_reloc_count): New function.
5315         (Incremental_inputs::create_data_sections): New function.
5316         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5317         (Incremental_inputs::inputs_section): New function.
5318         (Incremental_inputs::symtab_section): New function.
5319         (Incremental_inputs::relocs_section): New function.
5320         (Incremental_inputs::get_stringpool): Add const.
5321         (Incremental_inputs::command_line): Add const.
5322         (Incremental_inputs::inputs): Remove.
5323         (Incremental_inputs::command_line_key): New function.
5324         (Incremental_inputs::input_file_count): New function.
5325         (Incremental_inputs::input_files): New function.
5326         (Incremental_inputs::relocs_entsize): New function.
5327         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5328         (Incremental_inputs::finalize_inputs): Remove.
5329         (Incremental_inputs::Input_info): Remove.
5330         (Incremental_inputs::lock_): Remove.
5331         (Incremental_inputs::inputs_): Change type.
5332         (Incremental_inputs::inputs_map_): Remove.
5333         (Incremental_inputs::current_object_entry_): New data member.
5334         (Incremental_inputs::inputs_section_): New data member.
5335         (Incremental_inputs::symtab_section_): New data member.
5336         (Incremental_inputs::relocs_section_): New data member.
5337         (Incremental_inputs::reloc_count_): New data member.
5338         (Incremental_inputs_reader): New class.
5339         (Incremental_symtab_reader): New class.
5340         (Incremental_relocs_reader): New class.
5341         * layout.cc (Layout::finalize): Move finalization of incremental info
5342         and creation of incremental info sections to follow finalization of
5343         symbol table.  Set offsets for postprocessing sections.
5344         (Layout::create_incremental_info_sections): Call
5345         Incremental_inputs::create_data_sections.  Add incremental symtab
5346         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5347         sections to layout after input sections.
5348         * layout.h (struct Timespec): Forward declaration.
5349         (Layout::incremental_inputs): Add const.
5350         (Layout::create_incremental_info_sections): Add parameter.
5351         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5352         * object.cc: Include incremental.h.
5353         (Relobj::finalize_incremental_relocs): New function.
5354         (Sized_relobj::do_layout): Record input sections in incremental info.
5355         * object.h (Object::output_section): New function.
5356         (Object::output_section_offset): Moved from Relobj.
5357         (Object::get_incremental_reloc_base): New function.
5358         (Object::get_incremental_reloc_count): New function.
5359         (Object::do_output_section): New function.
5360         (Object::do_output_section_offset): Moved from Relobj.
5361         (Object::do_get_incremental_reloc_base): New function.
5362         (Object::do_get_incremental_reloc_count): New function.
5363         (Object::Object): Initialize new data members.
5364         (Relobj::output_section): Renamed do_output_section and moved to
5365         protected.
5366         (Relobj::output_section_offset): Moved to Object.
5367         (Relobj::do_get_incremental_reloc_base): New function.
5368         (Relobj::do_get_incremental_reloc_count): New function.
5369         (Relobj::allocate_incremental_reloc_counts): New function.
5370         (Relobj::count_incremental_reloc): New function.
5371         (Relobj::finalize_incremental_relocs): New function.
5372         (Relobj::next_incremental_reloc_index): New function.
5373         (Relobj::reloc_counts_): New data member.
5374         (Relobj::reloc_bases_): New data member.
5375         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5376         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5377         (Sized_relobj::incremental_relocs_scan): New function.
5378         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5379         (Sized_relobj::incremental_relocs_write): New function.
5380         (Sized_relobj::incremental_relocs_write_reltype): New function.
5381         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5382         incremental link.
5383         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5384         archives and object files elsewhere.
5385         (Add_symbols::run): Report object files here.
5386         (Finish_group::run): Report end of archive at end of group.
5387         * reloc.cc: Include layout.h, incremental.h.
5388         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5389         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5390         (Sized_relobj::incremental_relocs_scan): New function.
5391         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5392         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5393         (Sized_relobj::incremental_relocs_write): New function.
5394         (Sized_relobj::incremental_relocs_write_reltype): New function.
5395         * script.cc (read_input_script): Rewrite test for incremental link.
5396         Change call to Incremental_inputs::report_script.
5397         * symtab.h (Symbol_table::first_global_index): New function.
5398         (Symbol_table::output_count): New function.
5399
5400 2010-08-12  Doug Kwan  <dougkwan@google.com>
5401
5402         * arm.cc (Target_arm::merge_object_attributes): Check command line
5403         options --no-wchar-size-warning and --no-enum-size-warning.
5404         * options.h (General_options): Add ld-compatible options
5405         --no-enum-size-warning and --no-wchar-size-warning.
5406
5407 2010-08-04  Ian Lance Taylor  <iant@google.com>
5408
5409         * x86_64.cc (Target_x86_64::Scan::local): Use
5410         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5411         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5412         (Target_x86_64::Scan::global): Likewise.
5413         (Target_x86_64::Relocate::relocate): Likewise.
5414         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5415         Likewise.
5416
5417 2010-08-03  Cary Coutant  <ccoutant@google.com>
5418
5419         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5420         to reserve space in merged_strings vector. Keep total input size
5421         for stats.
5422         (Output_merge_string::do_print_merge_stats): Print total input size.
5423         * merge.h (Output_merge_string): Add input_size_ field.
5424         * stringpool.cc (Stringpool_template::string_length): Move
5425         implementations out of Stringpool_template class and place in
5426         stringpool.h.
5427         * stringpool.h (string_length): Move out of Stringpool_template.
5428
5429 2010-08-03  Ian Lance Taylor  <iant@google.com>
5430
5431         PR 11712
5432         * layout.cc (relaxation_loop_body): If address of load segment is
5433         set, adjust address to include headers if possible.
5434
5435 2010-08-03  Ian Lance Taylor  <iant@google.com>
5436
5437         * version.cc (version_string): Bump to 1.10.
5438
5439 2010-08-03  Ian Lance Taylor  <iant@google.com>
5440
5441         PR 11805
5442         * layout.h (enum Output_section_order): Define.
5443         (class Layout): Update declarations.
5444         * layout.cc (Layout::get_output_section): Add order parameter.
5445         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5446         is_first_non_relro parameters.  Change all callers.
5447         (Layout::choose_output_section): Likewise.
5448         (Layout::add_output_section_data): Likewise.
5449         (Layout::make_output_section): Likewise.  Set order.
5450         (Layout::default_section_order): New function.
5451         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5452         * output.cc (Output_section::Output_section): Initialize order_.
5453         Don't initialize deleted fields.
5454         (Output_segment::Output_segment): Don't initialize deleted
5455         fields.
5456         (Output_segment::add_output_section_to_load): New function
5457         replacing add_output_section.  Change all callers to call this or
5458         add_output_section_to_nonload.
5459         (Output_segment::add_output_section_to_nonload): New function.
5460         (Output_segment::remove_output_section): Rewrite.
5461         (Output_segment::add_initial_output_data): Likewise.
5462         (Output_segment::has_any_data_sections): Likewise.
5463         (Output_segment::is_first_section_relro): Likewise.
5464         (Output_segment::maximum_alignment): Likewise.
5465         (Output_segment::has_dynamic_reloc): New function replacing
5466         dynamic_reloc_count.  Change all callers.
5467         (Output_segment::has_dynamic_reloc_list): New function replacing
5468         dynamic_reloc_count_list.  Change all callers.
5469         (Output_segment::set_section_addresses): Rewrite.
5470         (Output_segment::set_offset): Rewrite.
5471         (Output_segment::find_first_and_last_list): Remove.
5472         (Output_segment::set_tls_offsets): Rewrite.
5473         (Output_segment::first_section_load_address): Likewise.
5474         (Output_segment::output_section_count): Likewise.
5475         (Output_segment::section_with_lowest_load_address): Likewise.
5476         (Output_segment::write_section_headers): Likewise.
5477         (Output_segment::print_sections_to_map): Likewise.
5478         * output.h (class Output_data): Remove dynamic_reloc_count_
5479         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5480         (Output_data::add_dynamic_reloc): Rewrite.
5481         (Output_data::has_dynamic_reloc): New function.
5482         (Output_data::dynamic_reloc_count): Remove.
5483         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5484         is_last_relro_, is_first_non_relro_, is_interp_,
5485         is_dynamic_linker_section_ fields.  Add order and set_order
5486         functions.  Remove is_relro_local, set_is_relro_local,
5487         is_last_relro, set_is_last_relro, is_first_non_relro,
5488         set_is_first_non_relro functions, is_interp, set_is_interp,
5489         is_dynamic_linker_section, and set_is_dynamic_linker_section
5490         functions.
5491         (class Output_segment): Change Output_data_list from std::list to
5492         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5493         output_bss_ fields.  Update declarations.
5494
5495 2010-08-02  Ian Lance Taylor  <iant@google.com>
5496
5497         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5498         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5499         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5500
5501 2010-08-02  Ian Lance Taylor  <iant@google.com>
5502
5503         PR 11855
5504         * script.cc (Script_options::Script_options): Initialize
5505         symbol_definitions_ and symbol_references_.
5506         (Script_options::add_symbol_assignment): Update
5507         symbol_definitions_ and symbol_references_.
5508         (Script_options::add_symbol_reference): New function.
5509         (script_symbol): New function.
5510         * script.h (class Script_options): Add symbol_definitions_ and
5511         symbol_references_ fields.
5512         (Script_options::referenced_const_iterator): New type.
5513         (Script_options::referenced_begin): New function.
5514         (Script_options::referenced_end): New function.
5515         (Script_options::is_referenced): New function.
5516         (Script_options::any_unreferenced): New function.
5517         * script-c.h (script_symbol): Declare.
5518         * yyscript.y (exp): Call script_symbol.
5519         * symtab.cc: Include "script.h".
5520         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5521         Change all callers.  Check symbols referenced by scripts.
5522         (Symbol_table::add_undefined_symbols_from_command_line): Add
5523         layout parameter.  Change all callers.
5524         (Symbol_table::do_add_undefined_symbols_from_command_line):
5525         Likewise.  Break out loop body.  Check symbols referenced by
5526         scripts.
5527         (Symbol_table::add_undefined_symbol_from_command_line): New
5528         function broken out of
5529         do_add_undefined_symbols_from_command_line.
5530         * symtab.h (class Symbol_table): Update declarations.
5531         * archive.cc: Include "layout.h".
5532         (Archive::should_include_member): Add layout parameter.  Change
5533         all callers.  Check for symbol mentioned in expression.
5534         * archive.h (class Archive): Update declaration.
5535         * object.cc (Sized_relobj::do_should_include_member): Add layout
5536         parameter.
5537         * object.h (Object::should_include_member): Add layout parameter.
5538         Change all callers.
5539         (Object::do_should_include_member): Add layout parameter.
5540         (class Sized_relobj): Update declaration.
5541         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5542         parameter.
5543         * dynobj.h (class Sized_dynobj): Update declaration.
5544         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5545         layout parameter.
5546         * plugin.h (class Sized_pluginobj): Update declaration.
5547
5548 2010-08-02  Ian Lance Taylor  <iant@google.com>
5549
5550         PR 11866
5551         * output.cc (Output_segment::set_offset): Search for the first and
5552         last sections rather than assuming that the list is in order.
5553         (Output_segment::find_first_and_last_list): New function.
5554         * output.h (class Output_segment): Update declarations.
5555         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5556         (relro_strip_test_SOURCES): New variable.
5557         (relro_strip_test_DEPENDENCIES): New variable.
5558         (relro_strip_test_LDFLAGS): New variable.
5559         (relro_strip_test_LDADD): New variable.
5560         (relro_strip_test.so): New target.
5561
5562 2010-08-02  Ian Lance Taylor  <iant@google.com>
5563
5564         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5565         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5566         (Target_i386::got_tlsdesc_section): New function.
5567         (Target_i386::got_section): Create space for GOT entries for
5568         TLSDESC relocations.
5569         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5570         R_386_TLS_GOTDESC.
5571         (Target_i386::Scan::global): Likewise.
5572         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5573         using TLSDESC GOT.
5574         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5575         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5576         (Target_x86_64::got_tlsdesc_section): New function.
5577         (Target_x86_64::got_section): Create space for GOT entries for
5578         TLSDESC relocations.
5579         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5580         R_386_TLS_GOTDESC.
5581         (Target_x86_64::Scan::global): Likewise.
5582         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5583         using TLSDESC GOT.
5584
5585 2010-08-02  Ian Lance Taylor  <iant@google.com>
5586
5587         * testsuite/final_layout.sh: Use dc to convert from hex to
5588         decimal.
5589
5590 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5591
5592         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5593         paramter to the call to gold::gc_process_relocs.
5594         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5595         paramter to the call to gold::gc_process_relocs.
5596         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5597         parameter to the call to gold::gc_process_relocs.
5598         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5599         template parameter to the call to gold::gc_process_relocs.
5600         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5601         paramter to the call to gold::gc_process_relocs.
5602         * gc.h (get_embedded_addend_size): New function.
5603         (gc_process_relocs): Save the size of the reloc for use by ICF.
5604         * icf.cc (get_section_contents): Get the addend from the text section
5605         for SHT_REL relocation sections.
5606         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5607         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5608         * int_encoding.h (read_from_pointer): New overloaded function.
5609         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5610         * testsuite/icf_sht_rel_addend_test.sh: New file.
5611         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5612         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5613
5614 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5615
5616         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5617         * Makefile.in: Regenerate.
5618         * testsuite/Makefile.in: Regenerate.
5619
5620 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5621
5622         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5623         * gold/testsuite/debug_msg.cc: Likewise.
5624         * gold/testsuite/odr_violation1.cc
5625         * gold/testsuite/odr_violation2.cc
5626
5627 2010-07-21  Cary Coutant  <ccoutant@google.com>
5628
5629         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5630         string, and length fields.
5631         (Output_merge_string::Merged_strings_list): New type.
5632         (Output_merge_string::Merged_strings_lists): New typedef.
5633         (Output_merge_string): Replace merged_strings_ with
5634         merged_strings_lists_.
5635         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5636         Merged_strings_list per input object and section.  Don't store pointer
5637         to the string.  Don't store length with each merged string entry.
5638         (Output_merge_string::finalize_merged_data): Loop over list of merged
5639         strings lists.  Recompute length of each merged string.
5640
5641 2010-07-15  Cary Coutant  <ccoutant@google.com>
5642
5643         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5644         here.
5645
5646 2010-07-14  Ian Lance Taylor  <iant@google.com>
5647
5648         * descriptors.cc (Descriptors::open): Report correct name in error
5649         message.
5650
5651 2010-07-13  Doug Kwan  <dougkwan@google.com>
5652
5653         * arm.cc (Arm_input_section::Arm_input_section): For a
5654         SHT_ARM_EXIDX section, always keeps the input sections.
5655         (Arm_input_section::set_exidx_section_link): New method.
5656         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5657         has_errors_ to false.
5658         (Arm_exidx_input_section::has_errors,
5659         Arm_exidx_input_section::set_has_errors): New methods.
5660         (Arm_exidx_input_section::has_errors_): New data member.
5661         (Arm_relobj::get_exidx_shndx_list): New method.
5662         (Arm_output_section::append_text_sections_to_list): Do not skip
5663         section without SHF_EXECINSTR.
5664         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5665         errors.
5666         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5667         section header.  Make error messages more verbose.  Check for
5668         a non-executable section linked to an EXIDX section.
5669         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5670         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5671         check that there is no deferred EXIDX section if we exit early.
5672         Instead of not making an EXIDX section in case of an error, make one
5673         and set the has_errors flag of it.
5674         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5675         in a relocatable link.
5676         (Target_arm::do_relax): Look for the EXIDX output section instead of
5677         assuming that it is called .ARM.exidx.
5678         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5679         section list.  Do not check for SHF_EXECINSTR section flags but
5680         skip any input section with errors.
5681         * output.cc (Output_section::Output_section): Initialize
5682         always_keeps_input_sections_ to false.
5683         (Output_section::add_input_section): Check for
5684         always_keeps_input_sections_.
5685         *  output.h (Output_section::always_keeps_input_sections,
5686         Output_section::set_always_keeps_input_sections): New methods.
5687         (Output_section::always_keeps_input_sections): New data member.
5688
5689 2010-07-13  Rafael Espindola  <espindola@google.com>
5690
5691         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5692         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5693
5694 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5695             Ian Lance Taylor  <iant@google.com>
5696
5697         * output.h (Output_section_lookup_maps::add_merge_section):
5698         Correct check of whether value was inserted.
5699         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5700         (Output_section_lookup_maps::add_relaxed_input_section):
5701         Likewise.
5702         * arm.cc (Target_arm::got_section): Remove used local os.
5703         * i386.cc (Target_i386::got_section): Likewise.
5704         * x86_64.cc (Target_x86_64::got_section): Likewise.
5705         * sparc.cc (Target_sparc::got_section): Likewise.
5706         (Target_sparc::relocate): Remove unused local have_got_offset.
5707         * powerpc.cc (Target_powerpc::relocate): Likewise.
5708
5709 2010-07-13  Ian Lance Taylor  <iant@google.com>
5710
5711         * compressed_output.cc (zlib_decompress): Fix signature in
5712         !HAVE_ZLIB_H case.
5713
5714         * archive.cc (Archive::include_member): Unlock an external member
5715         of a thin archive.  Don't bother to delete an object we know is
5716         NULL.
5717
5718 2010-07-12  Cary Coutant  <ccoutant@google.com>
5719
5720         * compressed_output.cc (zlib_decompress): New function.
5721         (get_uncompressed_size): New function.
5722         (decompress_input_section): New function.
5723         * compressed_output.h (get_uncompressed_size): New function.
5724         (decompress_input_section): New function.
5725         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5726         Handle compressed debug sections.
5727         * layout.cc (is_compressed_debug_section): New function.
5728         (Layout::output_section_name): Map compressed section names to
5729         canonical names.
5730         * layout.h (is_compressed_debug_section): New function.
5731         (is_debug_info_section): Recognize compressed debug sections.
5732         * merge.cc: Include compressed_output.h.
5733         (Output_merge_data::do_add_input_section): Handle compressed
5734         debug sections.
5735         (Output_merge_string::do_add_input_section): Handle compressed
5736         debug sections.
5737         * object.cc: Include compressed_output.h.
5738         (Sized_relobj::Sized_relobj): Initialize new data members.
5739         (build_compressed_section_map): New function.
5740         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5741         * object.h (Object::section_is_compressed): New method.
5742         (Object::do_section_is_compressed): New method.
5743         (Sized_relobj::Compressed_section_map): New type.
5744         (Sized_relobj::do_section_is_compressed): New method.
5745         (Sized_relobj::compressed_sections_): New data member.
5746         * output.cc (Output_section::add_input_section): Handle compressed
5747         debug sections.
5748         * reloc.cc: Include compressed_output.h.
5749         (Sized_relobj::write_sections): Handle compressed debug sections.
5750
5751 2010-07-08  Cary Coutant  <ccoutant@google.com>
5752
5753         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5754         weak when resolving to a dynamic def.
5755         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5756         for weak undef/dynamic def cases. Adjust callers.
5757         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5758         undef_binding_weak_.
5759         (Symbol_table::sized_write_globals): Adjust symbol binding.
5760         (Symbol_table::sized_write_symbol): Add binding parameter.
5761         * symtab.h (Symbol::set_undef_binding): New method.
5762         (Symbol::is_undef_binding_weak): New method.
5763         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5764         (Symbol_table::should_override): Add new parameter.
5765         (Symbol_table::sized_write_symbol): Add new parameter.
5766
5767         * testsuite/weak_undef_file1.cc: Add new test case.
5768         * testsuite/weak_undef_file2.cc: Fix header comment.
5769         * testsuite/weak_undef_test.cc: Add new test case.
5770
5771 2010-06-29  Doug Kwan  <dougkwan@google.com>
5772
5773         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5774         Initialize USE_SYMBOL_.
5775         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5776         definition.
5777         (Arm_reloc_property::uses_symbol_): New data member declaration.
5778         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5779         uses symbol value and symbol is undefined but not weakly undefined.
5780
5781 2010-06-28  Rafael Espindola  <espindola@google.com>
5782
5783         * plugin.cc (Plugin::load): Use dlerror.
5784
5785 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5786
5787         * symtab.cc (detect_odr_violations): When reporting an ODR
5788         violation, report an object where the symbol is defined.
5789
5790 2010-06-25  Doug Kwan  <dougkwan@google.com>
5791
5792         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5793         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5794         definition.
5795         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5796         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5797         target hook to detect function points.
5798         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5799         * icf.h (Icf::check_section_for_function_pointers): Change type of
5800         parameter SECTION_NAME to const reference to std::string.  Use
5801         target hook to determine if section may have unsafe pointers.
5802         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5803         method definition.
5804
5805 2010-06-21  Rafael Espindola  <espindola@google.com>
5806
5807         * fileread.cc (Input_file::find_fie): New
5808         (Input_file::open): Use Input_file::find_fie.
5809         * fileread.h (Input_file::find_fie): New
5810         * plugin.cc (set_extra_library_path): New.
5811         (Plugin::load): Add set_extra_library_path to the transfer vector.
5812         (Plugin_manager::set_extra_library_path): New.
5813         (Plugin_manager::add_input_file): Use the extra search path if set.
5814         (set_extra_library_path(): New.
5815         * plugin.h (Plugin_manager): Add set_extra_library_path and
5816         extra_search_path_.
5817
5818 2010-06-19  Cary Coutant  <ccoutant@google.com>
5819
5820         * layout.cc (gdb_sections): Add .debug_types.
5821         (lines_only_debug_sections): Likewise.
5822
5823 2010-06-18  Rafael Espindola  <espindola@google.com>
5824
5825         * plugin.cc (add_input_file,add_input_library)
5826         (Plugin_manager::add_input_file): Make filename arguments const.
5827         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5828         const.
5829
5830 2010-06-16  Doug Kwan  <dougkwan@google.com>
5831
5832         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5833         .ARM.attributes section if we have not merged any input
5834         attributes sections.
5835
5836 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5837
5838         * arm.cc: Allow combining objects with no EABI version
5839         information.
5840
5841 2010-06-15  Rafael Espindola  <espindola@google.com>
5842
5843         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5844
5845 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5846
5847         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5848         (struct iovec): Correct !HAVE_READV definition.
5849
5850 2010-06-10  Cary Coutant  <ccoutant@google.com>
5851
5852         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5853         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5854         reloc sections.
5855         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5856
5857         PR 11683
5858         * symtab.h (Symbol::is_placeholder): New member function.
5859         * target-reloc.h (relocate_section): Check for placeholder symbols.
5860
5861         * testsuite/Makefile.am (plugin_test_8): New test.
5862         (plugin_test_9): New test.
5863         * testsuite/Makefile.in: Regenerate.
5864
5865 2010-06-09  Nick Clifton  <nickc@redhat.com>
5866
5867         * yyscript.y (input_list_element): Allow strings prefixed with
5868         the '-' character.  Treat these as libraries.
5869         * script.cc (script_add_library): New function.  Adds a library
5870         specified by "-l<name>" found in an input script.
5871         * script-c.h: Add prototype for script_add_library.
5872
5873 2010-06-07  Doug Kwan  <dougkwan@google.com>
5874
5875         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5876         Restrict stub-group size to be within long conditional branch
5877         range when working around cortex-A8 erratum.
5878
5879 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5880
5881         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5882         #ifdef typo.
5883
5884 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5885
5886         PR gold/11658
5887         * output.cc
5888         (Output_section::Input_section_sort_entry::compare_section_ordering):
5889         Change to return non-zero correctly.
5890         (Output_section::Input_section_sort_section_order_index_compare
5891         ::operator()): Change to fix ambiguity in comparisons.
5892
5893 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5894
5895         * gold.h (is_wildcard_string): New function.
5896         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5897         (Layout::layout_eh_frame): Ditto.
5898         (Layout::find_section_order_index): New method.
5899         (Layout::read_layout_from_file): New method.
5900         * layout.h (Layout::find_section_order_index): New method.
5901         (Layout::read_layout_from_file): New method.
5902         (Layout::input_section_position_): New private member.
5903         (Layout::input_section_glob_): New private member.
5904         * main.cc (main): Call read_layout_from_file here.
5905         * options.h (--section-ordering-file): New option.
5906         * output.cc (Output_section::input_section_order_specified_): New
5907         member.
5908         (Output_section::Output_section): Initialize new member.
5909         (Output_section::add_input_section): Add new parameter.
5910         Keep input sections when --section-ordering-file is used.
5911         (Output_section::set_final_data_size): Sort input sections when
5912         section ordering file is specified.
5913         (Output_section::Input_section_sort_entry): Add new parameter.
5914         Check sorting type.
5915         (Output_section::Input_section_sort_entry::compare_section_ordering):
5916         New method.
5917         (Output_section::Input_section_sort_compare::operator()): Change to
5918         consider section_order_index.
5919         (Output_section::Input_section_sort_init_fini_compare::operator()):
5920         Change to consider section_order_index.
5921         (Output_section::Input_section_sort_section_order_index_compare
5922         ::operator()): New method.
5923         (Output_section::sort_attached_input_sections): Change to sort
5924         according to section order when specified.
5925         (Output_section::add_input_section<32, true>): Add new parameter.
5926         (Output_section::add_input_section<64, true>): Add new parameter.
5927         (Output_section::add_input_section<32, false>): Add new parameter.
5928         (Output_section::add_input_section<64, false>): Add new parameter.
5929         * output.h (Output_section::add_input_section): Add new parameter.
5930         (Output_section::input_section_order_specified): New
5931         method.
5932         (Output_section::set_input_section_order_specified): New method.
5933         (Input_section::Input_section): Initialize section_order_index_.
5934         (Input_section::section_order_index): New method.
5935         (Input_section::set_section_order_index): New method.
5936         (Input_section::section_order_index_): New member.
5937         (Input_section::Input_section_sort_section_order_index_compare): New
5938         struct.
5939         (Output_section::input_section_order_specified_): New member.
5940         * script-sections.cc (is_wildcard_string): Delete and move modified
5941         method to gold.h.
5942         (Output_section_element_input::Output_section_element_input): Modify
5943         call to is_wildcard_string.
5944         (Output_section_element_input::Input_section_pattern
5945         ::Input_section_pattern): Ditto.
5946         (Output_section_element_input::Output_section_element_input): Ditto.
5947         * testsuite/Makefile.am (final_layout): New test case.
5948         * testsuite/Makefile.in: Regenerate.
5949         * testsuite/final_layout.cc: New file.
5950         * testsuite/final_layout.sh: New file.
5951
5952 2010-06-01  Rafael Espindola  <espindola@google.com>
5953
5954         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5955
5956 2010-06-01  Rafael Espindola  <espindola@google.com>
5957
5958         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5959         visibility of symbols.
5960
5961 2010-05-27  Doug Kwan  <dougkwan@google.com>
5962
5963         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5964         from start of output section instead of address for a local symbol
5965         in a merged or relaxed section when doing a relocatable link.
5966
5967 2010-05-26  Rafael Espindola  <espindola@google.com>
5968
5969         PR 11604
5970         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5971         adding sections the garbage collector removed.
5972         * gold/testsuite/Makefile.am: Add test.
5973         * gold/testsuite/Makefile.in: Regenerate.
5974         * gold/testsuite/plugin_test_7.sh: New.
5975         * gold/testsuite/plugin_test_7_1.c: New.
5976         * gold/testsuite/plugin_test_7_2.c: New.
5977
5978 2010-05-26  Rafael Espindola  <espindola@google.com>
5979
5980         * script-sections.cc (Output_section_definition::set_section_addresses):
5981         Check for --section-start.
5982
5983 2010-05-26  Doug Kwan  <dougkwan@google.com>
5984
5985         * arm.cc (Arm_scan_relocatable_relocs): New class.
5986         (Target_arm::relocate_special_relocatable): New method.
5987         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5988         (Arm_relocate_functions::thumb_branch_common): Same.
5989         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5990         instead of Default_scan_relocatable_relocs.
5991         * target-reloc.h (relocate_for_relocatable): Let target handle
5992         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5993         * target.h (Sized_target::relocate_special_relocatable): New method.
5994
5995 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5996
5997         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5998
5999 2010-05-23  Doug Kwan  <dougkwan@google.com>
6000
6001         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6002         instead of a cast.
6003         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6004         with a direct branch, not a conditional branch, to a stub.
6005         * merge.cc (Output_merge_base::record_input_section): New method
6006         defintion.
6007         (Output_merge_data::do_add_input_section): Record input section if
6008         keeps-input-sections flag is set.
6009         (Output_merge_string::do_add_input_section): Ditto.
6010         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6011         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6012         INPUT_SECTIONS_.
6013         (Output_merge_base::keeps_input_sections,
6014         Output_merge_base::set_keeps_input_sections,
6015         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6016         method definitions.
6017         (Output_merge_base::Input_sections): New type declaration.
6018         (Output_merge_base::input_sections_begin,
6019         Output_merge_base::input_sections_end,
6020         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6021         (Output_merge_base::bool keeps_input_sections_,
6022         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6023         Output_merge_base::input_sections_): New data members.
6024         (Output_merge_data::do_set_keeps_input_sections): New method
6025         defintion.
6026         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6027         * output.cc (Output_section::Input_section::relobj): Move method
6028         defintion from class declaration to here and handle merge sections.
6029         (Output_section::Input_section::shndx): Ditto.
6030         (Output_section::Output_section): Remove initializations of removed
6031         data members and initialize new data member LOOKUP_MAPS_.
6032         (Output_section::add_input_section): Set keeps-input-sections flag
6033         for a newly created merge output section as appropriate.  Adjust code
6034         to use Output_section_lookup_maps class.
6035         (Output_section::add_relaxed_input_section): Adjst code for lookup
6036         maps code refactoring.
6037         (Output_section::add_merge_input_section): Add a new parameter
6038         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6039         class.  If adding input section to a newly created merge output
6040         section fails, remove the new merge section.
6041         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6042         Adjust code for use of the Output_section_lookup_maps class.
6043         (Output_section::find_merge_section): Ditto.
6044         (Output_section::build_lookup_maps): New method defintion.
6045         (Output_section::find_relaxed_input_section): Adjust code to use
6046         Output_section_lookup_maps class.
6047         (Output_section::get_input_sections): Export merge sections.  Adjust
6048         code to use Output_section_lookup_maps class.
6049         (Output_section:::add_script_input_section): Adjust code to use
6050         Output_section_lookup_maps class.  Update lookup maps for merge
6051         sections also.
6052         (Output_section::discard_states): Use Output_section_lookup_maps.
6053         (Output_section::restore_states): Same.
6054         * output.h (Merge_section_properties): Move class defintion out of
6055         Output_section.
6056         (Output_section_lookup_maps): New class.
6057         (Output_section::Input_section::is_merge_section): New method
6058         defintion.
6059         (Output_section::Input_section::relobj): Move defintion out of class
6060         defintion.  Declare method only.
6061         (Output_section::Input_section::shndx): Ditto.
6062         (Output_section::Input_section::output_merge_base): New method defintion.
6063         (Output_section::Input_section::u2_.pomb): New union field.
6064         (Output_section::Merge_section_by_properties_map,
6065         Output_section::Output_section_data_by_input_section_map,
6066         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6067         Remove types.
6068         (Output_section::add_merge_input_section): Add new parameter
6069         KEEPS_INPUT_SECTIONS.
6070         (Output_section::build_lookup_maps): New method declaration.
6071         (Output_section::merge_section_map_,
6072         Output_section::merge_section_by_properties_map_,
6073         Output_section::relaxed_input_section_map_,
6074         Output_section::is_relaxed_input_section_map_valid_): Remove data
6075         members.
6076         (Output_section::lookup_maps_): New data member.
6077
6078 2010-05-21  Doug Kwan  <dougkwan@google.com>
6079
6080         PR gold/11619
6081         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6082         avoid a compilation error.
6083
6084 2010-05-19  Rafael Espindola  <espindola@google.com>
6085
6086         * script-sections.cc (Output_section_definition::allocate_to_segment):
6087         Update the phdrs_list even when the output section is NULL.
6088         * testsuite/Makefile.am: Add test.
6089         * testsuite/Makefile.in: Regenerate.
6090         * testsuite/script_test_9.cc: New.
6091         * testsuite/script_test_9.sh: New.
6092         * testsuite/script_test_9.t: New.
6093
6094 2010-05-19  Doug Kwan  <dougkwan@google.com>
6095
6096         * arm.cc (Arm_input_section::original_size): New method.
6097         (Arm_input_section::do_addralign): Add a cast.
6098         (Arm_input_section::do_output_offset): Remove static cast.
6099         (Arm_input_section::original_addralign,
6100          Arm_input_section::original_size_): Change type to uint32_t.
6101         (Arm_input_section::init): Add safe casts for section alignment
6102         and size.
6103         (Arm_input_section::set_final_data_size): Do not set address and
6104         offset of stub table.
6105         (Arm_output_section::fix_exidx_coverage): Change use of of
6106         Output_section::Simple_input_section to that of
6107         Output_section::Input_section.
6108         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6109         except for the first pass.
6110         * output.cc (Output_section::get_input_sections): Change type of
6111         input_sections to std::list<Input_section>.
6112         (Output_section::add_script_input_section): Rename from
6113         Output_section::add_simple_input_section.  Change type of SIS
6114         parameter from Simple_input_section to Input_section.
6115         * output.h (Output_section::Simple_input_section): Remove class.
6116         (Output_section::Input_section): Change class visibility to public.
6117         (Output_section::Input_section::addralign): Use stored alignments
6118         for special input sections if set.
6119         (Output_section::Input_section::set_addralign): New method.
6120         (Output_section::get_input_sections): Change parameter type from
6121         list of Simple_input_section to list of Input_section.
6122         (Output_section::add_script_input_section): Rename from
6123         Output_section::add_simple_input_section. Change first parameter's
6124         type from Simple_input_section to Input_section and remove the
6125         second and third parameters.
6126         * script-sections.cc (Input_section::Input_section_list): Change
6127         type to list of Output_section::Input_section/
6128         (Input_section_info::Input_section_info): Change parameter type of
6129         INPUT_SECTION to Output_section::Input_section.
6130         (Input_section_info::input_section): Change return type.
6131         (Input_section_info::input_section_): Change type to
6132         Output_section::Input_section.
6133         (Output_section_element_input::set_section_addresses): Adjust code
6134         to use Output_section::Input_section instead of
6135         Output_section::Simple_input_section.  Adjust code for renaming
6136         of Output_section::add_simple_input_section.
6137         (Orphan_output_section::set_section_addresses): Ditto.
6138
6139 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6140
6141         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6142         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6143
6144 2010-05-18  Rafael Espindola  <espindola@google.com>
6145
6146         * options.cc (General_options::finalize): Handle -nostdlib.
6147         * options.h (nostdlib): New option.
6148         * script.cc (script_add_search_dir): Handle -nostdlib.
6149
6150 2010-05-12  Doug Kwan  <dougkwan@google.com>
6151
6152         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6153         attributes section only if there no attributes section after merging.
6154         (Target_arm::merge_object_attributes): Move value of
6155         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6156         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6157         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6158         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6159         and arm_attr_merge_7.stdout.
6160         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6161         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6162         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6163         arm_attr_merge_7b.o): New rules.
6164         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6165         arm_attr_merge_7
6166         * testsuite/Makefile.in: Regenerate.
6167         * testsuite/arm_attr_merge.sh: New file.
6168         * testsuite/arm_attr_merge_[67][ab].s: Same.
6169
6170 2010-05-05  Nick Clifton  <nickc@redhat.com>
6171
6172         * po/es.po: Updated Spanish translation.
6173
6174 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6175
6176         * Makefile.am (install-exec-local): Properly install gold as
6177         default cross linker.
6178         * Makefile.in: Regenerated.
6179
6180 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6181             Nick Clifton  <nickc@redhat.com>
6182
6183         * configure.ac (install_as_default): Define and set to false
6184         unless --enable-gold or --enable-gold=both/gold has been
6185         specified.
6186         * configure: Regenerate.
6187
6188         * Makefile.am (install-exec-local): Install the executable as
6189         'ld.gold'.  If install_as_default is true then also install it as
6190         'ld'.
6191         * Makefile.in: Regenerated.
6192
6193 2010-04-24  Ian Lance Taylor  <iant@google.com>
6194
6195         * layout.cc (Layout::layout_reloc): In relocatable link don't
6196         combine reloc sections for grouped sections.
6197
6198 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6199
6200         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6201         sections that are not ordinary to icf.
6202         * icf.cc (get_section_contents): Handle relocation pointing to section
6203         with no object or shndx information.
6204         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6205         * testsuite/Makefile.in: Regenerate.
6206         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6207         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6208
6209 2010-04-22  Ian Lance Taylor  <iant@google.com>
6210
6211         * expression.cc (Expression::Expression_eval_info): Add
6212         result_alignment_pointer field.
6213         (Expression::eval_with_dot): Add result_alignment_pointer
6214         parameter.  Change all callers.
6215         (Expression::eval_maybe_dot): Likewise.
6216         (class Binary_expression): Add alignment_pointer parameter to
6217         left_value and right_value.  Change all callers.
6218         (BINARY_EXPRESSION): Set result alignment.
6219         (class Trinary_expression): Add alignment_pointer parameter to
6220         arg2_value and arg3_value.  Change all callers.
6221         (Trinary_cond::value): Set result alignment.
6222         (Max_expression::value, Min_expression::value): Likewise.
6223         (Align_expression::value): Likewise.
6224         * script-sections.cc (class Sections_element): Add dot_alignment
6225         parameter to set_section_addresses virtual function.  Update
6226         instantiations.
6227         (class Output_section_element): Likewise.
6228         (Script_sections::create_segments): Add dot_alignment parameter.
6229         Change all callers.
6230         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6231         (Script_sections::set_phdrs_clause_addresses): Likewise.
6232         * script-sections.h: Update declarations.
6233         * script.h: Update declarations.
6234         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6235         min_p_align.
6236         * testsuite/script_test_3.t: Set large alignment.
6237         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6238         segment has expected alignment.
6239
6240 2010-04-22  Nick Clifton  <nickc@redhat.com>
6241
6242         * po/gold.pot: Updated by the Translation project.
6243         * po/vi.po: Updated Vietnamese translation.
6244
6245 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6246
6247         * testsuite/Makefile.am (check_PROGRAMS): Add
6248         icf_virtual_function_folding_test.
6249         * testsuite/Makefile.in: Regenerated.
6250
6251 2010-04-15  Andrew Haley  <aph@redhat.com>
6252
6253         * options.h (merge_exidx_entries): New option.
6254         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6255         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6256         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6257         (Target_arm::merge_exidx_entries): New function.
6258         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6259         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6260         to Arm_exidx_fixup constructor.
6261         Add new arg, merge_exidx_entries.
6262         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6263         Arm_output_section::fix_exidx_coverage.
6264
6265 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6266
6267         * icf.cc (get_section_contents): Check for preemptible functions.
6268         Ignore addend when appropriate.
6269         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6270         section folded.
6271         (add_from_relobj): Check for section folded.
6272         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6273         * symtab.h (should_add_dynsym_entry): Add new parameter.
6274         * target-reloc.h (scan_relocs): Check for section folded.
6275         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6276         Check reloc types for function pointers in shared objects.
6277         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6278         case.
6279         (icf_preemptible_functions_test): New test case.
6280         (icf_string_merge_test): New test case.
6281         * testsuite.Makefile.in: Regenerate.
6282         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6283         bar_glob.  Refactor code.
6284         * testsuite/icf_preemptible_functions_test.cc: New file.
6285         * testsuite/icf_preemptible_functions_test.sh: New file.
6286         * testsuite/icf_string_merge_test.cc: New file.
6287         * testsuite/icf_string_merge_test.sh: New file.
6288         * testsuite/icf_virtual_function_folding_test.cc: New file.
6289         * testsuite/icf_virtual_function_folding_test.sh: New file.
6290
6291 2010-04-14  Doug Kwan  <dougkwan@google.com>
6292
6293         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6294         for local symbol recounting if we remove a section due to ICF.
6295         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6296         there are no regular objects in input.
6297
6298 2010-04-13  Doug Kwan  <dougkwan@google.com>
6299
6300         * arm.cc (Arm_input_section::set_final_data_size): Compute
6301         accurate final data size instead of using current data size.
6302
6303 2010-04-09  Doug Kwan  <dougkwan@google.com>
6304
6305         * layout.cc (Layout::choose_output_section): Handle script section
6306         types.
6307         (Layout::make_output_section_for_script): Add section type parameter.
6308         Handle script section types.
6309         * layout.h (Layout::make_output_section_for_script): Add section
6310         type parameter.
6311         * output.cc (Output_section::Output_section): Initialize data member
6312         is_noload_.
6313         (Output_section::do_reset_address_and_file_offset): Do not set address
6314         to 0 if section is a NOLOAD section.
6315         * output.h (Output_section::is_noload): New method.
6316         (Output_section::set_is_noload): Ditto.
6317         (Output_section::is_noload_): New data member.
6318         * script-c.h (Script_section_type): New enum type.
6319         (struct Parser_output_section_header): Add new file section_type.
6320         * script-sections.cc (Sections_element::output_section_name): Add
6321         parameter for returning script section type.
6322         (Output_section_definition::output_section_name): Ditto.
6323         (Output_section_definition::section_type)P; New method.
6324         (Output_section_definiton::script_section_type_name): Ditto.
6325         (Output_section_definition::script_section_type_): New data member.
6326         (Output_section_definition::Output_section_definition): Initialize
6327         data member Output_section_definition::script_section_type_.
6328         (Output_section_definition::create_sections): Pass script section type
6329         to Layout::make_output_section_for_script.
6330         (Output_section_definition::output_section_name): Return script
6331         section type to caller.
6332         (Output_section_definition::set_section_address): Do not advance
6333         dot value and load address if section type is NOLOAD.  Set address
6334         of NOLOAD sections regardless of section flags.
6335         (Output_section_definition::print): Print section type if it is
6336         not SCRIPT_SECTION_TYPE_NONE.
6337         (Output_section_definition::section_type): New method.
6338         (Output_section_definition::script_section_type_name): Ditto.
6339         (Script_sections::output_section_name): Add new parameter
6340         PSECTION_TYPE for returning script section type.  Pass it to
6341         section elements.  Handle discard sections.
6342         (Sort_output_sections::operator()): Handle NOLOAD sections.
6343         * script-sections.h (Script_sections::Section_type): New enum type.
6344         (Script_sections::output_section_name): Add a new parameter for
6345         returning script section type.
6346         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6347         INFO and NOLOAD.
6348         * yyscript.y (union): Add new field SECTION_TYPE.
6349         (COPY, DSECT, INFO, NOLOAD): New tokens.
6350         (opt_address_and_section_type): Change type to output_section_header.
6351         (section_type): New non-terminal
6352         (section_header): Handle section type.
6353         (opt_address_and_section_type): Return section type value.
6354
6355 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6356
6357         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6358         * testsuite/plugin_common_test_2.c (foo): Likewise.
6359
6360 2010-04-08  Doug Kwan  <dougkwan@google.com>
6361
6362         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6363         Output_merge_data.
6364         * output.cc (Output_section::add_merge_input_section): Simplify
6365         code and return status of Output_merge_base::add_input_section.
6366         Update merge section map only if Output_merge_base::add_input_section
6367         returns true.
6368
6369 2010-04-07  Doug Kwan  <dougkwan@google.com>
6370
6371         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6372         if section is marked as containing instructions but has no mapping
6373         symbols.
6374         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6375         correct section index.
6376         (Arm_relobj::find_linked_text_section): Ditto.
6377
6378 2010-04-07  Cary Coutant  <ccoutant@google.com>
6379
6380         * archive.cc (include_member): Destroy Read_symbols_data object before
6381         releasing file.
6382         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6383         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6384         (Read_symbols_data::~Read_symbols_data) New destructor.
6385         (Section_relocs::Section_relocs) New constructor.
6386         (Section_relocs::~Section_relocs) New destructor.
6387         (Read_relocs_data::Read_relocs_data) New constructor.
6388         (Read_relocs_data::~Read_relocs_data) New destructor.
6389         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6390         pointers to NULL after deleting.
6391
6392 2010-04-07  Doug Kwan  <dougkwan@google.com>
6393
6394         * arm.cc: Replace "endianity" with "endianness" in comments.
6395         (Arm_exidx_cantunwind): Ditto.
6396         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6397         (Arm_relobj::merge_flags_and_attributes): New method.
6398         (Arm_relobj::merge_flags_and_attributes_): New data member.
6399         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6400         (Arm_relobj::scan_sections_for_stubs): Ditto.
6401         (Arm_relobj::do_read_symbols): Check to see if we really want to
6402         merge processor-specific flags and attributes.  Exit early if
6403         an object is empty except for section names and the undefined symbol.
6404         (Target_arm::do_finalize_sections): Move check for ELF format to
6405         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6406         attributes from a regular object only when we have determined that
6407         it is aapropriate.  Do not create an .ARM.attributes section in
6408         output if there is no regular input object.
6409         (Target_arm::merge_processor_specific_flags): Check
6410         --warn-mismatch before printing any error.
6411         (Target_arm::merge_object_attributes): Ditto.
6412         * gold.cc (queue_middle_tasks): Handle the case in which there is
6413         no regular object in input.
6414         * options.cc (General_options::parse_EB): New method.
6415         (General_options::parse_EL): Same.
6416         (General_options::General_options): Initialize endianness_.
6417         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6418         New options.
6419         (General_options::Endianness): New enum.
6420         (General_options::endianness): New method.
6421         (General_options::endianness_): New data member.
6422         * parameters.cc (Parameters::set_options): Check target endianness.
6423         (Parameters::set_target_once): Ditto.
6424         (Parameters::check_target_endianness): New method.
6425         (parameters_force_valid_target): If either -EL or -EB is specified,
6426         use it to define endianness of default target.
6427         * parameters.h (Parameters::check_target_endianness): New method
6428         declaration.
6429         * target.h (class Target): Change "endianity" to "endianness"
6430         in comments.
6431
6432 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6433
6434         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6435         * configure: Regenerate.
6436         * Makefile.in: Regenerate.
6437         * testsuite/Makefile.in: Regenerate.
6438
6439 2010-04-06  Cary Coutant  <ccoutant@google.com>
6440
6441         gcc PR lto/42757
6442         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6443         prevailing definitions of common symbols.
6444         * testsuite/plugin_test_6.sh: New test case.
6445         * testsuite/plugin_common_test_1.c: New test case.
6446         * testsuite/plugin_common_test_2.c: New test case.
6447         * testsuite/Makefile.am (plugin_test_6): New test case.
6448         * testsuite/Makefile.in: Regenerate.
6449
6450 2010-04-06  Nick Clifton  <nickc@redhat.com>
6451
6452         * po/vi.po: New Vietnamese translation.
6453
6454 2010-03-30  Doug Kwan  <dougkwan@google.com>
6455
6456         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6457
6458 2010-03-25  Doug Kwan  <dougkwan@google.com>
6459
6460         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6461         to avoid a conversion warning on a 32-bit host.
6462
6463 2010-03-24  Ian Lance Taylor  <iant@google.com>
6464
6465         * testsuite/script_test_3.t: Add a TLS segment.
6466         * testsuite/Makefile.am (check_PROGRAMS): Add
6467         tls_phdrs_script_test.
6468         (tls_phdrs_script_test_SOURCES): Define.
6469         (tls_phdrs_script_test_DEPENDENCIES): Define.
6470         (tls_phdrs_script_test_LDFLAGS): Define.
6471         (tls_phdrs_script_test_LDADD): Define.
6472         * testsuite/Makefile.in: Rebuild.
6473
6474 2010-03-23  Cary Coutant  <ccoutant@google.com>
6475
6476         * fileread.cc (find_or_make_view): Fix comment.
6477
6478 2010-03-23  Ian Lance Taylor  <iant@google.com>
6479
6480         * script-sections.cc (class Orphan_section_placement): Define
6481         PLACE_TLS and PLACE_TLS_BSS.
6482         (Orphan_section_placement::Orphan_section_placement): Initialize
6483         new places.
6484         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6485         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6486         (tls_script_test_SOURCES): Define.
6487         (tls_script_test_DEPENDENCIES): Define.
6488         (tls_script_test_LDFLAGS): Define.
6489         (tls_script_test_LDADD): Define.
6490         * testsuite/Makefile.in: Rebuild.
6491
6492 2010-03-22  Doug Kwan  <dougkwan@google.com>
6493
6494         * arm.cc (Arm_relocate_functions::abs8,
6495         Arm_relocate_functions::abs16): Use correct check for overflow
6496         specified in the ARM ELF specs.
6497         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6498         target of a BLX instruction specially.
6499         (Reloc_stub::stub_type_for_reloc): Ditto.
6500         (Relocate::relocate): Use symbolic names instead of numeric relocation
6501         codes to report error.
6502         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6503         workaround.
6504         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6505         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6506         thumb2_blx_out_of_range.stdout
6507         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6508         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6509         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6510         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6511         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6512         thumb2_blx_in_range, thumb2_blx_in_range.o,
6513         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6514         thumb2_blx_out_of_range.o): New rules.
6515         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6516         thumb2_blx_in_range and thumb2_blx_out_of_range.
6517         * testsuite/Makefile.in: Regenerate.
6518         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6519         * testsuite/thumb_blx_in_range.s: New file.
6520         * testsuite/thumb_blx_out_of_range.s: New file.
6521
6522 2010-03-22  Rafael Espindola  <espindola@google.com>
6523
6524         * archive.cc (Should_include): Move to archive.h.
6525         (should_include_member): Make it a member of Archive.
6526         (Lib_group): New.
6527         (Add_lib_group_symbols): New.
6528         * archive.h: Include options.h.
6529         (Archive_member): Moved from Archive.
6530         (Should_include): Moved from archive.cc.
6531         (Lib_group): New.
6532         (Add_lib_group_symbols): New.
6533         * dynobj.cc (do_should_include_member): New.
6534         * dynobj.h (do_should_include_member): New.
6535         * gold.cc (queue_initial_tasks): Update call to queue.
6536         * main.cc (main): Print lib group stats.
6537         * object.cc (do_should_include_member): New.
6538         * object.h: Include archive.h.
6539         (Object::should_include_member): New.
6540         (Object::do_should_include_member): New.
6541         (Sized_relobj::do_should_include_member): New.
6542         * options.cc (General_options::parse_start_lib): New.
6543         (General_options::parse_end_lib): New.
6544         (Input_arguments::add_file): Handle lib groups.
6545         (Input_arguments::start_group): Check we are not in a lib.
6546         (Input_arguments::start_lib): New.
6547         (Input_arguments::end_lib): New.
6548         * options.h (General_options): Add start_lib and end_lib.
6549         (Input_argument::lib_): New.
6550         (Input_argument::lib): New.
6551         (Input_argument::is_lib): New.
6552         (Input_file_lib): New.
6553         (Input_arguments::in_lib_): New.
6554         (Input_arguments::in_lib): New.
6555         (Input_arguments::start_lib): New.
6556         (Input_arguments::end_lib_): New.
6557         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6558         in unused members as preempted.
6559         (Sized_pluginobj::do_should_include_member): New.
6560         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6561         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6562         return the blocker.
6563         (Read_symbols::do_whole_lib_group): New.
6564         (Read_symbols::do_lib_group): New.
6565         (Read_symbols::do_read_symbols): Handle lib groups.
6566         (Read_symbols::get_name): Handle lib groups.
6567         * readsyms.h (Read_symbols): Add an archive member pointer.
6568         (Read_symbols::do_whole_lib_group): New.
6569         (Read_symbols::do_lib_group): New.
6570         (Read_symbols::member_): New.
6571         * script.cc (read_input_script): Update call to queue_soon.
6572
6573 2010-03-19  Doug Kwan  <dougkwan@google.com>
6574
6575         * arm.cc (Stub_table::Stub_table): Initialize new data members
6576         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6577         (Stub_table::add_reloc_stub): Assign stub offset and update
6578         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6579         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6580         New data members.
6581         (Stub_table::update_data_size_and_addralign): Use
6582         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6583         instead of going over all reloc stubs.
6584         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6585         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6586         Stringpool_template::offset_ to size of Stringpool_char.
6587         (Stringpool_template::new_key_offset): Remove code to initialize
6588         Stringpool_template::offset_.
6589         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6590         Stringpool_template::offset_ to zero.
6591
6592 2010-03-15  Doug Kwan  <dougkwan@google.com>
6593
6594         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6595         offset_.
6596         (Stringpool_template::new_key_offset): New method.
6597         (Stringpool_template::add_string): Assign offsets when adding new
6598         strings.
6599         (Stringpool_template::set_string_offsets): Do not set string offsets
6600         when not optimizing.
6601         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6602         member size_.
6603         (Chunked_vector::clear): Clear size_.
6604         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6605         (Chunked_vector::size): Return size_.
6606         (Chunked_vector::push_back): Use size_ to find insert position.
6607         (Chunked_vector::size_): New data member.
6608         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6609         (Stringpool_template::new_key_offset): New method declaration.
6610         (Stringpool_template::offset_): New data member.
6611
6612 2010-03-15   Rafael Espindola  <espindola@google.com>
6613
6614         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6615         Add_symbols' constructor.
6616         * readsyms.h (Add_symbols): Remove the input_group member.
6617
6618 2010-03-10  Ian Lance Taylor  <iant@google.com>
6619
6620         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6621         target to ask whether a reference to a symbol requires a stack
6622         split.
6623         * target.h (Target::is_call_to_non_split): New function.
6624         (Target::do_is_call_to_non_split): Declare virtual function.
6625         * target.cc: Include "symtab.h".
6626         (Target::do_is_call_to_non_split): New function.
6627         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6628
6629 2010-03-10  Cary Coutant  <ccoutant@google.com>
6630
6631         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6632         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6633         (File_read::open[2]): Add whole_file_view_ to list of views.
6634         (File_read::make_view): Remove test of whole_file_view_.
6635         (File_read::find_or_make_view): Create whole_file_view_ if
6636         necessary.
6637         (File_read::clear_views): Replace bool parameter with enum;
6638         adjust all callers.  Don't delete views with permanent data;
6639         do delete cached views and views from archives if
6640         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6641         if clearing the corresponding view.
6642         * fileread.h (File_read::Clear_views_mode): New enum.
6643         (File_read::View::is_permanent_view): New method.
6644         (File_read::clear_views): Replace bool parameter
6645         with enum; adjust all callers.
6646         * options.h (General_options): Change keep_files_mapped option;
6647         add map_whole_files.
6648         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6649         releasing the file.
6650         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6651         the file.
6652
6653 2010-03-10  David S. Miller  <davem@davemloft.net>
6654
6655         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6656
6657 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6658
6659         * icf.cc (get_section_contents): Add '@' marker after processing the
6660         merge reloc.
6661
6662 2010-03-08  Doug Kwan  <dougkwan@google.com>
6663
6664         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6665         due to a conversion warning.
6666         (Arm_relobj::update_output_local_symbol_count): Check for local
6667         symbol with unset output index.
6668
6669 2010-03-05  Ian Lance Taylor  <iant@google.com>
6670
6671         * options.h (class General_options): Add --spare-dynamic-tags.
6672         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6673         --spare-dynamic-tags.
6674
6675 2010-03-05  Ian Lance Taylor  <iant@google.com>
6676
6677         * incremental.cc: Include "libiberty.h".
6678
6679 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6680
6681         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6682         function, is_info_ member.
6683         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6684         (Versions::Versions): Update caller.
6685         (Versions::define_base_version): Likewise.
6686         (Versions::add_def): Likewise.
6687
6688 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6689
6690         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6691         (Scan::possible_function_pointer_reloc): New function.
6692         (Scan::local_reloc_may_be_function_pointer): Change to call
6693         possible_function_pointer_reloc.
6694         (Scan::global_reloc_may_be_function_pointer): Ditto.
6695         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6696         relocations in ".data.rel.ro._ZTV" section.
6697         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6698         * testsuite/icf_safe_so_test.cc: Ditto.
6699         * testsuite/icf_safe_test.cc: Ditto.
6700         * testsuite/icf_safe_test.sh: Ditto.
6701
6702 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6703             Ian Lance Taylor  <iant@google.com>
6704
6705         * target-reloc.h (relocate_section): Check the symbol table index
6706         for -1U before setting the local symbol index.
6707         (scan_relocatable_relocs): If copying the relocation, record that
6708         the local symbol is required.
6709         * object.h (Symbol_value::is_output_symtab_index_set): New
6710         function.
6711         (Symbol_value::may_be_discarded_from_output_symtab): New
6712         function.
6713         (Symbol_value::has_output_symtab_entry): New function.
6714         (Symbol_value::needs_output_symtab_entry): Remove.
6715         (Symbol_value::output_symtab_index): Make sure the symbol index is
6716         set.
6717         (Symbol_value::set_output_symtab_index): Make sure the symbol
6718         index is not set.  Make sure the new index is valid.
6719         (Symbol_value::set_must_have_output_symtab_entry): New function.
6720         (Symbol_value::has_output_dynsym_entry): New function.
6721         (Symbol_value::set_output_dynsym_index): Make sure the new index
6722         is valid.
6723         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6724         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6725         local symbol if permitted.
6726         (Sized_relobj::do_finalize_local_symbols): Call
6727         is_output_symtab_index_set rather than needs_output_symtab_entry.
6728         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6729         rather than needs_output_symtab_entry.  Call
6730         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6731         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6732         is_output_symtab_index_set rather than needs_output_symtab_entry.
6733         * testsuite/discard_locals_relocatable_test.c: New file.
6734         * testsuite/discard_locals_test.sh: Test -r.
6735         * testsuite/Makefile.am (check_DATA): Add
6736         discard_locals_relocatable_test1.syms,
6737         discard_local_relocatable_test2.syms.
6738         (MOSTLYCLEANFILES): Likewise.  Also add
6739         discard_locals_relocatable_test1.lout and
6740         discard_locals_relocatable_test2.out.
6741         (discard_locals_relocatable_test1.syms): New target.
6742         (discard_locals_relocatable_test.o): New target.
6743         (discard_locals_relocatable_test1.out): New target.
6744         (discard_locals_relocatable_test2.syms): New target.
6745         (discard_locals_relocatable_test2.out): New target.
6746         (various): Add missing ../ld-new dependencies.
6747         * testsuite/Makefile.in: Rebuild.
6748
6749 2010-03-03  Nick Clifton  <nickc@redhat.com>
6750
6751         * po/fi.po: New Finnish translation.
6752
6753 2010-03-01  Doug Kwan  <dougkwan@google.com>
6754
6755         * layout.cc (Layout::Layout): Force section types of .init_array*,
6756         .preinit_array* and .fini_array* sections.
6757         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6758         Fix check of return value of std::string::find.().
6759         (Output_section::Input_section_sort_compare::operator()): Remove
6760         comment about .init_array.
6761         (Output_section::Input_section_sort_init_fini_compare::operator()):
6762         New method.
6763         (Output_section::sort_attached_input_sections): Handle .init_array
6764         and .fini_array specially.
6765         * output.h (Output_section::Inut_section_sort_compare): Update
6766         comment.
6767         (Output_section::Input_section_sort_init_fini_compare): New struct.
6768
6769 2010-02-26  Doug Kwan  <dougkwan@google.com>
6770
6771         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6772         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6773         * testsuite/debug_msg.sh: Avoid matching source line number for
6774         use of global variable undef_int.
6775
6776 2010-02-26  Doug Kwan  <dougkwan@google.com>
6777
6778         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6779         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6780         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6781         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6782         * options.cc (General_options::General_options): Initialize member
6783         fix_v4bx_.
6784         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6785         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6786         and rm_no_fix_v4bx.stdout
6787         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6788         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6789         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6790         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6791         and arm_no_fix_v4bx.
6792         * Makefile.in: Regenerate.
6793         * testsuite/arm_fix_v4bx.s: New file.
6794         * testsuite/arm_fix_v4bx.sh: Ditto.
6795
6796 2010-02-24  Doug Kwan  <dougkwan@google.com>
6797
6798         * arm.cc (Target_arm::got_section): Make the .got section the first
6799         non RELRO section in the data segment.
6800         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6801         suffixes of section names.
6802
6803 2010-02-24  Doug Kwan  <dougkwan@google.com>
6804
6805         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6806         flags and attributes merging if an input file is a binary file.
6807         * fileread.cc (Input_file::open): Record format of original file.
6808         * fileread.h (Input_file::Format): New enum type.
6809         (Input_file::Input_file): Initialize data member format_.
6810         (Input_file::format): New method definition.
6811         (Input_file::format_):: New data member.
6812
6813 2010-02-24  Doug Kwan  <dougkwan@google.com>
6814
6815         * arm.cc (Arm_output_data_got): New class.
6816         (ARM_TCB_SIZE): New constant
6817         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6818         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6819         If user uses a script with a SECTIONS clause, issue only a warning
6820         for a misplaced EXIDX input section.  Otherwise, issue an error.
6821         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6822         garbage collection.
6823         (Target_arm::got_mode_index_entry): Handle static linking.
6824         (Target_arm::Scan::local): Ditto.
6825         (Target_arm::Scan::global): Ditto.
6826         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6827         all incorrectly implemented relocations.
6828         (Target_arm::fix_exidx_coverage): Pass layout to
6829         Arm_output_section::fix_exidx_coverage.
6830         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6831         from ".ARM.exidx." and ".ARM.extab.".
6832
6833 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6834
6835         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6836         section if it does not already exist.
6837         * attributes.cc (Attributes_section_data::Attributes_section_data):
6838         Don't crash if size is zero.
6839
6840 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6841             Ian Lance Taylor  <iant@google.com>
6842
6843         * gold.cc (queue_middle_tasks): If no input files were opened,
6844         exit.
6845         * workqueue.h (Task_function::Task_function): Assert that there is
6846         a blocker.
6847
6848 2010-02-22  Doug Kwan  <dougkwan@google.com>
6849
6850         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6851         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6852         types to avoid warnings due to different uint64_t implementations
6853         on different hosts.
6854
6855 2010-02-21  Doug Kwan  <dougkwan@google.com>
6856
6857         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6858         handling of the maximum backward branch offset.
6859         (Arm_relocate_functions::thumb_branch_common): Ditto.
6860         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6861         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6862         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6863         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6864         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6865         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6866         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6867         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6868         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6869         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6870         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6871         thumb2_bl_out_of_range.o): New rules.
6872         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6873         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6874         thumb2_bl_out_of_range
6875         * testsuite/Makefile.in: Regenerate.
6876         * testsuite/arm_bl_in_range.s: New file.
6877         * testsuite/arm_bl_out_of_range.s: Ditto.
6878         * testsuite/arm_branch_in_range.sh: Ditto.
6879         * testsuite/arm_branch_range.t: Ditto.
6880         * testsuite/thumb2_branch_range.t: Ditto.
6881         * testsuite/thumb_bl_in_range.s: Ditto.
6882         * testsuite/thumb_bl_out_of_range.s: Ditto.
6883         * testsuite/thumb_branch_range.t: Ditto.
6884
6885 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6886
6887         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6888         Add reloc offset information.
6889         * icf.cc (get_section_contents): Change iterators to point to the new
6890         vectors. Add reloc offset information to the contents.
6891         * icf.h (Icf::Sections_reachable_info): New typedef.
6892         (Icf::Sections_reachable_list): New typedef.
6893         (Icf::Offset_info): New typedef.
6894         (Icf::Reloc_info): New struct typedef.
6895         (Icf::Reloc_info_list): New typedef.
6896         (Icf::symbol_reloc_list): Delete method.
6897         (Icf::addend_reloc_list): Delete method.
6898         (Icf::section_reloc_list): Delete method.
6899         (Icf::reloc_info_list): New method.
6900         (Icf::reloc_info_list_): New member.
6901
6902 2010-02-19  Doug Kwan  <dougkwan@google.com>
6903
6904         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6905         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6906         * arm.cc (Arm_relocation_functions): New forward declaration.
6907         (Target_arm::Target_arm): Initialize new data members
6908         got_mod_index_offset_ and tls_base_symbol_defined_.
6909         (Target_arm::Relocate::relocate_tls): New method.
6910         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6911          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6912         New methods.
6913         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6914         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6915         (Target_arm::got_mod_index_offset_,
6916         Target_arm::tls_base_symbol_defined_): New data members.
6917         (Target_arm::Scan::local, Target::Scan::global,
6918         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6919         relocations.
6920
6921 2010-02-18  Doug Kwan  <dougkwan@google.com>
6922
6923         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6924         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6925         text section as a parameter becuase some broken tools may not set
6926         the link in section header.
6927         (Target_arm::has_got_section): New method.
6928         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6929         without any mapping symbol as data only.  Remove warning.
6930         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6931         link in its section header, try to discover the link by inspecting the
6932         REL31 relocation at the beginning of the section.
6933         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6934         in error message.
6935         (Target_arm::Scan::global): Treat any reference to the symbol
6936         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6937
6938 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6939
6940         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6941         (Scan::global_reloc_may_be_function_pointer): New function.
6942         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6943         (Scan::global_reloc_may_be_function_pointer): New function.
6944         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6945         (Scan::global_reloc_may_be_function_pointer): New function.
6946         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6947         (Scan::global_reloc_may_be_function_pointer): New function.
6948         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6949         (Scan::global_reloc_may_be_function_pointer): New function.
6950         (Scan::possible_function_pointer_reloc): New function.
6951         (Target_x86_64::can_check_for_function_pointers): New function.
6952         * gc.h (gc_process_relocs): Scan relocation types to determine if
6953         function pointers were taken for targets that support it.
6954         * icf.cc (Icf::find_identical_sections): Include functions for
6955         folding in safe ICF whose pointer is not taken.
6956         * icf.h (Secn_fptr_taken_set): New typedef.
6957         (fptr_section_id_): New member.
6958         (section_has_function_pointers): New function.
6959         (set_section_has_function_pointers): New function.
6960         (check_section_for_function_pointers): New function.
6961         * options.h: Fix comment for safe ICF option.
6962         * target.h (can_check_for_function_pointers): New function.
6963         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6964         Modify icf_safe_test for X86-64.
6965         * testsuite/Makefile.in: Regenerate.
6966         * testsuite/icf_safe_so_test.cc: New file.
6967         * testsuite/icf_safe_so_test.sh: New file.
6968         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6969         (main): Change to take pointer to function kept_func_3.
6970         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6971         folding is done correctly for X86-64.
6972
6973 2010-02-12  David S. Miller  <davem@davemloft.net>
6974
6975         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6976         is_symbolless parameter.
6977         (Output_reloc<SHT_REL>::is_symbolless): New.
6978         (Output_reloc<SHT_REL>::is_symbolless_): New.
6979         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6980         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6981         (Output_reloc<SHT_RELA>::is_symbolless): New.
6982         (Output_data_reloc::add_global): Handle is_symbolless.
6983         (Output_data_reloc::add_global_relative): Likewise.
6984         (Output_data_reloc::add_local): Likewise.
6985         (Output_data_reloc::add_local_relative): Likewise.
6986         (Output_data_reloc::add_symbolless_global_addend): New.
6987         (Output_data_reloc::add_symbolless_local_addend): New.
6988         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6989         is_symbolless.
6990         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6991         instead of ->is_relative_
6992         (Output_reloc::write): Likewise.
6993         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6994         (Output_reloc::write_rel): Simplify.
6995
6996         * sparc.cc (Target_sparc::Scan::local): Use
6997         ->add_symbolless_local_addend as needed.
6998         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6999         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7000         based upon relocation offset.
7001
7002 2010-02-11  Doug Kwan  <dougkwan@google.com>
7003
7004         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7005         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7006         beginning of function.
7007         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7008         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7009         parameter is_32bit in calls to should_apply_static_reloc.
7010         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7011         (check_DATA): Add arm_abs_global.stdout.
7012         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7013         arm_abs_global.stdout): New rules.
7014         (MOSTLLYCLEANFILES): Add arm_abs_global
7015         * Makefile.in: Regenerate.
7016         * testsuite/arm_abs_global.s: New file.
7017         * testsuite/arm_abs_global.sh: Ditto.
7018         * testsuite/arm_abs_lib.s: Ditto.
7019
7020 2010-02-11  Ian Lance Taylor  <iant@google.com>
7021
7022         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7023         Read_relocs task.
7024         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7025         Allocate_commons_task first.
7026         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7027         task, rather than symtab_lock_.
7028         (Gc_process_relocs::~Gc_process_relocs): New function.
7029         (Gc_process_relocs::is_runnable): Check this_blocker_.
7030         (Gc_process_relocs::locks): Use next_blocker_ rather than
7031         blocker_.
7032         (Scan_relocs::~Scan_relocs): New function.
7033         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7034         symtab_lock_.
7035         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7036         next_blocker_.
7037         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7038         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7039         constructor accordingly.
7040         (class Gc_process_relocs): Likewise.
7041         (class Scan_relocs): Likewise.
7042         * common.h (class Allocate_commons_task): Remove symtab_lock_
7043         field, and corresponding constructor parameter.
7044         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7045         symtab_lock_.
7046         (Allocate_commons_task::locks): Likewise.
7047
7048 2010-02-11  Ian Lance Taylor  <iant@google.com>
7049
7050         * gold-threads.h (class Once): Define.
7051         (class Initialize_lock): Rewrite as child of Once.
7052         * gold-threads.cc (class Once_initialize): Define.
7053         (once_pointer_control): New static variable.
7054         (once_pointer, once_arg): New static variables.
7055         (c_run_once): New static function.
7056         (Once::Once, Once::run_once, Once::internal_run): New functions.
7057         (class Initialize_lock_once): Remove.
7058         (initialize_lock_control): Remove.
7059         (initialize_lock_pointer): Remove.
7060         (initialize_lock_once): Remove.
7061         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7062         (Initialize_lock::initialize): Rewrite.
7063         (Initialize_lock::do_run_once): New function.
7064         * archive.cc (Archive::interpret_header): Only clear name if it is
7065         not already empty.
7066         * fileread.cc: Include "gold-threads.h"
7067         (file_counts_lock): New static variable.
7068         (file_counts_initialize_lock): Likewise.
7069         (File_read::release): Only increment counts when using --stats.
7070         Use a lock around the increment.
7071         * parameters.cc (class Set_parameters_target_once): Define.
7072         (set_parameters_target_once): New static variable.
7073         (Parameters::Parameters): Move here from parameters.h.
7074         (Parameters::set_target): Rewrite.
7075         (Parameters::set_target_once): New function.
7076         (Parameters::clear_target): Move here and rewrite.
7077         * parameters.h (class Parameters): Update declarations.  Add
7078         set_parameters_target_once_ field.
7079         (Parameters::Parameters): Move to parameters.cc.
7080         (Parameters::clear_target): Likewise.
7081         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7082         task.
7083         (Start_group::~Start_group): New function.
7084         (Start_group::is_runnable): New function.
7085         (Start_group::locks, Start_group::run): New functions.
7086         (Finish_group::run): Change saw_undefined to size_t.
7087         * readsyms.h (class Start_group): Define.
7088         (class Finish_group): Change saw_undefined_ field to size_t.
7089         (Finish_group::Finish_group): Remove saw_undefined and
7090         this_blocker parameters.  Change all callers.
7091         (Finish_group::set_saw_undefined): New function.
7092         (Finish_group::set_blocker): New function.
7093         * symtab.h (class Symbol_table): Change saw_undefined to return
7094         size_t.  Change saw_undefined_ field to size_t.
7095         * target-select.cc (Set_target_once::do_run_once): New function.
7096         (Target_selector::Target_selector): Initialize set_target_once_
7097         field.  Don't initialize lock_ and initialize_lock_ fields.
7098         (Target_selector::instantiate_target): Rewrite.
7099         (Target_selector::set_target): New function.
7100         * target-select.h (class Set_target_once): Define.
7101         (class Target_selector): Update declarations.  Make
7102         Set_target_once a friend.  Remove lock_ and initialize_lock_
7103         fields.  Add set_target_once_ field.
7104
7105 2010-02-10  Ian Lance Taylor  <iant@google.com>
7106
7107         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7108         queueing any tasks.
7109         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7110         (queue_middle_tasks): Add all blockers before queueing any tasks.
7111         (queue_final_tasks): Likewise.
7112         * token.h (Task_token::add_blockers): New function.
7113         * object.h (Input_objects::number_of_relobjs): New function.
7114
7115 2010-02-10  Ian Lance Taylor  <iant@google.com>
7116
7117         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7118         shared, not if not position independent.
7119         * x86_64.cc (Relocate::relocate_tls): Likewise.
7120         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7121         (tls_pie_pic_test): New target.
7122         * testsuite/Makefile.in: Rebuild.
7123
7124         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7125         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7126         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7127         * testsuite/Makefile.in: Rebuild.
7128
7129 2010-02-09  David S. Miller  <davem@davemloft.net>
7130
7131         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7132         R_SPARC_RELATIVE using ->add_local_relative().
7133         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7134
7135         * output.h (Output_data_dynamic::add_section_size): New method
7136         that takes two Output_data objects.
7137         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7138         entry param.  Handle it in initializers.
7139         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7140         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7141         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7142         arg.
7143         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7144         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7145         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7146         for dynrel_includes_plt.
7147         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7148         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7149         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7150         before .rela.plt
7151         (Target_sparc::do_finalize_sections): Update to pass true for
7152         dynrel_includes_plt.
7153         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7154         output before .rela.plt
7155         (Target_powerpc::do_finalize_sections): Update to pass true for
7156         dynrel_includes_plt when 32-bit.
7157
7158 2010-02-08  Doug Kwan  <dougkwan@google.com>
7159
7160         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7161         method.
7162         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7163         Arm_relobj::scan_section_for_cortex_a8_stubs,
7164         Arm_relobj::do_relocation_section): Instead of calling
7165         Output_section::output_address, use faster
7166         Arm_relobj::simple_input_section_output_address.
7167
7168 2010-02-08  David S. Miller  <davem@davemloft.net>
7169
7170         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7171         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7172         relocation helper function.
7173
7174         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7175         just like R_SPARC_GOT{10,13,22}.
7176         (Target_sparc::Scan::local): Likewise.
7177         (Target_sparc::Relocate:relocate): Likewise.
7178
7179 2010-02-06  Ian Lance Taylor  <iant@google.com>
7180
7181         * configure.ac: Rewrite targetobjs duplicate removal code to use
7182         only shell constructs.
7183         * configure: Rebuild.
7184
7185 2010-02-05  Doug Kwan  <dougkwan@google.com>
7186
7187         PR 11247
7188         * arm.cc (Arm_relobj::section_is_scannable): New method.
7189         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7190         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7191
7192 2010-02-04  Doug Kwan  <dougkwan@google.com>
7193
7194         PR 11247
7195         * arm-reloc-property.cc (cstdio): Include.
7196         * configure.ac (targetobjs): Remove duplicates.
7197         * configure: Regenerate.
7198         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7199         big and little endian version for a given address size.
7200
7201 2010-02-03  Doug Kwan  <dougkwan@google.com>
7202
7203         * arm-reloc-property.cc
7204         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7205         definition.
7206         * arm-reloc-property.h
7207         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7208         New method definition.
7209         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7210         declaration.
7211         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7212         overflow to N.
7213         (GOT_PREL): Change implemented to Y.
7214         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7215         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7216         (Arm_relocate_functions::movw_abs_nc): Remove method.
7217         (Arm_relocate_functions::movt_abs): Ditto.
7218         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7219         (Arm_relocate_functions::thm_movt_abs): Ditto.
7220         (Arm_relocate_functions::movw_rel_nc): Ditto.
7221         (Arm_relocate_functions::movw_rel): Ditto.
7222         (Arm_relocate_functions::movt_rel): Ditto.
7223         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7224         (Arm_relocate_functions:thm_movw_rel): Ditto.
7225         (Arm_relocate_functions:thm_movt_rel): Ditto.
7226         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7227         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7228         New method definitions.
7229         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7230         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7231         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7232         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7233         (Target_arm::Relocate::relocate): Check for non-static or
7234         unimplemented relocation code and exit early.  Change calls to
7235         Target_arm::reloc_uses_thumb_bit and
7236         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7237         instead.  Refactor code to handle similar relocations to increase
7238         code sharing.  Remove check for unsupported relocation code in switch
7239         statement.
7240         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7241         relocation property table to find out size.  Change error message to
7242         print out the name of a relocation code instead of the numeric value.
7243         (Target_arm::scan_reloc_for_stub): Use relocation property table
7244         instead of calling Target_arm::reloc_uses_thumb_bit().
7245
7246 2010-02-02  Doug Kwan  <dougkwan@google.com>
7247
7248         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7249         types of relaxed input section.
7250
7251 2010-02-02  Doug Kwan  <dougkwan@google.com>
7252
7253         * Makefile.am (HFILES): Add arm-reloc-property.h.
7254         (DEFFILES): New.
7255         (TARGETSOURCES): Add arm-reloc-property.cc
7256         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7257         (libgold_a_SOURCES): $(DEFFILES)
7258         * Makefile.in: Regenerate.
7259         * arm-reloc-property.cc: New file.
7260         * arm-reloc-property.h: New file.
7261         * arm-reloc.def: New file.
7262         * arm.cc: Update comments.
7263         (arm-reloc-property.h): New included header.
7264         (arm_reloc_property_table): New global variable.
7265         (Target_arm::do_select_as_default_target): New method definition.
7266         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7267         arm-reloc-property to targ_extra_obj.
7268         * parameters.cc (set_parameters_target): Call
7269         Target::select_as_default_target().
7270         * target.h (Target::select_as_default_target): New method definition.
7271         (Target::do_select_as_default_target): Same.
7272
7273 2010-02-01  Doug Kwan  <dougkwan@google.com>
7274
7275         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7276         first_output_text_section_.
7277         (Arm_exidx_fixup::first_output_text_section): New method definition.
7278         (Arm_exidx_fixup::first_output_text_section_): New data member.
7279         (Arm_exidx_fixup::process_exidx_section): Record the first text
7280         output section seen.
7281         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7282         and entsize in output section header.
7283
7284 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7285
7286         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7287         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7288         (Arm_relocate_functions::thm_alu11): New Method.
7289         (Arm_relocate_functions::thm_pc8): New Method.
7290         (Arm_relocate_functions::thm_pc12): New Method.
7291         (Target_arm::Scan::local): Handle the relocations.
7292         (Target_arm::Scan::global): Likewise.
7293         (Target_arm::Relocate::relocate): Likewise.
7294         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7295
7296 2010-01-29  Doug Kwan  <dougkwan@google.com>
7297
7298         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7299         of relocation types as ld.
7300
7301 2010-01-29  Doug Kwan  <dougkwan@google.com>
7302
7303         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7304         to public.
7305         (Arm_relocate_functions::thumb_branch_common): Ditto.
7306         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7307         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7308         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7309         Arm_relocate_functions::jump24): Remove.
7310         (Target_arm::Relocate::relocate): Adjust code to call
7311         Arm_relocation_functions::arm_branch_common and
7312         Arm_relocation_functions::thumb_branch_common instead of their removed
7313         wrappers.  Merge switch-cases together to reduce source code size.
7314
7315 2010-01-29  Doug Kwan  <dougkwan@google.com>
7316
7317         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7318         output_local_symbol_count_needs_update_.
7319         (Arm_relobj::output_local_symbol_count_needs_update,
7320          Arm_relobj::set_output_local_symbol_count_needs_update,
7321          Arm_relobj::update_output_local_symbol_count): New methods.
7322         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7323         member.
7324         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7325         of pointed function as in a R_ARM_PREL31 relocation.
7326         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7327         for output local symbol count updating.
7328         (Target_arm::do_relax): Update output local symbol counts in objects
7329         if necessary.
7330         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7331
7332 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7333
7334         * arm.cc: Added support for the ARM relocations:
7335         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7336         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7337         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7338         movw_prel_nc).
7339         (Arm_relocate_functions::movw_rel): New method.
7340         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7341         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7342         thm_movw_prel_nc).
7343         (Arm_relocate_functions::thm_movw_rel): New method.
7344         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7345         thm_movt_prel).
7346         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7347         relocations.
7348         (Target_arm::Scan::global): Likewise.
7349         (Target_arm::Relocate::relocate): Likewise.
7350         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7351         Likewise.
7352
7353 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7354
7355         * arm.cc: Added support for ARM group relocations.
7356         (Target_arm::reloc_needs_sym_origin): New method.
7357         (Arm_relocate_functions::calc_grp_kn): New method.
7358         (Arm_relocate_functions::calc_grp_residual): New method.
7359         (Arm_relocate_functions::calc_grp_gn): New method.
7360         (Arm_relocate_functions::arm_grp_alu): New Method.
7361         (Arm_relocate_functions::arm_grp_ldr): New Method.
7362         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7363         (Arm_relocate_functions::arm_grp_ldc): New Method.
7364         (Target_arm::Scan::local): Handle the ARM group relocations.
7365         (Target_arm::Scan::global): Likewise.
7366         (Target_arm::Relocate::relocate): Likewise.
7367         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7368         Likewise.
7369
7370 2010-01-26  Doug Kwan  <dougkwan@google.com>
7371
7372         * arm.cc (set): Include.
7373         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7374         pointer type.
7375         (Arm_output_section::Text_section_list): New type.
7376         (Arm_output_section::append_text_sections_to_list): New method.
7377         (Arm_output_section::fix_exidx_coverage): Ditto.
7378         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7379         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7380         Relobj::set_section_offset() instead of
7381         Sized_relobj::invalidate_section_offset().
7382         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7383         parameter for section headers. Ignore relocation sections for
7384         unallocated sections and EXIDX sections.
7385         (Target_arm::fix_exidx_coverage): New method.
7386         (Target_arm::output_section_address_less_than): New type.
7387         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7388         linked text section instead of the EXIDX section.
7389         (Arm_output_section::create_stub_group): Add an assertion to check
7390         that this is not an EXIDX output section.
7391         (Arm_output_section::append_text_sections_to_list): New method.
7392         (Arm_output_section::fix_exidx_coverage): Ditto.
7393         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7394         Arm_relobj::section_needs_reloc_stub_scanning.
7395         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7396         first pass.
7397         (Target_arm::fix_exidx_coverage): New method.
7398         * object.h (Relobj::set_output_section): New method.
7399         (Sized_relobj::invalidate_section_offset): Remove method.
7400         (Sized_relobj::do_invalidate_section_offset): Remove method.
7401         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7402
7403 2010-01-25  Doug Kwan  <dougkwan@google.com>
7404
7405         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7406         Fix warning due to signed and unsigned comparison on a 32-bit host.
7407
7408 2010-01-22  Doug Kwan  <dougkwan@google.com>
7409
7410         * arm.cc (Target_arm::do_relax): Record an output section for section
7411         offset adjustment it contains any stub table that has changed.
7412         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7413         offsets in an output section if necessary.
7414         * output.cc (Output_section::Output_section): Initialize
7415         section_offsets_need_adjustments_.
7416         (Output_section::add_input_section_for_script): Renamed to
7417         Output_section::add_simple_input_section.
7418         (Output_section::save_states): Add a comment.
7419         (Output_section::discard_states): New method defintion.
7420         (Output_section::adjust_section_offsets): Same.
7421         * output.h (Output_section::add_input_section_for_script): Renamed to
7422         Output_section::add_simple_input_section.
7423         (Output_section::discard_states): New method declaration.
7424         (Output_section::adjust_section_offsets): Same.
7425         (Output_section::section_offsets_need_adjustment,
7426         Output_section::set_section_offsets_need_adjustment): New method
7427         definitions.
7428         (Output_section::section_offsets_need_adjustment_): New data member.
7429         * script-sections.cc
7430         (Output_section_element_input::set_section_address): Adjust code for
7431         renaming of Output_section::add_input_section_for_script.
7432         (Orphan_output_section::set_section_address): Same.
7433
7434 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7435
7436         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7437         Fix_v4bx enum values .
7438         * gold/options.h (General_options): New option definitions.
7439         (General_options::fix_v4bx): New method.
7440         (General_options::Fix_v4bx): New enum.
7441         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7442         (General_options::parse_fix_v4bx_interworking): New method.
7443
7444 2010-01-22  Doug Kwan  <dougkwan@google.com>
7445
7446         * arm.cc (Arm_exidx_fixup): New class.
7447
7448 2010-01-21  Doug Kwan  <dougkwan@google.com>
7449
7450         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7451         classes.
7452         (Arm_exidx_section_offset_map): New type.
7453
7454 2010-01-21  Doug Kwan  <dougkwan@google.com>
7455
7456         * arm.cc (Arm_exidx_input_section): New class.
7457         (Arm_relobj::exidx_input_section_by_link,
7458         Arm_relobj::exidx_input_section_by_shndx,
7459         Arm_relobj::make_exidx_input_section): New methods.
7460         (read_arm_attributes_section): Remove.
7461         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7462         information about them.
7463         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7464         to here.
7465
7466 2010-01-20  Doug Kwan  <dougkwan@google.com>
7467
7468         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7469         Input_section_specifier to Section_id.
7470         (Target_arm::new_arm_input_section: Adjust code for change of key
7471         type.
7472         (Target_arm::find_arm_input_section): Ditto.
7473         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7474         (Section_id): Remove.
7475         (Garbage_collection::Section_id_hash): Remove.
7476         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7477         (Section_id): Remove.
7478         (Icf::Section_id_hash): Remove.
7479         * object.h (Section_id, Const_section_id, Section_id_hash,
7480         Const_section_id_hash): New type definitions.
7481         * output.cc (Output_section::add_relaxed_input_section): Change to
7482         use Const_section_id instead of Input_section_specifier as key type.
7483         (Output_section::add_merge_input_section): Ditto.
7484         (Output_section::build_relaxation_map): Change to use Section_id
7485         instead of Input_section_specifier as key type.
7486         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7487         Ditto.
7488         (Output_section::convert_input_sections_to_relaxed_sections): Change
7489         to use Const_section_id instead of Input_section_specifier as key type.
7490         (Output_section::find_merge_section): Ditto.
7491         (Output_section::find_relaxed_input_section): Ditto.
7492         * output.h (Input_section_specifier): Remove class.
7493         (Output_section::Output_section_data_by_input_section_map): Change
7494         key type to Const_section_id.
7495         (Output_section::Output_relaxed_input_section_by_input_section_map):
7496         Ditto.
7497         (Output_section::Relaxation_map): Change key type to Section_id.
7498
7499 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7500
7501         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7502         (class Arm_v4bx_stub): New class.
7503         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7504         (Stub_factory::make_arm_v4bx_stub): New method.
7505         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7506         (Stub_table::empty): Handle v4bx stubs.
7507         (Stub_table::add_arm_v4bx_stub): New method.
7508         (Stub_table::find_arm_v4bx_stub): New method.
7509         (Arm_relocate_functions::v4bx): New method.
7510         (Target_arm::fix_v4bx): New method.
7511         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7512         (Stub_table::relocate_stubs): Likewise.
7513         (Stub_table::do_write): Likewise.
7514         (Stub_table::update_data_size_and_addralign): Likewise.
7515         (Stub_table::finalize_stubs):  Likewise.
7516         (Target_arm::Scan::local): Likewise.
7517         (Target_arm::Scan::global): Likewise.
7518         (Target_arm::do_finalize_sections): Likewise.
7519         (Target_arm::Relocate::relocate): Likewise.
7520         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7521         Likewise.
7522         (Target_arm::scan_reloc_for_stub): Likewise.
7523         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7524
7525 2010-01-19  Ian Lance Taylor  <iant@google.com>
7526
7527         * output.cc (Output_section_headers::do_sized_write): Write large
7528         segment count to sh_info field.
7529         (Output_file_header::do_sized_write): For large segment count,
7530         write PN_XNUM to e_phnum field.
7531
7532 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7533
7534         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7535         (Arm_relocate_functions::thm_jump8): New function.
7536         (Arm_relocate_functions::thm_jump11): New function.
7537         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7538         R_ARM_THM_JUMP11.
7539         (Target_arm::Scan::global): Likewise.
7540         (Target_arm::Relocate::relocate): Likewise.
7541         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7542         Likewise.
7543
7544 2010-01-14  Doug Kwan  <dougkwan@google.com>
7545
7546         * arm.cc (map, utility): Include headers.
7547         (Target_arm::apply_cortex_a8_workaround): New method.
7548         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7549         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7550         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7551         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7552         the --[no-]fix-cortex-a8 command line options.
7553         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7554         (Target_arm::relocate_stub): Use addend in instruction template.
7555         * options.h (DEFINE_bool): Set the user-set flag.
7556         (General_options): Add --[no-]-fix-cortex options.
7557         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7558         : Update fast look-up map after conversion.
7559
7560 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7561
7562         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7563         in the first pass of do_layout.
7564
7565 2010-01-13  Doug Kwan  <dougkwan@google.com>
7566
7567         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7568         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7569         apparent compiler problem of not folding static constant integral
7570         data members of elfcpp::Elf_sizes<32>.
7571
7572 2010-01-13  Doug Kwan  <dougkwan@google.com>
7573
7574         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7575         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7576         Arm_relobj::scan_section_for_cortex_a8_erratum,
7577         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7578         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7579         sections to scan for relocation stubs into a new method
7580         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7581         relocation and Cortex-A8 stub scanning.
7582         (Target_arm::do_relax): Force stubs to be after stubbed sections
7583         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7584         the beginning of a new relaxation pass.  Update a comment.
7585         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7586
7587 2010-01-12  Ian Lance Taylor  <iant@google.com>
7588
7589         * target-reloc.h (visibility_error): New inline function.
7590         (relocate_section): Call visibility_error.
7591         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7592         (MOSTLYCLEANFILES): Likewise.
7593         (protected_4_pic.o, protected_3.err): New targets.
7594         * testsuite/protected_4.cc: New file.
7595
7596 2010-01-12  Doug Kwan  <dougkwan@google.com>
7597
7598         * arm.cc (Cortex_a8_reloc): New class.
7599         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7600         and cortex_a8_relocs_info_.
7601         (Target_arm::fix_cortex_a8): New method definition.
7602         (Target_arm::Cortex_a8_relocs_info): New type.
7603         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7604         New data member declarations.
7605         (Target_arm::scan_reloc_for_stub): Record information about
7606         relocations for THUMB branches that might be exempted from the
7607         Cortex-A8 workaround.
7608         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7609         at the beginning of a relaxation pass.
7610
7611 2010-01-12  Doug Kwan  <dougkwan@google.com>
7612
7613         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7614         (Arm_relobj::Mapping_symbol_position,
7615          Arm_reloj::Mapping_symbol_position_less,
7616          Arm_relobj::Mapping_symbols_info): New types.
7617         (Target_arm::is_mapping_symbol_name): New method definition.
7618         (Arm_relobj::do_count_local_symbols): Save information about mapping
7619         symbols.
7620
7621 2010-01-11  Doug Kwan  <dougkwan@google.com>
7622
7623         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7624         Arm_relocate_functions::thumb32_branch_upper,
7625         Arm_relocate_functions::thumb32_branch_lower,
7626         Arm_relocate_functions::thumb32_cond_branch_offset,
7627         Arm_relocate_functions::thumb32_cond_branch_upper,
7628         Arm_relocate_functions::thumb32_cond_branch_lower,
7629         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7630         branch offset encoding.
7631         (Arm_relocate_functions::thumb_branch_common): Use new branch
7632         offset encoding methods to avoid code duplication.
7633         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7634         (Stub_addend_reader::operator()): Use new branch encoding method
7635         to avoid code duplication.
7636
7637 2010-01-11  Doug Kwan  <dougkwan@google.com>
7638
7639         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7640         (Target_arm::do_finalize_sections): Define special EXIDX section
7641         symbols only if referenced.
7642         * gc.h (Garbage_collection::add_reference): New method.
7643         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7644         code duplication.
7645
7646 2010-01-11  Ian Lance Taylor  <iant@google.com>
7647
7648         * script.cc (Version_script_info::build_expression_list_lookup):
7649         Change complaing about duplicate wildcard match from error to
7650         warning.
7651
7652         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7653         of 2009-12-30.
7654         (Version_script_info::Version_script_info): Initialize globs_,
7655         default_version_, default_is_global_, and exact_.  Don't
7656         initialize globals_ or locals_.
7657         (Version_script_info::build_lookup_tables): Build local symbols
7658         first.
7659         (Version_script_info::unquote): New function.
7660         (Version_script_info::add_exact_match): New function.
7661         (Version_script_info::build_expression_list_lookup): Remove lookup
7662         parameter.  Add is_global parameter.  Change all callers.  Handle
7663         wildcard pattern specially.  Unquote pattern.  Call
7664         add_exact_match.
7665         (Version_script_info::get_name_to_match): New function.
7666         (Version_script_info::get_symbol_version): New function.
7667         (Version_script_info::get_symbol_version_helper): Remove.
7668         (Version_script_info::check_unmatched_names): Call unquote.
7669         * script.h (class Version_script_info): Change get_symbol_version
7670         to be non-inline and add is_global parameter; change all callers.
7671         Rewrite symbol_is_local.  Update declarations.  Define struct
7672         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7673         Remove globals_ and locals_ members.  Add exact_, globs_,
7674         default_version_, is_global_.
7675         (Version_script_info::Glob): Remove pattern, add expression and
7676         is_global.  Update constructor.  Change all callers.
7677         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7678         default version.
7679         (Versions::symbol_section_contents): If a symbol is undefined, or
7680         defined in a dynamic object, set the version index to
7681         VER_NDX_LOCAL.
7682         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7683         symbol_is_local.
7684         (Symbol_table::add_from_pluginobj): Likewise.
7685         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7686
7687 2010-01-11  Doug Kwan  <dougkwan@google.com>
7688
7689         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7690         (incremental_dump_LDADD): Add linking option for libintl.
7691         * Makefile.in: Regenerate.
7692
7693 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7694
7695         PR gold/11144
7696         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7697         instead of -Ds.
7698         * testsuite/Makefile.in: Regenerated.
7699
7700 2010-01-10  Doug Kwan  <dougkwan@google.com>
7701
7702         * options.h (DEFINE_var): Use parentheses around argument varname__
7703         in macro body to avoid any unintended subsequent substitutions.
7704
7705 2010-01-10  Ian Lance Taylor  <iant@google.com>
7706
7707         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7708         candidates before doing symbol resolution.
7709
7710         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7711         ODR candidates if only one is weak.
7712
7713 2010-01-08  Ian Lance Taylor  <iant@google.com>
7714
7715         * script.cc (Version_script_info::build_expression_list_lookup):
7716         Don't warn about ambiguous version, just record the ambiguity.
7717         (Version_script_info::get_symbol_version_helper): Give error if
7718         version is ambiguous.
7719
7720 2010-01-08  Doug Kwan  <dougkwan@google.com>
7721
7722         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7723         prev_data_size_ and prev_addralign_.  Remove initializer for
7724         deleted data member has_been_changed_.
7725         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7726         to determine if the table is empty.
7727         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7728         Remove.
7729         (Stub_table::add_reloc_stub): Define method in class definition
7730         instead of just declaring it there.
7731         (Stub_table::add_cortex_a8_stub): New method definition.
7732         (Stub_table::update_data_size_and_addralign): Ditto.
7733         (Stub_table::finalize_stubs): Ditto.
7734         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7735         (Stub_table::do_addralign_): Return address alignment in the
7736         (Stub_table::do_reset_address_and_file_offset): Define method in
7737         class definition instead of declaring it there.  Set current data
7738         size to be the data size of the previous pass.
7739         (Stub_table::set_final_data_size): Use current data size as the
7740         final data size.
7741         (Stub_table::relocate_stub): Change parameter type of stub from
7742         Reloc_stub pointer to Stub pointer.
7743         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7744         (Stub_table::Cortex_a8_stub_list): New typedef.
7745         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7746          Stub_table::prev_addralign_): New data member.
7747         (Arm_relobj::Arm_relobj): Initialize data member
7748         section_has_cortex_a8_workaround_.
7749         (Arm_relobj::section_has_cortex_a8_workaround,
7750          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7751          definitions.
7752         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7753         declarations.
7754         (Target_arm::relocate_stub): Change parameter type of stub from
7755         Reloc_stub pointer to Stub pointer.
7756         (Insn_template::size, Insn_template::alignment): Handle
7757         THUMB16_SPECIAL_TYPE.
7758         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7759          Stub_table::update_data_size_and_addralign,
7760          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7761         definitions.
7762         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7763         (Stub_table::do_write): Ditto.
7764         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7765
7766 2010-01-08  Ian Lance Taylor  <iant@google.com>
7767
7768         PR 11108
7769         * symtab.h (class Symbol): Remove fields is_target_special_ and
7770         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7771         (Symbol::is_defined_in_discarded_section): New function.
7772         (Symbol::set_is_defined_in_discarded_section): New function.
7773         (Symbol::has_plt_offset): Rewrite.
7774         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7775         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7776         Don't initialize is_target_special_ or has_plt_offset_.
7777         Initialize is_defined_in_discarded_section_.
7778         (Symbol_table::add_from_relobj): If appropriate, set
7779         is_defined_in_discarded_section.
7780         * resolve.cc (Symbol::override_base_with_special): Don't test
7781         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7782         * target-reloc.h (relocate_section): Do special handling for
7783         symbols defined in discarded sections for global symbols as well
7784         as local symbols.
7785
7786 2010-01-08  Ian Lance Taylor  <iant@google.com>
7787
7788         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7789         the SHT_SYMTAB case.
7790
7791 2010-01-08  Ian Lance Taylor  <iant@google.com>
7792
7793         * object.cc (Sized_relobj::do_layout): Don't get confused if
7794         layout_eh_frame returns NULL.
7795
7796 2010-01-08  Ian Lance Taylor  <iant@google.com>
7797
7798         PR 11084
7799         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7800         dynamic symbol table, use the normal symbol table.
7801         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7802         symbol table.
7803
7804 2010-01-08  Ian Lance Taylor  <iant@google.com>
7805
7806         PR 11072
7807         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7808         sections.
7809
7810 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7811
7812         * version.cc (print_version): Change to "Copyright 2010".
7813
7814 2010-01-08  Ian Lance Taylor  <iant@google.com>
7815
7816         PR 10287
7817         PR 11063
7818         * i386.cc (class Target_i386): Change return type of plt_section
7819         to be non-const.
7820         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7821         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7822         tls_desc_rel_ field.
7823         (Output_data_plt_i386::rel_tls_desc): New function.
7824         (Target_i386::rel_tls_desc_section): New function.
7825         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7826         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7827         R_386_TLS_DESC reloc in rel_tls_desc_section.
7828         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7829         Define struct Tlsdesc_info.
7830         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7831         (Target_x86_64::do_reloc_symbol_index): New function.
7832         (Target_x86_64::add_tlsdesc_info): New function.
7833         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7834         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7835         tlsdesc_rel_ field.
7836         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7837         all callers.
7838         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7839         (Target_x86_64::rela_tlsdesc_section): New function.
7840         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7841         handling.
7842         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7843         (Target_x86_64::do_reloc_addend): New function.
7844         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7845         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7846         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7847         (Output_reloc::type): New function.
7848         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7849         (Output_reloc::is_target_specific): New function.
7850         (Output_reloc::target_arg): New function.
7851         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7852         absolute relocs and target specific relocs.
7853         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7854         add_target_specific.
7855         (class Output_data_reloc) [SHT_RELA]: Likewise.
7856         * output.cc (Output_reloc::Output_reloc): Add four new versions
7857         for absolute relocs and target specific relocs.
7858         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7859         (Output_reloc::get_symbol_index): Likewise.
7860         (Output_reloc::local_section_offset): Check that local_sym_index_
7861         is not TARGET_CODE or 0.
7862         (Output_reloc::symbol_value): Likewise.
7863         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7864         reloc.
7865         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7866         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7867         functions.
7868         * layout.cc (add_target_dynamic_tags): Use output section for
7869         DT_PLTRELSZ and DT_JMPREL.
7870
7871 2010-01-07  Ian Lance Taylor  <iant@google.com>
7872
7873         PR 11061
7874         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7875         function.
7876         (class Output_data_reloc_generic): Define.
7877         (class Output_data_reloc_base): Change base class to
7878         Output_data_reloc_generic.  Change add() method to call
7879         bump_relative_reloc_count for a relative reloc.  Remove
7880         sort_relocs_ field.
7881         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7882         to sort_relocs().
7883         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7884         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7885         appropriate.
7886         * layout.h (class Layout): Update declaration.
7887
7888 2010-01-07  Ian Lance Taylor  <iant@google.com>
7889
7890         * output.h (class Output_data): Add const version of
7891         output_section and do_output_section.
7892         (class Output_section_data): Add const version of
7893         do_output_section.
7894         (class Output_section): Likewise.
7895         * layout.cc (Layout::add_target_dynamic_tags): New function.
7896         * layout.h (class Layout): Update declarations.
7897         * arm.cc (Target_arm::do_finalize_sections): Use
7898         add_target_dynamic_tags.
7899         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7900         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7901         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7902         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7903
7904 2010-01-07  Ian Lance Taylor  <iant@google.com>
7905
7906         PR 11042
7907         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7908         object as needed.
7909
7910 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7911             Ian Lance Taylor  <iant@google.com>
7912
7913         PR 11019
7914         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7915         Xindex::read_symtab_xindex.
7916
7917 2010-01-07  Doug Kwan  <dougkwan@google.com>
7918
7919         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7920         (Insn_template::thumb16_bcond_insn): New method declaration.
7921         (Insn_template): Fix spelling.
7922         (Stub::thumb16_special): New method declaration.
7923         (Stub::do_write): Define virtual method which was previously pure
7924         virtual.
7925         (Stub::do_thumb16_special): New method declaration.
7926         (Stub::do_fixed_endian_write): New template member.
7927         (Reloc_stub::do_write): Remove.
7928         (Reloc_stub::do_fixed_endian_write): Remove.
7929         (Cortex_a8_stub): New class definition.
7930         (Stub_factory::make_cortex_a8_stub): New method definition.
7931         (Stub_factory::Stub_factory): Add missing static storage class
7932         qualifier for elf32_arm_stub_a8_veneer_blx.
7933
7934 2010-01-07  Ian Lance Taylor  <iant@google.com>
7935
7936         PR 10980
7937         * options.h (class General_options): Add --warn-unresolved-symbols
7938         and --error-unresolved-symbols.
7939         * errors.cc (Errors::undefined_symbol): Implement
7940         --warn-unresolved-symbols.
7941
7942         * options.h (class General_options): Add -z text and -z textoff.
7943         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7944
7945 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7946
7947         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7948         (Garbage_collection::cident_sections): New function.
7949         (Garbage_collection::add_cident_section): New function.
7950         (Garbage_collection::cident_sections_): New member.
7951         (gc_process_relocs): Add references to sections whose names are C
7952         identifiers.
7953         * gold.h (cident_section_start_prefix): New constant.
7954         (cident_section_stop_prefix): New constant.
7955         (is_cident): New function.
7956         * layout.cc (Layout::define_section_symbols): Replace string constants
7957         with the newly defined constants.
7958         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7959         C identifiers.
7960         * testsuite/Makefile.am: Add gc_orphan_section_test.
7961         * testsuite/Makefile.in: Regenerate.
7962         * testsuite/gc_orphan_section_test.cc: New file.
7963         * testsuite/gc_orphan_section_test.sh: New file.
7964
7965 2010-01-06  Ian Lance Taylor  <iant@google.com>
7966
7967         PR 10980
7968         * options.h (class General_options): Add --warn-shared-textrel.
7969         * layout.cc (Layout::finish_dynamic_section): Implement
7970         --warn-shared-textrel.
7971
7972         PR 10980
7973         * options.h (class General_options): Add --warn-multiple-gp.
7974
7975 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7976
7977         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7978         $(THREADSLIB) and $(LIBDL).
7979         * Makefile.in: Rebuild.
7980
7981 2010-01-06  Ian Lance Taylor  <iant@google.com>
7982
7983         PR 10980
7984         * options.cc (General_options::parse_section_start): New function.
7985         (General_options::section_start): New function.
7986         (General_options::General_options): Initialize all members.
7987         * options.h: Include <map>
7988         (class General_options): Add --section-start.  Add section_starts_
7989         member.
7990         * layout.cc (Layout::attach_allocated_section_to_segment): If
7991         --section-start was used, set the address of the segment.  Remove
7992         local sort_sections.
7993         (Layout::relaxation_loop_body): If the address of the load segment
7994         has been set by --section-start, don't use it.
7995         * output.h (Output_segment::update_flags_for_output_section): New
7996         function.
7997         * output.cc (Output_segment::add_output_section): Call
7998         update_flags_for_output_section.
7999
8000 2010-01-05  Ian Lance Taylor  <iant@google.com>
8001
8002         PR 10980
8003         * options.h (class General_options): Add --undefined-version.
8004         * script.cc (struct Version_expression): Add was_matched_by_symbol
8005         field.
8006         (Version_script_info::matched_symbol): New function.
8007         (Version_script_info::get_symbol_version_helper): Call
8008         matched_symbol.
8009         (Version_script_info::check_unmatched_names): New function.
8010         * script.h (class Version_script_info): Update declarations.
8011         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8012
8013         * options.h (class General_options): Use DEFINE_bool_alias for
8014         allow_multiple_definition.
8015         * resolve.cc (Symbol_table::should_override): Don't test
8016         allow_multiple_definition.
8017
8018         PR 10980
8019         * options.h (class General_options): Add --cref.
8020         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8021         until after printing cref table.
8022         * cref.cc: Include "symtab.h".
8023         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8024         (Cref_table_compare::operator()): New function.
8025         (Cref_inputs::gather_cref): New function.
8026         (filecol): New static const.
8027         (Cref_inputs::print_cref): New function.
8028         (Cref::print_cref): New function.
8029         * cref.h: Include <cstdio>.
8030         (class Cref): Update declarations.
8031         * mapfile.h (Mapfile::file): New function.
8032         * object.h (class Object): Define Symbols.  Declare virtual
8033         do_get_global_symbols.
8034         (Object::get_global_symbols): New function.
8035         * object.cc (Input_objects::add_object): Pass object to cref_ if
8036         --cref.
8037         (Input_objects::archive_start): Likewise.
8038         (Input_objects::archive_stop): Likewise.
8039         (Input_objects::print_cref): New function.
8040         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8041         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8042         --cref.
8043         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8044         function.
8045         * plugin.h (class Sized_pluginobj): Update declarations.
8046
8047 2010-01-05  Ian Lance Taylor  <iant@google.com>
8048
8049         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8050         to is_default_version.  Rename insdef to insdefault.
8051         (Symbol_table::add_from_relobj): Rename def to is_default_version
8052         and local to is_forced_local.
8053         (Symbol_table::add_from_pluginobj): Likewise.
8054         (Symbol_table::add_from_dynobj): Likewise.
8055         (Symbol_table::define_special_symbol): Rename insdef to
8056         insdefault.
8057
8058 2010-01-04  Ian Lance Taylor  <iant@google.com>
8059
8060         PR 10980
8061         * options.h (class General_options): Add
8062         --allow-multiple-definition and -z muldefs.
8063         * resolve.cc (Symbol_table::should_override): Don't warn about a
8064         multiple symbol definition if --allow-multiple-definition or -z
8065         muldefs.
8066
8067         PR 10980
8068         * options.h (class General_options): Add --add-needed and
8069         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8070         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8071         error if --copy-dt-needed-entries aka --add-needed is used and
8072         would cause a change in behaviour.
8073
8074         PR 10980
8075         * options.h (class General_options): Add -G as a short version of
8076         --shared.  Add no-op options -assert, -g, and -i.
8077
8078 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8079
8080         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8081         check for .text or .gnu.linkonce.t sections.
8082         * icf.cc (Icf::find_identical_sections): Ditto.
8083         Change the detection for mangled function name within the section
8084         name.
8085         * icf.h (is_section_foldable_candidate): New function.
8086
8087 2009-12-30  Ian Lance Taylor  <iant@google.com>
8088
8089         PR 10980
8090         * options.h (class General_options): Permit two dashes with
8091         --retain-symbols-file.
8092
8093 2009-12-30  Ian Lance Taylor  <iant@google.com>
8094
8095         PR 10979
8096         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8097         don't put the file header and segment headers in the text
8098         segment.
8099
8100         PR 10979
8101         * common.cc (Sort_commons::operator()): Stabilize sort when both
8102         entries are NULL.
8103         (Symbol_table::do_allocate_commons_list): When allocating common
8104         symbols, skip a symbol which is no longer common.
8105         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8106         an object before checking its type.
8107         * testsuite/common_test_2.c: New file.
8108         * testsuite/common_test_3.c: New file.
8109         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8110         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8111         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8112         (common_test_2_pic.o, common_test_2.so): New targets.
8113         (common_test_3_pic.o, common_test_3.so): New targets.
8114         * testsuite/Makefile.in: Rebuild.
8115
8116         PR 10979
8117         * script.cc (read_input_script): If we see a new SECTIONS clause,
8118         and we have added an input section, give an error.
8119         * layout.h (class Layout): Add have_added_input_section function.
8120         Add have_added_input_section_ field.
8121         * layout.cc (Layout::Layout): Initialize
8122         have_added_input_section_.
8123         (Layout::layout): Set have_added_input_section_.
8124         (Layout::layout_eh_frame): Likewise.
8125
8126 2009-12-30  Ian Lance Taylor  <iant@google.com>
8127
8128         PR 10931
8129         * options.h (class General_options): Add --sort-common option.
8130         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8131         * common.cc (Sort_common): Add sort_order parameter to
8132         constructor.  Add sort_order_ field.
8133         (Sort_commons::operator): Check sort_order_.
8134         (Symbol_table::allocate_commons): Determine the sort order.
8135         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8136         Change all callers.
8137         (Symbol_table::do_allocate_commons_list): Likewise.
8138
8139 2009-12-30  Ian Lance Taylor  <iant@google.com>
8140
8141         PR 10916
8142         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8143         symbols from this object, don't change the visibility of an
8144         undefined symbol.
8145         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8146
8147 2009-12-30  Ian Lance Taylor  <iant@google.com>
8148
8149         PR 10861
8150         * script.h (class Version_script_info): Define Language enum.
8151         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8152         new fields globals_, locals_, and is_finalized_.
8153         * script.cc: Various formatting fixes.
8154         (class Parser_closure): Change language_stack_ from a vector of
8155         std::string to one of Version_script_info::Language.  Adjust all
8156         uses accordingly.
8157         (class Lazy_demangler): Remove.
8158         (struct Version_expression): Change language from std::string to
8159         Version_script_info::Language.
8160         (Version_script_info::Version_script_info): New function.
8161         (Version_script_info::~Version_script_info): Don't call clear.
8162         (Version_script_info::finalize): New function.
8163         (Version_script_info::build_lookup_tables): New function.
8164         (Version_script_info::build_expression_list_lookup): New
8165         function.
8166         (Version_script_info::get_symbol_version_helper): Rewrite to use
8167         lookup tables.
8168         (Version_script_info::print_expression_list): Adjust to use
8169         Version_script_info::Language.
8170         (script_push_lex_into_version_mode): Check that the version script
8171         has not been finalized.
8172         (version_script_push_lang): Change language string to
8173         Version_script_info::Language.
8174         * options.cc (Command_line::version_script): New function.
8175         * options.h (class General_options): Add finalize_dynamic_list
8176         function.  Change version_script from declaration to definition.
8177         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8178         * testsuite/version_script.map: Remove duplicate def of foo.
8179         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8180         version_script.map.
8181         * testsuite/Makefile.in: Rebuild.
8182
8183 2009-12-30  Ian Lance Taylor  <iant@google.com>
8184
8185         PR 10843
8186         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8187         if the input symbol index is 0, make the output symbol index 0.
8188
8189 2009-12-30  Ian Lance Taylor  <iant@google.com>
8190
8191         PR 10670
8192         * options.h (class General_options): Add -x/--discard-all.
8193         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8194         --discard-all.  If the local symbol needs a dynamic entry, check
8195         that before handling --discard-locals.
8196
8197 2009-12-30  Ian Lance Taylor  <iant@google.com>
8198
8199         PR 10450
8200         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8201         flags to PF_R.
8202         (Output_segment::add_output_section): Don't change the flags if
8203         the type is PT_TLS.
8204
8205         PR 10450
8206         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8207         GNU hash table if they need a dynamic value.  Otherwise, don't add
8208         them if they are defined in a dynamic object or are forced local.
8209
8210 2009-12-29  Ian Lance Taylor  <iant@google.com>
8211
8212         PR 10450
8213         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8214         .gnu.hash table for a 32-bit target.
8215
8216         PR 10450
8217         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8218         regular and a dynamic object only needs a dynamic symbol table
8219         entry if it is externally visible.
8220
8221         PR 10450
8222         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8223         constructor.  Add global_offset_table_ field.
8224         (Target_i386::got_section): Set global_offset_table_.
8225         (Target_i386::do_finalize_sections): Set global_offset_table_
8226         size.
8227         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8228         in constructor.  Add global_offset_table_ field.
8229         (Target_x86_64::got_section): Set global_offset_table_.
8230         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8231         size.
8232
8233         * layout.cc (Layout::Layout): Initialize increase_relro_.
8234         (Layout::get_output_section): Add is_relro, is_last_relro, and
8235         is_first_non_relro parameters.  Change all callers.
8236         (Layout::choose_output_section): Likewise.
8237         (Layout::add_output_section_data): Likewise.
8238         (Layout::make_output_section): Likewise.
8239         (Layout::set_segment_offsets): Clear increase_relro when using a
8240         linker script.
8241         * layout.h (class Layout): Add increase_relro method.  Add
8242         increase_relro_ field.  Update declarations.
8243         * output.cc (Output_section::Output_section): Initialize
8244         is_last_relro_ and is_first_non_relro_.
8245         (Output_segment::add_output_section): Group relro sections is
8246         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8247         (Output_segment::maximum_alignment): Remove relro handling.
8248         (Output_segment::set_section_addresses): Add increase_relro
8249         parameter.  Change all callers.  Add initial alignment to align
8250         relro sections on separate page.  Remove old relro handling.
8251         (Output_segment::set_section_list_addresses): Remove in_relro
8252         parameter.  Change all callers.
8253         (Output_segment::set_offset): Add increase parameter.  Change all
8254         callers.  Remove old relro handling.
8255         * output.h (class Output_section): Add new methods: is_last_relro,
8256         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8257         Add is_last_relro_ and is_first_non_relro_ fields.
8258         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8259         Create separate .got.plt section.  Call increase_relro.
8260         * x86_64.cc (Target_x86_64::got_section): Likewise.
8261         * testsuite/relro_script_test.t: Add .got.plt.
8262
8263         PR 10450
8264         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8265         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8266         (Layout::finalize): Call set_dynamic_symbol_size.
8267         (Layout::set_dynamic_symbol_size): New function.
8268         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8269         set_dynamic_symbol_size.
8270
8271         PR 10450
8272         * output.h (class Output_section): Add is_entsize_zero_ field.
8273         * output.cc (Output_section::Output_section): Initialize
8274         is_entsize_zero_.
8275         (Output_section::set_entsize): If two different entsizes are
8276         requested, force it to zero.
8277         (Output_section::add_input_section): Set flags for .debug_str
8278         before updating section flags.  Set entsize.
8279         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8280         and SHF_STRING if all input sections have those flags.
8281
8282 2009-12-29   Rafael Espindola  <espindola@google.com>
8283
8284         * main.cc (main): Fix the sys time reporting.
8285         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8286         reporting.
8287
8288 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8289
8290         * options.cc (General_options::parse_version): Allow -v to exit
8291         without an error if there is nothing to link.
8292
8293 2009-12-29  Ian Lance Taylor  <iant@google.com>
8294
8295         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8296         using a version of gcc before 4.1.
8297         * configure: Rebuild.
8298
8299 2009-12-28  Chris Demetriou  <cgd@google.com>
8300
8301         * attributes.cc (Output_attributes_section_data::do_write): Use
8302         std::vector::front rather than std::vector::data.
8303
8304 2009-12-28  Ian Lance Taylor  <iant@google.com>
8305
8306         * symtab.h (class Symbol_table): Add enum Defined.
8307         * resolve.cc (Symbol_table::should_override): Add defined
8308         parameter.  Change all callers.  Test whether object is NULL
8309         before calling a method on it.
8310         (Symbol_table::report_resolve_problem): Add defined parameter.
8311         Change all callers.
8312         (Symbol_table::should_override_with_special): Likewise.
8313         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8314         parameter.  Change all callers.
8315         (Symbol_table::do_define_in_output_data): Likewise.
8316         (Symbol_table::define_in_output_segment): Likewise.
8317         (Symbol_table::do_define_in_output_segment): Likewise.
8318         (Symbol_table::define_as_constant): Likewise.
8319         (Symbol_table::do_define_as_constant): Likewise.
8320         * script.h (class Symbol_assignment): Add is_defsym parameter to
8321         constructor; change all callers.
8322         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8323         parameter.  Change all callers.  Add is_defsym_ field.
8324         (class Parser_closure): Add parsing_defsym parameter to
8325         constructor; change all callers.  Add parsing_defsym accessor
8326         function.  Add parsing_defsym_ field.
8327
8328 2009-12-28  Ian Lance Taylor  <iant@google.com>
8329
8330         * gold.cc (queue_middle_tasks): Fix formatting.
8331         * object.cc (Relobj::is_section_name_included): Likewise.
8332
8333 2009-12-23  Ian Lance Taylor  <iant@google.com>
8334
8335         * i386.cc (Target_i386::do_calls_non_split): Recognize
8336         -fsplit-stack prologue for a function with a static chain.
8337         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8338         -fsplit-stack prologue when using %r11.
8339
8340 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8341
8342         * options.cc (General_options::parse_version): Make -v continue and do
8343         the link like GNU ld does.
8344
8345 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8346
8347         * Makefile.am (CCFILES): Add timer.cc.
8348         (HFILES): Add timer.h.
8349         * configure.ac: Check for sysconf and times.
8350         * main.cc: include timer.h.
8351         (main): Use Timer instead of get_run_time.
8352         * timer.cc: New.
8353         * timer.h: New.
8354         * workqueue.cc: include timer.h.
8355         (Workqueue::find_and_run_task):
8356         Report user, sys and wall time.
8357         * Makefile.in: Regenerate.
8358         * config.in: Regenerate.
8359         * configure: Regenerate.
8360
8361 2009-12-16  Doug Kwan  <dougkwan@google.com>
8362
8363         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8364         sections.
8365         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8366         relaxed input sections.
8367         * output.cc (Output_section::find_relaxed_input_section): Change
8368         return type to Output_relaxed_input_section pointer.  Adjust code
8369         for new type of relaxed_input_section_map_.
8370         * output.h (Output_section::find_relaxed_input_section): Change
8371         return type to Output_relaxed_input_section pointer.
8372         (Output_section::Output_relaxed_input_section_by_input_section_map):
8373         New type.
8374         (Output_section::relaxed_input_section_map_): Change type to
8375         Output_section::Output_relaxed_input_section_by_input_section_map.
8376         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8377         input section.
8378
8379 2009-12-15  Ian Lance Taylor  <iant@google.com>
8380
8381         * layout.cc (Layout::create_shstrtab): Only write out after input
8382         sections if we are compressing debug sections.
8383
8384 2009-12-15  Ian Lance Taylor  <iant@google.com>
8385
8386         * archive.cc (Archive::add_symbols): Only look up a symbol without
8387         a version if there is, in fact, a version.
8388
8389 2009-12-14  Ian Lance Taylor  <iant@google.com>
8390
8391         Revert -Wshadow changes, all changes from:
8392         2009-12-11  Doug Kwan  <dougkwan@google.com>
8393         2009-12-11  Nick Clifton  <nickc@redhat.com>
8394         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8395
8396 2009-12-11  Doug Kwan  <dougkwan@google.com>
8397
8398         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8399         due to -Wshadow.
8400         * attributes.cc (Object_attribute::size): Ditto.
8401         (Attributes_section_data::size): Ditto.
8402         (Attributes_section_data::Attributes_section_data): Ditto.
8403         (Output_attributes_section_data::do_write): Ditto.
8404         * attributes.h (Object_attribute::set_type): Ditto.
8405         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8406
8407 2009-12-11  Nick Clifton  <nickc@redhat.com>
8408
8409         * archive.cc: Fix shadowed variable warnings.
8410         * arm.cc: Likewise.
8411         * compressed_output.cc: Likewise.
8412         * compressed_output.h: Likewise.
8413         * configure: Likewise.
8414         * dwarf_reader.cc: Likewise.
8415         * dynobj.cc: Likewise.
8416         * dynobj.h: Likewise.
8417         * ehframe.cc: Likewise.
8418         * ehframe.h: Likewise.
8419         * errors.cc: Likewise.
8420         * expression.cc: Likewise.
8421         * fileread.cc: Likewise.
8422         * fileread.h: Likewise.
8423         * freebsd.h: Likewise.
8424         * i386.cc: Likewise.
8425         * icf.cc: Likewise.
8426         * incremental.h: Likewise.
8427         * layout.cc: Likewise.
8428         * layout.h: Likewise.
8429         * mapfile.cc: Likewise.
8430         * merge.cc: Likewise.
8431         * merge.h: Likewise.
8432         * object.cc: Likewise.
8433         * object.h: Likewise.
8434         * options.h: Likewise.
8435         * output.cc: Likewise.
8436         * output.h: Likewise.
8437         * parameters.cc: Likewise.
8438         * plugin.cc: Likewise.
8439         * powerpc.cc: Likewise.
8440         * reduced_debug_output.cc: Likewise.
8441         * reduced_debug_output.h: Likewise.
8442         * reloc.cc: Likewise.
8443         * reloc.h: Likewise.
8444         * resolve.cc: Likewise.
8445         * script-sections.cc: Likewise.
8446         * script.cc: Likewise.
8447         * script.h: Likewise.
8448         * sparc.cc: Likewise.
8449         * symtab.cc: Likewise.
8450         * symtab.h: Likewise.
8451         * target-select.cc: Likewise.
8452         * target-select.h: Likewise.
8453         * token.h: Likewise.
8454         * workqueue.cc: Likewise.
8455         * workqueue.h: Likewise.
8456         * x86_64.cc: Likewise.
8457
8458 2009-12-10  Doug Kwan  <dougkwan@google.com>
8459
8460         * arm.cc (attributes.h): New include.
8461         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8462         (Arm_relobj::~Arm_relobj): Delete object pointed by
8463         attributes_section_data_.
8464         (Arm_relobj::attributes_section_data): New method definition.
8465         (Arm_relobj::attributes_section_data_): New data member declaration.
8466         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8467         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8468         attributes_section_data_.
8469         (Arm_dynobj::attributes_section_data): New method definition.
8470         (Arm_dynobj::attributes_section_data_): New data member declaration.
8471         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8472         initialization value of may_use_blx_ to false.
8473         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8474         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8475         object attributes to compute results instead of hard-coding.
8476         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8477         Target_arm::get_secondary_compatible_arch,
8478         Target_arm::set_secondary_compatible_arch
8479         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8480         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8481         New method declarations.
8482         (Target_arm::get_aeabi_object_attribute): New method definition.
8483         (Target_arm::attributes_section_data_): New data member declaration.
8484         (read_arm_attributes_section): New template definition.
8485         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8486         (Arm_dynobj::do_read_symbols): Ditto.
8487         (Target_arm::do_finalize_sections): Merge attributes sections from
8488         input.  Check for BLX use after attributes section merging.
8489         Fix __exidx_start and __exidx_end visibility.  Create an
8490         .ARM.attributes section if necessary.
8491         (Target_arm::get_secondary_compatible_arch,
8492         Target_arm::set_secondary_compatible_arch,
8493         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8494         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8495         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8496         New method definitions.
8497
8498 2009-12-09  Ian Lance Taylor  <iant@google.com>
8499
8500         * plugin.cc (Plugin::load): Don't cast from void* to a function
8501         pointer.
8502
8503 2009-12-09  Ian Lance Taylor  <iant@google.com>
8504
8505         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8506         information fields.
8507
8508 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8509
8510         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8511         Replace two_file_shared_1.so with two_file_shared_2.so.
8512         * testsuite/Makefile.in: Regenerated.
8513
8514 2009-12-08  Doug Kwan  <dougkwan@google.com>
8515
8516         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8517         (HFILES): Add attributes.h and int_encoding.h.
8518         * Makefile.in: Regenerate.
8519         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8520         function definitions to int_encoding.cc
8521         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8522         prototypes to int_encoding.h
8523         * reduced_debug_output.cc (int_encoding.h): New include.
8524         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8525         function definitions to int_encoding.cc
8526         (insert_into_vector, read_from_pointer): Move template definitions to
8527         int_encoding.h
8528         * attributes.cc: New file.
8529         * attributes.h: New file.
8530         * int_encoding.cc: New file.
8531         * int_encoding.h: New file.
8532
8533 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8534
8535         PR gold/11055
8536         * incremental-dump.cc (dump_incremental_inputs): New.
8537         (main): Use dump_incremental_inputs.
8538
8539 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8540
8541         PR gold/10893
8542         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8543         checking elfcpp::STT_FUNC.
8544         (Target_i386::Relocate::relocate): Likewise.
8545         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8546
8547         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8548         symbols from shared libraries into normal FUNC symbols.
8549
8550         * symtab.h (Symbol): Add is_func and use it.
8551
8552 2009-12-05  Doug Kwan  <dougkwan@google.com>
8553
8554         * arm.cc (Target_arm::arm_info): Initialize new fields
8555         attributes_section and attributes_vendor.
8556         * i386.cc (Target_i386::i386_info): Same.
8557         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8558         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8559         fields attributes_section and attributes_vendor.
8560         * sparc.cc (Target_sparc::sparc_info): Same.
8561         * target.h (Target::attributes_section, Target::attributes_vendor,
8562         Target::is_attributes_section, Target::attribute_arg_type,
8563         Target::attributes_order): New method definitions.
8564         (Target::Target_info::attributes_section,
8565         Target::Target_info::attributes_vendor): New fields.
8566         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8567         virtual method definitions.
8568         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8569         attributes_section and attributes_vendor.
8570         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8571
8572 2009-12-05  Doug Kwan  <dougkwan@google.com>
8573
8574         * arm.cc: Update comments about interworking and stub generation.
8575         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8576         considered as non-PIC.
8577         (Arm_relocate_functions::base_abs): Fix formatting.
8578         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8579         of function to use GOT entry address instead of offset.
8580         (Target_arm::Scan::global): Issue an error if a symbol would need a
8581         PLT does not get one because it is untyped.  Remove code to create
8582         dynamic symbols for relative branches.
8583         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8584         takes unsigned integer instead of boolean.
8585
8586 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8587
8588         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8589         (two_file_test_LDADD): Likewise.
8590         (common_test_1_LDADD): Likewise.
8591         (exception_test_LDADD) Likewise.
8592         (weak_test_LDADD): Likewise.
8593         (many_sections_test_LDADD): Likewise.
8594         (initpri1_LDADD): Likewise.
8595         (script_test_1_LDADD): Likewise.
8596         (script_test_2_LDADD): Likewise.
8597         (justsyms_LDADD): Likewise.
8598         (binary_test_LDADD): Likewise.
8599         (large_LDADD): Likewise.
8600         * testsuite/Makefile.in: Regenerated.
8601
8602 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8603
8604         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8605         (Symbol_table::override_with_special): Likewise.
8606         (Symbol_table::add_from_object): Likewise.
8607
8608 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8609
8610         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8611         Don't set the data_offset twice.
8612
8613 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8614
8615         * testsuite/Makefile.in: Regenerate.
8616
8617 2009-12-03  Doug Kwan  <dougkwan@google.com>
8618
8619         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8620         (Target_arm::do_finalize_sections): Add parameter for symbol table
8621         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8622         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8623         parameter for symbol table pointer.
8624         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8625         an additional parameter for a pointer to symbol table.
8626         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8627         parameter for a symbol table pointer.
8628         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8629         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8630         Ditto.
8631         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8632         parameter for a symbol table pointer.
8633
8634 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8635
8636         * incremental.cc (Incremental_inputs_header)
8637         (Incremental_inputs_header_write, Incremental_inputs_entry)
8638         (Incremental_inputs_entry_write): Move ...
8639         * incremental.h (Incremental_inputs_header)
8640         (Incremental_inputs_header_write, Incremental_inputs_entry)
8641         (Incremental_inputs_entry_write): here.
8642
8643 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8644
8645         * incremental.cc (make_sized_incremental_binary): Set the target.
8646         Error if it is incompatible.
8647         * output.h (Output_file): Add filename method.
8648
8649 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8650
8651         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8652         from the get_* methods.
8653
8654 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8655
8656         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8657         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8658         Write 0 for the data_offset of scripts.
8659
8660 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8661
8662         * testsuite/Makefile.am: Add the incremental_test.sh test.
8663         * testsuite/incremental_test.sh: New.
8664         * testsuite/incremental_test_1.c: New.
8665         * testsuite/incremental_test_2.c: New.
8666
8667 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8668
8669         * incremental-dump.cc (main): Fix typos.
8670
8671 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8672
8673         PR gold/11025
8674         * incremental-dump.cc (main): Use llu to print 64 bit values.
8675
8676 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8677             H.J. Lu  <hongjiu.lu@intel.com>
8678
8679         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8680         $(LIBDL).
8681         (incremental_dump_LDADD): Likewise.
8682         * Makefile.in: Regenerated.
8683
8684 2009-11-25  Doug Kwan  <dougkwan@google.com>
8685
8686         Revert:
8687
8688         2009-11-25  Doug Kwan  <dougkwan@google.com>
8689
8690                 * arm.cc (Target_arm::Target_arm): Move method definition
8691                 outside of class definition.  Add code to handle
8692                 --target1-rel, --target1-abs and --target2= options.
8693                 (Target_arm::get_reloc_reloc_type): Change method to be
8694                 non-static and const.
8695                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8696                 New data member declaration.
8697                 (Target_arm::Scan::local, Target_arm::Scan::global,
8698                 Target_arm::Relocate::relocate,
8699                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8700                 Adjust call to Target_arm::get_real_reloc_type.
8701                 (Target_arm::get_real_reloc_type): Use command line options
8702                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8703                 * options.h (--target1-rel, --target1-abs, --target2): New
8704                 ARM-only options.
8705
8706 2009-11-25  Doug Kwan  <dougkwan@google.com>
8707
8708         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8709         class definition.  Add code to handle --target1-rel, --target1-abs
8710         and --target2= options.
8711         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8712         and const.
8713         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8714         member declaration.
8715         (Target_arm::Scan::local, Target_arm::Scan::global,
8716         Target_arm::Relocate::relocate,
8717         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8718         call to Target_arm::get_real_reloc_type.
8719         (Target_arm::get_real_reloc_type): Use command line options to
8720         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8721         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8722         options.
8723
8724 2009-11-25  Doug Kwan  <dougkwan@google.com>
8725
8726         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8727         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8728         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8729         formatting.
8730         (Arm_relocate_functions::thm_call): Replace body with a call to
8731         Arm_relocate_functions::thumb_branch_common.
8732         (Arm_relocate_functions::thm_jump24,
8733         Arm_relocate_functions::thm_xpc22): New method definitions.
8734         (Arm_relocate_functions::thumb_branch_common): New method definition.
8735         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8736         operator.
8737         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8738         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8739
8740 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8741
8742         * Makefile.am: Build incremental-dump
8743         * Makefile.in: Regenerate.
8744         * incremental-dump.cc: New.
8745         * incremental.cc (Incremental_inputs_header_data,
8746         Incremental_inputs_entry_data): Move to incremental.h
8747         * incremental.h: (Incremental_inputs_header_data,
8748         Incremental_inputs_entry_data): Move from incremental.cc
8749
8750 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8751
8752         * incremental.cc (Incremental_inputs_header,
8753         Incremental_inputs_header_write, Incremental_inputs_entry,
8754         Incremental_inputs_entry_write): Add a typedef with the data type.
8755
8756 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8757
8758         * incremental.cc (Incremental_inputs_header,
8759         Incremental_inputs_header_write, Incremental_inputs_entry,
8760         Incremental_inputs_entry_write): Update comment about which
8761         type has the filed descriptions.
8762
8763 2009-11-15  Doug Kwan  <dougkwan@google.com>
8764
8765         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8766         (Arm_relocate_functions::arm_branch_common): Change method defintion
8767         in class definition to a method declaration and update list of formal
8768         parameters.
8769         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8770         Arm_relocation_functions::jump24): Adjust call to
8771         Arm_relocate_functions::arm_branch_common.  Update list of formal
8772         parameters.
8773         (Arm_relocate_functions::xpc25): New method definition.
8774         (Arm_relocate_functions::arm_branch_common): Move method defintion
8775         out from class definition.  Use stubs for mode-switching and extending
8776         branch ranges.
8777         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8778         specially.  Change code to enable use of stubs in ARM branches.
8779
8780 2009-11-10  Doug Kwan  <dougkwan@google.com>
8781
8782         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8783         in method declaration.
8784         (Target_arm::relocate_stub): New method declaration.
8785         (Target_arm::default_target): Change to return a pointer instead of
8786         a const reference.
8787         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8788         Target_arm::default_target.
8789         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8790         method definition.
8791         (Target_arm::relocate_section): Adjust view.
8792         (Target_arm::relocate_stub): New method definition.
8793
8794 2009-11-10  Doug Kwan  <dougkwan@google.com>
8795
8796         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8797         a format warning.
8798         * incremental.cc (open_incremental_binary): Initialized local
8799         variables to avoid warnings.
8800         * object.cc (make_elf_object): Ditto.
8801         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8802         a format warning.
8803
8804 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8805
8806         PR gold/10930
8807         * testsuite/plugin_test.c: Include "config.h".
8808
8809 2009-11-09  Doug Kwan  <dougkwan@google.com>
8810
8811         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8812         (arm_symbol_value): Remove.
8813         (Arm_relocate_functions::arm_branch_common,
8814         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8815         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8816         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8817         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8818         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8819         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8820         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8821         Arm_relocate_functions::thm_mobw_abs_nc,
8822         Arm_relocate_functions::thm_mov_abs,
8823         Arm_relocate_functions::movw_prel_nc,
8824         Arm_relocate_functions::thm_movt_abs,
8825         Arm_relocate_functions::movt_prel,
8826         Arm_relocate_functions::thm_movw_prel_nc,
8827         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8828         (Target_arm::Relocate::relocate): Only decompose address into two
8829         parts if relocation type uses the thumb-bit and pass the actual
8830         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8831         calls to methods in Arm_relocate_functions for this change.
8832
8833 2009-11-08  Ian Lance Taylor  <iant@google.com>
8834
8835         PR 10925
8836         * reloc.cc: Instantiate
8837         Sized_relobj::initialize_input_to_output_maps and
8838         Sized_relobj:free_input_to_output_maps.
8839
8840 2009-11-06  Ian Lance Taylor  <iant@google.com>
8841
8842         PR 10876
8843         * defstd.cc (in_segment): Set only_if_ref true for "end".
8844
8845 2009-11-06  Doug Kwan  <dougkwan@google.com>
8846
8847         * arm.cc (class Reloc_stub): Correct a comment.
8848         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8849         (Target_arm::scan_section_for_stubs): New method declaration.
8850         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8851         Change methods from private to protected.
8852         (Target_arm::do_may_relax): New method definition.
8853         (Target_arm::do_relax, Target_arm::group_sections,
8854         Target_arm::scan_reloc_for_stub,
8855         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8856         (Target_arm::arm_input_section_map_): New data member declaration.
8857         (Target_arm::scan_reloc_for_stub,
8858         Target_arm::scan_reloc_section_for_stubs,
8859         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8860         Target_arm::do_relax): New method definitions.
8861
8862 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8863
8864         * configure.ac: Check for (struct stat)::st_mtim
8865         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8866         * config.in: Regenerate.
8867         * configure: Regenerate.
8868
8869 2009-11-05  Ian Lance Taylor  <iant@google.com>
8870
8871         PR 10910
8872         * output.cc (Output_segment::add_output_section): Add missing
8873         return statement.
8874
8875 2009-11-04  Ian Lance Taylor  <iant@google.com>
8876
8877         PR 10880
8878         * object.h (class Object): Add is_needed and set_is_needed
8879         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8880         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8881         defined in a dynamic object and referenced by a regular object,
8882         set is_needed for the dynamic object.
8883         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8884         if the file is marked with as_needed and it is not needed.
8885
8886 2009-11-04  Ian Lance Taylor  <iant@google.com>
8887
8888         PR 10887
8889         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8890         tags if data is discarded by linker script.
8891         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8892         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8893         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8894         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8895
8896 2009-11-04  Ian Lance Taylor  <iant@google.com>
8897
8898         * layout.cc (Layout::get_output_section): Add is_interp and
8899         is_dynamic_linker_section parameters.  Change all callers.
8900         (Layout::choose_output_section): Likewise.
8901         (Layout::make_output_section): Likewise.
8902         (Layout::add_output_section_data): Add is_dynamic_linker_section
8903         parameter.  Change all callers.
8904         * layout.h (class Layout): Update declarations.
8905         * output.h (class Output_section): Add is_interp, set_is_interp,
8906         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8907         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8908         generate_code_fills_at_write_ to a bitfield.
8909         * output.cc (Output_section::Output_sections): Initialize new
8910         fields.
8911         (Output_segment::add_output_section): Add do_sort parameter.
8912         Change all callers.
8913
8914 2009-11-03  Ian Lance Taylor  <iant@google.com>
8915
8916         PR 10860
8917         * options.h (class General_options): Add --warn-common.
8918         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8919         merging two common symbols.
8920         (Symbol_table::should_override): Handle --warn-common when merging
8921         a common symbol with a defined symbol.  Use report_resolve_problem
8922         for multiple definitions.
8923         (Symbol_table::report_resolve_problem): New function.
8924         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8925
8926 2009-11-03  Doug Kwan  <dougkwan@google.com>
8927
8928         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8929         stub_factory_.
8930         (Target_arm::stub_factory): New method definition.
8931         (Target_arm::new_arm_input_section,
8932         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8933         Target_arm::reloc_uses_thumb_bit): New method declarations.
8934         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8935         New type definitions.
8936         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8937         member declarations.
8938         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8939         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8940         New method definitions.
8941
8942 2009-11-03  Ian Lance Taylor  <iant@google.com>
8943
8944         * options.h (class General_options): Add --warn_constructors.
8945
8946 2009-11-03  Ian Lance Taylor  <iant@google.com>
8947
8948         PR 10893
8949         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8950         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8951
8952 2009-11-03  Ian Lance Taylor  <iant@google.com>
8953
8954         PR 10895
8955         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8956         --msgid-bugs-address.
8957         (install-pdf): New target.
8958         (install-data_yes): Look up one directory to find mkinstalldirs.
8959
8960 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8961
8962         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8963         tree.
8964
8965 2009-10-30  Doug Kwan  <dougkwan@google.com>
8966
8967         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8968
8969 2009-10-30  Doug Kwan  <dougkwan@google.com>
8970
8971         * arm.cc (Stub_addend_reader): New struct template definition
8972         and partial specializations.
8973         (Stub_addend_reader::operator()): New method definition for a
8974         partially specialized template.
8975
8976 2009-10-30  Doug Kwan  <dougkwan@google.com>
8977
8978         * arm.cc (Arm_relobj::processor_specific_flags): New method
8979         definition.
8980         (Arm_relobj::do_read_symbols): New method declaration.
8981         (Arm_relobj::processor_specific_flags_): New data member declaration.
8982         (Arm_dynobj): New class definition.
8983         (Target_arm::do_finalize_sections): Add input_objects parameter.
8984         (Target_arm::do_adjust_elf_header): New method declaration.
8985         (Target_arm::are_eabi_versions_compatible,
8986         (Target_arm::merge_processor_specific_flags): New method declaration.
8987         (Target_arm::do_make_elf_object): New overloaded method definitions
8988         and declaration.
8989         (Arm_relobj::do_read_symbols): New method definition.
8990         (Arm_dynobj::do_read_symbols): Ditto.
8991         (Target_arm::do_finalize_sections): Add input_objects parameters.
8992         Merge processor-specific flags from all input objects.
8993         (Target_arm::are_eabi_versions_compatible,
8994         Target_arm::merge_processor_specific_flags,
8995         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8996         New method definitions.
8997         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8998         Input_objects pointer type parameter.
8999         * layout.cc (Layout::finalize): Pass input objects to target's.
9000         finalize_sections function.
9001         * output.cc (Output_file_header::do_sized_write): Set ELF file
9002         header's processor-specific flags.
9003         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9004         Input_objects pointer type parameter.
9005         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9006         * target.h (Input_objects): New forward class declaration.
9007         (Target::processor_specific_flags,
9008         Target::are_processor_specific_flags_sect): New method definitions.
9009         (Target::finalize_sections): Add input_objects parameter.
9010         (Target::Target): Initialize processor_specific_flags_ and
9011         are_processor_specific_flags_set_.
9012         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9013         parameter.
9014         (Target::set_processor_specific_flags): New method definition.
9015         (Target::processor_specific_flags_,
9016         Target::are_processor_specific_flags_set_): New data member
9017         declarations.
9018         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9019         Input_objects pointer type parameter.
9020
9021 2009-10-30  Doug Kwan  <dougkwan@google.com>
9022
9023         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9024
9025 2009-10-28  Ian Lance Taylor  <iant@google.com>
9026
9027         * object.h (class Relobj): Drop options parameter from
9028         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9029         do_scan_relocs, do_relocate.  Change all callers.
9030         (class Sized_relobj): Drop options parameters from
9031         do_gc_process_relocs, do_scan_relocs, do_relocate,
9032         do_relocate_sections, relocate_sections, emit_relocs_scan,
9033         emit_relocs_scan_reltype.  Change all callers.
9034         (struct Relocate_info): Remove options field and all references to
9035         it.
9036         * reloc.h (class Read_relocs): Remove options constructor
9037         parameter and options_ field.  Change all callers.
9038         (class Gc_process_relocs, class Scan_relocs): Likewise.
9039         (class Relocate_task): Likewise.
9040         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9041         all callers.
9042         (scan_relocatable_relocs): Likewise.
9043         * target.h (class Sized_target): Remove options parameter from
9044         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9045         all callers.
9046         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9047         callers.
9048         * arm.cc: Update functions to remove options parameters.
9049         * i386.cc: Likewise.
9050         * powerpc.cc: Likewise.
9051         * sparc.cc: Likewise.
9052         * x86_64.cc: Likewise.
9053         * testsuite/testfile.cc: Likewise.
9054
9055 2009-10-28  Doug Kwan  <dougkwan@google.com>
9056
9057         * arm.cc (Arm_relobj): New class definition.
9058         (Arm_relobj::scan_sections_for_stubs,
9059         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9060         New method definitions.
9061
9062 2009-10-28  Cary Coutant  <ccoutant@google.com>
9063
9064         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9065         (Plugin::cleanup_done_): New member.
9066         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9067         (Plugin_manager::cleanup_done_): Remove.
9068         (Plugin_manager::add_input_file): Edit error message.
9069         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9070         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9071
9072 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9073
9074         * fileread.cc: (File_read::View::~View): Use the new
9075         data_ownership_ filed.
9076         (File_read::~File_read): Dispose the new whole_file_view_.
9077         (File_read::open): Mmap the whole file if needed.
9078         (File_read::open): Use whole_file_view_ instead of contents_.
9079         (File_read::find_view): Use whole_file_view_ if applicable.
9080         (File_read::do_read): Use whole_file_view_ instead of contents_.
9081         (File_read::make_view): Use whole_file_view_ instead of contents_,
9082         update File_read::View::View call.
9083         (File_read::find_or_make_view): Update File_read::View::View
9084         call.
9085         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9086         remove contents_
9087         (File_read::View::Data_ownership): New enum.
9088         (File_read::View::View): Replace bool mapped_ with Data_ownership
9089         argument.
9090         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9091         (File_read::View::data_ownership_): New field.
9092         (File_read::contents_): Remove (replaced by whole_file_view_).
9093         (File_read::whole_file_view_): New field.
9094         * options.h (class General_options): Add --keep-files-mapped.
9095
9096 2009-10-27  Cary Coutant  <ccoutant@google.com>
9097
9098         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9099         * testsuite/Makefile.am (plugin_test_5): New test case.
9100         * testsuite/Makefile.in: Regenerate.
9101
9102 2009-10-25  Doug Kwan  <dougkwan@google.com>
9103
9104         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9105         from private to protected to allow access by child class.
9106         (Sized_relobj::do_relocate_sections): New method declaration.
9107         (Sized_relobj::relocate_sections): Virtualize.
9108         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9109         Sized_relobj::relocate_sections.  Instantiate template explicitly
9110         for different target sizes and endianity.
9111
9112 2009-10-24  Doug Kwan  <dougkwan@google.com>
9113
9114         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9115         (Arm_input_section::as_arm_input_section): New method.
9116         (Arm_output_section): New class definition.
9117         (Arm_output_section::create_stub_group,
9118         Arm_output_section::group_sections): New method definitions.
9119
9120 2009-10-22  Doug Kwan  <dougkwan@google.com>
9121
9122         * arm.cc (Arm_input_section): New class definition.
9123         (Arm_input_section::init, Arm_input_section:do_write,
9124         Arm_input_section::set_final_data_size,
9125         Arm_input_section::do_reset_address_and_file_offset): New method
9126         definitions.
9127
9128 2009-10-21  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc (Stub_table, Arm_input_section): New forward class
9131         declarations.
9132         (Stub_table): New class defintion.
9133         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9134         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9135         New method definition.
9136
9137 2009-10-21  Doug Kwan  <dougkwan@google.com>
9138
9139         * arm.cc: Update copyright comments.
9140         (Target_arm): New forward class template declaration.
9141         (Arm_address): New type.
9142         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9143         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9144         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9145         constants.
9146         (Insn_template): Same.
9147         (DEF_STUBS): New macro.
9148         (Stub_type): New enum type.
9149         (Stub_template): New class definition.
9150         (Stub): Same.
9151         (Reloc_stub): Same.
9152         (Stub_factory): Same.
9153         (Target_arm::Target_arm): Initialize may_use_blx_ and
9154         should_force_pic_veneer_.
9155         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9156         Target_arm::should_force_pic_veneer,
9157         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9158         Target_arm::using_thumb_only, Target_arm:;default_target): New
9159         method defintions.
9160         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9161         New data member declarations.
9162         (Insn_template::size, Insn_template::alignment): New method defintions.
9163         (Stub_template::Stub_template): New method definition.
9164         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9165         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9166         (Stub_factory::Stub_factory): New method definition.
9167         * gold.h (string_hash): New template.
9168         * output.h (Input_section_specifier::hash_value): Use
9169         gold::string_hash.
9170         (Input_section_specifier::string_hash): Remove.
9171         * stringpool.cc (Stringpool_template::string_hash): Use
9172         gold::string_hash.
9173
9174 2009-10-20  Doug Kwan  <dougkwan@google.com>
9175
9176         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9177         symbols of relaxed input sections.
9178         * output.h (Output_section::find_relaxed_input_section): Make
9179         method public.
9180
9181 2009-10-16  Doug Kwan  <dougkwan@google.com>
9182
9183         * dynobj.cc (Versions::Versions): Initialize version_script_.
9184         Only insert base version symbol definition for a shared object
9185         if version script defines any version versions.
9186         (Versions::define_base_version): New method definition.
9187         (Versions::add_def): Check that base version is not needed.
9188         (Versions::add_need): Define base version lazily.
9189         * dynobj.h (Versions::define_base_version): New method declaration.
9190         (Versions::needs_base_version_): New data member declaration.
9191         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9192         (check_DATA): Add no_version_test.stdout.
9193         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9194         New make rules.
9195         * testsuite/Makefile.in: Regenerate.
9196         * testsuite/no_version_test.c: New file.
9197         * testsuite/no_version_test.sh: Ditto.
9198
9199 2009-10-16  Doug Kwan  <dougkwan@google.com>
9200
9201         * expression.cc (class Segment_start_expression): New class definition.
9202         (Segment_start_expression::value): New method definition.
9203         (script_exp_function_segment_start): Return a new
9204         Segment_start_expression.
9205         * gold/script-c.h (script_saw_segment_start_expression): New function
9206         prototype.
9207         * script-sections.cc (Script_sections::Script_sections): Initialize
9208         SAW_SEGMENT_START_EXPRESSION_ to false.
9209         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9210         and -Tbbs options to specify section addresses if given in
9211         command line and no SEGMENT_START expression is seen in a script.
9212         * script-sections.h (Script_sections::saw_segment_start_expression,
9213         Script_sections::set_saw_segment_start_expression): New method
9214         definition.
9215         (Script_sections::saw_segment_start_expression_): New data member
9216         declaration.
9217         * script.cc (script_saw_segment_start_expression): New function.
9218         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9219         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9220         script_test_7.sh and script_test_8.sh.
9221         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9222         script_test_8.stdout.
9223         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9224         (script_test_6, script_test_6.stdout, script_test_7,
9225         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9226         * Makefile.in: Regenerate.
9227         * testsuite/script_test_6.sh: New file.
9228         * testsuite/script_test_6.t: Same.
9229         * testsuite/script_test_7.sh: Same.
9230         * testsuite/script_test_7.t: Same.
9231         * testsuite/script_test_8.sh: Same.
9232
9233 2009-10-16  Doug Kwan  <dougkwan@google.com>
9234
9235         * output.cc (Output_segment::set_section_list_address): Cast
9236         expressions to unsigned long long type to avoid format warnings.
9237
9238 2009-10-15  Ian Lance Taylor  <iant@google.com>
9239
9240         * script.cc (Script_options::add_symbol_assignment): Always add a
9241         dot assignment to script_sections_.
9242         * script-sections.cc (Script_sections::add_dot_assignment):
9243         Initialize if necessary.
9244
9245         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9246         program headers with no load segment if there is a linker script.
9247
9248         * layout.cc (Layout::set_segment_offsets): Align the file offset
9249         to the segment aligment for -N or -n with no load segment.
9250         * output.cc (Output_segment::add_output_section): Don't crash if
9251         the first section is a TLS section.
9252         (Output_segment::set_section_list_addresses): Print an error
9253         message if the address moves backward in a linker script.
9254         * script-sections.cc
9255         (Output_section_element_input::set_section_addresses): Don't
9256         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9257         (Orphan_output_section::set_section_addresses): Likewise.
9258
9259 2009-10-15  Doug Kwan  <dougkwan@google.com>
9260
9261         * layout.cc (Layout::finish_dynamic_section): Generate tags
9262         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9263         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9264         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9265
9266 2009-10-14  Ian Lance Taylor  <iant@google.com>
9267
9268         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9269         fields.
9270         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9271         data_shdr fields of relinfo.
9272         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9273         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9274         R_386_TLS_LDO_32, adjust based on section flags.
9275         (Target_i386::Relocate::fix_up_ldo): Remove.
9276
9277 2009-10-13  Ian Lance Taylor  <iant@google.com>
9278
9279         Add support for -pie.
9280         * options.h (class General_options): Add -pie and
9281         --pic-executable.
9282         (General_options::output_is_position_independent): Test -pie.
9283         (General_options::output_is_executable): Return true if not shared
9284         and not relocatable.
9285         (General_options::output_is_pie): Remove.
9286         * options.cc (General_options::finalize): Reject incompatible uses
9287         of -pie.
9288         * gold.cc (queue_middle_tasks): A -pie link is not static.
9289         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9290         * symtab.cc (Symbol::final_value_is_known): Return false if
9291         output_is_position_independent.
9292         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9293         output_is_position_independent.
9294         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9295         output_is_position_independent.
9296         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9297         output_is_position_independent.
9298         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9299         two_file_pie_test.
9300         (basic_pie_test.o, basic_pie_test): New targets.
9301         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9302         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9303         (two_file_pie_test): New target.
9304         * testsuite/Makefile.in: Rebuild.
9305         * README: Remove note saying that -pie is not supported.
9306
9307 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9308
9309         * options.h (class General_options): Add -init and -fini.
9310         * layout.cc (Layout::finish_dynamic_section): Emit
9311         given init and fini functions.
9312
9313 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9314
9315         * gc.h (gc_process_relocs): Check if icf is enabled using new
9316         function.
9317         * gold.cc (queue_initial_tasks): Likewise.
9318         (queue_middle_tasks): Likewise.
9319         * object.cc (do_layout): Likewise.
9320         * symtab.cc (is_section_folded): Likewise.
9321         * main.cc (main): Likewise.
9322         * reloc.cc (Read_relocs::run): Likewise.
9323         (Sized_relobj::do_scan_relocs): Likewise.
9324         * icf.cc (is_function_ctor_or_dtor): New function.
9325         (Icf::find_identical_sections): Check if function is ctor or dtor when
9326         safe icf is chosen.
9327         * options.h (General_options::icf): Change option to be an enum.
9328         (Icf_status): New enum.
9329         (icf_enabled): New method.
9330         (icf_safe_folding): New method.
9331         (set_icf_status): New method.
9332         (icf_status_): New variable.
9333         * (options.cc) (General_options::finalize): Set icf_status_.
9334         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9335         icf_test and icf_keep_unique_test to use the --icf enum flag.
9336         * testsuite/icf_safe_test.sh: New file.
9337         * testsuite/icf_safe_test.cc: New file.
9338
9339 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9340
9341         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9342         includes to gc.h and icf.h.
9343         * arm.cc: Include gc.h.
9344         * gold.cc: Likewise.
9345         * i386.cc: Likewise.
9346         * powerpc.cc: Likewise.
9347         * sparc.cc: Likewise.
9348         * x86_64.cc: Likewise.
9349         * gc.h: Include icf.h.
9350
9351 2009-10-11  Ian Lance Taylor  <iant@google.com>
9352
9353         * plugin.cc: Include "gold.h" before other header files.
9354
9355 2009-10-10  Chris Demetriou  <cgd@google.com>
9356
9357         * options.h (Input_file_argument::Input_file_type): New enum.
9358         (Input_file_argument::is_lib_): Replace with...
9359         (Input_file_argument::type_): New member.
9360         (Input_file_argument::Input_file_argument): Take Input_file_type
9361         'type' rather than boolean 'is_lib' as second argument.
9362         (Input_file_argument::is_lib): Use type_.
9363         (Input_file_argument::is_searched_file): New function.
9364         (Input_file_argument::may_need_search): Handle is_searched_file.
9365         * options.cc (General_options::parse_library): Support -l:filename.
9366         (General_options::parse_just_symbols): Update for Input_file_argument
9367         changes.
9368         (Command_line::process): Likewise.
9369         * archive.cc (Archive::get_file_and_offset): Likewise.
9370         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9371         * script.cc (read_script_file, script_add_file): Likewise.
9372         * fileread.cc (Input_file::Input_file): Likewise.
9373         (Input_file::will_search_for): Handle is_searched_file.
9374         (Input_file::open): Likewise.
9375         * readsyms.cc (Read_symbols::get_name): Likewise.
9376         * testsuite/Makefile.am (searched_file_test): New test.
9377         * testsuite/Makefile.in: Regenerate.
9378         * testsuite/searched_file_test.cc: New file.
9379         * testsuite/searched_file_test_lib.cc: New file.
9380
9381 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9382             Ian Lance Taylor  <iant@google.com>
9383
9384         * descriptor.cc: Include <cstdio> and "binary-io.h".
9385         (Descriptors::open): Open the files in binary mode always.
9386         * script.cc (Lex::get_token): Treat \r as whitespace.
9387
9388 2009-10-09  Ian Lance Taylor  <iant@google.com>
9389
9390         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9391
9392 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9393             Ian Lance Taylor  <iant@google.com>
9394
9395         * configure.ac: Check for readv function also.
9396         * fileread.cc (readv): Define if not HAVE_READV.
9397         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9398         does not exist.
9399         * config.in: Regenerate.
9400         * configure: Regenerate.
9401
9402 2009-10-09  Doug Kwan  <dougkwan@google.com>
9403
9404         * layout.cc (Layout::make_output_section): Call target hook to make
9405         ordinary output section.
9406         (Layout::finalize): Adjust parameter list of call the
9407         Target::may_relax().
9408         * layout.h (class Layout::section_list): New method.
9409         * merge.h (Output_merge_base::entsize): Change visibility to public.
9410         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9411         New methods.
9412         (Output_merge_string::do_is_string): New method.
9413         * object.cc (Sized_relobj::do_setup): renamed from
9414         Sized_relobj::set_up.
9415         * object.h (Sized_relobj::adjust_shndx,
9416         Sized_relobj::initializ_input_to_output_maps,
9417         Sized_relobj::free_input_to_output_maps): Change visibilities to
9418         protected.
9419         (Sized_relobj::setup): Virtualize.
9420         (Sized_relobj::do_setup): New method declaration.
9421         (Sized_relobj::invalidate_section_offset,
9422         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9423         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9424         * options.cc (parse_int): New function.
9425         * options.h (parse_int): New declaration.
9426         (DEFINE_int): New macro.
9427         (stub_group_size): New option.
9428         * output.cc (Output_section::Output_section): Initialize memebers
9429         merge_section_map_, merge_section_by_properties_map_,
9430         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9431         (Output_section::add_input_section): Handled deferred code-fill
9432         generation and remove an old comment.
9433         (Output_section::add_relaxed_input_section): New method definition.
9434         (Output_section::add_merge_input_section): Use merge section by
9435         properties map to speed to search.  Update merge section maps
9436         as appropriate.
9437         (Output_section::build_relaxation_map): New method definition.
9438         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9439         Same.
9440         (Output_section::relax_input_section): Renamed to
9441         Output_section::convert_input_sections_to_relaxed_sections and change
9442         interface to take a vector of pointers to relaxed sections.
9443         (Output_section::find_merge_section,
9444         Output_section::find_relaxed_input_section): New method definitions.
9445         (Output_section::is_input_address_mapped,
9446         Output_section::output_offset, Output_section::output_address):
9447         Use output section data maps to speed up searching.
9448         (Output_section::find_starting_output_address): Add comments.
9449         (Output_section::do_write,
9450         Output_section::write_to_postprocessing_buffer): Do code-fill
9451         generation as appropriate.
9452         (Output_section::get_input_sections): Invalidate relaxed input section
9453         map.
9454         (Output_section::restore_states): Adjust type of checkpoint .
9455         Invalidate relaxed input section map.
9456         * output.h (Output_merge_base): New class declaration.
9457         (Input_section_specifier): New class defintion.
9458         (class Output_relaxed_input_section) Change base class to
9459         Output_section_data_build.
9460         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9461         base class initializer.
9462         (Output_section::add_relaxed_input_section): New method declaration.
9463         (Output_section::Input_section): Change visibility to protected.
9464         (Output_section::Input_section::relobj,
9465         Output_section::Input_section::shndx): Handle relaxed input sections.
9466         Output_section::input_sections) Change visibility to protected.  Also
9467         define overload to return a non-const pointer.
9468         (Output_section::Merge_section_properties): New class defintion.
9469         (Output_section::Merge_section_by_properties_map,
9470         Output_section::Output_section_data_by_input_section_map,
9471         Output_section::Relaxation_map): New types.
9472         (Output_section::relax_input_section): Rename method to
9473         Output_section::convert_input_sections_to_relaxed_sections and change
9474         interface to take a vector of relaxed section pointers.
9475         (Output_section::find_merge_section,
9476         Output_section::find_relaxed_input_section,
9477         Output_section::build_relaxation_map,
9478         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9479         New method declarations.
9480         (Output_section::merge_section_map_
9481         Output_section::merge_section_by_properties_map_,
9482         Output_section::relaxed_input_section_map_,
9483         Output_section::is_relaxed_input_section_map_valid_,
9484         Output_section::generate_code_fills_at_write_): New data members.
9485         * script-sections.cc
9486         (Output_section_element_input::set_section_addresses): Call
9487         current_data_size and addralign methods of relaxed input sections.
9488         (Orphan_output_section::set_section_addresses): Call current_data_size
9489         and addralign methods of relaxed input sections.
9490         * symtab.cc (Symbol_table::compute_final_value): Extract template
9491         from the body of Symbol_table::sized_finalize_symbol.
9492         (Symbol_table::sized_finalized_symbol): Call
9493         Symbol_table::compute_final_value.
9494         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9495         (Symbol_table::compute_final_value): New templated method declaration.
9496         * target.cc (Target::do_make_output_section): New method defintion.
9497         * target.h (Target::make_output_section): New method declaration.
9498         (Target::relax): Add more parameters for input objects, symbol table
9499         and layout.  Adjust call to do_relax.
9500         (Target::do_make_output_section): New method declaration.
9501         (Target::do_relax): Add parameters for input objects, symbol table
9502         and layout.
9503
9504 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9505
9506         * pread.c: Include stdio.h.
9507
9508 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9509
9510         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9511         defined.
9512
9513 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9514
9515         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9516         Change read_shndx type to unsigned int.
9517         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9518         int.
9519         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9520         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9521         Change read_shndx type to unsigned int.
9522         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9523         int.
9524         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9525         * layout.cc (Layout::create_symtab_sections): Cast the result of
9526         local_symcount * symsize to off_t in the gold_assert.
9527
9528 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9529
9530         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9531         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9532         R_ARM_BASE_ABS.
9533         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9534         (Arm_relocate_functions::thm_abs5): New function.
9535         (Arm_relocate_functions::abs12): New function.
9536         (Arm_relocate_functions::abs16): New function.
9537         (Arm_relocate_functions::base_abs): New function.
9538         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9539         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9540         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9541         R_ARM_BASE_ABS.
9542         (Scan::global): Likewise.
9543         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9544         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9545         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9546         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9547         R_ARM_BASE_ABS.
9548
9549 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9550
9551         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9552         (Arm_relocate_functions::movt_prel): New function.
9553         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9554         (Arm_relocate_functions::thm_movt_prel): New function.
9555         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9556         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9557         (Scan::global, Relocate::relocate): Likewise.
9558         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9559
9560 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9561
9562         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9563         Incremental_checker.
9564         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9565         unsigned int.
9566         (class Incremental_inputs_header): New class.
9567         (Incremental_inputs_header_writer): Edit comment.
9568         (Incremental_inputs_entry): New class.
9569         (Incremental_inputs_entry_writer): Edit comment.
9570         (Sized_incremental_binary::do_find_incremental_inputs_section):
9571         Add *strtab_shndx parameter, fill it.
9572         (Sized_incremental_binary::do_check_inputs): New method.
9573         (Incremental_checker::can_incrementally_link_output_file): Use
9574         Sized_incremental_binary::check_inputs.
9575         (Incremental_inputs::report_command_line): Save command line in
9576         command_line_.
9577         * incremental.h:
9578         (Incremental_binary::find_incremental_inputs_section): New
9579         method.
9580         (Incremental_binary::do_find_incremental_inputs_section): Add
9581         strtab_shndx parameter.
9582         (Incremental_binary::do_check_inputs): New pure virtual method.
9583         (Sized_incremental_binary::do_check_inputs): Declare.
9584         (Incremental_checker::Incremental_checker): Add incremental_inputs
9585         parameter, use it to initialize incremental_inputs_.
9586         (Incremental_checker::incremental_inputs_): New field.
9587         (Incremental_checker::command_line): New method.
9588         (Incremental_checker::inputs): New method.
9589         (Incremental_checker::command_line_): New field.
9590
9591 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9592
9593         * incremental.cc: Include <cstdarg> and "target-select.h".
9594         (vexplain_no_incremental): New function.
9595         (explain_no_incremental): New function.
9596         (Incremental_binary::error): New method.
9597         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9598         method.
9599         (make_sized_incremental_binary): New function.
9600         (open_incremental_binary): New function.
9601         (can_incrementally_link_file): Add checks if output is ELF and has
9602         inputs section.
9603         * incremental.h: Include "elfcpp_file.h" and "output.h".
9604         (Incremental_binary): New class.
9605         (Sized_incremental_binary): New class.
9606         (open_incremental_binary): Declare.
9607         * object.cc (is_elf_object): Use
9608         elfcpp::Elf_recognizer::is_elf_file.
9609         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9610         * output.h (Output_file::filesize): New method.
9611
9612 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9613
9614         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9615         New function.
9616         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9617         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9618         function.
9619         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9620         function.
9621         (Arm_relocate_functions::movw_abs_nc): New function.
9622         (Arm_relocate_functions::movt_abs): New function.
9623         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9624         (Arm_relocate_functions::thm_movt_abs): New function.
9625         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9626         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9627         (Scan::global): Likewise.
9628         (Relocate::relocate): Likewise.
9629         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9630
9631 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9632
9633         * arm.cc (Arm_relocate_functions::got_prel) New function.
9634         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9635         (Relocate::relocate): Likewise.
9636         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9637
9638 2009-10-06  Ian Lance Taylor  <iant@google.com>
9639
9640         * options.h (class General_options): Define
9641         split_stack_adjust_size parameter.
9642         * object.h (class Object): Add uses_split_stack_ and
9643         has_no_split_stack_ fields.  Add uses_split_stack and
9644         has_no_split_stack accessor functions.  Declare
9645         handle_split_stack_section.
9646         (class Reloc_symbol_changes): Define.
9647         (class Sized_relobj): Define Function_offsets.  Declare
9648         split_stack_adjust, split_stack_adjust_reltype, and
9649         find_functions.
9650         * object.cc (Object::handle_split_stack_section): New function.
9651         (Sized_relobj::do_layout): Call handle_split_stack_section.
9652         * dynobj.cc (Sized_dynobj::do_layout): Call
9653         handle_split_stack_section.
9654         * reloc.cc (Sized_relobj::relocate_sections): Call
9655         split_stack_adjust for executable sections in split_stack
9656         objects.  Pass reloc_map to relocate_section.
9657         (Sized_relobj::split_stack_adjust): New function.
9658         (Sized_relobj::split_stack_adjust_reltype): New function.
9659         (Sized_relobj::find_functions): New function.
9660         * target-reloc.h: Include "object.h".
9661         (relocate_section): Add reloc_symbol_changes parameter.  Change
9662         all callers.
9663         * target.h (class Target): Add calls_non_split method.  Declare
9664         do_calls_non_split virtual method.  Declare match_view and
9665         set_view_to_nop.
9666         * target.cc: Include "elfcpp.h".
9667         (Target::do_calls_non_split): New function.
9668         (Target::match_view): New function.
9669         (Target::set_view_to_nop): New function.
9670         * gold.cc (queue_middle_tasks): Give an error if mixing
9671         split-stack and non-split-stack objects with -r.
9672         * i386.cc (Target_i386::relocate_section): Add
9673         reloc_symbol_changes parameter.
9674         (Target_i386::do_calls_non_split): New function.
9675         * x86_64.cc (Target_x86_64::relocate_section): Add
9676         reloc_symbol_changes parameter.
9677         (Target_x86_64::do_calls_non_split): New function.
9678         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9679         parameter.
9680         * powerpc.cc (Target_powerpc::relocate_section): Add
9681         reloc_symbol_changes parameter.
9682         * sparc.cc (Target_sparc::relocate_section): Add
9683         reloc_symbol_changes parameter.
9684         * configure.ac: Call AM_CONDITIONAL for the default target.
9685         * configure: Rebuild.
9686         * testsuite/Makefile.am (TEST_AS): New variable.
9687         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9688         (check_DATA): Add split_i386 and split_x86_64 files.
9689         (SPLIT_DEFSYMS): Define.
9690         (split_i386_[1234n].o): New targets.
9691         (split_i386_[124]): New targets.
9692         (split_i386_[1234r].stdout): New targets.
9693         (split_x86_64_[1234n].o): New targets.
9694         (split_x86_64_[124]): New targets.
9695         (split_x86_64_[1234r].stdout): New targets.
9696         (MOSTLYCLEANFILES): Add new executables.
9697         * testsuite/split_i386.sh: New file.
9698         * testsuite/split_x86_64.sh: New file.
9699         * testsuite/split_i386_1.s: New file.
9700         * testsuite/split_i386_2.s: New file.
9701         * testsuite/split_i386_3.s: New file.
9702         * testsuite/split_i386_4.s: New file.
9703         * testsuite/split_i386_n.s: New file.
9704         * testsuite/split_x86_64_1.s: New file.
9705         * testsuite/split_x86_64_2.s: New file.
9706         * testsuite/split_x86_64_3.s: New file.
9707         * testsuite/split_x86_64_4.s: New file.
9708         * testsuite/split_x86_64_n.s: New file.
9709         * testsuite/testfile.cc (Target_test): Update relocation_section
9710         function.
9711         * testsuite/Makefile.in: Rebuild.
9712
9713 2009-10-06  Ian Lance Taylor  <iant@google.com>
9714
9715         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9716         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9717         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9718         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9719         the address on ldo_addrs_.
9720         (Target_i386::Relocate::fix_up_ldo): New function.
9721
9722 2009-10-06   Rafael Espindola  <espindola@google.com>
9723
9724         * plugin.cc (add_input_library): New.
9725         (Plugin::load): Add add_input_library to tv.
9726         (Plugin_manager::add_input_file): Add the is_lib argument.
9727         (add_input_file): Update call to Plugin_manager::add_input_file.
9728         (add_input_library): New.
9729         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9730
9731 2009-09-30  Doug Kwan  <dougkwan@google.com>
9732
9733         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9734         symbol and call Symbol::may_need_copy_reloc to determine if
9735         a copy reloc is needed.
9736         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9737         nocopyreloc is given in command line.
9738         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9739         given in command line.
9740         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9741         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9742         of the removed Target_i386::may_need_copy_reloc.
9743         * options.h (copyreloc): New option with default value false.
9744         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9745         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9746         instead of the removed Target_powerpc::may_need_copy_reloc.
9747         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9748         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9749         instead of the removed Target_sparc::may_need_copy_reloc.
9750         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9751         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9752         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9753         instead of the removed Target_x86_64::may_need_copy_reloc.
9754
9755 2009-09-30  Ian Lance Taylor  <iant@google.com>
9756
9757         * object.h (class Object): Remove target_ field, and target,
9758         sized_target, and set_target methods.
9759         (Object::sized_target): Remove.
9760         (class Sized_relobj): Update declarations.  Remove sized_target.
9761         * object.cc (Sized_relobj::setup): Remove target parameter.
9762         Change all callers.
9763         (Input_objects::add_object): Don't do anything with the target.
9764         (make_elf_sized_object): Add punconfigured parameter.  Change all
9765         callers.  Set or test parameter target.
9766         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9767         Change all callers.
9768         * parameters.cc (Parameters::set_target): Change parameter type to
9769         be non-const.
9770         (Parameters::default_target): Remove.
9771         (set_parameters_target): Change parameter type to be non-const.
9772         (parameters_force_valid_target): New function.
9773         (parameters_clear_target): New function.
9774         * parameters.h (class Parameters): Update declarations.  Remove
9775         default_target method.  Add sized_target and clear_target
9776         methods.  Change target_ to be non-const.
9777         (set_parameters_target): Update declaration.
9778         (parameters_force_valid_target): Declare.
9779         (parameters_clear_target): Declare.
9780         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9781         as NULL if we aren't searching.
9782         (Add_symbols::run): Don't check for compatible target.
9783         * fileread.cc (Input_file::open_binary): Call
9784         parameters_force_valid_target.
9785         * gold.cc (queue_middle_tasks): Likewise.
9786         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9787         set_target on object.
9788         * dynobj.h (class Sized_dynobj): Update declarations.
9789         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9790         make_elf_object returns NULL.
9791         (Archive::include_member): Don't check whether object target is
9792         compatible.
9793         * output.cc (Output_section::add_input_section): Get target from
9794         parameters.
9795         (Output_section::relax_input_section): Likewise.
9796         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9797         parameters.
9798         (Sized_relobj::do_scan_relocs): Likewise.
9799         (Sized_relobj::relocate_sections): Likewise.
9800         * resolve.cc (Symbol_table::resolve): Likewise.
9801         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9802         parameter.  Change all callers.
9803         (Symbol_table::add_from_object): Get target from parameters.
9804         (Symbol_table::add_from_relobj): Don't check object target.
9805         (Symbol_table::add_from_dynobj): Likewise.
9806         (Symbol_table::define_special_symbol): Get target from
9807         parameters.
9808         * symtab.h (class Symbol_table): Update declaration.
9809         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9810         parameter.  Change all callers.  Clear parameter target.
9811         (Binary_test): Test target here.
9812         * testsuite/object_unittest.cc (gold_testsuite): Remove
9813         target_test_pointer parameter.  Change all callers.
9814         (Object_test): Test target here.
9815
9816 2009-09-26  Ian Lance Taylor  <iant@google.com>
9817
9818         * testsuite/initpri1.c: Don't try to use constructor priorities if
9819         compiling with gcc before 4.3.
9820
9821 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9822
9823         * testsuite/retain_symbols_file_test.sh (check_present): Change
9824         output file name to retain_symbols_file_test.stdout.
9825         (check_absent): Likewise.
9826
9827 2009-09-18  Craig Silverstein  <csilvers@google.com>
9828
9829         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9830         * options.cc: Include <cerrno> and <fstream>.
9831         (General_options::finalize): Parse -retain-symbols-file tag.
9832         * options.h: New flag.
9833         (General_options): New method should_retain_symbol, new
9834         variable symbols_to_retain.
9835         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9836         should_retain_symbol map.
9837         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9838         * testsuite/Makefile.in: Regenerate.
9839         * testsuite/retain_symbols_file_test.sh: New file.
9840
9841 2009-09-18  Nick Clifton  <nickc@redhat.com>
9842
9843         * po/es.po: Updated Spanish translation.
9844
9845 2009-09-17  Doug Kwan  <dougkwan@google.com>
9846
9847         * debug.h (DEBUG_RELAXATION): New constant.
9848         (DEBUG_ALL): Add DEBUG_RELAXATION.
9849         (debug_string_to_enum): Add relaxation debug option.
9850         * layout.cc
9851         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9852         Layout::Relaxation_debug_check::read_sections,
9853         Layout::Relaxation_debug_check::read_sections): New method definitions.
9854         (Layout::Layout): Initialize data members
9855         record_output_section_data_from_scrips_,
9856         script_output_section_data_list_ and relaxation_debug_check_.
9857         (Layout::save_segments, Layout::restore_segments,
9858         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9859         Layout::relaxation_loop_body): New method definitions.
9860         (Layout::finalize): Support relaxation.  Move section layout code to
9861         Layout::relaxation_loop_body.
9862         (Layout::set_asection_address_from_script): Move code for orphan
9863         section placement out.
9864         (Layout::place_orphan_sections_in_script): New method definition.
9865         * layout.h (Output_segment_headers, Output_file_header):
9866         New forward class declarations.
9867         (Layout::~Layout): Define.
9868         (Layout::new_output_section_data_from_script): New method definition.
9869         (Layout::place_orphan_sections_in_script): New method declaration.
9870         (Layout::Segment_states): New type declaration.
9871         (Layout::save_segments, Layout::restore_segments,
9872         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9873         Layout::relaxation_loop_body): New method declarations.
9874         (Layout::Output_section_data_list): New type declaration.
9875         (Layout::Relaxation_debug_check): New class definition.
9876         (Layout::record_output_section_data_from_script_,
9877         Layout::script_output_section_data_list_, Layout::segment_states_,
9878         Layout::relaxation_debug_check_): New data members.
9879         * output.cc: (Output_section_headers::do_size): New method definition.
9880         (Output_section_headers::Output_section_headers): Move size
9881         computation to Output_section_headers::do_size.
9882         (Output_segment_headers::do_size): New method definition.
9883         (Output_file_header::Output_file_header): Move size computation to
9884         Output_file_header::do_size and call it.
9885         (Output_file_header::do_size): New method definition.
9886         (Output_data_group::Output_data_group): Adjust call to
9887         Output_section_data.
9888         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9889         (Output_symtab_xindex::do_write): Add array bound check.
9890         (Output_section::Input_section::print_to_mapfile): Handle
9891         RELAXED_INPUT_SECTION_CODE.
9892         (Output_section::Output_section): Initialize data member checkpoint_.
9893         (Output_section::~Output_section): Delete checkpoint object pointed
9894         by checkpoint_.
9895         (Output_section::add_input_section): Always add an Input_section if
9896         relaxing.
9897         (Output_section::add_merge_input_section): Add assert.
9898         (Output_section::relax_input_section): New method definition.
9899         (Output_section::set_final_data_size): Set load address to zero for
9900         an unallocated section.
9901         (Output_section::do_address_and_file_offset_have_reset_values):
9902         New method definition.
9903         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9904         Handle relaxed input section.
9905         (Output_section::sort_attached_input_sections): Checkpoint input
9906         section list lazily.
9907         (Output_section::get_input_sections): Change type of input_sections to
9908         list of Simple_input_section pointers.  Checkpoint input section list
9909         lazily.  Also handle relaxed input sections.
9910         (Output_section::add_input_section_for_script): Take a reference to
9911         a Simple_input_section object instead of Relobj pointer and section
9912         index as parameter.  Handle relaxed input sections.
9913         (Output_section::save_states, Output_section::restore_states): New
9914         method definitions.
9915         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9916         (Output_data::is_data_size_fixed): New method definition.
9917         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9918         if it is fixed.
9919         (Output_data::address_and_file_offset_have_reset_values): New method
9920         definition.
9921         (Output_data::do_address_and_file_offset_have_reset_values): New method
9922         definition.
9923         (Output_data::set_data_size): Check that data size is not fixed.
9924         (Output_data::fix_data_size): New method definition.
9925         (Output_data::is_data_size_fixed_): New data member.
9926         (Output_section_headers::set_final_data_size): New method definition.
9927         (Output_section_headers::do_size): New method declaration.
9928         (Output_segment_headers::set_final_data_size): New method definition.
9929         (Output_segment_headers::do_size): New method declaration.
9930         (Output_file_header::set_final_data_size)::New method definition.
9931         (Output_file_header::do_size)::New method declaration.
9932         (Output_section_data::Output_section_data): Add new parameter
9933         is_data_size_fixed and use it to fix data size.
9934         (Output_data_const::Output_data_const): Adjust call to base class
9935         constructor and fix data size.
9936         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9937         base class constructor and fix data size.
9938         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9939         base class constructor and fix data size.
9940         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9941         class constructor and fix data size.
9942         (Output_data_group::set_final_data_size): New method definition.
9943         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9944         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9945         class constructor and fix data size.
9946         (Output_relaxed_input_section): New class definition.
9947         (Output_section::Simple_input_section): New class definition.
9948         (Output_section::get_input_sections): Adjust parameter list.
9949         (Output_section::add_input_section_for_script): Same.
9950         (Output_section::save_states, Output_section::restore_states,
9951         Output_section::do_address_and_file_offset_have_reset_values,
9952         (Output_section::Input_section::Input_section): Handle
9953         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9954         Output_relaxed_input_section.
9955         (Output_section::Input_section::is_input_section,
9956         Output_section::Input_section::set_output_section): Handle relaxed
9957         input section.
9958         (Output_section::Input_section::is_relaxed_input_section,
9959         Output_section::Input_section::output_section_data,
9960         Output_section::Input_section::relaxed_input_section): New method
9961         definitions.
9962         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9963         value.
9964         (Output_section::Input_section::u1_): Update comments.
9965         (Output_section::Input_section::u2_): Add new union member poris.
9966         (Output_section::Checkpoint_output_section): New classs definition.
9967         (Output_section::relax_input_section): New method declaration.
9968         (Output_section::checkpoint_): New data member.
9969         (Output_segment): Update comments.
9970         (Output_segment::Output_segment): Un-privatize copy constructor.
9971         (Output_segment::operator=): Un-privatize.
9972         * script-sections.cc (Output_section_element::Input_section_list):
9973         Change element type to Output_section::Simple_input_section.
9974         (Output_section_element_dot_assignment::set_section_addresses):
9975         Register output section data for relaxation clean up.
9976         (Output_data_exression::Output_data_expression): Adjust call to base
9977         constructor to fix data size.
9978         (Output_section_element_data::set_section_addresses): Register
9979         Output_data_expression object for relaxation clean up.
9980         (struct Input_section_info): Replace Relobj pointer and section index
9981         pair with Output_section::Simple_input_section and Convert struct to a
9982         class.
9983         (Input_section_sorter::operator()): Adjust access to
9984         Input_section_info data member to use accessors.
9985         (Output_section_element_input::set_section_addresses): Use layout
9986         parameter.  Adjust code to use Output_section::Simple_input_section
9987         and Input_secction_info classes.  Register filler for relaxation
9988         clean up.
9989         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9990         and section index pair with Output_section::Simple_input_section
9991         class.  Adjust code accordingly.
9992         (Phdrs_element::release_segment): New method definition.
9993         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9994         segment list.
9995         (Script_sections::release_segments): New method definition.
9996         * gold/script-sections.h (Script_sections::release_segments): New
9997         method declaration.
9998         * gold/target.h (Target::may_relax, Target::relax,
9999         Target::do_may_relax, Target::do_relax): New method definitions.
10000
10001 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10002
10003         * arm.cc (has_signed_unsigned_overflow): New function.
10004         (Arm_relocate_functions::abs8): New function.
10005         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10006         (Target_arm::Scan::global): Likewise.
10007         (Target_arm::relocate::relocate): Likewise.
10008         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10009         Likewise.
10010
10011 2009-09-16  Cary Coutant  <ccoutant@google.com>
10012
10013         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10014         * testsuite/Makefile.in: Regenerate.
10015
10016 2009-09-11  Nick Clifton  <nickc@redhat.com>
10017
10018         * po/gold.pot: Updated by the Translation project.
10019
10020 2009-09-08  Cary Coutant  <ccoutant@google.com>
10021
10022         * output.cc (Output_file::open): Add execute permission to empty file.
10023         * testsuite/Makefile.am (permission_test): New test.
10024         * testsuite/Makefile.in: Regenerate.
10025
10026 2009-09-02  Ian Lance Taylor  <iant@google.com>
10027
10028         * output.cc (Output_file::resize): Call map_no_anonymous rather
10029         than map.
10030
10031 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10032
10033         * gold.cc: Include "incremental.h".
10034         (queue_initial_tasks): Call Incremental_checker methods.
10035         * incremental.cc: Include "output.h".
10036         (Incremental_checker::can_incrementally_link_output_file): New
10037         method.
10038         * incremental.h (Incremental_checker): New class.
10039
10040         * output.cc (Output_file::open_for_modification): New method.
10041         (Output_file::map_anonymous): Changed return type to bool.  Record
10042         map in base_ field.
10043         (Output_file::map_no_anonymous): New method, broken out of map.
10044         (Output_file::map): Use map_no_anonymous and map_anonymous.
10045         * output.h (class Output_file): Update declarations.
10046
10047 2009-08-24  Cary Coutant  <ccoutant@google.com>
10048
10049         * options.h (Command_line::Pre_options): New class.
10050         (Command_line::pre_options): New member.
10051         * options.cc (gold::options::ready_to_register): New variable.
10052         (One_option::register_option): Do nothing if not registering options.
10053         Assert if same short option registered twice.
10054         (General_options::General_options): Turn off option registration when
10055         done constructing.
10056         (Command_line::Pre_options::Pre_options): New constructor.
10057
10058 2009-08-24  Cary Coutant  <ccoutant@google.com>
10059
10060         * options.h (General_options::no_keep_memory): Remove incorrect
10061         short option.
10062
10063 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10064
10065         * Makefile.am (am__skiplex, am__skipyacc): New.
10066         * Makefile.in: Regenerate.
10067
10068 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10069
10070         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10071         (INCLUDES): ... this.
10072         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10073         (AM_CPPFLAGS): Renamed from ...
10074         (INCLUDE): ... this.
10075         * Makefile.in, testsuite/Makefile.in: Regenerate.
10076
10077         * Makefile.in: Regenerate.
10078         * aclocal.m4: Likewise.
10079         * config.in: Likewise.
10080         * configure: Likewise.
10081         * testsuite/Makefile.in: Likewise.
10082
10083         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10084         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10085         * Makefile.in: Regenerate.
10086         * testsuite/Makefile.in: Regenerate.
10087
10088 2009-08-19  Cary Coutant  <ccoutant@google.com>
10089
10090         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10091         symbols in shared libraries overridden by hidden or internal symbols
10092         in the main program.
10093
10094 2009-08-19  Chris Demetriou  <cgd@google.com>
10095
10096         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10097         checking source file names in error messages.
10098
10099 2009-08-18  Doug Kwan  <dougkwan@google.com>
10100
10101         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10102         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10103         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10104         an elfcpp::Ehdr as parameter.
10105         * object.cc (Object::set_target): Remove the version that looks up
10106         a target and sets it.
10107         (Sized_relobj::setup): Take a Target object instead of
10108         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10109         (make_elf_sized_object): Find target and ask target to
10110         make an ELF object.
10111         * object.h: (Object::set_target): Remove the version that looks up
10112         a target and sets it.
10113         (Sized_relobj::setup): Take a Target object instead of
10114         an elfcpp:Ehdr as parameter.
10115         * target.cc: Include dynobj.h.
10116         (Target::do_make_elf_object_implementation): New.
10117         (Target::do_make_elf_object): New.
10118         * target.h (Target::make_elf_object): New template declaration.
10119         (Target::do_make_elf_object): New method declarations.
10120         (Target::do_make_elf_object_implementation): New template declaration.
10121
10122 2009-08-14  Ian Lance Taylor  <iant@google.com>
10123
10124         * gold.h (FUNCTION_NAME): Define.
10125         (gold_unreachable): Use FUNCTION_NAME.
10126
10127 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10128
10129         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10130         symbol in the --keep-unique list is not found.
10131
10132 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10133
10134         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10135         been maked as --keep-unique.
10136         (Icf::unfold_section): New function.
10137         * icf.h (Icf::unfold_section): New function.
10138         * options.h (General_options::keep_unique): New option.
10139         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10140         * testsuite/Makefile.in: Regenerate.
10141         * testsuite/icf_keep_unique_test.sh: New file.
10142         * testsuite/icf_keep_unique_test.cc: New file.
10143
10144 2009-08-12  Cary Coutant  <ccoutant@google.com>
10145
10146         PR 10471
10147         * resolve.cc (Symbol_table::resolve): Check for references from
10148         dynamic objects to hidden and internal symbols.
10149         * testsuite/Makefile.am (hidden_test.sh): New test.
10150         * testsuite/Makefile.in: Regenerate.
10151         * testsuite/hidden_test.sh: New script.
10152         * testsuite/hidden_test_1.c: New test source.
10153         * testsuite/hidden_test_main.c: New test source.
10154
10155 2009-08-11  Doug Kwan  <dougkwan@google.com>
10156
10157         * arm.cc: Update comments.
10158         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10159         segment to locate the .ARM.exidx section if present.
10160
10161 2009-08-09  Doug Kwan  <dougkwan@google.com>
10162
10163         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10164         patch.
10165
10166 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10167         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10168         compiler warnings.
10169
10170 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10171
10172         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10173         valid tls_segment only for non-debug-section relocations.
10174         * testsuite/Makefile.am: Add gc_tls_test.
10175         * testsuite/Makefile.in: Regenerate.
10176         * testsuite/gc_tls_test.cc: New file.
10177         * testsuite/gc_tls_test.sh: New file.
10178
10179 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10180
10181         * icf.cc: New file.
10182         * icf.h: New file.
10183         * Makefile.am (CCFILES): Add icf.cc.
10184         (HFILES): Add icf.h
10185         * Makefile.in: Regenerate.
10186         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10187         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10188         section, symbol and addend information for the relocs.
10189         * gold.cc (queue_middle_tasks): Call identical code folding.
10190         * gold.h: Add defines for multimap.
10191         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10192         to the call of finalize_local_symbols.
10193         * main.cc (main): Create object of class Icf.
10194         * object.cc (Sized_relobj::do_layout): Allow this function to be
10195         called twice during icf.
10196         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10197         to sections marked as identical by icf.
10198         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10199         when available.
10200         (Sized_relobj::do_section_entsize): New function.
10201         * object.h (Object::section_entsize): New function.
10202         (Object::do_section_entsize): New pure virtual function.
10203         (Relobj::finalize_local_symbols): Add new parameter.
10204         (Relobj::do_section_entsize): New function.
10205         * options.h (General_options::icf): New option.
10206         (General_options::icf_iterations): New option.
10207         (General_options::print_icf_sections): New option.
10208         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10209         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10210         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10211         icf.
10212         * symtab.cc (Symbol_table::is_section_folded): New function.
10213         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10214         to sections marked as identical by icf.
10215         * symtab.h (Symbol_table::set_icf): New function.
10216         (Symbol_table::icf): New function.
10217         (Symbol_table::is_section_folded): New function.
10218         (Symbol_table::icf_): New data member.
10219         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10220         * testsuite/Makefile.am: Add commands to build icf_test.
10221         * testsuite/Makefile.in: Regenerate.
10222         * testsuite/icf_test.sh: New file.
10223         * testsuite/icf_test.cc: New file.
10224
10225 2009-07-24  Chris Demetriou  <cgd@google.com>
10226
10227         * layout.cc (is_compressible_debug_section): Fix incorrect
10228         comment about compressed section names.
10229
10230 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10231
10232         PR 10419
10233         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10234
10235 2009-07-16  Ian Lance Taylor  <iant@google.com>
10236
10237         PR 10400
10238         * layout.h: #include <map>.
10239         (class Kept_section): Change from struct to class.  Add accessors
10240         and setters.  Add section size to Comdat_group mapping.  Change
10241         Comdat_group to std::map.  Add is_comdat_ field.  Add
10242         linkonce_size field in union.
10243         (class Layout): Update declaration of find_or_add_kept_section.
10244         Don't declare find_kept_object.
10245         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10246         parameter.  Add object, shndx, is_comdat, and is_group_name
10247         parameters.  Change all callers.  Adjust for new Kept_section.
10248         (Layout::find_kept_object): Remove.
10249         * object.cc (Sized_relobj::include_section_group): Update use of
10250         Kept_section.  Rename secnum to shndx.  Only record
10251         Kept_comdat_section if sections are the same size.
10252         (Sized_relobj::include_linkonce_section): Update use of
10253         Kept_section.  Only record Kept_comdat_section if sections are the
10254         same size.  Set size of linkonce section.
10255         (Sized_relobj::map_to_kept_section): Update call to
10256         get_kept_comdat_section.
10257         * object.h (class Sized_relobj): Rename fields in
10258         Kept_comdat_section to drop trailing underscores; change object
10259         field to Relobj*.  Change Kept_comdat_section_table to store
10260         struct rather than pointer.
10261         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10262         Add kept_object and kept_shndx parameters.  Change all callers.
10263         (Sized_relobj::get_kept_comdat_section): Change return type to
10264         bool.  Add kept_object and kept_shndx parameters.  Change all
10265         callers.
10266         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10267         Layout::find_or_add_kept_section.
10268
10269 2009-07-09  Ian Lance Taylor  <iant@google.com>
10270
10271         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10272         Reserve space in the hash table.
10273
10274 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10275
10276         * fileread.cc (File_read::get_mtime): New method.
10277         * fileread.h (Timespec): New structure.
10278         (File_read::get_mtime): New method.
10279         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10280         Renamed from timestamp_nsec.
10281         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10282         Elf_Xword.
10283         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10284         timestamp_nsec.
10285         (Incremental_inputs::report_archive): Save mtime; style fix.
10286         (Incremental_inputs::report_obejct): Save mtime; style fix.
10287         (Incremental_inputs::report_script): Save mtime; style fix.
10288         (Incremental_inputs::finalize_inputs): Style fix.
10289         (Incremental_inputs::finalize): Style fix.
10290         (Incremental_inputs::create_input_section_data): Store inputs
10291         mtime.
10292         * incremental.h (Incremental_inputs::report_script): Add mtime
10293         argument.
10294         (Incremental_inputs::Input_info::Input_info): Intialize only one
10295         union member.
10296         (Incremental_inputs::Input_info::archive): Move to nameless
10297         union.
10298         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10299         (Incremental_inputs::Input_info::script): Move to nameless union.
10300         (Incremental_inputs::mtime): New field.
10301         * script.cc (read_input_script): Pass file mtime to
10302         Incremental_input.
10303         * script.h (Script_info::inputs): Style fix.
10304
10305 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10306
10307         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10308         instead of 32.
10309
10310 2009-06-24  Ian Lance Taylor  <iant@google.com>
10311
10312         PR 10156
10313         * layout.cc (Layout::choose_output_section): If we find an
10314         existing section, update the flags.
10315         (Layout::create_notes): New function, broken out of
10316         Layout::finalize.
10317         (Layout::finalize): Don't create note sections.
10318         (Layout::create_note): Don't crash if linker script discards
10319         section.
10320         (Layout::create_gold_note): Likewise.
10321         (Layout::create_build_id): Likewise.  Don't set
10322         after_input_sections on the section.
10323         (Layout::create_executable_stack_info): Remove target parameter.
10324         Change caller.
10325         * layout.h (class Layout): Declare create_notes.  Update
10326         declaration of create_executable_stack_info.
10327         * gold.cc (queue_middle_tasks): Call create_notes.
10328         * output.cc (Output_section::update_flags_for_input_section): Move
10329         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10330         invalid.
10331         * output.h (Output_data::mark_address_invalid): New function.
10332         (class Output_section): Only declare, not define,
10333         update_flags_for_input_section.  Remove set_flags.
10334
10335 2009-06-24  Ian Lance Taylor  <iant@google.com>
10336
10337         * script-sections.cc (Output_section_definition::
10338         set_section_addresses): Rename shadowing local load_address to
10339         laddr.
10340
10341 2009-06-24  Ian Lance Taylor  <iant@google.com>
10342
10343         PR 10244
10344         * reloc.cc (relocate_sections): Skip empty relocation sections.
10345
10346 2009-06-23  Ian Lance Taylor  <iant@google.com>
10347
10348         PR 10156
10349         * layout.cc (Layout::create_note): Use choose_output_section
10350         rather than make_output_section.
10351
10352 2009-06-23  Ian Lance Taylor  <iant@google.com>
10353
10354         PR 10237
10355         * options.cc (General_options::parse_V): Set printed_version_.
10356         (General_options::General_options): Initialize printed_version_.
10357         * options.h (class General_options): Add printed_version_ field.
10358         * gold.cc (queue_initial_tasks): If there are no input files,
10359         don't give a fatal error if we printed the version information.
10360         (queue_middle_tasks): If using -r with a shared object, give a
10361         fatal error rather than an ordinary error.
10362
10363 2009-06-23  Ian Lance Taylor  <iant@google.com>
10364
10365         PR 10219
10366         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10367         (Layout::make_output_section): Set have_stabstr_section_ if we see
10368         a .stab*str section.
10369         (Layout::finalize): Call link_stabs_sections.
10370         (Layout::link_stabs_sections): New file.
10371         * layout.h (class Layout): Add have_stabstr_section_ field.
10372         Declare link_stabs_sections.
10373
10374 2009-06-23  Doug Kwan  <dougkwan@google.com>
10375
10376         * Makefile.am (libgold_a_LIBADD): New.
10377         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10378         * Makefile.in: Regenerate.
10379         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10380         * configure: Regenerate.
10381         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10382         * fileread.cc: Include sys/state.h
10383         * gold.h: Declare memmem and strndup if found missing.
10384         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10385
10386 2009-06-23  Ian Lance Taylor  <iant@google.com>
10387
10388         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10389         * configure: Rebuild.
10390
10391 2009-06-23  Ian Lance Taylor  <iant@google.com>
10392
10393         PR 10147
10394         * object.cc (Object::section_contents): Don't try to get a view if
10395         the section has length zero.
10396         (Object::handle_gnu_warning_section): If the section is empty, use
10397         the name of the section as the warning.
10398
10399 2009-06-23  Ian Lance Taylor  <iant@google.com>
10400
10401         PR 10133
10402         * stringpool.h (class Stringpool_template): Add optimize_ field.
10403         (Stringpool_template::set_optimize): New function.
10404         * stringpool.cc (Stringpool_template::Stringpool_template):
10405         Initialize optimize_ field.
10406         (Stringpool_template::set_string_offsets): Test local optimize
10407         fild rather than parameter.
10408         * layout.cc (Layout::Layout): Call set_optimize on the section
10409         name stringpool.
10410
10411 2009-06-22  Ian Lance Taylor  <iant@google.com>
10412
10413         PR 10030
10414         * yyscript.y: Parse TARGET.
10415         * script.cc (script_set_target): New function.
10416         * script-c.h (script_set_target): Declare.
10417         * options.cc (General_options::string_to_object_format): Rename
10418         from string_to_object_format in anonymous namespace.  Change
10419         callers.
10420         * options.h (class General_options): Declare
10421         string_to_object_format.
10422
10423 2009-06-22  Ian Lance Taylor  <iant@google.com>
10424
10425         * script-sections.cc (Script_sections::create_segments): Don't put
10426         program headers in a PT_LOAD segment if -n or -N.
10427
10428 2009-06-22  Ian Lance Taylor  <iant@google.com>
10429
10430         PR 10141
10431         * options.h (class General_options): Add -z lazy and -z now.  Sort
10432         -z options into alphabetical order.
10433         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10434
10435 2009-06-21  Ian Lance Taylor  <iant@google.com>
10436
10437         * layout.cc (Layout::make_output_section): Call
10438         Target::new_output_section.
10439         (Layout::attach_allocated_section_to_segment): Put large section
10440         sections in a separate load segment with the large segment flag
10441         set.
10442         (Layout::segment_precedes): Sort large data segments after other
10443         load segments.
10444         (align_file_offset): New static function.
10445         (Layout::set_segment_offsets): Use align_file_offset.
10446         * output.h (class Output_section): Add is_small_section_ and
10447         is_large_section_ fields.
10448         (Output_section::is_small_section): New function.
10449         (Output_section::set_is_small_section):  New function.
10450         (Output_section::is_large_section): New function.
10451         (Output_section::set_is_large_section): New function.
10452         (Output_section::is_large_data_section): New function.
10453         (class Output_segment): Add is_large_data_segment_ field.
10454         (Output_segment::is_large_data_segment): New function.
10455         (Output_segment::set_is_large_data_segment): New function.
10456         * output.cc (Output_section::Output_section): Initialize new
10457         fields.
10458         (Output_segment::Output_segment): Likewise.
10459         (Output_segment::add_output_section): Add assertion that large
10460         data sections always go in large data segments.  Force small data
10461         sections to the end of the list of data sections.  Force small BSS
10462         sections to the start of the list of BSS sections.  For large BSS
10463         sections to the end of the list of BSS sections.
10464         * symtab.h (class Symbol): Declare is_common_shndx.
10465         (Symbol::is_defined): Check Symbol::is_common_shndx.
10466         (Symbol::is_common): Likewise.
10467         (class Symbol_table): Define enum Commons_section_type.  Update
10468         declarations.  Add small_commons_ and large_commons_ fields.
10469         * symtab.cc (Symbol::is_common_shndx): New function.
10470         (Symbol_table::Symbol_table): Initialize new fields.
10471         (Symbol_table::add_from_object): Put small and large common
10472         symbols in the right list.
10473         (Symbol_table::sized_finalized_symbol): Check
10474         Symbol::is_common_shndx.
10475         (Symbol_table::sized_write_globals): Likewise.
10476         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10477         common symbol lists.  Don't call do_allocate_commons_list if the
10478         list is empty.
10479         (Symbol_table::do_allocate_commons_list): Remove is_tls
10480         parameter.  Add comons_section_type parameter.  Change all
10481         callers.  Handle small and large common symbols.
10482         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10483         Symbol::is_common_shndx.
10484         * resolve.cc (symbol_to_bits): Likewise.
10485         * target.h (Target::small_common_shndx): New function.
10486         (Target::small_common_section_flags): New function.
10487         (Target::large_common_shndx): New function.
10488         (Target::large_common_section_flags): New function.
10489         (Target::new_output_section): New function.
10490         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10491         small_common_section_flags, and large_common_section_flags
10492         fields.
10493         (Target::do_new_output_section): New virtual function.
10494         * arm.cc (Target_arm::arm_info): Initialize new fields.
10495         * i386.cc (Target_i386::i386_info): Likewise.
10496         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10497         Likewise.
10498         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10499         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10500         (Target_x86_64::do_new_output_section): New function.
10501         * configure.ac: Define conditional MCMODEL_MEDIUM.
10502         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10503         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10504         (large_LDFLAGS): Define.
10505         * testsuite/large.c: New file.
10506         * testsuite/testfile.cc (Target_test::test_target_info):
10507         Initialize new fields.
10508         * configure, testsuite/Makefile.in: Rebuild.
10509
10510 2009-06-05  Doug Kwan  <dougkwan@google.com>
10511
10512         * Makefile.am (CCFILES): Add target.cc.
10513         * Makefile.in: Regenerate.
10514         * i386.cc (class Target_i386): Define new virtual method to
10515         override do_is_local_label_name in parent.
10516         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10517         local symbols if --discard-locals or -X is given.
10518         * options.h (class General_options): Declare new options
10519         '--discard-locals' and '-X' for discarding locals.
10520         * target.h (class Target): Define new methods is_local_label_name.
10521         Declare new virtual method do_is_local_label_name.
10522         * target.cc: New file.
10523         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10524         (check_SCRIPTS): Add discard_locals_test.sh.
10525         (check_DATA): Add discard_local_tests.syms.
10526         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10527         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10528         * testsuite/Makefile.in: Regenerate.
10529         * testsuite/discard_locals_test.c: New file.
10530         * testsuite/discard_locals_test.sh: Same.
10531
10532 2009-06-05  Doug Kwan  <dougkwan@google.com>
10533
10534         * object.cc (Sized_relobj::Sized_relobj): Initialize
10535         discarded_eh_frame_shndx_ to -1U.
10536         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10537         section.
10538         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10539         a discarded .eh_frame section.
10540         (Sized_relobj::do_finalize_local_symbols): Ditto.
10541         * object.h (class Sized_relobj): Declare new member
10542         discarded_eh_frame_shndx_.
10543         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10544         (local_labels_test.o, local_labels_test): New rules.
10545         * testsuite/Makefile.in: Regenerate.
10546
10547 2009-06-04  Doug Kwan  <dougkwan@google.com>
10548
10549         * layout.cc (Layout::section_name_mapping): Add mapping for
10550         special ARM sections.
10551
10552 2009-06-03  Doug Kwan  <dougkwan@google.com>
10553
10554         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10555         (utils::has_overflow): Same.
10556
10557 2009-06-03  Ian Lance Taylor  <iant@google.com>
10558
10559         * layout.cc (Layout::section_name_mapping): New array, replacing
10560         Layout::linkonce_mapping.
10561         (Layout::section_name_mapping_count): New variable, replacing
10562         Layout::linkonce_mapping_count.
10563         (Layout::linkonce_output_name): Remove.
10564         (Layout::output_section_name): Rewrite.
10565         * layout.h (class Layout): Rename Linkonce_mapping to
10566         Section_name_mapping, linkonce_mapping to section_name_mapping,
10567         linkonce_mapping_count to section_name_mapping_count.  Don't
10568         declare linkonce_output_name.
10569
10570 2009-06-03  Doug Kwan  <dougkwan@google.com>
10571
10572         * gold/arm.cc (namespace utils): New.
10573         (Target_arm::reloc_is_non_pic): Define new method.
10574         (class Arm_relocate_functions): New.
10575         (Target_arm::Relocate::relocate): Handle relocation types used by
10576         Android.
10577
10578 2009-06-03  Ian Lance Taylor  <iant@google.com>
10579
10580         * arm.cc (Target_arm::scan::global): Use || instead of |.
10581
10582 2009-06-02  Doug Kwan  <dougkwan@google.com>
10583
10584         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10585         issued_non_pic_error_.
10586         (class Target_arm::Scan): Declare new method check_non_pic.
10587         Define new method symbol_needs_plt_entry.
10588         Declare new data member issued_non_pic_error_.
10589         (class Target_arm::Relocate): Declare new method
10590         should_apply_static_reloc.
10591         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10592         (Target_arm::Scan::check_non_pic): Define new method.
10593         (Target_arm::Scan::local): Handle a small subset of reloc types used
10594         by Android.
10595         (Target_arm::Scan::local): Same.
10596         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10597
10598 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10599
10600         * incremental.cc (Incremental_inputs::report_command_line): Filter
10601         out --incremental-* options.
10602
10603 2009-05-29  Doug Kwan  <dougkwan@google.com>
10604
10605         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10606         template class.
10607         (class Target_arm): Update comment.
10608         (Target_arm::Target_arm): Initialize new data members GOT_,
10609         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10610         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10611         and Target_arm::rel_dyn_section.
10612         Declare new_enum Target_arm::Got_type.
10613         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10614         and DYNBSS_.
10615         Update commments for member do_dynsym_value.
10616         (Target_arm::got_size, Target_arm::plt_section,
10617         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10618         new methods inside class defintion.
10619         (Target_arm::got_section): Define new method.
10620         (Target_arm::rel_dyn_section): Same.
10621         (Output_data_plt_arm): New template class.
10622         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10623         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10624         (Output_data_plt_arm::add_entry): Same.
10625         (Output_data_plt_arm::first_plt_entry): Define new
10626         static data member for PLT instruction template.
10627         (Output_data_plt_arm::plt_entry): Same.
10628         (Output_data_plt_arm::do_write): Define new method.
10629         (Target_arm::make_plt_entry): Same.
10630         (Target_arm::do_finalize_sections): Same.
10631         (Target_arm::do_dynsym_value): Same.
10632
10633 2009-05-28  Doug Kwan  <dougkwan@google.com>
10634
10635         * Makefile.am (TARGETSOURCES): Add arm.cc.
10636         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10637         * Makefile.in: Regenerate.
10638         * arm.cc: New file.
10639         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10640
10641 2009-05-26  Doug Kwan  <dougkwan@google.com>
10642
10643         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10644         (General_options::check_excluded_libs): Strip off directories in
10645         archive name before matching like GNU ld does.
10646         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10647         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10648         (exclude_libs_test_LDFLAGS): Add linker option
10649         -Wl,--exclude-libs,libexclude_libs_test_3
10650         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10651         an explicit archive without using -l.
10652         (alt/libexclude_libs_test_3.a): New make rule.
10653         * testsuite/Makefile.in: Regenerate.
10654         * testsuite/exclude_libs_test.c : Declare lib3_default().
10655         (main): Call it.
10656         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10657         * exclude_libs_test_3.c: New file.
10658
10659 2009-05-26  Nick Clifton  <nickc@redhat.com>
10660
10661         * po/id.po: New Indonesian translation.
10662         * po/gold.pot: Updated template file.
10663
10664 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10665
10666         * testsuite/Makefile.am: Add -ffunction-sections to compile
10667         gc_comdat_test files.  Add -Wl,--gc-sections to build
10668         gc_comdat_test.
10669         * testsuite/Makefile.in: Regenerate.
10670         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10671
10672 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10673
10674         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10675         kept comdat section was garbage collected.
10676         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10677         * testsuite/Makefile.in: Regenerate.
10678         * testsuite/gc_comdat_test.sh: New file.
10679         * testsuite/gc_comdat_test_1.cc: New file.
10680         * testsuite/gc_comdat_test_2.cc: New file.
10681
10682 2009-05-19  Doug Kwan  <dougkwan@google.com>
10683
10684         * archive.cc (Archive::Archive): Move constructor from archive.h
10685         to here.  Initialize no_export_.
10686         (Archive::get_elf_object_for_member): Set no_export flag of object.
10687         * archive.h (Archive::Archive): Move constructor body to
10688         archive.cc.
10689         (Archive::no_export): New method.
10690         (Archive::no_export_): New field.
10691         * object.h (Object::Object): Initialize no_export_ to false.
10692         (Object::no_export, Object::set_no_export): New methods.
10693         (Object::no_export_): New field.
10694         * options.cc (General_options::parse_exclude_libs): New method.
10695         (General_options::check_excluded_libs) Same.
10696         * options.h (exclude_libs): New option.
10697         (General_options::check_excluded_libs): New method declaration.
10698         (General_options::excluded_libs_): New field.
10699         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10700         default or protected visibility if an object has no-export flag set.
10701         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10702         (check_SCRIPTS): Add exclude_libs_test.sh.
10703         (check_DATA): Add exclude_libs_test.syms.
10704         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10705         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10706         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10707         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10708         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10709         libexclude_libs_test_2.a): New rules.
10710         * testsuite/Makefile.in: Regenerate.
10711         * testsuite/exclude_libs_test.c: New file.
10712         * testsuite/exclude_libs_test.sh: Ditto.
10713         * testsuite/exclude_libs_test_1.c: Ditto.
10714         * testsuite/exclude_libs_test_2.c: Ditto.
10715
10716 2009-05-15  Ian Lance Taylor  <iant@google.com>
10717
10718         * configure.ac: Check for declarations for cases where libiberty.h
10719         checks HAVE_DECL_xxx.
10720         * configure, config.in: Rebuild.
10721
10722 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10723
10724         * gold.h (Incremental_argument_list): Remove (invalid) forward
10725         declaration.
10726         * incremental.cc (Incremental_inputs::report_achive): New method.
10727         (Incremental_inputs::report_object): New method.
10728         (Incremental_inputs::report_script): New method.
10729         (Incremental_inputs::finalize_inputs): New method.
10730         (Incremental_inputs::finalize): Call finalize_inputs().
10731         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10732         Create inputs entries.
10733         * incremental.h (Incremental_input_type): New enum.
10734         (Incremental_inputs::Incremental_input): Initialize new fields.
10735         (Incremental_inputs::report_inputs): New method.
10736         (Incremental_inputs::report_achive): New method.
10737         (Incremental_inputs::report_object): New method.
10738         (Incremental_inputs::report_script): New method.
10739         (Incremental_inputs::finalize_inputs): New method.
10740         (Incremental_inputs::Input_info): New struct.
10741         (Incremental_inputs::Input_info_map): New typedef.
10742         (Incremental_inputs::lock_): New field.
10743         (Incremental_inputs::Inputs_): New field.
10744         (Incremental_inputs::Inputs_map): New field.
10745         * main.cc (main): Call Incremental_input::report_inputs.
10746         * options.h (Input_argument_list): Typedef moved from
10747         Input_arguments.
10748         (Input_file_group::Files): Remove, use ::Input_argument_list.
10749         (Input_file_group::Input_argument_list): Remove, use
10750         ::Input_argument_list.
10751         * plugin.cc (Plugin_manager::add_input_file): Add error in
10752         incremental build.
10753         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10754         functions.
10755         * script.cc (read_input_script): Call
10756         Incremental_input::report_script.
10757         * script.h (Script_info): New class.
10758
10759 2009-04-27  Ian Lance Taylor  <iant@google.com>
10760
10761         * x86_64.cc (do_adjust_output_section): Set entsize to
10762         plt_entry_size.
10763
10764 2009-04-23  Elliott Hughes  <enh@google.com>
10765
10766         * output.cc (Output_file::close): After short writes, continue
10767         writing from the correct offset in the buffer being written.
10768
10769 2009-04-23  Chris Demetriou  <cgd@google.com>
10770
10771         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10772         * configure: Regenerate.
10773         * config.in: Regenerate.
10774         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10775         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10776
10777 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10778
10779         * incremental.cc (Incremental_inputs_header_data): Renamed from
10780         Incremental_input_header_data.
10781         (Incremental_inputs_header_data::data_size): New field.
10782         (Incremental_inputs_header_data::put_input_file_count): Renamed
10783         from input_file_count.
10784         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10785         from command_line_offset.
10786         (Incremental_inputs_header_data::put_reserved): Renamed from
10787         put_reserved.
10788         (Incremental_inputs_entry_data): Renamed from
10789         Incremental_input_entry_data.
10790         (Incremental_inputs_entry_data::data_size): New field.
10791         (Incremental_inputs::report_command_line): New method.
10792         (Incremental_inputs::finalize): New method.
10793         (Incremental_inputs::create_incremental_inputs_data): New method.
10794         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10795         * incremental.h: New file.
10796         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10797         (Layout::finalize): Create incremental inputs section in
10798         incremental builds.
10799         (Layout::create_incremental_info_sections): New method.
10800         * layout.h (Layout::incremental_inputs): New method.
10801         (Layout::create_incremental_info_sections): New method.
10802         (Layout::incremental_inputs_): New field.
10803         * main.cc (main): Notify Incremental_input of the command line.
10804
10805 2009-04-01  Ian Lance Taylor  <iant@google.com>
10806             Mikolaj Zalewski  <mikolajz@google.com>
10807
10808         * gold.h (reserve_unordered_map): Define, three versions, one for
10809         each version of Unordered_map.
10810         * layout.cc (Layout::Layout): Remove options parameter.  Add
10811         number_of_input_files parameter.  Don't initialize options_.
10812         Initialize number_of_input_files_ and resized_signatures_.  Move
10813         sections_are_attached_.
10814         (Layout::layout_group): Reserve space for group_signatures_.
10815         (Layout::find_or_add_kept_section): Change name parameter to be a
10816         reference.  Resize signatures_ map when it gets large enough.
10817         (Layout::layout_eh_frame): Use parameters->options() instead of
10818         this->options_.
10819         (Layout::make_output_section): Likewise.
10820         (Layout::attach_allocated_section_to_segment): Likewise.
10821         (Layout::finalize, Layout::create_executable_stack): Likewise.
10822         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10823         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10824         * layout.h (class Layout): Update declarations.  Remove options_
10825         field.  Add number_of_input_files_ and resized_signatures_
10826         fields.  Move sections_are_attached_ field.
10827         * main.cc (main): Pass number of input files to Layout
10828         constructor.  Don't pass options.
10829
10830 2009-03-30  Ian Lance Taylor  <iant@google.com>
10831
10832         * ffsll.c (ffsll): Correct implementation.
10833
10834 2009-03-27  Ian Lance Taylor  <iant@google.com>
10835
10836         * ffsll.c: New file.
10837         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10838         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10839         * ftruncate.c (ftruncate): Declare before definition.
10840         * mremap.c (mremap): Likewise.
10841         * pread.c (pread): Likewise.
10842         * configure, Makefile.in, config.in: Rebuild.
10843
10844         * mremap.c: New file.
10845         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10846         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10847         (mremap): Declare if HAVE_MREMAP is not defined.
10848         * configure, Makefile.in, config.in: Rebuild.
10849
10850 2009-03-27  Cary Coutant  <ccoutant@google.com>
10851
10852         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10853         position independent.
10854         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10855         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10856
10857 2009-03-24  Cary Coutant  <ccoutant@google.com>
10858
10859         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10860         an executable.
10861         (needs_dynamic_reloc): Likewise.
10862
10863 2009-03-24  Ian Lance Taylor  <iant@google.com>
10864
10865         * yyscript.y (file_cmd): Recognize EXTERN.
10866         (extern_name_list, extern_name_list_body): New nonterminals.
10867         * script.cc (script_add_extern): Define.
10868         * script-c.h (script_add_extern): Declare.
10869
10870 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10871
10872         * object.cc (is_elf_object): Define.
10873         * object.h (is_elf_object): Declare.
10874         * archive.cc (Archive::get_elf_object_for_member): Call
10875         is_elf_object.
10876         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10877
10878 2009-03-24  Elliott Hughes  <enh@google.com>
10879
10880         * output.cc (Output_file::map_anonymous): Define.
10881         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10882         try an anonymous one.  Report the size if the mmap fails.
10883         * output.h (class Output_file): Declare map_anonymous.
10884
10885 2009-03-24  Ian Lance Taylor  <iant@google.com>
10886
10887         * target-select.cc (instantiate_target): Don't acquire the lock if
10888         the instantiated_target_ field has already been set.
10889
10890 2009-03-23  Ian Lance Taylor  <iant@google.com>
10891
10892         * gold-threads.h (class Initialize_lock): Define.
10893         * gold-threads.cc (class Initialize_lock_once): Define.
10894         (initialize_lock_control): New static variable.
10895         (initialize_lock_pointer): New static variable.
10896         (initialize_lock_once): New static function.
10897         (Initialize_lock::Initialize_lock): Define.
10898         (Initialize_lock::initialize): Define.
10899         * target-select.h: Include "gold-threads.h".
10900         (class Target_selector): Add lock_ and initialize_lock_ fields.
10901         Don't define instantiate_target, just declare it.
10902         * target-select.cc (Target_selector::Target_selector): Initialize
10903         new fields.
10904         (Target_selector::instantiate_target): Define.
10905         * descriptors.h: Include "gold-threads.h".
10906         (class Descriptors): Add initialize_lock_ field.
10907         * descriptors.cc (Descriptors::Descriptors): Initialize new
10908         field.
10909         (Descriptors::open): Use initialize_lock_ field
10910         * errors.h (class Errors): Add initialize_lock_ field.
10911         * errors.cc (Errors::Errors): Initialize new field.
10912         (Errors::initialize_lock): Use initialize_lock_ field.
10913         * powerpc.cc (class Target_selector_powerpc): Remove
10914         instantiated_target_ field.  In do_recognize call
10915         instantiate_target rather than do_instantiate_target.  In
10916         do_instantiate_target just allocate a new target.
10917         * sparc.cc (class Target_selector_sparc): Likewise.
10918
10919         * freebsd.h: New file.
10920         * i386.cc: Include "freebsd.h".
10921         (Target_i386): Derive from Target_freebsd rather than
10922         Sized_target.
10923         (Target_selector_i386): Derive from Target_selector_freebsd rather
10924         than Target_selector.
10925         * x86_64.cc: Include "freebsd.h".
10926         (Target_x86_64): Derive from Target_freebsd rather than
10927         Sized_target.
10928         (Target_selector_x86_64): Derive from Target_selector_freebsd
10929         rather than Target_selector.
10930         * target.h (class Target): Add adjust_elf_header and
10931         do_adjust_elf_header.
10932         * output.cc (Output_file_header:: do_sized_write): Call target
10933         adjust_elf_header routine.
10934         * configure.tgt: Set targ_osabi.
10935         * configure.ac: Define GOLD_DEFAULT_OSABI.
10936         * parameters.cc (Parameters::default_target): Pass
10937         GOLD_DEFAULT_OSABI to select_target.
10938         * target-select.h (class Target_selector): Make instantiate_target
10939         protected rather than private.
10940         * Makefile.am (HFILES): Add freebsd.h.
10941         * configure, Makefile.in, config.in: Rebuild.
10942
10943         * merge.cc (do_add_input_section): Correct pend value.  Change
10944         message about last entry not being null terminated from error to
10945         warning.
10946
10947 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10948
10949         * incremental.cc: New file.
10950         * Makefile.am (CCFILES): Add incremental.cc.
10951         * Makefile.in: Rebuild.
10952
10953 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10954
10955         * layout.cc (Layout::output_section_name): Preserve names
10956         of '.note.' sections.
10957
10958 2009-03-19  Ian Lance Taylor  <iant@google.com>
10959
10960         * descriptors.cc (Descriptors::open): Check that the options are
10961         valid before using them.
10962
10963 2009-03-18  Ian Lance Taylor  <iant@google.com>
10964
10965         * script-sections.h: Include <list>.
10966         (class Script_sections): Change Sections_elements from std::vector
10967         to std::list.  Typedef public Elements_iterator.  Add
10968         orphan_section_placement_, data_segment_align_start_, and
10969         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10970         field.
10971         * script-sections.cc (class Orphan_section_placement): New class.
10972         (class Sections_element): Add virtual functions is_relro and
10973         orphan_section_init.  Remove virtual function place_orphan_here.
10974         (class Output_section_definition): Add is_relro and
10975         orphan_section_init.  Remove place_orphan_here.
10976         (class Orphan_output_section): Likewise.
10977         (Script_sections::Script_sections): Update for field changes.
10978         (Script_sections::data_segment_align): Set saw_data_segment_align_
10979         and data_segment_align_start_, not data_segment_align_index.
10980         (Script_sections::data_segment_relro_end): Check
10981         saw_data_segment_align_.  Use data_segment_align_start_ rather
10982         than data_segment_align_index_.
10983         (Script_sections::place_orphan): Rewrite to use
10984         Orphan_section_placement.
10985
10986 2009-03-17  Ian Lance Taylor  <iant@google.com>
10987
10988         * archive.cc (Archive::add_symbols): Check for a version attached
10989         to the symbol name in the archive map.
10990         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10991         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10992         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10993         (ver_test_11.a): New target.
10994         * testsuite/Makefile.in: Rebuild.
10995
10996         * configure.ac: Check for chsize and posix_fallocate.  Replace
10997         ftruncate.
10998         * ftruncate.c: New file, from gnulib.
10999         * output.cc (posix_fallocate): Define dummy version if not
11000         HAVE_POSIX_FALLOCATE.
11001         (Output_file::map): Call posix_fallocate rather than lseek and
11002         write.
11003         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11004         * configure, Makefile.in, config.in: Rebuild.
11005
11006 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11007
11008         * layout.h (Layout::create_note): Add section_name parameter.
11009         * layout.cc (Layout::create_note): Likewise.
11010         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11011
11012 2009-03-17  Ian Lance Taylor  <iant@google.com>
11013
11014         * descriptors.cc: Include "options.h".
11015         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11016         (Descriptors::open): Always use O_CLOEXEC when opening a new
11017         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11018         then set FD_CLOEXEC.
11019
11020         * sparc.cc (class Target_sparc): Add has_got_section.
11021         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11022         make sure we have a GOT section.
11023
11024         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11025         (Target_sparc::Scan::local): Likewise.
11026         (Target_sparc::Scan::global): Likewise.
11027         (Target_sparc::Relocate::relocate): Likewise.
11028         (Target_sparc::Relocate::relocate_tls): Likewise.
11029
11030         * symtab.cc (Symbol_table::define_default_version): New function,
11031         broken out of add_from_object.
11032         (Symbol_table::add_from_object): Call define_default_version.
11033         (Symbol_table::define_special_symbol): Add resolve_oldsym
11034         parameter.  Change all callers.  If the version for a symbol comes
11035         from a version script, resolve it with the symbol with the same
11036         name with no version.  Also add the symbol without a version if
11037         appropriate.
11038         (do_define_in_output_data): If resolving with oldsym, don't delete
11039         sym.
11040         (do_define_in_output_segment): Likewise.
11041         (do_define_as_constant): Likewise.
11042         * symtab.h (class Symbol_table): Update declarations.
11043
11044 2009-03-13  Ian Lance Taylor  <iant@google.com>
11045
11046         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11047         (Read_symbols::requeue): New function.
11048         (Read_symbols::do_read_symbols): If make_elf_object fails because
11049         the target type is not configured, and the file was searched for,
11050         issue a warning and retry with the next directory.
11051         (Add_symbols::run): If the file has an incompatible format, and
11052         it was searched for, requeue the Read_symbols task.  On error,
11053         release the object.
11054         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11055         dirindex parameter to constructor.  Change all callers.  Declare
11056         incompatible_warning and requeue.
11057         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11058         input_argument_ and input_group_ fields.  Add them to
11059         constructor.  Change all callers.
11060         (class Read_script): Add dirindex_ field.  Add it to constructor.
11061         Change all callers.
11062         * archive.cc (Archive::setup): Remove input_objects parameter.
11063         Change all callers.
11064         (Archive::get_file_and_offset): Likewise.
11065         (Archive::read_all_symbols): Likewise.
11066         (Archive::read_symbols): Likewise.
11067         (Archive::get_elf_object_for_member): Remove input_objects
11068         parameter.  Add punconfigured parameter.  Change all callers.
11069         (Archive::add_symbols): Change return type to bool.  Check return
11070         value of include_member.
11071         (Archive::include_all_members): Likewise.
11072         (Archive::include_member): Change return type to bool.  Return
11073         false if first included object has incompatible target.  Set
11074         included_member_ field.
11075         (Add_archive_symbols::run): If add_symbols returns false, requeue
11076         Read_symbols task.
11077         * archive.h (class Archive): Add included_member_ field.
11078         Initialize it in constructor.  Add input_file and searched_for
11079         methods.  Update declarations.
11080         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11081         input_argument_ fields.  Add them to constructor.  Change all
11082         callers.
11083         * script.cc: Include "target-select.h".
11084         (class Parser_closure): Add skip_on_incompatible_target_ and
11085         found_incompatible_target_ fields.  Add
11086         skip_on_incompatible_target parameter to constructor.  Change all
11087         callers.  Add methods skip_on_incompatible_target,
11088         clear_skip_on_incompatible_target, found_incompatible_target, and
11089         set_found_incompatible_target.
11090         (read_input_script): Add dirindex parameter.  Change all callers.
11091         If parser finds an incompatible target, requeue Read_symbols
11092         task.
11093         (script_set_symbol): Clear skip_on_incompatible_target in
11094         closure.
11095         (script_add_assertion, script_parse_option): Likewise.
11096         (script_start_sections, script_add_phdr): Likewise.
11097         (script_check_output_format): New function.
11098         * script.h (read_input_script): Update declaration.
11099         * script-c.h (script_check_output_format): Declare.
11100         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11101         (ignore_cmd): Remove OUTPUT_FORMAT.
11102         * fileread.cc (Input_file::Input_file): Add explicit this.
11103         (Input_file::will_search_for): New function.
11104         (Input_file::open): Add pindex parameter.  Change all callers.
11105         * fileread.h (class Input_file): Add input_file_argument method.
11106         Declare will_search_for.  Update declarations.
11107         * object.cc (make_elf_object): Add punconfigured parameter.
11108         Change all callers.
11109         * object.h (class Object): Make input_file public.  Add
11110         searched_for method.
11111         (make_elf_object): Update declaration.
11112         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11113         restart search.
11114         * dirsearch.h (class Dirsearch): Update declaration.
11115         * options.h (class General_options): Add --warn-search-mismatch.
11116         * parameters.cc (Parameters::is_compatible_target): New function.
11117         * parameters.h (class Parameters): Declare is_compatible_target.
11118         * workqueue.cc (Workqueue::add_blocker): New function.
11119         * workqueue.h (class Workqueue): Declare add_blocker.
11120
11121         * fileread.cc (Input_file::open): Remove options parameter.
11122         Change all callers.
11123         (Input_file::open_binary): Likewise.
11124         * script.cc (read_input_script): Likewise.
11125         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11126         options parameter from constructor.  Change all callers.
11127         (class Read_script): Likewise.
11128         * fileread.h (class Input_file): Update declarations.
11129         * script.h (read_input_script): Update declaration.
11130
11131 2009-03-10  Nick Clifton  <nickc@redhat.com>
11132
11133         * po/es.po: New Spanish translation.
11134
11135 2009-03-06  Cary Coutant  <ccoutant@google.com>
11136
11137         * options.cc (parse_short_option): Keep dash_z from registering itself.
11138
11139 2009-03-03  Ian Lance Taylor  <iant@google.com>
11140
11141         PR 9918
11142         * target-reloc.h (relocate_section): Pass output_section to
11143         relocate.
11144         * i386.cc (Target_i386::should_apply_static_reloc): Add
11145         output_section parameter.  Change all callers.
11146         (Target_i386::Relocate::relocate): Add output_section parameter.
11147         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11148         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11149         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11150         * testsuite/two_file_shared.sh: New script.
11151         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11152         (check_DATA): Add two_file_shared.dbg.
11153         (two_file_shared.dbg): New target.
11154         * testsuite/Makefile.in: Rebuild.
11155
11156 2009-03-01  Ian Lance Taylor  <iant@google.com>
11157
11158         * configure.ac: Check for byteswap.h.
11159         * configure: Rebuild.
11160         * config.in: Rebuild.
11161
11162 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11163
11164         * layout.cc (Layout::find_or_add_kept_section): New function.
11165         (Layout::add_comdat): Removed.
11166         * layout.h (struct Kept_section): Move out of class Layout.
11167         Remove trailing underscores from field names.  Add group_sections
11168         field.  Rename group_ field to is_group.  Change all uses.
11169         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11170         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11171         comdat_groups_ field.
11172         (Sized_relobj::include_section_group): Use
11173         find_or_add_kept_section and Kept_section::group_sections.
11174         (Sized_relobj::include_linkonce_section): Likewise.
11175         * object.cc (class Sized_relobj): Don't define Comdat_group or
11176         Comdat_group_table.  Remove find_comdat_group and
11177         add_comdat_group.  Remove comdat_groups_ field.
11178         * plugin.cc (include_comdat_group): Use
11179         Layout::find_or_add_kept_section.
11180
11181 2009-02-28  Ian Lance Taylor  <iant@google.com>
11182
11183         * README: --gc-sections and map files are now supported.  Document
11184         some build requirements.
11185
11186         PR 6992
11187         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11188         relocatable link set the value of the section symbol to zero.
11189         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11190         relocatable link don't include the section address in the local
11191         symbol value.
11192
11193 2009-02-27  Ian Lance Taylor  <iant@google.com>
11194
11195         PR 6811
11196         * options.h (class Search_directory): Add is_system_directory.
11197         (class General_options): Declare is_in_system_directory.
11198         * options.cc (get_relative_sysroot): Make static.
11199         (get_default_sysroot): Make static.
11200         (General_optoins::is_in_system_directory): New function.
11201         * fileread.cc (Input_file::is_in_system_directory): New function.
11202         * fileread.h (class Input_file): Declare is_in_system_directory.
11203         * object.h (class Object): Add is_in_system_directory.
11204         (class Input_objects): Remove system_library_directory_ field.
11205         * object.cc (Input_objects::add_object): Don't set
11206         system_library_directory_.
11207         (input_objects::found_in_system_library_directory): Remove.
11208         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11209         parameter.  Change all callers.
11210         (Symbol_table::sized_write_globals): Likewise.
11211         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11212         Call Object::is_in_system_directory.
11213         * symtab.h (class Symbol_table): Update declarations.
11214
11215         PR 5990
11216         * descriptors.h (Open_descriptor): Add is_on_stack field.
11217         * descriptors.cc (Descriptors::open): If the descriptor is on the
11218         top of the stack, remove it.  Initialize is_on_stack field.
11219         (Descriptors::release): Only add pod to stack if it is not on the
11220         stack already.
11221         (Descriptors::close_some_descriptor): Clear stack_next and
11222         is_on_stack fields.
11223
11224         PR 7091
11225         * output.cc (Output_section::find_starting_output_address): Rename
11226         from starting_output_address; add PADDR parameter; change return
11227         type.
11228         * output.h (class Output_section): Declare
11229         find_starting_output_address instead of starting_output_address.
11230         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11231         section symbol for which we can't find a merge section.
11232
11233         PR 9836
11234         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11235         hidden or internal, force the symbol to be local.
11236         * resolve.cc (Symbol::override_visibility): Define.
11237         (Symbol::override_base): Use override_visibility.
11238         (Symbol_table::resolve): Likewise.
11239         (Symbol::override_base_with_special): Likewise.
11240         (Symbol_table::override_with_special): If the visibility is hidden
11241         or internal, force the symbol to be local.
11242         * symtab.h (class Symbol): Add set_visibility and
11243         override_visibility.
11244         * testsuite/ver_test_1.sh: New file.
11245         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11246         (check_DATA): Add ver_test_1.syms.
11247         (ver_test_1.syms): New target.
11248         * testsuite/Makefile.in: Rebuild.
11249
11250 2009-02-25  Cary Coutant  <ccoutant@google.com>
11251
11252         * layout.cc (Layout::choose_output_section): Don't rename sections
11253         when using a linker script that has a SECTIONS clause.
11254         * Makefile.in: Regenerate.
11255
11256         * testsuite/Makefile.am (script_test_5.sh): New test case.
11257         * testsuite/Makefile.in: Regenerate.
11258         * testsuite/script_test_5.cc: New file.
11259         * testsuite/script_test_5.sh: New file.
11260         * testsuite/script_test_5.t: New file.
11261
11262 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11263
11264         * archive.cc (Archive::include_member): Update calls to add_symbols.
11265         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11266         the Layout argument.
11267         * dynobj.h (do_add_symbols): Add the Layout argument.
11268         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11269         Layout argument.
11270         * object.h (Object::add_symbols): Add the Layout argument.
11271         (Object::do_add_symbols): Add the Layout argument.
11272         (Sized_relobj::do_add_symbols): Add the Layout argument.
11273         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11274         Unify the two versions.
11275         (Add_plugin_symbols): Remove.
11276         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11277         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11278         (Add_plugin_symbols): Remove.
11279         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11280         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11281         (Add_symbols::run): Make it work with Pulginobj.
11282
11283 2009-02-06  Ian Lance Taylor  <iant@google.com>
11284
11285         * object.cc (Sized_relobj::do_layout): Make info message start
11286         with lower case letter.
11287
11288 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11289
11290         * binary.cc: Fix file comment.
11291
11292         * options.h (enum Incremental_disposition): Define.
11293         (class General_options): Add new options: --incremental,
11294         --incremental_changed, --incremental_unchanged,
11295         --incremental_unknown.  Add incremental_disposition_ and
11296         implicit_incremental_ fields.
11297         (General_options::incremental_disposition): New function.
11298         (class Position_dependent_options): Add incremental_disposition
11299         option.
11300         (Position_dependent_options::copy_from_options): Set incremental
11301         dispositions.
11302         * options.cc (General_options::parse_incremental_changed): New
11303         function.
11304         (General_options::parse_incremental_unchanged): New function.
11305         (General_options::parse_incremental_unknown): New function.
11306         (General_options::General_options): Initialize new fields
11307         incremental_disposition_ and implicit_incremental_.
11308         (General_options::finalize): Check for uasge of --incremental-*
11309         without --incremental.
11310
11311 2009-02-06  Chris Demetriou  <cgd@google.com>
11312
11313         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11314         pointer and to report location as the file name associated with
11315         the symbol.
11316         (gold_undefined_symbol_at_location): New function to replace the
11317         old gold_undefined_symbol functionality.
11318         * target-reloc.h (relocate_section): Update to use
11319         gold_undefined_symbol_at_location.
11320         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11321         Call gold_undefined_symbol function rather than gold_error.
11322         * errors.h (Errors::undefined_symbol): Take location as a
11323         string, rather than calculating it from a relocation.
11324         * errors.cc (Errors::fatal): Print "fatal error:" before the
11325         formatted message.
11326         (Errors::error, Errors::error_at_location): Print "error: "
11327         before the formatted message.
11328         (Errors::undefined_symbol): Take location as a string, rather
11329         than calculating it from a relocation.
11330         (gold_undefined_symbol_at_location): New function akin to
11331         old gold_undefined_symbol, calculates location from relocation.
11332         (gold_undefined_symbol): Change to take only a Symbol pointer
11333         and to report location as the file name associated with the symbol.
11334         * testsuite/debug_msg.sh: Update for changed error messages.
11335         * testsuite/undef_symbol.sh: Likewise.
11336
11337 2009-02-04  Duncan Sands  <baldrick@free.fr>
11338
11339         PR 9812
11340         * reduced_debug_output.h
11341         (Output_reduced_debug_abbrev_section::failed): Use format for
11342         gold_warning.
11343         (Output_reduced_debug_info_section::faild): Likewise.
11344
11345 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11346
11347         * script.cc (Lazy_demangler): New class.
11348         (Version_script_info::get_symbol_version_helper): Demangle a
11349         symbol only once.
11350
11351 2009-01-29  Cary Coutant  <ccoutant@google.com>
11352
11353         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11354         to __tls_get_addr.
11355         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11356
11357 2009-01-28  Ian Lance Taylor  <iant@google.com>
11358
11359         * version.cc (version_string): Bump to 1.9.
11360
11361         * gold.h: Include <cstring> and <stdint.h>.
11362         * version.cc: Include <cstdio>.
11363         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11364         warning.
11365         * reduced_debug_output.cc (insert_into_vector): Rename from
11366         Insert_into_vector; change all callers.  Use Swap_unaligned to
11367         avoid aliasing issue; remove union since it is unnecessary.
11368
11369 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11370
11371         * Makefile.am (CCFILES): Add gc.cc.
11372         (HFILES): Add gc.h.
11373         * Makefile.in: Regenerate.
11374         * gold.cc (Gc_runner): New class.
11375         (queue_initial_tasks): Call garbage collection related tasks
11376         when corresponding options are invoked.
11377         (queue_middle_gc_tasks): New function.
11378         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11379         processed early before laying out sections during garbage collection.
11380         * gold.h (queue_middle_gc_tasks): New function.
11381         (is_prefix_of): Move from "layout.cc".
11382         * i386.cc (Target_i386::gc_process_relocs): New function.
11383         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11384         * main.cc (main): Create object of class "Garbage_collection".
11385         * object.cc (Relobj::copy_symbols_data): New function.
11386         (Relobj::is_section_name_included): New function.
11387         (Sized_relobj::do_layout): Allow this function to be called twice
11388         during garbage collection and defer layout of section during the
11389         first call.
11390         * object.h (Relobj::get_symbols_data): New function.
11391         (Relobj::is_section_name_included): New function.
11392         (Relobj::copy_symbols_data): New function.
11393         (Relobj::set_symbols_data): New function.
11394         (Relobj::get_relocs_data): New function.
11395         (Relobj::set_relocs_data): New function.
11396         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11397         (Relobj::gc_process_relocs): New function.
11398         (Relobj::do_gc_process_relocs): New pure virtual function.
11399         (Relobj::sd_): New data member.
11400         (Sized_relobj::is_output_section_offset_invalid): New function.
11401         (Sized_relobj::do_gc_process_relocs): New function.
11402         * options.h (General_options::gc_sections): Modify to not be a no-op.
11403         (General_options::print_gc_sections): New option.
11404         * plugin.cc (Plugin_finish::run): Remove function call to
11405         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11406         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11407         * reloc.cc (Read_relocs::run): Add task to process relocs and
11408         determine unreferenced sections when doing garbage collection.
11409         (Gc_process_relocs): New class.
11410         (Sized_relobj::do_gc_process_relocs): New function.
11411         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11412         sections that are garbage collected.
11413         * reloc.h (Gc_process_relocs): New class.
11414         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11415         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11416         symbols whose corresponding sections are garbage collected.
11417         (Symbol_table::Symbol_table): Add new parameter for the garbage
11418         collection object.
11419         (Symbol_table::gc_mark_undef_symbols): New function.
11420         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11421         (Symbol_table::gc_mark_dyn_syms): New function.
11422         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11423         as garbage.
11424         (Symbol_table::add_from_object): Likewise.
11425         (Symbol_table::add_from_relobj): When building shared objects, do not
11426         treat externally visible symbols as garbage.
11427         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11428         table information for static and relocatable links.
11429         * symtab.h (Symbol_table::set_gc): New function.
11430         (Symbol_table::gc): New function.
11431         (Symbol_table::gc_mark_undef_symbols): New function.
11432         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11433         (Symbol_table::gc_mark_dyn_syms): New function.
11434         (Symbol_table::gc_): New data member.
11435         * target.h (Sized_target::gc_process_relocs): New pure virtual
11436         function.
11437         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11438         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11439
11440 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11441
11442         * options.h (General_options::gc_sections): Define as a no-op for now.
11443         (General_options::no_keep_memory): Ditto.
11444         (General_options::Bshareable): Define.
11445         * options.cc (General_options::finalize): Honor -Bshareable.
11446
11447 2009-01-20  Andreas Schwab  <schwab@suse.de>
11448
11449         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11450         read the value in the contents, since we don't use it.  Use the
11451         template endianness when writing.
11452         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11453
11454 2009-01-19  Andreas Schwab  <schwab@suse.de>
11455
11456         * configure.tgt (powerpc64-*): Fix targ_obj.
11457
11458 2009-01-15  Ian Lance Taylor  <iant@google.com>
11459
11460         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11461         local symbols when stripping all symbols.
11462
11463 2009-01-14  Cary Coutant  <ccoutant@google.com>
11464
11465         * output.cc (Output_reloc): Add explicit instantiations.
11466
11467 2009-01-14  Cary Coutant  <ccoutant@google.com>
11468
11469         * archive.cc (Archive::get_elf_object_for_member): Remove call
11470         to File_read::claim_for_plugin.
11471         * descriptors.cc (Descriptors::open): Remove reference to
11472         is_claimed.
11473         (Descriptors::claim_for_plugin): Remove.
11474         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11475         (Descriptors::is_claimed): Remove.
11476         (claim_descriptor_for_plugin): Remove.
11477         * fileread.cc (File_read::claim_for_plugin): Remove.
11478         * fileread.h (File_read::claim_for_plugin): Remove.
11479         (File_read::descriptor): Reopen descriptor if necessary.
11480         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11481         (Plugin_manager::all_symbols_read): Add task parameter. Change
11482         all callers.
11483         (Plugin_manager::get_input_file): New function.
11484         (Plugin_manager::release_input_file): New function.
11485         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11486         corresponding data member.
11487         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11488         and pass to base constructor. Change all callers.
11489         (get_input_file, release_input_file): New functions.
11490         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11491         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11492         (Plugin_manager::all_symbols_read): Add task parameter.
11493         (Plugin_manager::get_input_file): New function.
11494         (Plugin_manager::release_input_file): New function.
11495         (Plugin_manager::task_): New data member.
11496         (Pluginobj::Pluginobj): Add filesize parameter.
11497         (Pluginobj::filename): New function.
11498         (Pluginobj::descriptor): New function.
11499         (Pluginobj::filesize): New function.
11500         (Pluginobj::filesize_): New data member.
11501         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11502         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11503         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11504
11505         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11506         with archive libraries.
11507         * testsuite/Makefile.in: Regenerate.
11508         * testsuite/plugin_test.c (struct sym_info): New type.
11509         (get_input_file, release_input_file): New static variables.
11510         (onload): Capture new transfer vector entries.
11511         (claim_file_hook): Stop reading at end of file according to filesize.
11512         Factor out parsing of readelf output into separate function.
11513         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11514         APIs and get the source file name from the symbol table.  Convert
11515         source file name to corresponding object file name.  Print info
11516         message when adding new input files.
11517         (parse_readelf_line): New function.
11518         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11519         * testsuite/plugin_test_2.sh: Likewise.
11520         * testsuite/plugin_test_3.sh: Likewise.
11521         * testsuite/plugin_test_4.sh: New test case.
11522
11523 2009-01-07  Ian Lance Taylor  <iant@google.com>
11524
11525         * version.cc (version_string): Bump to 1.8.
11526
11527 2008-12-23  Cary Coutant  <ccoutant@google.com>
11528
11529         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11530         * plugin.cc (Plugin_manager::finish): Rename as
11531         layout_deferred_objects.  Move cleanup to separate function.
11532         (Plugin_manager::cleanup): New function.
11533         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11534         separately.
11535         * plugin.h (Plugin_manager::finish): Rename as
11536         layout_deferred_objects.
11537         (Plugin_manager::cleanup): New function.
11538         (Plugin_manager::cleanup_done): New field.
11539
11540 2008-12-23  Cary Coutant  <ccoutant@google.com>
11541
11542         * plugin.cc (is_visible_from_outside): New function.
11543         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11544         so we don't return "IR only" status for exported symbols or -r links.
11545
11546         * testsuite/Makefile.am (plugin_test_3): New test case.
11547         * testsuite/Makefile.in: Regenerate.
11548         * testsuite/plugin_test_3.sh: New file.
11549
11550 2008-12-22  Cary Coutant  <ccoutant@google.com>
11551
11552         * object.cc (Sized_relobj::layout_section): New function.
11553         (Sized_relobj::do_layout): Defer layout of input sections until after
11554         plugin has provided replacement files.
11555         (Sized_relobj::do_layout_deferred_sections): New function.
11556         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11557         (Relobj::layout_deferred_sections): New function.
11558         (Relobj::do_layout_deferred_sections): New function.
11559         (Sized_relobj::do_layout_deferred_sections): New function.
11560         (Sized_relobj::layout_section): New function.
11561         (Sized_relobj::Deferred_layout): New structure.
11562         (Sized_relobj::deferred_layout_): New field.
11563         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11564         Change all callers.  Layout deferred sections.
11565         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11566         references.
11567         (Plugin_hook::run): Move code from do_plugin_hook inline.
11568         (Plugin_hook::do_plugin_hook): Remove.
11569         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11570         (Plugin_manager::finish): Renamed, was cleanup.
11571         (Plugin_manager::should_defer_layout): New function.
11572         (Plugin_manager::add_deferred_layout_object): New function.
11573         (Plugin_manager::Deferred_layout_list): New type.
11574         (Plugin_manager::deferred_layout_objects_): New field.
11575         (Plugin_hook::do_plugin_hook): Remove.
11576
11577 2008-12-17  Ian Lance Taylor  <iant@google.com>
11578
11579         * options.h (class General_options): Add --no case for
11580         --export-dynamic.
11581
11582 2008-12-16  Cary Coutant  <ccoutant@google.com>
11583
11584         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11585         vector.
11586         (Plugin_manager::claim_file): Create plugin object even if
11587         plugin did not call the add_symbols callback.
11588         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11589         asking for more symbols than were added.
11590         * testsuite/Makefile.am (plugin_test_1): Add test case with
11591         no global symbols.
11592         (empty.syms): New target.
11593         * testsuite/Makefile.in: Regenerate.
11594         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11595         message. Don't call add_symbols if no globals.
11596         (all_symbols_read_hook): Don't provide replacement for empty
11597         claimed file.
11598
11599 2008-12-12  Ian Lance Taylor  <iant@google.com>
11600
11601         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11602         r_type == 0 for a local symbol with r_sym == 0.
11603         (scan_relocatable_relocs): Pass r_sym to
11604         local_non_section_strategy.
11605         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11606         r_sym parameter.
11607
11608         * configure.ac: Update test for TLS descriptors: they are
11609         supported as of glibc 2.9.
11610         * configure: Rebuild.
11611
11612 2008-12-11  Ian Lance Taylor  <iant@google.com>
11613
11614         PR 7091
11615         * target-reloc.h (Default_scan_relocatable_relocs): For each
11616         function, map r_type == 0 to RELOC_DISCARD.
11617
11618 2008-12-10  Cary Coutant  <ccoutant@google.com>
11619
11620         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11621         object to override a kept COMDAT group from a plugin object.
11622
11623 2008-12-09  Ian Lance Taylor  <iant@google.com>
11624
11625         PR 7088
11626         * yyscript.y (file_cmd): Handle INPUT.
11627
11628         * testsuite/initpri1.c: Change all declarations to be full
11629         prototypes by adding void, to avoid compiler warnings.
11630
11631 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11632
11633         * options.cc (General_options::parse_plugin_opt): New.
11634         (General_options::add_plugin): The argument now is just the filename.
11635         (General_options::add_plugin_option): New.
11636         * options.h (plugin_opt): New.
11637         (add_plugin): Change argument name.
11638         (add_plugin_option): New.
11639         * plugin.cc (Plugin::load): Don't parse the plugin option.
11640         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11641         (Plugin::add_option): New.
11642         (Plugin::args_): Change type.
11643         (Plugin::filename_): New.
11644         (Plugin_manager::add_plugin_option): New.
11645         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11646         * testsuite/Makefile.in: Regenerate.
11647
11648 2008-12-05  Cary Coutant  <ccoutant@google.com>
11649
11650         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11651         Handle --strip-lto-sections option.
11652         * options.h (strip_lto_sections): New option.
11653
11654 2008-12-01  Cary Coutant  <ccoutant@google.com>
11655
11656         * plugin.cc (ld_plugin_message): Change format parameter to const.
11657         Fix mismatch between new[] and delete.
11658
11659 2008-11-14  Cary Coutant  <ccoutant@google.com>
11660
11661         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11662         instead of -1U.
11663
11664 2008-11-05  Craig Silverstein  <csilvers@google.com>
11665
11666         * options.cc (General_options::parse_dynamic_list): New function.
11667         * options.h (General_options): New flags dynamic_list,
11668         dynamic_list_data, dynamic_list_cpp_new, and
11669         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11670         (General_options::in_dynamic_list): New function.
11671         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11672         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11673         (Lex::can_continue_name): Likewise.
11674         (yylex): Likewise.
11675         (read_script_file): New parameter script_options.
11676         (read_dynamic_list): New function.
11677         (Script_options::define_dynamic_list): New function.
11678         (dynamic_list_keyword_parsecodes): New variable.
11679         (dynamic_list_keywords): New variable.
11680         * script.h (Script_options::define_dynamic_list): New function
11681         prototype.
11682         (read_dynamic_list): New function prototype.
11683         * symtab.cc (strprefix): New macro.
11684         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11685         dynamic_list_data, dynamic_list_cpp_new, and
11686         dynamic_list_cpp_typeinfo.
11687         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11688         (dynamic_list_expr): New rule.
11689         (dynamic_list_nodes): Likewise.
11690         (dynamic_list_node): Likewise.
11691         * testsuite/Makefile.am (dynamic_list): New test.
11692         * testsuite/Makefile.in: Regenerated.
11693         * testsuite/dynamic_list.t: New file.
11694         * testsuite/dynamic_list.sh: New file.
11695
11696 2008-11-05  Craig Silverstein  <csilvers@google.com>
11697
11698         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11699         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11700         (t11_last): Likewise.
11701         * testsuite/ver_test_6.c (main): Likewise.
11702
11703 2008-10-07  Cary Coutant  <ccoutant@google.com>
11704
11705         * options.c (General_options::finalize): Add check for -static and
11706         -shared.
11707         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11708         is not empty.
11709
11710 2008-10-02  Cary Coutant  <ccoutant@google.com>
11711
11712         * plugin.cc (make_sized_plugin_object): Fix conditional
11713         compilation to work when not all targets are enabled.
11714
11715 2008-09-29  Cary Coutant  <ccoutant@google.com>
11716
11717         * archive.cc (Archive::get_file_and_offset): Use filename instead
11718         of name to get library path.
11719         (Archive::include_member): Unlock external member of a thin archive.
11720
11721         * testsuite/Makefile.am (TEST_AR): New variable.
11722         (thin_archive_test_1): New test.
11723         (thin_archive_test_2): New test.
11724         * testsuite/Makefile.in: Regenerate.
11725         * testsuite/thin_archive_main.cc: New file.
11726         * testsuite/thin_archive_test_1.cc: New file.
11727         * testsuite/thin_archive_test_2.cc: New file.
11728         * testsuite/thin_archive_test_3.cc: New file.
11729         * testsuite/thin_archive_test_4.cc: New file.
11730
11731 2008-09-29  Cary Coutant  <ccoutant@google.com>
11732
11733         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11734         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11735         instead of -1U.
11736         (Sized_relobj::do_finalize_local_symbols): Likewise.
11737         (Sized_relobj::map_to_kept_section): Likewise.
11738         * object.h (Sized_relobj::invalid_address): New constant.
11739         (Sized_relobj::do_output_section_offset): Check for invalid_address
11740         and return -1ULL.
11741         * output.cc (Output_reloc::local_section_offset): Use constant
11742         invalid_address instead of -1U.
11743         (Output_reloc::get_address): Likewise.
11744         (Output_section::output_address): Change -1U to -1ULL.
11745         * output.h (Output_reloc::invalid_address): New constant.
11746         * reloc.cc (Sized_relobj::write_sections): Use constant
11747         invalid_address instead of -1U.
11748         (Sized_relobj::relocate_sections): Likewise.
11749         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11750         values for merge sections.
11751         * target-reloc.h (relocate_for_relocatable): Use constant
11752         invalid_address instead of -1U.
11753
11754 2008-09-19  Cary Coutant  <ccoutant@google.com>
11755
11756         Add plugin functionality for link-time optimization (LTO).
11757         * configure.ac (plugins): Add --enable-plugins option.
11758         * configure: Regenerate.
11759         * config.in: Regenerate.
11760         * Makefile.am (LIBDL): New variable.
11761         (CCFILES): Add plugin.cc.
11762         (HFILES): Add plugin.h.
11763         (ldadd_var): Add LIBDL.
11764         * Makefile.in: Regenerate.
11765
11766         * archive.cc: Include "plugin.h".
11767         (Archive::setup): Don't preread archive symbols when using a plugin.
11768         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11769         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11770         files.
11771         (Archive::include_member): Add symbols from plugin objects.
11772         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11773         * descriptors.cc (Descriptors::open): Check for file descriptors
11774         abandoned by plugins.
11775         (Descriptors::claim_for_plugin): New function.
11776         * descriptors.h (Descriptors::claim_for_plugin): New function.
11777         (Open_descriptor::is_claimed): New field.
11778         (claim_descriptor_for_plugin): New function.
11779         * fileread.cc (File_read::claim_for_plugin): New function.
11780         * fileread.h (File_read::claim_for_plugin): New function.
11781         (File_read::descriptor): New function.
11782         * gold.cc: Include "plugin.h".
11783         (queue_initial_tasks): Add task to call plugin hooks for generating
11784         new object files.
11785         * main.cc: Include "plugin.h".
11786         (main): Load plugin libraries.
11787         * object.h (Pluginobj): Declare.
11788         (Object::pluginobj): New function.
11789         (Object::do_pluginobj): New function.
11790         (Object::set_target): New function.
11791         * options.cc: Include "plugin.h".
11792         (General_options::parse_plugin): New function.
11793         (General_options::General_options): Initialize plugins_ field.
11794         (General_options::add_plugin): New function.
11795         * options.h (Plugin_manager): Declare.
11796         (General_options): Add --plugin option.
11797         (General_options::has_plugins): New function.
11798         (General_options::plugins): New function.
11799         (General_options::add_plugin): New function.
11800         (General_options::plugins_): New field.
11801         * plugin.cc: New file.
11802         * plugin.h: New file.
11803         * readsyms.cc: Include "plugin.h".
11804         (Read_symbols::do_read_symbols): Check for archive before checking
11805         for ELF file.  Call plugin hooks to claim files.
11806         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11807         from a real object file; force override when processing replacement
11808         files.
11809         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11810         (Symbol::init_base_object): Likewise.
11811         (Symbol::init_base_output_data): Likewise.
11812         (Symbol::init_base_output_segment): Likewise.
11813         (Symbol::init_base_constant): Likewise.
11814         (Symbol::init_base_undefined): Likewise.
11815         (Symbol::output_section): Assert that object is not a plugin.
11816         (Symbol_table::add_from_pluginobj): New function.
11817         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11818         undefined.
11819         (Symbol_table::sized_write_globals): Likewise.
11820         (Symbol_table::add_from_pluginobj): Instantiate template.
11821         * symtab.h (Sized_pluginobj): Declare.
11822         (Symbol::in_real_elf): New function.
11823         (Symbol::set_in_real_elf): New function.
11824         (Symbol::in_real_elf_): New field.
11825         (Symbol_table::add_from_pluginobj): New function.
11826
11827         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11828         (LIBDL): New variable.
11829         (LDADD): Add LIBDL.
11830         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11831         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11832         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11833         (MOSTLYCLEANFILES): Likewise.
11834         * testsuite/Makefile.in: Regenerate.
11835         * testsuite/plugin_test.c: New file.
11836         * testsuite/plugin_test_1.sh: New file.
11837         * testsuite/plugin_test_2.sh: New file.
11838
11839 2008-09-16  Ian Lance Taylor  <iant@google.com>
11840
11841         * target-reloc.h (relocate_section): Check whether a symbol is
11842         defined by the ABI before reporting an undefined symbol error.
11843         * target.h (Target::is_defined_by_abi): Make parameter const.
11844         (Target::do_is_defined_by_abi): Likewise.
11845         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11846         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11847         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11848         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11849         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11850         * testsuite/Makefile.in: Rebuild.
11851
11852         * fileread.cc (make_view): Add casts to avoid warning.
11853
11854 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11855
11856         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11857         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11858
11859 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11860
11861         * options.h (General_options::output_is_executable): New.
11862         (General_options::output_is_pie): New.
11863         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11864         for shared libraries.
11865         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11866
11867 2008-09-11  Chris Demetriou  <cgd@google.com>
11868
11869         * options.h (origin): New -z option.
11870         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11871         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11872         in DT_FLAGS_1.
11873
11874 2008-09-05  Cary Coutant  <ccoutant@google.com>
11875
11876         * fileread.cc (File_read::make_view): Add check for attempt to map
11877         beyond end of file.
11878
11879 2008-09-05  Cary Coutant  <ccoutant@google.com>
11880
11881         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11882         explicit instantiations.
11883
11884 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11885
11886         PR gold/6858
11887         * options.cc (General_options::finalize): Allow undefined symbols
11888         in shlibs if linking -shared.
11889
11890         PR gold/6859
11891         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11892         symbols as not needing a dynsym entry.
11893
11894 2008-08-20  Craig Silverstein  <csilvers@google.com>
11895
11896         * fileread.cc (File_read::open): Do not lock the file unless it
11897         was successfully opened.
11898
11899 2008-08-14  Cary Coutant  <ccoutant@google.com>
11900
11901         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11902         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11903         * testsuite/tls_test.cc (struct int128): 128-bit struct
11904         for testing TLS relocs with non-zero addend.
11905         (v12): New TLS variable.
11906         (t12): New test.
11907         (t_last): Add check for v12.
11908         * testsuite/tls_test.h (t12): New function.
11909         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11910
11911 2008-08-13  Ian Lance Taylor  <iant@google.com>
11912
11913         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11914         set tls_segment_ or relro_segment_.
11915         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11916         when appropriate.
11917         * output.h (Output_section::clear_is_relro): New function.
11918         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11919         sections specially even when output_data_ is empty.
11920         (Output_segment::maximum_alignment): When first section is relro,
11921         only force alignment for PT_LOAD segments.
11922         * script.cc (script_data_segment_align): New function.
11923         (script_data_segment_relro_end): New function.
11924         * script-c.h (script_data_segment_align): Declare.
11925         (script_data_segment_relro_end): Declare.
11926         * script-sections.h (class Script_sections): Declare
11927         data_segment_align and data_segment_relro_end.  Add fields
11928         segment_align_index_ and saw_relro_end_.
11929         * script-sections.cc (class Sections_element): Add set_is_relro
11930         virtual function.  Add new bool* parameter to place_orphan_here.
11931         Add get_output_section virtual function.
11932         (class Output_section_definition): Add set_is_relro.  Add new
11933         bool* parameter to place_orphan_here.  Add get_output_section.
11934         Add is_relro_ field.
11935         (Output_section_definition::Output_section_definition): Initialize
11936         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11937         and is_relro_ fields.
11938         (Output_section_definition::place_orphan_here): Add is_relro
11939         parameter.
11940         (Output_section_definition::set_section_addresses): Set relro for
11941         output section.
11942         (Output_section_definition::alternate_constraint): Likewise.
11943         (class Orphan_output_section): Add new bool* parameter to
11944         place_orphan_here.  Add get_output_section.
11945         (Orphan_output_section::place_orphan_here): Add is_relro
11946         parameter.
11947         (Script_sections::Script_sections): Initialize
11948         data_segment_align_index_ and saw_relro_end_.
11949         (Script_sections::data_segment_align): New function.
11950         (Script_sections::data_segment_relro_end): New function.
11951         (Script_sections::place_orphan): Set or clear is_relro.
11952         (Script_sections::set_section_addresses): Force alignment of first
11953         TLS section.
11954         * yyscript.y (exp): Call script_data_segment_align and
11955         script_data_segment_relro_end.
11956         * testsuite/relro_script_test.t: New file.
11957         * testsuite/relro_test.cc (using_script): Declare.
11958         (t1, t2): Test using_script.
11959         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11960         (relro_script_test_SOURCES): Define.
11961         (relro_script_test_DEPENDENCIES): Define.
11962         (relro_script_test_LDFLAGS): Define.
11963         (relro_script_test_LDADD): Define.
11964         (relro_script_test.so): New target.
11965         * testsuite/Makefile.in: Rebuild.
11966
11967 2008-08-06  Cary Coutant <ccoutant@google.com>
11968
11969         * archive.cc (Archive::total_archives, Archive::total_members)
11970         (Archive::total_members_loaded): New variables.
11971         (Archive::setup): Add parameter.  Add option to preread
11972         archive symbols.
11973         (Archive::read_armap): Add counter.
11974         (Archive::get_file_and_offset): New function.
11975         (Archive::get_elf_object_for_member): New function.
11976         (Archive::read_all_symbols): New function.
11977         (Archive::read_symbols): New function.
11978         (Archive::add_symbols): Add counters.
11979         (Archive::include_all_members): Use armap to find members if it's
11980         already built.
11981         (Archive::include_member): Skip reading symbols if already read.
11982         Factored code into Archive::get_file_and_offset and
11983         Archive::get_elf_object_for_member.  Changed call to
11984         Mapfile::report_include_archive_member.
11985         (Archive::print_stats): New function.
11986         * archive.h: Declare Object and Read_symbols_data classes.
11987         (Archive::Archive): Add initializers for new members.
11988         (Archive::setup): Add parameter.
11989         (Archive::print_stats): New function.
11990         (Archive::total_archives, Archive::total_members)
11991         (Archive::total_members_loaded): New variables.
11992         (Archive::get_file_and_offset): New function.
11993         (Archive::get_elf_object_for_member): New function.
11994         (Archive::read_all_symbols): New function.
11995         (Archive::read_symbols): New function.
11996         (Archive::Archive_member): New class.
11997         (Archive::members_): New member.
11998         (Archive::num_members_): New member.
11999         * main.cc: Include archive.h.
12000         (main): Call Archive::print_stats.
12001         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12002         archive parameter; member_name is now the fully-decorated name.
12003         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12004         * options.h: (General_options): Add --preread-archive-symbols option.
12005         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12006         Archive::setup.
12007
12008 2008-08-04  Ian Lance Taylor  <iant@google.com>
12009
12010         * symtab.h (Symbol::use_plt_offset): New function.
12011         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12012         * powerpc.cc (Relocate::relocate): Likewise.
12013         * sparc.cc (Relocate::relocate): Likewise.
12014         * x86_64.cc (Relocate::relocate): Likewise.
12015         * testsuite/weak_plt.sh: New test.
12016         * testsuite/weak_plt_main.cc: New test.
12017         * testsuite/weak_plt_shared.cc: New test.
12018         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12019         (check_PROGRAMS): Add weak_plt.
12020         (check_DATA): Add weak_plt_shared.so.
12021         (weak_plt_main_pic.o, weak_plt): New targets.
12022         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12023         * testsuite/Makefile.in: Rebuild.
12024
12025         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12026         gcctestdir/ld.
12027         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12028         * testsuite/Makefile.in: Rebuild.
12029
12030 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12031
12032         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12033         * Makefile.in: Regenerate.
12034         * po/POTFILES.in: Regenerate.
12035
12036 2008-07-29  Ian Lance Taylor  <iant@google.com>
12037
12038         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12039         symbols before other symbols.
12040         * testsuite/script_test_2.cc (test_addr): Declare.
12041         (test_addr_alias): Declare.
12042         (main): Check that test_addr and test_addr_alias have the right
12043         values.
12044         * testsuite/script_test_2.t: Define test_addr_alias and
12045         test_addr.
12046
12047 2008-07-24  Ian Lance Taylor  <iant@google.com>
12048
12049         PR 5990
12050         * descriptors.cc: New file.
12051         * descriptors.h: New file.
12052         * gold-threads.h (class Hold_optional_lock): New class.
12053         * fileread.cc: Include "descriptors.h".
12054         (File_read::~File_read): Release descriptor rather than closing
12055         it.
12056         (File_read::open) [file]: Call open_descriptor rather than open.
12057         Set is_descriptor_opened_.
12058         (File_read::open) [memory]: Assert that descriptor is not open.
12059         (File_read::reopen_descriptor): New function.
12060         (File_read::release): Release descriptor.
12061         (File_read::do_read): Make non-const.  Reopen descriptor.
12062         (File_read::read): Make non-const.
12063         (File_read::make_view): Reopen descriptor.
12064         (File_read::do_readv): Likewise.
12065         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12066         Update declarations.
12067         * layout.cc: Include "descriptors.h".
12068         (Layout::create_build_id): Use open_descriptor rather than open.
12069         * output.cc: Include "descriptors.h".
12070         (Output_file::open): Use open_descriptor rather than open.
12071         * archive.cc (Archive::const_iterator): Change Archive to be
12072         non-const.
12073         (Archive::begin, Archive::end): Make non-const.
12074         (Archive::count_members): Likewise.
12075         * archive.h (class Archive): Update declarations.
12076         * object.h (Object::read): Make non-const.
12077         * Makefile.am (CCFILES): Add descriptors.cc.
12078         (HFILES): Add descriptors.h.
12079         * Makefile.in: Rebuild.
12080
12081         PR 6716
12082         * gold.h: Always include <clocale>.  Add Solaris workarounds
12083         following code in binutils/sysdep.h.
12084
12085         PR 6048
12086         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12087         this->eh_frame_hdr_ is NULL before using it.
12088
12089         * dynobj.cc (Versions::Versions): Update comment.
12090
12091         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12092         the base version name.
12093
12094         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12095         array size plus one.
12096         (Stringpool_template::set_string_offsets): Subtract one from key
12097         before using it as an array index.
12098         (Stringpool_template::get_offset_with_length): Likewise.
12099         (Stringpool_template::write_to_buffer): Likewise.
12100         * stringpool.h (Stringpool_template::get_offset_from_key):
12101         Likewise.
12102
12103 2008-07-23  Ian Lance Taylor  <iant@google.com>
12104
12105         PR 6658
12106         * object.h (Merged_symbol_value::value): Do our best to handle a
12107         negative addend.
12108
12109         PR 6647
12110         * script.cc (Version_script_info::get_versions): Don't add empty
12111         version tag to return value.
12112         (Version_script_info::get_symbol_version_helper): Change return
12113         type to bool.  Add pversion parameter.  Change all callers.
12114         (script_register_vers_node): Don't require a non-NULL tag.
12115         * script.h (class Version_script_info): Update declarations.
12116         (Version_script_info::get_symbol_version): Change return type to
12117         bool.  Add version parameter.  Change all callers.
12118         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12119         handling.  Handle an empty version from a version script.
12120         (Symbol_table::define_special_symbol): Likewise.
12121         * testsuite/ver_test_10.script: New file.
12122         * testsuite/ver_test_10.sh: New file.
12123         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12124         (check_DATA): Add ver_test_10.syms.
12125         (ver_test_10.syms, ver_test_10.so): New target.
12126         * testsuite/Makefile.in: Rebuild.
12127
12128 2008-07-23  Simon Baldwin  <simonb@google.com>
12129
12130         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12131         to zero for undefined symbols from dynamic libraries.
12132
12133 2008-07-23  Ian Lance Taylor  <iant@google.com>
12134
12135         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12136         Change all callers.
12137         * symtab.h (class Symbol_table): Update declaration.
12138         * testsuite/ver_test_9.cc: New file.
12139         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12140         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12141         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12142         (ver_test_9.so, ver_test_9.o): New targets.
12143         * testsuite/Makefile.in: Rebuild.
12144
12145 2008-07-22  Ian Lance Taylor  <iant@google.com>
12146
12147         * options.h (class General_options): Define --check-sections.
12148         * layout.cc (Layout::set_segment_offsets): Handle
12149         --check-sections.
12150
12151         * options.h (class General_options): Define -n/--nmagic and
12152         -N/--omagic.
12153         * options.cc (General_options::finalize): For -n/--nmagic or
12154         -N/--omagic, set -static.
12155         * layout.cc (Layout::attach_allocated_section_to_segment): If
12156         -N/--omagic, don't put read-only and read-write sections in
12157         different segments.
12158         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12159         finding a read-only segment.
12160         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12161         don't set the minimum segment alignment to the common page size,
12162         and don't set the file offset to the address modulo the page size.
12163         * script-sections.cc (Script_sections::create_segments): If
12164         -n/--omagic, don't put read-only and read-write sections in
12165         different segments.
12166
12167         * cref.cc: New file.
12168         * cref.h: New file.
12169         * options.h (class General_options): Add --print-symbol-counts.
12170         * main.cc (main): Issue defined symbol report if requested.
12171         * archive.cc (Archive::interpret_header): Make into a const member
12172         function.
12173         (Archive::add_symbols): Call Input_objects::archive_start and
12174         archive_stop.
12175         (Archive::const_iterator): Define new class.
12176         (Archive::begin, Archive::end): New functions.
12177         (Archive::include_all_members): Rewrite to use iterator.
12178         (Archive::count_members): New function.
12179         * archive.h (class Archive): Update declarations.
12180         (Archive::filename): New function.
12181         * object.cc: Include "cref.h".
12182         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12183         (Sized_relobj::do_get_global_symbol_counts): New function.
12184         (Input_objects::add_object): Add object to cross-referencer.
12185         (Input_objects::archive_start): New function.
12186         (Input_objects::archive_stop): New function.
12187         (Input_objects::print_symbol_counts): New function.
12188         * object.h: Declare Cref and Archive.
12189         (Object::get_global_symbol_counts): New function.
12190         (Object::do_get_global_symbol_counts): New pure virtual function.
12191         (class Sized_relobj): Add defined_count_ field.  Update
12192         declarations.
12193         (class Input_objects): Add cref_ field.  Update constructor.
12194         Update declarations.
12195         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12196         defined_count_.
12197         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12198         symbol counts.
12199         (Sized_dynobj::do_get_global_symbol_counts): New function.
12200         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12201         defined_count_.  Update declarations.  Define Symbols typedef.
12202         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12203         parameter.  Change all callers.
12204         (Symbol_table::add_from_dynobj): Add sympointers and defined
12205         parameters.  Change all callers.
12206         * symtab.h (class Symbol_table): Update declarations.
12207         * Makefile.am (CCFILES): Add cref.cc.
12208         (HFILES): Add cref.h.
12209         * Makefile.in: Rebuild.
12210
12211 2008-07-22  Simon Baldwin  <simonb@google.com>
12212
12213         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12214         to zero when writing undefined symbols.
12215
12216 2008-07-22  Ian Lance Taylor  <iant@google.com>
12217
12218         * output.cc (Output_section::add_input_section): Don't try to
12219         merge empty merge sections.
12220
12221 2008-07-21  Craig Silverstein  <csilvers@google.com>
12222
12223         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12224         Include symbol version in error message.
12225
12226 2008-07-20  Chris Demetriou  <cgd@google.com>
12227
12228         * configure.ac (gold_cv_c_random_seed): New configured variable.
12229         (RANDOM_SEED_CFLAGS): New substituted variable.
12230         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12231         * configure: Rebuild.
12232         * Makefile.in: Likewise.
12233         * testsuite/Makefile.in: Likewise.
12234
12235 2008-07-18  Ian Lance Taylor  <iant@google.com>
12236
12237         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12238         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12239         * testsuite/ver_test_main.cc (main): Call t4.
12240         (t4, t4_2a): Define.
12241         * testsuite/ver_test_2.cc (t4_2): Define.
12242         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12243         * testsuite/ver_test_4.cc (t4_2a): Define.
12244         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12245         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12246
12247 2008-07-17  Ian Lance Taylor  <iant@google.com>
12248
12249         * dynobj.cc (Versions::add_def): If we give an error about a
12250         missing version, go ahead and create the version anyhow.
12251
12252 2008-07-10  Ian Lance Taylor  <iant@google.com>
12253
12254         Handle output sections with more than 0x7fffffff bytes.
12255         * object.h (class Relobj): Change map_to_output_ to
12256         output_sections_, and just keep a section pointer.  Change all
12257         uses.  Move comdat group support to Sized_relobj.
12258         (Relobj::is_section_specially_mapped): Remove.
12259         (Relobj::output_section): Remove poff parameter.  Change all
12260         callers.
12261         (Relobj::output_section_offset): New function.
12262         (Relobj::set_section_offset): Rewrite.
12263         (Relobj::map_to_output): Remove.
12264         (Relobj::output_sections): New function.
12265         (Relobj::do_output_section_offset): New pure virtual function.
12266         (Relobj::do_set_section_offset): Likewise.
12267         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12268         group support from Relobj.  Update declarations.
12269         (Sized_relobj::get_output_section_offset): New function.
12270         (Sized_relobj::do_output_section_offset): New function.
12271         (Sized_relobj::do_set_section_offset): New function.
12272         * object.cc (Relobj::output_section_address): Remove.
12273         (Sized_relobj::Sized_relobj): Initialize new fields.
12274         (Sized_relobj::include_section_group): Cast find_kept_object to
12275         Sized_relobj.
12276         (Sized_relobj::include_linkonce_section): Likewise.
12277         (Sized_relobj::do_layout): Use separate arrays for output section
12278         and output offset.
12279         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12280         output_sections.
12281         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12282         output_sections and section_offsets.
12283         (Sized_relobj::write_local_symbols): Likewise.
12284         (map_to_kept_section): Compute output address directly.
12285         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12286         output_sections and section_offsets.
12287         (Sized_relobj::write_sections): Likewise.
12288         (Sized_relobj::relocate_sections): Likewise.
12289         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12290         * output.h (class Output_reloc): Update declarations.  Change
12291         u2_.relobj to Sized_relobj*.
12292         (class Output_data_reloc): Change add functions to use
12293         Sized_relobj*.
12294         * output.cc (Output_reloc::Output_reloc): Change relobj to
12295         Sized_relobj*.
12296         (Output_reloc::local_section_offset): Change return type to
12297         Elf_Addr.  Use get_output_section_offset.
12298         (Output_reloc::get_address): Likewise.
12299         (Output_section::is_input_address_mapped): Don't call
12300         is_section_specially_mapped.
12301         (Output_section::output_offset): Likewise.
12302         (Output_section::output_address): Likewise.
12303         (Output_section::starting_output_address): Likewise.
12304         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12305         parameter to Sized_relobj*.
12306         (Copy_relocs::need_copy_reloc): Likewise.
12307         (Copy_relocs::save): Likewise.
12308         * copy-relocs.h (class Copy_relocs): Update declarations.
12309         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12310         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12311         * target-reloc.h (relocate_for_relocatable): Change
12312         offset_in_output_section type to Elf_Addr.  Change code that uses
12313         it as well.
12314         * layout.cc (Layout::layout): Always set *off.
12315         * mapfile.cc (Mapfile::print_input_section): Use
12316         output_section_offset.
12317         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12318         Sized_relobj*.
12319         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12320         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12321         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12322
12323 2008-07-03  Ian Lance Taylor  <iant@google.com>
12324
12325         * layout.cc (Layout::include_section): Do not discard unrecognized
12326         SHT_STRTAB sections.
12327
12328 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12329
12330         * script.cc (Lex::can_continue_name): Make '?' allowable in
12331         version-script names.
12332         * testsuite/version_script.map: Change glob pattern to use '?'
12333
12334 2008-06-30  Manish Singh  <yosh@gimp.org>
12335
12336         PR 6585
12337         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12338         Correct typo.
12339
12340 2008-06-30  Ian Lance Taylor  <iant@google.com>
12341
12342         PR 6660
12343         PR 6682
12344         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12345         versions]: Don't try to read the value in the contents, since we
12346         don't use it.  Use the template endianness when writing.
12347
12348 2008-06-25  Cary Coutant  <ccoutant@google.com>
12349
12350         * fileread.cc (File_read::make_view): Assert on zero-length view.
12351         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12352         symbol table when there are no symbols to read.
12353
12354 2008-06-23  Craig Silverstein  <csilvers@google.com>
12355
12356         * version.cc (version_string): Bump to 1.7
12357
12358 2008-06-18  Craig Silverstein  <csilvers@google.com>
12359
12360         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12361         constant 0xFFFF to type Valtype.
12362         (Powerpc_relocate_functions::rel16_ha): Likewise.
12363
12364 2008-06-17  Ian Lance Taylor  <iant@google.com>
12365
12366         * output.h (Output_section::Input_section): Initialize p2align_ to
12367         zero for Output_section_data constructors.
12368         (Output_section::Input_section::addralign): If not an input
12369         section, return the alignment of the Output_section_data.
12370         * testsuite/copy_test.cc: New file.
12371         * testsuite/copy_test_1.cc: New file.
12372         * testsuite/copy_test_2.cc: New file.
12373         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12374         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12375         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12376         (copy_test_1_pic.o, copy_test_1.so): New targets.
12377         (copy_test_2_pic.o, copy_test_2.so): New targets.
12378         * testsuite/Makefile.in: Rebuild.
12379
12380         * script-sections.cc (Script_sections::place_orphan): Initialize
12381         local variable exact.
12382
12383 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12384
12385         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12386
12387 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12388             David S. Miller  <davem@davemloft.net>
12389
12390         * powerpc.cc: New file.
12391         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12392         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12393         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12394         * Makefile.in: Rebuild.
12395
12396 2008-06-09  Ian Lance Taylor  <iant@google.com>
12397
12398         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12399         <exception>.
12400         (throwing, orig_terminate): New static variables.
12401         (terminate_handler): New static function.
12402         (t2): Set terminate handler.
12403
12404 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12405
12406         PR 6584
12407         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12408         alignment.
12409
12410 2008-05-30  Cary Coutant  <ccoutant@google.com>
12411
12412         * archive.cc (Archive::include_all_members) Correct to step
12413         over symbol table and extended name table in thin archives.
12414
12415 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12416
12417         PR 6407
12418         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12419         calculation.
12420
12421 2008-05-28  Caleb Howe  <cshowe@google.com>
12422
12423         * reduced_debug_output.cc: New file.
12424         * reduced_debug_output.h: New file.
12425         * options.h (class General_options): Add --strip-debug-non-line.
12426         * options.cc (General_options::finalize): Add strip_debug_non_line
12427         to the strip heirarchy.
12428         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12429         fields.
12430         * layout.cc: Include "reduced_debug_output.h".
12431         (Layout::Layout): Initialize new fields.
12432         (line_only_debug_sections): New static array.
12433         (is_lines_only_debug_sections): New static inline function.
12434         (Layout::include_section): Handle --strip-debug-non-line.
12435         (Layout::make_output_section): If --strip-debug-non-line, build
12436         new output sections for .debug_abbrev and .debug_info.
12437         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12438         gold.  Warn about possible overflow.
12439         (read_signed_LEB_128): Likewise.
12440         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12441         (read_signed_LEB_128): Declare.
12442         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12443         (HFILES): Add reduced_debug_output.h.
12444         * Makefile.in: Rebuild.
12445
12446 2008-05-21  Ian Lance Taylor  <iant@google.com>
12447
12448         * mapfile.cc: New file.
12449         * mapfile.h: New file.
12450         * options.h (class General_options): Add -M/--print-map and -Map.
12451         * options.cc (General_options::finalize): Make -M equivalent to
12452         -Map -.
12453         * main.cc: Include <cstdio> and "mapfile.h".
12454         (main): Open mapfile if requested.
12455         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12456         constructor.  Change caller.
12457         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12458         (queue_middle_tasks): Likewise.
12459         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12460         declarations.
12461         * archive.cc: Include "mapfile.h".
12462         (Archive::add_symbols): Add mapfile parameter.  Change all
12463         callers.  Pass mapfile, symbol, and reason to include_member.
12464         (Archive::include_all_members): Add mapfile parameter.  Change all
12465         callers.
12466         (Archive::include_member): Add mapfile, sym, and why parameters.
12467         Change all callers.  Report inclusion to map file.
12468         * archive.h: Include "fileread.h".
12469         (class Archive): Update declarations.
12470         (Archive::file): New const method.
12471         (class Add_archive_symbols): Add mapfile_ field.  Update
12472         constructor.  Change all callers.
12473         * readsyms.h (class Read_symbols): Likewise.
12474         (class Finish_group): Likewise.
12475         (class Read_script): Likewise.
12476         * common.cc: Include "mapfile.h".
12477         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12478         all callers.
12479         (Symbol_table::do_allocate_commons): Likewise.
12480         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12481         symbol allocation to mapfile.
12482         * common.h (class Allocate_commons_task): Add mapfile_ field.
12483         Update constructor.  Change all callers.
12484         * symtab.h (class Symbol_table): Update declarations.
12485         * layout.cc: Include "mapfile.h".
12486         (Layout_task_runner::run): Print information to mapfile.
12487         (Layout::create_gold_note): Change Output_data_fixed_space to
12488         Output_data_zero_fill.
12489         (Layout::create_build_id): Likewise.
12490         (Layout::print_to_mapfile): New function.
12491         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12492         constructor.  Change caller.
12493         (class Layout): Declare print_to_mapfile.
12494         * output.cc (Output_section::Input_section::print_to_mapfile): New
12495         function.
12496         (Output_section::add_input_section): If producing a map, always
12497         add to input_sections_ list.
12498         (Output_section::do_print_to_mapfile): New function.
12499         (Output_segment::print_sections_to_mapfile): New function.
12500         (Output_segment::print_section_list_to_mapfile): New function.
12501         * output.h: Include "mapfile.h".
12502         (Output_data::print_to_mapfile): New function.
12503         (Output_data::do_print_to_mapfile): New virtual function.
12504         (Output_segment_headers::do_print_to_mapfile): New function.
12505         (Output_file_header::do_print_to_mapfile): New function.
12506         (Output_data_const::do_print_to_mapfile): New function.
12507         (class Output_data_const_buffer): Add map_name_ field.  Update
12508         constructor.  Change all callers.  Add do_print_to_mapfile
12509         function.
12510         (class Output_data_fixed_space): Likewise.
12511         (class Output_data_space): Likewise.
12512         (class Output_data_zero_fill): New class.
12513         (Output_data_strtab::do_print_to_mapfile): New function.
12514         (Output_data_reloc_base::do_print_to_mapfile): New function.
12515         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12516         (Output_data_group::do_print_to_mapfile): New function.
12517         (Output_data_got::do_print_to_mapfile): New function.
12518         (Output_data_dynamic::do_print_to_mapfile): New function.
12519         (Output_symtab_xindex::do_print_to_mapfile): New function.
12520         (class Output_section): Declare do_print_to_mapflie.  Declare
12521         print_to_mapfile in Input_section.
12522         (class Output_segment): Declare new functions.
12523         * object.h (Sized_relobj::symbol_count): New function.
12524         * script-sections.cc
12525         (Output_section_element_dot_assignment::set_section_addresses):
12526         Change Output_data_fixed_space to Output_data_zero_fill.
12527         (Output_data_expression::do_print_to_mapfile): New function.
12528         * script.cc (read_input_script): Add mapfile parameter.  Change
12529         all callers.
12530         * script.h (read_input_script): Update declaration.
12531         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12532         (Eh_frame::do_print_to_mapfile): New function.
12533         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12534         (Output_merge_string::do_print_to_mapfile): New function.
12535         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12536         function.
12537         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12538         function.
12539         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12540         function.
12541         * Makefile.am (CCFILES): Add mapfile.cc.
12542         (HFILES): Add mapfile.h.
12543         * Makefile.in: Rebuild.
12544
12545 2008-05-19  Ian Lance Taylor  <iant@google.com>
12546
12547         * options.h (class General_options): Add -z relro.
12548         * layout.cc (Layout::Layout): Initialize relro_segment_.
12549         (Layout::add_output_section_data): Return the output section.
12550         (Layout::make_output_section): Rcognize relro sections and mark
12551         them appropriately.
12552         (Layout::attach_allocated_section_to_segment): Put relro sections
12553         in a PT_GNU_RELRO segment.
12554         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12555         section as relro.
12556         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12557         PT_TLS segments.
12558         (Layout::linkonce_mapping): Map d.rel.ro.local to
12559         .data.rel.ro.local.
12560         (Layout::output_section_name): Us .data.rel.ro.local for any
12561         section which begins with that.
12562         * layout.h (class Layout): Update add_output_section_data
12563         declaration.  Add relro_segment_ field.
12564         * output.cc (Output_section::Output_section): Initialize is_relro_
12565         and is_relro_local_ fields.
12566         (Output_segment::add_output_section): Group relro sections.
12567         (Output_segment::is_first_section_relro): New function.
12568         (Output_segment::maximum_alignment): If there is a relro section,
12569         align the segment to the common page size.
12570         (Output_segment::set_section_addresses): Track whether we are
12571         looking at relro sections.  If the last section is a relro
12572         section, align to the common page size.
12573         (Output_segment::set_section_list_addresses): Add in_relro
12574         parameter.  Change all callers.  Align to the page size when
12575         moving from relro to non-relro section.
12576         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12577         segment.
12578         * output.h (class Output_section): Add is_relro_ and
12579         is_relro_local_ fields.
12580         (Output_section::is_relro): New function.
12581         (Output_section::set_is_relro): New function.
12582         (Output_section::is_relro_local): New function.
12583         (Output_section::set_is_relro_local): New function.
12584         (class Output_segment): Update declarations.
12585         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12586         * sparc.cc (Target_sparc::got_section): Likewise.
12587         * x86_64.cc (Target_x86_64::got_section): Likewise.
12588         * testsuite/relro_test_main.cc: New file.
12589         * testsuite/relro_test.cc: New file.
12590         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12591         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12592         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12593         (relro_test.so, relro_test_pic.o): New targets.
12594         * testsuite/Makefile.in: Rebuild.
12595
12596 2008-05-16  Ian Lance Taylor  <iant@google.com>
12597
12598         * output.cc (Output_segment::add_output_section): Remove front
12599         parameter.
12600         * output.h (class Output_segment): Remove
12601         add_initial_output_section and overloaded add_output_section.
12602         Update declaration of remaining add_output_section.
12603         * layout.cc (Layout::create_interp): Call add_output_section
12604         rather than add_initial_output_section.
12605         (Layout::finish_dynamic_section): Likewise.
12606
12607         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12608         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12609         know the dynamic type.
12610         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12611         field.  Initialize it in constructor.
12612         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12613         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12614         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12615         reloc.
12616
12617         * output.cc (Output_reloc::get_address): Change return type to
12618         Elf_Addr.
12619         * output.h (class Output_reloc): Update get_address declaration.
12620         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12621         for section addresses.
12622
12623 2008-05-09  Ian Lance Taylor  <iant@google.com>
12624
12625         PR 6493
12626         * gold.cc (gold_nomem): Use return value of write.
12627
12628 2008-05-08  Ian Lance Taylor  <iant@google.com>
12629
12630         * symtab.c (Symbol::init_base_output_data): Add version
12631         parameter.  Change all callers.
12632         (Symbol::init_base_output_segment): Likewise.
12633         (Symbol::init_base_constant): Likewise.
12634         (Symbol::init_base_undefined): Likewise.
12635         (Sized_symbol::init_output_data): Likewise.
12636         (Sized_symbol::init_output_segment): Likewise.
12637         (Sized_symbol::init_constant): Likewise.
12638         (Sized_symbol::init_undefined): Likewise.
12639         (Symbol_table::do_define_in_output_data): If the new symbol has a
12640         version, mark it as the default.
12641         (Symbol_table::do_define_in_output_segment): Likewise.
12642         (Symbol_table::do_define_as_constant): Likewise.
12643         * symtab.h (class Symbol): Update declarations.
12644         (class Sized_symbol): Likewise.
12645         * resolve.cc (Symbol::override_version): New function.
12646         (Symbol::override_base): Call override_version.
12647         (Symbol::override_base_with_special): Likewise.
12648         * testsuite/ver_script_8.script: New file.
12649         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12650         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12651         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12652         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12653
12654 2008-05-06  Ian Lance Taylor  <iant@google.com>
12655
12656         PR 6049
12657         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12658         functions.
12659         (class General_options): Remove existing --undefined, and add
12660         --no-undefined instead.  Add new --undefined as synonym for -u.
12661         * archive.cc (Archive::add_symbols): Check whether symbol was
12662         named with -u.
12663         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12664         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12665         all uses.  Add IS_UNDEFINED.  Update declarations to split
12666         different versions of init_base.  Declare init_base_undefined.
12667         (Symbol::is_defined): Handle IS_UNDEFINED.
12668         (Symbol::is_undefined): Likewise.
12669         (Symbol::is_weak_undefined): Call is_undefined.
12670         (Symbol::is_absolute): Handle IS_CONSTANT.
12671         (class Sized_symbol): Update declarations to split different
12672         versions of init.  Declare init_undefined.
12673         (class Symbol_table): Declare new functions.
12674         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12675         Change all callers.
12676         (Symbol::init_base_output_data): Likewise.
12677         (Symbol::init_base_output_segment): Likewise.
12678         (Symbol::init_base_constant): Likewise.
12679         (Symbol::init_base_undefined): New function.
12680         (Sized_symbol::init_object): Rename from init.  Change all
12681         callers.
12682         (Sized_symbol::init_output_data): Likewise.
12683         (Sized_symbol::init_output_segment): Likewise.
12684         (Sized_symbol::init_constant): Likewise.
12685         (Sized_symbol::init_undefined): New function.
12686         (Symbol_table::add_undefined_symbols_from_command_line): New
12687         function.
12688         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12689         function.
12690         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12691         (Symbol::output_section): Likewise.
12692         (Symbol::set_output_section): Likewise.
12693         (Symbol_table::sized_finalize_symbol): Likewise.
12694         (Symbol_table::sized_write_globals): Likewise.
12695         * resolve.cc (Symbol_table::should_override): Likewise.
12696         (Symbol::override_base_with_special): Likewise.
12697
12698         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12699         symbol, change it to have default visibility.
12700         * testsuite/protected_1.cc: New file.
12701         * testsuite/protected_2.cc: New file.
12702         * testsuite/protected_3.cc: New file.
12703         * testsuite/protected_main_1.cc: New file.
12704         * testsuite/protected_main_2.cc: New file.
12705         * testsuite/protected_main_3.cc: New file.
12706         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12707         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12708         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12709         (protected_1.so): New target.
12710         (protected_1_pic.o, protected_2_pic.o): New targets.
12711         (protected_3_pic.o): New target.
12712         (check_PROGRAMS): Add protected_2.
12713         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12714         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12715         * testsuite/Makefile.in: Rebuild.
12716
12717         * options.h (DEFINE_var): Add set_user_set_##varname__.
12718         (DEFINE_bool_alias): New macro.
12719         (class General_options): Define -Bstatic using DEFINE_bool_alias
12720         rather than DEFINE_special.  Add --undefined as an alias for -z
12721         defs.
12722         * options.cc (General_options::parse_Bstatic): Remove.
12723
12724         * options.h (class General_options): Add --fatal-warnings.
12725         * main.cc (main): Implement --fatal-warnings.
12726         * errors.h (Errors::warning_count): New function.
12727
12728         * options.h (class General_options): Add -Bsymbolic-functions.
12729         * symtab.h (Symbol::is_preemptible): Check for
12730         -Bsymbolic-functions.
12731
12732 2008-05-05  Ian Lance Taylor  <iant@google.com>
12733
12734         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12735         as noVARNAME rather than no-VARNAME.
12736         (class General_options): Add option -z combreloc.
12737         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12738         get_address.
12739         (Output_reloc::sort_before) [SHT_REL]: New function.
12740         (Output_reloc::sort_before) [SHT_RELA]: New function.
12741         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12742         Sort_relocs_comparison.
12743         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12744         parameter.  Change all callers.
12745         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12746         sort_relocs parameter.  Change all callers.
12747         * output.cc (Output_reloc::get_address): New function, broken out
12748         of write_rel.
12749         (Output_reloc::write_rel): Call it.
12750         (Output_reloc::compare): New function.
12751         (Output_data_reloc_base::do_write): Optionally sort relocs.
12752
12753         * configure.ac: If targ_extra_obj is set, link it in.
12754         * configure.tgt: Initialize all variables.
12755         (x86_64*): Set targ_extra_obj and targ_extra_size.
12756         * configure: Rebuild.
12757
12758         * object.cc (Sized_relobj::include_section_group): Adjust section
12759         indexes read from group data.  Build vector to pass to
12760         layout_group.
12761         * layout.cc (Layout::layout_group): Add flags and shndxes
12762         parameters.  Remove contents parameter.  Change caller.  Update
12763         explicit instantiations.
12764         * layout.h (class Layout): Update layout_group declaration.
12765         * output.cc (Output_data_group::Output_data_group): Add flags and
12766         input_shndxes parameters.  Remove contents parameter.  Change
12767         caller.
12768         (Output_data_group::do_write): Change input_sections_ to
12769         input_shndxes_.
12770         * output.h (class Output_data_group): Update constructor
12771         declaration.  Rename input_sections_ to input_shndxes_.
12772         * testsuite/many_sections_test.cc: Add template.
12773
12774 2008-04-30  Cary Coutant  <ccoutant@google.com>
12775
12776         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12777
12778         * layout.cc (Layout::include_section): Refactored check for debug
12779         info section.
12780         (Layout::add_comdat): Add new parameters.  Change type
12781         of signature parameter.  Add object and shndx to signatures table.
12782         (Layout::find_kept_object): New function.
12783         * layout.h: Include <cstring>.
12784         (Layout::is_debug_info_section): New function.
12785         (Layout::add_comdat): Add new parameters.
12786         (Layout::find_kept_object): New function.
12787         (Layout::Kept_section): New struct.
12788         (Layout::Signatures): Change type of map range.
12789         * object.cc (Relobj::output_section_address): New function.
12790         (Sized_relobj::include_section_group): Add new parameters.  Change
12791         calls to Layout::add_comdat.  Change to build table of kept comdat
12792         groups and table mapping discarded sections to kept sections.
12793         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12794         (Sized_relobj::do_layout): Change calls to include_section_group and
12795         include_linkonce_section.
12796         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12797         value to zero when section is discarded.
12798         (Sized_relobj::map_to_kept_section): New function.
12799         * object.h (Relobj::output_section_address): New function.
12800         (Relobj::Comdat_group): New type.
12801         (Relobj::find_comdat_group): New function.
12802         (Relobj::Comdat_group_table): New type.
12803         (Relobj::Kept_comdat_section): New type.
12804         (Relobj::Kept_comdat_section_table): New type.
12805         (Relobj::add_comdat_group): New function.
12806         (Relobj::set_kept_comdat_section): New function.
12807         (Relobj::get_kept_comdat_section): New function.
12808         (Relobj::comdat_groups_): New field.
12809         (Relobj::kept_comdat_sections_): New field.
12810         (Symbol_value::input_value): Update comment.
12811         (Sized_relobj::map_to_kept_section) New function.
12812         (Sized_relobj::include_linkonce_section): Add new parameter.
12813         * target-reloc.h (Comdat_behavior): New type.
12814         (get_comdat_behavior): New function.
12815         (relocate_section): Add code to map a discarded section to the
12816         corresponding kept section when applying a relocation.
12817
12818 2008-04-30  Craig Silverstein  <csilvers@google.com>
12819
12820         * dwarf_reader.cc (next_generation_count): New static var.
12821         (Addr2line_cache_entry): New struct.
12822         (addr2line_cache): New static var.
12823         (Dwarf_line_info::one_addr2line): Added caching.
12824         (Dwarf_line_info::clear_addr2line_cache): New function.
12825         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12826         cache-size parameter.
12827         (Dwarf_line_info::one_addr2line_cache): New function.
12828         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12829         new cache-size argument to one_addr2line(), and clear cache.
12830
12831 2008-04-28  Cary Coutant  <ccoutant@google.com>
12832
12833         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12834         R_386_PC8 relocations.
12835
12836 2008-04-23  Ian Lance Taylor  <iant@google.com>
12837
12838         * object.cc (Sized_relobj::include_section_group): Check for
12839         invalid section group.
12840
12841         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12842         header size.
12843
12844         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12845         than read for file header.
12846         * archive.cc (Archive::include_member): Likewise.
12847
12848 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12849
12850         * aclocal.m4: Regenerate.
12851         * configure: Regenerate.
12852
12853 2008-04-19  Ian Lance Taylor  <iant@google.com>
12854
12855         * version.cc (version_string): Bump to 1.6.
12856
12857         * testsuite/Makefile.am (many_sections_r_test): New target.
12858         (many_sections_r_test_SOURCES): Remove.
12859         (many_sections_r_test_DEPENDENCIES): Remove.
12860         (many_sections_r_test_LDFLAGS): Remove.
12861         (many_sections_r_test_LDADD): Remove.
12862
12863         * object.cc (Sized_relobj::do_add_symbols): Always pass
12864         local_symbol_count_ to add_from_relobj.
12865
12866         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12867         every thousand variables.
12868         * testsuite/Makefile.in: Rebuild.
12869
12870         * object.cc (Xindex::initialize_symtab_xindex): New function.
12871         (Xindex::read_symtab_xindex): New function.
12872         (Xindex::sym_xindex_to_shndx): New function.
12873         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12874         available.
12875         (Sized_relobj::do_initialize_xindex): New function.
12876         (Sized_relobj::do_read_symbols): Adjust section links.
12877         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12878         parameter.  Change all callers.
12879         (Sized_relobj::include_section_group): Adjust section links and
12880         symbol section indexes.
12881         (Sized_relobj::do_layout): Adjust section links.
12882         (Sized_relobj::do_count_local_symbols): Adjust section links and
12883         symbol section indexes.
12884         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12885         ordinary and special symbols.
12886         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12887         dynsym_xindex parameters.  Change all callers.  Adjust section
12888         links.  Use SHN_XINDEX when needed.
12889         (Sized_relobj::get_symbol_location_info): Adjust section links.
12890         Don't get fooled by special symbols.
12891         * object.h (class Xindex): Define.
12892         (class Object): Add xindex_ parameter.  Declare virtual functoin
12893         do_initialize_xindex.
12894         (Object::adjust_sym_shndx): New function.
12895         (Object::set_xindex): New protected function.
12896         (class Symbol_value): Add is_ordinary_shndx_ field.
12897         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12898         (Symbol_value::value): Assert ordinary section.
12899         (Symbol_value::initialize_input_to_output_map): Likewise.
12900         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12901         Change all callers.
12902         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12903         all callers.
12904         (class Sized_relobj): Update declarations.
12905         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12906         parameter.  Change all callers.
12907         (Sized_relobj::adjust_shndx): New function.
12908         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12909         field.
12910         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12911         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12912         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12913         (Sized_dynobj::read_dynsym_section): Adjust section links.
12914         (Sized_dynobj::read_dynamic): Likewise.
12915         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12916         section links.
12917         (Sized_dynobj::do_initialize_xindex): New function.
12918         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12919         do_initialize_xindex.
12920         (Sized_dynobj::adjust_shndx): New function.
12921         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12922         dynsym_xindex_ fields.
12923         (Layout::finalize): Add a call to set_section_indexes before
12924         creating the symtab sections.
12925         (Layout::set_section_indexes): Don't do anything if the section
12926         already has a section index.
12927         (Layout::create_symtab_sections): Add shnum parameter.  Change
12928         caller.  Create .symtab_shndx section if needed.
12929         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12930         caller.
12931         (Layout::allocated_output_section_count): New function.
12932         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12933         needed.
12934         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12935         fields.  Update declarations.
12936         (Layout::symtab_xindex): New function.
12937         (Layout::dynsym_xindex): New function.
12938         (class Write_symbols_task): Add layout_ field.
12939         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12940         Change caller.
12941         * output.cc (Output_section_headers::Output_section_headers): Add
12942         shstrtab_section parameter.  Change all callers.
12943         (Output_section_headers::do_sized_write): Store overflow values
12944         for section count and section string table section index in
12945         section header zero.
12946         (Output_file_header::do_sized_write): Check for overflow of
12947         section count and section string table section index.
12948         (Output_symtab_xindex::do_write): New function.
12949         (Output_symtab_xindex::endian_do_write): New function.
12950         * output.h (class Output_section_headers): Add shstrtab_section_.
12951         Update declarations.
12952         (class Output_symtab_xindex): Define.
12953         (Output_section::has_out_shndx): New function.
12954         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12955         field.
12956         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12957         Change all callers.
12958         (Sized_symbol::init): Likewise.
12959         (Symbol::output_section): Check for ordinary symbol.
12960         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12961         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12962         callers.
12963         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12964         Change all callers.  Simplify handling of symbols from sections
12965         not included in the link.
12966         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12967         distinction.
12968         (Weak_alias_sorter::operator()): Assert that symbols are
12969         ordinary.
12970         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12971         distinction.
12972         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12973         parameters.  Change all callers.
12974         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12975         symbol distinction.  Use SHN_XINDEX when needed.
12976         (Symbol_table::write_section_symbol): Add symtab_xindex
12977         parameter.  Change all callers.
12978         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12979         SHN_XINDEX when needed.
12980         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12981         declarations.
12982         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12983         (Symbol::is_defined): Check is_ordinary.
12984         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12985         (Symbol::is_absolute, Symbol::is_common): Likewise.
12986         (class Sized_symbol): Update declarations.
12987         (class Symbol_table): Update declarations.
12988         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12989         parameters.  Change all callers.
12990         (Sized_symbol::override): Likewise.
12991         (Symbol_table::override): Likewise.
12992         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12993         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12994         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12995         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12996         to be in an ordinary section.
12997         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12998         object and is_ordinary parameters.  Change all callers.
12999         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13000         Change all callers.  Don't add undefined or non-ordinary symbols
13001         to reloc_map_.
13002         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13003         Change all callers.
13004         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13005         declarations.
13006         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13007         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13008         (Sized_relobj::relocate_sections): Likewise.
13009         * target-reloc.h (scan_relocs): Adjust section symbol index.
13010         (scan_relocatable_relocs): Likewise.
13011         * i386.cc (Scan::local): Check for ordinary symbols.
13012         * sparc.cc (Scan::local): Likewise.
13013         * x86_64.cc (Scan::local): Likewise.
13014         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13015         to symbol_section_and_value.
13016         * testsuite/many_sections_test.cc: New file.
13017         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13018         (check_PROGRAMS): Add many_sections_test.
13019         (many_sections_test_SOURCES): Define.
13020         (many_sections_test_DEPENDENCIES): Define.
13021         (many_sections_test_LDFLAGS): Define.
13022         (BUILT_SOURCES): Add many_sections_define.h.
13023         (many_sections_define.h): New target.
13024         (BUILT_SOURCES): Add many_sections_check.h.
13025         (many_sections_check.h): New target.
13026         (check_PROGRAMS): Add many_sections_r_test.
13027         (many_sections_r_test_SOURCES): Define.
13028         (many_sections_r_test_DEPENDENCIES): Define.
13029         (many_sections_r_test_LDFLAGS): Define.
13030         (many_sections_r_test_LDADD): Define.
13031         (many_sections_r_test.o): New target.
13032         * testsuite/Makefile.in: Rebuild.
13033
13034 2008-04-17  Cary Coutant  <ccoutant@google.com>
13035
13036         * errors.cc (Errors::info): New function.
13037         (gold_info): New function.
13038         * errors.h (Errors::info): New function.
13039         * gold.h (gold_info): New function.
13040         * object.cc (Input_objects::add_object): Print trace output.
13041         * options.cc (options::parse_set): New function.
13042         (General_options::parse_wrap): Deleted.
13043         (General_options::General_options): Deleted initializer.
13044         * options.h (options::String_set): New typedef.
13045         (options::parse_set): New function.
13046         (DEFINE_set): New macro.
13047         (General_options::wrap): Changed to use DEFINE_set. Changed
13048         callers of any_wrap_symbols and is_wrap_symbol.
13049         (General_options::trace, General_options::trace_symbol):
13050         New options.
13051         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13052         (General_options::wrap_symbols_): Deleted.
13053         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13054
13055 2008-04-17  David S. Miller  <davem@davemloft.net>
13056
13057         * options.cc (General_options::parse_V): New function.
13058         * options.h: Add entries for -V and -Qy.
13059
13060 2008-04-17  Ian Lance Taylor  <iant@google.com>
13061
13062         * common.cc (Symbol_table::allocate_commons): Remove options
13063         parameter.  Change caller.
13064         (Symbol_table::do_allocate_commons): Remove options parameter.
13065         Change caller.  Just call do_allocate_commons_list twice.
13066         (Symbol_table::do_allocate_commons_list): New function, broken out
13067         of do_allocate_commons.
13068         * common.h (class Allocate_commons_task): Remove options_ field.
13069         Update constructor.
13070         * symtab.cc (Symbol_table::Symbol_table): Initialize
13071         tls_commons_.
13072         (Symbol_table::add_from_object): Put TLS common symbols on
13073         tls_commons_ list.
13074         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13075         which are IN_OUTPUT_DATA.
13076         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13077         allocate_commons and do_allocate_commons declarations.  Declare
13078         do_allocate_commons_list.
13079         * gold.cc (queue_middle_tasks): Update creation of
13080         Allocate_commons_task to not pass options.
13081         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13082         (TLS_TEST_C_FLAGS): New variable.
13083         (tls_test_c_pic.o): New target.
13084         (tls_test_shared.so): Link in tls_test_c_pic.o.
13085         (tls_test_c_pic_ie.o): New target.
13086         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13087         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13088         (tls_test_c.o): New target.
13089         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13090         (tls_pic_test_LDADD): Likewise.
13091         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13092         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13093         (tls_test_c_gnu2.o): New target.
13094         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13095         tls_test_c_gnu2.o.
13096         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13097         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13098         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13099         * testsuite/tls_test.cc: Include "config.h".
13100         (t_last): Call t11_last.
13101         * testsuite/tls_test.h (t11, t11_last): Declare.
13102         * testsuite/tls_test_c.c: New file.
13103         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13104         * configure.ac: Check for OpenMP support.
13105         * configure, config.in, Makefile.in: Rebuild.
13106         * testsuite/Makefile.in: Rebuild.
13107
13108 2008-04-16  Cary Coutant  <ccoutant@google.com>
13109
13110         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13111         (Target_i386::tls_base_symbol_defined_): New field.
13112         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13113         (Target_i386::Scan::global): Likewise.
13114         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13115         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13116         (Target_x86_64::tls_base_symbol_defined_): New field.
13117         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13118         (Target_x86_64::Scan::global): Likewise.
13119
13120 2008-04-16  Cary Coutant  <ccoutant@google.com>
13121
13122         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13123         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13124         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13125         building shared libraries.
13126         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13127         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13128         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13129         * testsuite/Makefile.in: Rebuild.
13130         * testsuite/weak_undef.h: New file.
13131         * testsuite/weak_undef_file1.cc: Add extra test cases.
13132         * testsuite/weak_undef_file2.cc: Likewise.
13133         * testsuite/weak_undef_test.cc: Likewise.
13134
13135 2008-04-16  David S. Miller  <davem@davemloft.net>
13136
13137         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13138         Add issued_non_pic_error_ field.  Declare check_non_pic.
13139         (Target_sparc::Scan::check_non_pic): New function.
13140         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13141         (Target_sparc::Scan::global): Likewise.
13142
13143         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13144         * configure: Rebuild.
13145
13146         * options.h (DEFINE_enable): New macro.
13147         (new_dtags): New enable option.
13148         (initfirst, interpose, loadfltr, nodefaultlib,
13149         nodelete, nodlopen, nodump): New -z options.
13150         * layout.cc (Layout:finish_dynamic_section): If new
13151         dtags enabled, emit DT_RUNPATH.  Also, emit a
13152         DT_FLAGS_1 containing any specified -z flags.
13153
13154 2008-04-16  Ian Lance Taylor  <iant@google.com>
13155
13156         * copy-relocs.cc: New file.
13157         * copy-relocs.h: New file.
13158         * reloc.cc: Remove Copy_relocs code.
13159         * reloc.h: Likewise.
13160         * reloc-types.h (struct Reloc_types) [both versions]: Add
13161         get_reloc_addend_noerror.
13162         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13163         variants of add_global which take an addend which must be zero.
13164         * i386.cc: Include "copy-relocs.h".
13165         (class Target_i386): Change type of copy_relocs_ to variable,
13166         update initializer.
13167         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13168         Change all callers.
13169         (Target_i386::do_finalize_sections): Change handling of
13170         copy_relocs_.
13171         * sparc.cc: Include "copy-relocs.h".
13172         (class Target_sparc): Change type of copy_relocs_ to variable,
13173         update initializer.
13174         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13175         Change all callers.
13176         (Target_sparc::do_finalize_sections): Change handling of
13177         copy_relocs_.
13178         * x86_64.cc: Include "copy-relocs.h".
13179         (class Target_x86_64): Change type of copy_relocs_ to variable,
13180         update initializer.
13181         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13182         class.  Change all callers.
13183         (Target_x86_64::do_finalize_sections): Change handling of
13184         copy_relocs_.
13185         * Makefile.am (CCFILES): Add copy-relocs.cc.
13186         (HFILES): Add copy-relocs.h.
13187
13188         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13189
13190         * testsuite/script_test_4.sh: Permit leading zeroes.
13191
13192 2008-04-15  Ian Lance Taylor  <iant@google.com>
13193
13194         * script-sections.cc (Script_sections::create_segments): Use
13195         header_size_adjustment even when there is enough room for the
13196         headers.
13197         * testsuite/script_test_4.sh: New file.
13198         * testsuite/script_test_4.t: New file.
13199         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13200         (check_DATA): Add script_test_4.stdout.
13201         (MOSTLYCLEANFILES): Likewise.
13202         (script_test_4): New target.
13203         (script_test_4.stdout): New target.
13204         * testsuite/Makefile.in: Rebuild.
13205
13206         * sparc.cc: Add definitions for Output_data_plt_sparc class
13207         constants.
13208
13209 2008-04-14  David S. Miller  <davem@davemloft.net>
13210
13211         * sparc.cc: New file.
13212         * Makefile.am (TARGETSOURCES): Add sparc.cc
13213         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13214         * configure.tgt: Document targ_extra_size and
13215         targ_extra_big_endian.  Add entries for sparc-* and
13216         sparc64-*.
13217         * configure.ac: Handle targ_extra_size and
13218         targ_extra_big_endian.
13219         * Makefile.in: Rebuild.
13220         * configure: Likewise.
13221         * po/POTFILES.in: Likewise.
13222         * po/gold.pot: Likewise.
13223
13224 2008-04-14  Ian Lance Taylor  <iant@google.com>
13225
13226         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13227         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13228         in the name/type/flags to section mapping.  Don't call
13229         allocate_output_section.
13230         (Layout::choose_output_section): Change parameter from adjust_name
13231         to is_input_section.  Don't permit input sections after sections
13232         are attached to segments.  Don't call allocate_output_section.
13233         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13234         not write_enable_output_section.
13235         (Layout::make_output_section): Don't push to
13236         unattached_section_list_ nor call attach_to_segment.  Call
13237         attach_section_to_segment if sections are attached.
13238         (Layout::attach_sections_to_segments): New function.
13239         (Layout::attach_section_to_segment): New function.
13240         (Layout::attach_allocated_section_to_segment): Rename from
13241         attach_to_segment.  Remove flags parameter.
13242         (Layout::allocate_output_section): Remove function.
13243         (Layout::write_enable_output_section): Remove function.
13244         * layout.h (class Layout): Update for above changes.  Add new
13245         field sections_are_attached_.
13246         * output.h (Output_section::update_flags_for_input_section): New
13247         function.
13248         * output.cc (Output_section::add_input_section): Call
13249         update_flags_for_input_section.
13250         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13251
13252 2008-04-11  Cary Coutant  <ccoutant@google.com>
13253
13254         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13255         thought unnecessary.
13256         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13257
13258 2008-04-11  Ian Lance Taylor  <iant@google.com>
13259
13260         * output.h (class Output_section_data): Remove inline definition
13261         of set_addralign.
13262         * output.cc (Output_section_data::set_addralign): New function.
13263
13264 2008-04-11  Cary Coutant  <ccoutant@google.com>
13265
13266         Add support for TLS descriptors for i386 and x86_64.
13267         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13268         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13269         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13270         GOT_TYPE_TLS_DESC.
13271         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13272         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13273         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13274         relocations.
13275         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13276         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13277         Fix problem with initial-exec relocations.
13278         (Target_i386::Relocate::relocate_tls): Likewise.
13279         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13280         relaxation.
13281         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13282         support for section-plus-offset dynamic table entries.
13283         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13284         (Output_data_dynamic::Dynamic_entry): Add support for
13285         section-plus-offset dynamic table entries.
13286         (Output_data_dynamic::Classification): Likewise.
13287         (Output_data_dynamic::classification_): Renamed offset_.
13288         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13289         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13290         (Target_x86_64::make_plt_section): New function.
13291         (Target_x86_64::reserve_tlsdesc_entries): New function.
13292         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13293         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13294         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13295         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13296         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13297         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13298         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13299         add extra PLT entry for TLS descriptors.
13300         (Output_data_plt_x86_64::got_): New field.
13301         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13302         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13303         fields.
13304         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13305         descriptors.
13306         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13307         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13308         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13309         R_386_TLS_DESC_CALL relocations.
13310         (Target_x86_64::Scan::global): Likewise.
13311         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13312         for TLS descriptors.
13313         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13314         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13315         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13316         GD-to-IE relaxation.
13317         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13318         and TLS_DESCRIPTORS.
13319         * Makefile.in: Rebuild.
13320         * configure: Rebuild.
13321         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13322         (tls_test_shared2.so): New target.
13323         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13324         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13325         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13326         (tls_shared_gd_to_ie_test_LDADD): New variable.
13327         (tls_shared_gnu2_gd_to_ie_test): New target.
13328         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13329         New targets.
13330         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13331         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13332         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13333         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13334         (tls_shared_gnu2_test): New target.
13335         (tls_test_gnu2_shared.so): New target.
13336         (tls_shared_gnu2_test_SOURCES): New variable.
13337         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13338         (tls_shared_gnu2_test_LDFLAGS): New variable.
13339         (tls_shared_gnu2_test_LDADD): New variable.
13340         * testsuite/Makefile.in: Rebuild.
13341         * testsuite/Makefile.
13342
13343 2008-04-11  Ian Lance Taylor  <iant@google.com>
13344
13345         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13346         justsyms.t.
13347         * testsuite/Makefile.in: Rebuild.
13348
13349         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13350         long.
13351         * testsuite/script_test_2.cc (main): Adjust test.
13352
13353 2008-04-11  David S. Miller  <davem@davemloft.net>
13354             Ian Lance Taylor  <iant@google.com>
13355
13356         * options.h (General_options): Add entries for '-Y' and
13357         '-relax'.
13358         * options.cc (General_options:finalize): If -Y was used, add those
13359         entries to the library path instead of the default "/lib" and
13360         "/usr/lib".
13361
13362 2008-04-11  David S. Miller  <davem@davemloft.net>
13363
13364         * testsuite/justsyms.t: Start at 0x100.
13365         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13366         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13367         long.
13368         * testsuite/script_test_2.cc: Adjust string and section length
13369         checks.
13370
13371 2008-04-09  Ian Lance Taylor  <iant@google.com>
13372
13373         PR gold/5996
13374         * script-sections.cc (Sections_element::allocate_to_segment): Add
13375         orphan parameter.
13376         (Output_section_definition::allocate_to_segment): Likewise.
13377         (Orphan_output_section::allocate_to_segment): Likewise.
13378         (Script_sections::attach_sections_using_phdrs_clause): Don't
13379         propagate non-PT_LOAD segments to orphan sections.
13380         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13381         readelf rather than objdump.
13382         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13383         .interp section and PT_INTERP segment are the same size.
13384         * testsuite/Makefile.in: Rebuild.
13385
13386         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13387         aliases for symbols defined in the same object.
13388         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13389         (weak_alias_test_SOURCES): New variable.
13390         (weak_alias_test_DEPENDENCIES): New variable.
13391         (weak_alias_test_LDFLAGS): New variable.
13392         (weak_alias_test_LDADD): New variable.
13393         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13394         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13395         (weak_alias_test_3.o): New target.
13396         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13397         * testsuite/weak_alias_test_main.cc: New file.
13398         * testsuite/weak_alias_test_1.cc: New file.
13399         * testsuite/weak_alias_test_2.cc: New file.
13400         * testsuite/weak_alias_test_3.cc: New file.
13401
13402 2008-04-08  Ian Lance Taylor  <iant@google.com>
13403
13404         * options.h (class General_options): Add --noinhibit-exec option.
13405         * main.cc (main): Check --noinhibit-exec.
13406
13407         * options.h (class General_options): Define --wrap as a special
13408         option.  Add wrap_symbols_ field.
13409         (General_options::any_wrap_symbols): New function.
13410         (General_options::is_wrap_symbol): New function.
13411         * options.cc (General_options::parse_wrap): New function.
13412         (General_options::General_options): Initialize wrap_symbols_.
13413         * symtab.cc (Symbol_table::wrap_symbol): New function.
13414         (Symbol_table::add_from_object): Handle --wrap.
13415         * symtab.h (class Symbol_table): Declare wrap_symbol.
13416         * target.h (Target::wrap_char): New function.
13417         (Target::Target_info): Add wrap_char field.
13418         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13419         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13420         * testsuite/testfile.cc (Target_test::test_target_info):
13421         Likewise.
13422
13423         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13424         there is one.
13425
13426         * layout.h (class Layout): Add added_eh_frame_data_ field.
13427         * layout.cc (Layout::Layout): Initialize new field.
13428         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13429         output section until we find a section we merged successfully.
13430         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13431         that the size be non-zero.
13432
13433         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13434         qualifier.
13435
13436 2008-04-08  Craig Silverstein  <csilvers@google.com>
13437
13438         * configure.ac: Export new conditional variable HAVE_ZLIB.
13439         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13440         on HAVE_ZLIB.
13441         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13442         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13443
13444 2008-04-07  Ian Lance Taylor  <iant@google.com>
13445
13446         * version.cc (version_string): Set to "1.5".
13447
13448         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13449         Add issued_non_pic_error_ field.  Declare check_non_pic.
13450         (Target_x86_64::Scan::check_non_pic): New function.
13451         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13452         (Target_x86_64::Scan::global): Likewise.
13453
13454         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13455         addend parameter.  Change caller.  Handle merge sections.
13456         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13457         Address to Addend.  Don't add in the result of
13458         local_section_offset, pass down the addend and use the returned
13459         value.
13460         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13461         Update declarations of local_section_offset and symbol_value.
13462         * testsuite/two_file_test_1.cc (t18): New function.
13463         * testsuite/two_file_test_2.cc (f18): New function.
13464         * testsuite/two_file_test_main.cc (main): Call t18.
13465         * testsuite/two_file_test.h (t18, f18): Declare.
13466
13467         * configure.ac: Don't test for objdump, c++filt, or readelf.
13468         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13469         conditionals.
13470         (TEST_READELF): New variable.
13471         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13472         (check_PROGRAMS): Add two_file_strip_test.
13473         (two_file_strip_test): New target.
13474         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13475         (two_file_same_shared_strip_test_SOURCES): New variable.
13476         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13477         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13478         (two_file_same_shared_strip_test_LDADD): New variable.
13479         (two_file_shared_strip.so): New target.
13480         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13481         (ver_test_5.syms, ver_test_7.syms): Likewise.
13482         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13483         (strip_test_3.stdout): Use TEST_OBJDUMP.
13484         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13485
13486 2008-04-04  Cary Coutant  <ccoutant@google.com>
13487
13488         * symtab.h (Symbol::is_weak_undefined): New function.
13489         (Symbol::is_strong_undefined): New function.
13490         (Symbol::is_absolute): New function.
13491         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13492         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13493         absolute symbols.
13494         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13495         (weak_undef_test): New target.
13496         * testsuite/Makefile.in: Rebuild.
13497         * testsuite/weak_undef_file1.cc: New file.
13498         * testsuite/weak_undef_file2.cc: New file.
13499         * testsuite/weak_undef_test.cc: New file.
13500
13501 2008-04-03  Craig Silverstein  <csilvers@google.com>
13502
13503         * compressed_output.h (class Output_compressed_section): Use
13504         unsigned buffer.
13505         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13506         add zlib header.
13507         (zlib_compressed_suffix): Removed.
13508         (Output_compressed_section::set_final_data_size): Use unsigned
13509         buffers.
13510         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13511         Fix linker invocation.
13512         (flagstest_o_specialfile_and_compress_debug_sections):
13513         Likewise.
13514         * testsuite/Makefile.in: Regenerated.
13515
13516 2008-04-02  David S. Miller  <davem@davemloft.net>
13517
13518         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13519         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13520
13521 2008-04-02  Craig Silverstein  <csilvers@google.com>
13522
13523         * TODO: New file.
13524
13525 2008-04-02  Ian Lance Taylor  <iant@google.com>
13526
13527         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13528         parameters.  Update for new key type to views_.  Change all
13529         callers.
13530         (File_read::read): Adjust for byteshift in returned view.
13531         (File_read::add_view): New function, broken out of
13532         find_and_make_view.
13533         (File_read::make_view): New function, broken out of
13534         find_and_make_view.
13535         (File_read::find_or_make_view): Add offset and aligned
13536         parameters.  Rewrite accordingly.  Change all callers.
13537         (File_read::get_view): Add offset and aligned parameters.  Adjust
13538         for byteshift in return value.
13539         (File_read::get_lasting_view): Likewise.
13540         * fileread.h (class File_read): Update declarations.
13541         (class File_read::View): Add byteshift_ field.  Add byteshift to
13542         constructor.  Add byteshift method.
13543         * archive.h (Archive::clear_uncached_views): New function.
13544         (Archive::get_view): Add aligned parameter.  Change all callers.
13545         * object.h (Object::get_view): Add aligned parameter.  Change all
13546         callers.
13547         (Object::get_lasting_view): Likewise.
13548
13549         * fileread.cc (File_read::release): Don't call clear_views if
13550         there are multiple objects.
13551         * fileread.h (File_read::clear_uncached_views): New function.
13552         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13553         on the archive.
13554
13555 2008-03-31  Cary Coutant  <ccoutant@google.com>
13556
13557         Add thin archive support.
13558         * archive.cc (Archive::armagt): New const.
13559         (Archive::setup): Remove task parameter and calls to unlock.
13560         (Archive::unlock_nested_archives): New function.
13561         (Archive::read_header): Add nested_off parameter. Change
13562         all callers.
13563         (Archive::interpret_header): Likewise.
13564         (Archive::include_all_members): Change to handle thin
13565         archives.
13566         (Archive::include_member): Likewise.
13567         * archive.h (Archive::Archive): Add new parameters and
13568         initializers.
13569         (Archive::armagt): New const.
13570         (Archive::setup): Remove task parameter.
13571         (Archive::unlock_nested_archives): New function.
13572         (Archive::read_header): Add nested_off parameter.
13573         (Archive::interpret_header): Likewise.
13574         (Archive::Nested_archive_table): New typedef.
13575         (Archive::is_thin_archive_): New field.
13576         (Archive::nested_archives_): New field.
13577         (Archive::options_): New field.
13578         (Archive::dirpath_): New field.
13579         (Archive::task_): New field.
13580         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13581         for thin archives.  Pass additional parameters to
13582         Archive::Archive.  Unlock the archive file after calling
13583         Archive::setup.
13584
13585 2008-03-29  Ian Lance Taylor  <iant@google.com>
13586
13587         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13588         version symbol to be local.
13589         * testsuite/ver_test_4.sh: New file.
13590         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13591         (check_DATA): Add ver_test_4.syms.
13592         (ver_test_4.syms): New target.
13593         * testsuite/Makefile.in: Rebuild.
13594
13595         * output.cc
13596         (Output_section::Input_section_sort_entry::has_priority): New
13597         function.
13598         (Output_section::Input_section_sort_entry::match_file_name): New
13599         function.
13600         (Output_section::Input_section_sort_entry::match_section_name):
13601         Remove.
13602         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13603         Remove.
13604         (Output_section::Input_section_sort_entry::match_section_file):
13605         Remove.
13606         (Output_section::Input_section_sort_compare::operator()): Rewrite
13607         using new Input_section_sort_entry functions.  Sort crtbegin and
13608         crtend first.  Sort sections with no priority before sections with
13609         a priority.
13610         * testsuite/initpri1.c (d3): Check j != 4.
13611         (cd5): New constructor/destructor function.
13612         (main): Check j != 2.
13613
13614         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13615         new symbol when resolving, don't call set_is_default.
13616         * testsuite/ver_test_7.cc: New file.
13617         * testsuite/ver_test_7.sh: New file.
13618         * testsuite/Makefile.am (ver_test_7.so): New target.
13619         (ver_test_7.o): New target.
13620         (check_SCRIPTS): Add ver_test_7.sh.
13621         (check_DATA): Add ver_test_7.syms.
13622         (ver_test_7.syms): New target.
13623
13624 2008-03-28  Ian Lance Taylor  <iant@google.com>
13625
13626         * layout.cc (Layout::layout): If we see an input section with a
13627         name that needs sorting, set the must_sort flag for the output
13628         section.
13629         (Layout::make_output_section): If the name of the output section
13630         indicates that it might require sorting, set the may_sort flag.
13631         * output.h (Output_section::may_sort_attached_input_sections): New
13632         function.
13633         (Output_section::set_may_sort_attached_input_sections): New
13634         function.
13635         (Output_section::must_sort_attached_input_sections): New
13636         function.
13637         (Output_section::set_must_sort_attached_input_sections): New
13638         function.
13639         (class Output_section): Declare Input_section_sort_entry.  Define
13640         Input_section_sort_compare.  Declare
13641         sort_attached_input_sections.  Add new fields:
13642         may_sort_attached_input_sections_,
13643         must_sort_attached_input_sections_,
13644         attached_input_sections_are_sorted_.
13645         * output.cc (Output_section::Output_section): Initialize new
13646         fields.
13647         (Output_section::add_input_section): Add an entry to
13648         input_sections_ if may_sort or must_sort are true.
13649         (Output_section::set_final_data_size): Call
13650         sort_attached_input_sections if necessary.
13651         (Output_section::Input_section_sort_entry): Define new class.
13652         (Output_section::Input_section_sort_compare::operator()): New
13653         function.
13654         (Output_section::sort_attached_input_sections): New function.
13655         * configure.ac: Check whether the compiler supports constructor
13656         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13657         * testsuite/initpri1.c: New file.
13658         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13659         CONSTRUCTOR_PRIORITY.
13660         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13661         (initpri1_LDFLAGS): New variable.
13662         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13663
13664 2008-03-27  Ian Lance Taylor  <iant@google.com>
13665
13666         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13667         * testsuite/common_test_1.c: New file.
13668         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13669         (common_test_1_SOURCES): New variable.
13670         (common_test_1_DEPENDENCIES): New variable.
13671         (common_test_1_LDFLAGS): New variable.
13672
13673         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13674         and commons_ correctly when NAME/VERSION does not override
13675         NAME/NULL.
13676         * testsuite/ver_test_6.c: New file.
13677         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13678         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13679         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13680
13681 2008-03-26  Ian Lance Taylor  <iant@google.com>
13682
13683         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13684         of an undefined symbol from a version script.
13685         * testsuite/Makefile.am (ver_test_5.so): New target.
13686         (ver_test_5.o): New target.
13687         (check_SCRIPTS): Add ver_test_5.sh.
13688         (check_DATA): Add ver_test_5.syms.
13689         (ver_test_5.syms): New target.
13690         * testsuite/ver_test_5.cc: New file.
13691         * testsuite/ver_test_5.script: New file.
13692         * testsuite/ver_test_5.sh: New file.
13693         * Makefile.in, testsuite/Makefile.in: Rebuild.
13694
13695         PR gold/5986
13696         Fix problems building gold with gcc 4.3.0.
13697         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13698         (gold_error_at_location, gold_warning_at_location): Use it.
13699         * configure.ac: Check whether we can compile and use a template
13700         function with a printf attribute.
13701         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13702         when jumping over bytes.
13703         * object.cc: Instantiate Object::read_section_data.
13704         * debug.h: Include <cstring>
13705         * dwarf_reader.cc: Include <algorithm>
13706         * main.cc: Include <cstring>.
13707         * options.cc: Include <cstring>.
13708         * output.cc: Include <cstring>.
13709         * script.cc: Include <cstring>.
13710         * script.h: Include <string>.
13711         * symtab.cc: Include <cstring> and <algorithm>.
13712         * target-select.cc: Include <cstring>.
13713         * version.cc: Include <string>.
13714         * testsuite/testmain.cc: Include <cstdlib>.
13715         * configure, config.in: Rebuild.
13716
13717 2008-03-25  Ian Lance Taylor  <iant@google.com>
13718
13719         * options.cc: Include "../bfd/bfdver.h".
13720         (options::help): Print bug reporting address.
13721
13722         * version.cc (print_version): Adjust output for current value of
13723         BFD_VERSION_STRING.
13724
13725         * NEWS: New file.
13726
13727         * options.cc (options::help): Print list of supported targets.
13728         * target-select.h: Include <vector>.
13729         (class Target_selector): Make machine_, size_, and is_big_endian_
13730         fields const.  Add bfd_name_ and instantiated_target_ fields.
13731         (Target_selector::Target_selector): Add bfd_name parameter.
13732         (Target_selector::recognize): Make non-virtual, call
13733         do_recognize.
13734         (Target_selector::recognize_by_name): Make non-virtual, call
13735         do_recognize_by_name.
13736         (Target_selector::supported_names): New function.
13737         (Target_selector::bfd_name): New function.
13738         (Target_selector::do_instantiate_target): New pure virtual
13739         function.
13740         (Target_selector::do_recognize): New virtual function.
13741         (Target_selector::do_recognize_by_name): New virtual function.
13742         (Target_selector::instantiate_target): New private function.
13743         (supported_target_names): Declare.
13744         * target-select.cc (Target_selector::Target_selector): Update for
13745         new parameter and fields.
13746         (select_target_by_name): Check that the name matches before
13747         calling recognize_by_name.
13748         (supported_target_names): New function.
13749         * i386.cc (class Target_selector_i386): Update Target_selector
13750         constructor call.  Remove recognize and recognize_by_name.  Add
13751         do_instantiate_target.
13752         * x86_64.cc (class Target_selector_x86_64): Likewise.
13753         * testsuite/testfile.cc (class Target_selector_test): Update for
13754         changes to Target_selector.
13755
13756         * README: Rewrite, with some notes on unsupported features.
13757
13758 2008-03-24  Cary Coutant  <ccoutant@google.com>
13759
13760         * i386.cc (Target_i386::Got_type): New enum declaration.
13761         (Target_i386::Scan::local): Updated callers of Output_data_got
13762         member functions.
13763         (Target_i386::Scan::global): Likewise.
13764         (Target_i386::Relocate::relocate): Likewise.
13765         (Target_i386::Relocate::relocate_tls): Likewise.
13766         * object.h (Got_offset_list): New class.
13767         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13768         (Sized_relobj::local_got_offset): Likewise.
13769         (Sized_relobj::set_local_got_offset): Likewise.
13770         (Sized_relobj::local_has_tls_got_offset): Removed.
13771         (Sized_relobj::local_tls_got_offset): Removed.
13772         (Sized_relobj::set_local_tls_got_offset): Removed.
13773         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13774         * output.cc (Output_data_got::add_global): Added got_type parameter.
13775         (Output_data_got::add_global_with_rel): Likewise.
13776         (Output_data_got::add_global_with_rela): Likewise.
13777         (Output_data_got::add_global_pair_with_rel): New function.
13778         (Output_data_got::add_global_pair_with_rela): New function.
13779         (Output_data_got::add_local): Added got_type parameter.
13780         (Output_data_got::add_local_with_rel): Likewise.
13781         (Output_data_got::add_local_with_rela): Likewise.
13782         (Output_data_got::add_local_pair_with_rel): New function.
13783         (Output_data_got::add_local_pair_with_rela): New function.
13784         (Output_data_got::add_global_tls): Removed.
13785         (Output_data_got::add_global_tls_with_rel): Removed.
13786         (Output_data_got::add_global_tls_with_rela): Removed.
13787         (Output_data_got::add_local_tls): Removed.
13788         (Output_data_got::add_local_tls_with_rel): Removed.
13789         (Output_data_got::add_local_tls_with_rela): Removed.
13790         * output.h (Output_data_got::add_global): Added got_type parameter.
13791         (Output_data_got::add_global_with_rel): Likewise.
13792         (Output_data_got::add_global_with_rela): Likewise.
13793         (Output_data_got::add_global_pair_with_rel): New function.
13794         (Output_data_got::add_global_pair_with_rela): New function.
13795         (Output_data_got::add_local): Added got_type parameter.
13796         (Output_data_got::add_local_with_rel): Likewise.
13797         (Output_data_got::add_local_with_rela): Likewise.
13798         (Output_data_got::add_local_pair_with_rel): New function.
13799         (Output_data_got::add_local_pair_with_rela): New function.
13800         (Output_data_got::add_global_tls): Removed.
13801         (Output_data_got::add_global_tls_with_rel): Removed.
13802         (Output_data_got::add_global_tls_with_rela): Removed.
13803         (Output_data_got::add_local_tls): Removed.
13804         (Output_data_got::add_local_tls_with_rel): Removed.
13805         (Output_data_got::add_local_tls_with_rela): Removed.
13806         * resolve.cc (Symbol::override_base_with_special): Removed
13807         reference to has_got_offset_ field.
13808         * symtab.cc (Symbol::init_fields): Replaced initialization
13809         of got_offset_ with got_offsets_.  Removed initialization
13810         of has_got_offset_
13811         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13812         (Symbol::got_offset): Likewise.
13813         (Symbol::set_got_offset): Likewise.
13814         (Symbol::has_tls_got_offset): Removed.
13815         (Symbol::tls_got_offset): Removed.
13816         (Symbol::set_tls_got_offset): Removed.
13817         (Symbol::got_offset_): Removed.
13818         (Symbol::tls_mod_got_offset_): Removed.
13819         (Symbol::tls_pair_got_offset_): Removed.
13820         (Symbol::got_offsets_): New field.
13821         (Symbol::has_got_offset): Removed.
13822         (Symbol::has_tls_mod_got_offset): Removed.
13823         (Symbol::has_tls_pair_got_offset): Removed.
13824         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13825         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13826         member functions.
13827         (Target_x86_64::Scan::global): Likewise.
13828         (Target_x86_64::Relocate::relocate): Likewise.
13829         (Target_x86_64::Relocate::relocate_tls): Likewise.
13830
13831 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13832
13833         * yyscript.y: Fix spelling error in comment.
13834
13835 2008-03-24  Ian Lance Taylor  <iant@google.com>
13836
13837         * options.h (class General_options): Define build_id option.
13838         * layout.h (class Layout): Declare write_build_id, create_note,
13839         create_build_id.  Add build_id_note_ member.
13840         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13841         "libiberty.h", "md5.h", "sha1.h".
13842         (Layout::Layout): Initialize eh_frame_data_,
13843         eh_frame_hdr_section_, and build_id_note_.
13844         (Layout::finalize): Call create_build_id.
13845         (Layout::create_note): New function, broken out of
13846         Layout::create_gold_note.
13847         (Layout::create_gold_note): Call create_note.
13848         (Layout::create_build_id): New function.
13849         (Layout::write_build_id): New function.
13850         (Close_task_runner::run): Call write_build_id.
13851
13852         * x86_64.cc: Correct license to GPLv3.
13853
13854 2008-03-23  Ian Lance Taylor  <iant@google.com>
13855
13856         * options.cc: Include "demangle.h".
13857         (parse_optional_string): New function.
13858         (parse_long_option): Handle takes_optional_argument.
13859         (parse_short_option): Update dash_z initializer.  Handle
13860         takes_optional_argument.
13861         (General_options::General_options): Initialize do_demangle_.
13862         (General_options::finalize): Set do_demangle_.  Handle demangling
13863         style.
13864         * options.h (parse_optional_string): Declare.
13865         (struct One_option): Add optional_arg field.  Update constructor.
13866         Update call constructor calls.  Add takes_optional_argument
13867         function.
13868         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13869         (DEFINE_optional_string): Define.
13870         (General_options::demangle): Change from DEFINE_bool to
13871         DEFINE_optional_string.
13872         (General_options::no_demangle): New function.
13873         (General_options::do_demangle): New function.
13874         (General_options::set_do_demangle): New function.
13875         (General_options::execstack_status_): Move definition to end of
13876         class definition.
13877         (General_options::static_): Likewise.
13878         (General_options::do_demangle_): New field.
13879         * object.cc (big_endian>::get_symbol_location_info): Call
13880         Options::do_demangle, not Options::demangle.
13881         * symtab.cc (demangle): Likewise.
13882
13883 2008-03-22  Ian Lance Taylor  <iant@google.com>
13884
13885         * gold.h: Include <cstddef> and <sys/types.h>
13886         * options.h: Include <cstring>.
13887
13888 2008-03-21  Ian Lance Taylor  <iant@google.com>
13889
13890         * Added source code to GNU binutils.