PR gold/14727
[external/binutils.git] / gold / ChangeLog
1 2012-10-18  Alan Modra  <amodra@gmail.com>
2
3         PR gold/14727
4         * object.cc (Relobj::is_section_name_included): Also match
5         .sdata personality section.
6
7 2012-10-18  Alan Modra  <amodra@gmail.com>
8
9         * target-reloc.h (class Default_comdat_behavior): New, package up..
10         (get_comdat_behaviour): ..this.
11         (relocate_section): Add Relocate_comdat_behavior template arg,
12         adjust code to suit.
13         * arm.cc (Target_arm::relocate_section): Adjust to suit.
14         (Target_arm::scan_reloc_section): Likewise.
15         * i386.cc (Target_i386::relocate_section): Likewise.
16         * sparc.cc (Target_sparc::relocate_section): Likewise.
17         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
18         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
19         * powerpc.cc (class Relocate_comdat_behavior): New.
20         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
21         gold::relocate_section with new template arg.
22
23 2012-10-18  Alan Modra  <amodra@gmail.com>
24
25         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
26         dynamic relocs for GOT_TPREL got entries, without symbol if
27         resolving locally.
28         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
29         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
30         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
31
32 2012-10-17  Alan Modra  <amodra@gmail.com>
33
34         PR gold/14726
35         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
36
37 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
38
39         * layout.cc (Layout::include_section): Keep sections marked
40         SHF_EXCLUDE when doing relocatable links.
41
42 2012-10-16  Alan Modra  <amodra@gmail.com>
43
44         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
45         (Target_powerpc::do_finalize_sections): Call it.
46         (Output_data_save_res): New class and supporting functions.
47         (Target_powerpc::symval_for_branch): Only look up .opd entry for
48         normal symbols defined in object files.
49
50 2012-10-12  Alan Modra  <amodra@gmail.com>
51
52         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
53         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
54         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
55         section if scan_opd_relocs not yet called.
56         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
57
58 2012-10-12  Alan Modra  <amodra@gmail.com>
59
60         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
61         add_local_ifunc_entry): Revert last change.
62         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
63
64 2012-10-05  Alan Modra  <amodra@gmail.com>
65
66         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
67         do_plt_address_for_global): New functions.
68         (Output_data_got_powerpc::do_write): Don't segfault when linking
69         statically.
70         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
71         add_local_ifunc_entry): Return true on adding entry..
72         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
73         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
74         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
75         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
76         set up symbols here.
77         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
78         syms here.  Do so even when no .iplt.  Don't segfault when linking
79         statically.
80         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
81         new variants without reloc param.
82         (Glink_sym_ent::Glink_sym_ent): Likewise.
83         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
84         reloc when refs will resolve to plt call stub.
85         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
86         R_PPC_PLTREL24 to resolve locally.
87         (Target_powerpc::Scan::global): Correct ifunc handling.
88         (Target_powerpc::Relocate::relocate): Correct local sym glink
89         lookup.  Don't destroy "value" when we have a plt call stub,
90         and when checking plt call validity.
91         (Target_powerpc::do_dynsym_value): Simplify.
92
93 2012-10-05  Alan Modra  <amodra@gmail.com>
94
95         * i386.cc (Output_data_plt_i386::address_for_global,
96         address_for_local): Add plt offset to returned value.  Adjust uses.
97         * sparc.cc (Output_data_plt_sparc::address_for_global,
98         address_for_local): Likewise.
99         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
100         address_for_local): Likewise.
101         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
102         address_for_local): Likewise.
103         * target.h (Target::plt_address_for_global, plt_address_for_local):
104         Update comment.
105         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
106         (Output_data_got::Got_entry::write): Nor here.
107         * output.h: Comment fix.
108
109 2012-10-02  Jiong Wang  <jiwang@tilera.com>
110
111         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
112         global_offset_table_ value for larget got.
113         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
114
115 2012-09-29  Alan Modra  <amodra@gmail.com>
116
117         * powerpc.cc (Target_powerpc::iplt_): New output section.
118         (Target_powerpc::iplt_section, make_iplt_section,
119         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
120         (Target_powerpc::make_plt_entry): Handle ifunc syms.
121         Target_powerpc::plt_entry_count): Count iplt entries too.
122         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
123         reloc section in constructor.  New params.
124         (Target_powerpc::make_plt_section): Create reloc section here instead.
125         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
126         functions.
127         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
128         (Output_data_glink::add_entry, find_entry): New functions to
129         deal with local syms.
130         (Glink_sym_ent): Add support for local syms.
131         (Output_data_glink::do_write): Handle ifunc plt entries.
132         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
133         (Target_powerpc::Scan::local, global): Handle ifunc syms.
134         (Target_powerpc::Relocate::relocate): Likewise.
135         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
136
137 2012-09-25  Alan Modra  <amodra@gmail.com>
138
139         * object.h (Sized_relobj_file::adjust_local_symbol,
140         do_adjust_local_symbol): New functions.
141         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
142         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
143         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
144         and irregular opd entry spacing.
145         (Powerpc_relobj::do_read_relocs): Add opd size checks.
146         (Global_symbol_visitor_opd): New functor.
147         (Target_powerpc::do_finalize_sections): Omit global symbols defined
148         on deleted opd entries.
149
150 2012-09-15  Jiong Wang  <jiwang@tilera.com>
151
152         * tilegx.cc: New file.
153         * Makefile.am (TARGETSOURCES): Add tilegx.cc
154         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
155         * configure.tgt: Add entries for tilegx*.
156         * configure.ac: Likewise.
157         * Makefile.in: Rebuild.
158         * configure: Likewise.
159         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
160         tilegx.
161
162 2012-09-13  Alan Modra  <amodra@gmail.com>
163
164         * target-reloc.h (scan_relocs): Call scan.local for relocs
165         against symbols in discarded sections.  Pass is_discarded
166         param.
167         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
168         Add is_discarded param.
169         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
170         is_discarded to flag opd entry as discarded.  Don't emit dyn
171         relocs on such entries.
172         (Target_powerpc::Scan::global): Similarly detect and handle
173         such opd entries.
174         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
175         opd_ent_.  Update all uses.
176         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
177         (Target_powerpc::relocate_section): Zero out discarded opd
178         entry relocs.
179
180 2012-09-12  Ian Lance Taylor  <iant@google.com>
181
182         PR gold/14570
183         * output.cc: Rename Output_data_got template parameter from size
184         to got_size for all functions.  Compile all variants of
185         Output_data_got.
186         (Output_data_got::Got_entry::write): Correct use of size for
187         symbol value.  Use local_is_tls rather than casting to
188         Sized_relobj_file.
189         * object.h (class Object): Add local_is_tls and do_local_is_tls.
190         (class Sized_relobj_file): Add do_local_is_tls.
191         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
192
193 2012-09-11  Alan Modra  <amodra@gmail.com>
194
195         PR gold/14566
196         * layout.cc (Layout::set_segment_offsets): When using
197         common-page-size alignment, ensure we are on a new max-page-size
198         page.
199         * output.cc (Output_segment::set_section_addresses): Use
200         abi_pagesize, not common_pagesize for relro boundary.
201         (Output_segment::set_offset): Likewise.
202
203 2012-09-11  Alan Modra  <amodra@gmail.com>
204
205         * output.h (Output_data_got::add_global_tls, add_local_tls,
206         add_local_tls_pair): New functions.
207         (Output_data_got::add_local_pair_with_rel): Remove second
208         reloc param.  Expand comment.
209         (Output_data_got::Got_entry): Rename use_plt_offset_ to
210         use_plt_or_tls_offset_, similarly for constructor param.
211         (Output_data_got::Got_entry::write): Add got_index param.
212         * output.cc (Output_data_got::add_global_tls, add_local_tls,
213         add_local_tls_pair): New functions.
214         (Output_data_got::Got_entry::write): Handle tls symbols
215         with use_plt_or_tls_offset_ set specially.
216         (Output_data_got::add_local_pair_with_rel): Only one reloc.
217         (Output_data_got::do_write): Replace iterator with index, pass
218         index to entry write function.
219         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
220         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
221         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
222         call.
223         * i386.cc (Target_i386::Scan::local): Likewise.
224         * sparc.cc (Target_sparc::Scan::local): Likewise.
225         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
226         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
227         do_tls_offset_for_global): New functions.
228         (Target_powerpc::Scan::local): Correct TLS relocations and got
229         entry values.
230         (Target_powerpc::Scan::global): Don't emit unnecessary
231         dynamic relocations on TLS GOT entries.
232
233 2012-09-10  Matthias Klose  <doko@ubuntu.com>
234
235         * config.in: Disable sanity check for kfreebsd.
236
237 2012-09-10  Sterling Augustine  <saugustine@google.com>
238
239         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
240         (Gdb_index::pubtypes_read): New parameter.
241         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
242         to calls.
243         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
244         pubtypes_object_.
245
246 2012-09-09  Alan Modra  <amodra@gmail.com>
247
248         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
249         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
250         * gc.h (gc_process_relocs): Call target gc_add_reference.
251         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
252         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
253         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
254         unnecessary cast.
255         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
256         to cater for when we don't need code offset.  Update use.
257         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
258         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
259         set_opd_valid): New functions.
260         (Target_powerpc::do_gc_add_reference): New function.
261         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
262         stashed refs.
263         (Target_powerpc::do_gc_mark_symbol): New function.
264
265 2012-09-06  Cary Coutant  <ccoutant@google.com>
266
267         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
268         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
269         (Dwarf_die::skip_attributes): Likewise.
270         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
271         * testsuite/gdb_index_test.cc (inline_func_1): New function.
272         (main): Call it.
273         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
274
275 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
276
277         * testsuite/script_test_3.t: Add .got.plt output section
278         statement.
279         * testsuite/script_test_4.t: Likewise.
280
281 2012-09-05  Alan Modra  <amodra@gmail.com>
282
283         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
284         update all uses and lose "enum" when using type.
285
286 2012-09-05  Alan Modra  <amodra@gmail.com>
287
288         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
289         * configure: Regenerate.
290         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
291         (plugin_final_layout.stdout): Likewise.
292         (memory_test): Set page sizes to 0x1000.
293         * testsuite/Makefile.in: Regenerate.
294         * testsuite/discard_locals_test.sh: Add FIXME comment.
295         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
296         * testsuite/pr14265.t: Add .got output section statement.
297         * testsuite/script_test_2.t: Likewise.
298         * testsuite/script_test_3.t: Likewise.
299         * testsuite/script_test_4.t: Likewise.
300         * testsuite/script_test_5.t: Likewise.
301         * testsuite/script_test_6.t: Likewise.
302         * testsuite/script_test_7.t: Likewise.
303         * testsuite/script_test_9.t: Likewise.
304
305 2012-09-05  Alan Modra  <amodra@gmail.com>
306
307         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
308         (Powerpc_relocate_functions::Status): New typedef.
309         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
310         (Target_powerpc::Scan::local): Handle REL64.
311         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
312         for REL32 and REL64.
313         (Target_powerpc::symval_for_branch): New function, extracted from..
314         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
315         checks.  Report overflow errors.
316
317 2012-09-05  Alan Modra  <amodra@gmail.com>
318
319         * object.h (Sized_relobj_file::emit_relocs): Delete.
320         (Sized_relobj_file::emit_relocs_reltype): Delete.
321         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
322         relocate_relocs for --emit-relocs.
323         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
324         * output.h: Update comment.
325         (Output_segment::first_section): New function.
326         (Output_segment::first_section_load_address): Use first_section.
327         * output.cc (Output_segment::first_section): New function extracted..
328         (Output_segment::first_section_load_address): ..from here.  Delete.
329         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
330         * target.h (Sized_target::relocate_for_relocatable): Likewise.
331         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
332         adjust call to target.h function.
333         * i386.cc (Target_i386): Likewise.
334         * sparc.cc (Target_sparc): Likewise.
335         * x86_64.cc (Target_x86_64): Likewise.
336         * powerpc.cc (Target_powerpc): Likewise.
337         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
338         first tls section has section symbol for optimised local dynamic
339         output relocs.
340         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
341         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
342         optimised tls code.
343         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
344         Rename to relocate_relocs.  Update error message.
345
346 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
347
348         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
349         --just-symbols.
350
351 2012-08-31  Alan Modra  <amodra@gmail.com>
352
353         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
354         (Powerpc_relobj::toc_base_offset): New stub function.
355         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
356         got_mod_index_offset to tlsld_got_offset.  Update all refs.
357         (Target_powerpc::Relocate::enum skip_tls): New.
358         (Target_powerpc::call_tls_get_addr_): New var.
359         (Target_powerpc::is_branch_reloc): Move to file scope.
360         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
361         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
362         New functions.
363         (Target_powerpc::enum Got_type): Delete old values, add new ones.
364         (powerpc_info): Correct common_pagesize for ppc64.
365         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
366         (Powerpc_relocate_functions): Add overflow check enums and functions.
367         Add non-shift version of rela, rela_ua.  Delete all rel public
368         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
369         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
370         addr16_ha3, addr14 functions.
371         (Output_data_got_powerpc::add_constant_pair): New function.
372         (Output_data_got_powerpc::got_base_offset): Likewise.
373         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
374         (instruction constants): Sort, add some more.
375         (Output_data_glink::do_write): Add and use Address typedef.  Use
376         object->toc_base_offset() stub for 64-bit.
377         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
378         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
379         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
380         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
381         Always treat .opd relocs as against locally defined symbol.
382         Correct condition for RELATIVE relocs.
383         (Target_powerpc::do_finalize_sections): Test for NULL sections.
384         (Target_powerpc::Relocate::relocate): Use plt call stub as value
385         for 32-bit syms with a plt entry.  Correct ppc64 toc base
386         calculations.  Handle TLS relocs, and more.  Add overflow
387         checking and adjust for Powerpc_relocate_functions changes.
388         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
389         Reinstate --emit-relocs code with FIXME.
390
391 2012-08-30  Alan Modra  <amodra@gmail.com>
392
393         * layout.cc (Layout::set_segment_offsets): Set p_align to
394         abi_pagesize, not common_pagesize.
395         (Layout::relaxation_loop_body): Similarly use abi_pagesize
396         to determine whether file header can go in segment.
397
398 2012-08-30  Alan Modra  <amodra@gmail.com>
399
400         * output.h (Output_reloc::Output_reloc <output section>): Add
401         is_relative param.  Adjust calls.
402         (Output_reloc::add_output_section_relative): New functions.
403         * output.cc (Output_reloc::Output_reloc <output section>): Handle
404         is_relative.
405         (Output_reloc::symbol_value): Handle SECTION_CODE.
406
407 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
408
409         * gold.cc (queue_middle_tasks): Call layout again when unique
410         segments for sections is desired.
411         * layout.cc (Layout::Layout): Initialize new members.
412         (Layout::get_output_section_flags): New function.
413         (Layout::choose_output_section): Call get_output_section_flags.
414         (Layout::layout): Make output section for mapping to a unique segment.
415         (Layout::insert_section_segment_map): New function.
416         (Layout::attach_allocated_section_to_segment): Make unique segment for
417         output sections marked so.
418         (Layout::segment_precedes): Check for unique segments when sorting.
419         * layout.h (Layout::Unique_segment_info): New struct.
420         (Layout::Section_segment_map): New typedef.
421         (Layout::insert_section_segment_map): New function.
422         (Layout::get_output_section_flags): New function.
423         (Layout::is_unique_segment_for_sections_specified): New function.
424         (Layout::set_unique_segment_for_sections_specified): New function.
425         (Layout::unique_segment_for_sections_specified_): New member.
426         (Layout::section_segment_map_): New member.
427         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
428         Rename is_gc_pass_one to is_pass_one.
429         Rename is_gc_pass_two to is_pass_two.
430         Rename is_gc_or_icf to is_two_pass.
431         Check for which pass based on whether symbols data is present.
432         Make it two pass when unique segments for sections is desired.
433         * output.cc (Output_section::Output_section): Initialize new
434         members.
435         * output.h (Output_section::is_unique_segment): New function.
436         (Output_section::set_is_unique_segment): New function.
437         (Output_section::is_unique_segment_): New member.
438         (Output_section::extra_segment_flags): New function.
439         (Output_section::set_extra_segment_flags): New function.
440         (Output_section::extra_segment_flags_): New member.
441         (Output_section::segment_alignment): New function.
442         (Output_section::set_segment_alignment): New function.
443         (Output_section::segment_alignment_): New member.
444         (Output_segment::Output_segment): Initialize is_unique_segment_.
445         (Output_segment::is_unique_segment): New function.
446         (Output_segment::set_is_unique_segment): New function.
447         (Output_segment::is_unique_segment_): New member.
448         * plugin.cc (allow_unique_segment_for_sections): New function.
449         (unique_segment_for_sections): New function.
450         (Plugin::load): Add new functions to transfer vector.
451         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
452         * Makefile.in: Regenerate.
453         * testsuite/plugin_final_layout.sh: Check if unique segment
454         functionality works.
455         * testsuite/plugin_section_order.c (onload): Check if new interfaces
456         are available.
457         (allow_unique_segment_for_sections): New global.
458         (unique_segment_for_sections): New global.
459         (claim_file_hook): Call allow_unique_segment_for_sections.
460         (all_symbols_read_hook): Call unique_segment_for_sections.
461
462 2012-08-22  Cary Coutant  <ccoutant@google.com>
463
464         * layout.cc (Layout::include_section): Don't assert on GROUP
465         sections with --emit-relocs.
466
467 2012-08-21  Cary Coutant  <ccoutant@google.com>
468
469         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
470         if --export-dynamic-symbol names an undef symbol.
471
472 2012-08-18  Alan Modra  <amodra@gmail.com>
473
474         * powerpc.cc: Formatting and white space.
475         (Powerpc_relobj): Rename got2_section_ to special_.
476         Add opd_ent_shndx_ and opd_ent_off_ vectors.
477         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
478         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
479         (Target_powerpc): Add Address typedef and invalid_address.  Use
480         throughout.
481         (Target_powerpc::is_branch_reloc): New function.
482         (Powerpc_relocate_functions): Add Address typedef, use throughout.
483         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
484         for dst_mask, value and addend.
485         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
486         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
487         (Output_data_glink::do_write): Correct toc base.  Don't try to use
488         uint16_t for 24-bit offset.  Use get_output_section_offset and
489         check return.
490         (Target_powerpc::Scan::local): Handle more relocs.
491         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
492         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
493         Plug in toc restoring insn after plt calls.  Translate branches
494         to function descriptor symbols to corresponding entry point.
495         (Target_powerpc::relocate_for_relocatable): Check return from
496         get_output_section_offset.
497         * symtab.h: Comment typo.
498
499 2012-08-14  Ian Lance Taylor  <iant@google.com>
500
501         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
502         unsupported_relocal_local to call unsupported_reloc_global.
503
504 2012-08-14  Nick Clifton  <nickc@redhat.com>
505
506         PR ld/14265
507         * script-sections.cc (Sections_element::output_section_name): Add
508         keep return parameter.
509         (Output_section_element::match_name): Add keep return parameter.
510         Return the value of the keep_ member.
511         * script-sections.h (class Output_section): Update
512         output_section_name prototype.
513         * layout.cc (Layout::keep_input_section): New public member
514         function.
515         (Layout::choose_output_section): Pass keep parameter to
516         output_section_name.
517         * layout.h (class Layout): Add keep_input_section.
518         * object.cc (Sized_relobj_file::do_layout): Check for kept input
519         sections.
520         * testsuite/Makefile.am: Add a test.
521         * testsuite/Makefile.in: Regenerate.
522         * testsuite/pr14265.c: Source file for the test.
523         * testsuite/pr14265.t: Linker script for the test.
524         * testsuite/pr14265.sh: Shell script for the test.
525
526 2012-08-14  Alan Modra  <amodra@gmail.com>
527
528         * target.h (Target::output_section_name): New function.
529         (Target::do_output_section_name): New function.
530         * layout.cc (Layout::choose_output_section): Call the above.
531         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
532
533 2012-08-14  Alan Modra  <amodra@gmail.com>
534
535         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
536         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
537         for replace_constant call.
538         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
539         (Output_data_glink::do_print_to_mapfile): New function.
540         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
541         (Target_powerpc::Relocate::relocate): Likewise.
542
543 2012-08-14  Alan Modra  <amodra@gmail.com>
544
545         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
546         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
547         (Output_data_glink::add_entry,find_entry): Remove shndx param.
548         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
549         all references to shndx_.  Handle special case for R_PPC_PLTREL24
550         here.
551         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
552         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
553         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
554         here.
555         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
556         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
557
558 2012-08-12  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
561         (glink insn constants): Use uint32_t.
562         (Output_data_glink::add_entry): Use insert, not [] operator.
563
564 2012-08-11  Alan Modra  <amodra@gmail.com>
565
566         * object.h (Sized_relobj_file::find_shdr): New function.
567         (Sized_relobj_file::find_special_sections): New function.
568         * object.cc (Sized_relobj_file::find_shdr): New function.
569         (Sized_relobj_file::find_eh_frame): Use find_shdr.
570         (Sized_relobj_file::find_special_sections): New function, split out..
571         (Sized_relobj_file::do_read_symbols): ..from here.
572         * output.h (Output_data_got::replace_constant): New function.
573         (Output_data_got::num_entries): New function.
574         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
575         (Output_data_got::got_offset): Protected rather than private.
576         (Output_data_got::replace_got_entry): New function.
577         * output.cc (Output_data_got::replace_got_entry): New function.
578         * powerpc.cc (class Powerpc_relobj): New.
579         (class Powerpc_relocate_functions): Delete all psymval variants or
580         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
581         Implement _ha functions using corresponding _hi function.
582         (Powerpc_relobj::find_special_sections): New function.
583         (Target_powerpc::do_make_elf_object): New function.
584         (class Output_data_got_powerpc): New.
585         (class Output_data_glink): New.
586         (class Powerpc_scan_relocatable_reloc): New.
587         Many more changes througout file.
588
589 2012-08-09  Nick Clifton  <nickc@redhat.com>
590
591         * po/vi.po: Updated Vietnamese translation.
592
593 2012-08-07  Ian Lance Taylor  <iant@google.com>
594
595         * layout.cc (Layout::add_target_dynamic_tags): If
596         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
597         plt_rel.
598
599 2012-07-30  Nick Clifton  <nickc@redhat.com>
600
601         * po/gold.pot: Updated template.
602         * po/es.po: Updated Spanish translation.
603
604 2012-07-18  Cary Coutant  <ccoutant@google.com>
605
606         PR gold/14344
607         * configure.ac: Add check for -gpubnames support.
608         * configure: Regenerate.
609         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
610         support; force -gno-pubnames.
611         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
612         support.
613         (gdb_index_test_4): New test.
614         * testsuite/Makefile.in: Regenerate.
615         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
616         * testsuite/gdb_index_test_2.sh: Likewise.
617         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
618         * testsuite/gdb_index_test_4.sh: New script.
619         * testsuite/gdb_index_test_comm.sh: New script with common code;
620         don't look for space after colon.
621
622 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
623
624         * gold.cc (queue_middle_tasks): Update function order only after
625         deferred objects due to plugins are processed.
626
627 2012-07-11  Ian Lance Taylor  <iant@google.com>
628
629         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
630         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
631         (Target_arm::scan_reloc_for_stub): Likewise.
632         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
633         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
634         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
635         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
636         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
637
638 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
639             Ian Lance Taylor  <iant@google.com>
640
641         PR gold/14309
642         * configure.ac: Test whether std::tr1::hash<off_t> works.
643         * gold.h: Add a specialization for std::tr1::hash<off_t> if
644         needed.
645         * output.h (class Output_fill): Add virtual destructor.
646         * configure, config.in: Rebuild.
647
648 2012-06-22  Roland McGrath  <mcgrathr@google.com>
649
650         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
651
652 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
653
654         * plugin.cc (Plugin::load): Handle position independent executables.
655
656 2012-06-06  Cary Coutant  <ccoutant@google.com>
657
658         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
659         add .debug_macro.
660         (lines_only_debug_sections): Likewise.
661         (gdb_fast_lookup_sections): New static array.
662         (is_gdb_debug_section): Rename formal parameter.
663         (is_lines_only_debug_section): Likewise.
664         (is_gdb_fast_lookup_section): New function.
665         (Layout::include_section): Check for ".zdebug_" prefix; pass
666         section name suffix to is_gdb_debug_section, et al.; check for
667         fast-lookup sections when building .gdb_index.
668         * options.h (--strip-debug-gdb): Update GDB version number.
669
670 2012-06-06  Cary Coutant  <ccoutant@google.com>
671
672         * configure.ac: Add check for fallocate.
673         * configure: Regenerate.
674         * config.in: Regenerate.
675
676         * options.h (class General_options): Add --mmap-output-file and
677         --posix-fallocate options.
678         * output.cc: (posix_fallocate): Remove; replace with...
679         (gold_fallocate): New function.
680         (Output_file::map_no_anonymous): Call gold_fallocate.
681         (Output_file::map): Check --mmap-output-file option.
682
683 2012-06-05  Jing Yu  <jingyu@google.com>
684
685         * gold.h (textdomain): Add do {} to empty while(0).
686         (bindtextdomain): Likewise.
687
688 2012-06-04  Cary Coutant  <ccoutant@google.com>
689
690         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
691         has_dynsym_index.
692
693 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
694
695         * symtab.cc (Symbol_table::define_special_symbol):
696         Initialize *poldsym to prevent uninitialized variable errors.
697
698 2012-05-23  Cary Coutant  <ccoutant@google.com>
699
700         * layout.cc (Layout::section_name_mapping): Add rules to handle
701         exact match on .data.rel.ro.local or .data.rel.ro.
702         (Layout::output_section_name): Check for exact matches.
703
704 2012-05-23  Cary Coutant  <ccoutant@google.com>
705
706         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
707         more carefully.
708
709 2012-05-22  Cary Coutant  <ccoutant@google.com>
710
711         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
712         object before exporting symbol.
713
714 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
715
716         * testsuite/tls_test.cc: Include "config.h" first.
717         * testsuite/tls_test_c.c: Likewise.
718
719 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
720             Nick Clifton  <nickc@redhat.com>
721
722         PR 14072
723         * configure.in: Add check that sysdep.h has been included before
724         any system header files.
725         * configure: Regenerate.
726         * config.in: Regenerate.
727
728 2012-05-14  Cary Coutant  <ccoutant@google.com>
729
730         * layout.cc (Layout::make_output_section): Mark .tdata section
731         as RELRO.
732         * testsuite/relro_test.cc: Add a TLS variable.
733
734 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
735
736         PR gold/14091
737         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
738         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
739         R_X86_64_64.
740
741 2012-05-08  Cary Coutant  <ccoutant@google.com>
742
743         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
744         (lines_only_debug_sections): Likewise.
745
746 2012-05-02  Roland McGrath  <mcgrathr@google.com>
747
748         * nacl.cc: New file.
749         * nacl.h: New file.
750         * Makefile.am (CCFILES, HFILES): Add them.
751         * Makefile.in: Regenerate.
752         * i386.cc (Output_data_plt_i386_nacl): New class.
753         (Output_data_plt_i386_nacl_exec): New class.
754         (Output_data_plt_i386_nacl_dyn): New class.
755         (Target_i386_nacl): New class.
756         (Target_selector_i386_nacl): New class.
757         (target_selector_i386): Use it instead of Target_selector_i386.
758         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
759         (Target_x86_64_nacl): New class.
760         (Target_selector_x86_64_nacl): New class.
761         (target_selector_x86_64, target_selector_x32): Use it instead of
762         Target_selector_x86_64.
763         * arm.cc (Output_data_plt_arm_nacl): New class.
764         (Target_arm_nacl): New class.
765         (Target_selector_arm_nacl): New class.
766         (target_selector_arm, target_selector_armbe): Use it instead of
767         Target_selector_arm.
768
769         * target-select.cc (select_target): Take new Input_file* and off_t
770         arguments, pass them on to recognize method of selector.
771         * object.cc (make_elf_sized_object): Update caller.
772         * parameters.cc (parameters_force_valid_target): Likewise.
773         * incremental.cc (make_sized_incremental_binary): Likewise.
774         * target-select.h: Update decl.
775         (Target_selector::recognize): Take new Input_file* argument,
776         pass it on to do_recognize.
777         (Target_selector::do_recognize): Take new Input_file* argument.
778         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
779         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
780         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
781         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
782
783         * target.h (Target::Target_info): New members isolate_execinstr
784         and rosegment_gap.
785         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
786         * arm.cc (Target_arm::arm_info): Update initializer.
787         * i386.cc (Target_i386::i386_info): Likewise.
788         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
789         * sparc.cc (Target_sparc::sparc_info): Likewise.
790         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
791         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
792         * layout.cc (Layout::attach_allocated_section_to_segment):
793         Take new const Target* argument.  If target->isolate_execinstr(), act
794         like --rosegment.
795         (Layout::find_first_load_seg): Take new const Target* argument;
796         if target->isolate_execinstr(), reject PF_X segments.
797         (Layout::relaxation_loop_body): Update caller.
798         (Layout::set_segment_offsets): If target->isolate_execinstr(),
799         reset file offset to zero when we hit LOAD_SEG, and then do a second
800         loop over the segments before LOAD_SEG to reassign offsets after
801         addresses have been determined.  Handle target->rosegment_gap().
802         (Layout::attach_section_to_segment): Take new const Target* argument;
803         pass it to attach_allocated_section_to_segment.
804         (Layout::make_output_section): Update caller.
805         (Layout::attach_sections_to_segments): Take new const Target* argument;
806         pass it to attach_section_to_segment.
807         * gold.cc (queue_middle_tasks): Update caller.
808         * layout.h (Layout): Update method decls with new arguments.
809
810         * arm.cc (Target_arm::Target_arm): Take optional argument for the
811         Target_info pointer to use.
812         (Target_arm::do_make_data_plt): New virtual method.
813         (Target_arm::make_data_plt): New method that calls it.
814         (Target_arm::make_plt_entry): Use it.
815         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
816         for the section alignment.
817         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
818         method.
819         (Output_data_plt_arm::first_plt_entry_offset): Call it.
820         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
821         method.
822         (Output_data_plt_arm::get_plt_entry_size): Call it.
823         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
824         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
825         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
826         method.
827         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
828         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
829         method instead of sizeof(plt_entry).
830         (Output_data_plt_arm::add_entry): Likewise.
831         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
832         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
833         than static method.
834         (Target_arm::plt_entry_size): Likewise.
835         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
836         Move to ...
837         (Output_data_plt_arm_standard): ... here, new class.
838         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
839         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
840         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
841
842         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
843         Take additional argument for the PLT entry size.
844         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
845         Use get_plt_entry_size method rather than plt_entry_size variable.
846         (Output_data_plt_x86_64::reserve_slot): Likewise.
847         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
848         (Output_data_plt_x86_64::add_entry): Likewise.
849         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
850         (Output_data_plt_x86_64::address_for_global): Likewise.
851         (Output_data_plt_x86_64::address_for_local): Likewise.
852         (Output_data_plt_x86_64::set_final_data_size): Likewise.
853         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
854         Make method non-static.
855         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
856         method.
857         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
858         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
859         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
860         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
861         virtual method.
862         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
863         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
864         virtual method.
865         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
866         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
867         virtual method.
868         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
869         (Output_data_plt_x86_64::plt_entry_size)
870         (Output_data_plt_x86_64::first_plt_entry)
871         (Output_data_plt_x86_64::plt_entry)
872         (Output_data_plt_x86_64::tlsdesc_plt_entry)
873         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
874         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
875         (Output_data_plt_x86_64_standard): ... here, new class.
876         (Target_x86_64::Target_x86_64): Take optional argument for the
877         Target_info pointer to use.
878         (Target_x86_64::do_make_data_plt): New virtual method.
879         (Target_x86_64::make_data_plt): New method to call it.
880         (Target_x86_64::init_got_plt_for_update): Use that.
881         Call this->plt_->add_eh_frame method here.
882         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
883         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
884         rather than static method.
885         (Target_x86_64::plt_entry_size): Likewise.
886         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
887         rather than plt_entry_size variable.  Move guts of PLT filling to...
888         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
889         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
890         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
891
892         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
893         additional argument for the section alignment.
894         Don't do add_eh_frame_for_plt here.
895         (Output_data_plt_i386::first_plt_entry_offset): Make the method
896         non-static.  Use get_plt_entry_size method rather than plt_entry_size
897         variable.
898         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
899         method.
900         (Output_data_plt_i386::get_plt_entry_size): Call it.
901         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
902         (Output_data_plt_i386::add_eh_frame): New method to call it.
903         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
904         method.
905         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
906         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
907         method.
908         (Output_data_plt_i386::fill_plt_entry): New method to call it.
909         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
910         method instead of plt_entry_size.
911         (Output_data_plt_i386::plt_entry_size)
912         (Output_data_plt_i386::plt_eh_frame_fde_size)
913         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
914         (Output_data_plt_i386_standard): ... here, new class.
915         (Output_data_plt_i386_exec): New class.
916         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
917         (Output_data_plt_i386_exec::first_plt_entry): ... here.
918         (Output_data_plt_i386::exec_plt_entry): Move to ...
919         (Output_data_plt_i386_exec::plt_entry): ... here.
920         (Output_data_plt_i386_dyn): New class.
921         (Output_data_plt_i386::first_plt_entry): Move to ...
922         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
923         (Output_data_plt_i386::dyn_plt_entry): Move to ...
924         (Output_data_plt_i386_dyn::plt_entry): ... here.
925         (Target_i386::Target_i386): Take optional argument for the Target_info
926         pointer to use.
927         (Target_i386::do_make_data_plt): New virtual method.
928         (Target_i386::make_data_plt): New method to call it.
929         (Target_i386::make_plt_section): Use that.
930         Call this->plt_->add_eh_frame method here.
931         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
932         rather than plt_entry_size variable.
933         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
934         (Output_data_plt_i386::address_for_local): Likewise.
935         (Output_data_plt_i386::do_write): Likewise.
936         Move guts of PLT filling to...
937         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
938         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
939         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
940         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
941
942 2012-05-01  Cary Coutant  <ccoutant@google.com>
943
944         * dwarf_reader.cc (Dwarf_die::read_attributes)
945         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
946         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
947         * reduced_debug_output.cc
948         (Output_reduced_debug_info_section::get_die_end): Remove
949         DW_FORM_GNU_ref_index.  Add default case.
950
951 2012-04-26  Mark Wielaard  <mjw@redhat.com>
952
953         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
954         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
955         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
956         DW_AT_high_pc as offset from DW_AT_low_pc.
957
958         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
959         * testsuite/Makefile.in: Regenerate.
960         * testsuite/gdb_index_test_3.c: New test source file.
961         * testsuite/gdb_index_test_3.sh: New test source file.
962
963 2012-04-25  Ian Lance Taylor  <iant@google.com>
964
965         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
966         pointer.
967         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
968         as a class, not a struct.
969         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
970         (Target_arm::apply_cortex_a8_workaround): Likewise.
971         * gc.h: Declare Reloc_types as a struct, not a class.
972         * object.h: Declare Symbols_data as a struct.
973         * reloc.h: Declare Read_relocs_data as a struct.
974         * target.h: Declare Relocate_info as a struct.
975
976 2012-04-24  David S. Miller  <davem@davemloft.net>
977
978         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
979         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
980         and R_SPARC_WPLT30.
981
982 2012-04-24  Cary Coutant  <ccoutant@google.com>
983
984         * incremental-dump.cc (find_input_containing_global): Replace
985         magic number with symbolic constant.
986         (dump_incremental_inputs): Update version number.
987         * incremental.cc (Output_section_incremental_inputs): Update version
988         number; import symbolic constants from Incremental_inputs_reader.
989         (Incremental_inputs::create_data_sections): Align relocations
990         section correctly for 64-bit targets.
991         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
992         constants; add padding.
993         (Output_section_incremental_inputs::write_header): Add assert for
994         header_size.
995         (Output_section_incremental_inputs::write_input_files): Add assert
996         for input_entry_size.
997         (Output_section_incremental_inputs::write_info_blocks): Add padding;
998         add assert for object_info_size, input_section_entry_size,
999         global_sym_entry_size.
1000         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1001         for data structure sizes; use them.
1002         (Incremental_input_entry_reader): Import symbolic constants from
1003         Incremental_inputs_reader; use them.
1004
1005 2012-04-23  David S. Miller  <davem@davemloft.net>
1006
1007         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1008         and elf_flags_set_.
1009         (Target_sparc::Target_sparc): Initialize new fields.
1010         (Target_sparc::do_make_elf_object): New function.
1011         (Target_sparc::do_adjust_elf_header): New function.
1012
1013 2012-04-23  Cary Coutant  <ccoutant@google.com>
1014
1015         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1016         CU range table of gdb index.
1017
1018 2012-04-20  David S. Miller  <davem@davemloft.net>
1019
1020         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1021         instead of false.
1022
1023 2012-04-16  David S. Miller  <davem@davemloft.net>
1024
1025         * sparc.cc (Target_sparc::got_address): New function.
1026         (Sparc_relocate_functions::gdop_hix22): New function.
1027         (Sparc_relocate_functions::gdop_lox10): New function.
1028         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1029         relocs.
1030         (Target_sparc::Scan::local): Likewise if the global symbol is not
1031         preemptible and is not IFUNC.
1032         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1033         transformations for local and non-preemptible non-IFUNC global
1034         symbols.
1035
1036         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1037         writing out 64-bit part of ranges.
1038
1039         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1040         -fpic and -fpie respectively.
1041         * Makefile.in: Regenerate.
1042
1043         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1044         (Target_sparc::Target_sparc): Initialize new field.
1045         (Target_sparc::do_plt_section_for_global): New function.
1046         (Target_sparc::do_plt_section_for_local): New function.
1047         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1048         (Target_sparc::make_plt_section): New function, broken out of
1049         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1050         (Target_sparc::make_plt_entry): Call make_plt_section.
1051         (Target_sparc::make_local_ifunc_plt_entry): New function.
1052         (Target_sparc::rela_ifunc_section): New function.
1053         (Target_sparc::plt_section): Remove const.
1054         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1055         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1056         and ifunc_count_ fields.
1057         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1058         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1059         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1060         (Output_data_plt_sparc::rela_ifunc): New function.
1061         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1062         (Output_data_plt_sparc::has_ifunc_section): New function.
1063         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1064         (Output_data_plt_sparc::address_for_global): New function.
1065         (Output_data_plt_sparc::address_for_local): New function.
1066         (Output_data_plt_sparc::plt_index_to_offset): New function.
1067         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1068         and entry_count.
1069         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1070         entry_count.
1071         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1072         R_SPARC_JMP_IREL to switch.
1073         (Target_sparc::Scan::check_non_pic): Likewise.
1074         (Target_sparc::Scan::local): Handle IFUNC symbols.
1075         (Target_sparc::Scan::local): Likewise.
1076         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1077         and plt_address_for_local.
1078         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1079         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1080
1081         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1082         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1083         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1084         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1085         global relocs too.
1086         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1087         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1088         calls.
1089         * sparc.cc (Target_sparc::Scan::global): Likewise.
1090         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1091
1092 2012-04-16  Cary Coutant  <ccoutant@google.com>
1093
1094         * archive.cc (Library_base::should_include_member): Check for
1095         --export-dynamic-symbol.
1096         * options.h (class General_options): Add --export-dynamic-symbol.
1097         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1098         --export-dynamic-symbol.
1099         (Symbol_table::gc_mark_undef_symbols): Likewise.
1100         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1101
1102 2012-04-12  David S. Miller  <davem@davemloft.net>
1103
1104         * sparc.cc (Reloc::wdisp10): New relocation method.
1105         (Reloc::h34): Likewise.
1106         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1107         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1108         R_SPARC_WDISP10.
1109         (Target_sparc::Scan::local): Likewise.
1110         (Target_sparc::Scan::global): Likewise.
1111         (Target_sparc::Relocate::relocate): Likewise.
1112
1113 2012-04-09  Cary Coutant  <ccoutant@google.com>
1114
1115         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1116         low_pc == 0.
1117
1118 2012-04-06  Ian Lance Taylor  <iant@google.com>
1119
1120         * timer.cc: #include <unistd.h>.
1121
1122 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1123
1124         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1125         * config.in: Regenerate.
1126         * configure: Regenerate.
1127
1128 2012-04-05  Nick Clifton  <nickc@redhat.com>
1129
1130         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1131         (AM_LC_MESSAGES): Add.
1132         * aclocal.m4: Regenerate.
1133         * config.in: Regenerate.
1134         * configure: Regenerate.
1135
1136 2012-03-21  Cary Coutant  <ccoutant@google.com>
1137
1138         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1139         * Makefile.in: Regenerate.
1140         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1141         (Sized_elf_reloc_mapper::symbol_section): New function.
1142         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1143         (make_elf_reloc_mapper): New function.
1144         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1145         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1146         (Dwarf_abbrev_table::do_get_abbrev): New function.
1147         (Dwarf_ranges_table::read_ranges_table): New function.
1148         (Dwarf_ranges_table::read_range_list): New function.
1149         (Dwarf_pubnames_table::read_section): New function.
1150         (Dwarf_pubnames_table::read_header): New function.
1151         (Dwarf_pubnames_table::next_name): New function.
1152         (Dwarf_die::Dwarf_die): New function.
1153         (Dwarf_die::read_attributes): New function.
1154         (Dwarf_die::skip_attributes): New function.
1155         (Dwarf_die::set_name): New function.
1156         (Dwarf_die::set_linkage_name): New function.
1157         (Dwarf_die::attribute): New function.
1158         (Dwarf_die::string_attribute): New function.
1159         (Dwarf_die::int_attribute): New function.
1160         (Dwarf_die::uint_attribute): New function.
1161         (Dwarf_die::ref_attribute): New function.
1162         (Dwarf_die::child_offset): New function.
1163         (Dwarf_die::sibling_offset): New function.
1164         (Dwarf_info_reader::check_buffer): New function.
1165         (Dwarf_info_reader::parse): New function.
1166         (Dwarf_info_reader::do_parse): New function.
1167         (Dwarf_info_reader::do_read_string_table): New function.
1168         (Dwarf_info_reader::lookup_reloc): New function.
1169         (Dwarf_info_reader::get_string): New function.
1170         (Dwarf_info_reader::visit_compilation_unit): New function.
1171         (Dwarf_info_reader::visit_type_unit): New function.
1172         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1173         Sized_elf_reloc_mapper.
1174         (Sized_dwarf_line_info::symbol_section): Remove function.
1175         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1176         (Sized_dwarf_line_info::read_line_mappings): Remove object
1177         parameter, adjust callers.
1178         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1179         * dwarf_reader.h: Include <sys/types.h>.
1180         (class Track_relocs): Remove forward declaration.
1181         (class Elf_reloc_mapper): New class.
1182         (class Sized_elf_reloc_mapper): New class.
1183         (class Dwarf_abbrev_table): New class.
1184         (class Dwarf_range_list): New class.
1185         (class Dwarf_ranges_table): New class.
1186         (class Dwarf_pubnames_table): New class.
1187         (class Dwarf_die): New class.
1188         (class Dwarf_info_reader): New class.
1189         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1190         (Sized_dwarf_line_info::symbol_section): Remove member function.
1191         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1192         base class.
1193         * gdb-index.cc: New source file.
1194         * gdb-index.h: New source file.
1195         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1196         and .debug_types sections, call Layout::add_to_gdb_index.
1197         (Sized_relobj_incr::do_section_name): Implement.
1198         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1199         return type; Implement.
1200         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1201         return type.
1202         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1203         parameter list and return type.
1204         (Sized_incr_dynobj::do_section_contents): Likewise.
1205         * layout.cc: Include gdb-index.h.
1206         (Layout::Layout): Initialize gdb_index_data_.
1207         (Layout::init_fixed_output_section): Check for .gdb_index section.
1208         (Layout::add_to_gdb_index): New function. Instantiate.
1209         * layout.h: Add forward declaration for class Gdb_index.
1210         (Layout::add_to_gdb_index): New member function.
1211         (Layout::gdb_index_data_): New data member.
1212         * main.cc: Include gdb-index.h.
1213         (main): Print statistics for gdb index.
1214         * object.cc (Object::section_contents): Move code into
1215         do_section_contents.
1216         (need_decompressed_section): Check for sections needed when building
1217         gdb index.
1218         (build_compressed_section_map): Likewise.
1219         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1220         gdb index.
1221         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1222         sections; call Layout::add_to_gdb_index.
1223         (Sized_relobj_file::do_decompressed_section_contents): Call
1224         do_section_contents directly.
1225         * object.h (Object::do_section_contents): Adjust parameter list and
1226         return type.
1227         (Object::do_decompressed_section_contents): Call do_section_contents
1228         directly.
1229         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1230         return type.
1231         * options.h (class General_options): Add --gdb-index option.
1232         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1233         list and return type.
1234         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1235         * reloc.h (Track_relocs::checkpoint): New function.
1236         (Track_relocs::reset): New function.
1237
1238         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1239         New test cases.
1240         * testsuite/Makefile.in: Regenerate.
1241         * testsuite/gdb_index_test.cc: New test source file.
1242         * testsuite/gdb_index_test_1.sh: New test source file.
1243         * testsuite/gdb_index_test_2.sh: New test source file.
1244
1245 2012-03-19  Doug Kwan  <dougkwan@google.com>
1246
1247         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1248         (Target_arm::do_finalize_sections): Remove code which defines
1249         __exidx_start and __exidx_end.  Make symbol table parameter
1250         anonymous as it is not used.
1251         * gold.cc (queue_middle_tasks): Call target hook to define any
1252         target-specific symbols.
1253         * target.h (Target::define_standard_symbols): New method.
1254         (Target::do_define_standard_symbols): Same.
1255         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1256         * testsuite/Makefile.in: Regenerate.
1257         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1258         and __exidx_end.
1259         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1260         relocations are generated for __exidx_start and __exidx_end.
1261
1262 2012-03-16  Doug Kwan  <dougkwan@google.com>
1263
1264         * testsuite/Makefile.am: Disable test initpri3b.
1265         * testsuite/Makefile.in: Regenerate.
1266
1267 2012-03-15  Doug Kwan  <dougkwan@google.com>
1268
1269         * arm.cc (Target_arm::got_section): Make .got section read-only
1270         if -z now is given.
1271
1272 2012-03-15  Ian Lance Taylor  <iant@google.com>
1273
1274         PR gold/13850
1275         * layout.cc (Layout::make_output_section): Correctly mark
1276         SHT_INIT_ARRAY, et. al., as relro.
1277
1278 2012-03-14  Doug Kwan  <dougkwan@google.com>
1279
1280         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1281         dynamic relocations for protected symbols in shared objects.
1282
1283 2012-03-13  Ian Lance Taylor  <iant@google.com>
1284
1285         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1286         keep the larger alignment.
1287
1288 2012-03-12  Cary Coutant  <ccoutant@google.com>
1289
1290         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1291         handling of DW_LNE_define_file.
1292
1293 2012-03-12  Cary Coutant  <ccoutant@google.com>
1294
1295         * reduced_debug_output.cc
1296         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1297         codes to switch.
1298
1299 2012-02-29  Cary Coutant  <ccoutant@google.com>
1300
1301         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1302
1303 2012-02-29  Cary Coutant  <ccoutant@google.com>
1304
1305         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1306         Call Object::decompressed_section_contents.
1307         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1308         New dtor.
1309         (Sized_dwarf_line_info::buffer_start_): New data member.
1310         * merge.cc (Output_merge_data::do_add_input_section): Call
1311         Object::decompressed_section_contents.
1312         (Output_merge_string::do_add_input_section): Likewise.
1313         * object.cc (need_decompressed_section): New function.
1314         (build_compressed_section_map): Decompress sections needed later.
1315         (Sized_relobj_file::do_decompressed_section_contents): New function.
1316         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1317         * object.h (Object::decompressed_section_contents): New function.
1318         (Object::discard_decompressed_sections): New function.
1319         (Object::do_decompressed_section_contents): New function.
1320         (Object::do_discard_decompressed_sections): New function.
1321         (Compressed_section_info): New type.
1322         (Compressed_section_map): Include decompressed section contents.
1323         (Sized_relobj_file::do_decompressed_section_contents): New function.
1324         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1325
1326 2012-02-16  Cary Coutant  <ccoutant@google.com>
1327
1328         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1329         * testsuite/Makefile.in: Regenerate.
1330
1331 2012-02-14  Cary Coutant  <ccoutant@google.com>
1332
1333         * options.cc (General_options::finalize): Disallow -pie and -static.
1334
1335 2012-02-03  Doug Kwan  <dougkwan@google.com>
1336
1337         * arm.cc (Arm_relocate_functions::abs8,
1338         Arm_relocate_functions::abs16): Use
1339         Bits::has_signed_unsigned_overflow32.
1340         (Arm_relocate_functions::thm_abs8): Correct range of
1341         overflow check.
1342         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1343         in assertions.
1344
1345 2012-02-02  Doug Kwan  <dougkwan@google.com>
1346
1347         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1348         position independent outputs, not just shared objects.
1349
1350 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1351
1352         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1353         * configure: Regenerated.
1354
1355 2012-01-27  Ian Lance Taylor  <iant@google.com>
1356
1357         * reloc.h (Bits): New class with static functions, copied from
1358         namespace utils in arm.cc.
1359         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1360         instead.
1361
1362 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1363
1364         * incremental.cc (write_info_blocks): Correct relocation offset.
1365
1366 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1367
1368         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1369         (Relocate::tls_gd_to_le): Likewise.
1370
1371 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1372
1373         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1374
1375 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1376
1377         * configure.ac: Check if -mcmodel=medium works.
1378         * configure: Regenerated.
1379
1380 2012-01-24  Cary Coutant  <ccoutant@google.com>
1381
1382         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1383         definition and ...
1384         (read_unsigned_LEB_128_x): ... this new function.
1385         (read_signed_LEB_128): Replaced with inline definition and ...
1386         (read_signed_LEB_128_x): ... this new function.
1387         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1388         (read_unsigned_LEB_128): Add inline definition.
1389         (read_signed_LEB_128_x): New function.
1390         (read_signed_LEB_128): Add inline definition.
1391         * testsuite/Makefile.am (leb128_unittest): New unit test.
1392         * testsuite/Makefile.in: Regenerate.
1393         * testsuite/leb128_unittest.cc: New unit test.
1394
1395 2012-01-23  Ian Lance Taylor  <iant@google.com>
1396
1397         PR gold/13617
1398         * i386.cc (Target_i386::do_code_fill): When using a jmp
1399         instruction, pad with nop instructions.
1400         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1401
1402 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1403
1404         * x86_64.cc (gc_process_relocs): Add typename on types used in
1405         template.
1406         (scan_relocs): Likewise.
1407         (relocate_section): Likewise.
1408         (apply_relocation): Likewise.
1409
1410 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1411
1412         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1413         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1414         under x32.
1415
1416 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1417
1418         * x86_64.cc: Initial support for x32.
1419
1420 2012-01-03  Cary Coutant  <ccoutant@google.com>
1421
1422         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1423         Use abstract base class for GOT.
1424         * gold/output.h (class Output_data_got_base): New abstract base class.
1425         (class Output_data_got): Derive from new base class, adjust ctors.
1426         (Output_data_got::reserve_slot): Make virtual; rename to
1427         do_reserve_slot; Adjust callers.
1428         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1429         pointer to abstract base class.
1430         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1431
1432 2011-12-18  Ian Lance Taylor  <iant@google.com>
1433
1434         * object.h (Relobj::local_symbol_value): New function.
1435         (Relobj::local_plt_offset): New function.
1436         (Relobj::local_has_got_offset): New function.
1437         (Relobj::local_got_offset): New function.
1438         (Relobj::set_local_got_offset): New function.
1439         (Relobj::do_local_symbol_value): New pure virtual function.
1440         (Relobj::do_local_plt_offset): Likewise.
1441         (Relobj::do_local_has_got_offset): Likewise.
1442         (Relobj::do_local_got_offset): Likewise.
1443         (Relobj::do_set_local_got_offset): Likewise.
1444         (Sized_relobj::do_local_has_got_offset): Rename from
1445         local_has_got_offset.
1446         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1447         (Sized_relobj::do_set_local_got_offset): Rename from
1448         set_local_got_offset.
1449         (Sized_relobj_file::do_local_plt_offset): Rename from
1450         local_plt_offset.
1451         (Sized_relobj_file::do_local_symbol_value): New function.
1452         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1453         local_plt_offset.
1454         * output.cc (Output_data_got::Got_entry::write): Change object to
1455         Relobj.  Use local_symbol_value.
1456         (Output_data_got::add_global_with_rel): Change rel_dyn to
1457         Output_data_reloc_generic*.  Use add_global_generic.
1458         (Output_data_got::add_global_with_rela): Remove.  Change all
1459         callers to use add_global_with_rel.
1460         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1461         Output_data_reloc_generic*.  Use add_global_generic.
1462         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1463         callers to use add_global_pair_with_rel.
1464         (Output_data_got::add_local): Change object to Relobj*.
1465         (Output_data_got::add_local_plt): Likewise.
1466         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1467         change rel_dyn to Output_data_reloc_generic*.  Use
1468         add_local_generic.
1469         (Output_data_got::add_local_with_rela): Remove.  Change all
1470         callers to use all_local_with_rel.
1471         (Output_data_got::add_local_pair_with_rel): Change object to
1472         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1473         add_output_section_generic.
1474         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1475         callers to use add_local_pair_with_rel.
1476         (Output_data_got::reserve_local): Change object to Relobj*.
1477         * output.h: (class Output_data_reloc_generic): Add pure virtual
1478         declarations for add_global_generic, add_local_generic,
1479         add_output_section_generic.
1480         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1481         functions for Output_data_reloc_generic.  Update declarations for
1482         changes listed in output.cc.
1483         (class Output_data_got): Change template parameter to got_size.
1484         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1485         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1486         function.
1487         (Sized_relobj_incr::do_local_plt_offset): New function.
1488         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1489         add_global_generic.
1490
1491 2011-12-17  Cary Coutant  <ccoutant@google.com>
1492
1493         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1494         * resolve.cc (Symbol_table::resolve): Likewise.
1495         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1496         arrays.
1497         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1498
1499 2011-12-16  Ian Lance Taylor  <iant@google.com>
1500
1501         * output.h (Output_data_reloc_generic::add): Only call
1502         add_dynamic_reloc if this is a dynamic reloc section.
1503
1504 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1505
1506         PR gold/13505
1507         * target-reloc.h (apply_relocation): Replace <64, false> with
1508         <size, big_endian>.
1509
1510 2011-11-25  Nick Clifton  <nickc@redhat.com>
1511
1512         * po/it.po: New Italian translation.
1513
1514 2011-11-17  Sterling Augustine  <saugustine@google.com>
1515
1516         * script.cc (script_include_directive): Implement.
1517         (read_script_file): New local variables name and search_path. Update
1518         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1519         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1520         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1521
1522 2011-11-11  Sterling Augustine  <saugustine@google.com>
1523
1524         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1525         (file_or_sections_cmd): Likewise.
1526
1527 2011-11-11  Doug Kwan  <dougkwan@google.com>
1528
1529         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1530         if --just-symbols is given.
1531
1532 2011-11-10  Doug Kwan  <dougkwan@google.com>
1533
1534         PR gold/13362
1535         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1536         when processing data relocs.
1537         * reloc.h (Relocate_functions::rel_unaligned): New method.
1538         (Relocate_functions::pcrel_unaligned): Ditto.
1539         (Relocate_functions::rel32_unaligned): Ditto.
1540         (Relocate_functions::pcrel32_unaligned): Ditto.
1541
1542 2011-11-09  Doug Kwan  <dougkwan@google.com>
1543
1544         PR gold/13362
1545         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1546         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1547         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1548         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1549         (Relocate_functions::rel_unaligned): New.
1550         (Relocate_functions::rel32_unaligned): New.
1551         * target-reloc.h (relocate_for_relocatable): Add code to handle
1552         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1553         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1554         arm_unaligned_reloc_r): New targets.
1555         * testsuite/Makefile.in: Regenerate.
1556         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1557         linking.
1558
1559 2011-11-02  Ian Lance Taylor  <iant@google.com>
1560
1561         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1562         NATIVE_LINKER.
1563         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1564         * options.cc (General_options::finalize): Use library search path
1565         from configure script if specified.  If not native and no sysroot,
1566         only search TOOLLIBDIR.
1567         * options.h (Search_directory::Search_directory): Change name to
1568         const std::string&.
1569         (General_options::add_to_library_path_with_sysroot): Change arg to
1570         const std::string&.
1571         * configure, Makefile.in, config.in: Rebuild.
1572
1573 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1574
1575         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1576         we are working around the ARM1176 Erratum.
1577         * options.h (General_options::fix_arm1176): Add option.
1578         * testsuite/Makefile.am: Add testcases, and keep current ones
1579         working.
1580         * testsuite/Makefile.in: Regenerate.
1581         * testsuite/arm_fix_1176.s: New file.
1582         * testsuite/arm_fix_1176.sh: Likewise.
1583
1584 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1585
1586         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1587         may_use_blx_.
1588         (Target_arm::may_use_blx): Remove method.
1589         (Target_arm::set_may_use_blx): Likewise.
1590         (Target_arm::may_use_v4t_interworking): New method.
1591         (Target_arm::may_use_v5t_interworking): Likewise.
1592         (Target_arm::may_use_blx_): Remove member variable.
1593         (Arm_relocate_functions::arm_branch_common): Check for v5T
1594         interworking.
1595         (Arm_relocate_functions::thumb_branch_common): Likewise.
1596         (Reloc_stub::stub_type_for_reloc): Likewise.
1597         (Target_arm::do_finalize_sections): Correct interworking checks.
1598         * testsuite/Makefile.am: Add new tests.
1599         * testsuite/Makefile.in: Regenerate.
1600         * testsuite/arm_farcall_arm_arm.s: New test.
1601         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1602         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1603         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1604         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1605         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1606         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1607         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1608
1609 2011-10-31  Cary Coutant  <ccoutant@google.com>
1610
1611         PR gold/13023
1612         * expression.cc (Expression::eval_with_dot): Add
1613         is_section_dot_assignment parameter.
1614         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1615         absolute and assigning to dot within a section.
1616         * script-sections.cc
1617         (Output_section_element_assignment::set_section_addresses): Pass
1618         dot_section to set_if_absolute.
1619         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1620         as is_section_dot_assignment flag to eval_with_dot.
1621         (Output_section_element_dot_assignment::set_section_addresses):
1622         Likewise.
1623         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1624         parameter.  Also set value if relative to dot_section; set the
1625         symbol's output_section.
1626         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1627         parameter.  Adjust all callers.
1628         (Expression::eval_maybe_dot): Likewise.
1629         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1630         Adjust all callers.
1631         * testsuite/script_test_2.t: Test assignment of an absolute value
1632         to dot within an output section element.
1633
1634 2011-10-31  Cary Coutant  <ccoutant@google.com>
1635
1636         * options.h (class General_options): Add --[no-]gnu-unique options.
1637         * symtab.cc (Symbol_table::sized_write_globals): Convert
1638         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1639
1640 2011-10-31  Cary Coutant  <ccoutant@google.com>
1641
1642         PR gold/13359
1643         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1644         unnecessary assertion.
1645         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1646
1647 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1648
1649         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1650         gc_mark_symbol.
1651         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1652         gc_mark_symbol.
1653         Change to just keep the section associated with symbol.
1654         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1655         they are externally visible and --export-dynamic is turned on.
1656         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1657
1658 2011-10-19  Ian Lance Taylor  <iant@google.com>
1659
1660         PR gold/13163
1661         * script-sections.cc
1662         (Output_section_element_dot_assignment::needs_output_section): New
1663         function.
1664
1665 2011-10-19  Ian Lance Taylor  <iant@google.com>
1666
1667         PR gold/13204
1668         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1669         --section-start option was seen.
1670         * options.h (General_options::any_section_start): New function.
1671
1672 2011-10-18  David S. Miller  <davem@davemloft.net>
1673
1674         PR binutils/13301
1675         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1676         member to track relocation locations that have moved during TLS
1677         reloc optimizations.
1678         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1679         (Target_sparc::Relocate::relocate): Adjust view down by 4
1680         bytes if it matches reloc_adjust_addr_.
1681         (Target_sparc::Relocate::relocate_tls): Always move the
1682         __tls_get_addr call delay slot instruction forward 4 bytes when
1683         performing relaxation.
1684
1685 2011-10-18  Cary Coutant  <ccoutant@google.com>
1686
1687         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1688         (Output_file::map_no_anonymous): Check for non-zero
1689         return code from posix_fallocate.
1690
1691 2011-10-17  Cary Coutant  <ccoutant@google.com>
1692
1693         PR gold/13245
1694         * plugin.cc (is_visible_from_outside): Check for symbols
1695         referenced from dynamic objects.
1696         * resolve.cc (Symbol_table::resolve): Don't count references
1697         from dynamic objects as references from real ELF files.
1698         * testsuite/plugin_test_2.sh: Adjust expected result.
1699
1700 2011-10-17  Cary Coutant  <ccoutant@google.com>
1701
1702         * gold.cc: Include timer.h.
1703         (queue_middle_tasks): Stamp time.
1704         (queue_final_tasks): Likewise.
1705         * main.cc (main): Store timer in parameters.  Print timers
1706         for each pass.
1707         * parameters.cc (Parameters::Parameters): Initialize timer_.
1708         (Parameters::set_timer): New function.
1709         (set_parameters_timer): New function.
1710         * parameters.h (Parameters::set_timer): New function.
1711         (Parameters::timer): New function.
1712         (Parameters::timer_): New data member.
1713         (set_parameters_timer): New function.
1714         * timer.cc (Timer::stamp): New function.
1715         (Timer::get_pass_time): New function.
1716         * timer.h (Timer::stamp): New function.
1717         (Timer::get_pass_time): New function.
1718         (Timer::pass_times_): New data member.
1719
1720 2011-10-17  Cary Coutant  <ccoutant@google.com>
1721
1722         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1723         task for members of lib groups.
1724
1725 2011-10-17  Cary Coutant  <ccoutant@google.com>
1726
1727         PR gold/13288
1728         * fileread.cc (File_read::find_view): Add assert.
1729         (File_read::make_view): Move bounds check (replace with assert)...
1730         (File_read::find_or_make_view): ... to here.
1731
1732 2011-10-12  Cary Coutant  <ccoutant@google.com>
1733
1734         * output.cc (Output_file::open_base_file): Handle case where
1735         ::read returns less than requested size.
1736
1737 2011-10-10  Cary Coutant  <ccoutant@google.com>
1738
1739         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1740         Initialize defined_count_.
1741         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1742         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1743         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1744         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1745         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1746         * incremental.h (Sized_relobj_incr::defined_count_): New data
1747         member.
1748         (Sized_incr_dynobj::defined_count_): New data member.
1749         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1750         Return zeroes instead of internal error.
1751
1752 2011-10-10  Cary Coutant  <ccoutant@google.com>
1753
1754         PR gold/13249
1755         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1756         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1757         * output.h (class Output_reloc): Add use_plt_offset flag.
1758         (Output_reloc::type_): Adjust size of bit field.
1759         (Output_reloc::use_plt_offset_): New bit field.
1760         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1761         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1762         flag.  Adjust all callers.
1763         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1764         creating RELATIVE relocations.
1765
1766 2011-10-10  Nick Clifton  <nickc@redhat.com>
1767
1768         * po/es.po: Updated Spanish translation.
1769         * po/fi.po: Updated Finnish translation.
1770
1771 2011-10-03   Diego Novillo  <dnovillo@google.com>
1772
1773         * options.cc (parse_uint): Fix dereference of RETVAL.
1774
1775 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1776
1777         * layout.h (section_order_map_): New member.
1778         (get_section_order_map): New member function.
1779         * output.cc (Output_section::add_input_section): Check for patterns
1780         only when --section-ordering-file is specified.
1781         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1782         output_sections have been formed.
1783         * layout.cc (Layout_Layout): Initialize section_order_map_.
1784         * plugin.cc (update_section_order): Store order in order_map. Do not
1785         update the order.
1786         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1787         * testsuite/Makefile.in: Regenerate.
1788         * testsuite/plugin_section_order.c: New file.
1789         * testsuite/plugin_final_layout.cc: New file.
1790         * testsuite/plugin_final_layout.sh: New file.
1791
1792 2011-09-29  Cary Coutant  <ccoutant@google.com>
1793
1794         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1795         Check for NULL.
1796         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1797         symbols during incremental update.
1798         (Symbol_table::add_from_dynobj): Likewise.
1799
1800 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1801             Ian Lance Taylor  <iant@google.com>
1802
1803         * symtab.cc (Symbol_table::define_special_symbol): Always
1804         canonicalize version string.
1805
1806 2011-09-26  Cary Coutant  <ccoutant@google.com>
1807
1808         * gold.cc (queue_initial_tasks): Move option checks ...
1809         * options.cc (General_options::finalize): ... to here. Disable
1810         some options; make others fatal.
1811
1812 2011-09-26  Cary Coutant  <ccoutant@google.com>
1813
1814         gcc PR lto/47247
1815         * plugin.cc (get_symbols_v2): New function.
1816         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1817         (is_referenced_from_outside): New function.
1818         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1819         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1820         (get_symbols): Pass version parameter.
1821         (get_symbols_v2): New function.
1822         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1823         parameter.
1824         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1825         (onload): Add LDPT_GET_SYMBOLS_V2.
1826         (all_symbols_read_hook): Use get_symbols_v2; check for
1827         LDPR_PREVAILING_DEF_IRONLY_EXP.
1828         * testsuite/plugin_test_3.sh: Update expected results.
1829
1830 2011-09-23  Simon Baldwin  <simonb@google.com>
1831
1832         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1833         configuration options.
1834         * configure: Regenerate.
1835         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1836         * Makefile.in: Regenerate.
1837         * testsuite/Makefile.in: Regenerate.
1838
1839 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1840
1841         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1842
1843 2011-09-19  Cary Coutant  <ccoutant@google.com>
1844
1845         * incremental.cc (can_incremental_update): Fix typo in comment.
1846         * incremental.h (can_incremental_update): Likewise.
1847
1848 2011-09-18  Cary Coutant  <ccoutant@google.com>
1849
1850         * incremental.cc (can_incremental_update): New function.
1851         * incremental.h (can_incremental_update): New function.
1852         * layout.cc (Layout::init_fixed_output_section): Call it.
1853         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1854         * object.cc (Sized_relobj_file::do_layout): Call
1855         can_incremental_update.
1856
1857 2011-09-13  Cary Coutant  <ccoutant@google.com>
1858
1859         * configure.ac: Check for glibc support for gnu_indirect_function
1860         support with static linking, setting automake conditional
1861         IFUNC_STATIC.
1862         * Makefile.in: Regenerate.
1863         * configure: Regenerate.
1864
1865         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1866         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1867         for IFUNC_STATIC.
1868         * testsuite/Makefile.in: Regenerate.
1869
1870 2011-09-13  Cary Coutant  <ccoutant@google.com>
1871
1872         * incremental.cc (Sized_relobj_incr::do_layout): Call
1873         report_comdat_group for kept comdat sections.
1874         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1875         * testsuite/Makefile.in: Regenerate.
1876         * testsuite/incr_comdat_test_1.cc: New source file.
1877         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1878         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1879         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1880
1881 2011-09-13  Ian Lance Taylor  <iant@google.com>
1882
1883         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1884         variable external_symbols_offset.
1885
1886 2011-09-12  Ian Lance Taylor  <iant@google.com>
1887
1888         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1889         triggered if object has no symbols.
1890
1891 2011-09-09  David S. Miller  <davem@davemloft.net>
1892
1893         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1894         (Output_fill_debug_line::do_write): Likewise.
1895
1896 2011-08-29  Cary Coutant  <ccoutant@google.com>
1897
1898         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1899         casts to match formatting specs.
1900         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1901
1902 2011-08-26  Cary Coutant  <ccoutant@google.com>
1903
1904         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1905         remaining hole size when allocating.
1906         (Layout::make_output_section): Set fill methods for debug sections.
1907         * layout.h (Free_list::Free_list_node): Move from private to
1908         public.
1909         (Free_list::set_min_hole_size): New function.
1910         (Free_list::begin, Free_list::end): New functions.
1911         (Free_list::min_hole_): New data member.
1912         * output.cc: Include dwarf.h.
1913         (Output_fill_debug_info::do_minimum_hole_size): New function.
1914         (Output_fill_debug_info::do_write): New function.
1915         (Output_fill_debug_line::do_minimum_hole_size): New function.
1916         (Output_fill_debug_line::do_write): New function.
1917         (Output_section::Output_section): Initialize new data member.
1918         (Output_section::set_final_data_size): Ensure patch space is larger
1919         than minimum hole size.
1920         (Output_section::do_write): Fill holes in debug sections.
1921         * output.h (Output_fill): New class.
1922         (Output_fill_debug_info): New class.
1923         (Output_fill_debug_line): New class.
1924         (Output_section::set_free_space_fill): New function.
1925         (Output_section::free_space_fill_): New data member.
1926         * testsuite/Makefile.am (incremental_test_3): Add
1927         --incremental-patch option.
1928         (incremental_test_4): Likewise.
1929         (incremental_test_5): Likewise.
1930         (incremental_test_6): Likewise.
1931         (incremental_copy_test): Likewise.
1932         (incremental_common_test_1): Likewise.
1933         * testsuite/Makefile.in: Regenerate.
1934
1935 2011-08-26  Nick Clifton  <nickc@redhat.com>
1936
1937         * po/es.po: Updated Spanish translation.
1938
1939 2011-08-01  Cary Coutant  <ccoutant@google.com>
1940
1941         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1942         * gold/testsuite/Makefile.in: Regenerate.
1943         * gold/testsuite/justsyms_exec.c: New source file.
1944         * gold/testsuite/justsyms_lib.c: New source file.
1945
1946 2011-08-01  Cary Coutant  <ccoutant@google.com>
1947
1948         * layout.cc (Layout::set_segment_offsets): Don't realign text
1949         segment if -Ttext was specified.
1950         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1951         file type.
1952         * object.h (Sized_relobj_file::e_type): New function.
1953         (Sized_relobj_file::e_type_): New data member.
1954         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1955         base address for ET_EXEC files.
1956         * target.cc (Target::do_make_elf_object_implementation): Allow
1957         ET_EXEC files with --just-symbols option.
1958
1959 2011-07-28  Cary Coutant  <ccoutant@google.com>
1960
1961         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1962         Add thread_number parameter.
1963         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1964         * workqueue-threads.cc
1965         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1966         current thread if its thread number is greater than desired thread
1967         count.
1968         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1969         Add thread_number parameter.
1970         (Workqueue::should_cancel_thread): Likewise.
1971         (Workqueue::find_runnable_or_wait): Pass thread_number to
1972         should_cancel_thread.
1973         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1974         parameter.
1975
1976 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1977
1978         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1979         only after checking if it cannot be forced local.
1980         * symtab.h (is_externally_visible): Check if the symbol is not forced
1981         local.
1982
1983 2011-07-15  Ian Lance Taylor  <iant@google.com>
1984
1985         * options.h (class General_options): Add --print-output-format.
1986         Move -EL next to -EB, for  better --help output.
1987         * target-select.cc: Include <cstdio>, "options.h", and
1988         "parameters.h".
1989         (Target_selector::do_target_bfd_name): New function.
1990         (print_output_format): New function.
1991         * target-select.h (class Target_selector): Update declarations.
1992         (Target_selector::target_bfd_name): New function.
1993         (print_output_format): Declare.
1994         * main.cc: Include "target-select.h".
1995         (main): Handle --print-output-format.
1996         * gold.cc: Include "target-select.h".
1997         (queue_initial_tasks): Handle --print-output-format when there are
1998         no input files.
1999         * parameters.cc (parameters_force_valid_target): Give a better
2000         error message if -EB/-EL does not match target.
2001         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2002         function.
2003
2004 2011-07-15  Ian Lance Taylor  <iant@google.com>
2005
2006         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2007         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2008         (Output_data_plt_i386::do_write): Write address of .dynamic
2009         section to first entry in .got.plt section.
2010         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2011         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2012         Initialize layout_.
2013         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2014         section to first entry in .got.plt section.
2015         * layout.h (Layout::dynamic_section): New function.
2016
2017 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2018
2019         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2020         to claim_file call.
2021         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2022         input_section_position_, and input_section_glob_.
2023         (read_layout_from_file): Call function section_ordering_specified.
2024         * layout.h (is_section_ordering_specified): New function.
2025         (section_ordering_specified): New function.
2026         (section_ordering_specified_): New boolean member.
2027         * main.cc(main): Call load_plugins after layout object is defined.
2028         * output.cc (Output_section::add_input_section): Use
2029         function section_ordering_specified to check if section ordering is
2030         needed.
2031         * output.cc (Output_section::add_relaxed_input_section): Use
2032         function section_ordering_specified to check if section ordering is
2033         needed.
2034         (Output_section::update_section_layout): New function.
2035         (Output_section::sort_attached_input_sections): Check if input section
2036         must be reordered.
2037         * output.h (Output_section::update_section_layout): New function.
2038         * plugin.cc (get_section_count): New function.
2039         (get_section_type): New function.
2040         (get_section_name): New function.
2041         (get_section_contents): New function.
2042         (update_section_order): New function.
2043         (allow_section_ordering): New function.
2044         (Plugin::load): Add the new interfaces to the transfer vector.
2045         (Plugin_manager::load_plugins): New parameter.
2046         (Plugin_manager::all_symbols_read): New parameter.
2047         (Plugin_manager::claim_file): New parameter. Save the elf object for
2048         unclaimed objects.
2049         (Plugin_manager::get_elf_object): New function.
2050         (Plugin_manager::get_view): Change to directly use the bool to check
2051         if get_view is called from claim_file_hook.
2052         * plugin.h (input_objects): New function
2053         (Plugin__manager::load_plugins): New parameter.
2054         (Plugin_manager::claim_file): New parameter.
2055         (Plugin_manager::get_elf_object): New function.
2056         (Plugin_manager::in_claim_file_handler): New function.
2057         (Plugin_manager::in_claim_file_handler_): New member.
2058         (layout): New function.
2059         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2060         handler with an extra parameter. Make the elf object before calling
2061         claim_file handler.
2062         * testsuite/plugin_test.c (get_section_count): New function pointer.
2063         (get_section_type): New function pointer.
2064         (get_section_name): New function pointer.
2065         (get_section_contents): New function pointer.
2066         (update_section_order): New function pointer.
2067         (allow_section_ordering): New function pointer.
2068         (onload): Check if the new interfaces exist.
2069
2070 2011-07-13  Ian Lance Taylor  <iant@google.com>
2071
2072         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2073         relro section.
2074         * x86_64.cc (Target_x86_64::got_section): Likewise.
2075         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2076         (relro_now_test_SOURCES): New variable.
2077         (relro_now_test_DEPENDENCIES): New variable.
2078         (relro_now_test_LDFLAGS): New variable.
2079         (relro_now_test_LDADD): New variable.
2080         (relro_now_test.so): New target.
2081         * testsuite/Makefile.in: Rebuild.
2082
2083 2011-07-12  Ian Lance Taylor  <iant@google.com>
2084
2085         PR gold/12980
2086         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2087         GLOB_DAT relocation rather than a RELATIVE relocation for a
2088         protected symbol when creating a shared library.
2089         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2090         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2091         * testsuite/protected_main_1.cc (main): Test that protected
2092         function has same address.
2093
2094 2011-07-11  Ian Lance Taylor  <iant@google.com>
2095
2096         PR gold/12979
2097         * options.h (class General_options): Add -Bgroup.
2098         * options.cc (General_options::finalize): If -Bgroup is set,
2099         default to --unresolved-symbols=report-all.
2100         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2101         * target-reloc.h (issue_undefined_symbol_error): Handle
2102         --unresolved-symbols=report-all.
2103
2104 2011-07-08  Ian Lance Taylor  <iant@google.com>
2105
2106         PR gold/11985
2107         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2108         if linker script discards key sections.
2109         (Layout::create_dynamic_symtab): Likewise.
2110         (Layout::assign_local_dynsym_offsets): Likewise.
2111         (Layout::sized_create_version_sections): Likewise.
2112         (Layout::create_interp): Likewise.
2113         (Layout::finish_dynamic_section): Likewise.
2114         (Layout::set_dynamic_symbol_size): Likewise.
2115
2116 2011-07-08  Ian Lance Taylor  <iant@google.com>
2117
2118         PR gold/12386
2119         * options.h (class General_options): Add --unresolved-symbols.
2120         * target-reloc.h (issue_undefined_symbol_error): Check
2121         --unresolved-symbols.  Add comments.
2122
2123 2011-07-08  Ian Lance Taylor  <iant@google.com>
2124
2125         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2126         expression more complex.
2127
2128 2011-07-08  Ian Lance Taylor  <iant@google.com>
2129
2130         PR gold/11317
2131         * target-reloc.h (issue_undefined_symbol_error): New inline
2132         function, broken out of relocate_section.
2133         (relocate_section): Call issue_undefined_symbol_error.
2134         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2135         there is no TLS segment if we are about to issue an undefined
2136         symbol error.
2137         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2138
2139 2011-07-08  Ian Lance Taylor  <iant@google.com>
2140
2141         PR gold/12279
2142         * resolve.cc (Symbol_table::should_override): Add fromtype
2143         parameter.  Change all callers.  Give error when linking together
2144         TLS and non-TLS symbol.
2145         (Symbol_table::should_override_with_special): Add fromtype
2146         parameter.  Change all callers.
2147         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2148         there is no TLS segment if we have reported some errors.
2149         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2150
2151 2011-07-08  Ian Lance Taylor  <iant@google.com>
2152
2153         PR gold/12372
2154         * target.h (Target::plt_address_for_global): New function.
2155         (Target::plt_address_for_local): New function.
2156         (Target::plt_section_for_global): Remove.
2157         (Target::plt_section_for_local): Remove.
2158         (Target::do_plt_address_for_global): New virtual function.
2159         (Target::do_plt_address_for_local): New virtual function.
2160         (Target::do_plt_section_for_global): Remove.
2161         (Target::do_plt_section_for_local): Remove.
2162         (Target::register_global_plt_entry): Add Symbol_table and Layout
2163         parameters.
2164         * output.cc (Output_data_got::Got_entry::write): Use
2165         plt_address_for_global and plt_address_for_local.
2166         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2167         address of output section.
2168         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2169         got_irelative_, and irelative_count_ fields.  Update
2170         declarations.
2171         (Output_data_plt_i386::has_irelative_section): New function.
2172         (Output_data_plt_i386::entry_count): Add irelative_count_.
2173         (Output_data_plt_i386::set_final_data_size): Likewise.
2174         (class Target_i386): Add got_irelative_ and rel_irelative_
2175         fields.  Update declarations.
2176         (Target_i386::Target_i386): Initialize new fields.
2177         (Target_i386::do_plt_address_for_global): New function replacing
2178         do_plt_section_for_global.
2179         (Target_i386::do_plt_address_for_local): New function replacing
2180         do_plt_section_for_local.
2181         (Target_i386::got_section): Create got_irelative_.
2182         (Target_i386::rel_irelative_section): New function.
2183         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2184         fields.  Don't define __rel_iplt_{start,end}.
2185         (Output_data_plt_i386::add_entry): Add symtab and layout
2186         parameters.  Change all callers.  Use different PLT and GOT for
2187         IFUNC symbols.
2188         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2189         layout parameters.  Change all callers.  Use different PLT and
2190         GOT.
2191         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2192         (Output_data_plt_i386::rel_irelative): New function.
2193         (Output_data_plt_i386::address_for_global): New function.
2194         (Output_data_plt_i386::address_for_local): New function.
2195         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2196         IRELATIVE GOT when changing IFUNC GOT entries.
2197         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2198         reloc.
2199         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2200         if we didn't create an IRELATIVE GOT.
2201         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2202         plt_address_for_local.
2203         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2204         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2205         got_irelative_, and irelative_count_ fields.  Update
2206         declarations.
2207         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2208         Initialize new fields.  Remove symtab parameter.  Change all
2209         callers.
2210         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2211         irelative_count_.
2212         (Output_data_plt_x86_64::has_irelative_section): New function.
2213         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2214         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2215         fields.  Update declarations.
2216         (Target_x86_64::Target_x86_64): Initialize new fields.
2217         (Target_x86_64::do_plt_address_for_global): New function replacing
2218         do_plt_section_for_global.
2219         (Target_x86_64::do_plt_address_for_local): New function replacing
2220         do_plt_section_for_local.
2221         (Target_x86_64::got_section): Create got_irelative_.
2222         (Target_x86_64::rela_irelative_section): New function.
2223         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2224         all callers.  Don't create __rel_iplt_{start,end}.
2225         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2226         parameters.  Change all callers.  Use different PLT and GOT for
2227         IFUNC symbols.
2228         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2229         layout parameters.  Change all callers.  Use different PLT and
2230         GOT.
2231         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2232         parameters.  Change all callers.  Use different PLT and GOT for
2233         IFUNC symbols.
2234         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2235         (Output_data_plt_x86_64::rela_irelative): New function.
2236         (Output_data_plt_x86_64::address_for_global): New function.
2237         (Output_data_plt_x86_64::address_for_local): New function.
2238         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2239         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2240         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2241         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2242         parameters.
2243         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2244         reloc.
2245         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2246         symbols if we didn't create an IRELATIVE GOT.
2247         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2248         plt_address_for_local.
2249         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2250         * testsuite/ifuncvar1.c: New test file.
2251         * testsuite/ifuncvar2.c: New test file.
2252         * testsuite/ifuncvar3.c: New test file.
2253         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2254         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2255         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2256         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2257         * testsuite/Makefile.in: Rebuild.
2258
2259 2011-07-07  Cary Coutant  <ccoutant@google.com>
2260
2261         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2262         (two_file_test_1_ndebug.o): Likewise.
2263         (two_file_test_1b_ndebug.o): Likewise.
2264         (two_file_test_2_ndebug.o): Likewise.
2265         (two_file_test_main_ndebug.o): Likewise.
2266         (incremental_test_2): Link with no-debug versions.
2267
2268 2011-07-06  Cary Coutant  <ccoutant@google.com>
2269
2270         * gold/incremental.cc
2271         (Output_section_incremental_inputs::write_info_blocks): Check for
2272         hidden and internal symbols.
2273
2274 2011-07-06  Cary Coutant  <ccoutant@google.com>
2275
2276         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2277         Check disposition for startup file.
2278         (Incremental_inputs::report_command_line): Ignore
2279         --incremental-startup-unchanged option.
2280         * options.cc (General_options::parse_incremental_startup_unchanged):
2281         New function.
2282         (General_options::General_options): Initialize new data member.
2283         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2284         (General_options): Add --incremental-startup-unchanged option.
2285         (General_options::incremental_startup_disposition): New function.
2286         (General_options::incremental_startup_disposition_): New data member.
2287
2288 2011-07-06  Cary Coutant  <ccoutant@google.com>
2289
2290         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2291         input file index to Script_info ctor.
2292         (Sized_incremental_binary::do_file_has_changed): Find the
2293         command-line argument for files named in scripts.
2294         * incremental.h (Script_info::Script_info): New ctor
2295         with input file index.
2296         (Script_info::input_file_index): New function.
2297         (Script_info::input_file_index_): New data member.
2298         (Incremental_binary::get_library): Add const.
2299         (Incremental_binary::get_script_info): Add const.
2300         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2301         * testsuite/Makefile.am (incremental_test_5): New test case.
2302         (incremental_test_6): New test case.
2303         * testsuite/Makefile.in: Regenerate.
2304
2305 2011-07-06  Cary Coutant  <ccoutant@google.com>
2306
2307         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2308         debug output when command lines differ.
2309
2310 2011-07-06  Cary Coutant  <ccoutant@google.com>
2311
2312         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2313         --incremental-patch option.
2314         * layout.cc (Free_list::allocate): Extend allocation beyond original
2315         end if enabled.
2316         (Layout::make_output_section): Mark sections that should get
2317         patch space.
2318         * options.cc (parse_percent): New function.
2319         * options.h (parse_percent): New function.
2320         (DEFINE_percent): New macro.
2321         (General_options): Add --incremental-patch option.
2322         * output.cc (Output_section::Output_section): Initialize new data
2323         members.
2324         (Output_section::add_input_section): Print section name when out
2325         of patch space.
2326         (Output_section::add_output_section_data): Likewise.
2327         (Output_section::set_final_data_size): Add patch space when
2328         doing --incremental-full.
2329         (Output_section::do_reset_address_and_file_offset): Remove patch
2330         space.
2331         (Output_segment::set_section_list_addresses): Print debug output
2332         only if --incremental-update.
2333         * output.h (Output_section::set_is_patch_space_allowed): New function.
2334         (Output_section::is_patch_space_allowed_): New data member.
2335         (Output_section::patch_space_): New data member.
2336         * parameters.cc (Parameters::incremental_full): New function.
2337         * parameters.h (Parameters::incremental_full): New function
2338         * testsuite/Makefile.am (incremental_test_2): Add test for
2339         --incremental-patch option.
2340         * testsuite/Makefile.in: Regenerate.
2341         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2342         (t18): Remove function body.
2343
2344 2011-07-05  Doug Kwan  <dougkwan@google.com>
2345
2346         PR gold/12771
2347         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2348         Arm_Address type for relocation result.
2349         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2350         overflow check.
2351         (Arm_relocate_functions::abs32): Use unaligned access.
2352         (Arm_relocate_functions::rel32): Ditto.
2353         (Arm_relocate_functions::prel31): Ditto.
2354         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2355         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2356         static data relocations.
2357         * testsuite/Makefile.in: Regnerate.
2358         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2359
2360 2011-07-05  Ian Lance Taylor  <iant@google.com>
2361
2362         PR gold/12392
2363         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2364         symbols if necessary.
2365         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2366
2367 2011-07-05  Ian Lance Taylor  <iant@google.com>
2368
2369         PR gold/12952
2370         * resolve.cc (Symbol::override_base_with_special): Simply override
2371         version with special symbol version, ignoring previous version.
2372
2373 2011-07-05  Ian Lance Taylor  <iant@google.com>
2374
2375         * object.cc (Sized_relobj_file::include_section_group): Add
2376         information to comment about signature location.
2377
2378 2011-07-02  Ian Lance Taylor  <iant@google.com>
2379
2380         PR gold/12957
2381         * options.h (class General_options): Add -f and -F.
2382         * options.cc (General_options::finalize): Fatal error if -f/-F
2383         are used without -shared.
2384         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2385
2386 2011-07-02  Ian Lance Taylor  <iant@google.com>
2387
2388         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2389
2390 2011-07-01  Ian Lance Taylor  <iant@google.com>
2391
2392         PR gold/12525
2393         PR gold/12952
2394         * resolve.cc (Symbol::override_base_with_special): Don't override
2395         the version if the overriding symbol has a different name.
2396         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2397         all callers.  If we give an error about an undefined version,
2398         define the base version if necessary.
2399         * dynobj.h (class Versions): Update declaration.
2400         * testsuite/weak_alias_test_5.cc: New file.
2401         * testsuite/weak_alias_test.script: New file.
2402         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2403         and versioned_alias have the right value, and call t2.
2404         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2405         weak_alias_test_5.so.
2406         (weak_alias_test_LDADD): Likewise.
2407         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2408         * testsuite/Makefile.in: Rebuild.
2409
2410 2011-07-01  Ian Lance Taylor  <iant@google.com>
2411
2412         PR gold/12525
2413         * options.h (class General_options): Support -z notext.
2414         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2415         -Wl,-z,notext.
2416         (two_file_shared_nonpic.so): Likewise.
2417         (two_file_shared_mixed.so): Likewise.
2418         (two_file_shared_mixed_1.so): Likewise.
2419         (weak_undef_lib_nonpic.so): Likewise.
2420         (alt/weak_undef_lib_nonpic.so): Likewise.
2421         (tls_test_shared_nonpic.so): Likewise.
2422         * testsuite/Makefile.in: Rebuild.
2423
2424 2011-07-01  Ian Lance Taylor  <iant@google.com>
2425
2426         PR gold/12525
2427         * configure.ac: Test whether static linking works, setting
2428         the automake conditional HAVE_STATIC.
2429         * testsuite/Makefile.am: Disable tests using -static if
2430         HAVE_STATIC is not true.
2431         * configure, testsuite/Makefile.in: Rebuild.
2432
2433 2011-07-01  Ian Lance Taylor  <iant@google.com>
2434
2435         PR gold/12525
2436         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2437         Assert if we see DW_EH_PE_indirect.
2438         * target.h (Target::ehframe_datarel_base): New function.
2439         (Target::do_ehframe_datarel_base): New target function.
2440         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2441         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2442         function.
2443
2444 2011-07-01  Ian Lance Taylor  <iant@google.com>
2445
2446         PR gold/12571
2447         * options.h (class General_options): Add
2448         --ld-generated-unwind-info.
2449         * ehframe.cc (Fde::write): Add address parameter.  Change all
2450         callers.  If associated with PLT, fill in address and size.
2451         (Cie::set_output_offset): Only add merge mapping if there is an
2452         object.
2453         (Cie::write): Add address parameter.  Change all callers.
2454         (Eh_frame::add_ehframe_for_plt): New function.
2455         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2456         input_offset_ fields into union u_, with new plt field.
2457         (Fde::Fde): Adjust for new union field.
2458         (Fde::Fde) [Output_data version]: New constructor.
2459         (Fde::add_mapping): Only add merge mapping if there is an object.
2460         (class Cie): Update declarations.
2461         (class Eh_frame): Declare add_ehframe_for_plt.
2462         * layout.cc (Layout::layout_eh_frame): Break out code into
2463         make_eh_frame_section, and call it.
2464         (Layout::make_eh_frame_section): New function.
2465         (Layout::add_eh_frame_for_plt): New function.
2466         * layout.h (class Layout): Update declarations.
2467         * merge.cc (Merge_map::add_mapping): Add assertion.
2468         * i386.cc: Include "dwarf.h".
2469         (class Output_data_plt_i386): Make first_plt_entry,
2470         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2471         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2472         and plt_eh_frame_fde.
2473         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2474         boundary.  Call add_eh_frame_for_plt if appropriate.
2475         * x86_64.cc: Include "dwarf.h".
2476         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2477         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2478         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2479         and plt_eh_frame_fde.
2480         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2481         appropriate.
2482
2483 2011-06-29  Ian Lance Taylor  <iant@google.com>
2484
2485         PR gold/12629
2486         * object.cc (Sized_relobj_file::layout_section): Change shdr
2487         parameter to be const.
2488         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2489         out of do_layout.
2490         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2491         appropriate.  Call layout_eh_frame_section.
2492         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2493         sections.
2494         * object.h (class Sized_relobj_file): Update declarations.
2495
2496 2011-06-29  Ian Lance Taylor  <iant@google.com>
2497
2498         PR gold/12652
2499         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2500         modifier.
2501         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2502
2503 2011-06-29  Ian Lance Taylor  <iant@google.com>
2504
2505         PR gold/12675
2506         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2507         SHT_X86_64_UNWIND.
2508         * layout.cc (Layout::layout_eh_frame): Likewise.
2509
2510 2011-06-29  Ian Lance Taylor  <iant@google.com>
2511
2512         PR gold/12695
2513         * layout.cc (Layout::symtab_section_shndx): New function.
2514         * layout.h (class Layout): Declare symtab_section_shndx.
2515         * output.cc (Output_section::write_header): Call it.
2516
2517 2011-06-29  Ian Lance Taylor  <iant@google.com>
2518
2519         PR gold/12818
2520         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2521         symbols which are not used in a relocation.
2522
2523 2011-06-28  Ian Lance Taylor  <iant@google.com>
2524
2525         PR gold/12898
2526         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2527         script create indistinguishable segments.
2528         (Layout::set_segment_offsets): Use stable_sort when sorting
2529         segments.  Pass this to Compare_segments constructor.
2530         * layout.h (class Layout): Make segment_precedes non-static.
2531         (class Compare_segments): Change from struct to class.  Add
2532         layout_ field.  Add constructor.
2533         * script-sections.cc
2534         (Script_sections::attach_sections_using_phdrs_clause): Rename
2535         local orphan to is_orphan.  Don't report failure to put empty
2536         section in segment.  On attachment failure, report name of
2537         section, and attach to first PT_LOAD segment.
2538
2539 2011-06-28  Ian Lance Taylor  <iant@google.com>
2540
2541         PR gold/12934
2542         * target-select.cc (Target_selector::Target_selector): Add
2543         emulation parameter.  Change all callers.
2544         (select_target_by_bfd_name): Rename from select_target_by_name.
2545         Change all callers.
2546         (select_target_by_emulation): New function.
2547         (supported_emulation_names): New function.
2548         * target-select.h (class Target_selector): Add emulation_ field.
2549         Update declarations.
2550         (Target_selector::recognize_by_bfd_name): Rename from
2551         recognize_by_name.  Change all callers.
2552         (Target_selector::supported_bfd_names): Rename from
2553         supported_names.  Change all callers.
2554         (Target_selector::recognize_by_emulation): New function.
2555         (Target_selector::supported_emulations): New function.
2556         (Target_selector::emulation): New function.
2557         (Target_selector::do_recognize_by_bfd_name): Rename from
2558         do_recognize_by_name.  Change all callers.
2559         (Target_selector::do_supported_bfd_names): Rename from
2560         do_supported_names.  Change all callers.
2561         (Target_selector::do_recognize_by_emulation): New function.
2562         (Target_selector::do_supported_emulations): New function.
2563         (select_target_by_bfd_name): Change name in declaration.
2564         (select_target_by_emulation): Declare.
2565         (supported_emulation_names): Declare.
2566         * parameters.cc (parameters_force_valid_target): Try to find
2567         target based on emulation from -m option.
2568         * options.h (class General_options): Change doc string for -m.
2569         * options.cc (help): Print emulations.
2570         (General_options::parse_V): Likewise.
2571         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2572         Add emulation parameter.  Change all callers.
2573
2574 2011-06-28  Ian Lance Taylor  <iant@google.com>
2575
2576         * target.h (class Target): Add osabi_ field.
2577         (Target::osabi): New function.
2578         (Target::set_osabi): New function.
2579         (Target::Target): Initialize osabi_.
2580         (Target::do_adjust_elf_header): Make pure virtual.
2581         (Sized_target::do_adjust_elf_header): Declare.
2582         * target.cc (Sized_target::do_adjust_elf_header): New function.
2583         (class Sized_target): Instantiate all versions.
2584         * freebsd.h (class Target_freebsd): Remove.
2585         (Target_selector_freebsd::do_recognize): Call set_osabi on
2586         Target.
2587         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2588         (Target_selector_freebsd::set_osabi): Remove.
2589         * i386.cc (class Target_i386): Inherit from Sized_target rather
2590         than Target_freebsd.
2591         * x86_64.cc (class Target_x86_64): Likewise.
2592
2593 2011-06-28  Ian Lance Taylor  <iant@google.com>
2594
2595         * target.h (Target::can_check_for_function_pointers): Rewrite.
2596         Make non-virtual.
2597         (Target::can_icf_inline_merge_sections): Likewise.
2598         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2599         (Target::Target_info): Add can_icf_inline_merge_sections field.
2600         (Target::do_can_check_for_function_pointers): New virtual
2601         function.
2602         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2603         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2604         from can_check_for_function_pointers, move in file.
2605         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2606         section_may_have_icf_unsafe_poineters, move in file.
2607         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2608         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2609         Rename from can_check_for_function_pointers, move in file.
2610         (Target_i386::can_icf_inline_merge_sections): Remove.
2611         (Target_i386::i386_info): Initialize
2612         can_icf_inline_merge_sections.
2613         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2614         Initialize can_icf_inline_merge_sections.
2615         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2616         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2617         Rename from can_check_for_function_pointers, move in file.
2618         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2619         (Target_x86_64::x86_64_info): Initialize
2620         can_icf_inline_merge_sections.
2621         * testsuite/testfile.cc (Target_test::test_target_info):
2622         Likewise.
2623         * icf.cc (get_section_contents): Correct formatting.
2624
2625 2011-06-27  Ian Lance Taylor  <iant@google.com>
2626
2627         * symtab.cc (Symbol::versioned_name): New function.
2628         (Symbol_table::add_to_final_symtab): Use versioned_name when
2629         appropriate.
2630         (Symbol_table::sized_write_symbol): Likewise.
2631         * symtab.h (class Symbol): Declare versioned_name.
2632         * stringpool.h (class Stringpool_template): Add variant of add
2633         which takes a std::basic_string.
2634         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2635         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2636         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2637         (ver_test_12.o): New target.
2638         * testsuite/Makefile.in: Rebuild.
2639
2640 2011-06-27  Doug Kwan  <dougkwan@google.com>
2641
2642         * arm.cc (Arm_relocate_functions::thm_jump8,
2643         Arm_relocate_functions::thm_jump11): Use a wider signed
2644         type to compute offset.
2645         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2646         arm_thm_jump8.
2647         * testsuite/Makefile.in: Regenerate.
2648         * testsuite/arm_branch_in_range.sh: Check test results of
2649         arm_thm_jump11 and arm_thm_jump8.
2650         * testsuite/arm_thm_jump11.s: New test source file.
2651         * testsuite/arm_thm_jump11.t: New linker script.
2652         * testsuite/arm_thm_jump8.s: New test source file.
2653         * testsuite/arm_thm_jump8.t: New linker script.
2654
2655 2011-06-24  Ian Lance Taylor  <iant@google.com>
2656
2657         * layout.cc: Include "object.h".
2658         (ctors_sections_in_init_array): New static variable.
2659         (Layout::is_ctors_in_init_array): New function.
2660         (Layout::layout): Add entry to ctors_sections_in_init_array if
2661         appropriate.
2662         * layout.h (class Layout): Declare is_ctors_in_init_array.
2663         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2664         is_ctors_reverse_view is set.
2665         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2666         all callers.  Set is_ctors_reverse_view field of View_size.
2667         (Sized_relobj_file::reverse_words): New function.
2668         * object.h (Sized_relobj_file::View_size): Add
2669         is_ctors_reverse_view field.
2670         (class Sized_relobj_file): Update declarations.
2671         * testsuite/initpri3.c: New test.
2672         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2673         initpri3b.
2674         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2675         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2676         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2677         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2678         * testsuite/Makefile.in: Rebuild.
2679
2680 2011-06-24  Cary Coutant  <ccoutant@google.com>
2681
2682         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2683         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2684         (debug_msg_cdebug.err): New targets.
2685         * testsuite/Makefile.in: Regenerate.
2686         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2687         Fix checks for link with shared library.
2688
2689 2011-06-24  Doug Kwan  <dougkwan@google.com>
2690
2691         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2692         skip empty text sections.
2693         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2694
2695 2011-06-22  Ian Lance Taylor  <iant@google.com>
2696
2697         PR gold/12910
2698         * options.h (class General_options): Add --ctors-in-init-array.
2699         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2700         friends as SHT_PROGBITS for merging sections.
2701         (Layout::layout): Remove special handling of .init_array and
2702         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2703         and .dtors if ctors_in_init_array.
2704         (Layout::make_output_section): Force correct section types for
2705         .init_array and friends.  Don't sort if doing relocatable link,
2706         Don't sort .ctors and .dtors if ctors_in_init_array.
2707         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2708         (Layout::output_section_name): Add relobj parameter.  Change all
2709         callers.  Handle .ctors. and .dtors. in code rather than table.
2710         Handle .ctors and .dtors if ctors_in_init_array.
2711         (Layout::match_file_name): New function, moved from output.cc.
2712         * layout.h (class Layout): Update declarations.
2713         * output.cc: Include "layout.h".
2714         (Input_section_sort_entry::get_priority): New function.
2715         (Input_section_sort_entry::match_file_name): Just call
2716         Layout::match_file_name.
2717         (Output_section::Input_section_sort_init_fini_compare::operator()):
2718         Handle .ctors and .dtors.  Sort by explicit priority rather than
2719         by name.
2720         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2721         * testsuite/initpri2.c: New test.
2722         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2723         (check_PROGRAMS): Add initpri2.
2724         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2725         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2726         * configure, testsuite/Makefile.in: Rebuild.
2727
2728 2011-06-19  Ian Lance Taylor  <iant@google.com>
2729
2730         PR gold/12880
2731         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2732         .interp section to a PT_INTERP segment even if we have seen a
2733         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2734         clause in a linker script.
2735         (Layout::finalize): Don't create a .interp section if we've
2736         already create a PT_INTERP segment.
2737         (Layout::create_interp): Always call choose_output_section (revert
2738         patch of 2011-06-17).  Don't create PT_INTERP segment.
2739         * script-sections.cc
2740         (Script_sections::create_note_and_tls_segments): Add a .interp
2741         section to a PT_INTERP segment even if we have seen a
2742         --dynamic-linker option.
2743
2744 2011-06-18  Ian Lance Taylor  <iant@google.com>
2745
2746         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2747         merely because a non-PT_LOAD segment has a dynamic reloc.
2748
2749 2011-06-18  Ian Lance Taylor  <iant@google.com>
2750
2751         * layout.cc (Layout::finish_dynamic_section): Don't create
2752         DT_FLAGS entry if not needed.
2753
2754 2011-06-18  Ian Lance Taylor  <iant@google.com>
2755
2756         PR gold/12745
2757         * layout.cc (Layout::layout_eh_frame): Correct handling of
2758         writable .eh_frame section.
2759
2760 2011-06-17  Ian Lance Taylor  <iant@google.com>
2761
2762         PR gold/12893
2763         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2764         symbol is redefined with the exact same object and value.
2765
2766 2011-06-17  Ian Lance Taylor  <iant@google.com>
2767
2768         PR gold/12880
2769         * layout.h (class Layout): Add interp_segment_ field.
2770         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2771         (Layout::attach_allocated_section_to_segment): If making shared
2772         library, put .interp section in PT_INTERP segment.
2773         (Layout::finalize): Also call create_interp if -dynamic-linker
2774         option was used.
2775         (Layout::create_interp): Assert that there is no PT_INTERP
2776         segment.  If not using a SECTIONS clause, use make_output_section.
2777         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2778         * script-sections.cc
2779         (Script_sections::create_note_and_tls_segments): If making shared
2780         library, put .interp section in PT_INTERP segment.
2781
2782 2011-06-17  Ian Lance Taylor  <iant@google.com>
2783
2784         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2785         when making a shared library.
2786
2787 2011-06-17  Ian Lance Taylor  <iant@google.com>
2788
2789         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2790         parameter.  Change all callers.  Don't issue warning about PC32
2791         against locally defined symbol.
2792
2793 2011-06-16  Ian Lance Taylor  <iant@google.com>
2794
2795         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2796         occurs in same object.
2797
2798 2011-06-14  Alan Modra  <amodra@gmail.com>
2799
2800         * po/POTFILES.in: Regenerate.
2801
2802 2011-06-09  Ian Lance Taylor  <iant@google.com>
2803
2804         * script-sections.cc
2805         (Orphan_output_section::set_section_addresses): For a relocatable
2806         link set address to 0.
2807
2808 2011-06-09  Cary Coutant  <ccoutant@google.com>
2809
2810         PR gold/12804
2811         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2812         used with --compress-debug-sections.
2813         * gold/object.cc (Sized_relobj_file::do_layout): Report
2814         uncompressed size of compressed input sections.
2815
2816 2011-06-08  Cary Coutant  <ccoutant@google.com>
2817
2818         PR gold/12804
2819         * testsuite/two_file_test_2_v1.cc: Change initialization of
2820         v2 to keep it in .data.
2821
2822 2011-06-07  Cary Coutant  <ccoutant@google.com>
2823
2824         * common.cc (Symbol_table::do_allocate_commons_list): Call
2825         gold_fallback.
2826         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2827         (Errors::fallback): New function.
2828         (gold_fallback): New function.
2829         * errors.h (Errors::fallback): New function.
2830         * gold.cc (gold_exit): Change status parameter to enum; adjust
2831         all callers.
2832         (queue_initial_tasks): Call gold_fallback.
2833         * gold.h: Include cstdlib.
2834         (Exit_status): New enum type.
2835         (gold_exit): Change status parameter to enum.
2836         (gold_fallback): New function.
2837         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2838         (Layout::create_symtab_sections): Likewise.
2839         (Layout::create_shdrs): Likewise.
2840         * main.cc (main): Adjust call to gold_exit.
2841         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2842         (Output_data_got::add_got_entry_pair): Likewise.
2843         (Output_section::add_input_section): Likewise.
2844         (Output_section::add_output_section_data): Likewise.
2845         (Output_segment::set_section_list_addresses): Likewise.
2846         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2847
2848 2011-06-07  Cary Coutant  <ccoutant@google.com>
2849
2850         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2851         for incremental links.
2852         * output.cc (Output_segment::set_section_list_addresses): Remove
2853         FIXME and test for TLS or BSS.
2854
2855 2011-06-07  Cary Coutant  <ccoutant@google.com>
2856
2857         * testsuite/Makefile.am: Add incremental_copy_test,
2858         incremental_common_test_1.
2859         * testsuite/Makefile.in: Regenerate.
2860         * testsuite/common_test_1_v1.c: New source file.
2861         * testsuite/common_test_1_v2.c: New source file.
2862         * testsuite/copy_test_v1.cc: New source file.
2863
2864 2011-06-07  Cary Coutant  <ccoutant@google.com>
2865
2866         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2867         update, allocate common from bss section's free list.
2868         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2869         linker-defined symbols.
2870         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2871         Skip GOT and PLT entries that are no longer referenced.
2872         (Output_section_incremental_inputs::write_info_blocks): Mark
2873         linker-defined symbols.
2874         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2875         * output.cc (Output_section::allocate): New function.
2876         * output.h (Output_section::allocate): New function.
2877         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2878         linker-defined symbols.
2879         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2880         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2881         (Symbol::init_base_output_data): Likewise.
2882         (Symbol::init_base_output_segment): Likewise.
2883         (Symbol::init_base_constant): Likewise.
2884         (Sized_symbol::init_output_data): Likewise.
2885         (Sized_symbol::init_output_segment): Likewise.
2886         (Sized_symbol::init_constant): Likewise.
2887         (Symbol_table::do_define_in_output_data): Likewise.
2888         (Symbol_table::do_define_in_output_segment): Likewise.
2889         (Symbol_table::do_define_as_constant): Likewise.
2890         * symtab.h (Symbol::is_predefined): New function.
2891         (Symbol::init_base_output_data): Add is_predefined parameter.
2892         (Symbol::init_base_output_segment): Likewise.
2893         (Symbol::init_base_constant): Likewise.
2894         (Symbol::is_predefined_): New data member.
2895         (Sized_symbol::init_output_data): Add is_predefined parameter.
2896         (Sized_symbol::init_output_segment): Likewise.
2897         (Sized_symbol::init_constant): Likewise.
2898         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2899
2900 2011-06-07  Cary Coutant  <ccoutant@google.com>
2901
2902         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2903         instead of emit_copy_reloc.
2904         (Copy_relocs::emit_copy_reloc): Refactor.
2905         (Copy_relocs::make_copy_reloc): New function.
2906         (Copy_relocs::add_copy_reloc): Remove.
2907         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2908         section.
2909         (Copy_relocs::make_copy_reloc): New function.
2910         (Copy_relocs::add_copy_reloc): Remove.
2911         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2912         unchanged input files.
2913         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2914         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2915         Reserve BSS space for COPY relocations.
2916         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2917         (Output_section_incremental_inputs::write_info_blocks): Record
2918         whether a symbol is copied from a shared object.
2919         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2920         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2921         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2922         (Incremental_input_entry_reader::get_output_symbol_index): Add
2923         is_copy parameter.
2924         (Incremental_binary::emit_copy_relocs): New function.
2925         (Incremental_binary::do_emit_copy_relocs): New function.
2926         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2927         new data member.
2928         (Sized_incremental_binary::add_copy_reloc): New function.
2929         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2930         (Sized_incremental_binary::Copy_reloc): New struct.
2931         (Sized_incremental_binary::Copy_relocs): New typedef.
2932         (Sized_incremental_binary::copy_relocs_): New data member.
2933         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2934         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2935         * target.h (Sized_target::emit_copy_reloc): New function.
2936         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2937
2938 2011-06-02  Cary Coutant  <ccoutant@google.com>
2939
2940         PR gold/12163
2941         * gold/archive.cc (Archive::Archive): Initialize new data member.
2942         (Archive::include_all_members): Return if archive has already been
2943         included.
2944         * gold/archive.h (Archive::include_all_members_): New data member.
2945
2946 2011-06-02  Nick Clifton  <nickc@redhat.com>
2947
2948         * dynobj.h: Fix spelling mistake in comment.
2949         * output.cc: Likewise.
2950
2951 2011-05-31  Doug Kwan  <dougkwan@google.com>
2952             Asier Llano
2953
2954         PR gold/12826
2955         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2956         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2957         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2958         redundant arm_exidx_test.so.
2959         * testsuite/Makefile.in: Regenerate.
2960         (check_SCRIPTS): Add pr12826.sh
2961         (check_DATA): Add pr12826.stdout
2962         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2963         * testsuite/pr12826.sh: New file.
2964         * testsuite/pr12826_1.s: Ditto.
2965         * testsuite/pr12826_1.s: Ditto.
2966
2967 2011-05-30  Ian Lance Taylor  <iant@google.com>
2968
2969         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2970         sections.
2971
2972 2011-05-29  Ian Lance Taylor  <iant@google.com>
2973
2974         PR gold/12804
2975         * testsuite/Makefile.am: Use different file name for two_file_test
2976         temporary file for each incremental test.
2977         * testsuite/Makefile.in: Rebuild.
2978
2979 2011-05-29  Ian Lance Taylor  <iant@google.com>
2980
2981         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2982         binary input file is empty.
2983
2984 2011-05-27  Ian Lance Taylor  <iant@google.com>
2985
2986         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2987         (ver_test_9.so): Likewise.
2988         * testsuite/Makefile.in: Rebuild.
2989
2990 2011-05-26 Cary Coutant  <ccoutant@google.com>
2991
2992         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2993         * incremental.cc (Incremental_inputs::report_input_section): Fix
2994         comment, indentation.
2995         (Incremental_inputs::report_comdat_group): New function.
2996         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2997         of data for incremental input file entry.
2998         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2999         group count, COMDAT group signatures.
3000         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3001         an unchanged input file.
3002         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3003         Initialize new data member.
3004         (Incremental_object_entry::add_comdat_group): New function.
3005         (Incremental_object_entry::get_comdat_group_count): New function.
3006         (Incremental_object_entry::get_comdat_signature_key): New function.
3007         (Incremental_object_entry::groups_): New data member.
3008         (Incremental_inputs::report_comdat_group): New function.
3009         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3010         data for incremental input file entry.
3011         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3012         (Incremental_input_entry_reader::get_input_section): Adjust size of
3013         data for incremental input file entry.
3014         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3015         (Incremental_input_entry_reader::get_comdat_group_signature): New
3016         function.
3017         * object.cc (Sized_relobj::include_section_group): Report kept
3018         COMDAT groups for incremental links.
3019
3020 2011-05-24  David Meyer  <pdox@google.com>
3021
3022         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3023         with name parameter.  Add found_name parameter.
3024         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3025         * dirsearch.h (class Dirsearch): Update declaration.
3026
3027 2011-05-24  Ian Lance Taylor  <iant@google.com>
3028
3029         * archive.cc (Library_base::should_include_member): Pull in object
3030         from archive if it defines the entry symbol.
3031         * parameters.cc (Parameters::entry): New function.
3032         * parameters.h (class Parameters): Declare entry.
3033         * output.h (class Output_file_header): Remove entry_ field.
3034         * output.cc (Output_file_header::Output_file_header): Remove entry
3035         parameter.  Change all callers.
3036         (Output_file_header::entry): Use parameters->entry.
3037         * gold.cc (queue_middle_tasks): Likewise.
3038         * plugin.cc (Plugin_hook::run): Likewise.
3039
3040 2011-05-24 Cary Coutant  <ccoutant@google.com>
3041
3042         * gold.cc (queue_initial_tasks): Pass incremental base filename
3043         to Output_file::open_base_file; don't print error message.
3044         * incremental-dump.cc (main): Adjust call to
3045         Output_file::open_for_modification.
3046         * incremental-dump.cc (main): Likewise.
3047         * incremental.cc (Incremental_inputs::report_command_line):
3048         Ignore --incremental-base option when comparing command lines.
3049         Ignore parameter when given as separate argument.
3050         * options.h (class General_options): Add --incremental-base.
3051         * output.cc (Output_file::Output_file):
3052         (Output_file::open_base_file): Add base_name and writable parameters;
3053         read base file into new file; print error message here.
3054         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3055         callers.
3056         * output.h (Output_file::open_for_modification): Rename to...
3057         (Output_file::open_base_file): ...this; add base_name and
3058         writable parameters; adjust all callers.
3059         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3060         callers.
3061         * testsuite/Makefile.am (incremental_test_4): Test
3062         --incremental-base.
3063         * testsuite/Makefile.in: Regenerate.
3064
3065 2011-05-24 Cary Coutant  <ccoutant@google.com>
3066
3067         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3068         incremental_test_4.
3069         * testsuite/Makefile.in: Regenerate.
3070         * testsuite/two_file_test_1_v1.cc: New test source file.
3071         * testsuite/two_file_test_1b_v1.cc: New test source file.
3072         * testsuite/two_file_test_2_v1.cc: New test source file.
3073
3074 2011-05-24 Cary Coutant  <ccoutant@google.com>
3075
3076         * dynobj.h (Dynobj::do_dynobj): New function.
3077         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3078         flag and soname for shared objects.
3079         * incremental.cc (Incremental_inputs::report_object): Make
3080         either Incremental_object_entry or Incremental_dynobj_entry; add
3081         soname to string table.
3082         (Incremental_inputs::report_input_section): Add assertion.
3083         (Output_section_incremental_inputs::set_final_data_size): Adjust
3084         type of input file entry for shared libraries; adjust size of
3085         shared library info entry.
3086         (Output_section_incremental_inputs::write_input_files): Write
3087         as_needed flag for shared libraries.
3088         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3089         of input file entry for shared libraries; write soname.
3090         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3091         soname from incremental info.
3092         * incremental.h (enum Incremental_input_flags): Add
3093         INCREMENTAL_INPUT_AS_NEEDED.
3094         (Incremental_input_entry::Incremental_input_entry): Initialize new
3095         data member.
3096         (Incremental_input_entry::set_as_needed): New function.
3097         (Incremental_input_entry::as_needed): New function.
3098         (Incremental_input_entry::do_dynobj_entry): New function.
3099         (Incremental_input_entry::as_needed_): New data member.
3100         (Incremental_object_entry::Incremental_object_entry): Don't check
3101         for shared library.
3102         (Incremental_object_entry::do_type): Likewise.
3103         (class Incremental_dynobj_entry): New class.
3104         (Incremental_input_entry_reader::as_needed): New function.
3105         (Incremental_input_entry_reader::get_soname): New function.
3106         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3107         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3108         size of shared library info entry.
3109         * layout.cc (Layout::finish_dynamic_section): Don't test for
3110         incremental link when adding DT_NEEDED entries.
3111         * object.h (Object::Object): Initialize new data member.
3112         (Object::dynobj): New function.
3113         (Object::set_as_needed): New function.
3114         (Object::as_needed): New function.
3115         (Object::do_dynobj): New function.
3116         (Object::as_needed_): New data member.
3117
3118 2011-05-24 Cary Coutant  <ccoutant@google.com>
3119
3120         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3121         info; adjust display of GOT entries.
3122         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3123         vector of input objects; remove file_status_.
3124         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3125         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3126         got_plt reader; call target hooks to reserve GOT entries.
3127         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3128         of input file info header and GOT info entry.
3129         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3130         relocation info.
3131         (Got_plt_view_info::got_descriptor): Remove.
3132         (Got_plt_view_info::sym_index): New data member.
3133         (Got_plt_view_info::input_index): New data member.
3134         (Local_got_offset_visitor::visit): Write input file index.
3135         (Global_got_offset_visitor::visit): Write 0 for input file index.
3136         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3137         with sym_index and input_index.
3138         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3139         incremental info GOT entry; replace got_descriptor with input_index.
3140         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3141         map from input file index to object.
3142         (Sized_relobj_incr::do_layout): Replace direct data member reference
3143         with accessor function.
3144         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3145         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3146         Adjust size of input file info header.
3147         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3148         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3149         (Incremental_input_entry_reader::get_input_section): Adjust size of
3150         input file info header.
3151         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3152         of incremental info GOT entry.
3153         (Incremental_got_plt_reader::get_got_desc): Remove.
3154         (Incremental_got_plt_reader::get_got_symndx): New function.
3155         (Incremental_got_plt_reader::get_got_input_index): New function.
3156         (Sized_incremental_binary::Sized_incremental_binary): Remove
3157         file_status_; add input_objects_.
3158         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3159         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3160         (Sized_incremental_binary::file_is_unchanged): Remove.
3161         (Sized_incremental_binary::set_input_object): New function.
3162         (Sized_incremental_binary::input_object): New function.
3163         (Sized_incremental_binary::file_status_): Remove.
3164         (Sized_incremental_binary::input_objects_): New data member.
3165         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3166         references.
3167         (Sized_relobj_incr::invalid_address): Move to base class.
3168         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3169         class.
3170         (Sized_relobj_incr::do_output_section_offset): Likewise.
3171         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3172         (Sized_relobj_incr::section_offsets_): Likewise.
3173         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3174         function.
3175         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3176         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3177         with accessor function.
3178         (Sized_relobj_file::do_layout): Likewise.
3179         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3180         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3181         (Sized_relobj_file::compute_final_local_value): Replace refs to
3182         section_offsets_ with accessor function.
3183         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3184         * object.h (Relobj::Relobj): Initialize new data members.
3185         (Relobj::add_dyn_reloc): New function.
3186         (Relobj::first_dyn_reloc): New function.
3187         (Relobj::dyn_reloc_count): New function.
3188         (Relobj::first_dyn_reloc_): New data member.
3189         (Relobj::dyn_reloc_count_): New data member.
3190         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3191         references.
3192         (Sized_relobj::Address): New typedef.
3193         (Sized_relobj::invalid_address): Move here from child class.
3194         (Sized_relobj::Sized_relobj): Initialize new data members.
3195         (Sized_relobj::sized_relobj): New function.
3196         (Sized_relobj::is_output_section_offset_invalid): Move here from
3197         child class.
3198         (Sized_relobj::get_output_section_offset): Likewise.
3199         (Sized_relobj::local_has_got_offset): Likewise.
3200         (Sized_relobj::local_got_offset): Likewise.
3201         (Sized_relobj::set_local_got_offset): Likewise.
3202         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3203         (Sized_relobj::clear_got_offsets): New function.
3204         (Sized_relobj::section_offsets): Move here from child class.
3205         (Sized_relobj::do_output_section_offset): Likewise.
3206         (Sized_relobj::do_set_section_offset): Likewise.
3207         (Sized_relobj::Local_got_offsets): Likewise.
3208         (Sized_relobj::local_got_offsets_): Likewise.
3209         (Sized_relobj::section_offsets_): Likewise.
3210         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3211         references.
3212         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3213         class.
3214         (Sized_relobj_file::sized_relobj): New function
3215         (Sized_relobj_file::local_has_got_offset): Move to base class.
3216         (Sized_relobj_file::local_got_offset): Likewise.
3217         (Sized_relobj_file::set_local_got_offset): Likewise.
3218         (Sized_relobj_file::get_output_section_offset): Likewise.
3219         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3220         (Sized_relobj_file::do_output_section_offset): Likewise.
3221         (Sized_relobj_file::do_set_section_offset): Likewise.
3222         (Sized_relobj_file::Local_got_offsets): Likewise.
3223         (Sized_relobj_file::local_got_offsets_): Likewise.
3224         (Sized_relobj_file::section_offsets_): Likewise.
3225         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3226         (all constructors).
3227         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3228         (Output_reloc::get_symbol_index): Likewise.
3229         (Output_reloc::local_section_offset): Likewise.
3230         (Output_reloc::get_address): Likewise.
3231         (Output_reloc::symbol_value): Likewise.
3232         (Output_data_got::reserve_slot): Move to class definition.
3233         (Output_data_got::reserve_local): New function.
3234         (Output_data_got::reserve_slot_for_global): Remove.
3235         (Output_data_got::reserve_global): New function.
3236         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3237         (all constructors, two instantiations).
3238         (Output_reloc::get_relobj): New function (two instantiations).
3239         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3240         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3241         (Output_data_reloc::add_global): Adjust type of relobj.
3242         (Output_data_reloc::add_global_relative): Likewise.
3243         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3244         (Output_data_reloc::add_local): Likewise.
3245         (Output_data_reloc::add_local_relative): Likewise.
3246         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3247         (Output_data_reloc::add_local_section): Likewise.
3248         (Output_data_reloc::add_output_section): Likewise.
3249         (Output_data_reloc::add_absolute): Likewise.
3250         (Output_data_reloc::add_target_specific): Likewise.
3251         (Output_data_got::reserve_slot): Move definition here.
3252         (Output_data_got::reserve_local): New function.
3253         (Output_data_got::reserve_global): New function.
3254         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3255         section_offsets_ with accessor function.
3256         (Sized_relobj_file::write_sections): Likewise.
3257         (Sized_relobj_file::do_relocate_sections): Likewise.
3258         * target.h (Sized_target::reserve_local_got_entry): New function.
3259         (Sized_target::reserve_global_got_entry): New function.
3260         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3261         (Target_x86_64::reserve_global_got_entry): New function.
3262         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3263
3264 2011-05-23 Cary Coutant  <ccoutant@google.com>
3265
3266         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3267         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3268         bit when checking got_type.
3269         * incremental.cc (Sized_incremental_binary::setup_readers):
3270         Store symbol table and string table locations; initialize bit vector
3271         of file status flags.
3272         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3273         unchanged files.
3274         (Sized_incremental_binary::do_process_got_plt): New function.
3275         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3276         (Output_section_incremental_inputs::set_final_data_size): Record
3277         file index for each input file.
3278         (Output_section_incremental_inputs::write_got_plt): Store file index
3279         instead of input entry offset for each GOT entry.
3280         * incremental.h
3281         (Incremental_input_entry::Incremental_input_entry): Initialize new
3282         data member.
3283         (Incremental_input_entry::set_offset): Store file index.
3284         (Incremental_input_entry::get_file_index): New function.
3285         (Incremental_input_entry::file_index_): New data member.
3286         (Incremental_binary::process_got_plt): New function.
3287         (Incremental_binary::do_process_got_plt): New function.
3288         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3289         data members.
3290         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3291         (Sized_incremental_binary::set_file_is_unchanged): New function.
3292         (Sized_incremental_binary::file_is_unchanged): New function.
3293         (Sized_incremental_binary::do_process_got_plt): New function.
3294         (Sized_incremental_binary::file_status_): New data member.
3295         (Sized_incremental_binary::main_symtab_loc_): New data member.
3296         (Sized_incremental_binary::main_strtab_loc_): New data member.
3297         * output.cc (Output_data_got::Got_entry::write): Add case
3298         RESERVED_CODE.
3299         (Output_data_got::add_global): Call add_got_entry.
3300         (Output_data_got::add_global_plt): Likewise.
3301         (Output_data_got::add_global_with_rel): Likewise.
3302         (Output_data_got::add_global_with_rela): Likewise.
3303         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3304         (Output_data_got::add_global_pair_with_rela): Likewise.
3305         (Output_data_got::add_local): Call add_got_entry.
3306         (Output_data_got::add_local_plt): Likewise.
3307         (Output_data_got::add_local_with_rel): Likewise.
3308         (Output_data_got::add_local_with_rela): Likewise.
3309         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3310         (Output_data_got::add_local_pair_with_rela): Likewise.
3311         (Output_data_got::reserve_slot): New function.
3312         (Output_data_got::reserve_slot_for_global): New function.
3313         (Output_data_got::add_got_entry): New function.
3314         (Output_data_got::add_got_entry_pair): New function.
3315         (Output_section::add_output_section_data): Edit FIXME.
3316         * output.h
3317         (Output_section_data_build::Output_section_data_build): New
3318         constructor with size parameter.
3319         (Output_data_space::Output_data_space): Likewise.
3320         (Output_data_got::Output_data_got): Initialize new data member; new
3321         constructor with size parameter.
3322         (Output_data_got::add_constant): Call add_got_entry.
3323         (Output_data_got::reserve_slot): New function.
3324         (Output_data_got::reserve_slot_for_global): New function.
3325         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3326         (Output_data_got::add_got_entry): New function.
3327         (Output_data_got::add_got_entry_pair): New function.
3328         (Output_data_got::free_list_): New data member.
3329         * target.h (Sized_target::init_got_plt_for_update): New function.
3330         (Sized_target::register_global_plt_entry): New function.
3331         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3332         Initialize new data member; call init; add constructor with PLT count.
3333         (Output_data_plt_x86_64::init): New function.
3334         (Output_data_plt_x86_64::add_relocation): New function.
3335         (Output_data_plt_x86_64::reserve_slot): New function.
3336         (Output_data_plt_x86_64::free_list_): New data member.
3337         (Target_x86_64::init_got_plt_for_update): New function.
3338         (Target_x86_64::register_global_plt_entry): New function.
3339         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3340         incremental updates.
3341         (Output_data_plt_x86_64::add_relocation): New function.
3342         * testsuite/object_unittest.cc (Object_test): Set default options.
3343
3344 2011-05-16  Ian Lance Taylor  <iant@google.com>
3345
3346         * options.h (class General_options): Make -i a synonym for -r.
3347
3348 2011-05-16  Ian Lance Taylor  <iant@google.com>
3349
3350         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3351
3352 2011-05-10 Cary Coutant  <ccoutant@google.com>
3353
3354         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3355         strip_all (-s).
3356
3357 2011-05-06  Ian Lance Taylor  <iant@google.com>
3358
3359         * layout.cc (Layout::layout): If the output section flags change,
3360         update the ordering.
3361
3362 2011-04-25 Cary Coutant  <ccoutant@google.com>
3363
3364         * incremental-dump.cc (dump_incremental_inputs): Print local
3365         symbol info for each input file.
3366         * incremental.cc
3367         (Output_section_incremental_inputs::set_final_data_size): Add local
3368         symbol info to input file entries in incremental info.
3369         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3370         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3371         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3372         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3373         implementation.
3374         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3375         (Sized_incr_relobj::do_relocate): Write the local symbols.
3376         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3377         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3378         Adjust size of input file header.
3379         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3380         (Incremental_inputs_reader::get_local_symbol_count): New function.
3381         (Incremental_inputs_reader::get_input_section): Adjust size of input
3382         file header.
3383         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3384         (Sized_incr_relobj::This): New typedef.
3385         (Sized_incr_relobj::sym_size): New const data member.
3386         (Sized_incr_relobj::Local_symbol): New struct.
3387         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3388         (Sized_incr_relobj::do_local_symbol_offset): New function.
3389         (Sized_incr_relobj::local_symbol_count_): New data member.
3390         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3391         (Sized_incr_relobj::local_symbol_index_): New data member.
3392         (Sized_incr_relobj::local_symbol_offset_): New data member.
3393         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3394         (Sized_incr_relobj::local_symbols_): New data member.
3395         * object.h (Relobj::output_local_symbol_count): New function.
3396         (Relobj::local_symbol_offset): New function.
3397         (Relobj::do_output_local_symbol_count): New function.
3398         (Relobj::do_local_symbol_offset): New function.
3399         (Sized_relobj::do_output_local_symbol_count): New function.
3400         (Sized_relobj::do_local_symbol_offset): New function.
3401
3402 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3403
3404         * descriptors.cc (set_close_on_exec): New function.
3405         (Descriptors::open): Use set_close_on_exec.
3406         * output.cc (S_ISLNK): Define if not defined.
3407
3408 2011-04-22 Cary Coutant  <ccoutant@google.com>
3409
3410         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3411         global symbol map.
3412         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3413         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3414         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3415         relocations.
3416         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3417         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3418         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3419         * incremental.h
3420         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3421         function.
3422         (Incremental_binary::apply_incremental_relocs): New function.
3423         (Incremental_binary::do_apply_incremental_relocs): New function.
3424         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3425         data member.
3426         (Sized_incremental_binary::add_global_symbol): New function.
3427         (Sized_incremental_binary::global_symbol): New function.
3428         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3429         (Sized_incremental_binary::symbol_map_): New data member.
3430         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3431         * target.h (Sized_target::apply_relocation): New function.
3432         * target-reloc.h (apply_relocation): New function.
3433         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3434
3435 2011-04-22  Doug Kwan  <dougkwan@google.com>
3436
3437         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3438         flag of a SHT_ARM_EXIDX section.
3439         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3440         * testsuite/Makefile.in: Regenerate.
3441         * testsuite/arm_exidx_test.s: New file.
3442         * testsuite/arm_exidx_test.sh: Same.
3443
3444 2011-04-20 Cary Coutant  <ccoutant@google.com>
3445
3446         PR gold/12689
3447         * archive.h (Incremental_archive_entry::Archive_member):
3448         Initialize arg_serial_ (second constructor).
3449
3450 2011-04-17  Ian Lance Taylor  <iant@google.com>
3451
3452         * object.cc (Relocate_info::location): Simplify location string.
3453         * errors.cc (Errors::error_at_location): Don't print program
3454         name.
3455         (Errors::warning_at_location): Likewise.
3456         (Errors::undefined_symbol): Likewise.
3457         * testsuite/debug_msg.sh: Update accordingly.
3458
3459 2011-04-14 Cary Coutant  <ccoutant@google.com>
3460
3461         * gold/layout.cc (Layout::symtab_section_offset): New function.
3462         * gold/layout.h (Layout::symtab_section_offset): New function.
3463         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3464
3465 2011-04-12  Ian Lance Taylor  <iant@google.com>
3466
3467         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3468         with MREMAP_MAYMOVE.
3469         * output.h (class Output_file): Add map_is_allocated_ field.
3470         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3471         not available, provide stubs.  If mremap is not available, #define
3472         it to gold_mremap.
3473         (MREMAP_MAYMOVE): Define if not defined.
3474         (Output_file::Output_file): Initialize map_is_allocated_.
3475         (Output_file::resize): Check map_is_allocated_.
3476         (Output_file::map_anonymous): If mmap fails, use malloc.
3477         (Output_file::unmap): Don't do anything for an anonymous map.
3478         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3479         is not available, provide stubs.
3480         (File_read::View::~View): Use free rather than delete[].
3481         (File_read::make_view): Use malloc rather than new[].  If mmap
3482         fails, use malloc.
3483         (File_read::find_or_make_view): Use malloc rather than new[].
3484         * gold.h: Remove HAVE_REMAP code.
3485         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3486         exists.  Rename mremap to gold_mremap.  If mmap is not available
3487         don't do anything.
3488         * configure, config.in: Rebuild.
3489
3490 2011-04-11  Ian Lance Taylor  <iant@google.com>
3491
3492         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3493         initialize local variable v.
3494
3495 2011-04-11  Cary Coutant  <ccoutant@google.com>
3496
3497         * archive.cc (Archive::include_member): Adjust call to
3498         report_object.
3499         (Add_archive_symbols::run): Track argument serial numbers.
3500         (Lib_group::include_member): Likewise.
3501         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3502         * archive.h (Incremental_archive_entry::Archive_member):
3503         Initialize arg_serial_.
3504         (Archive_member::arg_serial_): New data member.
3505         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3506         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3507         incremental link.
3508         (Sized_dynobj::do_for_all_local_got_entries): New function.
3509         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3510         function.
3511         * fileread.cc (get_mtime): New function.
3512         * fileread.h (get_mtime): New function.
3513         * gold.cc (queue_initial_tasks): Check for incremental update.
3514         (process_incremental_input): New function.
3515         (queue_middle_tasks): Don't force valid target for incremental
3516         update.
3517         * incremental-dump.cc (find_input_containing_global): Adjust
3518         size of symbol info entry.
3519         (dump_incremental_inputs): Dump argument serial number and
3520         in_system_directory flag; bias shndx by 1; print symbol names
3521         when dumping per-file symbol lists; use new symbol info readers.
3522         * incremental.cc
3523         (Output_section_incremental_inputs:update_data_size): New function.
3524         (Sized_incremental_binary::setup_readers): Setup input readers
3525         for each input file; build maps for files added from libraries
3526         and scripts.
3527         (Sized_incremental_binary::check_input_args): New function.
3528         (Sized_incremental_binary::do_check_inputs): Build map of argument
3529         serial numbers to input arguments.
3530         (Sized_incremental_binary::do_file_has_changed): Rename
3531         do_file_is_unchanged to this; compare file modification times.
3532         (Sized_incremental_binary::do_init_layout): New function.
3533         (Sized_incremental_binary::do_reserve_layout): New function.
3534         (Sized_incremental_binary::do_get_input_reader): Remove.
3535         (Sized_incremental_binary::get_symtab_view): New function.
3536         (Incremental_checker::can_incrementally_link_output_file): Remove.
3537         (Incremental_inputs::report_command_line): Exclude --debug options.
3538         (Incremental_inputs::report_archive_begin): Add parameter; track
3539         argument serial numbers; don't put input file entry for archive
3540         before archive members.
3541         (Incremental_inputs::report_archive_end): Put input file entry
3542         for archive after archive members.
3543         (Incremental_inputs::report_object): Add parameter; track argument
3544         serial numbers and in_system_directory flag.
3545         (Incremental_inputs::report_script): Add parameter; track argument
3546         serial numbers.
3547         (Output_section_incremental_inputs::set_final_data_size): Adjust
3548         size of symbol info entry; check for forwarding symbols.
3549         (Output_section_incremental_inputs::write_input_files): Write
3550         in_system_directory flag and argument serial number.
3551         (Output_section_incremental_inputs::write_info_blocks): Map section
3552         indices between incremental info and original input file; store
3553         input section index for each symbol.
3554         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3555         change operator() to visit().
3556         (class Global_got_offset_visitor): Likewise.
3557         (class Global_symbol_visitor_got_plt):
3558         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3559         classes.
3560         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3561         (Sized_incr_relobj::do_read_symbols): New function.
3562         (Sized_incr_relobj::do_layout): New function.
3563         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3564         (Sized_incr_relobj::do_add_symbols): New function.
3565         (Sized_incr_relobj::do_should_include_member): New function.
3566         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3567         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3568         (Sized_incr_relobj::do_section_size): New function.
3569         (Sized_incr_relobj::do_section_name): New function.
3570         (Sized_incr_relobj::do_section_contents): New function.
3571         (Sized_incr_relobj::do_section_flags): New function.
3572         (Sized_incr_relobj::do_section_entsize): New function.
3573         (Sized_incr_relobj::do_section_address): New function.
3574         (Sized_incr_relobj::do_section_type): New function.
3575         (Sized_incr_relobj::do_section_link): New function.
3576         (Sized_incr_relobj::do_section_info): New function.
3577         (Sized_incr_relobj::do_section_addralign): New function.
3578         (Sized_incr_relobj::do_initialize_xindex): New function.
3579         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3580         (Sized_incr_relobj::do_read_relocs): New function.
3581         (Sized_incr_relobj::do_gc_process_relocs): New function.
3582         (Sized_incr_relobj::do_scan_relocs): New function.
3583         (Sized_incr_relobj::do_count_local_symbols): New function.
3584         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3585         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3586         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3587         (Sized_incr_relobj::do_relocate): New function.
3588         (Sized_incr_relobj::do_set_section_offset): New function.
3589         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3590         (Sized_incr_dynobj::do_read_symbols): New function.
3591         (Sized_incr_dynobj::do_layout): New function.
3592         (Sized_incr_dynobj::do_add_symbols): New function.
3593         (Sized_incr_dynobj::do_should_include_member): New function.
3594         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3595         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3596         (Sized_incr_dynobj::do_section_size): New function.
3597         (Sized_incr_dynobj::do_section_name): New function.
3598         (Sized_incr_dynobj::do_section_contents): New function.
3599         (Sized_incr_dynobj::do_section_flags): New function.
3600         (Sized_incr_dynobj::do_section_entsize): New function.
3601         (Sized_incr_dynobj::do_section_address): New function.
3602         (Sized_incr_dynobj::do_section_type): New function.
3603         (Sized_incr_dynobj::do_section_link): New function.
3604         (Sized_incr_dynobj::do_section_info): New function.
3605         (Sized_incr_dynobj::do_section_addralign): New function.
3606         (Sized_incr_dynobj::do_initialize_xindex): New function.
3607         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3608         (make_sized_incremental_object): New function.
3609         (Incremental_library::copy_unused_symbols): New function.
3610         (Incremental_library::do_for_all_unused_symbols): New function.
3611         * incremental.h (enum Incremental_input_flags): New type.
3612         (class Incremental_checker): Remove.
3613         (Incremental_input_entry::Incremental_input_entry): Add argument
3614         serial number.
3615         (Incremental_input_entry::arg_serial): New function.
3616         (Incremental_input_entry::set_is_in_system_directory): New function.
3617         (Incremental_input_entry::is_in_system_directory): New function.
3618         (Incremental_input_entry::arg_serial_): New data member.
3619         (Incremental_input_entry::is_in_system_directory_): New data member.
3620         (class Script_info): Move here from script.h.
3621         (Script_info::Script_info): Add filename parameter.
3622         (Script_info::filename): New function.
3623         (Script_info::filename_): New data member.
3624         (Incremental_script_entry::Incremental_script_entry): Add argument
3625         serial number.
3626         (Incremental_object_entry::Incremental_object_entry): Likewise.
3627         (Incremental_object_entry::add_input_section): Build list of input
3628         sections with map to original shndx.
3629         (Incremental_object_entry::get_input_section_index): New function.
3630         (Incremental_object_entry::shndx_): New data member.
3631         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3632         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3633         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3634         serial number.
3635         (Incremental_inputs::report_archive_begin): Likewise.
3636         (Incremental_inputs::report_object): Likewise.
3637         (Incremental_inputs::report_script): Likewise.
3638         (class Incremental_global_symbol_reader): New class.
3639         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3640         and store flags and input file type.
3641         (Incremental_input_entry_reader::arg_serial): New function.
3642         (Incremental_input_entry_reader::type): Extract type from flags.
3643         (Incremental_input_entry_reader::is_in_system_directory): New function.
3644         (Incremental_input_entry_reader::get_input_section_count): Call
3645         accessor function for type.
3646         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3647         function for type; adjust size of global symbol entry.
3648         (Incremental_input_entry_reader::get_global_symbol_count): Call
3649         accessor function for type.
3650         (Incremental_input_entry_reader::get_object_count): Likewise.
3651         (Incremental_input_entry_reader::get_object_offset): Likewise.
3652         (Incremental_input_entry_reader::get_member_count): Likewise.
3653         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3654         (Incremental_input_entry_reader::get_member_offset): Likewise.
3655         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3656         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3657         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3658         (Incremental_input_entry_reader::get_global_symbol_reader): New
3659         function.
3660         (Incremental_input_entry_reader::get_output_symbol_index): New
3661         function.
3662         (Incremental_input_entry_reader::type_): Remove.
3663         (Incremental_input_entry_reader::flags_): New data member.
3664         (Incremental_inputs_reader::input_file_offset): New function.
3665         (Incremental_inputs_reader::input_file_index): New function.
3666         (Incremental_inputs_reader::input_file): Call input_file_offset.
3667         (Incremental_inputs_reader::input_file_at_offset): New function.
3668         (Incremental_relocs_reader::get_r_type): Reformat.
3669         (Incremental_relocs_reader::get_r_shndx): Reformat.
3670         (Incremental_relocs_reader::get_r_offset): Reformat.
3671         (Incremental_relocs_reader::data): New function.
3672         (Incremental_binary::Incremental_binary): Initialize new data members.
3673         (Incremental_binary::check_inputs): Add cmdline parameter.
3674         (Incremental_binary::file_is_unchanged): Remove.
3675         (Input_reader::arg_serial): New function.
3676         (Input_reader::get_unused_symbol_count): New function.
3677         (Input_reader::get_unused_symbol): New function.
3678         (Input_reader::do_arg_serial): New function.
3679         (Input_reader::do_get_unused_symbol_count): New function.
3680         (Input_reader::do_get_unused_symbol): New function.
3681         (Incremental_binary::input_file_count): New function.
3682         (Incremental_binary::get_input_reader): Change signature to use
3683         index instead of filename.
3684         (Incremental_binary::file_has_changed): New function.
3685         (Incremental_binary::get_input_argument): New function.
3686         (Incremental_binary::get_library): New function.
3687         (Incremental_binary::get_script_info): New function.
3688         (Incremental_binary::init_layout): New function.
3689         (Incremental_binary::reserve_layout): New function.
3690         (Incremental_binary::output_file): New function.
3691         (Incremental_binary::do_check_inputs): New function.
3692         (Incremental_binary::do_file_is_unchanged): Remove.
3693         (Incremental_binary::do_file_has_changed): New function.
3694         (Incremental_binary::do_init_layout): New function.
3695         (Incremental_binary::do_reserve_layout): New function.
3696         (Incremental_binary::do_input_file_count): New function.
3697         (Incremental_binary::do_get_input_reader): Change signature.
3698         (Incremental_binary::input_args_map_): New data member.
3699         (Incremental_binary::library_map_): New data member.
3700         (Incremental_binary::script_map_): New data member.
3701         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3702         new data members.
3703         (Sized_incremental_binary::output_section): New function.
3704         (Sized_incremental_binary::inputs_reader): Add const.
3705         (Sized_incremental_binary::symtab_reader): Add const.
3706         (Sized_incremental_binary::relocs_reader): Add const.
3707         (Sized_incremental_binary::got_plt_reader): Add const.
3708         (Sized_incremental_binary::get_symtab_view): New function.
3709         (Sized_incremental_binary::Inputs_reader): New typedef.
3710         (Sized_incremental_binary::Input_entry_reader): New typedef.
3711         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3712         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3713         (Sized_incremental_binary::do_file_has_changed): New function.
3714         (Sized_incremental_binary::do_init_layout): New function.
3715         (Sized_incremental_binary::do_reserve_layout): New function.
3716         (Sized_input_reader::Inputs_reader): Remove.
3717         (Sized_input_reader::Input_entry_reader): Remove.
3718         (Sized_input_reader::do_arg_serial): New function.
3719         (Sized_input_reader::do_get_unused_symbol_count): New function.
3720         (Sized_input_reader::do_get_unused_symbol): New function.
3721         (Sized_incremental_binary::do_input_file_count): New function.
3722         (Sized_incremental_binary::do_get_input_reader): Change signature;
3723         use index instead of filename.
3724         (Sized_incremental_binary::section_map_): New data member.
3725         (Sized_incremental_binary::input_entry_readers_): New data member.
3726         (class Sized_incr_relobj): New class.
3727         (class Sized_incr_dynobj): New class.
3728         (make_sized_incremental_object): New function.
3729         (class Incremental_library): New class.
3730         * layout.cc (Free_list::num_lists): New static data member.
3731         (Free_list::num_nodes): New static data member.
3732         (Free_list::num_removes): New static data member.
3733         (Free_list::num_remove_visits): New static data member.
3734         (Free_list::num_allocates): New static data member.
3735         (Free_list::num_allocate_visits): New static data member.
3736         (Free_list::init): New function.
3737         (Free_list::remove): New function.
3738         (Free_list::allocate): New function.
3739         (Free_list::dump): New function.
3740         (Free_list::print_stats): New function.
3741         (Layout_task_runner::run): Resize output file for incremental updates.
3742         (Layout::Layout): Initialize new data members.
3743         (Layout::set_incremental_base): New function.
3744         (Layout::init_fixed_output_section): New function.
3745         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3746         incremental updates.
3747         (Layout::create_gold_note): Do not create gold note section for
3748         incremental updates.
3749         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3750         for incremental updates.
3751         (Layout::set_section_offsets): For incremental updates, allocate space
3752         from free list.
3753         (Layout::create_symtab_sections): Layout with offsets relative to
3754         start of section; for incremental updates, allocate space from free
3755         list.
3756         (Layout::create_shdrs): For incremental updates, allocate space from
3757         free list.
3758         (Layout::finish_dynamic_section): For incremental updates, do not
3759         check --as-needed (fixed in subsequent patch).
3760         * layout.h (class Free_list): New class.
3761         (Layout::set_incremental_base): New function.
3762         (Layout::incremental_base): New function.
3763         (Layout::init_fixed_output_section): New function.
3764         (Layout::allocate): New function.
3765         (Layout::incremental_base_): New data member.
3766         (Layout::free_list_): New data member.
3767         * main.cc (main): Print Free_list statistics.
3768         * object.cc (Relobj::finalize_incremental_relocs): Add
3769         clear_counts parameter; clear counts only when clear_counts is set.
3770         (Sized_relobj::Sized_relobj): Initialize new base class.
3771         (Sized_relobj::do_layout): Don't report special sections.
3772         (Sized_relobj::do_for_all_local_got_entries): New function.
3773         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3774         symtab_off to all symbol table offsets.
3775         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3776         * object.h (class Got_offset_list): Move to top of file.
3777         (Object::Object): Allow case where input_file == NULL.
3778         (Object::~Object): Likewise.
3779         (Object::input_file): Assert that input_file != NULL.
3780         (Object::lock): Allow case where input_file == NULL.
3781         (Object::unlock): Likewise.
3782         (Object::is_locked): Likewise.
3783         (Object::token): Likewise.
3784         (Object::release): Likewise.
3785         (Object::is_incremental): New function.
3786         (Object::get_mtime): New function.
3787         (Object::for_all_local_got_entries): New function.
3788         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3789         (Object::set_is_in_system_directory): New function.
3790         (Object::is_in_system_directory): New function.
3791         (Object::do_is_incremental): New function.
3792         (Object::do_get_mtime): New function.
3793         (Object::do_for_all_local_got_entries): New function.
3794         (Object::is_in_system_directory_): New data member.
3795         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3796         (class Sized_relobj_base): New class.
3797         (class Sized_relobj): Derive from Sized_relobj_base.
3798         (class Sized_relobj::Symbols): Redeclare from base class.
3799         (class Sized_relobj::local_got_offset_list): Remove.
3800         (class Sized_relobj::Output_sections): Redeclare from base class.
3801         (class Sized_relobj::do_for_all_local_got_entries): New function.
3802         (class Sized_relobj::write_local_symbols): Add offset parameter.
3803         (class Sized_relobj::local_symbol_offset_): Update comment.
3804         (class Sized_relobj::local_dynsym_offset_): Update comment.
3805         * options.cc (Input_arguments::add_file): Remove const.
3806         * options.h (Input_file_argument::Input_file_argument):
3807         Initialize arg_serial_ (all constructors).
3808         (Input_file_argument::set_arg_serial): New function.
3809         (Input_file_argument::arg_serial): New function.
3810         (Input_file_argument::arg_serial_): New data member.
3811         (Input_arguments::Input_arguments): Initialize file_count_.
3812         (Input_arguments::add_file): Remove const.
3813         (Input_arguments::number_of_input_files): New function.
3814         (Input_arguments::file_count_): New data member.
3815         (Command_line::number_of_input_files): Call
3816         Input_arguments::number_of_input_files.
3817         * output.cc (Output_segment_headers::Output_segment_headers):
3818         Set current size.
3819         (Output_section::Input_section::current_data_size): New function.
3820         (Output_section::Output_section): Initialize new data members.
3821         (Output_section::add_input_section): Don't do merge sections for
3822         an incremental link; allocate space from free list for an
3823         incremental update.
3824         (Output_section::add_output_section_data): Allocate space from
3825         free list for an incremental update.
3826         (Output_section::update_data_size): New function.
3827         (Output_section::set_fixed_layout): New function.
3828         (Output_section::reserve): New function.
3829         (Output_segment::set_section_addresses): Remove const.
3830         (Output_segment::set_section_list_addresses): Remove const; allocate
3831         space from free list for an incremental update.
3832         (Output_segment::set_offset): Adjust size of RELRO segment for an
3833         incremental update.
3834         * output.h (Output_data::current_data_size): Move here from
3835         child classes.
3836         (Output_data::pre_finalize_data_size): New function.
3837         (Output_data::update_data_size): New function.
3838         (Output_section_headers::update_data_size): new function.
3839         (Output_section_data_build::current_data_size): Move to Output_data.
3840         (Output_data_strtab::update_data_size): New function.
3841         (Output_section::current_data_size): Move to Output_data.
3842         (Output_section::set_fixed_layout): New function.
3843         (Output_section::has_fixed_layout): New function.
3844         (Output_section::reserve): New function.
3845         (Output_section::update_data_size): New function.
3846         (Output_section::has_fixed_layout_): New data member.
3847         (Output_section::free_list_): New data member.
3848         (Output_segment::set_section_addresses): Remove const.
3849         (Output_segment::set_section_list_addresses): Remove const.
3850         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3851         New function.
3852         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3853         New function.
3854         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3855         parameter when calling Add_symbols constructor; store argument
3856         serial number for members of a lib group.
3857         (Add_symbols::locks): Allow case where token == NULL.
3858         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3859         (Read_member::~Read_member): New function.
3860         (Read_member::is_runnable): New function.
3861         (Read_member::locks): New function.
3862         (Read_member::run): New function.
3863         (Check_script::~Check_script): New function.
3864         (Check_script::is_runnable): New function.
3865         (Check_script::locks): New function.
3866         (Check_script::run): New function.
3867         (Check_library::~Check_library): New function.
3868         (Check_library::is_runnable): New function.
3869         (Check_library::locks): New function.
3870         (Check_library::run): New function.
3871         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3872         (Add_symbols::library_): New data member.
3873         (class Read_member): New class.
3874         (class Check_script): New class.
3875         (class Check_library): New class.
3876         * reloc.cc (Read_relocs::is_runnable): Allow case where
3877         token == NULL.
3878         (Read_relocs::locks): Likewise.
3879         (Scan_relocs::locks): Likewise.
3880         (Relocate_task::locks): Likewise.
3881         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3882         to clear counters.
3883         (Sized_relobj::incremental_relocs_scan): Fix comment.
3884         (Sized_relobj::do_relocate): Pass output file offset to
3885         write_local_symbols.
3886         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3887         from class declaration.
3888         * script.cc (read_input_script): Allocate Script_info; pass
3889         argument serial number to report_script.
3890         * script.h (class Script_info): Move to incremental.h.
3891         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3892         * symtab.h (Symbol_table::add_from_incrobj): New function.
3893         (Symbol_table::set_file_offset): New function.
3894
3895 2011-04-05  Cary Coutant  <ccoutant@google.com>
3896
3897         * incremental-dump.cc (dump_incremental_inputs): Change signature
3898         to take a Sized_incremental_binary; change caller.  Use readers
3899         in Sized_incremental_binary.
3900         * incremental.cc
3901         (Sized_incremental_binary::find_incremental_inputs_sections):
3902         Rename do_find_incremental_inputs_sections to this.
3903         (Sized_incremental_binary::setup_readers): New function.
3904         (Sized_incremental_binary::do_check_inputs): Check
3905         has_incremental_info_ flag; move setup code to setup_readers;
3906         use input readers.
3907         (Sized_incremental_binary::do_file_is_unchanged): New function.
3908         (Sized_incremental_binary::do_get_input_reader): New function.
3909         * incremental.h (class Incremental_binary): Move to end of file.
3910         (Incremental_binary::file_is_unchanged): New function.
3911         (Incremental_binary::do_file_is_unchanged): New function.
3912         (Incremental_binary::Input_reader): New class.
3913         (Incremental_binary::get_input_reader): New function.
3914         (class Sized_incremental_binary): Move to end of file.
3915         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3916         input section reader classes.
3917         (Sized_incremental_binary::has_incremental_info): New function.
3918         (Sized_incremental_binary::inputs_reader): New function.
3919         (Sized_incremental_binary::symtab_reader): New function.
3920         (Sized_incremental_binary::relocs_reader): New function.
3921         (Sized_incremental_binary::got_plt_reader): New function.
3922         (Sized_incremental_binary::do_file_is_unchanged): New function.
3923         (Sized_incremental_binary::Sized_input_reader): New class.
3924         (Sized_incremental_binary::get_input_reader): New function.
3925         (Sized_incremental_binary::find_incremental_inputs_sections):
3926         Rename do_find_incremental_inputs_sections to this.
3927         (Sized_incremental_binary::setup_readers): New function.
3928         (Sized_incremental_binary::has_incremental_info_): New data member.
3929         (Sized_incremental_binary::inputs_reader_): New data member.
3930         (Sized_incremental_binary::symtab_reader_): New data member.
3931         (Sized_incremental_binary::relocs_reader_): New data member.
3932         (Sized_incremental_binary::got_plt_reader_): New data member.
3933         (Sized_incremental_binary::current_input_file_): New data member.
3934
3935 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3936
3937         PR gold/12640
3938         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3939         violation.
3940
3941 2011-03-30  Cary Coutant  <ccoutant@google.com>
3942
3943         * archive.cc (Archive::include_member): Adjust call to report_object.
3944         (Add_archive_symbols::run): Add script_info to call to
3945         report_archive_begin.
3946         (Lib_group::include_member): Adjust call to report_object.
3947         (Add_lib_group_symbols::run): Adjust call to report_object.
3948         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3949         blocks.  Add object count for script input files.
3950         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3951         script_info parameter; change all callers.
3952         (Incremental_inputs::report_object): Add script_info parameter;
3953         change all callers.
3954         (Incremental_inputs::report_script): Store backpointer to
3955         incremental info entry.
3956         (Output_section_incremental_inputs::set_final_data_size): Record
3957         additional information for scripts.
3958         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3959         * incremental.h (Incremental_script_entry::add_object): New function.
3960         (Incremental_script_entry::get_object_count): New function.
3961         (Incremental_script_entry::get_object): New function.
3962         (Incremental_script_entry::objects_): New data member; adjust
3963         constructor.
3964         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3965         (Incremental_inputs::report_object): Add script_info parameter.
3966         (Incremental_inputs_reader::get_object_count): New function.
3967         (Incremental_inputs_reader::get_object_offset): New function.
3968         * options.cc (Input_arguments::add_file): Return reference to
3969         new input argument.
3970         * options.h (Input_argument::set_script_info): New function.
3971         (Input_argument::script_info): New function.
3972         (Input_argument::script_info_): New data member; adjust all
3973         constructors.
3974         (Input_file_group::add_file): Return reference to new input argument.
3975         (Input_file_lib::add_file): Likewise.
3976         (Input_arguments::add_file): Likewise.
3977         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3978         * script.cc (Parser_closure::Parser_closure): Add script_info
3979         parameter; adjust all callers.
3980         (Parser_closure::script_info): New function.
3981         (Parser_closure::script_info_): New data member.
3982         (read_input_script): Report scripts earlier to incremental info.
3983         (script_add_file): Set script_info in Input_argument.
3984         (script_add_library): Likewise.
3985         * script.h (Script_options::Script_info): Rewrite class.
3986
3987 2011-03-29  Cary Coutant  <ccoutant@google.com>
3988
3989         * archive.cc (Library_base::should_include_member): Move
3990         method here from class Archive.
3991         (Archive::Archive): Initialize base class.
3992         (Archive::should_include_member): Move to base class.
3993         (Archive::do_for_all_unused_symbols): New function.
3994         (Add_archive_symbols::run): Remove redundant access to
3995         incremental_inputs.
3996         (Lib_group::Lib_group): Initialize base class.
3997         (Lib_group::do_filename): New function.
3998         (Lib_group::include_member): Pass pointer to Lib_group to
3999         report_object.
4000         (Lib_group::do_for_all_unused_symbols): New function.
4001         (Add_lib_group_symbols::run): Report archive information for
4002         incremental links.
4003         * archive.h (class Library_base): New base class.
4004         (class Archive): Derive from Library_base.
4005         (Archive::filename): Move to base class.
4006         (Archive::set_incremental_info): Likewise.
4007         (Archive::incremental_info): Likewise.
4008         (Archive::Should_include): Likewise.
4009         (Archive::should_include_member): Likewise.
4010         (Archive::Armap_entry): Remove.
4011         (Archive::Unused_symbol_iterator): Remove.
4012         (Archive::unused_symbols_begin): Remove.
4013         (Archive::unused_symbols_end): Remove.
4014         (Archive::do_filename): New function.
4015         (Archive::do_get_mtime): New function.
4016         (Archive::do_for_all_unused_symbols): New function.
4017         (Archive::task_): Move to base class.
4018         (Archive::incremental_info_): Likewise.
4019         (class Lib_group): Derive from Library_base.
4020         (Lib_group::do_filename): New function.
4021         (Lib_group::do_get_mtime): New function.
4022         (Lib_group::do_for_all_unused_symbols): New function.
4023         (Lib_group::task_): Move to base class.
4024         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4025         function.
4026         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4027         function.
4028         * incremental.cc (Incremental_inputs::report_archive_begin):
4029         Use Library_base; call library's get_mtime; add incremental inputs
4030         entry before members.
4031         (class Unused_symbol_visitor): New class.
4032         (Incremental_inputs::report_archive_end): Use Library_base; use
4033         visitor class to record unused symbols; don't add incremental inputs
4034         entry after members.
4035         (Incremental_inputs::report_object): Use Library_base.
4036         * incremental.h
4037         (Incremental_archive_entry::Incremental_archive_entry): Remove
4038         unused Archive parameter.
4039         (Incremental_inputs::report_archive_begin): Use Library_base.
4040         (Incremental_inputs::report_archive_end): Likewise.
4041         (Incremental_inputs::report_object): Likewise.
4042         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4043         function.
4044         * object.h (Object::for_all_global_symbols): New function.
4045         (Object::do_for_all_global_symbols): New function.
4046         (Sized_relobj::do_for_all_global_symbols): New function.
4047         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4048         function.
4049         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4050         function.
4051
4052 2011-03-27  Ian Lance Taylor  <iant@google.com>
4053
4054         * archive.cc (Archive::interpret_header): Return -1 if something
4055         goes wrong.  Change callers accordingly.
4056
4057 2011-03-25  Cary Coutant  <ccoutant@google.com>
4058
4059         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4060         * testsuite/Makefile.in: Regenerate.
4061
4062 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4063
4064         * plugin.cc (get_view): New.
4065         (Plugin::load): Pass get_view to the plugin.
4066         (Plugin_manager::get_view): New.
4067
4068 2011-03-21  Ian Lance Taylor  <iant@google.com>
4069
4070         * testsuite/final_layout.sh: Rewrite to not use dc.
4071         * testsuite/relro_test.sh: Fail if dc is not present.
4072
4073 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4074
4075         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4076         Change == to -eq.
4077         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4078         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4079         Change == to -eq.
4080         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4081         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4082
4083 2011-03-14  Ian Lance Taylor  <iant@google.com>
4084
4085         * script-sections.cc (Sort_output_sections::script_compare):
4086         Rename from is_before, change return type.
4087         (Sort_output_sections::operator()): Adjust accordingly.
4088
4089 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4090
4091         PR gold/12572
4092         * testsuite/odr_violation2.cc: Add comment to make all error line
4093         numbers double digits.
4094         * testsuite/debug_msg.sh: Adjust expected errors.
4095
4096 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4097
4098         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4099         but mark earlier ones as non-canonical
4100         (offset_to_iterator): Update search target and example
4101         (do_addr2line): Return extra lines in a vector*
4102         (format_file_lineno): Extract from do_addr2line
4103         (one_addr2line): Add vector* out-param
4104         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4105         when a lineno entry appeared last for its instruction
4106         (Dwarf_line_info): Add vector* out-param
4107         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4108         * symtab.cc (Odr_violation_compare): Include the lineno in the
4109         comparison again.
4110         (linenos_from_loc): New. Combine the canonical line for an
4111         address with its other lines.
4112         (True_if_intersect): New. Helper functor to make
4113         std::set_intersection a query.
4114         (detect_odr_violations): Compare sets of lines instead of just
4115         one line for each function. This became less deterministic, but
4116         has fewer false positives.
4117         * symtab.h: Declarations.
4118         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4119         mix an optimized and non-optimized object in the same binary
4120         (odr_violation2.so): Same.
4121         * testsuite/Makefile.in: Regenerate from Makefile.am.
4122         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4123         * testsuite/debug_msg.sh: Update line numbers and add
4124         assertions.
4125         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4126         non-optimized context.
4127         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4128         isn't inlined, and use OdrDerived in an optimized context.
4129         * testsuite/odr_header1.h: Defines OdrDerived, where
4130         optimization will change the
4131         first-instruction-in-the-destructor's file and line number.
4132         * testsuite/odr_header2.h: Defines OdrBase.
4133
4134 2011-03-09  Ian Lance Taylor  <iant@google.com>
4135
4136         * fileread.cc (File_read::clear_views): Don't delete the whole
4137         file view.
4138
4139 2011-03-08  Ian Lance Taylor  <iant@google.com>
4140
4141         PR gold/12525
4142         * fileread.cc: #include <climits>.
4143         (GOLD_IOV_MAX): Define.
4144         (File_read::read_multiple): Limit number of entries by iov_max.
4145         * fileread.h (class File_read): Always set max_readv_entries to
4146         128.
4147
4148 2011-03-07  Ian Lance Taylor  <iant@google.com>
4149
4150         PR gold/12525
4151         * options.h (class General_options): Add -dy and -dn.
4152
4153 2011-03-02  Cary Coutant  <ccoutant@google.com>
4154
4155         * testsuite/script_test_9.t: Add TLS segment.
4156
4157 2011-03-02  Simon Baldwin  <simonb@google.com>
4158
4159         * configure.ac: Add check for gnu_indirect_function support in
4160         the toolchain building binutils.
4161         * configure: Rebuild.
4162
4163 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4164
4165         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4166         plugin only symbols.
4167         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4168         in plugin files as not needed in the symbol table.
4169
4170 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4171
4172         * output.cc (Output_section::add_input_section): Delay fill
4173         generation for section ordering.
4174
4175 2011-02-09  Ian Lance Taylor  <iant@google.com>
4176
4177         PR gold/12316
4178         * object.h (class Sized_relobj): Remove clear_local_symbols.
4179         * reloc.cc (Sized_relobj::do_relocate): Don't call
4180         clear_local_symbols.
4181
4182 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4183
4184         * plugin.cc (is_visible_from_outside): Return true for symbols
4185         in the -u option.
4186
4187 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4188
4189         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4190         filename.
4191
4192 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4193
4194         * icf.h (is_section_foldable_candidate): Change type of parameter
4195         to std::string.
4196         * icf.cc (Icf::find_identical_sections): Change type of local variable
4197         section_name to be std::string.
4198         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4199
4200 2011-01-25  Ian Lance Taylor  <iant@google.com>
4201
4202         * script.cc (script_add_extern): Rewrite to use
4203         add_symbol_reference.
4204
4205 2011-01-25  Doug Kwan  <dougkwan@google.com>
4206
4207         * icf.cc (get_section_contents): Always lock section's object.
4208
4209 2011-01-24  Ian Lance Taylor  <iant@google.com>
4210
4211         * options.h (class General_options): Accept
4212         --no-detect-odr-violations.
4213
4214 2011-01-24  Ian Lance Taylor  <iant@google.com>
4215
4216         * version.cc (version_string): Bump to 1.11.
4217
4218 2011-01-24  Ian Lance Taylor  <iant@google.com>
4219
4220         * plugin.cc (class Plugin_rescan): Define new class.
4221         (Plugin_manager::claim_file): Set any_claimed_.
4222         (Plugin_manager::save_archive): New function.
4223         (Plugin_manager::save_input_group): New function.
4224         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4225         necessary.
4226         (Plugin_manager::new_undefined_symbol): New function.
4227         (Plugin_manager::rescan): New function.
4228         (Plugin_manager::rescannable_defines): New function.
4229         (Plugin_manager::add_input_file): Set any_added_.
4230         * plugin.h (class Plugin_manager): define new fields rescannable_,
4231         undefined_symbols_, any_claimed_, and any_added_.  Declare
4232         Plugin_rescan as friend.  Declare new functions.
4233         (Plugin_manager::Rescannable): Define type.
4234         (Plugin_manager::Rescannable_list): Define type.
4235         (Plugin_manager::Undefined_symbol_list): Define type.
4236         (Plugin_manager::Plugin_manager): Initialize new fields.
4237         * archive.cc (Archive::defines_symbol): New function.
4238         (Add_archive_symbols::run): Pass archive to plugins if any.
4239         * archive.h (class Archive): Declare defines_symbol.
4240         * readsyms.cc (Input_group::~Input_group): New function.
4241         (Finish_group::run): Pass input_group to plugins if any.
4242         * readsyms.h (class Input_group): Declare destructor.
4243         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4244         any.
4245
4246 2011-01-10  Ian Lance Taylor  <iant@google.com>
4247
4248         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4249         section as relro.
4250         (Layout::set_segment_offsets): Reset increase_relro before calling
4251         set_section_addresses a second time.
4252
4253 2011-01-04  Cary Coutant  <ccoutant@google.com>
4254
4255         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4256         sections before NOBITS sections.
4257
4258 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4259
4260         * version.cc (print_version): Update copyright to 2011.
4261
4262 2010-12-23  Cary Coutant  <ccoutant@google.com>
4263
4264         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4265         of OS to this->add.  Add OD parameter to second form of the function.
4266
4267 2010-12-20  Ian Lance Taylor  <iant@google.com>
4268
4269         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4270         second of two consecutive entries with same offset.
4271
4272 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4273
4274         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4275         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4276         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4277         to avoid unneeded links against $(LDADD).
4278         * testsuite/Makefile.in: Regenerate.
4279
4280 2010-12-15  Ian Lance Taylor  <iant@google.com>
4281
4282         PR gold/12324
4283         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4284         for R_X86_64_32 and R_X86_64_PC32.
4285         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4286         ver_matching_def_pic.o.
4287         (ver_matching_def_pic.o): New target.
4288
4289 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4290
4291         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4292         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4293         Move definition before File_read::View member definitions.
4294         (File_read::View::~View): Initialize and hold lock before
4295         updating current_mapped_bytes.
4296
4297 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4298
4299         * dwarf_reader.cc: Remove outdated comment.
4300         * gold-threads.cc: Fix typo in error message.
4301         * archive.cc: Fix typos in comments.
4302         * archive.h: Likewise.
4303         * arm-reloc-property.cc: Likewise.
4304         * arm-reloc-property.h: Likewise.
4305         * arm-reloc.def: Likewise.
4306         * arm.cc: Likewise.
4307         * attributes.h: Likewise.
4308         * cref.cc: Likewise.
4309         * ehframe.cc: Likewise.
4310         * fileread.h: Likewise.
4311         * gold.h: Likewise.
4312         * i386.cc: Likewise.
4313         * icf.cc: Likewise.
4314         * incremental.h: Likewise.
4315         * int_encoding.cc: Likewise.
4316         * layout.h: Likewise.
4317         * main.cc: Likewise.
4318         * merge.h: Likewise.
4319         * object.cc: Likewise.
4320         * object.h: Likewise.
4321         * options.cc: Likewise.
4322         * readsyms.cc: Likewise.
4323         * reduced_debug_output.cc: Likewise.
4324         * reloc.cc: Likewise.
4325         * script-sections.cc: Likewise.
4326         * sparc.cc: Likewise.
4327         * symtab.h: Likewise.
4328         * target-reloc.h: Likewise.
4329         * target.cc: Likewise.
4330         * target.h: Likewise.
4331         * timer.cc: Likewise.
4332         * timer.h: Likewise.
4333         * x86_64.cc: Likewise.
4334
4335 2010-12-09  Cary Coutant  <ccoutant@google.com>
4336
4337         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4338         stack.
4339         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4340         parameter; change all callers.
4341         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4342         * options.h (warn_execstack): New option.
4343
4344 2010-12-07  Doug Kwan  <dougkwan@google.com>
4345
4346         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4347         like function call relocations.
4348
4349 2010-12-07  Ian Lance Taylor  <iant@google.com>
4350
4351         * archive.cc (Archive::get_elf_object_for_member): Permit
4352         punconfigured to be NULL.
4353         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4354         (Archive::include_member): Pass NULL to get_elf_object_for_member
4355         if we searched for the archive and this is the first included
4356         object.
4357
4358 2010-12-01  Ian Lance Taylor  <iant@google.com>
4359
4360         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4361         track_relocs_type_ field.
4362         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4363         Set track_relocs_type_.
4364         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4365         contents when using RELA relocs.
4366         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4367         reloc_map_.
4368         * reloc.cc (Track_relocs::next_addend): New function.
4369         * reloc.h (class Track_relocs): Declare next_addend.
4370
4371 2010-12-01  Ian Lance Taylor  <iant@google.com>
4372
4373         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4374         virtual destructor.
4375
4376 2010-12-01  Ian Lance Taylor  <iant@google.com>
4377
4378         * README: Update compilers known to work and fail.
4379
4380 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4381
4382         * configure.in: For --enable-gold, handle value `default' instead of
4383         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4384         not the default.
4385         * configure: Regenerate.
4386
4387 2010-11-18  Doug Kwan  <dougkwan@google.com>
4388
4389         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4390         and right_alignment to be zero.  Store result alignment only if it is
4391         greater than existing alignment.
4392
4393 2010-11-16  Cary Coutant  <ccoutant@google.com>
4394
4395         PR gold/12220
4396         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4397         Check for ".zdebug_line".
4398
4399 2010-11-16  Doug Kwan  <dougkwan@google.com>
4400             Cary Coutant  <ccoutant@google.com>
4401
4402         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4403         by reference; adjust all callers.
4404         * output.cc (Output_segment::set_section_addresses): Adjust references
4405         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4406         list is empty.
4407         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4408         end at page boundary.
4409
4410 2010-11-16  Cary Coutant  <ccoutant@google.com>
4411
4412         PR gold/12220
4413         * layout.cc (Layout::choose_output_section): Transform names of
4414         compressed sections even when using a script with a SECTIONS clause.
4415         (Layout::output_section_name): Remove code to transform
4416         compressed debug section names.
4417         * output.cc (Output_section::add_input_section): Use uncompressed
4418         section size when tracking input sections.
4419
4420 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4421
4422         * symtab.h (Symbol::NON_PIC_REF): Remove.
4423         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4424         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4425         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4426         (Symbol::use_plt_offset): Take a flags argument and pass it
4427         directly to needs_dynamic_reloc.  Restrict check for undefined
4428         weak symbols to function calls.
4429         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4430         (Target_arm::Scan::global): Use it.
4431         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4432         (Target_arm::Relocate::relocate): Likewise.
4433         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4434         parameter with an r_type parameter.  Use get_reference_flags
4435         to get the flags.
4436         (Target_arm::Relocate::relocate): Update accordingly.
4437         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4438         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4439         (Target_i386::Scan::global): Likewise.
4440         (Target_i386::Relocate::relocate): Likewise.
4441         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4442         parameter with an r_type parameter.  Use get_reference_flags
4443         to get the flags.
4444         (Target_i386::Relocate::relocate): Update accordingly.
4445         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4446         (Target_powerpc::Scan::global): Use it.
4447         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4448         (Target_powerpc::Relocate::relocate): Likewise.
4449         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4450         (Target_sparc::Scan::global): Use it.
4451         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4452         (Target_sparc::Relocate::relocate): Likewise.
4453         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4454         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4455         (Target_x86_64::Scan::global): Likewise.
4456         (Target_x86_64::Relocate::relocate): Likewise.
4457
4458 2010-11-08  Doug Kwan  <dougkwan@google.com>
4459             Cary Coutant  <ccoutant@google.com>
4460
4461         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4462         (Arm_exidx_merge_section::section_contents_): New data member.
4463         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4464         (Arm_input_section::~Arm_input_section): De-allocate memory.
4465         (Arm_input_section::original_contents_): New data member.
4466         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4467         in parameters instead of calling Object::section_contents without
4468         locking.
4469         (Arm_output_section::group_section): New parameter TASK.  Pass it
4470         to callees that need locking objects.
4471         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4472         to lock EXIDX input sections.  Fix a formatting issue.  Call
4473         Arm_exidx_merged_section::build_contents to create merged section
4474         contents.
4475         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4476         to lock object of stub table owner.
4477         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4478         TEXT_SIZE to initialize data member TEXT_SIZE_.
4479         (Arm_exidx_input_section::addralign): Fix typo in comment.
4480         (Arm_exidx_input_section::text_size): New method.
4481         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4482         that require locking objects.  Lock objects before scanning for stubs
4483         and updating local symbols.
4484         (Arm_input_section<big_endian>::init): Copy contents of original
4485         input section.
4486         (Arm_input_section<big_endian>::do_write): Use saved contents of
4487         original input section instead of calling Object::section_contents
4488         without locking.
4489         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4490         size without calling Object::section_size().
4491         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4492         for size.  Allocate a buffer for merged EXIDX entries.
4493         (Arm_exidx_merged_section::build_contents): New method.
4494         (Arm_exidx_merged_section::do_write): Move merge section contents
4495         building code to Arm_exidx_merged_section::build_contetns.  Write
4496         out contetns in buffer instead of building it on the fly.
4497         (Arm_relobj::make_exidx_input_section): Also pass text section size
4498         to Arm_exidx_input_section constructor.
4499         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4500         (Arm_dynobj::do_read_symbols): Fix memory leak.
4501         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4502         * target.h: (class Task): Add forward declaration.
4503         (Target::relax): Add new parameter TASK and pass it to
4504         Target::do_relax().
4505         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4506
4507 2010-11-05  Cary Coutant  <ccoutant@google.com>
4508
4509         PR gold/10708
4510         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4511         object when reading from the file.
4512         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4513         second layout pass.
4514         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4515         when reading section contents.
4516         (get_section_contents): Likewise.
4517         (icf::find_identical_sections): Likewise.
4518         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4519         object when reading from the file.
4520         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4521         the object when doing deferred section layout.
4522
4523 2010-11-03  Nick Clifton  <nickc@redhat.com>
4524
4525         PR gold/12001
4526         * script.h (class Symbol_assignment: name): New member.  Returns
4527         the name of the symbol.
4528         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4529         Returns true if the given symbol name is on the list of
4530         assignments wating to be processed.
4531         * archive.cc (should_incldue_member): If the symbol is undefined,
4532         check to see if it is on the list of symbols pending assignment.
4533
4534 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4535
4536         * script-sections.cc (Script_sections::find_memory_region): Check
4537         for a NULL output section pointer.
4538
4539 2010-10-29  Doug Kwan  <dougkwan@google.com>
4540
4541         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4542         Output_section::add_relaxed_input_section.
4543         * output.cc (Output_section::add_relaxed_input_section): Add new
4544         arguments LAYOUT and NAME.  Set section order index.
4545         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4546         Copy section order index.
4547         * output.h (Output_section::add_relaxed_input_section): Add new
4548         arguments LAYOUT and NAME.
4549
4550 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4551
4552         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4553         NATIVE_OR_CROSS_LINKER.
4554         * testsuite/Makefile.in: Regenerate.
4555
4556 2010-10-20  Doug Kwan  <dougkwan@google.com>
4557
4558         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4559         without SHF_LINK_ORDER flags.
4560         * layout.cc (Layout::choose_output_section): Do not filter
4561         SHF_LINK_ORDER flag in a relocatable link.
4562
4563 2010-10-17  Cary Coutant  <ccoutant@google.com>
4564
4565         * output.h (Output_segment::set_section_addresses): Change function
4566         signature.  Update all callers.
4567         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4568         sections.
4569         (Output_segment::set_section_addresses): Align after last TLS
4570         section.  Add padding before last relro section instead of after.
4571
4572 2010-10-17  Doug Kwan  <dougkwan@google.com>
4573
4574         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4575         GOT output section to be writable.
4576
4577 2010-10-14  Cary Coutant  <ccoutant@google.com>
4578
4579         * debug.h (DEBUG_INCREMENTAL): New flag.
4580         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4581         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4582         mode.
4583         * incremental.cc (report_command_line): Ignore all forms of
4584         --incremental.
4585         * layout.cc (Layout::Layout): Check parameters for incremental link
4586         mode.
4587         * options.cc (General_options::parse_incremental): New function.
4588         (General_options::parse_no_incremental): New function.
4589         (General_options::parse_incremental_full): New function.
4590         (General_options::parse_incremental_update): New function.
4591         (General_options::incremental_mode_): New data member.
4592         (General_options::finalize): Check incremental_mode_.
4593         * options.h (General_options): Update help text for --incremental.
4594         Add --no-incremental, --incremental-full, --incremental-update.
4595         (General_options::Incremental_mode): New enum type.
4596         (General_options::incremental_mode): New function.
4597         (General_options::incremental_mode_): New data member.
4598         * parameters.cc (Parameters::incremental_mode_): New data member.
4599         (Parameters::set_options): Set incremental_mode_.
4600         (Parameters::set_incremental_full): New function.
4601         (Parameters::incremental): New function.
4602         (Parameters::incremental_update): New function.
4603         (set_parameters_incremental_full): New function.
4604         * parameters.h (Parameters::set_incremental_full): New function.
4605         (Parameters::incremental): New function.
4606         (Parameters::incremental_update): New function.
4607         (Parameters::incremental_mode_): New data member.
4608         (set_parameters_incremental_full): New function.
4609         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4610         incremental link mode.
4611         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4612         (Sized_relobj::do_relocate_sections): Likewise.
4613         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4614         option.
4615         * testsuite/Makefile.in: Regenerate.
4616         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4617
4618 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4619
4620         * script-sections.h (class Script_sections): Make
4621         Sections_elements typedef public.
4622         * script-sections.cc (class Sort_output_sections): Add elements_
4623         field.  Add constructor which sets it; change all callers.
4624         (Sort_output_sections::is_before): New function.
4625         (Sort_output_sections::operator()): Call is_before.
4626         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4627         conditional.
4628         * testsuite/script_test_10.sh: New test. Test script section
4629         order.
4630         * testsuite/script_test_10.t: Likewise.
4631         * testsuite/script_test_10.s: Likewise.
4632         * testsuite/Makefile.am: Wrap the cross linker tests and the
4633         common tests into NATIVE_OR_CROSS_LINKER.
4634         (check_SCRIPTS): Add script_test_10.sh.
4635         (check_DATA): Add script_test_10.stdout.
4636         (script_test_10.o, script_test_10): New targets.
4637         (script_test_10.stdout): New target.
4638         * configure, testsuite/Makefile.in: Regenerate.
4639
4640 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4641
4642         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4643         error for the deprecated relocations.
4644         (Target_arm::Scan::global): Likewise.
4645         (Target_arm::Relocate::relocate): Likewise.
4646
4647 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4648
4649         * fileread.cc (Input_file::find_file): Initialize *found_name
4650         and *namep when using the fallback search for case 4.
4651
4652 2010-10-11  Cary Coutant  <ccoutant@google.com>
4653
4654         * options.h (class General_options): Redefine -z lazy as an alias for
4655         the negation of -z now.
4656
4657 2010-10-11  Ian Lance Taylor  <iant@google.com>
4658
4659         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4660         binding.
4661
4662 2010-10-06  Nick Clifton  <nickc@redhat.com>
4663
4664         * script-sections.cc(class Memory_region): Remove
4665         current_lma_offset_ field.  Rename current_vma_offset_ to
4666         current_offset_.  Add last_section_ field.
4667         (Memory_region::get_current_vma_address): Rename to
4668         get_current_address.
4669         (Memory_region::get_current_lma_address): Delete.
4670         (Memory_region::increment_vma_offset): Rename to
4671         increment_offset.
4672         (Memory_region::increment_lma_offset): Delete.
4673         (Memory_region::attributes_compatible): New method.  Returns
4674         true if the provided section is compatible with the region.
4675         (Memory_region::get_last_section): New method.  Returns the last
4676         section to use the region.
4677         (Memory_region::set_last_section): New method.  Stores the last
4678         section to use the region.
4679         (Script_sections::block_in_region): New method.  Returns true if
4680         a block of memory is contained within a region.
4681         (Script_sections::find_memory_region): New method.  Locates a
4682         memory region to be used to set a VMA or LMA address.
4683         (Output_section_definition::set_section_addresses): Add code to
4684         check for addresses set by memory regions.
4685         (Output_segment::set_section_addresses): Remove memory region
4686         walking code.
4687         (Script_sections::create_segment): Add a warning if a header
4688         segment is created outside of any region.
4689         * script-sections.h (class Script_sections): Add prototypes for
4690         find_memory_region and block_in_region methods.
4691         * testsuite/memory_test.s: Use .long instead of .word.
4692         * testsuite/memory_test.t: Add some more output sections.
4693         * testsuite/memory_test.sh: Update expected output.
4694
4695 2010-10-02  Doug Kwan  <dougkwan@google.com>
4696
4697         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4698         defintion to symtab.h
4699         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4700         declaration to defintion.
4701
4702 2010-10-01  Nick Clifton  <nickc@redhat.com>
4703
4704         * expression.cc (eval): Replace dummy argument with NULL.
4705         (eval_maybe_dot): Check for a NULL result section pointer.
4706         (Symbol_expression::value): Likewise.
4707         (Dot_expression::value): Likewise.
4708         (BINARY_EXPRESSION): Likewise.
4709         (Max_expression::value): Likewise.
4710         (Min_expression::value): Likewise.
4711         (Absolute_expression::value): Likewise.
4712         (Addr_expression::value_from_output_section): Likewise.
4713         (Loaddddr_expression::value_from_output_section): Likewise.
4714         (Segment_start_expression::value): Likewise.
4715         * script-sections.cc
4716         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4717         argument with NULL.
4718         (Sections_elememt_dot_assignment::set_section_addresses):
4719         Likewise.
4720         (Output_data_expression::do_write_to_buffer): Likewise.
4721         (Output_section_definition::finalize_symbols): Likewise.
4722         (Output_section_definition::set_section_addresses): Likewise.
4723
4724 2010-09-30  Doug Kwan  <dougkwan@google.com>
4725
4726         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4727
4728 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4729
4730         * target.h (Target::can_icf_inline_merge_sections): New virtual
4731         function.
4732         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4733         virtual function.
4734         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4735         virtual function.
4736         * icf.cc (get_section_contents): Inline merge sections only when
4737         target allows it.
4738
4739 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4740
4741         * configure: Regenerate.
4742
4743 2010-09-17  Ian Lance Taylor  <iant@google.com>
4744
4745         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4746         * testsuite/Makefile.am (memory_test.o): New target.
4747         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4748         memory_test.t.
4749         * testsuite/Makefile.in: Rebuild.
4750
4751 2010-09-17  Doug Kwan  <dougkwan@google.com>
4752
4753         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4754         defintion if relocation uses GOT entries of the symbol.
4755         * testsuite/icf_safe_test.sh: Fix test.
4756         * testsuite/icf_safe_so_test.sh: Fix test.
4757
4758 2010-09-16  Cary Coutant  <ccoutant@google.com>
4759
4760         * script_sections.cc (class Memory_region): Remove "NULL" from
4761         vector initializations.
4762
4763 2010-09-15  Cary Coutant  <ccoutant@google.com>
4764
4765         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4766         Resolve forwarding symbols.
4767
4768 2010-09-15  Doug Kwan  <dougkwan@google.com>
4769
4770         * gold/testsuite/script_test_3.t: Add ARM special sections.
4771         * gold/testsuite/script_test_4.t: Same.
4772         * gold/testsuite/script_test_5.t: Same.
4773         * gold/testsuite/script_test_6.t: Same.
4774         * gold/testsuite/script_test_7.t: Same.
4775         * gold/testsuite/script_test_7.t: Same.
4776         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4777
4778 2010-09-14  Cary Coutant  <ccoutant@google.com>
4779
4780         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4781         (Target_x86_64::Relocate::relocate_tls): Replace check for
4782         saw_tls_block_reloc_ with test for executable section.
4783
4784 2010-09-12  Cary Coutant  <ccoutant@google.com>
4785
4786         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4787         position-independent executables to shared libraries need dynamic
4788         relocations.
4789         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4790         position-independent executables.
4791         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4792         * testsuite/Makefile.in: Regenerate.
4793
4794 2010-09-10  Nick Clifton  <nickc@redhat.com>
4795
4796         PR gold/11997
4797         * testsuite/memory_test.t: Discard any sections that are not
4798         needed.
4799
4800 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4801
4802         PR gold/11996
4803         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4804         "This::" to work around a bug in gcc 4.2.
4805
4806         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4807
4808 2010-09-09  Rafael Espindola  <espindola@google.com>
4809
4810         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4811         sections with different PF_X flags in the same segment.
4812         (Layout::find_first_load_seg): Search all segments to find the first
4813         one.
4814         * options.h (rosegment): New.
4815
4816 2010-09-08  Rafael Espindola  <espindola@google.com>
4817
4818         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4819
4820 2010-09-08  Doug Kwan  <dougkwan@google.com>
4821
4822         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4823         (Arm_relobj::do_relocate_sections): Add new parameter for output
4824         file to match the parent.
4825         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4826         of local symbols instead of input values.  Update code to track
4827         changes in gold::relocate_section.
4828         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4829         (Sized_relobj::compute_final_local_value_internal): New methods.
4830         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4831         body into private version of Sized_relobj::compute_final_local_value.
4832         Call the inline method.
4833         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4834         merged symbol value if there is one.
4835         (Symbol_value::has_output_value): New method defintiion.
4836         (Sized_relobj::Compute_final_local_value_status): New enum type.
4837         (Sized_relobj::compute_final_local_value): New methods.
4838         (Sized_relobj::compute_final_local_value_internal): New methods.
4839         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4840         and arm_cortex_a8.sh.
4841         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4842         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4843         New tests.
4844         * Makefile.in: Regenerate.
4845         * testsuite/arm_bl_out_of_range.s: Update test.
4846         * testsuite/thumb_bl_out_of_range.s: Ditto.
4847         * testsuite/thumb_blx_out_of_range.s: Ditto.
4848         * testsuite/arm_branch_out_of_range.sh: New file.
4849         * testsuite/arm_cortex_a8.sh: Ditto.
4850         * testsuite/arm_cortex_a8_b.s: Ditto.
4851         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4852         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4853         * testsuite/arm_cortex_a8_bl.s: Ditto.
4854         * testsuite/arm_cortex_a8_blx.s: Ditto.
4855         * testsuite/arm_cortex_a8_local.s: Ditto.
4856         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4857         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4858
4859 2010-09-08  Rafael Espindola  <espindola@google.com>
4860
4861         * Makefile.am (memory_test.stdout): Run readelf with -W.
4862         * Makefile.in: Regenerate.
4863         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4864         64 bit output.
4865
4866 2010-09-08  Rafael Espindola  <espindola@google.com>
4867
4868         * script-sections.cc (Script_sections::add_memory_region): Convert
4869         field precision to int.
4870         * script.cc (script_set_section_region, script_set_section_region):
4871         Convert field precision to int.
4872
4873 2010-09-08  Rafael Espindola  <espindola@google.com>
4874
4875         * arm.cc (do_finalize_sections): Create the __exidx_start and
4876         __exdix_end symbols even when the section is missing.
4877
4878 2010-09-08  Nick Clifton  <nickc@redhat.com>
4879
4880         * README: Remove claim that MEMORY is not supported.
4881         * expression.cc (script_exp_function_origin)
4882         (script_exp_function_length): Move from here to ...
4883         * script.cc: ... here.
4884         (script_set_section_region, script_add_memory)
4885         (script_parse_memory_attr, script_include_directive): New
4886         functions.
4887         * script-sections.cc
4888         (class Memory_region): New class.
4889         (class Output_section_definition): Add set_memory_region,
4890         set_section_vma, set_section_lma and get_section_name methods.
4891         (class Script_Sections): Add add_memory_region,
4892         find_memory_region, find_memory_region_origin,
4893         find_memory_region_length and set_memory_region methods.
4894         Have set_section_addresses method walk the list of set memory
4895         regions.
4896         Extend the print methos to display memory regions.
4897         * script-sections.h: Add prototypes for new methods.
4898         Add enum for MEMORY region attributes.
4899         * yyscript.y: Add support for parsing MEMORY regions.
4900         * script-c.h: Add prototypes for new functions.
4901         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4902         * testsuite/Makefile.in: Regenerate.
4903         * testsuite/memory_test.sh: New script.
4904         * testsuite/memory_test.s: New assembler source file.
4905         * testsuite/memory_test.t: New linker script.
4906
4907 2010-08-27  Doug Kwan  <dougkwan@google.com>
4908
4909         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4910         reference override an existing dynamic weak reference.
4911         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4912         * testsuite/Makefile.in: Regenerate.
4913         * testsuite/dyn_weak_ref.sh: New file.
4914         * testsuite/dyn_weak_ref_1.c: Ditto.
4915         * testsuite/dyn_weak_ref_2.c: Ditto.
4916
4917 2010-08-27  Ian Lance Taylor  <iant@google.com>
4918
4919         * incremental.h (class Incremental_input_entry): Add virtual
4920         destructor.
4921
4922 2010-08-27  Ian Lance Taylor  <iant@google.com>
4923
4924         * testsuite/start_lib_test_3.c: Mark t3 as used.
4925
4926 2010-08-27  Nick Clifton  <nickc@redhat.com>
4927
4928         * options.cc (version_script): Fix small typo in previous
4929         whitespace tidyup.
4930
4931 2010-08-25  Nick Clifton  <nickc@redhat.com>
4932
4933         * archive.cc: Formatting fixes: Remove whitespace between
4934         typename and following asterisk.  Remove whitespace between
4935         function name and opening parenthesis.
4936         * archive.h: Likewise.
4937         * arm.cc: Likewise.
4938         * attributes.cc: Likewise.
4939         * attributes.h: Likewise.
4940         * common.cc: Likewise.
4941         * copy-relocs.cc: Likewise.
4942         * dirsearch.h: Likewise.
4943         * dynobj.cc: Likewise.
4944         * ehframe.cc: Likewise.
4945         * ehframe.h: Likewise.
4946         * expression.cc: Likewise.
4947         * fileread.cc: Likewise.
4948         * fileread.h: Likewise.
4949         * gc.h: Likewise.
4950         * gold-threads.cc: Likewise.
4951         * gold.cc: Likewise.
4952         * i386.cc: Likewise.
4953         * icf.h: Likewise.
4954         * incremental-dump.cc: Likewise.
4955         * incremental.cc: Likewise.
4956         * layout.cc: Likewise.
4957         * layout.h: Likewise.
4958         * main.cc: Likewise.
4959         * merge.cc: Likewise.
4960         * merge.h: Likewise.
4961         * object.cc: Likewise.
4962         * object.h: Likewise.
4963         * options.cc: Likewise.
4964         * options.h: Likewise.
4965         * output.cc: Likewise.
4966         * output.h: Likewise.
4967         * plugin.cc: Likewise.
4968         * plugin.h: Likewise.
4969         * powerpc.cc: Likewise.
4970         * reloc.cc: Likewise.
4971         * script-c.h: Likewise.
4972         * script-sections.cc: Likewise.
4973         * script.cc: Likewise.
4974         * stringpool.cc: Likewise.
4975         * symtab.cc: Likewise.
4976         * symtab.h: Likewise.
4977         * target.cc: Likewise.
4978         * timer.cc: Likewise.
4979         * timer.h: Likewise.
4980         * version.cc: Likewise.
4981         * x86_64.cc: Likewise.
4982
4983 2010-08-24  Nick Clifton  <nickc@redhat.com>
4984
4985         PR 11899
4986         * layout.cc (segment_precedes): Sort segments by their physical
4987         addresses, if they have been set.
4988
4989 2010-08-23  Cary Coutant  <ccoutant@google.com>
4990
4991         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4992         symbols data.
4993         (Lib_group::include_member): Unlock object after deleting its
4994         symbols data.
4995         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4996         the bug fixed here.
4997
4998 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4999             Cary Coutant  <ccoutant@google.com>
5000
5001         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5002         constructor, and set_blocker.
5003         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5004         readsyms_blocker_.
5005         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5006         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5007         * testsuite/Makefile.am (start_lib_test): New test case.
5008         * testsuite/Makefile.in: Regenerate.
5009         * testsuite/start_lib_test_main.c: New file.
5010         * testsuite/start_lib_test_1.c: New file.
5011         * testsuite/start_lib_test_2.c: New file.
5012         * testsuite/start_lib_test_3.c: New file.
5013
5014 2010-08-19  Ian Lance Taylor  <iant@google.com>
5015
5016         * Makefile.in: Rebuild with automake 1.11.1.
5017         * aclocal.m4: Likewise.
5018         * testsuite/Makefile.in: Likewise.
5019
5020 2010-08-19  Ian Lance Taylor  <iant@google.com>
5021
5022         PR 10893
5023         * i386.cc (class Output_data_plt_i386): Update declarations.
5024         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5025         local_ifuncs_ fields.
5026         (Target_i386::do_plt_section_for_global): New function.
5027         (Target_i386::do_plt_section_for_local): New function.
5028         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5029         parameter; change all callers.  Initialize global_ifuncs_ and
5030         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5031         __rel_iplt_end.
5032         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5033         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5034         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5035         symbols.
5036         (Target_i386::make_plt_section): New function, broken out of
5037         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5038         (Target_i386::make_plt_entry): Call make_plt_section.
5039         (Target_i386::make_local_ifunc_plt_entry): New function.
5040         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5041         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5042         R_386_IRELATIVE to switch.
5043         (Target_i386::Scan::global): Likewise.
5044         (Target_i386::Relocate::relocate): Likewise.
5045         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5046         switch.
5047         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5048         (Target_x86_64::do_plt_section_for_global): New function.
5049         (Target_x86_64::do_plt_section_for_local): New function.
5050         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5051         parameter; change all callers.  If doing a static link define
5052         __rela_iplt_start and __rela_iplt_end.
5053         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5054         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5055         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5056         to point to .plt.
5057         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5058         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5059         switch.
5060         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5061         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5062         R_X86_64_IRELATIVE to switch.
5063         (Target_x86_64::Scan::global): Likewise.
5064         (Target_x86_64::Relocate::relocate): Likewise.
5065         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5066         switch.
5067         * target.h (class Target): Add plt_section_for_global and
5068         plt_section_for_local functions.  Add do_plt_section_for_global
5069         and do_plt_section_for_local virtual functions.
5070         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5071         clarifying comments.
5072         (Symbol::use_plt_offset): Handle IFUNC symbol.
5073         * object.cc (Sized_relobj::Sized_relobj): Initialize
5074         local_plt_offsets_.
5075         (Sized_relobj::local_has_plt_offset): New function.
5076         (Sized_relobj::local_plt_offset): New function.
5077         (Sized_relobj::set_local_plt_offset): New function.
5078         (Sized_relobj::do_count): Handle IFUNC symbol.
5079         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5080         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5081         is_ifunc_symbol functions.
5082         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5083         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5084         local_plt_offsets_ field.
5085         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5086         * output.h (class Output_section_data): Add non-const
5087         output_section function.
5088         (class Output_data_got): Update declarations.
5089         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5090         Add use_plt_offset parameter to global and local constructors.
5091         Change all callers.  Change local_sym_index_ field to 31 bits.
5092         Change GSYM_CODE and CONSTANT_CODE accordingly.
5093         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5094         doing a static link don't set sh_link field.
5095         (Output_data_got::Got_entry::write): Use PLT offset if
5096         appropriate.
5097         (Output_data_got::add_global_plt): New function.
5098         (Output_data_got::add_local_plt): New function.
5099         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5100         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5101         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5102         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5103         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5104         IFUNC conditional.
5105         * testsuite/ifunc-sel.h: New file.
5106         * testsuite/ifuncmain1.c: New file.
5107         * testsuite/ifuncmain1vis.c: New file.
5108         * testsuite/ifuncmod1.c: New file.
5109         * testsuite/ifuncdep2.c: New file.
5110         * testsuite/ifuncmain2.c: New file.
5111         * testsuite/ifuncmain3.c: New file.
5112         * testsuite/ifuncmod3.c: New file.
5113         * testsuite/ifuncmain4.c: New file.
5114         * testsuite/ifuncmain5.c: New file.
5115         * testsuite/ifuncmod5.c: New file.
5116         * testsuite/ifuncmain6pie.c: New file.
5117         * testsuite/ifuncmod6.c: New file.
5118         * testsuite/ifuncmain7.c: New file.
5119         * configure, testsuite/Makefile.in: Rebuild.
5120
5121 2010-08-18  Ian Lance Taylor  <iant@google.com>
5122
5123         * incremental.cc
5124         (Output_section_incremental_inputs::write_input_files): Add cast
5125         to avoid signed/unsigned comparison warning.
5126         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5127
5128 2010-08-12  Cary Coutant  <ccoutant@google.com>
5129
5130         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5131
5132 2010-08-13  Ian Lance Taylor  <iant@google.com>
5133
5134         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5135
5136 2010-08-12  Cary Coutant  <ccoutant@google.com>
5137             Doug Kwan  <dougkwan@google.com>
5138
5139         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5140         defintion overrides non-weak undef, remember that the original undef
5141         is not weak.
5142         * symtab.cc (Symbol_table::sized_write_global): For undef without
5143         an original weak binding, set binding to global in output.
5144         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5145         * testsuite/Makefile.in: Regenerate.
5146         * testsuite/strong_ref_weak_def.sh: New file.
5147         * testsuite/strong_ref_weak_def_1.c: Ditto.
5148         * testsuite/strong_ref_weak_def_2.c: Ditto.
5149
5150 2010-08-12  Cary Coutant  <ccoutant@google.com>
5151
5152         * testsuite/incremental_test.sh: Rewrite.
5153         * testsuite/incremental_test_1.c: Rewrite.
5154         * testsuite/incremental_test_2.c: Rewrite.
5155
5156 2010-08-12  Cary Coutant  <ccoutant@google.com>
5157
5158         * arm.cc (Target_arm::got_size): Add const.
5159         (Target_arm::got_entry_count): New function.
5160         (Target_arm::plt_entry_count): New function.
5161         (Target_arm::first_plt_entry_offset): New function.
5162         (Target_arm::plt_entry_size): New function.
5163         (Output_data_plt_arm::entry_count): New function.
5164         (Output_data_plt_arm::first_plt_entry_offset): New function.
5165         (Output_data_plt_arm::get_plt_entry_size): New function.
5166         * i386.cc (Target_i386::got_size): Add const.
5167         (Target_i386::got_entry_count): New function.
5168         (Target_i386::plt_entry_count): New function.
5169         (Target_i386::first_plt_entry_offset): New function.
5170         (Target_i386::plt_entry_size): New function.
5171         (Output_data_plt_i386::entry_count): New function.
5172         (Output_data_plt_i386::first_plt_entry_offset): New function.
5173         (Output_data_plt_i386::get_plt_entry_size): New function.
5174         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5175         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5176         * incremental.cc: Include target.h.
5177         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5178         parameter.  Adjust all callers.  Find incremental_got_plt section.
5179         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5180         section.
5181         (Output_section_incremental_inputs::set_final_data_size): Calculate
5182         size of incremental_got_plt section.
5183         (Output_section_incremental_inputs::do_write): Write the
5184         incremental_got_plt section.
5185         (Got_plt_view_info): New struct.
5186         (Local_got_offset_visitor): New class.
5187         (Global_got_offset_visitor): New class.
5188         (Global_symbol_visitor_got_plt): New class.
5189         (Output_section_incremental_inputs::write_got_plt): New function.
5190         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5191         Add parameter.  Adjust all callers.
5192         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5193         (Incremental_inputs::got_plt_section): New function.
5194         (Incremental_inputs::got_plt_section_): New data member.
5195         (Incremental_got_plt_reader): New class.
5196         * layout.cc (Layout::create_incremental_info_sections): Add the
5197         incremental_got_plt section.
5198         * object.h (Got_offset_list::get_list): New function.
5199         (Got offset_list::for_all_got_offsets): New function.
5200         (Sized_relobj::local_got_offset_list): New function.
5201         * powerpc.cc (Target_powerpc::got_size): Add const.
5202         (Target_powerpc::got_entry_count): New function.
5203         (Target_powerpc::plt_entry_count): New function.
5204         (Target_powerpc::first_plt_entry_offset): New function.
5205         (Target_powerpc::plt_entry_size): New function.
5206         (Output_data_plt_powerpc::entry_count): New function.
5207         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5208         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5209         * sparc.cc (Target_sparc::got_size): Add const.
5210         (Target_sparc::got_entry_count): New function.
5211         (Target_sparc::plt_entry_count): New function.
5212         (Target_sparc::first_plt_entry_offset): New function.
5213         (Target_sparc::plt_entry_size): New function.
5214         (Output_data_plt_sparc::entry_count): New function.
5215         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5216         (Output_data_plt_sparc::get_plt_entry_size): New function.
5217         * symtab.h (Symbol::got_offset_list): New function.
5218         (Symbol_table::for_all_symbols): New function.
5219         * target.h (Sized_target::got_entry_count): New function.
5220         (Sized_target::plt_entry_count): New function.
5221         (Sized_target::plt_entry_size): New function.
5222         * x86_64.cc (Target_x86_64::got_size): Add const.
5223         (Target_x86_64::got_entry_count): New function.
5224         (Target_x86_64::plt_entry_count): New function.
5225         (Target_x86_64::first_plt_entry_offset): New function.
5226         (Target_x86_64::plt_entry_size): New function.
5227         (Output_data_plt_x86_64::entry_count): New function.
5228         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5229         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5230
5231 2010-08-12  Cary Coutant  <ccoutant@google.com>
5232
5233         * archive.cc: Include incremental.h.
5234         (Archive::Archive): Initialize incremental_info_.
5235         (Archive::include_member): Record archive members in incremental info.
5236         (Add_archive_symbols::run): Record begin and end of an archive in
5237         incremental info.
5238         (Lib_group::include_member): Record objects in incremental info.
5239         * archive.h (Incremental_archive_entry): Forward declaration.
5240         (Archive::set_incremental_info): New member function.
5241         (Archive::incremental_info): New member function.
5242         (Archive::Unused_symbol_iterator): New class.
5243         (Archive::unused_symbols_begin): New member function.
5244         (Archive::unused_symbols_end): New member function.
5245         (Archive::incremental_info_): New data member.
5246         * incremental-dump.cc (find_input_containing_global): New function.
5247         (dump_incremental_inputs): Dump new incremental info sections.
5248         * incremental.cc: Include symtab.h.
5249         (Output_section_incremental_inputs): New class.
5250         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5251         new incremental info sections.
5252         (Sized_incremental_binary::do_check_inputs): Likewise.
5253         (Incremental_inputs::report_archive): Remove.
5254         (Incremental_inputs::report_archive_begin): New function.
5255         (Incremental_inputs::report_archive_end): New function.
5256         (Incremental_inputs::report_object): New function.
5257         (Incremental_inputs::finalize_inputs): Remove.
5258         (Incremental_inputs::report_input_section): New function.
5259         (Incremental_inputs::report_script): Rewrite.
5260         (Incremental_inputs::finalize): Do nothing but finalize string table.
5261         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5262         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5263         (Incremental_inputs::create_data_sections): New function.
5264         (Incremental_inputs::relocs_entsize): New function.
5265         (Output_section_incremental_inputs::set_final_data_size): New function.
5266         (Output_section_incremental_inputs::do_write): New function.
5267         (Output_section_incremental_inputs::write_header): New function.
5268         (Output_section_incremental_inputs::write_input_files): New function.
5269         (Output_section_incremental_inputs::write_info_blocks): New function.
5270         (Output_section_incremental_inputs::write_symtab): New function.
5271         * incremental.h (Incremental_script_entry): Forward declaration.
5272         (Incremental_object_entry): Forward declaration.
5273         (Incremental_archive_entry): Forward declaration.
5274         (Incremental_inputs): Forward declaration.
5275         (Incremental_inputs_header_data): Remove.
5276         (Incremental_inputs_header): Remove.
5277         (Incremental_inputs_header_write): Remove.
5278         (Incremental_inputs_entry_data): Remove.
5279         (Incremental_inputs_entry): Remove.
5280         (Incremental_inputs_entry_write): Remove.
5281         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5282         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5283         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5284         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5285         Likewise.
5286         (Incremental_input_entry): New class.
5287         (Incremental_script_entry): New class.
5288         (Incremental_object_entry): New class.
5289         (Incremental_archive_entry): New class.
5290         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5291         (Incremental_inputs::report_inputs): Remove.
5292         (Incremental_inputs::report_archive): Remove.
5293         (Incremental_inputs::report_archive_begin): New function.
5294         (Incremental_inputs::report_archive_end): New function.
5295         (Incremental_inputs::report_object): Change prototype.
5296         (Incremental_inputs::report_input_section): New function.
5297         (Incremental_inputs::report_script): Change prototype.
5298         (Incremental_inputs::get_reloc_count): New function.
5299         (Incremental_inputs::set_reloc_count): New function.
5300         (Incremental_inputs::create_data_sections): New function.
5301         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5302         (Incremental_inputs::inputs_section): New function.
5303         (Incremental_inputs::symtab_section): New function.
5304         (Incremental_inputs::relocs_section): New function.
5305         (Incremental_inputs::get_stringpool): Add const.
5306         (Incremental_inputs::command_line): Add const.
5307         (Incremental_inputs::inputs): Remove.
5308         (Incremental_inputs::command_line_key): New function.
5309         (Incremental_inputs::input_file_count): New function.
5310         (Incremental_inputs::input_files): New function.
5311         (Incremental_inputs::relocs_entsize): New function.
5312         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5313         (Incremental_inputs::finalize_inputs): Remove.
5314         (Incremental_inputs::Input_info): Remove.
5315         (Incremental_inputs::lock_): Remove.
5316         (Incremental_inputs::inputs_): Change type.
5317         (Incremental_inputs::inputs_map_): Remove.
5318         (Incremental_inputs::current_object_entry_): New data member.
5319         (Incremental_inputs::inputs_section_): New data member.
5320         (Incremental_inputs::symtab_section_): New data member.
5321         (Incremental_inputs::relocs_section_): New data member.
5322         (Incremental_inputs::reloc_count_): New data member.
5323         (Incremental_inputs_reader): New class.
5324         (Incremental_symtab_reader): New class.
5325         (Incremental_relocs_reader): New class.
5326         * layout.cc (Layout::finalize): Move finalization of incremental info
5327         and creation of incremental info sections to follow finalization of
5328         symbol table.  Set offsets for postprocessing sections.
5329         (Layout::create_incremental_info_sections): Call
5330         Incremental_inputs::create_data_sections.  Add incremental symtab
5331         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5332         sections to layout after input sections.
5333         * layout.h (struct Timespec): Forward declaration.
5334         (Layout::incremental_inputs): Add const.
5335         (Layout::create_incremental_info_sections): Add parameter.
5336         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5337         * object.cc: Include incremental.h.
5338         (Relobj::finalize_incremental_relocs): New function.
5339         (Sized_relobj::do_layout): Record input sections in incremental info.
5340         * object.h (Object::output_section): New function.
5341         (Object::output_section_offset): Moved from Relobj.
5342         (Object::get_incremental_reloc_base): New function.
5343         (Object::get_incremental_reloc_count): New function.
5344         (Object::do_output_section): New function.
5345         (Object::do_output_section_offset): Moved from Relobj.
5346         (Object::do_get_incremental_reloc_base): New function.
5347         (Object::do_get_incremental_reloc_count): New function.
5348         (Object::Object): Initialize new data members.
5349         (Relobj::output_section): Renamed do_output_section and moved to
5350         protected.
5351         (Relobj::output_section_offset): Moved to Object.
5352         (Relobj::do_get_incremental_reloc_base): New function.
5353         (Relobj::do_get_incremental_reloc_count): New function.
5354         (Relobj::allocate_incremental_reloc_counts): New function.
5355         (Relobj::count_incremental_reloc): New function.
5356         (Relobj::finalize_incremental_relocs): New function.
5357         (Relobj::next_incremental_reloc_index): New function.
5358         (Relobj::reloc_counts_): New data member.
5359         (Relobj::reloc_bases_): New data member.
5360         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5361         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5362         (Sized_relobj::incremental_relocs_scan): New function.
5363         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5364         (Sized_relobj::incremental_relocs_write): New function.
5365         (Sized_relobj::incremental_relocs_write_reltype): New function.
5366         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5367         incremental link.
5368         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5369         archives and object files elsewhere.
5370         (Add_symbols::run): Report object files here.
5371         (Finish_group::run): Report end of archive at end of group.
5372         * reloc.cc: Include layout.h, incremental.h.
5373         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5374         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5375         (Sized_relobj::incremental_relocs_scan): New function.
5376         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5377         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5378         (Sized_relobj::incremental_relocs_write): New function.
5379         (Sized_relobj::incremental_relocs_write_reltype): New function.
5380         * script.cc (read_input_script): Rewrite test for incremental link.
5381         Change call to Incremental_inputs::report_script.
5382         * symtab.h (Symbol_table::first_global_index): New function.
5383         (Symbol_table::output_count): New function.
5384
5385 2010-08-12  Doug Kwan  <dougkwan@google.com>
5386
5387         * arm.cc (Target_arm::merge_object_attributes): Check command line
5388         options --no-wchar-size-warning and --no-enum-size-warning.
5389         * options.h (General_options): Add ld-compatible options
5390         --no-enum-size-warning and --no-wchar-size-warning.
5391
5392 2010-08-04  Ian Lance Taylor  <iant@google.com>
5393
5394         * x86_64.cc (Target_x86_64::Scan::local): Use
5395         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5396         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5397         (Target_x86_64::Scan::global): Likewise.
5398         (Target_x86_64::Relocate::relocate): Likewise.
5399         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5400         Likewise.
5401
5402 2010-08-03  Cary Coutant  <ccoutant@google.com>
5403
5404         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5405         to reserve space in merged_strings vector. Keep total input size
5406         for stats.
5407         (Output_merge_string::do_print_merge_stats): Print total input size.
5408         * merge.h (Output_merge_string): Add input_size_ field.
5409         * stringpool.cc (Stringpool_template::string_length): Move
5410         implementations out of Stringpool_template class and place in
5411         stringpool.h.
5412         * stringpool.h (string_length): Move out of Stringpool_template.
5413
5414 2010-08-03  Ian Lance Taylor  <iant@google.com>
5415
5416         PR 11712
5417         * layout.cc (relaxation_loop_body): If address of load segment is
5418         set, adjust address to include headers if possible.
5419
5420 2010-08-03  Ian Lance Taylor  <iant@google.com>
5421
5422         * version.cc (version_string): Bump to 1.10.
5423
5424 2010-08-03  Ian Lance Taylor  <iant@google.com>
5425
5426         PR 11805
5427         * layout.h (enum Output_section_order): Define.
5428         (class Layout): Update declarations.
5429         * layout.cc (Layout::get_output_section): Add order parameter.
5430         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5431         is_first_non_relro parameters.  Change all callers.
5432         (Layout::choose_output_section): Likewise.
5433         (Layout::add_output_section_data): Likewise.
5434         (Layout::make_output_section): Likewise.  Set order.
5435         (Layout::default_section_order): New function.
5436         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5437         * output.cc (Output_section::Output_section): Initialize order_.
5438         Don't initialize deleted fields.
5439         (Output_segment::Output_segment): Don't initialize deleted
5440         fields.
5441         (Output_segment::add_output_section_to_load): New function
5442         replacing add_output_section.  Change all callers to call this or
5443         add_output_section_to_nonload.
5444         (Output_segment::add_output_section_to_nonload): New function.
5445         (Output_segment::remove_output_section): Rewrite.
5446         (Output_segment::add_initial_output_data): Likewise.
5447         (Output_segment::has_any_data_sections): Likewise.
5448         (Output_segment::is_first_section_relro): Likewise.
5449         (Output_segment::maximum_alignment): Likewise.
5450         (Output_segment::has_dynamic_reloc): New function replacing
5451         dynamic_reloc_count.  Change all callers.
5452         (Output_segment::has_dynamic_reloc_list): New function replacing
5453         dynamic_reloc_count_list.  Change all callers.
5454         (Output_segment::set_section_addresses): Rewrite.
5455         (Output_segment::set_offset): Rewrite.
5456         (Output_segment::find_first_and_last_list): Remove.
5457         (Output_segment::set_tls_offsets): Rewrite.
5458         (Output_segment::first_section_load_address): Likewise.
5459         (Output_segment::output_section_count): Likewise.
5460         (Output_segment::section_with_lowest_load_address): Likewise.
5461         (Output_segment::write_section_headers): Likewise.
5462         (Output_segment::print_sections_to_map): Likewise.
5463         * output.h (class Output_data): Remove dynamic_reloc_count_
5464         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5465         (Output_data::add_dynamic_reloc): Rewrite.
5466         (Output_data::has_dynamic_reloc): New function.
5467         (Output_data::dynamic_reloc_count): Remove.
5468         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5469         is_last_relro_, is_first_non_relro_, is_interp_,
5470         is_dynamic_linker_section_ fields.  Add order and set_order
5471         functions.  Remove is_relro_local, set_is_relro_local,
5472         is_last_relro, set_is_last_relro, is_first_non_relro,
5473         set_is_first_non_relro functions, is_interp, set_is_interp,
5474         is_dynamic_linker_section, and set_is_dynamic_linker_section
5475         functions.
5476         (class Output_segment): Change Output_data_list from std::list to
5477         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5478         output_bss_ fields.  Update declarations.
5479
5480 2010-08-02  Ian Lance Taylor  <iant@google.com>
5481
5482         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5483         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5484         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5485
5486 2010-08-02  Ian Lance Taylor  <iant@google.com>
5487
5488         PR 11855
5489         * script.cc (Script_options::Script_options): Initialize
5490         symbol_definitions_ and symbol_references_.
5491         (Script_options::add_symbol_assignment): Update
5492         symbol_definitions_ and symbol_references_.
5493         (Script_options::add_symbol_reference): New function.
5494         (script_symbol): New function.
5495         * script.h (class Script_options): Add symbol_definitions_ and
5496         symbol_references_ fields.
5497         (Script_options::referenced_const_iterator): New type.
5498         (Script_options::referenced_begin): New function.
5499         (Script_options::referenced_end): New function.
5500         (Script_options::is_referenced): New function.
5501         (Script_options::any_unreferenced): New function.
5502         * script-c.h (script_symbol): Declare.
5503         * yyscript.y (exp): Call script_symbol.
5504         * symtab.cc: Include "script.h".
5505         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5506         Change all callers.  Check symbols referenced by scripts.
5507         (Symbol_table::add_undefined_symbols_from_command_line): Add
5508         layout parameter.  Change all callers.
5509         (Symbol_table::do_add_undefined_symbols_from_command_line):
5510         Likewise.  Break out loop body.  Check symbols referenced by
5511         scripts.
5512         (Symbol_table::add_undefined_symbol_from_command_line): New
5513         function broken out of
5514         do_add_undefined_symbols_from_command_line.
5515         * symtab.h (class Symbol_table): Update declarations.
5516         * archive.cc: Include "layout.h".
5517         (Archive::should_include_member): Add layout parameter.  Change
5518         all callers.  Check for symbol mentioned in expression.
5519         * archive.h (class Archive): Update declaration.
5520         * object.cc (Sized_relobj::do_should_include_member): Add layout
5521         parameter.
5522         * object.h (Object::should_include_member): Add layout parameter.
5523         Change all callers.
5524         (Object::do_should_include_member): Add layout parameter.
5525         (class Sized_relobj): Update declaration.
5526         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5527         parameter.
5528         * dynobj.h (class Sized_dynobj): Update declaration.
5529         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5530         layout parameter.
5531         * plugin.h (class Sized_pluginobj): Update declaration.
5532
5533 2010-08-02  Ian Lance Taylor  <iant@google.com>
5534
5535         PR 11866
5536         * output.cc (Output_segment::set_offset): Search for the first and
5537         last sections rather than assuming that the list is in order.
5538         (Output_segment::find_first_and_last_list): New function.
5539         * output.h (class Output_segment): Update declarations.
5540         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5541         (relro_strip_test_SOURCES): New variable.
5542         (relro_strip_test_DEPENDENCIES): New variable.
5543         (relro_strip_test_LDFLAGS): New variable.
5544         (relro_strip_test_LDADD): New variable.
5545         (relro_strip_test.so): New target.
5546
5547 2010-08-02  Ian Lance Taylor  <iant@google.com>
5548
5549         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5550         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5551         (Target_i386::got_tlsdesc_section): New function.
5552         (Target_i386::got_section): Create space for GOT entries for
5553         TLSDESC relocations.
5554         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5555         R_386_TLS_GOTDESC.
5556         (Target_i386::Scan::global): Likewise.
5557         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5558         using TLSDESC GOT.
5559         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5560         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5561         (Target_x86_64::got_tlsdesc_section): New function.
5562         (Target_x86_64::got_section): Create space for GOT entries for
5563         TLSDESC relocations.
5564         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5565         R_386_TLS_GOTDESC.
5566         (Target_x86_64::Scan::global): Likewise.
5567         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5568         using TLSDESC GOT.
5569
5570 2010-08-02  Ian Lance Taylor  <iant@google.com>
5571
5572         * testsuite/final_layout.sh: Use dc to convert from hex to
5573         decimal.
5574
5575 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5576
5577         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5578         paramter to the call to gold::gc_process_relocs.
5579         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5580         paramter to the call to gold::gc_process_relocs.
5581         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5582         parameter to the call to gold::gc_process_relocs.
5583         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5584         template parameter to the call to gold::gc_process_relocs.
5585         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5586         paramter to the call to gold::gc_process_relocs.
5587         * gc.h (get_embedded_addend_size): New function.
5588         (gc_process_relocs): Save the size of the reloc for use by ICF.
5589         * icf.cc (get_section_contents): Get the addend from the text section
5590         for SHT_REL relocation sections.
5591         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5592         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5593         * int_encoding.h (read_from_pointer): New overloaded function.
5594         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5595         * testsuite/icf_sht_rel_addend_test.sh: New file.
5596         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5597         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5598
5599 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5600
5601         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5602         * Makefile.in: Regenerate.
5603         * testsuite/Makefile.in: Regenerate.
5604
5605 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5606
5607         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5608         * gold/testsuite/debug_msg.cc: Likewise.
5609         * gold/testsuite/odr_violation1.cc
5610         * gold/testsuite/odr_violation2.cc
5611
5612 2010-07-21  Cary Coutant  <ccoutant@google.com>
5613
5614         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5615         string, and length fields.
5616         (Output_merge_string::Merged_strings_list): New type.
5617         (Output_merge_string::Merged_strings_lists): New typedef.
5618         (Output_merge_string): Replace merged_strings_ with
5619         merged_strings_lists_.
5620         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5621         Merged_strings_list per input object and section.  Don't store pointer
5622         to the string.  Don't store length with each merged string entry.
5623         (Output_merge_string::finalize_merged_data): Loop over list of merged
5624         strings lists.  Recompute length of each merged string.
5625
5626 2010-07-15  Cary Coutant  <ccoutant@google.com>
5627
5628         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5629         here.
5630
5631 2010-07-14  Ian Lance Taylor  <iant@google.com>
5632
5633         * descriptors.cc (Descriptors::open): Report correct name in error
5634         message.
5635
5636 2010-07-13  Doug Kwan  <dougkwan@google.com>
5637
5638         * arm.cc (Arm_input_section::Arm_input_section): For a
5639         SHT_ARM_EXIDX section, always keeps the input sections.
5640         (Arm_input_section::set_exidx_section_link): New method.
5641         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5642         has_errors_ to false.
5643         (Arm_exidx_input_section::has_errors,
5644         Arm_exidx_input_section::set_has_errors): New methods.
5645         (Arm_exidx_input_section::has_errors_): New data member.
5646         (Arm_relobj::get_exidx_shndx_list): New method.
5647         (Arm_output_section::append_text_sections_to_list): Do not skip
5648         section without SHF_EXECINSTR.
5649         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5650         errors.
5651         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5652         section header.  Make error messages more verbose.  Check for
5653         a non-executable section linked to an EXIDX section.
5654         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5655         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5656         check that there is no deferred EXIDX section if we exit early.
5657         Instead of not making an EXIDX section in case of an error, make one
5658         and set the has_errors flag of it.
5659         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5660         in a relocatable link.
5661         (Target_arm::do_relax): Look for the EXIDX output section instead of
5662         assuming that it is called .ARM.exidx.
5663         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5664         section list.  Do not check for SHF_EXECINSTR section flags but
5665         skip any input section with errors.
5666         * output.cc (Output_section::Output_section): Initialize
5667         always_keeps_input_sections_ to false.
5668         (Output_section::add_input_section): Check for
5669         always_keeps_input_sections_.
5670         *  output.h (Output_section::always_keeps_input_sections,
5671         Output_section::set_always_keeps_input_sections): New methods.
5672         (Output_section::always_keeps_input_sections): New data member.
5673
5674 2010-07-13  Rafael Espindola  <espindola@google.com>
5675
5676         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5677         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5678
5679 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5680             Ian Lance Taylor  <iant@google.com>
5681
5682         * output.h (Output_section_lookup_maps::add_merge_section):
5683         Correct check of whether value was inserted.
5684         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5685         (Output_section_lookup_maps::add_relaxed_input_section):
5686         Likewise.
5687         * arm.cc (Target_arm::got_section): Remove used local os.
5688         * i386.cc (Target_i386::got_section): Likewise.
5689         * x86_64.cc (Target_x86_64::got_section): Likewise.
5690         * sparc.cc (Target_sparc::got_section): Likewise.
5691         (Target_sparc::relocate): Remove unused local have_got_offset.
5692         * powerpc.cc (Target_powerpc::relocate): Likewise.
5693
5694 2010-07-13  Ian Lance Taylor  <iant@google.com>
5695
5696         * compressed_output.cc (zlib_decompress): Fix signature in
5697         !HAVE_ZLIB_H case.
5698
5699         * archive.cc (Archive::include_member): Unlock an external member
5700         of a thin archive.  Don't bother to delete an object we know is
5701         NULL.
5702
5703 2010-07-12  Cary Coutant  <ccoutant@google.com>
5704
5705         * compressed_output.cc (zlib_decompress): New function.
5706         (get_uncompressed_size): New function.
5707         (decompress_input_section): New function.
5708         * compressed_output.h (get_uncompressed_size): New function.
5709         (decompress_input_section): New function.
5710         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5711         Handle compressed debug sections.
5712         * layout.cc (is_compressed_debug_section): New function.
5713         (Layout::output_section_name): Map compressed section names to
5714         canonical names.
5715         * layout.h (is_compressed_debug_section): New function.
5716         (is_debug_info_section): Recognize compressed debug sections.
5717         * merge.cc: Include compressed_output.h.
5718         (Output_merge_data::do_add_input_section): Handle compressed
5719         debug sections.
5720         (Output_merge_string::do_add_input_section): Handle compressed
5721         debug sections.
5722         * object.cc: Include compressed_output.h.
5723         (Sized_relobj::Sized_relobj): Initialize new data members.
5724         (build_compressed_section_map): New function.
5725         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5726         * object.h (Object::section_is_compressed): New method.
5727         (Object::do_section_is_compressed): New method.
5728         (Sized_relobj::Compressed_section_map): New type.
5729         (Sized_relobj::do_section_is_compressed): New method.
5730         (Sized_relobj::compressed_sections_): New data member.
5731         * output.cc (Output_section::add_input_section): Handle compressed
5732         debug sections.
5733         * reloc.cc: Include compressed_output.h.
5734         (Sized_relobj::write_sections): Handle compressed debug sections.
5735
5736 2010-07-08  Cary Coutant  <ccoutant@google.com>
5737
5738         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5739         weak when resolving to a dynamic def.
5740         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5741         for weak undef/dynamic def cases. Adjust callers.
5742         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5743         undef_binding_weak_.
5744         (Symbol_table::sized_write_globals): Adjust symbol binding.
5745         (Symbol_table::sized_write_symbol): Add binding parameter.
5746         * symtab.h (Symbol::set_undef_binding): New method.
5747         (Symbol::is_undef_binding_weak): New method.
5748         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5749         (Symbol_table::should_override): Add new parameter.
5750         (Symbol_table::sized_write_symbol): Add new parameter.
5751
5752         * testsuite/weak_undef_file1.cc: Add new test case.
5753         * testsuite/weak_undef_file2.cc: Fix header comment.
5754         * testsuite/weak_undef_test.cc: Add new test case.
5755
5756 2010-06-29  Doug Kwan  <dougkwan@google.com>
5757
5758         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5759         Initialize USE_SYMBOL_.
5760         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5761         definition.
5762         (Arm_reloc_property::uses_symbol_): New data member declaration.
5763         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5764         uses symbol value and symbol is undefined but not weakly undefined.
5765
5766 2010-06-28  Rafael Espindola  <espindola@google.com>
5767
5768         * plugin.cc (Plugin::load): Use dlerror.
5769
5770 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5771
5772         * symtab.cc (detect_odr_violations): When reporting an ODR
5773         violation, report an object where the symbol is defined.
5774
5775 2010-06-25  Doug Kwan  <dougkwan@google.com>
5776
5777         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5778         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5779         definition.
5780         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5781         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5782         target hook to detect function points.
5783         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5784         * icf.h (Icf::check_section_for_function_pointers): Change type of
5785         parameter SECTION_NAME to const reference to std::string.  Use
5786         target hook to determine if section may have unsafe pointers.
5787         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5788         method definition.
5789
5790 2010-06-21  Rafael Espindola  <espindola@google.com>
5791
5792         * fileread.cc (Input_file::find_fie): New
5793         (Input_file::open): Use Input_file::find_fie.
5794         * fileread.h (Input_file::find_fie): New
5795         * plugin.cc (set_extra_library_path): New.
5796         (Plugin::load): Add set_extra_library_path to the transfer vector.
5797         (Plugin_manager::set_extra_library_path): New.
5798         (Plugin_manager::add_input_file): Use the extra search path if set.
5799         (set_extra_library_path(): New.
5800         * plugin.h (Plugin_manager): Add set_extra_library_path and
5801         extra_search_path_.
5802
5803 2010-06-19  Cary Coutant  <ccoutant@google.com>
5804
5805         * layout.cc (gdb_sections): Add .debug_types.
5806         (lines_only_debug_sections): Likewise.
5807
5808 2010-06-18  Rafael Espindola  <espindola@google.com>
5809
5810         * plugin.cc (add_input_file,add_input_library)
5811         (Plugin_manager::add_input_file): Make filename arguments const.
5812         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5813         const.
5814
5815 2010-06-16  Doug Kwan  <dougkwan@google.com>
5816
5817         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5818         .ARM.attributes section if we have not merged any input
5819         attributes sections.
5820
5821 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5822
5823         * arm.cc: Allow combining objects with no EABI version
5824         information.
5825
5826 2010-06-15  Rafael Espindola  <espindola@google.com>
5827
5828         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5829
5830 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5831
5832         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5833         (struct iovec): Correct !HAVE_READV definition.
5834
5835 2010-06-10  Cary Coutant  <ccoutant@google.com>
5836
5837         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5838         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5839         reloc sections.
5840         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5841
5842         PR 11683
5843         * symtab.h (Symbol::is_placeholder): New member function.
5844         * target-reloc.h (relocate_section): Check for placeholder symbols.
5845
5846         * testsuite/Makefile.am (plugin_test_8): New test.
5847         (plugin_test_9): New test.
5848         * testsuite/Makefile.in: Regenerate.
5849
5850 2010-06-09  Nick Clifton  <nickc@redhat.com>
5851
5852         * yyscript.y (input_list_element): Allow strings prefixed with
5853         the '-' character.  Treat these as libraries.
5854         * script.cc (script_add_library): New function.  Adds a library
5855         specified by "-l<name>" found in an input script.
5856         * script-c.h: Add prototype for script_add_library.
5857
5858 2010-06-07  Doug Kwan  <dougkwan@google.com>
5859
5860         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5861         Restrict stub-group size to be within long conditional branch
5862         range when working around cortex-A8 erratum.
5863
5864 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5865
5866         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5867         #ifdef typo.
5868
5869 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5870
5871         PR gold/11658
5872         * output.cc
5873         (Output_section::Input_section_sort_entry::compare_section_ordering):
5874         Change to return non-zero correctly.
5875         (Output_section::Input_section_sort_section_order_index_compare
5876         ::operator()): Change to fix ambiguity in comparisons.
5877
5878 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5879
5880         * gold.h (is_wildcard_string): New function.
5881         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5882         (Layout::layout_eh_frame): Ditto.
5883         (Layout::find_section_order_index): New method.
5884         (Layout::read_layout_from_file): New method.
5885         * layout.h (Layout::find_section_order_index): New method.
5886         (Layout::read_layout_from_file): New method.
5887         (Layout::input_section_position_): New private member.
5888         (Layout::input_section_glob_): New private member.
5889         * main.cc (main): Call read_layout_from_file here.
5890         * options.h (--section-ordering-file): New option.
5891         * output.cc (Output_section::input_section_order_specified_): New
5892         member.
5893         (Output_section::Output_section): Initialize new member.
5894         (Output_section::add_input_section): Add new parameter.
5895         Keep input sections when --section-ordering-file is used.
5896         (Output_section::set_final_data_size): Sort input sections when
5897         section ordering file is specified.
5898         (Output_section::Input_section_sort_entry): Add new parameter.
5899         Check sorting type.
5900         (Output_section::Input_section_sort_entry::compare_section_ordering):
5901         New method.
5902         (Output_section::Input_section_sort_compare::operator()): Change to
5903         consider section_order_index.
5904         (Output_section::Input_section_sort_init_fini_compare::operator()):
5905         Change to consider section_order_index.
5906         (Output_section::Input_section_sort_section_order_index_compare
5907         ::operator()): New method.
5908         (Output_section::sort_attached_input_sections): Change to sort
5909         according to section order when specified.
5910         (Output_section::add_input_section<32, true>): Add new parameter.
5911         (Output_section::add_input_section<64, true>): Add new parameter.
5912         (Output_section::add_input_section<32, false>): Add new parameter.
5913         (Output_section::add_input_section<64, false>): Add new parameter.
5914         * output.h (Output_section::add_input_section): Add new parameter.
5915         (Output_section::input_section_order_specified): New
5916         method.
5917         (Output_section::set_input_section_order_specified): New method.
5918         (Input_section::Input_section): Initialize section_order_index_.
5919         (Input_section::section_order_index): New method.
5920         (Input_section::set_section_order_index): New method.
5921         (Input_section::section_order_index_): New member.
5922         (Input_section::Input_section_sort_section_order_index_compare): New
5923         struct.
5924         (Output_section::input_section_order_specified_): New member.
5925         * script-sections.cc (is_wildcard_string): Delete and move modified
5926         method to gold.h.
5927         (Output_section_element_input::Output_section_element_input): Modify
5928         call to is_wildcard_string.
5929         (Output_section_element_input::Input_section_pattern
5930         ::Input_section_pattern): Ditto.
5931         (Output_section_element_input::Output_section_element_input): Ditto.
5932         * testsuite/Makefile.am (final_layout): New test case.
5933         * testsuite/Makefile.in: Regenerate.
5934         * testsuite/final_layout.cc: New file.
5935         * testsuite/final_layout.sh: New file.
5936
5937 2010-06-01  Rafael Espindola  <espindola@google.com>
5938
5939         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5940
5941 2010-06-01  Rafael Espindola  <espindola@google.com>
5942
5943         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5944         visibility of symbols.
5945
5946 2010-05-27  Doug Kwan  <dougkwan@google.com>
5947
5948         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5949         from start of output section instead of address for a local symbol
5950         in a merged or relaxed section when doing a relocatable link.
5951
5952 2010-05-26  Rafael Espindola  <espindola@google.com>
5953
5954         PR 11604
5955         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5956         adding sections the garbage collector removed.
5957         * gold/testsuite/Makefile.am: Add test.
5958         * gold/testsuite/Makefile.in: Regenerate.
5959         * gold/testsuite/plugin_test_7.sh: New.
5960         * gold/testsuite/plugin_test_7_1.c: New.
5961         * gold/testsuite/plugin_test_7_2.c: New.
5962
5963 2010-05-26  Rafael Espindola  <espindola@google.com>
5964
5965         * script-sections.cc (Output_section_definition::set_section_addresses):
5966         Check for --section-start.
5967
5968 2010-05-26  Doug Kwan  <dougkwan@google.com>
5969
5970         * arm.cc (Arm_scan_relocatable_relocs): New class.
5971         (Target_arm::relocate_special_relocatable): New method.
5972         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5973         (Arm_relocate_functions::thumb_branch_common): Same.
5974         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5975         instead of Default_scan_relocatable_relocs.
5976         * target-reloc.h (relocate_for_relocatable): Let target handle
5977         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5978         * target.h (Sized_target::relocate_special_relocatable): New method.
5979
5980 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5981
5982         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5983
5984 2010-05-23  Doug Kwan  <dougkwan@google.com>
5985
5986         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5987         instead of a cast.
5988         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5989         with a direct branch, not a conditional branch, to a stub.
5990         * merge.cc (Output_merge_base::record_input_section): New method
5991         defintion.
5992         (Output_merge_data::do_add_input_section): Record input section if
5993         keeps-input-sections flag is set.
5994         (Output_merge_string::do_add_input_section): Ditto.
5995         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5996         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5997         INPUT_SECTIONS_.
5998         (Output_merge_base::keeps_input_sections,
5999         Output_merge_base::set_keeps_input_sections,
6000         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6001         method definitions.
6002         (Output_merge_base::Input_sections): New type declaration.
6003         (Output_merge_base::input_sections_begin,
6004         Output_merge_base::input_sections_end,
6005         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6006         (Output_merge_base::bool keeps_input_sections_,
6007         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6008         Output_merge_base::input_sections_): New data members.
6009         (Output_merge_data::do_set_keeps_input_sections): New method
6010         defintion.
6011         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6012         * output.cc (Output_section::Input_section::relobj): Move method
6013         defintion from class declaration to here and handle merge sections.
6014         (Output_section::Input_section::shndx): Ditto.
6015         (Output_section::Output_section): Remove initializations of removed
6016         data members and initialize new data member LOOKUP_MAPS_.
6017         (Output_section::add_input_section): Set keeps-input-sections flag
6018         for a newly created merge output section as appropriate.  Adjust code
6019         to use Output_section_lookup_maps class.
6020         (Output_section::add_relaxed_input_section): Adjst code for lookup
6021         maps code refactoring.
6022         (Output_section::add_merge_input_section): Add a new parameter
6023         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6024         class.  If adding input section to a newly created merge output
6025         section fails, remove the new merge section.
6026         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6027         Adjust code for use of the Output_section_lookup_maps class.
6028         (Output_section::find_merge_section): Ditto.
6029         (Output_section::build_lookup_maps): New method defintion.
6030         (Output_section::find_relaxed_input_section): Adjust code to use
6031         Output_section_lookup_maps class.
6032         (Output_section::get_input_sections): Export merge sections.  Adjust
6033         code to use Output_section_lookup_maps class.
6034         (Output_section:::add_script_input_section): Adjust code to use
6035         Output_section_lookup_maps class.  Update lookup maps for merge
6036         sections also.
6037         (Output_section::discard_states): Use Output_section_lookup_maps.
6038         (Output_section::restore_states): Same.
6039         * output.h (Merge_section_properties): Move class defintion out of
6040         Output_section.
6041         (Output_section_lookup_maps): New class.
6042         (Output_section::Input_section::is_merge_section): New method
6043         defintion.
6044         (Output_section::Input_section::relobj): Move defintion out of class
6045         defintion.  Declare method only.
6046         (Output_section::Input_section::shndx): Ditto.
6047         (Output_section::Input_section::output_merge_base): New method defintion.
6048         (Output_section::Input_section::u2_.pomb): New union field.
6049         (Output_section::Merge_section_by_properties_map,
6050         Output_section::Output_section_data_by_input_section_map,
6051         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6052         Remove types.
6053         (Output_section::add_merge_input_section): Add new parameter
6054         KEEPS_INPUT_SECTIONS.
6055         (Output_section::build_lookup_maps): New method declaration.
6056         (Output_section::merge_section_map_,
6057         Output_section::merge_section_by_properties_map_,
6058         Output_section::relaxed_input_section_map_,
6059         Output_section::is_relaxed_input_section_map_valid_): Remove data
6060         members.
6061         (Output_section::lookup_maps_): New data member.
6062
6063 2010-05-21  Doug Kwan  <dougkwan@google.com>
6064
6065         PR gold/11619
6066         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6067         avoid a compilation error.
6068
6069 2010-05-19  Rafael Espindola  <espindola@google.com>
6070
6071         * script-sections.cc (Output_section_definition::allocate_to_segment):
6072         Update the phdrs_list even when the output section is NULL.
6073         * testsuite/Makefile.am: Add test.
6074         * testsuite/Makefile.in: Regenerate.
6075         * testsuite/script_test_9.cc: New.
6076         * testsuite/script_test_9.sh: New.
6077         * testsuite/script_test_9.t: New.
6078
6079 2010-05-19  Doug Kwan  <dougkwan@google.com>
6080
6081         * arm.cc (Arm_input_section::original_size): New method.
6082         (Arm_input_section::do_addralign): Add a cast.
6083         (Arm_input_section::do_output_offset): Remove static cast.
6084         (Arm_input_section::original_addralign,
6085          Arm_input_section::original_size_): Change type to uint32_t.
6086         (Arm_input_section::init): Add safe casts for section alignment
6087         and size.
6088         (Arm_input_section::set_final_data_size): Do not set address and
6089         offset of stub table.
6090         (Arm_output_section::fix_exidx_coverage): Change use of of
6091         Output_section::Simple_input_section to that of
6092         Output_section::Input_section.
6093         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6094         except for the first pass.
6095         * output.cc (Output_section::get_input_sections): Change type of
6096         input_sections to std::list<Input_section>.
6097         (Output_section::add_script_input_section): Rename from
6098         Output_section::add_simple_input_section.  Change type of SIS
6099         parameter from Simple_input_section to Input_section.
6100         * output.h (Output_section::Simple_input_section): Remove class.
6101         (Output_section::Input_section): Change class visibility to public.
6102         (Output_section::Input_section::addralign): Use stored alignments
6103         for special input sections if set.
6104         (Output_section::Input_section::set_addralign): New method.
6105         (Output_section::get_input_sections): Change parameter type from
6106         list of Simple_input_section to list of Input_section.
6107         (Output_section::add_script_input_section): Rename from
6108         Output_section::add_simple_input_section. Change first parameter's
6109         type from Simple_input_section to Input_section and remove the
6110         second and third parameters.
6111         * script-sections.cc (Input_section::Input_section_list): Change
6112         type to list of Output_section::Input_section/
6113         (Input_section_info::Input_section_info): Change parameter type of
6114         INPUT_SECTION to Output_section::Input_section.
6115         (Input_section_info::input_section): Change return type.
6116         (Input_section_info::input_section_): Change type to
6117         Output_section::Input_section.
6118         (Output_section_element_input::set_section_addresses): Adjust code
6119         to use Output_section::Input_section instead of
6120         Output_section::Simple_input_section.  Adjust code for renaming
6121         of Output_section::add_simple_input_section.
6122         (Orphan_output_section::set_section_addresses): Ditto.
6123
6124 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6125
6126         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6127         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6128
6129 2010-05-18  Rafael Espindola  <espindola@google.com>
6130
6131         * options.cc (General_options::finalize): Handle -nostdlib.
6132         * options.h (nostdlib): New option.
6133         * script.cc (script_add_search_dir): Handle -nostdlib.
6134
6135 2010-05-12  Doug Kwan  <dougkwan@google.com>
6136
6137         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6138         attributes section only if there no attributes section after merging.
6139         (Target_arm::merge_object_attributes): Move value of
6140         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6141         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6142         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6143         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6144         and arm_attr_merge_7.stdout.
6145         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6146         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6147         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6148         arm_attr_merge_7b.o): New rules.
6149         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6150         arm_attr_merge_7
6151         * testsuite/Makefile.in: Regenerate.
6152         * testsuite/arm_attr_merge.sh: New file.
6153         * testsuite/arm_attr_merge_[67][ab].s: Same.
6154
6155 2010-05-05  Nick Clifton  <nickc@redhat.com>
6156
6157         * po/es.po: Updated Spanish translation.
6158
6159 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6160
6161         * Makefile.am (install-exec-local): Properly install gold as
6162         default cross linker.
6163         * Makefile.in: Regenerated.
6164
6165 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6166             Nick Clifton  <nickc@redhat.com>
6167
6168         * configure.ac (install_as_default): Define and set to false
6169         unless --enable-gold or --enable-gold=both/gold has been
6170         specified.
6171         * configure: Regenerate.
6172
6173         * Makefile.am (install-exec-local): Install the executable as
6174         'ld.gold'.  If install_as_default is true then also install it as
6175         'ld'.
6176         * Makefile.in: Regenerated.
6177
6178 2010-04-24  Ian Lance Taylor  <iant@google.com>
6179
6180         * layout.cc (Layout::layout_reloc): In relocatable link don't
6181         combine reloc sections for grouped sections.
6182
6183 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6184
6185         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6186         sections that are not ordinary to icf.
6187         * icf.cc (get_section_contents): Handle relocation pointing to section
6188         with no object or shndx information.
6189         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6190         * testsuite/Makefile.in: Regenerate.
6191         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6192         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6193
6194 2010-04-22  Ian Lance Taylor  <iant@google.com>
6195
6196         * expression.cc (Expression::Expression_eval_info): Add
6197         result_alignment_pointer field.
6198         (Expression::eval_with_dot): Add result_alignment_pointer
6199         parameter.  Change all callers.
6200         (Expression::eval_maybe_dot): Likewise.
6201         (class Binary_expression): Add alignment_pointer parameter to
6202         left_value and right_value.  Change all callers.
6203         (BINARY_EXPRESSION): Set result alignment.
6204         (class Trinary_expression): Add alignment_pointer parameter to
6205         arg2_value and arg3_value.  Change all callers.
6206         (Trinary_cond::value): Set result alignment.
6207         (Max_expression::value, Min_expression::value): Likewise.
6208         (Align_expression::value): Likewise.
6209         * script-sections.cc (class Sections_element): Add dot_alignment
6210         parameter to set_section_addresses virtual function.  Update
6211         instantiations.
6212         (class Output_section_element): Likewise.
6213         (Script_sections::create_segments): Add dot_alignment parameter.
6214         Change all callers.
6215         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6216         (Script_sections::set_phdrs_clause_addresses): Likewise.
6217         * script-sections.h: Update declarations.
6218         * script.h: Update declarations.
6219         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6220         min_p_align.
6221         * testsuite/script_test_3.t: Set large alignment.
6222         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6223         segment has expected alignment.
6224
6225 2010-04-22  Nick Clifton  <nickc@redhat.com>
6226
6227         * po/gold.pot: Updated by the Translation project.
6228         * po/vi.po: Updated Vietnamese translation.
6229
6230 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6231
6232         * testsuite/Makefile.am (check_PROGRAMS): Add
6233         icf_virtual_function_folding_test.
6234         * testsuite/Makefile.in: Regenerated.
6235
6236 2010-04-15  Andrew Haley  <aph@redhat.com>
6237
6238         * options.h (merge_exidx_entries): New option.
6239         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6240         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6241         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6242         (Target_arm::merge_exidx_entries): New function.
6243         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6244         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6245         to Arm_exidx_fixup constructor.
6246         Add new arg, merge_exidx_entries.
6247         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6248         Arm_output_section::fix_exidx_coverage.
6249
6250 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6251
6252         * icf.cc (get_section_contents): Check for preemptible functions.
6253         Ignore addend when appropriate.
6254         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6255         section folded.
6256         (add_from_relobj): Check for section folded.
6257         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6258         * symtab.h (should_add_dynsym_entry): Add new parameter.
6259         * target-reloc.h (scan_relocs): Check for section folded.
6260         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6261         Check reloc types for function pointers in shared objects.
6262         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6263         case.
6264         (icf_preemptible_functions_test): New test case.
6265         (icf_string_merge_test): New test case.
6266         * testsuite.Makefile.in: Regenerate.
6267         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6268         bar_glob.  Refactor code.
6269         * testsuite/icf_preemptible_functions_test.cc: New file.
6270         * testsuite/icf_preemptible_functions_test.sh: New file.
6271         * testsuite/icf_string_merge_test.cc: New file.
6272         * testsuite/icf_string_merge_test.sh: New file.
6273         * testsuite/icf_virtual_function_folding_test.cc: New file.
6274         * testsuite/icf_virtual_function_folding_test.sh: New file.
6275
6276 2010-04-14  Doug Kwan  <dougkwan@google.com>
6277
6278         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6279         for local symbol recounting if we remove a section due to ICF.
6280         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6281         there are no regular objects in input.
6282
6283 2010-04-13  Doug Kwan  <dougkwan@google.com>
6284
6285         * arm.cc (Arm_input_section::set_final_data_size): Compute
6286         accurate final data size instead of using current data size.
6287
6288 2010-04-09  Doug Kwan  <dougkwan@google.com>
6289
6290         * layout.cc (Layout::choose_output_section): Handle script section
6291         types.
6292         (Layout::make_output_section_for_script): Add section type parameter.
6293         Handle script section types.
6294         * layout.h (Layout::make_output_section_for_script): Add section
6295         type parameter.
6296         * output.cc (Output_section::Output_section): Initialize data member
6297         is_noload_.
6298         (Output_section::do_reset_address_and_file_offset): Do not set address
6299         to 0 if section is a NOLOAD section.
6300         * output.h (Output_section::is_noload): New method.
6301         (Output_section::set_is_noload): Ditto.
6302         (Output_section::is_noload_): New data member.
6303         * script-c.h (Script_section_type): New enum type.
6304         (struct Parser_output_section_header): Add new file section_type.
6305         * script-sections.cc (Sections_element::output_section_name): Add
6306         parameter for returning script section type.
6307         (Output_section_definition::output_section_name): Ditto.
6308         (Output_section_definition::section_type)P; New method.
6309         (Output_section_definiton::script_section_type_name): Ditto.
6310         (Output_section_definition::script_section_type_): New data member.
6311         (Output_section_definition::Output_section_definition): Initialize
6312         data member Output_section_definition::script_section_type_.
6313         (Output_section_definition::create_sections): Pass script section type
6314         to Layout::make_output_section_for_script.
6315         (Output_section_definition::output_section_name): Return script
6316         section type to caller.
6317         (Output_section_definition::set_section_address): Do not advance
6318         dot value and load address if section type is NOLOAD.  Set address
6319         of NOLOAD sections regardless of section flags.
6320         (Output_section_definition::print): Print section type if it is
6321         not SCRIPT_SECTION_TYPE_NONE.
6322         (Output_section_definition::section_type): New method.
6323         (Output_section_definition::script_section_type_name): Ditto.
6324         (Script_sections::output_section_name): Add new parameter
6325         PSECTION_TYPE for returning script section type.  Pass it to
6326         section elements.  Handle discard sections.
6327         (Sort_output_sections::operator()): Handle NOLOAD sections.
6328         * script-sections.h (Script_sections::Section_type): New enum type.
6329         (Script_sections::output_section_name): Add a new parameter for
6330         returning script section type.
6331         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6332         INFO and NOLOAD.
6333         * yyscript.y (union): Add new field SECTION_TYPE.
6334         (COPY, DSECT, INFO, NOLOAD): New tokens.
6335         (opt_address_and_section_type): Change type to output_section_header.
6336         (section_type): New non-terminal
6337         (section_header): Handle section type.
6338         (opt_address_and_section_type): Return section type value.
6339
6340 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6341
6342         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6343         * testsuite/plugin_common_test_2.c (foo): Likewise.
6344
6345 2010-04-08  Doug Kwan  <dougkwan@google.com>
6346
6347         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6348         Output_merge_data.
6349         * output.cc (Output_section::add_merge_input_section): Simplify
6350         code and return status of Output_merge_base::add_input_section.
6351         Update merge section map only if Output_merge_base::add_input_section
6352         returns true.
6353
6354 2010-04-07  Doug Kwan  <dougkwan@google.com>
6355
6356         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6357         if section is marked as containing instructions but has no mapping
6358         symbols.
6359         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6360         correct section index.
6361         (Arm_relobj::find_linked_text_section): Ditto.
6362
6363 2010-04-07  Cary Coutant  <ccoutant@google.com>
6364
6365         * archive.cc (include_member): Destroy Read_symbols_data object before
6366         releasing file.
6367         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6368         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6369         (Read_symbols_data::~Read_symbols_data) New destructor.
6370         (Section_relocs::Section_relocs) New constructor.
6371         (Section_relocs::~Section_relocs) New destructor.
6372         (Read_relocs_data::Read_relocs_data) New constructor.
6373         (Read_relocs_data::~Read_relocs_data) New destructor.
6374         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6375         pointers to NULL after deleting.
6376
6377 2010-04-07  Doug Kwan  <dougkwan@google.com>
6378
6379         * arm.cc: Replace "endianity" with "endianness" in comments.
6380         (Arm_exidx_cantunwind): Ditto.
6381         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6382         (Arm_relobj::merge_flags_and_attributes): New method.
6383         (Arm_relobj::merge_flags_and_attributes_): New data member.
6384         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6385         (Arm_relobj::scan_sections_for_stubs): Ditto.
6386         (Arm_relobj::do_read_symbols): Check to see if we really want to
6387         merge processor-specific flags and attributes.  Exit early if
6388         an object is empty except for section names and the undefined symbol.
6389         (Target_arm::do_finalize_sections): Move check for ELF format to
6390         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6391         attributes from a regular object only when we have determined that
6392         it is aapropriate.  Do not create an .ARM.attributes section in
6393         output if there is no regular input object.
6394         (Target_arm::merge_processor_specific_flags): Check
6395         --warn-mismatch before printing any error.
6396         (Target_arm::merge_object_attributes): Ditto.
6397         * gold.cc (queue_middle_tasks): Handle the case in which there is
6398         no regular object in input.
6399         * options.cc (General_options::parse_EB): New method.
6400         (General_options::parse_EL): Same.
6401         (General_options::General_options): Initialize endianness_.
6402         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6403         New options.
6404         (General_options::Endianness): New enum.
6405         (General_options::endianness): New method.
6406         (General_options::endianness_): New data member.
6407         * parameters.cc (Parameters::set_options): Check target endianness.
6408         (Parameters::set_target_once): Ditto.
6409         (Parameters::check_target_endianness): New method.
6410         (parameters_force_valid_target): If either -EL or -EB is specified,
6411         use it to define endianness of default target.
6412         * parameters.h (Parameters::check_target_endianness): New method
6413         declaration.
6414         * target.h (class Target): Change "endianity" to "endianness"
6415         in comments.
6416
6417 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6418
6419         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6420         * configure: Regenerate.
6421         * Makefile.in: Regenerate.
6422         * testsuite/Makefile.in: Regenerate.
6423
6424 2010-04-06  Cary Coutant  <ccoutant@google.com>
6425
6426         gcc PR lto/42757
6427         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6428         prevailing definitions of common symbols.
6429         * testsuite/plugin_test_6.sh: New test case.
6430         * testsuite/plugin_common_test_1.c: New test case.
6431         * testsuite/plugin_common_test_2.c: New test case.
6432         * testsuite/Makefile.am (plugin_test_6): New test case.
6433         * testsuite/Makefile.in: Regenerate.
6434
6435 2010-04-06  Nick Clifton  <nickc@redhat.com>
6436
6437         * po/vi.po: New Vietnamese translation.
6438
6439 2010-03-30  Doug Kwan  <dougkwan@google.com>
6440
6441         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6442
6443 2010-03-25  Doug Kwan  <dougkwan@google.com>
6444
6445         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6446         to avoid a conversion warning on a 32-bit host.
6447
6448 2010-03-24  Ian Lance Taylor  <iant@google.com>
6449
6450         * testsuite/script_test_3.t: Add a TLS segment.
6451         * testsuite/Makefile.am (check_PROGRAMS): Add
6452         tls_phdrs_script_test.
6453         (tls_phdrs_script_test_SOURCES): Define.
6454         (tls_phdrs_script_test_DEPENDENCIES): Define.
6455         (tls_phdrs_script_test_LDFLAGS): Define.
6456         (tls_phdrs_script_test_LDADD): Define.
6457         * testsuite/Makefile.in: Rebuild.
6458
6459 2010-03-23  Cary Coutant  <ccoutant@google.com>
6460
6461         * fileread.cc (find_or_make_view): Fix comment.
6462
6463 2010-03-23  Ian Lance Taylor  <iant@google.com>
6464
6465         * script-sections.cc (class Orphan_section_placement): Define
6466         PLACE_TLS and PLACE_TLS_BSS.
6467         (Orphan_section_placement::Orphan_section_placement): Initialize
6468         new places.
6469         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6470         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6471         (tls_script_test_SOURCES): Define.
6472         (tls_script_test_DEPENDENCIES): Define.
6473         (tls_script_test_LDFLAGS): Define.
6474         (tls_script_test_LDADD): Define.
6475         * testsuite/Makefile.in: Rebuild.
6476
6477 2010-03-22  Doug Kwan  <dougkwan@google.com>
6478
6479         * arm.cc (Arm_relocate_functions::abs8,
6480         Arm_relocate_functions::abs16): Use correct check for overflow
6481         specified in the ARM ELF specs.
6482         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6483         target of a BLX instruction specially.
6484         (Reloc_stub::stub_type_for_reloc): Ditto.
6485         (Relocate::relocate): Use symbolic names instead of numeric relocation
6486         codes to report error.
6487         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6488         workaround.
6489         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6490         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6491         thumb2_blx_out_of_range.stdout
6492         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6493         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6494         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6495         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6496         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6497         thumb2_blx_in_range, thumb2_blx_in_range.o,
6498         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6499         thumb2_blx_out_of_range.o): New rules.
6500         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6501         thumb2_blx_in_range and thumb2_blx_out_of_range.
6502         * testsuite/Makefile.in: Regenerate.
6503         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6504         * testsuite/thumb_blx_in_range.s: New file.
6505         * testsuite/thumb_blx_out_of_range.s: New file.
6506
6507 2010-03-22  Rafael Espindola  <espindola@google.com>
6508
6509         * archive.cc (Should_include): Move to archive.h.
6510         (should_include_member): Make it a member of Archive.
6511         (Lib_group): New.
6512         (Add_lib_group_symbols): New.
6513         * archive.h: Include options.h.
6514         (Archive_member): Moved from Archive.
6515         (Should_include): Moved from archive.cc.
6516         (Lib_group): New.
6517         (Add_lib_group_symbols): New.
6518         * dynobj.cc (do_should_include_member): New.
6519         * dynobj.h (do_should_include_member): New.
6520         * gold.cc (queue_initial_tasks): Update call to queue.
6521         * main.cc (main): Print lib group stats.
6522         * object.cc (do_should_include_member): New.
6523         * object.h: Include archive.h.
6524         (Object::should_include_member): New.
6525         (Object::do_should_include_member): New.
6526         (Sized_relobj::do_should_include_member): New.
6527         * options.cc (General_options::parse_start_lib): New.
6528         (General_options::parse_end_lib): New.
6529         (Input_arguments::add_file): Handle lib groups.
6530         (Input_arguments::start_group): Check we are not in a lib.
6531         (Input_arguments::start_lib): New.
6532         (Input_arguments::end_lib): New.
6533         * options.h (General_options): Add start_lib and end_lib.
6534         (Input_argument::lib_): New.
6535         (Input_argument::lib): New.
6536         (Input_argument::is_lib): New.
6537         (Input_file_lib): New.
6538         (Input_arguments::in_lib_): New.
6539         (Input_arguments::in_lib): New.
6540         (Input_arguments::start_lib): New.
6541         (Input_arguments::end_lib_): New.
6542         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6543         in unused members as preempted.
6544         (Sized_pluginobj::do_should_include_member): New.
6545         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6546         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6547         return the blocker.
6548         (Read_symbols::do_whole_lib_group): New.
6549         (Read_symbols::do_lib_group): New.
6550         (Read_symbols::do_read_symbols): Handle lib groups.
6551         (Read_symbols::get_name): Handle lib groups.
6552         * readsyms.h (Read_symbols): Add an archive member pointer.
6553         (Read_symbols::do_whole_lib_group): New.
6554         (Read_symbols::do_lib_group): New.
6555         (Read_symbols::member_): New.
6556         * script.cc (read_input_script): Update call to queue_soon.
6557
6558 2010-03-19  Doug Kwan  <dougkwan@google.com>
6559
6560         * arm.cc (Stub_table::Stub_table): Initialize new data members
6561         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6562         (Stub_table::add_reloc_stub): Assign stub offset and update
6563         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6564         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6565         New data members.
6566         (Stub_table::update_data_size_and_addralign): Use
6567         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6568         instead of going over all reloc stubs.
6569         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6570         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6571         Stringpool_template::offset_ to size of Stringpool_char.
6572         (Stringpool_template::new_key_offset): Remove code to initialize
6573         Stringpool_template::offset_.
6574         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6575         Stringpool_template::offset_ to zero.
6576
6577 2010-03-15  Doug Kwan  <dougkwan@google.com>
6578
6579         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6580         offset_.
6581         (Stringpool_template::new_key_offset): New method.
6582         (Stringpool_template::add_string): Assign offsets when adding new
6583         strings.
6584         (Stringpool_template::set_string_offsets): Do not set string offsets
6585         when not optimizing.
6586         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6587         member size_.
6588         (Chunked_vector::clear): Clear size_.
6589         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6590         (Chunked_vector::size): Return size_.
6591         (Chunked_vector::push_back): Use size_ to find insert position.
6592         (Chunked_vector::size_): New data member.
6593         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6594         (Stringpool_template::new_key_offset): New method declaration.
6595         (Stringpool_template::offset_): New data member.
6596
6597 2010-03-15   Rafael Espindola  <espindola@google.com>
6598
6599         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6600         Add_symbols' constructor.
6601         * readsyms.h (Add_symbols): Remove the input_group member.
6602
6603 2010-03-10  Ian Lance Taylor  <iant@google.com>
6604
6605         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6606         target to ask whether a reference to a symbol requires a stack
6607         split.
6608         * target.h (Target::is_call_to_non_split): New function.
6609         (Target::do_is_call_to_non_split): Declare virtual function.
6610         * target.cc: Include "symtab.h".
6611         (Target::do_is_call_to_non_split): New function.
6612         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6613
6614 2010-03-10  Cary Coutant  <ccoutant@google.com>
6615
6616         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6617         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6618         (File_read::open[2]): Add whole_file_view_ to list of views.
6619         (File_read::make_view): Remove test of whole_file_view_.
6620         (File_read::find_or_make_view): Create whole_file_view_ if
6621         necessary.
6622         (File_read::clear_views): Replace bool parameter with enum;
6623         adjust all callers.  Don't delete views with permanent data;
6624         do delete cached views and views from archives if
6625         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6626         if clearing the corresponding view.
6627         * fileread.h (File_read::Clear_views_mode): New enum.
6628         (File_read::View::is_permanent_view): New method.
6629         (File_read::clear_views): Replace bool parameter
6630         with enum; adjust all callers.
6631         * options.h (General_options): Change keep_files_mapped option;
6632         add map_whole_files.
6633         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6634         releasing the file.
6635         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6636         the file.
6637
6638 2010-03-10  David S. Miller  <davem@davemloft.net>
6639
6640         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6641
6642 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6643
6644         * icf.cc (get_section_contents): Add '@' marker after processing the
6645         merge reloc.
6646
6647 2010-03-08  Doug Kwan  <dougkwan@google.com>
6648
6649         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6650         due to a conversion warning.
6651         (Arm_relobj::update_output_local_symbol_count): Check for local
6652         symbol with unset output index.
6653
6654 2010-03-05  Ian Lance Taylor  <iant@google.com>
6655
6656         * options.h (class General_options): Add --spare-dynamic-tags.
6657         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6658         --spare-dynamic-tags.
6659
6660 2010-03-05  Ian Lance Taylor  <iant@google.com>
6661
6662         * incremental.cc: Include "libiberty.h".
6663
6664 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6665
6666         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6667         function, is_info_ member.
6668         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6669         (Versions::Versions): Update caller.
6670         (Versions::define_base_version): Likewise.
6671         (Versions::add_def): Likewise.
6672
6673 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6674
6675         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6676         (Scan::possible_function_pointer_reloc): New function.
6677         (Scan::local_reloc_may_be_function_pointer): Change to call
6678         possible_function_pointer_reloc.
6679         (Scan::global_reloc_may_be_function_pointer): Ditto.
6680         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6681         relocations in ".data.rel.ro._ZTV" section.
6682         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6683         * testsuite/icf_safe_so_test.cc: Ditto.
6684         * testsuite/icf_safe_test.cc: Ditto.
6685         * testsuite/icf_safe_test.sh: Ditto.
6686
6687 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6688             Ian Lance Taylor  <iant@google.com>
6689
6690         * target-reloc.h (relocate_section): Check the symbol table index
6691         for -1U before setting the local symbol index.
6692         (scan_relocatable_relocs): If copying the relocation, record that
6693         the local symbol is required.
6694         * object.h (Symbol_value::is_output_symtab_index_set): New
6695         function.
6696         (Symbol_value::may_be_discarded_from_output_symtab): New
6697         function.
6698         (Symbol_value::has_output_symtab_entry): New function.
6699         (Symbol_value::needs_output_symtab_entry): Remove.
6700         (Symbol_value::output_symtab_index): Make sure the symbol index is
6701         set.
6702         (Symbol_value::set_output_symtab_index): Make sure the symbol
6703         index is not set.  Make sure the new index is valid.
6704         (Symbol_value::set_must_have_output_symtab_entry): New function.
6705         (Symbol_value::has_output_dynsym_entry): New function.
6706         (Symbol_value::set_output_dynsym_index): Make sure the new index
6707         is valid.
6708         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6709         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6710         local symbol if permitted.
6711         (Sized_relobj::do_finalize_local_symbols): Call
6712         is_output_symtab_index_set rather than needs_output_symtab_entry.
6713         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6714         rather than needs_output_symtab_entry.  Call
6715         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6716         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6717         is_output_symtab_index_set rather than needs_output_symtab_entry.
6718         * testsuite/discard_locals_relocatable_test.c: New file.
6719         * testsuite/discard_locals_test.sh: Test -r.
6720         * testsuite/Makefile.am (check_DATA): Add
6721         discard_locals_relocatable_test1.syms,
6722         discard_local_relocatable_test2.syms.
6723         (MOSTLYCLEANFILES): Likewise.  Also add
6724         discard_locals_relocatable_test1.lout and
6725         discard_locals_relocatable_test2.out.
6726         (discard_locals_relocatable_test1.syms): New target.
6727         (discard_locals_relocatable_test.o): New target.
6728         (discard_locals_relocatable_test1.out): New target.
6729         (discard_locals_relocatable_test2.syms): New target.
6730         (discard_locals_relocatable_test2.out): New target.
6731         (various): Add missing ../ld-new dependencies.
6732         * testsuite/Makefile.in: Rebuild.
6733
6734 2010-03-03  Nick Clifton  <nickc@redhat.com>
6735
6736         * po/fi.po: New Finnish translation.
6737
6738 2010-03-01  Doug Kwan  <dougkwan@google.com>
6739
6740         * layout.cc (Layout::Layout): Force section types of .init_array*,
6741         .preinit_array* and .fini_array* sections.
6742         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6743         Fix check of return value of std::string::find.().
6744         (Output_section::Input_section_sort_compare::operator()): Remove
6745         comment about .init_array.
6746         (Output_section::Input_section_sort_init_fini_compare::operator()):
6747         New method.
6748         (Output_section::sort_attached_input_sections): Handle .init_array
6749         and .fini_array specially.
6750         * output.h (Output_section::Inut_section_sort_compare): Update
6751         comment.
6752         (Output_section::Input_section_sort_init_fini_compare): New struct.
6753
6754 2010-02-26  Doug Kwan  <dougkwan@google.com>
6755
6756         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6757         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6758         * testsuite/debug_msg.sh: Avoid matching source line number for
6759         use of global variable undef_int.
6760
6761 2010-02-26  Doug Kwan  <dougkwan@google.com>
6762
6763         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6764         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6765         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6766         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6767         * options.cc (General_options::General_options): Initialize member
6768         fix_v4bx_.
6769         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6770         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6771         and rm_no_fix_v4bx.stdout
6772         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6773         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6774         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6775         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6776         and arm_no_fix_v4bx.
6777         * Makefile.in: Regenerate.
6778         * testsuite/arm_fix_v4bx.s: New file.
6779         * testsuite/arm_fix_v4bx.sh: Ditto.
6780
6781 2010-02-24  Doug Kwan  <dougkwan@google.com>
6782
6783         * arm.cc (Target_arm::got_section): Make the .got section the first
6784         non RELRO section in the data segment.
6785         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6786         suffixes of section names.
6787
6788 2010-02-24  Doug Kwan  <dougkwan@google.com>
6789
6790         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6791         flags and attributes merging if an input file is a binary file.
6792         * fileread.cc (Input_file::open): Record format of original file.
6793         * fileread.h (Input_file::Format): New enum type.
6794         (Input_file::Input_file): Initialize data member format_.
6795         (Input_file::format): New method definition.
6796         (Input_file::format_):: New data member.
6797
6798 2010-02-24  Doug Kwan  <dougkwan@google.com>
6799
6800         * arm.cc (Arm_output_data_got): New class.
6801         (ARM_TCB_SIZE): New constant
6802         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6803         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6804         If user uses a script with a SECTIONS clause, issue only a warning
6805         for a misplaced EXIDX input section.  Otherwise, issue an error.
6806         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6807         garbage collection.
6808         (Target_arm::got_mode_index_entry): Handle static linking.
6809         (Target_arm::Scan::local): Ditto.
6810         (Target_arm::Scan::global): Ditto.
6811         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6812         all incorrectly implemented relocations.
6813         (Target_arm::fix_exidx_coverage): Pass layout to
6814         Arm_output_section::fix_exidx_coverage.
6815         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6816         from ".ARM.exidx." and ".ARM.extab.".
6817
6818 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6819
6820         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6821         section if it does not already exist.
6822         * attributes.cc (Attributes_section_data::Attributes_section_data):
6823         Don't crash if size is zero.
6824
6825 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6826             Ian Lance Taylor  <iant@google.com>
6827
6828         * gold.cc (queue_middle_tasks): If no input files were opened,
6829         exit.
6830         * workqueue.h (Task_function::Task_function): Assert that there is
6831         a blocker.
6832
6833 2010-02-22  Doug Kwan  <dougkwan@google.com>
6834
6835         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6836         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6837         types to avoid warnings due to different uint64_t implementations
6838         on different hosts.
6839
6840 2010-02-21  Doug Kwan  <dougkwan@google.com>
6841
6842         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6843         handling of the maximum backward branch offset.
6844         (Arm_relocate_functions::thumb_branch_common): Ditto.
6845         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6846         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6847         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6848         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6849         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6850         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6851         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6852         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6853         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6854         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6855         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6856         thumb2_bl_out_of_range.o): New rules.
6857         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6858         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6859         thumb2_bl_out_of_range
6860         * testsuite/Makefile.in: Regenerate.
6861         * testsuite/arm_bl_in_range.s: New file.
6862         * testsuite/arm_bl_out_of_range.s: Ditto.
6863         * testsuite/arm_branch_in_range.sh: Ditto.
6864         * testsuite/arm_branch_range.t: Ditto.
6865         * testsuite/thumb2_branch_range.t: Ditto.
6866         * testsuite/thumb_bl_in_range.s: Ditto.
6867         * testsuite/thumb_bl_out_of_range.s: Ditto.
6868         * testsuite/thumb_branch_range.t: Ditto.
6869
6870 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6871
6872         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6873         Add reloc offset information.
6874         * icf.cc (get_section_contents): Change iterators to point to the new
6875         vectors. Add reloc offset information to the contents.
6876         * icf.h (Icf::Sections_reachable_info): New typedef.
6877         (Icf::Sections_reachable_list): New typedef.
6878         (Icf::Offset_info): New typedef.
6879         (Icf::Reloc_info): New struct typedef.
6880         (Icf::Reloc_info_list): New typedef.
6881         (Icf::symbol_reloc_list): Delete method.
6882         (Icf::addend_reloc_list): Delete method.
6883         (Icf::section_reloc_list): Delete method.
6884         (Icf::reloc_info_list): New method.
6885         (Icf::reloc_info_list_): New member.
6886
6887 2010-02-19  Doug Kwan  <dougkwan@google.com>
6888
6889         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6890         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6891         * arm.cc (Arm_relocation_functions): New forward declaration.
6892         (Target_arm::Target_arm): Initialize new data members
6893         got_mod_index_offset_ and tls_base_symbol_defined_.
6894         (Target_arm::Relocate::relocate_tls): New method.
6895         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6896          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6897         New methods.
6898         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6899         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6900         (Target_arm::got_mod_index_offset_,
6901         Target_arm::tls_base_symbol_defined_): New data members.
6902         (Target_arm::Scan::local, Target::Scan::global,
6903         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6904         relocations.
6905
6906 2010-02-18  Doug Kwan  <dougkwan@google.com>
6907
6908         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6909         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6910         text section as a parameter becuase some broken tools may not set
6911         the link in section header.
6912         (Target_arm::has_got_section): New method.
6913         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6914         without any mapping symbol as data only.  Remove warning.
6915         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6916         link in its section header, try to discover the link by inspecting the
6917         REL31 relocation at the beginning of the section.
6918         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6919         in error message.
6920         (Target_arm::Scan::global): Treat any reference to the symbol
6921         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6922
6923 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6924
6925         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6926         (Scan::global_reloc_may_be_function_pointer): New function.
6927         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6928         (Scan::global_reloc_may_be_function_pointer): New function.
6929         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6930         (Scan::global_reloc_may_be_function_pointer): New function.
6931         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6932         (Scan::global_reloc_may_be_function_pointer): New function.
6933         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6934         (Scan::global_reloc_may_be_function_pointer): New function.
6935         (Scan::possible_function_pointer_reloc): New function.
6936         (Target_x86_64::can_check_for_function_pointers): New function.
6937         * gc.h (gc_process_relocs): Scan relocation types to determine if
6938         function pointers were taken for targets that support it.
6939         * icf.cc (Icf::find_identical_sections): Include functions for
6940         folding in safe ICF whose pointer is not taken.
6941         * icf.h (Secn_fptr_taken_set): New typedef.
6942         (fptr_section_id_): New member.
6943         (section_has_function_pointers): New function.
6944         (set_section_has_function_pointers): New function.
6945         (check_section_for_function_pointers): New function.
6946         * options.h: Fix comment for safe ICF option.
6947         * target.h (can_check_for_function_pointers): New function.
6948         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6949         Modify icf_safe_test for X86-64.
6950         * testsuite/Makefile.in: Regenerate.
6951         * testsuite/icf_safe_so_test.cc: New file.
6952         * testsuite/icf_safe_so_test.sh: New file.
6953         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6954         (main): Change to take pointer to function kept_func_3.
6955         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6956         folding is done correctly for X86-64.
6957
6958 2010-02-12  David S. Miller  <davem@davemloft.net>
6959
6960         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6961         is_symbolless parameter.
6962         (Output_reloc<SHT_REL>::is_symbolless): New.
6963         (Output_reloc<SHT_REL>::is_symbolless_): New.
6964         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6965         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6966         (Output_reloc<SHT_RELA>::is_symbolless): New.
6967         (Output_data_reloc::add_global): Handle is_symbolless.
6968         (Output_data_reloc::add_global_relative): Likewise.
6969         (Output_data_reloc::add_local): Likewise.
6970         (Output_data_reloc::add_local_relative): Likewise.
6971         (Output_data_reloc::add_symbolless_global_addend): New.
6972         (Output_data_reloc::add_symbolless_local_addend): New.
6973         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6974         is_symbolless.
6975         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6976         instead of ->is_relative_
6977         (Output_reloc::write): Likewise.
6978         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6979         (Output_reloc::write_rel): Simplify.
6980
6981         * sparc.cc (Target_sparc::Scan::local): Use
6982         ->add_symbolless_local_addend as needed.
6983         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6984         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6985         based upon relocation offset.
6986
6987 2010-02-11  Doug Kwan  <dougkwan@google.com>
6988
6989         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6990         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6991         beginning of function.
6992         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6993         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6994         parameter is_32bit in calls to should_apply_static_reloc.
6995         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6996         (check_DATA): Add arm_abs_global.stdout.
6997         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6998         arm_abs_global.stdout): New rules.
6999         (MOSTLLYCLEANFILES): Add arm_abs_global
7000         * Makefile.in: Regenerate.
7001         * testsuite/arm_abs_global.s: New file.
7002         * testsuite/arm_abs_global.sh: Ditto.
7003         * testsuite/arm_abs_lib.s: Ditto.
7004
7005 2010-02-11  Ian Lance Taylor  <iant@google.com>
7006
7007         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7008         Read_relocs task.
7009         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7010         Allocate_commons_task first.
7011         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7012         task, rather than symtab_lock_.
7013         (Gc_process_relocs::~Gc_process_relocs): New function.
7014         (Gc_process_relocs::is_runnable): Check this_blocker_.
7015         (Gc_process_relocs::locks): Use next_blocker_ rather than
7016         blocker_.
7017         (Scan_relocs::~Scan_relocs): New function.
7018         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7019         symtab_lock_.
7020         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7021         next_blocker_.
7022         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7023         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7024         constructor accordingly.
7025         (class Gc_process_relocs): Likewise.
7026         (class Scan_relocs): Likewise.
7027         * common.h (class Allocate_commons_task): Remove symtab_lock_
7028         field, and corresponding constructor parameter.
7029         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7030         symtab_lock_.
7031         (Allocate_commons_task::locks): Likewise.
7032
7033 2010-02-11  Ian Lance Taylor  <iant@google.com>
7034
7035         * gold-threads.h (class Once): Define.
7036         (class Initialize_lock): Rewrite as child of Once.
7037         * gold-threads.cc (class Once_initialize): Define.
7038         (once_pointer_control): New static variable.
7039         (once_pointer, once_arg): New static variables.
7040         (c_run_once): New static function.
7041         (Once::Once, Once::run_once, Once::internal_run): New functions.
7042         (class Initialize_lock_once): Remove.
7043         (initialize_lock_control): Remove.
7044         (initialize_lock_pointer): Remove.
7045         (initialize_lock_once): Remove.
7046         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7047         (Initialize_lock::initialize): Rewrite.
7048         (Initialize_lock::do_run_once): New function.
7049         * archive.cc (Archive::interpret_header): Only clear name if it is
7050         not already empty.
7051         * fileread.cc: Include "gold-threads.h"
7052         (file_counts_lock): New static variable.
7053         (file_counts_initialize_lock): Likewise.
7054         (File_read::release): Only increment counts when using --stats.
7055         Use a lock around the increment.
7056         * parameters.cc (class Set_parameters_target_once): Define.
7057         (set_parameters_target_once): New static variable.
7058         (Parameters::Parameters): Move here from parameters.h.
7059         (Parameters::set_target): Rewrite.
7060         (Parameters::set_target_once): New function.
7061         (Parameters::clear_target): Move here and rewrite.
7062         * parameters.h (class Parameters): Update declarations.  Add
7063         set_parameters_target_once_ field.
7064         (Parameters::Parameters): Move to parameters.cc.
7065         (Parameters::clear_target): Likewise.
7066         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7067         task.
7068         (Start_group::~Start_group): New function.
7069         (Start_group::is_runnable): New function.
7070         (Start_group::locks, Start_group::run): New functions.
7071         (Finish_group::run): Change saw_undefined to size_t.
7072         * readsyms.h (class Start_group): Define.
7073         (class Finish_group): Change saw_undefined_ field to size_t.
7074         (Finish_group::Finish_group): Remove saw_undefined and
7075         this_blocker parameters.  Change all callers.
7076         (Finish_group::set_saw_undefined): New function.
7077         (Finish_group::set_blocker): New function.
7078         * symtab.h (class Symbol_table): Change saw_undefined to return
7079         size_t.  Change saw_undefined_ field to size_t.
7080         * target-select.cc (Set_target_once::do_run_once): New function.
7081         (Target_selector::Target_selector): Initialize set_target_once_
7082         field.  Don't initialize lock_ and initialize_lock_ fields.
7083         (Target_selector::instantiate_target): Rewrite.
7084         (Target_selector::set_target): New function.
7085         * target-select.h (class Set_target_once): Define.
7086         (class Target_selector): Update declarations.  Make
7087         Set_target_once a friend.  Remove lock_ and initialize_lock_
7088         fields.  Add set_target_once_ field.
7089
7090 2010-02-10  Ian Lance Taylor  <iant@google.com>
7091
7092         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7093         queueing any tasks.
7094         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7095         (queue_middle_tasks): Add all blockers before queueing any tasks.
7096         (queue_final_tasks): Likewise.
7097         * token.h (Task_token::add_blockers): New function.
7098         * object.h (Input_objects::number_of_relobjs): New function.
7099
7100 2010-02-10  Ian Lance Taylor  <iant@google.com>
7101
7102         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7103         shared, not if not position independent.
7104         * x86_64.cc (Relocate::relocate_tls): Likewise.
7105         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7106         (tls_pie_pic_test): New target.
7107         * testsuite/Makefile.in: Rebuild.
7108
7109         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7110         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7111         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7112         * testsuite/Makefile.in: Rebuild.
7113
7114 2010-02-09  David S. Miller  <davem@davemloft.net>
7115
7116         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7117         R_SPARC_RELATIVE using ->add_local_relative().
7118         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7119
7120         * output.h (Output_data_dynamic::add_section_size): New method
7121         that takes two Output_data objects.
7122         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7123         entry param.  Handle it in initializers.
7124         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7125         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7126         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7127         arg.
7128         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7129         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7130         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7131         for dynrel_includes_plt.
7132         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7133         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7134         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7135         before .rela.plt
7136         (Target_sparc::do_finalize_sections): Update to pass true for
7137         dynrel_includes_plt.
7138         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7139         output before .rela.plt
7140         (Target_powerpc::do_finalize_sections): Update to pass true for
7141         dynrel_includes_plt when 32-bit.
7142
7143 2010-02-08  Doug Kwan  <dougkwan@google.com>
7144
7145         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7146         method.
7147         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7148         Arm_relobj::scan_section_for_cortex_a8_stubs,
7149         Arm_relobj::do_relocation_section): Instead of calling
7150         Output_section::output_address, use faster
7151         Arm_relobj::simple_input_section_output_address.
7152
7153 2010-02-08  David S. Miller  <davem@davemloft.net>
7154
7155         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7156         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7157         relocation helper function.
7158
7159         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7160         just like R_SPARC_GOT{10,13,22}.
7161         (Target_sparc::Scan::local): Likewise.
7162         (Target_sparc::Relocate:relocate): Likewise.
7163
7164 2010-02-06  Ian Lance Taylor  <iant@google.com>
7165
7166         * configure.ac: Rewrite targetobjs duplicate removal code to use
7167         only shell constructs.
7168         * configure: Rebuild.
7169
7170 2010-02-05  Doug Kwan  <dougkwan@google.com>
7171
7172         PR 11247
7173         * arm.cc (Arm_relobj::section_is_scannable): New method.
7174         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7175         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7176
7177 2010-02-04  Doug Kwan  <dougkwan@google.com>
7178
7179         PR 11247
7180         * arm-reloc-property.cc (cstdio): Include.
7181         * configure.ac (targetobjs): Remove duplicates.
7182         * configure: Regenerate.
7183         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7184         big and little endian version for a given address size.
7185
7186 2010-02-03  Doug Kwan  <dougkwan@google.com>
7187
7188         * arm-reloc-property.cc
7189         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7190         definition.
7191         * arm-reloc-property.h
7192         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7193         New method definition.
7194         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7195         declaration.
7196         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7197         overflow to N.
7198         (GOT_PREL): Change implemented to Y.
7199         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7200         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7201         (Arm_relocate_functions::movw_abs_nc): Remove method.
7202         (Arm_relocate_functions::movt_abs): Ditto.
7203         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7204         (Arm_relocate_functions::thm_movt_abs): Ditto.
7205         (Arm_relocate_functions::movw_rel_nc): Ditto.
7206         (Arm_relocate_functions::movw_rel): Ditto.
7207         (Arm_relocate_functions::movt_rel): Ditto.
7208         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7209         (Arm_relocate_functions:thm_movw_rel): Ditto.
7210         (Arm_relocate_functions:thm_movt_rel): Ditto.
7211         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7212         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7213         New method definitions.
7214         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7215         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7216         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7217         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7218         (Target_arm::Relocate::relocate): Check for non-static or
7219         unimplemented relocation code and exit early.  Change calls to
7220         Target_arm::reloc_uses_thumb_bit and
7221         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7222         instead.  Refactor code to handle similar relocations to increase
7223         code sharing.  Remove check for unsupported relocation code in switch
7224         statement.
7225         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7226         relocation property table to find out size.  Change error message to
7227         print out the name of a relocation code instead of the numeric value.
7228         (Target_arm::scan_reloc_for_stub): Use relocation property table
7229         instead of calling Target_arm::reloc_uses_thumb_bit().
7230
7231 2010-02-02  Doug Kwan  <dougkwan@google.com>
7232
7233         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7234         types of relaxed input section.
7235
7236 2010-02-02  Doug Kwan  <dougkwan@google.com>
7237
7238         * Makefile.am (HFILES): Add arm-reloc-property.h.
7239         (DEFFILES): New.
7240         (TARGETSOURCES): Add arm-reloc-property.cc
7241         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7242         (libgold_a_SOURCES): $(DEFFILES)
7243         * Makefile.in: Regenerate.
7244         * arm-reloc-property.cc: New file.
7245         * arm-reloc-property.h: New file.
7246         * arm-reloc.def: New file.
7247         * arm.cc: Update comments.
7248         (arm-reloc-property.h): New included header.
7249         (arm_reloc_property_table): New global variable.
7250         (Target_arm::do_select_as_default_target): New method definition.
7251         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7252         arm-reloc-property to targ_extra_obj.
7253         * parameters.cc (set_parameters_target): Call
7254         Target::select_as_default_target().
7255         * target.h (Target::select_as_default_target): New method definition.
7256         (Target::do_select_as_default_target): Same.
7257
7258 2010-02-01  Doug Kwan  <dougkwan@google.com>
7259
7260         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7261         first_output_text_section_.
7262         (Arm_exidx_fixup::first_output_text_section): New method definition.
7263         (Arm_exidx_fixup::first_output_text_section_): New data member.
7264         (Arm_exidx_fixup::process_exidx_section): Record the first text
7265         output section seen.
7266         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7267         and entsize in output section header.
7268
7269 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7270
7271         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7272         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7273         (Arm_relocate_functions::thm_alu11): New Method.
7274         (Arm_relocate_functions::thm_pc8): New Method.
7275         (Arm_relocate_functions::thm_pc12): New Method.
7276         (Target_arm::Scan::local): Handle the relocations.
7277         (Target_arm::Scan::global): Likewise.
7278         (Target_arm::Relocate::relocate): Likewise.
7279         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7280
7281 2010-01-29  Doug Kwan  <dougkwan@google.com>
7282
7283         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7284         of relocation types as ld.
7285
7286 2010-01-29  Doug Kwan  <dougkwan@google.com>
7287
7288         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7289         to public.
7290         (Arm_relocate_functions::thumb_branch_common): Ditto.
7291         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7292         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7293         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7294         Arm_relocate_functions::jump24): Remove.
7295         (Target_arm::Relocate::relocate): Adjust code to call
7296         Arm_relocation_functions::arm_branch_common and
7297         Arm_relocation_functions::thumb_branch_common instead of their removed
7298         wrappers.  Merge switch-cases together to reduce source code size.
7299
7300 2010-01-29  Doug Kwan  <dougkwan@google.com>
7301
7302         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7303         output_local_symbol_count_needs_update_.
7304         (Arm_relobj::output_local_symbol_count_needs_update,
7305          Arm_relobj::set_output_local_symbol_count_needs_update,
7306          Arm_relobj::update_output_local_symbol_count): New methods.
7307         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7308         member.
7309         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7310         of pointed function as in a R_ARM_PREL31 relocation.
7311         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7312         for output local symbol count updating.
7313         (Target_arm::do_relax): Update output local symbol counts in objects
7314         if necessary.
7315         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7316
7317 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7318
7319         * arm.cc: Added support for the ARM relocations:
7320         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7321         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7322         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7323         movw_prel_nc).
7324         (Arm_relocate_functions::movw_rel): New method.
7325         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7326         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7327         thm_movw_prel_nc).
7328         (Arm_relocate_functions::thm_movw_rel): New method.
7329         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7330         thm_movt_prel).
7331         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7332         relocations.
7333         (Target_arm::Scan::global): Likewise.
7334         (Target_arm::Relocate::relocate): Likewise.
7335         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7336         Likewise.
7337
7338 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7339
7340         * arm.cc: Added support for ARM group relocations.
7341         (Target_arm::reloc_needs_sym_origin): New method.
7342         (Arm_relocate_functions::calc_grp_kn): New method.
7343         (Arm_relocate_functions::calc_grp_residual): New method.
7344         (Arm_relocate_functions::calc_grp_gn): New method.
7345         (Arm_relocate_functions::arm_grp_alu): New Method.
7346         (Arm_relocate_functions::arm_grp_ldr): New Method.
7347         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7348         (Arm_relocate_functions::arm_grp_ldc): New Method.
7349         (Target_arm::Scan::local): Handle the ARM group relocations.
7350         (Target_arm::Scan::global): Likewise.
7351         (Target_arm::Relocate::relocate): Likewise.
7352         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7353         Likewise.
7354
7355 2010-01-26  Doug Kwan  <dougkwan@google.com>
7356
7357         * arm.cc (set): Include.
7358         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7359         pointer type.
7360         (Arm_output_section::Text_section_list): New type.
7361         (Arm_output_section::append_text_sections_to_list): New method.
7362         (Arm_output_section::fix_exidx_coverage): Ditto.
7363         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7364         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7365         Relobj::set_section_offset() instead of
7366         Sized_relobj::invalidate_section_offset().
7367         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7368         parameter for section headers. Ignore relocation sections for
7369         unallocated sections and EXIDX sections.
7370         (Target_arm::fix_exidx_coverage): New method.
7371         (Target_arm::output_section_address_less_than): New type.
7372         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7373         linked text section instead of the EXIDX section.
7374         (Arm_output_section::create_stub_group): Add an assertion to check
7375         that this is not an EXIDX output section.
7376         (Arm_output_section::append_text_sections_to_list): New method.
7377         (Arm_output_section::fix_exidx_coverage): Ditto.
7378         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7379         Arm_relobj::section_needs_reloc_stub_scanning.
7380         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7381         first pass.
7382         (Target_arm::fix_exidx_coverage): New method.
7383         * object.h (Relobj::set_output_section): New method.
7384         (Sized_relobj::invalidate_section_offset): Remove method.
7385         (Sized_relobj::do_invalidate_section_offset): Remove method.
7386         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7387
7388 2010-01-25  Doug Kwan  <dougkwan@google.com>
7389
7390         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7391         Fix warning due to signed and unsigned comparison on a 32-bit host.
7392
7393 2010-01-22  Doug Kwan  <dougkwan@google.com>
7394
7395         * arm.cc (Target_arm::do_relax): Record an output section for section
7396         offset adjustment it contains any stub table that has changed.
7397         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7398         offsets in an output section if necessary.
7399         * output.cc (Output_section::Output_section): Initialize
7400         section_offsets_need_adjustments_.
7401         (Output_section::add_input_section_for_script): Renamed to
7402         Output_section::add_simple_input_section.
7403         (Output_section::save_states): Add a comment.
7404         (Output_section::discard_states): New method defintion.
7405         (Output_section::adjust_section_offsets): Same.
7406         * output.h (Output_section::add_input_section_for_script): Renamed to
7407         Output_section::add_simple_input_section.
7408         (Output_section::discard_states): New method declaration.
7409         (Output_section::adjust_section_offsets): Same.
7410         (Output_section::section_offsets_need_adjustment,
7411         Output_section::set_section_offsets_need_adjustment): New method
7412         definitions.
7413         (Output_section::section_offsets_need_adjustment_): New data member.
7414         * script-sections.cc
7415         (Output_section_element_input::set_section_address): Adjust code for
7416         renaming of Output_section::add_input_section_for_script.
7417         (Orphan_output_section::set_section_address): Same.
7418
7419 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7420
7421         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7422         Fix_v4bx enum values .
7423         * gold/options.h (General_options): New option definitions.
7424         (General_options::fix_v4bx): New method.
7425         (General_options::Fix_v4bx): New enum.
7426         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7427         (General_options::parse_fix_v4bx_interworking): New method.
7428
7429 2010-01-22  Doug Kwan  <dougkwan@google.com>
7430
7431         * arm.cc (Arm_exidx_fixup): New class.
7432
7433 2010-01-21  Doug Kwan  <dougkwan@google.com>
7434
7435         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7436         classes.
7437         (Arm_exidx_section_offset_map): New type.
7438
7439 2010-01-21  Doug Kwan  <dougkwan@google.com>
7440
7441         * arm.cc (Arm_exidx_input_section): New class.
7442         (Arm_relobj::exidx_input_section_by_link,
7443         Arm_relobj::exidx_input_section_by_shndx,
7444         Arm_relobj::make_exidx_input_section): New methods.
7445         (read_arm_attributes_section): Remove.
7446         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7447         information about them.
7448         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7449         to here.
7450
7451 2010-01-20  Doug Kwan  <dougkwan@google.com>
7452
7453         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7454         Input_section_specifier to Section_id.
7455         (Target_arm::new_arm_input_section: Adjust code for change of key
7456         type.
7457         (Target_arm::find_arm_input_section): Ditto.
7458         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7459         (Section_id): Remove.
7460         (Garbage_collection::Section_id_hash): Remove.
7461         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7462         (Section_id): Remove.
7463         (Icf::Section_id_hash): Remove.
7464         * object.h (Section_id, Const_section_id, Section_id_hash,
7465         Const_section_id_hash): New type definitions.
7466         * output.cc (Output_section::add_relaxed_input_section): Change to
7467         use Const_section_id instead of Input_section_specifier as key type.
7468         (Output_section::add_merge_input_section): Ditto.
7469         (Output_section::build_relaxation_map): Change to use Section_id
7470         instead of Input_section_specifier as key type.
7471         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7472         Ditto.
7473         (Output_section::convert_input_sections_to_relaxed_sections): Change
7474         to use Const_section_id instead of Input_section_specifier as key type.
7475         (Output_section::find_merge_section): Ditto.
7476         (Output_section::find_relaxed_input_section): Ditto.
7477         * output.h (Input_section_specifier): Remove class.
7478         (Output_section::Output_section_data_by_input_section_map): Change
7479         key type to Const_section_id.
7480         (Output_section::Output_relaxed_input_section_by_input_section_map):
7481         Ditto.
7482         (Output_section::Relaxation_map): Change key type to Section_id.
7483
7484 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7485
7486         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7487         (class Arm_v4bx_stub): New class.
7488         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7489         (Stub_factory::make_arm_v4bx_stub): New method.
7490         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7491         (Stub_table::empty): Handle v4bx stubs.
7492         (Stub_table::add_arm_v4bx_stub): New method.
7493         (Stub_table::find_arm_v4bx_stub): New method.
7494         (Arm_relocate_functions::v4bx): New method.
7495         (Target_arm::fix_v4bx): New method.
7496         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7497         (Stub_table::relocate_stubs): Likewise.
7498         (Stub_table::do_write): Likewise.
7499         (Stub_table::update_data_size_and_addralign): Likewise.
7500         (Stub_table::finalize_stubs):  Likewise.
7501         (Target_arm::Scan::local): Likewise.
7502         (Target_arm::Scan::global): Likewise.
7503         (Target_arm::do_finalize_sections): Likewise.
7504         (Target_arm::Relocate::relocate): Likewise.
7505         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7506         Likewise.
7507         (Target_arm::scan_reloc_for_stub): Likewise.
7508         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7509
7510 2010-01-19  Ian Lance Taylor  <iant@google.com>
7511
7512         * output.cc (Output_section_headers::do_sized_write): Write large
7513         segment count to sh_info field.
7514         (Output_file_header::do_sized_write): For large segment count,
7515         write PN_XNUM to e_phnum field.
7516
7517 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7518
7519         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7520         (Arm_relocate_functions::thm_jump8): New function.
7521         (Arm_relocate_functions::thm_jump11): New function.
7522         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7523         R_ARM_THM_JUMP11.
7524         (Target_arm::Scan::global): Likewise.
7525         (Target_arm::Relocate::relocate): Likewise.
7526         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7527         Likewise.
7528
7529 2010-01-14  Doug Kwan  <dougkwan@google.com>
7530
7531         * arm.cc (map, utility): Include headers.
7532         (Target_arm::apply_cortex_a8_workaround): New method.
7533         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7534         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7535         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7536         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7537         the --[no-]fix-cortex-a8 command line options.
7538         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7539         (Target_arm::relocate_stub): Use addend in instruction template.
7540         * options.h (DEFINE_bool): Set the user-set flag.
7541         (General_options): Add --[no-]-fix-cortex options.
7542         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7543         : Update fast look-up map after conversion.
7544
7545 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7546
7547         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7548         in the first pass of do_layout.
7549
7550 2010-01-13  Doug Kwan  <dougkwan@google.com>
7551
7552         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7553         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7554         apparent compiler problem of not folding static constant integral
7555         data members of elfcpp::Elf_sizes<32>.
7556
7557 2010-01-13  Doug Kwan  <dougkwan@google.com>
7558
7559         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7560         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7561         Arm_relobj::scan_section_for_cortex_a8_erratum,
7562         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7563         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7564         sections to scan for relocation stubs into a new method
7565         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7566         relocation and Cortex-A8 stub scanning.
7567         (Target_arm::do_relax): Force stubs to be after stubbed sections
7568         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7569         the beginning of a new relaxation pass.  Update a comment.
7570         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7571
7572 2010-01-12  Ian Lance Taylor  <iant@google.com>
7573
7574         * target-reloc.h (visibility_error): New inline function.
7575         (relocate_section): Call visibility_error.
7576         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7577         (MOSTLYCLEANFILES): Likewise.
7578         (protected_4_pic.o, protected_3.err): New targets.
7579         * testsuite/protected_4.cc: New file.
7580
7581 2010-01-12  Doug Kwan  <dougkwan@google.com>
7582
7583         * arm.cc (Cortex_a8_reloc): New class.
7584         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7585         and cortex_a8_relocs_info_.
7586         (Target_arm::fix_cortex_a8): New method definition.
7587         (Target_arm::Cortex_a8_relocs_info): New type.
7588         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7589         New data member declarations.
7590         (Target_arm::scan_reloc_for_stub): Record information about
7591         relocations for THUMB branches that might be exempted from the
7592         Cortex-A8 workaround.
7593         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7594         at the beginning of a relaxation pass.
7595
7596 2010-01-12  Doug Kwan  <dougkwan@google.com>
7597
7598         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7599         (Arm_relobj::Mapping_symbol_position,
7600          Arm_reloj::Mapping_symbol_position_less,
7601          Arm_relobj::Mapping_symbols_info): New types.
7602         (Target_arm::is_mapping_symbol_name): New method definition.
7603         (Arm_relobj::do_count_local_symbols): Save information about mapping
7604         symbols.
7605
7606 2010-01-11  Doug Kwan  <dougkwan@google.com>
7607
7608         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7609         Arm_relocate_functions::thumb32_branch_upper,
7610         Arm_relocate_functions::thumb32_branch_lower,
7611         Arm_relocate_functions::thumb32_cond_branch_offset,
7612         Arm_relocate_functions::thumb32_cond_branch_upper,
7613         Arm_relocate_functions::thumb32_cond_branch_lower,
7614         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7615         branch offset encoding.
7616         (Arm_relocate_functions::thumb_branch_common): Use new branch
7617         offset encoding methods to avoid code duplication.
7618         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7619         (Stub_addend_reader::operator()): Use new branch encoding method
7620         to avoid code duplication.
7621
7622 2010-01-11  Doug Kwan  <dougkwan@google.com>
7623
7624         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7625         (Target_arm::do_finalize_sections): Define special EXIDX section
7626         symbols only if referenced.
7627         * gc.h (Garbage_collection::add_reference): New method.
7628         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7629         code duplication.
7630
7631 2010-01-11  Ian Lance Taylor  <iant@google.com>
7632
7633         * script.cc (Version_script_info::build_expression_list_lookup):
7634         Change complaing about duplicate wildcard match from error to
7635         warning.
7636
7637         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7638         of 2009-12-30.
7639         (Version_script_info::Version_script_info): Initialize globs_,
7640         default_version_, default_is_global_, and exact_.  Don't
7641         initialize globals_ or locals_.
7642         (Version_script_info::build_lookup_tables): Build local symbols
7643         first.
7644         (Version_script_info::unquote): New function.
7645         (Version_script_info::add_exact_match): New function.
7646         (Version_script_info::build_expression_list_lookup): Remove lookup
7647         parameter.  Add is_global parameter.  Change all callers.  Handle
7648         wildcard pattern specially.  Unquote pattern.  Call
7649         add_exact_match.
7650         (Version_script_info::get_name_to_match): New function.
7651         (Version_script_info::get_symbol_version): New function.
7652         (Version_script_info::get_symbol_version_helper): Remove.
7653         (Version_script_info::check_unmatched_names): Call unquote.
7654         * script.h (class Version_script_info): Change get_symbol_version
7655         to be non-inline and add is_global parameter; change all callers.
7656         Rewrite symbol_is_local.  Update declarations.  Define struct
7657         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7658         Remove globals_ and locals_ members.  Add exact_, globs_,
7659         default_version_, is_global_.
7660         (Version_script_info::Glob): Remove pattern, add expression and
7661         is_global.  Update constructor.  Change all callers.
7662         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7663         default version.
7664         (Versions::symbol_section_contents): If a symbol is undefined, or
7665         defined in a dynamic object, set the version index to
7666         VER_NDX_LOCAL.
7667         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7668         symbol_is_local.
7669         (Symbol_table::add_from_pluginobj): Likewise.
7670         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7671
7672 2010-01-11  Doug Kwan  <dougkwan@google.com>
7673
7674         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7675         (incremental_dump_LDADD): Add linking option for libintl.
7676         * Makefile.in: Regenerate.
7677
7678 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7679
7680         PR gold/11144
7681         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7682         instead of -Ds.
7683         * testsuite/Makefile.in: Regenerated.
7684
7685 2010-01-10  Doug Kwan  <dougkwan@google.com>
7686
7687         * options.h (DEFINE_var): Use parentheses around argument varname__
7688         in macro body to avoid any unintended subsequent substitutions.
7689
7690 2010-01-10  Ian Lance Taylor  <iant@google.com>
7691
7692         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7693         candidates before doing symbol resolution.
7694
7695         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7696         ODR candidates if only one is weak.
7697
7698 2010-01-08  Ian Lance Taylor  <iant@google.com>
7699
7700         * script.cc (Version_script_info::build_expression_list_lookup):
7701         Don't warn about ambiguous version, just record the ambiguity.
7702         (Version_script_info::get_symbol_version_helper): Give error if
7703         version is ambiguous.
7704
7705 2010-01-08  Doug Kwan  <dougkwan@google.com>
7706
7707         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7708         prev_data_size_ and prev_addralign_.  Remove initializer for
7709         deleted data member has_been_changed_.
7710         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7711         to determine if the table is empty.
7712         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7713         Remove.
7714         (Stub_table::add_reloc_stub): Define method in class definition
7715         instead of just declaring it there.
7716         (Stub_table::add_cortex_a8_stub): New method definition.
7717         (Stub_table::update_data_size_and_addralign): Ditto.
7718         (Stub_table::finalize_stubs): Ditto.
7719         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7720         (Stub_table::do_addralign_): Return address alignment in the
7721         (Stub_table::do_reset_address_and_file_offset): Define method in
7722         class definition instead of declaring it there.  Set current data
7723         size to be the data size of the previous pass.
7724         (Stub_table::set_final_data_size): Use current data size as the
7725         final data size.
7726         (Stub_table::relocate_stub): Change parameter type of stub from
7727         Reloc_stub pointer to Stub pointer.
7728         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7729         (Stub_table::Cortex_a8_stub_list): New typedef.
7730         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7731          Stub_table::prev_addralign_): New data member.
7732         (Arm_relobj::Arm_relobj): Initialize data member
7733         section_has_cortex_a8_workaround_.
7734         (Arm_relobj::section_has_cortex_a8_workaround,
7735          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7736          definitions.
7737         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7738         declarations.
7739         (Target_arm::relocate_stub): Change parameter type of stub from
7740         Reloc_stub pointer to Stub pointer.
7741         (Insn_template::size, Insn_template::alignment): Handle
7742         THUMB16_SPECIAL_TYPE.
7743         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7744          Stub_table::update_data_size_and_addralign,
7745          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7746         definitions.
7747         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7748         (Stub_table::do_write): Ditto.
7749         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7750
7751 2010-01-08  Ian Lance Taylor  <iant@google.com>
7752
7753         PR 11108
7754         * symtab.h (class Symbol): Remove fields is_target_special_ and
7755         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7756         (Symbol::is_defined_in_discarded_section): New function.
7757         (Symbol::set_is_defined_in_discarded_section): New function.
7758         (Symbol::has_plt_offset): Rewrite.
7759         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7760         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7761         Don't initialize is_target_special_ or has_plt_offset_.
7762         Initialize is_defined_in_discarded_section_.
7763         (Symbol_table::add_from_relobj): If appropriate, set
7764         is_defined_in_discarded_section.
7765         * resolve.cc (Symbol::override_base_with_special): Don't test
7766         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7767         * target-reloc.h (relocate_section): Do special handling for
7768         symbols defined in discarded sections for global symbols as well
7769         as local symbols.
7770
7771 2010-01-08  Ian Lance Taylor  <iant@google.com>
7772
7773         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7774         the SHT_SYMTAB case.
7775
7776 2010-01-08  Ian Lance Taylor  <iant@google.com>
7777
7778         * object.cc (Sized_relobj::do_layout): Don't get confused if
7779         layout_eh_frame returns NULL.
7780
7781 2010-01-08  Ian Lance Taylor  <iant@google.com>
7782
7783         PR 11084
7784         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7785         dynamic symbol table, use the normal symbol table.
7786         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7787         symbol table.
7788
7789 2010-01-08  Ian Lance Taylor  <iant@google.com>
7790
7791         PR 11072
7792         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7793         sections.
7794
7795 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7796
7797         * version.cc (print_version): Change to "Copyright 2010".
7798
7799 2010-01-08  Ian Lance Taylor  <iant@google.com>
7800
7801         PR 10287
7802         PR 11063
7803         * i386.cc (class Target_i386): Change return type of plt_section
7804         to be non-const.
7805         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7806         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7807         tls_desc_rel_ field.
7808         (Output_data_plt_i386::rel_tls_desc): New function.
7809         (Target_i386::rel_tls_desc_section): New function.
7810         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7811         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7812         R_386_TLS_DESC reloc in rel_tls_desc_section.
7813         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7814         Define struct Tlsdesc_info.
7815         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7816         (Target_x86_64::do_reloc_symbol_index): New function.
7817         (Target_x86_64::add_tlsdesc_info): New function.
7818         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7819         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7820         tlsdesc_rel_ field.
7821         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7822         all callers.
7823         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7824         (Target_x86_64::rela_tlsdesc_section): New function.
7825         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7826         handling.
7827         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7828         (Target_x86_64::do_reloc_addend): New function.
7829         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7830         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7831         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7832         (Output_reloc::type): New function.
7833         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7834         (Output_reloc::is_target_specific): New function.
7835         (Output_reloc::target_arg): New function.
7836         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7837         absolute relocs and target specific relocs.
7838         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7839         add_target_specific.
7840         (class Output_data_reloc) [SHT_RELA]: Likewise.
7841         * output.cc (Output_reloc::Output_reloc): Add four new versions
7842         for absolute relocs and target specific relocs.
7843         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7844         (Output_reloc::get_symbol_index): Likewise.
7845         (Output_reloc::local_section_offset): Check that local_sym_index_
7846         is not TARGET_CODE or 0.
7847         (Output_reloc::symbol_value): Likewise.
7848         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7849         reloc.
7850         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7851         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7852         functions.
7853         * layout.cc (add_target_dynamic_tags): Use output section for
7854         DT_PLTRELSZ and DT_JMPREL.
7855
7856 2010-01-07  Ian Lance Taylor  <iant@google.com>
7857
7858         PR 11061
7859         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7860         function.
7861         (class Output_data_reloc_generic): Define.
7862         (class Output_data_reloc_base): Change base class to
7863         Output_data_reloc_generic.  Change add() method to call
7864         bump_relative_reloc_count for a relative reloc.  Remove
7865         sort_relocs_ field.
7866         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7867         to sort_relocs().
7868         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7869         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7870         appropriate.
7871         * layout.h (class Layout): Update declaration.
7872
7873 2010-01-07  Ian Lance Taylor  <iant@google.com>
7874
7875         * output.h (class Output_data): Add const version of
7876         output_section and do_output_section.
7877         (class Output_section_data): Add const version of
7878         do_output_section.
7879         (class Output_section): Likewise.
7880         * layout.cc (Layout::add_target_dynamic_tags): New function.
7881         * layout.h (class Layout): Update declarations.
7882         * arm.cc (Target_arm::do_finalize_sections): Use
7883         add_target_dynamic_tags.
7884         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7885         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7886         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7887         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7888
7889 2010-01-07  Ian Lance Taylor  <iant@google.com>
7890
7891         PR 11042
7892         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7893         object as needed.
7894
7895 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7896             Ian Lance Taylor  <iant@google.com>
7897
7898         PR 11019
7899         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7900         Xindex::read_symtab_xindex.
7901
7902 2010-01-07  Doug Kwan  <dougkwan@google.com>
7903
7904         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7905         (Insn_template::thumb16_bcond_insn): New method declaration.
7906         (Insn_template): Fix spelling.
7907         (Stub::thumb16_special): New method declaration.
7908         (Stub::do_write): Define virtual method which was previously pure
7909         virtual.
7910         (Stub::do_thumb16_special): New method declaration.
7911         (Stub::do_fixed_endian_write): New template member.
7912         (Reloc_stub::do_write): Remove.
7913         (Reloc_stub::do_fixed_endian_write): Remove.
7914         (Cortex_a8_stub): New class definition.
7915         (Stub_factory::make_cortex_a8_stub): New method definition.
7916         (Stub_factory::Stub_factory): Add missing static storage class
7917         qualifier for elf32_arm_stub_a8_veneer_blx.
7918
7919 2010-01-07  Ian Lance Taylor  <iant@google.com>
7920
7921         PR 10980
7922         * options.h (class General_options): Add --warn-unresolved-symbols
7923         and --error-unresolved-symbols.
7924         * errors.cc (Errors::undefined_symbol): Implement
7925         --warn-unresolved-symbols.
7926
7927         * options.h (class General_options): Add -z text and -z textoff.
7928         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7929
7930 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7931
7932         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7933         (Garbage_collection::cident_sections): New function.
7934         (Garbage_collection::add_cident_section): New function.
7935         (Garbage_collection::cident_sections_): New member.
7936         (gc_process_relocs): Add references to sections whose names are C
7937         identifiers.
7938         * gold.h (cident_section_start_prefix): New constant.
7939         (cident_section_stop_prefix): New constant.
7940         (is_cident): New function.
7941         * layout.cc (Layout::define_section_symbols): Replace string constants
7942         with the newly defined constants.
7943         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7944         C identifiers.
7945         * testsuite/Makefile.am: Add gc_orphan_section_test.
7946         * testsuite/Makefile.in: Regenerate.
7947         * testsuite/gc_orphan_section_test.cc: New file.
7948         * testsuite/gc_orphan_section_test.sh: New file.
7949
7950 2010-01-06  Ian Lance Taylor  <iant@google.com>
7951
7952         PR 10980
7953         * options.h (class General_options): Add --warn-shared-textrel.
7954         * layout.cc (Layout::finish_dynamic_section): Implement
7955         --warn-shared-textrel.
7956
7957         PR 10980
7958         * options.h (class General_options): Add --warn-multiple-gp.
7959
7960 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7961
7962         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7963         $(THREADSLIB) and $(LIBDL).
7964         * Makefile.in: Rebuild.
7965
7966 2010-01-06  Ian Lance Taylor  <iant@google.com>
7967
7968         PR 10980
7969         * options.cc (General_options::parse_section_start): New function.
7970         (General_options::section_start): New function.
7971         (General_options::General_options): Initialize all members.
7972         * options.h: Include <map>
7973         (class General_options): Add --section-start.  Add section_starts_
7974         member.
7975         * layout.cc (Layout::attach_allocated_section_to_segment): If
7976         --section-start was used, set the address of the segment.  Remove
7977         local sort_sections.
7978         (Layout::relaxation_loop_body): If the address of the load segment
7979         has been set by --section-start, don't use it.
7980         * output.h (Output_segment::update_flags_for_output_section): New
7981         function.
7982         * output.cc (Output_segment::add_output_section): Call
7983         update_flags_for_output_section.
7984
7985 2010-01-05  Ian Lance Taylor  <iant@google.com>
7986
7987         PR 10980
7988         * options.h (class General_options): Add --undefined-version.
7989         * script.cc (struct Version_expression): Add was_matched_by_symbol
7990         field.
7991         (Version_script_info::matched_symbol): New function.
7992         (Version_script_info::get_symbol_version_helper): Call
7993         matched_symbol.
7994         (Version_script_info::check_unmatched_names): New function.
7995         * script.h (class Version_script_info): Update declarations.
7996         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7997
7998         * options.h (class General_options): Use DEFINE_bool_alias for
7999         allow_multiple_definition.
8000         * resolve.cc (Symbol_table::should_override): Don't test
8001         allow_multiple_definition.
8002
8003         PR 10980
8004         * options.h (class General_options): Add --cref.
8005         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8006         until after printing cref table.
8007         * cref.cc: Include "symtab.h".
8008         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8009         (Cref_table_compare::operator()): New function.
8010         (Cref_inputs::gather_cref): New function.
8011         (filecol): New static const.
8012         (Cref_inputs::print_cref): New function.
8013         (Cref::print_cref): New function.
8014         * cref.h: Include <cstdio>.
8015         (class Cref): Update declarations.
8016         * mapfile.h (Mapfile::file): New function.
8017         * object.h (class Object): Define Symbols.  Declare virtual
8018         do_get_global_symbols.
8019         (Object::get_global_symbols): New function.
8020         * object.cc (Input_objects::add_object): Pass object to cref_ if
8021         --cref.
8022         (Input_objects::archive_start): Likewise.
8023         (Input_objects::archive_stop): Likewise.
8024         (Input_objects::print_cref): New function.
8025         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8026         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8027         --cref.
8028         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8029         function.
8030         * plugin.h (class Sized_pluginobj): Update declarations.
8031
8032 2010-01-05  Ian Lance Taylor  <iant@google.com>
8033
8034         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8035         to is_default_version.  Rename insdef to insdefault.
8036         (Symbol_table::add_from_relobj): Rename def to is_default_version
8037         and local to is_forced_local.
8038         (Symbol_table::add_from_pluginobj): Likewise.
8039         (Symbol_table::add_from_dynobj): Likewise.
8040         (Symbol_table::define_special_symbol): Rename insdef to
8041         insdefault.
8042
8043 2010-01-04  Ian Lance Taylor  <iant@google.com>
8044
8045         PR 10980
8046         * options.h (class General_options): Add
8047         --allow-multiple-definition and -z muldefs.
8048         * resolve.cc (Symbol_table::should_override): Don't warn about a
8049         multiple symbol definition if --allow-multiple-definition or -z
8050         muldefs.
8051
8052         PR 10980
8053         * options.h (class General_options): Add --add-needed and
8054         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8055         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8056         error if --copy-dt-needed-entries aka --add-needed is used and
8057         would cause a change in behaviour.
8058
8059         PR 10980
8060         * options.h (class General_options): Add -G as a short version of
8061         --shared.  Add no-op options -assert, -g, and -i.
8062
8063 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8064
8065         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8066         check for .text or .gnu.linkonce.t sections.
8067         * icf.cc (Icf::find_identical_sections): Ditto.
8068         Change the detection for mangled function name within the section
8069         name.
8070         * icf.h (is_section_foldable_candidate): New function.
8071
8072 2009-12-30  Ian Lance Taylor  <iant@google.com>
8073
8074         PR 10980
8075         * options.h (class General_options): Permit two dashes with
8076         --retain-symbols-file.
8077
8078 2009-12-30  Ian Lance Taylor  <iant@google.com>
8079
8080         PR 10979
8081         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8082         don't put the file header and segment headers in the text
8083         segment.
8084
8085         PR 10979
8086         * common.cc (Sort_commons::operator()): Stabilize sort when both
8087         entries are NULL.
8088         (Symbol_table::do_allocate_commons_list): When allocating common
8089         symbols, skip a symbol which is no longer common.
8090         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8091         an object before checking its type.
8092         * testsuite/common_test_2.c: New file.
8093         * testsuite/common_test_3.c: New file.
8094         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8095         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8096         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8097         (common_test_2_pic.o, common_test_2.so): New targets.
8098         (common_test_3_pic.o, common_test_3.so): New targets.
8099         * testsuite/Makefile.in: Rebuild.
8100
8101         PR 10979
8102         * script.cc (read_input_script): If we see a new SECTIONS clause,
8103         and we have added an input section, give an error.
8104         * layout.h (class Layout): Add have_added_input_section function.
8105         Add have_added_input_section_ field.
8106         * layout.cc (Layout::Layout): Initialize
8107         have_added_input_section_.
8108         (Layout::layout): Set have_added_input_section_.
8109         (Layout::layout_eh_frame): Likewise.
8110
8111 2009-12-30  Ian Lance Taylor  <iant@google.com>
8112
8113         PR 10931
8114         * options.h (class General_options): Add --sort-common option.
8115         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8116         * common.cc (Sort_common): Add sort_order parameter to
8117         constructor.  Add sort_order_ field.
8118         (Sort_commons::operator): Check sort_order_.
8119         (Symbol_table::allocate_commons): Determine the sort order.
8120         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8121         Change all callers.
8122         (Symbol_table::do_allocate_commons_list): Likewise.
8123
8124 2009-12-30  Ian Lance Taylor  <iant@google.com>
8125
8126         PR 10916
8127         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8128         symbols from this object, don't change the visibility of an
8129         undefined symbol.
8130         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8131
8132 2009-12-30  Ian Lance Taylor  <iant@google.com>
8133
8134         PR 10861
8135         * script.h (class Version_script_info): Define Language enum.
8136         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8137         new fields globals_, locals_, and is_finalized_.
8138         * script.cc: Various formatting fixes.
8139         (class Parser_closure): Change language_stack_ from a vector of
8140         std::string to one of Version_script_info::Language.  Adjust all
8141         uses accordingly.
8142         (class Lazy_demangler): Remove.
8143         (struct Version_expression): Change language from std::string to
8144         Version_script_info::Language.
8145         (Version_script_info::Version_script_info): New function.
8146         (Version_script_info::~Version_script_info): Don't call clear.
8147         (Version_script_info::finalize): New function.
8148         (Version_script_info::build_lookup_tables): New function.
8149         (Version_script_info::build_expression_list_lookup): New
8150         function.
8151         (Version_script_info::get_symbol_version_helper): Rewrite to use
8152         lookup tables.
8153         (Version_script_info::print_expression_list): Adjust to use
8154         Version_script_info::Language.
8155         (script_push_lex_into_version_mode): Check that the version script
8156         has not been finalized.
8157         (version_script_push_lang): Change language string to
8158         Version_script_info::Language.
8159         * options.cc (Command_line::version_script): New function.
8160         * options.h (class General_options): Add finalize_dynamic_list
8161         function.  Change version_script from declaration to definition.
8162         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8163         * testsuite/version_script.map: Remove duplicate def of foo.
8164         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8165         version_script.map.
8166         * testsuite/Makefile.in: Rebuild.
8167
8168 2009-12-30  Ian Lance Taylor  <iant@google.com>
8169
8170         PR 10843
8171         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8172         if the input symbol index is 0, make the output symbol index 0.
8173
8174 2009-12-30  Ian Lance Taylor  <iant@google.com>
8175
8176         PR 10670
8177         * options.h (class General_options): Add -x/--discard-all.
8178         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8179         --discard-all.  If the local symbol needs a dynamic entry, check
8180         that before handling --discard-locals.
8181
8182 2009-12-30  Ian Lance Taylor  <iant@google.com>
8183
8184         PR 10450
8185         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8186         flags to PF_R.
8187         (Output_segment::add_output_section): Don't change the flags if
8188         the type is PT_TLS.
8189
8190         PR 10450
8191         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8192         GNU hash table if they need a dynamic value.  Otherwise, don't add
8193         them if they are defined in a dynamic object or are forced local.
8194
8195 2009-12-29  Ian Lance Taylor  <iant@google.com>
8196
8197         PR 10450
8198         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8199         .gnu.hash table for a 32-bit target.
8200
8201         PR 10450
8202         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8203         regular and a dynamic object only needs a dynamic symbol table
8204         entry if it is externally visible.
8205
8206         PR 10450
8207         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8208         constructor.  Add global_offset_table_ field.
8209         (Target_i386::got_section): Set global_offset_table_.
8210         (Target_i386::do_finalize_sections): Set global_offset_table_
8211         size.
8212         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8213         in constructor.  Add global_offset_table_ field.
8214         (Target_x86_64::got_section): Set global_offset_table_.
8215         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8216         size.
8217
8218         * layout.cc (Layout::Layout): Initialize increase_relro_.
8219         (Layout::get_output_section): Add is_relro, is_last_relro, and
8220         is_first_non_relro parameters.  Change all callers.
8221         (Layout::choose_output_section): Likewise.
8222         (Layout::add_output_section_data): Likewise.
8223         (Layout::make_output_section): Likewise.
8224         (Layout::set_segment_offsets): Clear increase_relro when using a
8225         linker script.
8226         * layout.h (class Layout): Add increase_relro method.  Add
8227         increase_relro_ field.  Update declarations.
8228         * output.cc (Output_section::Output_section): Initialize
8229         is_last_relro_ and is_first_non_relro_.
8230         (Output_segment::add_output_section): Group relro sections is
8231         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8232         (Output_segment::maximum_alignment): Remove relro handling.
8233         (Output_segment::set_section_addresses): Add increase_relro
8234         parameter.  Change all callers.  Add initial alignment to align
8235         relro sections on separate page.  Remove old relro handling.
8236         (Output_segment::set_section_list_addresses): Remove in_relro
8237         parameter.  Change all callers.
8238         (Output_segment::set_offset): Add increase parameter.  Change all
8239         callers.  Remove old relro handling.
8240         * output.h (class Output_section): Add new methods: is_last_relro,
8241         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8242         Add is_last_relro_ and is_first_non_relro_ fields.
8243         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8244         Create separate .got.plt section.  Call increase_relro.
8245         * x86_64.cc (Target_x86_64::got_section): Likewise.
8246         * testsuite/relro_script_test.t: Add .got.plt.
8247
8248         PR 10450
8249         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8250         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8251         (Layout::finalize): Call set_dynamic_symbol_size.
8252         (Layout::set_dynamic_symbol_size): New function.
8253         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8254         set_dynamic_symbol_size.
8255
8256         PR 10450
8257         * output.h (class Output_section): Add is_entsize_zero_ field.
8258         * output.cc (Output_section::Output_section): Initialize
8259         is_entsize_zero_.
8260         (Output_section::set_entsize): If two different entsizes are
8261         requested, force it to zero.
8262         (Output_section::add_input_section): Set flags for .debug_str
8263         before updating section flags.  Set entsize.
8264         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8265         and SHF_STRING if all input sections have those flags.
8266
8267 2009-12-29   Rafael Espindola  <espindola@google.com>
8268
8269         * main.cc (main): Fix the sys time reporting.
8270         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8271         reporting.
8272
8273 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8274
8275         * options.cc (General_options::parse_version): Allow -v to exit
8276         without an error if there is nothing to link.
8277
8278 2009-12-29  Ian Lance Taylor  <iant@google.com>
8279
8280         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8281         using a version of gcc before 4.1.
8282         * configure: Rebuild.
8283
8284 2009-12-28  Chris Demetriou  <cgd@google.com>
8285
8286         * attributes.cc (Output_attributes_section_data::do_write): Use
8287         std::vector::front rather than std::vector::data.
8288
8289 2009-12-28  Ian Lance Taylor  <iant@google.com>
8290
8291         * symtab.h (class Symbol_table): Add enum Defined.
8292         * resolve.cc (Symbol_table::should_override): Add defined
8293         parameter.  Change all callers.  Test whether object is NULL
8294         before calling a method on it.
8295         (Symbol_table::report_resolve_problem): Add defined parameter.
8296         Change all callers.
8297         (Symbol_table::should_override_with_special): Likewise.
8298         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8299         parameter.  Change all callers.
8300         (Symbol_table::do_define_in_output_data): Likewise.
8301         (Symbol_table::define_in_output_segment): Likewise.
8302         (Symbol_table::do_define_in_output_segment): Likewise.
8303         (Symbol_table::define_as_constant): Likewise.
8304         (Symbol_table::do_define_as_constant): Likewise.
8305         * script.h (class Symbol_assignment): Add is_defsym parameter to
8306         constructor; change all callers.
8307         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8308         parameter.  Change all callers.  Add is_defsym_ field.
8309         (class Parser_closure): Add parsing_defsym parameter to
8310         constructor; change all callers.  Add parsing_defsym accessor
8311         function.  Add parsing_defsym_ field.
8312
8313 2009-12-28  Ian Lance Taylor  <iant@google.com>
8314
8315         * gold.cc (queue_middle_tasks): Fix formatting.
8316         * object.cc (Relobj::is_section_name_included): Likewise.
8317
8318 2009-12-23  Ian Lance Taylor  <iant@google.com>
8319
8320         * i386.cc (Target_i386::do_calls_non_split): Recognize
8321         -fsplit-stack prologue for a function with a static chain.
8322         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8323         -fsplit-stack prologue when using %r11.
8324
8325 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8326
8327         * options.cc (General_options::parse_version): Make -v continue and do
8328         the link like GNU ld does.
8329
8330 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8331
8332         * Makefile.am (CCFILES): Add timer.cc.
8333         (HFILES): Add timer.h.
8334         * configure.ac: Check for sysconf and times.
8335         * main.cc: include timer.h.
8336         (main): Use Timer instead of get_run_time.
8337         * timer.cc: New.
8338         * timer.h: New.
8339         * workqueue.cc: include timer.h.
8340         (Workqueue::find_and_run_task):
8341         Report user, sys and wall time.
8342         * Makefile.in: Regenerate.
8343         * config.in: Regenerate.
8344         * configure: Regenerate.
8345
8346 2009-12-16  Doug Kwan  <dougkwan@google.com>
8347
8348         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8349         sections.
8350         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8351         relaxed input sections.
8352         * output.cc (Output_section::find_relaxed_input_section): Change
8353         return type to Output_relaxed_input_section pointer.  Adjust code
8354         for new type of relaxed_input_section_map_.
8355         * output.h (Output_section::find_relaxed_input_section): Change
8356         return type to Output_relaxed_input_section pointer.
8357         (Output_section::Output_relaxed_input_section_by_input_section_map):
8358         New type.
8359         (Output_section::relaxed_input_section_map_): Change type to
8360         Output_section::Output_relaxed_input_section_by_input_section_map.
8361         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8362         input section.
8363
8364 2009-12-15  Ian Lance Taylor  <iant@google.com>
8365
8366         * layout.cc (Layout::create_shstrtab): Only write out after input
8367         sections if we are compressing debug sections.
8368
8369 2009-12-15  Ian Lance Taylor  <iant@google.com>
8370
8371         * archive.cc (Archive::add_symbols): Only look up a symbol without
8372         a version if there is, in fact, a version.
8373
8374 2009-12-14  Ian Lance Taylor  <iant@google.com>
8375
8376         Revert -Wshadow changes, all changes from:
8377         2009-12-11  Doug Kwan  <dougkwan@google.com>
8378         2009-12-11  Nick Clifton  <nickc@redhat.com>
8379         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8380
8381 2009-12-11  Doug Kwan  <dougkwan@google.com>
8382
8383         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8384         due to -Wshadow.
8385         * attributes.cc (Object_attribute::size): Ditto.
8386         (Attributes_section_data::size): Ditto.
8387         (Attributes_section_data::Attributes_section_data): Ditto.
8388         (Output_attributes_section_data::do_write): Ditto.
8389         * attributes.h (Object_attribute::set_type): Ditto.
8390         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8391
8392 2009-12-11  Nick Clifton  <nickc@redhat.com>
8393
8394         * archive.cc: Fix shadowed variable warnings.
8395         * arm.cc: Likewise.
8396         * compressed_output.cc: Likewise.
8397         * compressed_output.h: Likewise.
8398         * configure: Likewise.
8399         * dwarf_reader.cc: Likewise.
8400         * dynobj.cc: Likewise.
8401         * dynobj.h: Likewise.
8402         * ehframe.cc: Likewise.
8403         * ehframe.h: Likewise.
8404         * errors.cc: Likewise.
8405         * expression.cc: Likewise.
8406         * fileread.cc: Likewise.
8407         * fileread.h: Likewise.
8408         * freebsd.h: Likewise.
8409         * i386.cc: Likewise.
8410         * icf.cc: Likewise.
8411         * incremental.h: Likewise.
8412         * layout.cc: Likewise.
8413         * layout.h: Likewise.
8414         * mapfile.cc: Likewise.
8415         * merge.cc: Likewise.
8416         * merge.h: Likewise.
8417         * object.cc: Likewise.
8418         * object.h: Likewise.
8419         * options.h: Likewise.
8420         * output.cc: Likewise.
8421         * output.h: Likewise.
8422         * parameters.cc: Likewise.
8423         * plugin.cc: Likewise.
8424         * powerpc.cc: Likewise.
8425         * reduced_debug_output.cc: Likewise.
8426         * reduced_debug_output.h: Likewise.
8427         * reloc.cc: Likewise.
8428         * reloc.h: Likewise.
8429         * resolve.cc: Likewise.
8430         * script-sections.cc: Likewise.
8431         * script.cc: Likewise.
8432         * script.h: Likewise.
8433         * sparc.cc: Likewise.
8434         * symtab.cc: Likewise.
8435         * symtab.h: Likewise.
8436         * target-select.cc: Likewise.
8437         * target-select.h: Likewise.
8438         * token.h: Likewise.
8439         * workqueue.cc: Likewise.
8440         * workqueue.h: Likewise.
8441         * x86_64.cc: Likewise.
8442
8443 2009-12-10  Doug Kwan  <dougkwan@google.com>
8444
8445         * arm.cc (attributes.h): New include.
8446         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8447         (Arm_relobj::~Arm_relobj): Delete object pointed by
8448         attributes_section_data_.
8449         (Arm_relobj::attributes_section_data): New method definition.
8450         (Arm_relobj::attributes_section_data_): New data member declaration.
8451         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8452         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8453         attributes_section_data_.
8454         (Arm_dynobj::attributes_section_data): New method definition.
8455         (Arm_dynobj::attributes_section_data_): New data member declaration.
8456         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8457         initialization value of may_use_blx_ to false.
8458         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8459         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8460         object attributes to compute results instead of hard-coding.
8461         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8462         Target_arm::get_secondary_compatible_arch,
8463         Target_arm::set_secondary_compatible_arch
8464         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8465         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8466         New method declarations.
8467         (Target_arm::get_aeabi_object_attribute): New method definition.
8468         (Target_arm::attributes_section_data_): New data member declaration.
8469         (read_arm_attributes_section): New template definition.
8470         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8471         (Arm_dynobj::do_read_symbols): Ditto.
8472         (Target_arm::do_finalize_sections): Merge attributes sections from
8473         input.  Check for BLX use after attributes section merging.
8474         Fix __exidx_start and __exidx_end visibility.  Create an
8475         .ARM.attributes section if necessary.
8476         (Target_arm::get_secondary_compatible_arch,
8477         Target_arm::set_secondary_compatible_arch,
8478         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8479         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8480         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8481         New method definitions.
8482
8483 2009-12-09  Ian Lance Taylor  <iant@google.com>
8484
8485         * plugin.cc (Plugin::load): Don't cast from void* to a function
8486         pointer.
8487
8488 2009-12-09  Ian Lance Taylor  <iant@google.com>
8489
8490         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8491         information fields.
8492
8493 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8494
8495         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8496         Replace two_file_shared_1.so with two_file_shared_2.so.
8497         * testsuite/Makefile.in: Regenerated.
8498
8499 2009-12-08  Doug Kwan  <dougkwan@google.com>
8500
8501         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8502         (HFILES): Add attributes.h and int_encoding.h.
8503         * Makefile.in: Regenerate.
8504         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8505         function definitions to int_encoding.cc
8506         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8507         prototypes to int_encoding.h
8508         * reduced_debug_output.cc (int_encoding.h): New include.
8509         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8510         function definitions to int_encoding.cc
8511         (insert_into_vector, read_from_pointer): Move template definitions to
8512         int_encoding.h
8513         * attributes.cc: New file.
8514         * attributes.h: New file.
8515         * int_encoding.cc: New file.
8516         * int_encoding.h: New file.
8517
8518 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8519
8520         PR gold/11055
8521         * incremental-dump.cc (dump_incremental_inputs): New.
8522         (main): Use dump_incremental_inputs.
8523
8524 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8525
8526         PR gold/10893
8527         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8528         checking elfcpp::STT_FUNC.
8529         (Target_i386::Relocate::relocate): Likewise.
8530         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8531
8532         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8533         symbols from shared libraries into normal FUNC symbols.
8534
8535         * symtab.h (Symbol): Add is_func and use it.
8536
8537 2009-12-05  Doug Kwan  <dougkwan@google.com>
8538
8539         * arm.cc (Target_arm::arm_info): Initialize new fields
8540         attributes_section and attributes_vendor.
8541         * i386.cc (Target_i386::i386_info): Same.
8542         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8543         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8544         fields attributes_section and attributes_vendor.
8545         * sparc.cc (Target_sparc::sparc_info): Same.
8546         * target.h (Target::attributes_section, Target::attributes_vendor,
8547         Target::is_attributes_section, Target::attribute_arg_type,
8548         Target::attributes_order): New method definitions.
8549         (Target::Target_info::attributes_section,
8550         Target::Target_info::attributes_vendor): New fields.
8551         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8552         virtual method definitions.
8553         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8554         attributes_section and attributes_vendor.
8555         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8556
8557 2009-12-05  Doug Kwan  <dougkwan@google.com>
8558
8559         * arm.cc: Update comments about interworking and stub generation.
8560         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8561         considered as non-PIC.
8562         (Arm_relocate_functions::base_abs): Fix formatting.
8563         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8564         of function to use GOT entry address instead of offset.
8565         (Target_arm::Scan::global): Issue an error if a symbol would need a
8566         PLT does not get one because it is untyped.  Remove code to create
8567         dynamic symbols for relative branches.
8568         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8569         takes unsigned integer instead of boolean.
8570
8571 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8572
8573         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8574         (two_file_test_LDADD): Likewise.
8575         (common_test_1_LDADD): Likewise.
8576         (exception_test_LDADD) Likewise.
8577         (weak_test_LDADD): Likewise.
8578         (many_sections_test_LDADD): Likewise.
8579         (initpri1_LDADD): Likewise.
8580         (script_test_1_LDADD): Likewise.
8581         (script_test_2_LDADD): Likewise.
8582         (justsyms_LDADD): Likewise.
8583         (binary_test_LDADD): Likewise.
8584         (large_LDADD): Likewise.
8585         * testsuite/Makefile.in: Regenerated.
8586
8587 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8588
8589         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8590         (Symbol_table::override_with_special): Likewise.
8591         (Symbol_table::add_from_object): Likewise.
8592
8593 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8594
8595         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8596         Don't set the data_offset twice.
8597
8598 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8599
8600         * testsuite/Makefile.in: Regenerate.
8601
8602 2009-12-03  Doug Kwan  <dougkwan@google.com>
8603
8604         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8605         (Target_arm::do_finalize_sections): Add parameter for symbol table
8606         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8607         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8608         parameter for symbol table pointer.
8609         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8610         an additional parameter for a pointer to symbol table.
8611         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8612         parameter for a symbol table pointer.
8613         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8614         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8615         Ditto.
8616         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8617         parameter for a symbol table pointer.
8618
8619 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8620
8621         * incremental.cc (Incremental_inputs_header)
8622         (Incremental_inputs_header_write, Incremental_inputs_entry)
8623         (Incremental_inputs_entry_write): Move ...
8624         * incremental.h (Incremental_inputs_header)
8625         (Incremental_inputs_header_write, Incremental_inputs_entry)
8626         (Incremental_inputs_entry_write): here.
8627
8628 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8629
8630         * incremental.cc (make_sized_incremental_binary): Set the target.
8631         Error if it is incompatible.
8632         * output.h (Output_file): Add filename method.
8633
8634 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8635
8636         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8637         from the get_* methods.
8638
8639 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8640
8641         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8642         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8643         Write 0 for the data_offset of scripts.
8644
8645 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8646
8647         * testsuite/Makefile.am: Add the incremental_test.sh test.
8648         * testsuite/incremental_test.sh: New.
8649         * testsuite/incremental_test_1.c: New.
8650         * testsuite/incremental_test_2.c: New.
8651
8652 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8653
8654         * incremental-dump.cc (main): Fix typos.
8655
8656 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8657
8658         PR gold/11025
8659         * incremental-dump.cc (main): Use llu to print 64 bit values.
8660
8661 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8662             H.J. Lu  <hongjiu.lu@intel.com>
8663
8664         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8665         $(LIBDL).
8666         (incremental_dump_LDADD): Likewise.
8667         * Makefile.in: Regenerated.
8668
8669 2009-11-25  Doug Kwan  <dougkwan@google.com>
8670
8671         Revert:
8672
8673         2009-11-25  Doug Kwan  <dougkwan@google.com>
8674
8675                 * arm.cc (Target_arm::Target_arm): Move method definition
8676                 outside of class definition.  Add code to handle
8677                 --target1-rel, --target1-abs and --target2= options.
8678                 (Target_arm::get_reloc_reloc_type): Change method to be
8679                 non-static and const.
8680                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8681                 New data member declaration.
8682                 (Target_arm::Scan::local, Target_arm::Scan::global,
8683                 Target_arm::Relocate::relocate,
8684                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8685                 Adjust call to Target_arm::get_real_reloc_type.
8686                 (Target_arm::get_real_reloc_type): Use command line options
8687                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8688                 * options.h (--target1-rel, --target1-abs, --target2): New
8689                 ARM-only options.
8690
8691 2009-11-25  Doug Kwan  <dougkwan@google.com>
8692
8693         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8694         class definition.  Add code to handle --target1-rel, --target1-abs
8695         and --target2= options.
8696         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8697         and const.
8698         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8699         member declaration.
8700         (Target_arm::Scan::local, Target_arm::Scan::global,
8701         Target_arm::Relocate::relocate,
8702         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8703         call to Target_arm::get_real_reloc_type.
8704         (Target_arm::get_real_reloc_type): Use command line options to
8705         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8706         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8707         options.
8708
8709 2009-11-25  Doug Kwan  <dougkwan@google.com>
8710
8711         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8712         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8713         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8714         formatting.
8715         (Arm_relocate_functions::thm_call): Replace body with a call to
8716         Arm_relocate_functions::thumb_branch_common.
8717         (Arm_relocate_functions::thm_jump24,
8718         Arm_relocate_functions::thm_xpc22): New method definitions.
8719         (Arm_relocate_functions::thumb_branch_common): New method definition.
8720         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8721         operator.
8722         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8723         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8724
8725 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8726
8727         * Makefile.am: Build incremental-dump
8728         * Makefile.in: Regenerate.
8729         * incremental-dump.cc: New.
8730         * incremental.cc (Incremental_inputs_header_data,
8731         Incremental_inputs_entry_data): Move to incremental.h
8732         * incremental.h: (Incremental_inputs_header_data,
8733         Incremental_inputs_entry_data): Move from incremental.cc
8734
8735 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8736
8737         * incremental.cc (Incremental_inputs_header,
8738         Incremental_inputs_header_write, Incremental_inputs_entry,
8739         Incremental_inputs_entry_write): Add a typedef with the data type.
8740
8741 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8742
8743         * incremental.cc (Incremental_inputs_header,
8744         Incremental_inputs_header_write, Incremental_inputs_entry,
8745         Incremental_inputs_entry_write): Update comment about which
8746         type has the filed descriptions.
8747
8748 2009-11-15  Doug Kwan  <dougkwan@google.com>
8749
8750         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8751         (Arm_relocate_functions::arm_branch_common): Change method defintion
8752         in class definition to a method declaration and update list of formal
8753         parameters.
8754         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8755         Arm_relocation_functions::jump24): Adjust call to
8756         Arm_relocate_functions::arm_branch_common.  Update list of formal
8757         parameters.
8758         (Arm_relocate_functions::xpc25): New method definition.
8759         (Arm_relocate_functions::arm_branch_common): Move method defintion
8760         out from class definition.  Use stubs for mode-switching and extending
8761         branch ranges.
8762         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8763         specially.  Change code to enable use of stubs in ARM branches.
8764
8765 2009-11-10  Doug Kwan  <dougkwan@google.com>
8766
8767         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8768         in method declaration.
8769         (Target_arm::relocate_stub): New method declaration.
8770         (Target_arm::default_target): Change to return a pointer instead of
8771         a const reference.
8772         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8773         Target_arm::default_target.
8774         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8775         method definition.
8776         (Target_arm::relocate_section): Adjust view.
8777         (Target_arm::relocate_stub): New method definition.
8778
8779 2009-11-10  Doug Kwan  <dougkwan@google.com>
8780
8781         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8782         a format warning.
8783         * incremental.cc (open_incremental_binary): Initialized local
8784         variables to avoid warnings.
8785         * object.cc (make_elf_object): Ditto.
8786         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8787         a format warning.
8788
8789 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8790
8791         PR gold/10930
8792         * testsuite/plugin_test.c: Include "config.h".
8793
8794 2009-11-09  Doug Kwan  <dougkwan@google.com>
8795
8796         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8797         (arm_symbol_value): Remove.
8798         (Arm_relocate_functions::arm_branch_common,
8799         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8800         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8801         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8802         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8803         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8804         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8805         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8806         Arm_relocate_functions::thm_mobw_abs_nc,
8807         Arm_relocate_functions::thm_mov_abs,
8808         Arm_relocate_functions::movw_prel_nc,
8809         Arm_relocate_functions::thm_movt_abs,
8810         Arm_relocate_functions::movt_prel,
8811         Arm_relocate_functions::thm_movw_prel_nc,
8812         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8813         (Target_arm::Relocate::relocate): Only decompose address into two
8814         parts if relocation type uses the thumb-bit and pass the actual
8815         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8816         calls to methods in Arm_relocate_functions for this change.
8817
8818 2009-11-08  Ian Lance Taylor  <iant@google.com>
8819
8820         PR 10925
8821         * reloc.cc: Instantiate
8822         Sized_relobj::initialize_input_to_output_maps and
8823         Sized_relobj:free_input_to_output_maps.
8824
8825 2009-11-06  Ian Lance Taylor  <iant@google.com>
8826
8827         PR 10876
8828         * defstd.cc (in_segment): Set only_if_ref true for "end".
8829
8830 2009-11-06  Doug Kwan  <dougkwan@google.com>
8831
8832         * arm.cc (class Reloc_stub): Correct a comment.
8833         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8834         (Target_arm::scan_section_for_stubs): New method declaration.
8835         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8836         Change methods from private to protected.
8837         (Target_arm::do_may_relax): New method definition.
8838         (Target_arm::do_relax, Target_arm::group_sections,
8839         Target_arm::scan_reloc_for_stub,
8840         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8841         (Target_arm::arm_input_section_map_): New data member declaration.
8842         (Target_arm::scan_reloc_for_stub,
8843         Target_arm::scan_reloc_section_for_stubs,
8844         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8845         Target_arm::do_relax): New method definitions.
8846
8847 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8848
8849         * configure.ac: Check for (struct stat)::st_mtim
8850         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8851         * config.in: Regenerate.
8852         * configure: Regenerate.
8853
8854 2009-11-05  Ian Lance Taylor  <iant@google.com>
8855
8856         PR 10910
8857         * output.cc (Output_segment::add_output_section): Add missing
8858         return statement.
8859
8860 2009-11-04  Ian Lance Taylor  <iant@google.com>
8861
8862         PR 10880
8863         * object.h (class Object): Add is_needed and set_is_needed
8864         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8865         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8866         defined in a dynamic object and referenced by a regular object,
8867         set is_needed for the dynamic object.
8868         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8869         if the file is marked with as_needed and it is not needed.
8870
8871 2009-11-04  Ian Lance Taylor  <iant@google.com>
8872
8873         PR 10887
8874         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8875         tags if data is discarded by linker script.
8876         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8877         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8878         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8879         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8880
8881 2009-11-04  Ian Lance Taylor  <iant@google.com>
8882
8883         * layout.cc (Layout::get_output_section): Add is_interp and
8884         is_dynamic_linker_section parameters.  Change all callers.
8885         (Layout::choose_output_section): Likewise.
8886         (Layout::make_output_section): Likewise.
8887         (Layout::add_output_section_data): Add is_dynamic_linker_section
8888         parameter.  Change all callers.
8889         * layout.h (class Layout): Update declarations.
8890         * output.h (class Output_section): Add is_interp, set_is_interp,
8891         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8892         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8893         generate_code_fills_at_write_ to a bitfield.
8894         * output.cc (Output_section::Output_sections): Initialize new
8895         fields.
8896         (Output_segment::add_output_section): Add do_sort parameter.
8897         Change all callers.
8898
8899 2009-11-03  Ian Lance Taylor  <iant@google.com>
8900
8901         PR 10860
8902         * options.h (class General_options): Add --warn-common.
8903         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8904         merging two common symbols.
8905         (Symbol_table::should_override): Handle --warn-common when merging
8906         a common symbol with a defined symbol.  Use report_resolve_problem
8907         for multiple definitions.
8908         (Symbol_table::report_resolve_problem): New function.
8909         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8910
8911 2009-11-03  Doug Kwan  <dougkwan@google.com>
8912
8913         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8914         stub_factory_.
8915         (Target_arm::stub_factory): New method definition.
8916         (Target_arm::new_arm_input_section,
8917         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8918         Target_arm::reloc_uses_thumb_bit): New method declarations.
8919         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8920         New type definitions.
8921         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8922         member declarations.
8923         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8924         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8925         New method definitions.
8926
8927 2009-11-03  Ian Lance Taylor  <iant@google.com>
8928
8929         * options.h (class General_options): Add --warn_constructors.
8930
8931 2009-11-03  Ian Lance Taylor  <iant@google.com>
8932
8933         PR 10893
8934         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8935         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8936
8937 2009-11-03  Ian Lance Taylor  <iant@google.com>
8938
8939         PR 10895
8940         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8941         --msgid-bugs-address.
8942         (install-pdf): New target.
8943         (install-data_yes): Look up one directory to find mkinstalldirs.
8944
8945 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8946
8947         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8948         tree.
8949
8950 2009-10-30  Doug Kwan  <dougkwan@google.com>
8951
8952         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8953
8954 2009-10-30  Doug Kwan  <dougkwan@google.com>
8955
8956         * arm.cc (Stub_addend_reader): New struct template definition
8957         and partial specializations.
8958         (Stub_addend_reader::operator()): New method definition for a
8959         partially specialized template.
8960
8961 2009-10-30  Doug Kwan  <dougkwan@google.com>
8962
8963         * arm.cc (Arm_relobj::processor_specific_flags): New method
8964         definition.
8965         (Arm_relobj::do_read_symbols): New method declaration.
8966         (Arm_relobj::processor_specific_flags_): New data member declaration.
8967         (Arm_dynobj): New class definition.
8968         (Target_arm::do_finalize_sections): Add input_objects parameter.
8969         (Target_arm::do_adjust_elf_header): New method declaration.
8970         (Target_arm::are_eabi_versions_compatible,
8971         (Target_arm::merge_processor_specific_flags): New method declaration.
8972         (Target_arm::do_make_elf_object): New overloaded method definitions
8973         and declaration.
8974         (Arm_relobj::do_read_symbols): New method definition.
8975         (Arm_dynobj::do_read_symbols): Ditto.
8976         (Target_arm::do_finalize_sections): Add input_objects parameters.
8977         Merge processor-specific flags from all input objects.
8978         (Target_arm::are_eabi_versions_compatible,
8979         Target_arm::merge_processor_specific_flags,
8980         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8981         New method definitions.
8982         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8983         Input_objects pointer type parameter.
8984         * layout.cc (Layout::finalize): Pass input objects to target's.
8985         finalize_sections function.
8986         * output.cc (Output_file_header::do_sized_write): Set ELF file
8987         header's processor-specific flags.
8988         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8989         Input_objects pointer type parameter.
8990         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8991         * target.h (Input_objects): New forward class declaration.
8992         (Target::processor_specific_flags,
8993         Target::are_processor_specific_flags_sect): New method definitions.
8994         (Target::finalize_sections): Add input_objects parameter.
8995         (Target::Target): Initialize processor_specific_flags_ and
8996         are_processor_specific_flags_set_.
8997         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8998         parameter.
8999         (Target::set_processor_specific_flags): New method definition.
9000         (Target::processor_specific_flags_,
9001         Target::are_processor_specific_flags_set_): New data member
9002         declarations.
9003         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9004         Input_objects pointer type parameter.
9005
9006 2009-10-30  Doug Kwan  <dougkwan@google.com>
9007
9008         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9009
9010 2009-10-28  Ian Lance Taylor  <iant@google.com>
9011
9012         * object.h (class Relobj): Drop options parameter from
9013         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9014         do_scan_relocs, do_relocate.  Change all callers.
9015         (class Sized_relobj): Drop options parameters from
9016         do_gc_process_relocs, do_scan_relocs, do_relocate,
9017         do_relocate_sections, relocate_sections, emit_relocs_scan,
9018         emit_relocs_scan_reltype.  Change all callers.
9019         (struct Relocate_info): Remove options field and all references to
9020         it.
9021         * reloc.h (class Read_relocs): Remove options constructor
9022         parameter and options_ field.  Change all callers.
9023         (class Gc_process_relocs, class Scan_relocs): Likewise.
9024         (class Relocate_task): Likewise.
9025         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9026         all callers.
9027         (scan_relocatable_relocs): Likewise.
9028         * target.h (class Sized_target): Remove options parameter from
9029         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9030         all callers.
9031         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9032         callers.
9033         * arm.cc: Update functions to remove options parameters.
9034         * i386.cc: Likewise.
9035         * powerpc.cc: Likewise.
9036         * sparc.cc: Likewise.
9037         * x86_64.cc: Likewise.
9038         * testsuite/testfile.cc: Likewise.
9039
9040 2009-10-28  Doug Kwan  <dougkwan@google.com>
9041
9042         * arm.cc (Arm_relobj): New class definition.
9043         (Arm_relobj::scan_sections_for_stubs,
9044         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9045         New method definitions.
9046
9047 2009-10-28  Cary Coutant  <ccoutant@google.com>
9048
9049         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9050         (Plugin::cleanup_done_): New member.
9051         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9052         (Plugin_manager::cleanup_done_): Remove.
9053         (Plugin_manager::add_input_file): Edit error message.
9054         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9055         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9056
9057 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9058
9059         * fileread.cc: (File_read::View::~View): Use the new
9060         data_ownership_ filed.
9061         (File_read::~File_read): Dispose the new whole_file_view_.
9062         (File_read::open): Mmap the whole file if needed.
9063         (File_read::open): Use whole_file_view_ instead of contents_.
9064         (File_read::find_view): Use whole_file_view_ if applicable.
9065         (File_read::do_read): Use whole_file_view_ instead of contents_.
9066         (File_read::make_view): Use whole_file_view_ instead of contents_,
9067         update File_read::View::View call.
9068         (File_read::find_or_make_view): Update File_read::View::View
9069         call.
9070         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9071         remove contents_
9072         (File_read::View::Data_ownership): New enum.
9073         (File_read::View::View): Replace bool mapped_ with Data_ownership
9074         argument.
9075         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9076         (File_read::View::data_ownership_): New field.
9077         (File_read::contents_): Remove (replaced by whole_file_view_).
9078         (File_read::whole_file_view_): New field.
9079         * options.h (class General_options): Add --keep-files-mapped.
9080
9081 2009-10-27  Cary Coutant  <ccoutant@google.com>
9082
9083         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9084         * testsuite/Makefile.am (plugin_test_5): New test case.
9085         * testsuite/Makefile.in: Regenerate.
9086
9087 2009-10-25  Doug Kwan  <dougkwan@google.com>
9088
9089         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9090         from private to protected to allow access by child class.
9091         (Sized_relobj::do_relocate_sections): New method declaration.
9092         (Sized_relobj::relocate_sections): Virtualize.
9093         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9094         Sized_relobj::relocate_sections.  Instantiate template explicitly
9095         for different target sizes and endianity.
9096
9097 2009-10-24  Doug Kwan  <dougkwan@google.com>
9098
9099         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9100         (Arm_input_section::as_arm_input_section): New method.
9101         (Arm_output_section): New class definition.
9102         (Arm_output_section::create_stub_group,
9103         Arm_output_section::group_sections): New method definitions.
9104
9105 2009-10-22  Doug Kwan  <dougkwan@google.com>
9106
9107         * arm.cc (Arm_input_section): New class definition.
9108         (Arm_input_section::init, Arm_input_section:do_write,
9109         Arm_input_section::set_final_data_size,
9110         Arm_input_section::do_reset_address_and_file_offset): New method
9111         definitions.
9112
9113 2009-10-21  Doug Kwan  <dougkwan@google.com>
9114
9115         * arm.cc (Stub_table, Arm_input_section): New forward class
9116         declarations.
9117         (Stub_table): New class defintion.
9118         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9119         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9120         New method definition.
9121
9122 2009-10-21  Doug Kwan  <dougkwan@google.com>
9123
9124         * arm.cc: Update copyright comments.
9125         (Target_arm): New forward class template declaration.
9126         (Arm_address): New type.
9127         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9128         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9129         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9130         constants.
9131         (Insn_template): Same.
9132         (DEF_STUBS): New macro.
9133         (Stub_type): New enum type.
9134         (Stub_template): New class definition.
9135         (Stub): Same.
9136         (Reloc_stub): Same.
9137         (Stub_factory): Same.
9138         (Target_arm::Target_arm): Initialize may_use_blx_ and
9139         should_force_pic_veneer_.
9140         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9141         Target_arm::should_force_pic_veneer,
9142         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9143         Target_arm::using_thumb_only, Target_arm:;default_target): New
9144         method defintions.
9145         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9146         New data member declarations.
9147         (Insn_template::size, Insn_template::alignment): New method defintions.
9148         (Stub_template::Stub_template): New method definition.
9149         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9150         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9151         (Stub_factory::Stub_factory): New method definition.
9152         * gold.h (string_hash): New template.
9153         * output.h (Input_section_specifier::hash_value): Use
9154         gold::string_hash.
9155         (Input_section_specifier::string_hash): Remove.
9156         * stringpool.cc (Stringpool_template::string_hash): Use
9157         gold::string_hash.
9158
9159 2009-10-20  Doug Kwan  <dougkwan@google.com>
9160
9161         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9162         symbols of relaxed input sections.
9163         * output.h (Output_section::find_relaxed_input_section): Make
9164         method public.
9165
9166 2009-10-16  Doug Kwan  <dougkwan@google.com>
9167
9168         * dynobj.cc (Versions::Versions): Initialize version_script_.
9169         Only insert base version symbol definition for a shared object
9170         if version script defines any version versions.
9171         (Versions::define_base_version): New method definition.
9172         (Versions::add_def): Check that base version is not needed.
9173         (Versions::add_need): Define base version lazily.
9174         * dynobj.h (Versions::define_base_version): New method declaration.
9175         (Versions::needs_base_version_): New data member declaration.
9176         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9177         (check_DATA): Add no_version_test.stdout.
9178         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9179         New make rules.
9180         * testsuite/Makefile.in: Regenerate.
9181         * testsuite/no_version_test.c: New file.
9182         * testsuite/no_version_test.sh: Ditto.
9183
9184 2009-10-16  Doug Kwan  <dougkwan@google.com>
9185
9186         * expression.cc (class Segment_start_expression): New class definition.
9187         (Segment_start_expression::value): New method definition.
9188         (script_exp_function_segment_start): Return a new
9189         Segment_start_expression.
9190         * gold/script-c.h (script_saw_segment_start_expression): New function
9191         prototype.
9192         * script-sections.cc (Script_sections::Script_sections): Initialize
9193         SAW_SEGMENT_START_EXPRESSION_ to false.
9194         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9195         and -Tbbs options to specify section addresses if given in
9196         command line and no SEGMENT_START expression is seen in a script.
9197         * script-sections.h (Script_sections::saw_segment_start_expression,
9198         Script_sections::set_saw_segment_start_expression): New method
9199         definition.
9200         (Script_sections::saw_segment_start_expression_): New data member
9201         declaration.
9202         * script.cc (script_saw_segment_start_expression): New function.
9203         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9204         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9205         script_test_7.sh and script_test_8.sh.
9206         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9207         script_test_8.stdout.
9208         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9209         (script_test_6, script_test_6.stdout, script_test_7,
9210         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9211         * Makefile.in: Regenerate.
9212         * testsuite/script_test_6.sh: New file.
9213         * testsuite/script_test_6.t: Same.
9214         * testsuite/script_test_7.sh: Same.
9215         * testsuite/script_test_7.t: Same.
9216         * testsuite/script_test_8.sh: Same.
9217
9218 2009-10-16  Doug Kwan  <dougkwan@google.com>
9219
9220         * output.cc (Output_segment::set_section_list_address): Cast
9221         expressions to unsigned long long type to avoid format warnings.
9222
9223 2009-10-15  Ian Lance Taylor  <iant@google.com>
9224
9225         * script.cc (Script_options::add_symbol_assignment): Always add a
9226         dot assignment to script_sections_.
9227         * script-sections.cc (Script_sections::add_dot_assignment):
9228         Initialize if necessary.
9229
9230         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9231         program headers with no load segment if there is a linker script.
9232
9233         * layout.cc (Layout::set_segment_offsets): Align the file offset
9234         to the segment aligment for -N or -n with no load segment.
9235         * output.cc (Output_segment::add_output_section): Don't crash if
9236         the first section is a TLS section.
9237         (Output_segment::set_section_list_addresses): Print an error
9238         message if the address moves backward in a linker script.
9239         * script-sections.cc
9240         (Output_section_element_input::set_section_addresses): Don't
9241         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9242         (Orphan_output_section::set_section_addresses): Likewise.
9243
9244 2009-10-15  Doug Kwan  <dougkwan@google.com>
9245
9246         * layout.cc (Layout::finish_dynamic_section): Generate tags
9247         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9248         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9249         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9250
9251 2009-10-14  Ian Lance Taylor  <iant@google.com>
9252
9253         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9254         fields.
9255         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9256         data_shdr fields of relinfo.
9257         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9258         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9259         R_386_TLS_LDO_32, adjust based on section flags.
9260         (Target_i386::Relocate::fix_up_ldo): Remove.
9261
9262 2009-10-13  Ian Lance Taylor  <iant@google.com>
9263
9264         Add support for -pie.
9265         * options.h (class General_options): Add -pie and
9266         --pic-executable.
9267         (General_options::output_is_position_independent): Test -pie.
9268         (General_options::output_is_executable): Return true if not shared
9269         and not relocatable.
9270         (General_options::output_is_pie): Remove.
9271         * options.cc (General_options::finalize): Reject incompatible uses
9272         of -pie.
9273         * gold.cc (queue_middle_tasks): A -pie link is not static.
9274         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9275         * symtab.cc (Symbol::final_value_is_known): Return false if
9276         output_is_position_independent.
9277         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9278         output_is_position_independent.
9279         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9280         output_is_position_independent.
9281         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9282         output_is_position_independent.
9283         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9284         two_file_pie_test.
9285         (basic_pie_test.o, basic_pie_test): New targets.
9286         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9287         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9288         (two_file_pie_test): New target.
9289         * testsuite/Makefile.in: Rebuild.
9290         * README: Remove note saying that -pie is not supported.
9291
9292 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9293
9294         * options.h (class General_options): Add -init and -fini.
9295         * layout.cc (Layout::finish_dynamic_section): Emit
9296         given init and fini functions.
9297
9298 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9299
9300         * gc.h (gc_process_relocs): Check if icf is enabled using new
9301         function.
9302         * gold.cc (queue_initial_tasks): Likewise.
9303         (queue_middle_tasks): Likewise.
9304         * object.cc (do_layout): Likewise.
9305         * symtab.cc (is_section_folded): Likewise.
9306         * main.cc (main): Likewise.
9307         * reloc.cc (Read_relocs::run): Likewise.
9308         (Sized_relobj::do_scan_relocs): Likewise.
9309         * icf.cc (is_function_ctor_or_dtor): New function.
9310         (Icf::find_identical_sections): Check if function is ctor or dtor when
9311         safe icf is chosen.
9312         * options.h (General_options::icf): Change option to be an enum.
9313         (Icf_status): New enum.
9314         (icf_enabled): New method.
9315         (icf_safe_folding): New method.
9316         (set_icf_status): New method.
9317         (icf_status_): New variable.
9318         * (options.cc) (General_options::finalize): Set icf_status_.
9319         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9320         icf_test and icf_keep_unique_test to use the --icf enum flag.
9321         * testsuite/icf_safe_test.sh: New file.
9322         * testsuite/icf_safe_test.cc: New file.
9323
9324 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9325
9326         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9327         includes to gc.h and icf.h.
9328         * arm.cc: Include gc.h.
9329         * gold.cc: Likewise.
9330         * i386.cc: Likewise.
9331         * powerpc.cc: Likewise.
9332         * sparc.cc: Likewise.
9333         * x86_64.cc: Likewise.
9334         * gc.h: Include icf.h.
9335
9336 2009-10-11  Ian Lance Taylor  <iant@google.com>
9337
9338         * plugin.cc: Include "gold.h" before other header files.
9339
9340 2009-10-10  Chris Demetriou  <cgd@google.com>
9341
9342         * options.h (Input_file_argument::Input_file_type): New enum.
9343         (Input_file_argument::is_lib_): Replace with...
9344         (Input_file_argument::type_): New member.
9345         (Input_file_argument::Input_file_argument): Take Input_file_type
9346         'type' rather than boolean 'is_lib' as second argument.
9347         (Input_file_argument::is_lib): Use type_.
9348         (Input_file_argument::is_searched_file): New function.
9349         (Input_file_argument::may_need_search): Handle is_searched_file.
9350         * options.cc (General_options::parse_library): Support -l:filename.
9351         (General_options::parse_just_symbols): Update for Input_file_argument
9352         changes.
9353         (Command_line::process): Likewise.
9354         * archive.cc (Archive::get_file_and_offset): Likewise.
9355         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9356         * script.cc (read_script_file, script_add_file): Likewise.
9357         * fileread.cc (Input_file::Input_file): Likewise.
9358         (Input_file::will_search_for): Handle is_searched_file.
9359         (Input_file::open): Likewise.
9360         * readsyms.cc (Read_symbols::get_name): Likewise.
9361         * testsuite/Makefile.am (searched_file_test): New test.
9362         * testsuite/Makefile.in: Regenerate.
9363         * testsuite/searched_file_test.cc: New file.
9364         * testsuite/searched_file_test_lib.cc: New file.
9365
9366 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9367             Ian Lance Taylor  <iant@google.com>
9368
9369         * descriptor.cc: Include <cstdio> and "binary-io.h".
9370         (Descriptors::open): Open the files in binary mode always.
9371         * script.cc (Lex::get_token): Treat \r as whitespace.
9372
9373 2009-10-09  Ian Lance Taylor  <iant@google.com>
9374
9375         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9376
9377 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9378             Ian Lance Taylor  <iant@google.com>
9379
9380         * configure.ac: Check for readv function also.
9381         * fileread.cc (readv): Define if not HAVE_READV.
9382         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9383         does not exist.
9384         * config.in: Regenerate.
9385         * configure: Regenerate.
9386
9387 2009-10-09  Doug Kwan  <dougkwan@google.com>
9388
9389         * layout.cc (Layout::make_output_section): Call target hook to make
9390         ordinary output section.
9391         (Layout::finalize): Adjust parameter list of call the
9392         Target::may_relax().
9393         * layout.h (class Layout::section_list): New method.
9394         * merge.h (Output_merge_base::entsize): Change visibility to public.
9395         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9396         New methods.
9397         (Output_merge_string::do_is_string): New method.
9398         * object.cc (Sized_relobj::do_setup): renamed from
9399         Sized_relobj::set_up.
9400         * object.h (Sized_relobj::adjust_shndx,
9401         Sized_relobj::initializ_input_to_output_maps,
9402         Sized_relobj::free_input_to_output_maps): Change visibilities to
9403         protected.
9404         (Sized_relobj::setup): Virtualize.
9405         (Sized_relobj::do_setup): New method declaration.
9406         (Sized_relobj::invalidate_section_offset,
9407         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9408         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9409         * options.cc (parse_int): New function.
9410         * options.h (parse_int): New declaration.
9411         (DEFINE_int): New macro.
9412         (stub_group_size): New option.
9413         * output.cc (Output_section::Output_section): Initialize memebers
9414         merge_section_map_, merge_section_by_properties_map_,
9415         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9416         (Output_section::add_input_section): Handled deferred code-fill
9417         generation and remove an old comment.
9418         (Output_section::add_relaxed_input_section): New method definition.
9419         (Output_section::add_merge_input_section): Use merge section by
9420         properties map to speed to search.  Update merge section maps
9421         as appropriate.
9422         (Output_section::build_relaxation_map): New method definition.
9423         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9424         Same.
9425         (Output_section::relax_input_section): Renamed to
9426         Output_section::convert_input_sections_to_relaxed_sections and change
9427         interface to take a vector of pointers to relaxed sections.
9428         (Output_section::find_merge_section,
9429         Output_section::find_relaxed_input_section): New method definitions.
9430         (Output_section::is_input_address_mapped,
9431         Output_section::output_offset, Output_section::output_address):
9432         Use output section data maps to speed up searching.
9433         (Output_section::find_starting_output_address): Add comments.
9434         (Output_section::do_write,
9435         Output_section::write_to_postprocessing_buffer): Do code-fill
9436         generation as appropriate.
9437         (Output_section::get_input_sections): Invalidate relaxed input section
9438         map.
9439         (Output_section::restore_states): Adjust type of checkpoint .
9440         Invalidate relaxed input section map.
9441         * output.h (Output_merge_base): New class declaration.
9442         (Input_section_specifier): New class defintion.
9443         (class Output_relaxed_input_section) Change base class to
9444         Output_section_data_build.
9445         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9446         base class initializer.
9447         (Output_section::add_relaxed_input_section): New method declaration.
9448         (Output_section::Input_section): Change visibility to protected.
9449         (Output_section::Input_section::relobj,
9450         Output_section::Input_section::shndx): Handle relaxed input sections.
9451         Output_section::input_sections) Change visibility to protected.  Also
9452         define overload to return a non-const pointer.
9453         (Output_section::Merge_section_properties): New class defintion.
9454         (Output_section::Merge_section_by_properties_map,
9455         Output_section::Output_section_data_by_input_section_map,
9456         Output_section::Relaxation_map): New types.
9457         (Output_section::relax_input_section): Rename method to
9458         Output_section::convert_input_sections_to_relaxed_sections and change
9459         interface to take a vector of relaxed section pointers.
9460         (Output_section::find_merge_section,
9461         Output_section::find_relaxed_input_section,
9462         Output_section::build_relaxation_map,
9463         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9464         New method declarations.
9465         (Output_section::merge_section_map_
9466         Output_section::merge_section_by_properties_map_,
9467         Output_section::relaxed_input_section_map_,
9468         Output_section::is_relaxed_input_section_map_valid_,
9469         Output_section::generate_code_fills_at_write_): New data members.
9470         * script-sections.cc
9471         (Output_section_element_input::set_section_addresses): Call
9472         current_data_size and addralign methods of relaxed input sections.
9473         (Orphan_output_section::set_section_addresses): Call current_data_size
9474         and addralign methods of relaxed input sections.
9475         * symtab.cc (Symbol_table::compute_final_value): Extract template
9476         from the body of Symbol_table::sized_finalize_symbol.
9477         (Symbol_table::sized_finalized_symbol): Call
9478         Symbol_table::compute_final_value.
9479         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9480         (Symbol_table::compute_final_value): New templated method declaration.
9481         * target.cc (Target::do_make_output_section): New method defintion.
9482         * target.h (Target::make_output_section): New method declaration.
9483         (Target::relax): Add more parameters for input objects, symbol table
9484         and layout.  Adjust call to do_relax.
9485         (Target::do_make_output_section): New method declaration.
9486         (Target::do_relax): Add parameters for input objects, symbol table
9487         and layout.
9488
9489 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9490
9491         * pread.c: Include stdio.h.
9492
9493 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9494
9495         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9496         defined.
9497
9498 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9499
9500         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9501         Change read_shndx type to unsigned int.
9502         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9503         int.
9504         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9505         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9506         Change read_shndx type to unsigned int.
9507         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9508         int.
9509         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9510         * layout.cc (Layout::create_symtab_sections): Cast the result of
9511         local_symcount * symsize to off_t in the gold_assert.
9512
9513 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9514
9515         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9516         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9517         R_ARM_BASE_ABS.
9518         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9519         (Arm_relocate_functions::thm_abs5): New function.
9520         (Arm_relocate_functions::abs12): New function.
9521         (Arm_relocate_functions::abs16): New function.
9522         (Arm_relocate_functions::base_abs): New function.
9523         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9524         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9525         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9526         R_ARM_BASE_ABS.
9527         (Scan::global): Likewise.
9528         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9529         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9530         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9531         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9532         R_ARM_BASE_ABS.
9533
9534 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9535
9536         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9537         (Arm_relocate_functions::movt_prel): New function.
9538         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9539         (Arm_relocate_functions::thm_movt_prel): New function.
9540         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9541         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9542         (Scan::global, Relocate::relocate): Likewise.
9543         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9544
9545 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9546
9547         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9548         Incremental_checker.
9549         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9550         unsigned int.
9551         (class Incremental_inputs_header): New class.
9552         (Incremental_inputs_header_writer): Edit comment.
9553         (Incremental_inputs_entry): New class.
9554         (Incremental_inputs_entry_writer): Edit comment.
9555         (Sized_incremental_binary::do_find_incremental_inputs_section):
9556         Add *strtab_shndx parameter, fill it.
9557         (Sized_incremental_binary::do_check_inputs): New method.
9558         (Incremental_checker::can_incrementally_link_output_file): Use
9559         Sized_incremental_binary::check_inputs.
9560         (Incremental_inputs::report_command_line): Save command line in
9561         command_line_.
9562         * incremental.h:
9563         (Incremental_binary::find_incremental_inputs_section): New
9564         method.
9565         (Incremental_binary::do_find_incremental_inputs_section): Add
9566         strtab_shndx parameter.
9567         (Incremental_binary::do_check_inputs): New pure virtual method.
9568         (Sized_incremental_binary::do_check_inputs): Declare.
9569         (Incremental_checker::Incremental_checker): Add incremental_inputs
9570         parameter, use it to initialize incremental_inputs_.
9571         (Incremental_checker::incremental_inputs_): New field.
9572         (Incremental_checker::command_line): New method.
9573         (Incremental_checker::inputs): New method.
9574         (Incremental_checker::command_line_): New field.
9575
9576 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9577
9578         * incremental.cc: Include <cstdarg> and "target-select.h".
9579         (vexplain_no_incremental): New function.
9580         (explain_no_incremental): New function.
9581         (Incremental_binary::error): New method.
9582         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9583         method.
9584         (make_sized_incremental_binary): New function.
9585         (open_incremental_binary): New function.
9586         (can_incrementally_link_file): Add checks if output is ELF and has
9587         inputs section.
9588         * incremental.h: Include "elfcpp_file.h" and "output.h".
9589         (Incremental_binary): New class.
9590         (Sized_incremental_binary): New class.
9591         (open_incremental_binary): Declare.
9592         * object.cc (is_elf_object): Use
9593         elfcpp::Elf_recognizer::is_elf_file.
9594         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9595         * output.h (Output_file::filesize): New method.
9596
9597 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9598
9599         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9600         New function.
9601         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9602         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9603         function.
9604         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9605         function.
9606         (Arm_relocate_functions::movw_abs_nc): New function.
9607         (Arm_relocate_functions::movt_abs): New function.
9608         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9609         (Arm_relocate_functions::thm_movt_abs): New function.
9610         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9611         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9612         (Scan::global): Likewise.
9613         (Relocate::relocate): Likewise.
9614         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9615
9616 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9617
9618         * arm.cc (Arm_relocate_functions::got_prel) New function.
9619         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9620         (Relocate::relocate): Likewise.
9621         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9622
9623 2009-10-06  Ian Lance Taylor  <iant@google.com>
9624
9625         * options.h (class General_options): Define
9626         split_stack_adjust_size parameter.
9627         * object.h (class Object): Add uses_split_stack_ and
9628         has_no_split_stack_ fields.  Add uses_split_stack and
9629         has_no_split_stack accessor functions.  Declare
9630         handle_split_stack_section.
9631         (class Reloc_symbol_changes): Define.
9632         (class Sized_relobj): Define Function_offsets.  Declare
9633         split_stack_adjust, split_stack_adjust_reltype, and
9634         find_functions.
9635         * object.cc (Object::handle_split_stack_section): New function.
9636         (Sized_relobj::do_layout): Call handle_split_stack_section.
9637         * dynobj.cc (Sized_dynobj::do_layout): Call
9638         handle_split_stack_section.
9639         * reloc.cc (Sized_relobj::relocate_sections): Call
9640         split_stack_adjust for executable sections in split_stack
9641         objects.  Pass reloc_map to relocate_section.
9642         (Sized_relobj::split_stack_adjust): New function.
9643         (Sized_relobj::split_stack_adjust_reltype): New function.
9644         (Sized_relobj::find_functions): New function.
9645         * target-reloc.h: Include "object.h".
9646         (relocate_section): Add reloc_symbol_changes parameter.  Change
9647         all callers.
9648         * target.h (class Target): Add calls_non_split method.  Declare
9649         do_calls_non_split virtual method.  Declare match_view and
9650         set_view_to_nop.
9651         * target.cc: Include "elfcpp.h".
9652         (Target::do_calls_non_split): New function.
9653         (Target::match_view): New function.
9654         (Target::set_view_to_nop): New function.
9655         * gold.cc (queue_middle_tasks): Give an error if mixing
9656         split-stack and non-split-stack objects with -r.
9657         * i386.cc (Target_i386::relocate_section): Add
9658         reloc_symbol_changes parameter.
9659         (Target_i386::do_calls_non_split): New function.
9660         * x86_64.cc (Target_x86_64::relocate_section): Add
9661         reloc_symbol_changes parameter.
9662         (Target_x86_64::do_calls_non_split): New function.
9663         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9664         parameter.
9665         * powerpc.cc (Target_powerpc::relocate_section): Add
9666         reloc_symbol_changes parameter.
9667         * sparc.cc (Target_sparc::relocate_section): Add
9668         reloc_symbol_changes parameter.
9669         * configure.ac: Call AM_CONDITIONAL for the default target.
9670         * configure: Rebuild.
9671         * testsuite/Makefile.am (TEST_AS): New variable.
9672         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9673         (check_DATA): Add split_i386 and split_x86_64 files.
9674         (SPLIT_DEFSYMS): Define.
9675         (split_i386_[1234n].o): New targets.
9676         (split_i386_[124]): New targets.
9677         (split_i386_[1234r].stdout): New targets.
9678         (split_x86_64_[1234n].o): New targets.
9679         (split_x86_64_[124]): New targets.
9680         (split_x86_64_[1234r].stdout): New targets.
9681         (MOSTLYCLEANFILES): Add new executables.
9682         * testsuite/split_i386.sh: New file.
9683         * testsuite/split_x86_64.sh: New file.
9684         * testsuite/split_i386_1.s: New file.
9685         * testsuite/split_i386_2.s: New file.
9686         * testsuite/split_i386_3.s: New file.
9687         * testsuite/split_i386_4.s: New file.
9688         * testsuite/split_i386_n.s: New file.
9689         * testsuite/split_x86_64_1.s: New file.
9690         * testsuite/split_x86_64_2.s: New file.
9691         * testsuite/split_x86_64_3.s: New file.
9692         * testsuite/split_x86_64_4.s: New file.
9693         * testsuite/split_x86_64_n.s: New file.
9694         * testsuite/testfile.cc (Target_test): Update relocation_section
9695         function.
9696         * testsuite/Makefile.in: Rebuild.
9697
9698 2009-10-06  Ian Lance Taylor  <iant@google.com>
9699
9700         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9701         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9702         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9703         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9704         the address on ldo_addrs_.
9705         (Target_i386::Relocate::fix_up_ldo): New function.
9706
9707 2009-10-06   Rafael Espindola  <espindola@google.com>
9708
9709         * plugin.cc (add_input_library): New.
9710         (Plugin::load): Add add_input_library to tv.
9711         (Plugin_manager::add_input_file): Add the is_lib argument.
9712         (add_input_file): Update call to Plugin_manager::add_input_file.
9713         (add_input_library): New.
9714         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9715
9716 2009-09-30  Doug Kwan  <dougkwan@google.com>
9717
9718         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9719         symbol and call Symbol::may_need_copy_reloc to determine if
9720         a copy reloc is needed.
9721         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9722         nocopyreloc is given in command line.
9723         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9724         given in command line.
9725         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9726         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9727         of the removed Target_i386::may_need_copy_reloc.
9728         * options.h (copyreloc): New option with default value false.
9729         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9730         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9731         instead of the removed Target_powerpc::may_need_copy_reloc.
9732         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9733         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9734         instead of the removed Target_sparc::may_need_copy_reloc.
9735         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9736         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9737         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9738         instead of the removed Target_x86_64::may_need_copy_reloc.
9739
9740 2009-09-30  Ian Lance Taylor  <iant@google.com>
9741
9742         * object.h (class Object): Remove target_ field, and target,
9743         sized_target, and set_target methods.
9744         (Object::sized_target): Remove.
9745         (class Sized_relobj): Update declarations.  Remove sized_target.
9746         * object.cc (Sized_relobj::setup): Remove target parameter.
9747         Change all callers.
9748         (Input_objects::add_object): Don't do anything with the target.
9749         (make_elf_sized_object): Add punconfigured parameter.  Change all
9750         callers.  Set or test parameter target.
9751         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9752         Change all callers.
9753         * parameters.cc (Parameters::set_target): Change parameter type to
9754         be non-const.
9755         (Parameters::default_target): Remove.
9756         (set_parameters_target): Change parameter type to be non-const.
9757         (parameters_force_valid_target): New function.
9758         (parameters_clear_target): New function.
9759         * parameters.h (class Parameters): Update declarations.  Remove
9760         default_target method.  Add sized_target and clear_target
9761         methods.  Change target_ to be non-const.
9762         (set_parameters_target): Update declaration.
9763         (parameters_force_valid_target): Declare.
9764         (parameters_clear_target): Declare.
9765         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9766         as NULL if we aren't searching.
9767         (Add_symbols::run): Don't check for compatible target.
9768         * fileread.cc (Input_file::open_binary): Call
9769         parameters_force_valid_target.
9770         * gold.cc (queue_middle_tasks): Likewise.
9771         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9772         set_target on object.
9773         * dynobj.h (class Sized_dynobj): Update declarations.
9774         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9775         make_elf_object returns NULL.
9776         (Archive::include_member): Don't check whether object target is
9777         compatible.
9778         * output.cc (Output_section::add_input_section): Get target from
9779         parameters.
9780         (Output_section::relax_input_section): Likewise.
9781         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9782         parameters.
9783         (Sized_relobj::do_scan_relocs): Likewise.
9784         (Sized_relobj::relocate_sections): Likewise.
9785         * resolve.cc (Symbol_table::resolve): Likewise.
9786         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9787         parameter.  Change all callers.
9788         (Symbol_table::add_from_object): Get target from parameters.
9789         (Symbol_table::add_from_relobj): Don't check object target.
9790         (Symbol_table::add_from_dynobj): Likewise.
9791         (Symbol_table::define_special_symbol): Get target from
9792         parameters.
9793         * symtab.h (class Symbol_table): Update declaration.
9794         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9795         parameter.  Change all callers.  Clear parameter target.
9796         (Binary_test): Test target here.
9797         * testsuite/object_unittest.cc (gold_testsuite): Remove
9798         target_test_pointer parameter.  Change all callers.
9799         (Object_test): Test target here.
9800
9801 2009-09-26  Ian Lance Taylor  <iant@google.com>
9802
9803         * testsuite/initpri1.c: Don't try to use constructor priorities if
9804         compiling with gcc before 4.3.
9805
9806 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9807
9808         * testsuite/retain_symbols_file_test.sh (check_present): Change
9809         output file name to retain_symbols_file_test.stdout.
9810         (check_absent): Likewise.
9811
9812 2009-09-18  Craig Silverstein  <csilvers@google.com>
9813
9814         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9815         * options.cc: Include <cerrno> and <fstream>.
9816         (General_options::finalize): Parse -retain-symbols-file tag.
9817         * options.h: New flag.
9818         (General_options): New method should_retain_symbol, new
9819         variable symbols_to_retain.
9820         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9821         should_retain_symbol map.
9822         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9823         * testsuite/Makefile.in: Regenerate.
9824         * testsuite/retain_symbols_file_test.sh: New file.
9825
9826 2009-09-18  Nick Clifton  <nickc@redhat.com>
9827
9828         * po/es.po: Updated Spanish translation.
9829
9830 2009-09-17  Doug Kwan  <dougkwan@google.com>
9831
9832         * debug.h (DEBUG_RELAXATION): New constant.
9833         (DEBUG_ALL): Add DEBUG_RELAXATION.
9834         (debug_string_to_enum): Add relaxation debug option.
9835         * layout.cc
9836         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9837         Layout::Relaxation_debug_check::read_sections,
9838         Layout::Relaxation_debug_check::read_sections): New method definitions.
9839         (Layout::Layout): Initialize data members
9840         record_output_section_data_from_scrips_,
9841         script_output_section_data_list_ and relaxation_debug_check_.
9842         (Layout::save_segments, Layout::restore_segments,
9843         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9844         Layout::relaxation_loop_body): New method definitions.
9845         (Layout::finalize): Support relaxation.  Move section layout code to
9846         Layout::relaxation_loop_body.
9847         (Layout::set_asection_address_from_script): Move code for orphan
9848         section placement out.
9849         (Layout::place_orphan_sections_in_script): New method definition.
9850         * layout.h (Output_segment_headers, Output_file_header):
9851         New forward class declarations.
9852         (Layout::~Layout): Define.
9853         (Layout::new_output_section_data_from_script): New method definition.
9854         (Layout::place_orphan_sections_in_script): New method declaration.
9855         (Layout::Segment_states): New type declaration.
9856         (Layout::save_segments, Layout::restore_segments,
9857         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9858         Layout::relaxation_loop_body): New method declarations.
9859         (Layout::Output_section_data_list): New type declaration.
9860         (Layout::Relaxation_debug_check): New class definition.
9861         (Layout::record_output_section_data_from_script_,
9862         Layout::script_output_section_data_list_, Layout::segment_states_,
9863         Layout::relaxation_debug_check_): New data members.
9864         * output.cc: (Output_section_headers::do_size): New method definition.
9865         (Output_section_headers::Output_section_headers): Move size
9866         computation to Output_section_headers::do_size.
9867         (Output_segment_headers::do_size): New method definition.
9868         (Output_file_header::Output_file_header): Move size computation to
9869         Output_file_header::do_size and call it.
9870         (Output_file_header::do_size): New method definition.
9871         (Output_data_group::Output_data_group): Adjust call to
9872         Output_section_data.
9873         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9874         (Output_symtab_xindex::do_write): Add array bound check.
9875         (Output_section::Input_section::print_to_mapfile): Handle
9876         RELAXED_INPUT_SECTION_CODE.
9877         (Output_section::Output_section): Initialize data member checkpoint_.
9878         (Output_section::~Output_section): Delete checkpoint object pointed
9879         by checkpoint_.
9880         (Output_section::add_input_section): Always add an Input_section if
9881         relaxing.
9882         (Output_section::add_merge_input_section): Add assert.
9883         (Output_section::relax_input_section): New method definition.
9884         (Output_section::set_final_data_size): Set load address to zero for
9885         an unallocated section.
9886         (Output_section::do_address_and_file_offset_have_reset_values):
9887         New method definition.
9888         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9889         Handle relaxed input section.
9890         (Output_section::sort_attached_input_sections): Checkpoint input
9891         section list lazily.
9892         (Output_section::get_input_sections): Change type of input_sections to
9893         list of Simple_input_section pointers.  Checkpoint input section list
9894         lazily.  Also handle relaxed input sections.
9895         (Output_section::add_input_section_for_script): Take a reference to
9896         a Simple_input_section object instead of Relobj pointer and section
9897         index as parameter.  Handle relaxed input sections.
9898         (Output_section::save_states, Output_section::restore_states): New
9899         method definitions.
9900         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9901         (Output_data::is_data_size_fixed): New method definition.
9902         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9903         if it is fixed.
9904         (Output_data::address_and_file_offset_have_reset_values): New method
9905         definition.
9906         (Output_data::do_address_and_file_offset_have_reset_values): New method
9907         definition.
9908         (Output_data::set_data_size): Check that data size is not fixed.
9909         (Output_data::fix_data_size): New method definition.
9910         (Output_data::is_data_size_fixed_): New data member.
9911         (Output_section_headers::set_final_data_size): New method definition.
9912         (Output_section_headers::do_size): New method declaration.
9913         (Output_segment_headers::set_final_data_size): New method definition.
9914         (Output_segment_headers::do_size): New method declaration.
9915         (Output_file_header::set_final_data_size)::New method definition.
9916         (Output_file_header::do_size)::New method declaration.
9917         (Output_section_data::Output_section_data): Add new parameter
9918         is_data_size_fixed and use it to fix data size.
9919         (Output_data_const::Output_data_const): Adjust call to base class
9920         constructor and fix data size.
9921         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9922         base class constructor and fix data size.
9923         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9924         base class constructor and fix data size.
9925         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9926         class constructor and fix data size.
9927         (Output_data_group::set_final_data_size): New method definition.
9928         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9929         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9930         class constructor and fix data size.
9931         (Output_relaxed_input_section): New class definition.
9932         (Output_section::Simple_input_section): New class definition.
9933         (Output_section::get_input_sections): Adjust parameter list.
9934         (Output_section::add_input_section_for_script): Same.
9935         (Output_section::save_states, Output_section::restore_states,
9936         Output_section::do_address_and_file_offset_have_reset_values,
9937         (Output_section::Input_section::Input_section): Handle
9938         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9939         Output_relaxed_input_section.
9940         (Output_section::Input_section::is_input_section,
9941         Output_section::Input_section::set_output_section): Handle relaxed
9942         input section.
9943         (Output_section::Input_section::is_relaxed_input_section,
9944         Output_section::Input_section::output_section_data,
9945         Output_section::Input_section::relaxed_input_section): New method
9946         definitions.
9947         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9948         value.
9949         (Output_section::Input_section::u1_): Update comments.
9950         (Output_section::Input_section::u2_): Add new union member poris.
9951         (Output_section::Checkpoint_output_section): New classs definition.
9952         (Output_section::relax_input_section): New method declaration.
9953         (Output_section::checkpoint_): New data member.
9954         (Output_segment): Update comments.
9955         (Output_segment::Output_segment): Un-privatize copy constructor.
9956         (Output_segment::operator=): Un-privatize.
9957         * script-sections.cc (Output_section_element::Input_section_list):
9958         Change element type to Output_section::Simple_input_section.
9959         (Output_section_element_dot_assignment::set_section_addresses):
9960         Register output section data for relaxation clean up.
9961         (Output_data_exression::Output_data_expression): Adjust call to base
9962         constructor to fix data size.
9963         (Output_section_element_data::set_section_addresses): Register
9964         Output_data_expression object for relaxation clean up.
9965         (struct Input_section_info): Replace Relobj pointer and section index
9966         pair with Output_section::Simple_input_section and Convert struct to a
9967         class.
9968         (Input_section_sorter::operator()): Adjust access to
9969         Input_section_info data member to use accessors.
9970         (Output_section_element_input::set_section_addresses): Use layout
9971         parameter.  Adjust code to use Output_section::Simple_input_section
9972         and Input_secction_info classes.  Register filler for relaxation
9973         clean up.
9974         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9975         and section index pair with Output_section::Simple_input_section
9976         class.  Adjust code accordingly.
9977         (Phdrs_element::release_segment): New method definition.
9978         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9979         segment list.
9980         (Script_sections::release_segments): New method definition.
9981         * gold/script-sections.h (Script_sections::release_segments): New
9982         method declaration.
9983         * gold/target.h (Target::may_relax, Target::relax,
9984         Target::do_may_relax, Target::do_relax): New method definitions.
9985
9986 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9987
9988         * arm.cc (has_signed_unsigned_overflow): New function.
9989         (Arm_relocate_functions::abs8): New function.
9990         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9991         (Target_arm::Scan::global): Likewise.
9992         (Target_arm::relocate::relocate): Likewise.
9993         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9994         Likewise.
9995
9996 2009-09-16  Cary Coutant  <ccoutant@google.com>
9997
9998         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9999         * testsuite/Makefile.in: Regenerate.
10000
10001 2009-09-11  Nick Clifton  <nickc@redhat.com>
10002
10003         * po/gold.pot: Updated by the Translation project.
10004
10005 2009-09-08  Cary Coutant  <ccoutant@google.com>
10006
10007         * output.cc (Output_file::open): Add execute permission to empty file.
10008         * testsuite/Makefile.am (permission_test): New test.
10009         * testsuite/Makefile.in: Regenerate.
10010
10011 2009-09-02  Ian Lance Taylor  <iant@google.com>
10012
10013         * output.cc (Output_file::resize): Call map_no_anonymous rather
10014         than map.
10015
10016 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10017
10018         * gold.cc: Include "incremental.h".
10019         (queue_initial_tasks): Call Incremental_checker methods.
10020         * incremental.cc: Include "output.h".
10021         (Incremental_checker::can_incrementally_link_output_file): New
10022         method.
10023         * incremental.h (Incremental_checker): New class.
10024
10025         * output.cc (Output_file::open_for_modification): New method.
10026         (Output_file::map_anonymous): Changed return type to bool.  Record
10027         map in base_ field.
10028         (Output_file::map_no_anonymous): New method, broken out of map.
10029         (Output_file::map): Use map_no_anonymous and map_anonymous.
10030         * output.h (class Output_file): Update declarations.
10031
10032 2009-08-24  Cary Coutant  <ccoutant@google.com>
10033
10034         * options.h (Command_line::Pre_options): New class.
10035         (Command_line::pre_options): New member.
10036         * options.cc (gold::options::ready_to_register): New variable.
10037         (One_option::register_option): Do nothing if not registering options.
10038         Assert if same short option registered twice.
10039         (General_options::General_options): Turn off option registration when
10040         done constructing.
10041         (Command_line::Pre_options::Pre_options): New constructor.
10042
10043 2009-08-24  Cary Coutant  <ccoutant@google.com>
10044
10045         * options.h (General_options::no_keep_memory): Remove incorrect
10046         short option.
10047
10048 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10049
10050         * Makefile.am (am__skiplex, am__skipyacc): New.
10051         * Makefile.in: Regenerate.
10052
10053 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10054
10055         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10056         (INCLUDES): ... this.
10057         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10058         (AM_CPPFLAGS): Renamed from ...
10059         (INCLUDE): ... this.
10060         * Makefile.in, testsuite/Makefile.in: Regenerate.
10061
10062         * Makefile.in: Regenerate.
10063         * aclocal.m4: Likewise.
10064         * config.in: Likewise.
10065         * configure: Likewise.
10066         * testsuite/Makefile.in: Likewise.
10067
10068         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10069         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10070         * Makefile.in: Regenerate.
10071         * testsuite/Makefile.in: Regenerate.
10072
10073 2009-08-19  Cary Coutant  <ccoutant@google.com>
10074
10075         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10076         symbols in shared libraries overridden by hidden or internal symbols
10077         in the main program.
10078
10079 2009-08-19  Chris Demetriou  <cgd@google.com>
10080
10081         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10082         checking source file names in error messages.
10083
10084 2009-08-18  Doug Kwan  <dougkwan@google.com>
10085
10086         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10087         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10088         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10089         an elfcpp::Ehdr as parameter.
10090         * object.cc (Object::set_target): Remove the version that looks up
10091         a target and sets it.
10092         (Sized_relobj::setup): Take a Target object instead of
10093         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10094         (make_elf_sized_object): Find target and ask target to
10095         make an ELF object.
10096         * object.h: (Object::set_target): Remove the version that looks up
10097         a target and sets it.
10098         (Sized_relobj::setup): Take a Target object instead of
10099         an elfcpp:Ehdr as parameter.
10100         * target.cc: Include dynobj.h.
10101         (Target::do_make_elf_object_implementation): New.
10102         (Target::do_make_elf_object): New.
10103         * target.h (Target::make_elf_object): New template declaration.
10104         (Target::do_make_elf_object): New method declarations.
10105         (Target::do_make_elf_object_implementation): New template declaration.
10106
10107 2009-08-14  Ian Lance Taylor  <iant@google.com>
10108
10109         * gold.h (FUNCTION_NAME): Define.
10110         (gold_unreachable): Use FUNCTION_NAME.
10111
10112 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10113
10114         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10115         symbol in the --keep-unique list is not found.
10116
10117 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10118
10119         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10120         been maked as --keep-unique.
10121         (Icf::unfold_section): New function.
10122         * icf.h (Icf::unfold_section): New function.
10123         * options.h (General_options::keep_unique): New option.
10124         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10125         * testsuite/Makefile.in: Regenerate.
10126         * testsuite/icf_keep_unique_test.sh: New file.
10127         * testsuite/icf_keep_unique_test.cc: New file.
10128
10129 2009-08-12  Cary Coutant  <ccoutant@google.com>
10130
10131         PR 10471
10132         * resolve.cc (Symbol_table::resolve): Check for references from
10133         dynamic objects to hidden and internal symbols.
10134         * testsuite/Makefile.am (hidden_test.sh): New test.
10135         * testsuite/Makefile.in: Regenerate.
10136         * testsuite/hidden_test.sh: New script.
10137         * testsuite/hidden_test_1.c: New test source.
10138         * testsuite/hidden_test_main.c: New test source.
10139
10140 2009-08-11  Doug Kwan  <dougkwan@google.com>
10141
10142         * arm.cc: Update comments.
10143         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10144         segment to locate the .ARM.exidx section if present.
10145
10146 2009-08-09  Doug Kwan  <dougkwan@google.com>
10147
10148         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10149         patch.
10150
10151 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10152         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10153         compiler warnings.
10154
10155 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10156
10157         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10158         valid tls_segment only for non-debug-section relocations.
10159         * testsuite/Makefile.am: Add gc_tls_test.
10160         * testsuite/Makefile.in: Regenerate.
10161         * testsuite/gc_tls_test.cc: New file.
10162         * testsuite/gc_tls_test.sh: New file.
10163
10164 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10165
10166         * icf.cc: New file.
10167         * icf.h: New file.
10168         * Makefile.am (CCFILES): Add icf.cc.
10169         (HFILES): Add icf.h
10170         * Makefile.in: Regenerate.
10171         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10172         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10173         section, symbol and addend information for the relocs.
10174         * gold.cc (queue_middle_tasks): Call identical code folding.
10175         * gold.h: Add defines for multimap.
10176         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10177         to the call of finalize_local_symbols.
10178         * main.cc (main): Create object of class Icf.
10179         * object.cc (Sized_relobj::do_layout): Allow this function to be
10180         called twice during icf.
10181         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10182         to sections marked as identical by icf.
10183         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10184         when available.
10185         (Sized_relobj::do_section_entsize): New function.
10186         * object.h (Object::section_entsize): New function.
10187         (Object::do_section_entsize): New pure virtual function.
10188         (Relobj::finalize_local_symbols): Add new parameter.
10189         (Relobj::do_section_entsize): New function.
10190         * options.h (General_options::icf): New option.
10191         (General_options::icf_iterations): New option.
10192         (General_options::print_icf_sections): New option.
10193         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10194         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10195         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10196         icf.
10197         * symtab.cc (Symbol_table::is_section_folded): New function.
10198         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10199         to sections marked as identical by icf.
10200         * symtab.h (Symbol_table::set_icf): New function.
10201         (Symbol_table::icf): New function.
10202         (Symbol_table::is_section_folded): New function.
10203         (Symbol_table::icf_): New data member.
10204         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10205         * testsuite/Makefile.am: Add commands to build icf_test.
10206         * testsuite/Makefile.in: Regenerate.
10207         * testsuite/icf_test.sh: New file.
10208         * testsuite/icf_test.cc: New file.
10209
10210 2009-07-24  Chris Demetriou  <cgd@google.com>
10211
10212         * layout.cc (is_compressible_debug_section): Fix incorrect
10213         comment about compressed section names.
10214
10215 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10216
10217         PR 10419
10218         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10219
10220 2009-07-16  Ian Lance Taylor  <iant@google.com>
10221
10222         PR 10400
10223         * layout.h: #include <map>.
10224         (class Kept_section): Change from struct to class.  Add accessors
10225         and setters.  Add section size to Comdat_group mapping.  Change
10226         Comdat_group to std::map.  Add is_comdat_ field.  Add
10227         linkonce_size field in union.
10228         (class Layout): Update declaration of find_or_add_kept_section.
10229         Don't declare find_kept_object.
10230         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10231         parameter.  Add object, shndx, is_comdat, and is_group_name
10232         parameters.  Change all callers.  Adjust for new Kept_section.
10233         (Layout::find_kept_object): Remove.
10234         * object.cc (Sized_relobj::include_section_group): Update use of
10235         Kept_section.  Rename secnum to shndx.  Only record
10236         Kept_comdat_section if sections are the same size.
10237         (Sized_relobj::include_linkonce_section): Update use of
10238         Kept_section.  Only record Kept_comdat_section if sections are the
10239         same size.  Set size of linkonce section.
10240         (Sized_relobj::map_to_kept_section): Update call to
10241         get_kept_comdat_section.
10242         * object.h (class Sized_relobj): Rename fields in
10243         Kept_comdat_section to drop trailing underscores; change object
10244         field to Relobj*.  Change Kept_comdat_section_table to store
10245         struct rather than pointer.
10246         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10247         Add kept_object and kept_shndx parameters.  Change all callers.
10248         (Sized_relobj::get_kept_comdat_section): Change return type to
10249         bool.  Add kept_object and kept_shndx parameters.  Change all
10250         callers.
10251         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10252         Layout::find_or_add_kept_section.
10253
10254 2009-07-09  Ian Lance Taylor  <iant@google.com>
10255
10256         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10257         Reserve space in the hash table.
10258
10259 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10260
10261         * fileread.cc (File_read::get_mtime): New method.
10262         * fileread.h (Timespec): New structure.
10263         (File_read::get_mtime): New method.
10264         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10265         Renamed from timestamp_nsec.
10266         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10267         Elf_Xword.
10268         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10269         timestamp_nsec.
10270         (Incremental_inputs::report_archive): Save mtime; style fix.
10271         (Incremental_inputs::report_obejct): Save mtime; style fix.
10272         (Incremental_inputs::report_script): Save mtime; style fix.
10273         (Incremental_inputs::finalize_inputs): Style fix.
10274         (Incremental_inputs::finalize): Style fix.
10275         (Incremental_inputs::create_input_section_data): Store inputs
10276         mtime.
10277         * incremental.h (Incremental_inputs::report_script): Add mtime
10278         argument.
10279         (Incremental_inputs::Input_info::Input_info): Intialize only one
10280         union member.
10281         (Incremental_inputs::Input_info::archive): Move to nameless
10282         union.
10283         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10284         (Incremental_inputs::Input_info::script): Move to nameless union.
10285         (Incremental_inputs::mtime): New field.
10286         * script.cc (read_input_script): Pass file mtime to
10287         Incremental_input.
10288         * script.h (Script_info::inputs): Style fix.
10289
10290 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10291
10292         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10293         instead of 32.
10294
10295 2009-06-24  Ian Lance Taylor  <iant@google.com>
10296
10297         PR 10156
10298         * layout.cc (Layout::choose_output_section): If we find an
10299         existing section, update the flags.
10300         (Layout::create_notes): New function, broken out of
10301         Layout::finalize.
10302         (Layout::finalize): Don't create note sections.
10303         (Layout::create_note): Don't crash if linker script discards
10304         section.
10305         (Layout::create_gold_note): Likewise.
10306         (Layout::create_build_id): Likewise.  Don't set
10307         after_input_sections on the section.
10308         (Layout::create_executable_stack_info): Remove target parameter.
10309         Change caller.
10310         * layout.h (class Layout): Declare create_notes.  Update
10311         declaration of create_executable_stack_info.
10312         * gold.cc (queue_middle_tasks): Call create_notes.
10313         * output.cc (Output_section::update_flags_for_input_section): Move
10314         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10315         invalid.
10316         * output.h (Output_data::mark_address_invalid): New function.
10317         (class Output_section): Only declare, not define,
10318         update_flags_for_input_section.  Remove set_flags.
10319
10320 2009-06-24  Ian Lance Taylor  <iant@google.com>
10321
10322         * script-sections.cc (Output_section_definition::
10323         set_section_addresses): Rename shadowing local load_address to
10324         laddr.
10325
10326 2009-06-24  Ian Lance Taylor  <iant@google.com>
10327
10328         PR 10244
10329         * reloc.cc (relocate_sections): Skip empty relocation sections.
10330
10331 2009-06-23  Ian Lance Taylor  <iant@google.com>
10332
10333         PR 10156
10334         * layout.cc (Layout::create_note): Use choose_output_section
10335         rather than make_output_section.
10336
10337 2009-06-23  Ian Lance Taylor  <iant@google.com>
10338
10339         PR 10237
10340         * options.cc (General_options::parse_V): Set printed_version_.
10341         (General_options::General_options): Initialize printed_version_.
10342         * options.h (class General_options): Add printed_version_ field.
10343         * gold.cc (queue_initial_tasks): If there are no input files,
10344         don't give a fatal error if we printed the version information.
10345         (queue_middle_tasks): If using -r with a shared object, give a
10346         fatal error rather than an ordinary error.
10347
10348 2009-06-23  Ian Lance Taylor  <iant@google.com>
10349
10350         PR 10219
10351         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10352         (Layout::make_output_section): Set have_stabstr_section_ if we see
10353         a .stab*str section.
10354         (Layout::finalize): Call link_stabs_sections.
10355         (Layout::link_stabs_sections): New file.
10356         * layout.h (class Layout): Add have_stabstr_section_ field.
10357         Declare link_stabs_sections.
10358
10359 2009-06-23  Doug Kwan  <dougkwan@google.com>
10360
10361         * Makefile.am (libgold_a_LIBADD): New.
10362         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10363         * Makefile.in: Regenerate.
10364         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10365         * configure: Regenerate.
10366         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10367         * fileread.cc: Include sys/state.h
10368         * gold.h: Declare memmem and strndup if found missing.
10369         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10370
10371 2009-06-23  Ian Lance Taylor  <iant@google.com>
10372
10373         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10374         * configure: Rebuild.
10375
10376 2009-06-23  Ian Lance Taylor  <iant@google.com>
10377
10378         PR 10147
10379         * object.cc (Object::section_contents): Don't try to get a view if
10380         the section has length zero.
10381         (Object::handle_gnu_warning_section): If the section is empty, use
10382         the name of the section as the warning.
10383
10384 2009-06-23  Ian Lance Taylor  <iant@google.com>
10385
10386         PR 10133
10387         * stringpool.h (class Stringpool_template): Add optimize_ field.
10388         (Stringpool_template::set_optimize): New function.
10389         * stringpool.cc (Stringpool_template::Stringpool_template):
10390         Initialize optimize_ field.
10391         (Stringpool_template::set_string_offsets): Test local optimize
10392         fild rather than parameter.
10393         * layout.cc (Layout::Layout): Call set_optimize on the section
10394         name stringpool.
10395
10396 2009-06-22  Ian Lance Taylor  <iant@google.com>
10397
10398         PR 10030
10399         * yyscript.y: Parse TARGET.
10400         * script.cc (script_set_target): New function.
10401         * script-c.h (script_set_target): Declare.
10402         * options.cc (General_options::string_to_object_format): Rename
10403         from string_to_object_format in anonymous namespace.  Change
10404         callers.
10405         * options.h (class General_options): Declare
10406         string_to_object_format.
10407
10408 2009-06-22  Ian Lance Taylor  <iant@google.com>
10409
10410         * script-sections.cc (Script_sections::create_segments): Don't put
10411         program headers in a PT_LOAD segment if -n or -N.
10412
10413 2009-06-22  Ian Lance Taylor  <iant@google.com>
10414
10415         PR 10141
10416         * options.h (class General_options): Add -z lazy and -z now.  Sort
10417         -z options into alphabetical order.
10418         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10419
10420 2009-06-21  Ian Lance Taylor  <iant@google.com>
10421
10422         * layout.cc (Layout::make_output_section): Call
10423         Target::new_output_section.
10424         (Layout::attach_allocated_section_to_segment): Put large section
10425         sections in a separate load segment with the large segment flag
10426         set.
10427         (Layout::segment_precedes): Sort large data segments after other
10428         load segments.
10429         (align_file_offset): New static function.
10430         (Layout::set_segment_offsets): Use align_file_offset.
10431         * output.h (class Output_section): Add is_small_section_ and
10432         is_large_section_ fields.
10433         (Output_section::is_small_section): New function.
10434         (Output_section::set_is_small_section):  New function.
10435         (Output_section::is_large_section): New function.
10436         (Output_section::set_is_large_section): New function.
10437         (Output_section::is_large_data_section): New function.
10438         (class Output_segment): Add is_large_data_segment_ field.
10439         (Output_segment::is_large_data_segment): New function.
10440         (Output_segment::set_is_large_data_segment): New function.
10441         * output.cc (Output_section::Output_section): Initialize new
10442         fields.
10443         (Output_segment::Output_segment): Likewise.
10444         (Output_segment::add_output_section): Add assertion that large
10445         data sections always go in large data segments.  Force small data
10446         sections to the end of the list of data sections.  Force small BSS
10447         sections to the start of the list of BSS sections.  For large BSS
10448         sections to the end of the list of BSS sections.
10449         * symtab.h (class Symbol): Declare is_common_shndx.
10450         (Symbol::is_defined): Check Symbol::is_common_shndx.
10451         (Symbol::is_common): Likewise.
10452         (class Symbol_table): Define enum Commons_section_type.  Update
10453         declarations.  Add small_commons_ and large_commons_ fields.
10454         * symtab.cc (Symbol::is_common_shndx): New function.
10455         (Symbol_table::Symbol_table): Initialize new fields.
10456         (Symbol_table::add_from_object): Put small and large common
10457         symbols in the right list.
10458         (Symbol_table::sized_finalized_symbol): Check
10459         Symbol::is_common_shndx.
10460         (Symbol_table::sized_write_globals): Likewise.
10461         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10462         common symbol lists.  Don't call do_allocate_commons_list if the
10463         list is empty.
10464         (Symbol_table::do_allocate_commons_list): Remove is_tls
10465         parameter.  Add comons_section_type parameter.  Change all
10466         callers.  Handle small and large common symbols.
10467         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10468         Symbol::is_common_shndx.
10469         * resolve.cc (symbol_to_bits): Likewise.
10470         * target.h (Target::small_common_shndx): New function.
10471         (Target::small_common_section_flags): New function.
10472         (Target::large_common_shndx): New function.
10473         (Target::large_common_section_flags): New function.
10474         (Target::new_output_section): New function.
10475         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10476         small_common_section_flags, and large_common_section_flags
10477         fields.
10478         (Target::do_new_output_section): New virtual function.
10479         * arm.cc (Target_arm::arm_info): Initialize new fields.
10480         * i386.cc (Target_i386::i386_info): Likewise.
10481         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10482         Likewise.
10483         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10484         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10485         (Target_x86_64::do_new_output_section): New function.
10486         * configure.ac: Define conditional MCMODEL_MEDIUM.
10487         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10488         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10489         (large_LDFLAGS): Define.
10490         * testsuite/large.c: New file.
10491         * testsuite/testfile.cc (Target_test::test_target_info):
10492         Initialize new fields.
10493         * configure, testsuite/Makefile.in: Rebuild.
10494
10495 2009-06-05  Doug Kwan  <dougkwan@google.com>
10496
10497         * Makefile.am (CCFILES): Add target.cc.
10498         * Makefile.in: Regenerate.
10499         * i386.cc (class Target_i386): Define new virtual method to
10500         override do_is_local_label_name in parent.
10501         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10502         local symbols if --discard-locals or -X is given.
10503         * options.h (class General_options): Declare new options
10504         '--discard-locals' and '-X' for discarding locals.
10505         * target.h (class Target): Define new methods is_local_label_name.
10506         Declare new virtual method do_is_local_label_name.
10507         * target.cc: New file.
10508         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10509         (check_SCRIPTS): Add discard_locals_test.sh.
10510         (check_DATA): Add discard_local_tests.syms.
10511         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10512         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10513         * testsuite/Makefile.in: Regenerate.
10514         * testsuite/discard_locals_test.c: New file.
10515         * testsuite/discard_locals_test.sh: Same.
10516
10517 2009-06-05  Doug Kwan  <dougkwan@google.com>
10518
10519         * object.cc (Sized_relobj::Sized_relobj): Initialize
10520         discarded_eh_frame_shndx_ to -1U.
10521         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10522         section.
10523         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10524         a discarded .eh_frame section.
10525         (Sized_relobj::do_finalize_local_symbols): Ditto.
10526         * object.h (class Sized_relobj): Declare new member
10527         discarded_eh_frame_shndx_.
10528         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10529         (local_labels_test.o, local_labels_test): New rules.
10530         * testsuite/Makefile.in: Regenerate.
10531
10532 2009-06-04  Doug Kwan  <dougkwan@google.com>
10533
10534         * layout.cc (Layout::section_name_mapping): Add mapping for
10535         special ARM sections.
10536
10537 2009-06-03  Doug Kwan  <dougkwan@google.com>
10538
10539         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10540         (utils::has_overflow): Same.
10541
10542 2009-06-03  Ian Lance Taylor  <iant@google.com>
10543
10544         * layout.cc (Layout::section_name_mapping): New array, replacing
10545         Layout::linkonce_mapping.
10546         (Layout::section_name_mapping_count): New variable, replacing
10547         Layout::linkonce_mapping_count.
10548         (Layout::linkonce_output_name): Remove.
10549         (Layout::output_section_name): Rewrite.
10550         * layout.h (class Layout): Rename Linkonce_mapping to
10551         Section_name_mapping, linkonce_mapping to section_name_mapping,
10552         linkonce_mapping_count to section_name_mapping_count.  Don't
10553         declare linkonce_output_name.
10554
10555 2009-06-03  Doug Kwan  <dougkwan@google.com>
10556
10557         * gold/arm.cc (namespace utils): New.
10558         (Target_arm::reloc_is_non_pic): Define new method.
10559         (class Arm_relocate_functions): New.
10560         (Target_arm::Relocate::relocate): Handle relocation types used by
10561         Android.
10562
10563 2009-06-03  Ian Lance Taylor  <iant@google.com>
10564
10565         * arm.cc (Target_arm::scan::global): Use || instead of |.
10566
10567 2009-06-02  Doug Kwan  <dougkwan@google.com>
10568
10569         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10570         issued_non_pic_error_.
10571         (class Target_arm::Scan): Declare new method check_non_pic.
10572         Define new method symbol_needs_plt_entry.
10573         Declare new data member issued_non_pic_error_.
10574         (class Target_arm::Relocate): Declare new method
10575         should_apply_static_reloc.
10576         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10577         (Target_arm::Scan::check_non_pic): Define new method.
10578         (Target_arm::Scan::local): Handle a small subset of reloc types used
10579         by Android.
10580         (Target_arm::Scan::local): Same.
10581         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10582
10583 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10584
10585         * incremental.cc (Incremental_inputs::report_command_line): Filter
10586         out --incremental-* options.
10587
10588 2009-05-29  Doug Kwan  <dougkwan@google.com>
10589
10590         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10591         template class.
10592         (class Target_arm): Update comment.
10593         (Target_arm::Target_arm): Initialize new data members GOT_,
10594         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10595         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10596         and Target_arm::rel_dyn_section.
10597         Declare new_enum Target_arm::Got_type.
10598         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10599         and DYNBSS_.
10600         Update commments for member do_dynsym_value.
10601         (Target_arm::got_size, Target_arm::plt_section,
10602         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10603         new methods inside class defintion.
10604         (Target_arm::got_section): Define new method.
10605         (Target_arm::rel_dyn_section): Same.
10606         (Output_data_plt_arm): New template class.
10607         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10608         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10609         (Output_data_plt_arm::add_entry): Same.
10610         (Output_data_plt_arm::first_plt_entry): Define new
10611         static data member for PLT instruction template.
10612         (Output_data_plt_arm::plt_entry): Same.
10613         (Output_data_plt_arm::do_write): Define new method.
10614         (Target_arm::make_plt_entry): Same.
10615         (Target_arm::do_finalize_sections): Same.
10616         (Target_arm::do_dynsym_value): Same.
10617
10618 2009-05-28  Doug Kwan  <dougkwan@google.com>
10619
10620         * Makefile.am (TARGETSOURCES): Add arm.cc.
10621         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10622         * Makefile.in: Regenerate.
10623         * arm.cc: New file.
10624         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10625
10626 2009-05-26  Doug Kwan  <dougkwan@google.com>
10627
10628         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10629         (General_options::check_excluded_libs): Strip off directories in
10630         archive name before matching like GNU ld does.
10631         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10632         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10633         (exclude_libs_test_LDFLAGS): Add linker option
10634         -Wl,--exclude-libs,libexclude_libs_test_3
10635         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10636         an explicit archive without using -l.
10637         (alt/libexclude_libs_test_3.a): New make rule.
10638         * testsuite/Makefile.in: Regenerate.
10639         * testsuite/exclude_libs_test.c : Declare lib3_default().
10640         (main): Call it.
10641         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10642         * exclude_libs_test_3.c: New file.
10643
10644 2009-05-26  Nick Clifton  <nickc@redhat.com>
10645
10646         * po/id.po: New Indonesian translation.
10647         * po/gold.pot: Updated template file.
10648
10649 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10650
10651         * testsuite/Makefile.am: Add -ffunction-sections to compile
10652         gc_comdat_test files.  Add -Wl,--gc-sections to build
10653         gc_comdat_test.
10654         * testsuite/Makefile.in: Regenerate.
10655         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10656
10657 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10658
10659         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10660         kept comdat section was garbage collected.
10661         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10662         * testsuite/Makefile.in: Regenerate.
10663         * testsuite/gc_comdat_test.sh: New file.
10664         * testsuite/gc_comdat_test_1.cc: New file.
10665         * testsuite/gc_comdat_test_2.cc: New file.
10666
10667 2009-05-19  Doug Kwan  <dougkwan@google.com>
10668
10669         * archive.cc (Archive::Archive): Move constructor from archive.h
10670         to here.  Initialize no_export_.
10671         (Archive::get_elf_object_for_member): Set no_export flag of object.
10672         * archive.h (Archive::Archive): Move constructor body to
10673         archive.cc.
10674         (Archive::no_export): New method.
10675         (Archive::no_export_): New field.
10676         * object.h (Object::Object): Initialize no_export_ to false.
10677         (Object::no_export, Object::set_no_export): New methods.
10678         (Object::no_export_): New field.
10679         * options.cc (General_options::parse_exclude_libs): New method.
10680         (General_options::check_excluded_libs) Same.
10681         * options.h (exclude_libs): New option.
10682         (General_options::check_excluded_libs): New method declaration.
10683         (General_options::excluded_libs_): New field.
10684         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10685         default or protected visibility if an object has no-export flag set.
10686         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10687         (check_SCRIPTS): Add exclude_libs_test.sh.
10688         (check_DATA): Add exclude_libs_test.syms.
10689         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10690         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10691         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10692         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10693         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10694         libexclude_libs_test_2.a): New rules.
10695         * testsuite/Makefile.in: Regenerate.
10696         * testsuite/exclude_libs_test.c: New file.
10697         * testsuite/exclude_libs_test.sh: Ditto.
10698         * testsuite/exclude_libs_test_1.c: Ditto.
10699         * testsuite/exclude_libs_test_2.c: Ditto.
10700
10701 2009-05-15  Ian Lance Taylor  <iant@google.com>
10702
10703         * configure.ac: Check for declarations for cases where libiberty.h
10704         checks HAVE_DECL_xxx.
10705         * configure, config.in: Rebuild.
10706
10707 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10708
10709         * gold.h (Incremental_argument_list): Remove (invalid) forward
10710         declaration.
10711         * incremental.cc (Incremental_inputs::report_achive): New method.
10712         (Incremental_inputs::report_object): New method.
10713         (Incremental_inputs::report_script): New method.
10714         (Incremental_inputs::finalize_inputs): New method.
10715         (Incremental_inputs::finalize): Call finalize_inputs().
10716         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10717         Create inputs entries.
10718         * incremental.h (Incremental_input_type): New enum.
10719         (Incremental_inputs::Incremental_input): Initialize new fields.
10720         (Incremental_inputs::report_inputs): New method.
10721         (Incremental_inputs::report_achive): New method.
10722         (Incremental_inputs::report_object): New method.
10723         (Incremental_inputs::report_script): New method.
10724         (Incremental_inputs::finalize_inputs): New method.
10725         (Incremental_inputs::Input_info): New struct.
10726         (Incremental_inputs::Input_info_map): New typedef.
10727         (Incremental_inputs::lock_): New field.
10728         (Incremental_inputs::Inputs_): New field.
10729         (Incremental_inputs::Inputs_map): New field.
10730         * main.cc (main): Call Incremental_input::report_inputs.
10731         * options.h (Input_argument_list): Typedef moved from
10732         Input_arguments.
10733         (Input_file_group::Files): Remove, use ::Input_argument_list.
10734         (Input_file_group::Input_argument_list): Remove, use
10735         ::Input_argument_list.
10736         * plugin.cc (Plugin_manager::add_input_file): Add error in
10737         incremental build.
10738         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10739         functions.
10740         * script.cc (read_input_script): Call
10741         Incremental_input::report_script.
10742         * script.h (Script_info): New class.
10743
10744 2009-04-27  Ian Lance Taylor  <iant@google.com>
10745
10746         * x86_64.cc (do_adjust_output_section): Set entsize to
10747         plt_entry_size.
10748
10749 2009-04-23  Elliott Hughes  <enh@google.com>
10750
10751         * output.cc (Output_file::close): After short writes, continue
10752         writing from the correct offset in the buffer being written.
10753
10754 2009-04-23  Chris Demetriou  <cgd@google.com>
10755
10756         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10757         * configure: Regenerate.
10758         * config.in: Regenerate.
10759         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10760         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10761
10762 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10763
10764         * incremental.cc (Incremental_inputs_header_data): Renamed from
10765         Incremental_input_header_data.
10766         (Incremental_inputs_header_data::data_size): New field.
10767         (Incremental_inputs_header_data::put_input_file_count): Renamed
10768         from input_file_count.
10769         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10770         from command_line_offset.
10771         (Incremental_inputs_header_data::put_reserved): Renamed from
10772         put_reserved.
10773         (Incremental_inputs_entry_data): Renamed from
10774         Incremental_input_entry_data.
10775         (Incremental_inputs_entry_data::data_size): New field.
10776         (Incremental_inputs::report_command_line): New method.
10777         (Incremental_inputs::finalize): New method.
10778         (Incremental_inputs::create_incremental_inputs_data): New method.
10779         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10780         * incremental.h: New file.
10781         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10782         (Layout::finalize): Create incremental inputs section in
10783         incremental builds.
10784         (Layout::create_incremental_info_sections): New method.
10785         * layout.h (Layout::incremental_inputs): New method.
10786         (Layout::create_incremental_info_sections): New method.
10787         (Layout::incremental_inputs_): New field.
10788         * main.cc (main): Notify Incremental_input of the command line.
10789
10790 2009-04-01  Ian Lance Taylor  <iant@google.com>
10791             Mikolaj Zalewski  <mikolajz@google.com>
10792
10793         * gold.h (reserve_unordered_map): Define, three versions, one for
10794         each version of Unordered_map.
10795         * layout.cc (Layout::Layout): Remove options parameter.  Add
10796         number_of_input_files parameter.  Don't initialize options_.
10797         Initialize number_of_input_files_ and resized_signatures_.  Move
10798         sections_are_attached_.
10799         (Layout::layout_group): Reserve space for group_signatures_.
10800         (Layout::find_or_add_kept_section): Change name parameter to be a
10801         reference.  Resize signatures_ map when it gets large enough.
10802         (Layout::layout_eh_frame): Use parameters->options() instead of
10803         this->options_.
10804         (Layout::make_output_section): Likewise.
10805         (Layout::attach_allocated_section_to_segment): Likewise.
10806         (Layout::finalize, Layout::create_executable_stack): Likewise.
10807         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10808         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10809         * layout.h (class Layout): Update declarations.  Remove options_
10810         field.  Add number_of_input_files_ and resized_signatures_
10811         fields.  Move sections_are_attached_ field.
10812         * main.cc (main): Pass number of input files to Layout
10813         constructor.  Don't pass options.
10814
10815 2009-03-30  Ian Lance Taylor  <iant@google.com>
10816
10817         * ffsll.c (ffsll): Correct implementation.
10818
10819 2009-03-27  Ian Lance Taylor  <iant@google.com>
10820
10821         * ffsll.c: New file.
10822         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10823         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10824         * ftruncate.c (ftruncate): Declare before definition.
10825         * mremap.c (mremap): Likewise.
10826         * pread.c (pread): Likewise.
10827         * configure, Makefile.in, config.in: Rebuild.
10828
10829         * mremap.c: New file.
10830         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10831         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10832         (mremap): Declare if HAVE_MREMAP is not defined.
10833         * configure, Makefile.in, config.in: Rebuild.
10834
10835 2009-03-27  Cary Coutant  <ccoutant@google.com>
10836
10837         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10838         position independent.
10839         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10840         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10841
10842 2009-03-24  Cary Coutant  <ccoutant@google.com>
10843
10844         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10845         an executable.
10846         (needs_dynamic_reloc): Likewise.
10847
10848 2009-03-24  Ian Lance Taylor  <iant@google.com>
10849
10850         * yyscript.y (file_cmd): Recognize EXTERN.
10851         (extern_name_list, extern_name_list_body): New nonterminals.
10852         * script.cc (script_add_extern): Define.
10853         * script-c.h (script_add_extern): Declare.
10854
10855 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10856
10857         * object.cc (is_elf_object): Define.
10858         * object.h (is_elf_object): Declare.
10859         * archive.cc (Archive::get_elf_object_for_member): Call
10860         is_elf_object.
10861         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10862
10863 2009-03-24  Elliott Hughes  <enh@google.com>
10864
10865         * output.cc (Output_file::map_anonymous): Define.
10866         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10867         try an anonymous one.  Report the size if the mmap fails.
10868         * output.h (class Output_file): Declare map_anonymous.
10869
10870 2009-03-24  Ian Lance Taylor  <iant@google.com>
10871
10872         * target-select.cc (instantiate_target): Don't acquire the lock if
10873         the instantiated_target_ field has already been set.
10874
10875 2009-03-23  Ian Lance Taylor  <iant@google.com>
10876
10877         * gold-threads.h (class Initialize_lock): Define.
10878         * gold-threads.cc (class Initialize_lock_once): Define.
10879         (initialize_lock_control): New static variable.
10880         (initialize_lock_pointer): New static variable.
10881         (initialize_lock_once): New static function.
10882         (Initialize_lock::Initialize_lock): Define.
10883         (Initialize_lock::initialize): Define.
10884         * target-select.h: Include "gold-threads.h".
10885         (class Target_selector): Add lock_ and initialize_lock_ fields.
10886         Don't define instantiate_target, just declare it.
10887         * target-select.cc (Target_selector::Target_selector): Initialize
10888         new fields.
10889         (Target_selector::instantiate_target): Define.
10890         * descriptors.h: Include "gold-threads.h".
10891         (class Descriptors): Add initialize_lock_ field.
10892         * descriptors.cc (Descriptors::Descriptors): Initialize new
10893         field.
10894         (Descriptors::open): Use initialize_lock_ field
10895         * errors.h (class Errors): Add initialize_lock_ field.
10896         * errors.cc (Errors::Errors): Initialize new field.
10897         (Errors::initialize_lock): Use initialize_lock_ field.
10898         * powerpc.cc (class Target_selector_powerpc): Remove
10899         instantiated_target_ field.  In do_recognize call
10900         instantiate_target rather than do_instantiate_target.  In
10901         do_instantiate_target just allocate a new target.
10902         * sparc.cc (class Target_selector_sparc): Likewise.
10903
10904         * freebsd.h: New file.
10905         * i386.cc: Include "freebsd.h".
10906         (Target_i386): Derive from Target_freebsd rather than
10907         Sized_target.
10908         (Target_selector_i386): Derive from Target_selector_freebsd rather
10909         than Target_selector.
10910         * x86_64.cc: Include "freebsd.h".
10911         (Target_x86_64): Derive from Target_freebsd rather than
10912         Sized_target.
10913         (Target_selector_x86_64): Derive from Target_selector_freebsd
10914         rather than Target_selector.
10915         * target.h (class Target): Add adjust_elf_header and
10916         do_adjust_elf_header.
10917         * output.cc (Output_file_header:: do_sized_write): Call target
10918         adjust_elf_header routine.
10919         * configure.tgt: Set targ_osabi.
10920         * configure.ac: Define GOLD_DEFAULT_OSABI.
10921         * parameters.cc (Parameters::default_target): Pass
10922         GOLD_DEFAULT_OSABI to select_target.
10923         * target-select.h (class Target_selector): Make instantiate_target
10924         protected rather than private.
10925         * Makefile.am (HFILES): Add freebsd.h.
10926         * configure, Makefile.in, config.in: Rebuild.
10927
10928         * merge.cc (do_add_input_section): Correct pend value.  Change
10929         message about last entry not being null terminated from error to
10930         warning.
10931
10932 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10933
10934         * incremental.cc: New file.
10935         * Makefile.am (CCFILES): Add incremental.cc.
10936         * Makefile.in: Rebuild.
10937
10938 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10939
10940         * layout.cc (Layout::output_section_name): Preserve names
10941         of '.note.' sections.
10942
10943 2009-03-19  Ian Lance Taylor  <iant@google.com>
10944
10945         * descriptors.cc (Descriptors::open): Check that the options are
10946         valid before using them.
10947
10948 2009-03-18  Ian Lance Taylor  <iant@google.com>
10949
10950         * script-sections.h: Include <list>.
10951         (class Script_sections): Change Sections_elements from std::vector
10952         to std::list.  Typedef public Elements_iterator.  Add
10953         orphan_section_placement_, data_segment_align_start_, and
10954         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10955         field.
10956         * script-sections.cc (class Orphan_section_placement): New class.
10957         (class Sections_element): Add virtual functions is_relro and
10958         orphan_section_init.  Remove virtual function place_orphan_here.
10959         (class Output_section_definition): Add is_relro and
10960         orphan_section_init.  Remove place_orphan_here.
10961         (class Orphan_output_section): Likewise.
10962         (Script_sections::Script_sections): Update for field changes.
10963         (Script_sections::data_segment_align): Set saw_data_segment_align_
10964         and data_segment_align_start_, not data_segment_align_index.
10965         (Script_sections::data_segment_relro_end): Check
10966         saw_data_segment_align_.  Use data_segment_align_start_ rather
10967         than data_segment_align_index_.
10968         (Script_sections::place_orphan): Rewrite to use
10969         Orphan_section_placement.
10970
10971 2009-03-17  Ian Lance Taylor  <iant@google.com>
10972
10973         * archive.cc (Archive::add_symbols): Check for a version attached
10974         to the symbol name in the archive map.
10975         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10976         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10977         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10978         (ver_test_11.a): New target.
10979         * testsuite/Makefile.in: Rebuild.
10980
10981         * configure.ac: Check for chsize and posix_fallocate.  Replace
10982         ftruncate.
10983         * ftruncate.c: New file, from gnulib.
10984         * output.cc (posix_fallocate): Define dummy version if not
10985         HAVE_POSIX_FALLOCATE.
10986         (Output_file::map): Call posix_fallocate rather than lseek and
10987         write.
10988         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10989         * configure, Makefile.in, config.in: Rebuild.
10990
10991 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10992
10993         * layout.h (Layout::create_note): Add section_name parameter.
10994         * layout.cc (Layout::create_note): Likewise.
10995         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10996
10997 2009-03-17  Ian Lance Taylor  <iant@google.com>
10998
10999         * descriptors.cc: Include "options.h".
11000         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11001         (Descriptors::open): Always use O_CLOEXEC when opening a new
11002         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11003         then set FD_CLOEXEC.
11004
11005         * sparc.cc (class Target_sparc): Add has_got_section.
11006         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11007         make sure we have a GOT section.
11008
11009         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11010         (Target_sparc::Scan::local): Likewise.
11011         (Target_sparc::Scan::global): Likewise.
11012         (Target_sparc::Relocate::relocate): Likewise.
11013         (Target_sparc::Relocate::relocate_tls): Likewise.
11014
11015         * symtab.cc (Symbol_table::define_default_version): New function,
11016         broken out of add_from_object.
11017         (Symbol_table::add_from_object): Call define_default_version.
11018         (Symbol_table::define_special_symbol): Add resolve_oldsym
11019         parameter.  Change all callers.  If the version for a symbol comes
11020         from a version script, resolve it with the symbol with the same
11021         name with no version.  Also add the symbol without a version if
11022         appropriate.
11023         (do_define_in_output_data): If resolving with oldsym, don't delete
11024         sym.
11025         (do_define_in_output_segment): Likewise.
11026         (do_define_as_constant): Likewise.
11027         * symtab.h (class Symbol_table): Update declarations.
11028
11029 2009-03-13  Ian Lance Taylor  <iant@google.com>
11030
11031         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11032         (Read_symbols::requeue): New function.
11033         (Read_symbols::do_read_symbols): If make_elf_object fails because
11034         the target type is not configured, and the file was searched for,
11035         issue a warning and retry with the next directory.
11036         (Add_symbols::run): If the file has an incompatible format, and
11037         it was searched for, requeue the Read_symbols task.  On error,
11038         release the object.
11039         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11040         dirindex parameter to constructor.  Change all callers.  Declare
11041         incompatible_warning and requeue.
11042         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11043         input_argument_ and input_group_ fields.  Add them to
11044         constructor.  Change all callers.
11045         (class Read_script): Add dirindex_ field.  Add it to constructor.
11046         Change all callers.
11047         * archive.cc (Archive::setup): Remove input_objects parameter.
11048         Change all callers.
11049         (Archive::get_file_and_offset): Likewise.
11050         (Archive::read_all_symbols): Likewise.
11051         (Archive::read_symbols): Likewise.
11052         (Archive::get_elf_object_for_member): Remove input_objects
11053         parameter.  Add punconfigured parameter.  Change all callers.
11054         (Archive::add_symbols): Change return type to bool.  Check return
11055         value of include_member.
11056         (Archive::include_all_members): Likewise.
11057         (Archive::include_member): Change return type to bool.  Return
11058         false if first included object has incompatible target.  Set
11059         included_member_ field.
11060         (Add_archive_symbols::run): If add_symbols returns false, requeue
11061         Read_symbols task.
11062         * archive.h (class Archive): Add included_member_ field.
11063         Initialize it in constructor.  Add input_file and searched_for
11064         methods.  Update declarations.
11065         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11066         input_argument_ fields.  Add them to constructor.  Change all
11067         callers.
11068         * script.cc: Include "target-select.h".
11069         (class Parser_closure): Add skip_on_incompatible_target_ and
11070         found_incompatible_target_ fields.  Add
11071         skip_on_incompatible_target parameter to constructor.  Change all
11072         callers.  Add methods skip_on_incompatible_target,
11073         clear_skip_on_incompatible_target, found_incompatible_target, and
11074         set_found_incompatible_target.
11075         (read_input_script): Add dirindex parameter.  Change all callers.
11076         If parser finds an incompatible target, requeue Read_symbols
11077         task.
11078         (script_set_symbol): Clear skip_on_incompatible_target in
11079         closure.
11080         (script_add_assertion, script_parse_option): Likewise.
11081         (script_start_sections, script_add_phdr): Likewise.
11082         (script_check_output_format): New function.
11083         * script.h (read_input_script): Update declaration.
11084         * script-c.h (script_check_output_format): Declare.
11085         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11086         (ignore_cmd): Remove OUTPUT_FORMAT.
11087         * fileread.cc (Input_file::Input_file): Add explicit this.
11088         (Input_file::will_search_for): New function.
11089         (Input_file::open): Add pindex parameter.  Change all callers.
11090         * fileread.h (class Input_file): Add input_file_argument method.
11091         Declare will_search_for.  Update declarations.
11092         * object.cc (make_elf_object): Add punconfigured parameter.
11093         Change all callers.
11094         * object.h (class Object): Make input_file public.  Add
11095         searched_for method.
11096         (make_elf_object): Update declaration.
11097         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11098         restart search.
11099         * dirsearch.h (class Dirsearch): Update declaration.
11100         * options.h (class General_options): Add --warn-search-mismatch.
11101         * parameters.cc (Parameters::is_compatible_target): New function.
11102         * parameters.h (class Parameters): Declare is_compatible_target.
11103         * workqueue.cc (Workqueue::add_blocker): New function.
11104         * workqueue.h (class Workqueue): Declare add_blocker.
11105
11106         * fileread.cc (Input_file::open): Remove options parameter.
11107         Change all callers.
11108         (Input_file::open_binary): Likewise.
11109         * script.cc (read_input_script): Likewise.
11110         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11111         options parameter from constructor.  Change all callers.
11112         (class Read_script): Likewise.
11113         * fileread.h (class Input_file): Update declarations.
11114         * script.h (read_input_script): Update declaration.
11115
11116 2009-03-10  Nick Clifton  <nickc@redhat.com>
11117
11118         * po/es.po: New Spanish translation.
11119
11120 2009-03-06  Cary Coutant  <ccoutant@google.com>
11121
11122         * options.cc (parse_short_option): Keep dash_z from registering itself.
11123
11124 2009-03-03  Ian Lance Taylor  <iant@google.com>
11125
11126         PR 9918
11127         * target-reloc.h (relocate_section): Pass output_section to
11128         relocate.
11129         * i386.cc (Target_i386::should_apply_static_reloc): Add
11130         output_section parameter.  Change all callers.
11131         (Target_i386::Relocate::relocate): Add output_section parameter.
11132         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11133         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11134         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11135         * testsuite/two_file_shared.sh: New script.
11136         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11137         (check_DATA): Add two_file_shared.dbg.
11138         (two_file_shared.dbg): New target.
11139         * testsuite/Makefile.in: Rebuild.
11140
11141 2009-03-01  Ian Lance Taylor  <iant@google.com>
11142
11143         * configure.ac: Check for byteswap.h.
11144         * configure: Rebuild.
11145         * config.in: Rebuild.
11146
11147 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11148
11149         * layout.cc (Layout::find_or_add_kept_section): New function.
11150         (Layout::add_comdat): Removed.
11151         * layout.h (struct Kept_section): Move out of class Layout.
11152         Remove trailing underscores from field names.  Add group_sections
11153         field.  Rename group_ field to is_group.  Change all uses.
11154         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11155         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11156         comdat_groups_ field.
11157         (Sized_relobj::include_section_group): Use
11158         find_or_add_kept_section and Kept_section::group_sections.
11159         (Sized_relobj::include_linkonce_section): Likewise.
11160         * object.cc (class Sized_relobj): Don't define Comdat_group or
11161         Comdat_group_table.  Remove find_comdat_group and
11162         add_comdat_group.  Remove comdat_groups_ field.
11163         * plugin.cc (include_comdat_group): Use
11164         Layout::find_or_add_kept_section.
11165
11166 2009-02-28  Ian Lance Taylor  <iant@google.com>
11167
11168         * README: --gc-sections and map files are now supported.  Document
11169         some build requirements.
11170
11171         PR 6992
11172         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11173         relocatable link set the value of the section symbol to zero.
11174         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11175         relocatable link don't include the section address in the local
11176         symbol value.
11177
11178 2009-02-27  Ian Lance Taylor  <iant@google.com>
11179
11180         PR 6811
11181         * options.h (class Search_directory): Add is_system_directory.
11182         (class General_options): Declare is_in_system_directory.
11183         * options.cc (get_relative_sysroot): Make static.
11184         (get_default_sysroot): Make static.
11185         (General_optoins::is_in_system_directory): New function.
11186         * fileread.cc (Input_file::is_in_system_directory): New function.
11187         * fileread.h (class Input_file): Declare is_in_system_directory.
11188         * object.h (class Object): Add is_in_system_directory.
11189         (class Input_objects): Remove system_library_directory_ field.
11190         * object.cc (Input_objects::add_object): Don't set
11191         system_library_directory_.
11192         (input_objects::found_in_system_library_directory): Remove.
11193         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11194         parameter.  Change all callers.
11195         (Symbol_table::sized_write_globals): Likewise.
11196         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11197         Call Object::is_in_system_directory.
11198         * symtab.h (class Symbol_table): Update declarations.
11199
11200         PR 5990
11201         * descriptors.h (Open_descriptor): Add is_on_stack field.
11202         * descriptors.cc (Descriptors::open): If the descriptor is on the
11203         top of the stack, remove it.  Initialize is_on_stack field.
11204         (Descriptors::release): Only add pod to stack if it is not on the
11205         stack already.
11206         (Descriptors::close_some_descriptor): Clear stack_next and
11207         is_on_stack fields.
11208
11209         PR 7091
11210         * output.cc (Output_section::find_starting_output_address): Rename
11211         from starting_output_address; add PADDR parameter; change return
11212         type.
11213         * output.h (class Output_section): Declare
11214         find_starting_output_address instead of starting_output_address.
11215         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11216         section symbol for which we can't find a merge section.
11217
11218         PR 9836
11219         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11220         hidden or internal, force the symbol to be local.
11221         * resolve.cc (Symbol::override_visibility): Define.
11222         (Symbol::override_base): Use override_visibility.
11223         (Symbol_table::resolve): Likewise.
11224         (Symbol::override_base_with_special): Likewise.
11225         (Symbol_table::override_with_special): If the visibility is hidden
11226         or internal, force the symbol to be local.
11227         * symtab.h (class Symbol): Add set_visibility and
11228         override_visibility.
11229         * testsuite/ver_test_1.sh: New file.
11230         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11231         (check_DATA): Add ver_test_1.syms.
11232         (ver_test_1.syms): New target.
11233         * testsuite/Makefile.in: Rebuild.
11234
11235 2009-02-25  Cary Coutant  <ccoutant@google.com>
11236
11237         * layout.cc (Layout::choose_output_section): Don't rename sections
11238         when using a linker script that has a SECTIONS clause.
11239         * Makefile.in: Regenerate.
11240
11241         * testsuite/Makefile.am (script_test_5.sh): New test case.
11242         * testsuite/Makefile.in: Regenerate.
11243         * testsuite/script_test_5.cc: New file.
11244         * testsuite/script_test_5.sh: New file.
11245         * testsuite/script_test_5.t: New file.
11246
11247 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11248
11249         * archive.cc (Archive::include_member): Update calls to add_symbols.
11250         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11251         the Layout argument.
11252         * dynobj.h (do_add_symbols): Add the Layout argument.
11253         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11254         Layout argument.
11255         * object.h (Object::add_symbols): Add the Layout argument.
11256         (Object::do_add_symbols): Add the Layout argument.
11257         (Sized_relobj::do_add_symbols): Add the Layout argument.
11258         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11259         Unify the two versions.
11260         (Add_plugin_symbols): Remove.
11261         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11262         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11263         (Add_plugin_symbols): Remove.
11264         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11265         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11266         (Add_symbols::run): Make it work with Pulginobj.
11267
11268 2009-02-06  Ian Lance Taylor  <iant@google.com>
11269
11270         * object.cc (Sized_relobj::do_layout): Make info message start
11271         with lower case letter.
11272
11273 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11274
11275         * binary.cc: Fix file comment.
11276
11277         * options.h (enum Incremental_disposition): Define.
11278         (class General_options): Add new options: --incremental,
11279         --incremental_changed, --incremental_unchanged,
11280         --incremental_unknown.  Add incremental_disposition_ and
11281         implicit_incremental_ fields.
11282         (General_options::incremental_disposition): New function.
11283         (class Position_dependent_options): Add incremental_disposition
11284         option.
11285         (Position_dependent_options::copy_from_options): Set incremental
11286         dispositions.
11287         * options.cc (General_options::parse_incremental_changed): New
11288         function.
11289         (General_options::parse_incremental_unchanged): New function.
11290         (General_options::parse_incremental_unknown): New function.
11291         (General_options::General_options): Initialize new fields
11292         incremental_disposition_ and implicit_incremental_.
11293         (General_options::finalize): Check for uasge of --incremental-*
11294         without --incremental.
11295
11296 2009-02-06  Chris Demetriou  <cgd@google.com>
11297
11298         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11299         pointer and to report location as the file name associated with
11300         the symbol.
11301         (gold_undefined_symbol_at_location): New function to replace the
11302         old gold_undefined_symbol functionality.
11303         * target-reloc.h (relocate_section): Update to use
11304         gold_undefined_symbol_at_location.
11305         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11306         Call gold_undefined_symbol function rather than gold_error.
11307         * errors.h (Errors::undefined_symbol): Take location as a
11308         string, rather than calculating it from a relocation.
11309         * errors.cc (Errors::fatal): Print "fatal error:" before the
11310         formatted message.
11311         (Errors::error, Errors::error_at_location): Print "error: "
11312         before the formatted message.
11313         (Errors::undefined_symbol): Take location as a string, rather
11314         than calculating it from a relocation.
11315         (gold_undefined_symbol_at_location): New function akin to
11316         old gold_undefined_symbol, calculates location from relocation.
11317         (gold_undefined_symbol): Change to take only a Symbol pointer
11318         and to report location as the file name associated with the symbol.
11319         * testsuite/debug_msg.sh: Update for changed error messages.
11320         * testsuite/undef_symbol.sh: Likewise.
11321
11322 2009-02-04  Duncan Sands  <baldrick@free.fr>
11323
11324         PR 9812
11325         * reduced_debug_output.h
11326         (Output_reduced_debug_abbrev_section::failed): Use format for
11327         gold_warning.
11328         (Output_reduced_debug_info_section::faild): Likewise.
11329
11330 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11331
11332         * script.cc (Lazy_demangler): New class.
11333         (Version_script_info::get_symbol_version_helper): Demangle a
11334         symbol only once.
11335
11336 2009-01-29  Cary Coutant  <ccoutant@google.com>
11337
11338         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11339         to __tls_get_addr.
11340         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11341
11342 2009-01-28  Ian Lance Taylor  <iant@google.com>
11343
11344         * version.cc (version_string): Bump to 1.9.
11345
11346         * gold.h: Include <cstring> and <stdint.h>.
11347         * version.cc: Include <cstdio>.
11348         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11349         warning.
11350         * reduced_debug_output.cc (insert_into_vector): Rename from
11351         Insert_into_vector; change all callers.  Use Swap_unaligned to
11352         avoid aliasing issue; remove union since it is unnecessary.
11353
11354 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11355
11356         * Makefile.am (CCFILES): Add gc.cc.
11357         (HFILES): Add gc.h.
11358         * Makefile.in: Regenerate.
11359         * gold.cc (Gc_runner): New class.
11360         (queue_initial_tasks): Call garbage collection related tasks
11361         when corresponding options are invoked.
11362         (queue_middle_gc_tasks): New function.
11363         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11364         processed early before laying out sections during garbage collection.
11365         * gold.h (queue_middle_gc_tasks): New function.
11366         (is_prefix_of): Move from "layout.cc".
11367         * i386.cc (Target_i386::gc_process_relocs): New function.
11368         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11369         * main.cc (main): Create object of class "Garbage_collection".
11370         * object.cc (Relobj::copy_symbols_data): New function.
11371         (Relobj::is_section_name_included): New function.
11372         (Sized_relobj::do_layout): Allow this function to be called twice
11373         during garbage collection and defer layout of section during the
11374         first call.
11375         * object.h (Relobj::get_symbols_data): New function.
11376         (Relobj::is_section_name_included): New function.
11377         (Relobj::copy_symbols_data): New function.
11378         (Relobj::set_symbols_data): New function.
11379         (Relobj::get_relocs_data): New function.
11380         (Relobj::set_relocs_data): New function.
11381         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11382         (Relobj::gc_process_relocs): New function.
11383         (Relobj::do_gc_process_relocs): New pure virtual function.
11384         (Relobj::sd_): New data member.
11385         (Sized_relobj::is_output_section_offset_invalid): New function.
11386         (Sized_relobj::do_gc_process_relocs): New function.
11387         * options.h (General_options::gc_sections): Modify to not be a no-op.
11388         (General_options::print_gc_sections): New option.
11389         * plugin.cc (Plugin_finish::run): Remove function call to
11390         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11391         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11392         * reloc.cc (Read_relocs::run): Add task to process relocs and
11393         determine unreferenced sections when doing garbage collection.
11394         (Gc_process_relocs): New class.
11395         (Sized_relobj::do_gc_process_relocs): New function.
11396         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11397         sections that are garbage collected.
11398         * reloc.h (Gc_process_relocs): New class.
11399         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11400         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11401         symbols whose corresponding sections are garbage collected.
11402         (Symbol_table::Symbol_table): Add new parameter for the garbage
11403         collection object.
11404         (Symbol_table::gc_mark_undef_symbols): New function.
11405         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11406         (Symbol_table::gc_mark_dyn_syms): New function.
11407         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11408         as garbage.
11409         (Symbol_table::add_from_object): Likewise.
11410         (Symbol_table::add_from_relobj): When building shared objects, do not
11411         treat externally visible symbols as garbage.
11412         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11413         table information for static and relocatable links.
11414         * symtab.h (Symbol_table::set_gc): New function.
11415         (Symbol_table::gc): New function.
11416         (Symbol_table::gc_mark_undef_symbols): New function.
11417         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11418         (Symbol_table::gc_mark_dyn_syms): New function.
11419         (Symbol_table::gc_): New data member.
11420         * target.h (Sized_target::gc_process_relocs): New pure virtual
11421         function.
11422         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11423         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11424
11425 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11426
11427         * options.h (General_options::gc_sections): Define as a no-op for now.
11428         (General_options::no_keep_memory): Ditto.
11429         (General_options::Bshareable): Define.
11430         * options.cc (General_options::finalize): Honor -Bshareable.
11431
11432 2009-01-20  Andreas Schwab  <schwab@suse.de>
11433
11434         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11435         read the value in the contents, since we don't use it.  Use the
11436         template endianness when writing.
11437         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11438
11439 2009-01-19  Andreas Schwab  <schwab@suse.de>
11440
11441         * configure.tgt (powerpc64-*): Fix targ_obj.
11442
11443 2009-01-15  Ian Lance Taylor  <iant@google.com>
11444
11445         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11446         local symbols when stripping all symbols.
11447
11448 2009-01-14  Cary Coutant  <ccoutant@google.com>
11449
11450         * output.cc (Output_reloc): Add explicit instantiations.
11451
11452 2009-01-14  Cary Coutant  <ccoutant@google.com>
11453
11454         * archive.cc (Archive::get_elf_object_for_member): Remove call
11455         to File_read::claim_for_plugin.
11456         * descriptors.cc (Descriptors::open): Remove reference to
11457         is_claimed.
11458         (Descriptors::claim_for_plugin): Remove.
11459         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11460         (Descriptors::is_claimed): Remove.
11461         (claim_descriptor_for_plugin): Remove.
11462         * fileread.cc (File_read::claim_for_plugin): Remove.
11463         * fileread.h (File_read::claim_for_plugin): Remove.
11464         (File_read::descriptor): Reopen descriptor if necessary.
11465         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11466         (Plugin_manager::all_symbols_read): Add task parameter. Change
11467         all callers.
11468         (Plugin_manager::get_input_file): New function.
11469         (Plugin_manager::release_input_file): New function.
11470         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11471         corresponding data member.
11472         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11473         and pass to base constructor. Change all callers.
11474         (get_input_file, release_input_file): New functions.
11475         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11476         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11477         (Plugin_manager::all_symbols_read): Add task parameter.
11478         (Plugin_manager::get_input_file): New function.
11479         (Plugin_manager::release_input_file): New function.
11480         (Plugin_manager::task_): New data member.
11481         (Pluginobj::Pluginobj): Add filesize parameter.
11482         (Pluginobj::filename): New function.
11483         (Pluginobj::descriptor): New function.
11484         (Pluginobj::filesize): New function.
11485         (Pluginobj::filesize_): New data member.
11486         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11487         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11488         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11489
11490         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11491         with archive libraries.
11492         * testsuite/Makefile.in: Regenerate.
11493         * testsuite/plugin_test.c (struct sym_info): New type.
11494         (get_input_file, release_input_file): New static variables.
11495         (onload): Capture new transfer vector entries.
11496         (claim_file_hook): Stop reading at end of file according to filesize.
11497         Factor out parsing of readelf output into separate function.
11498         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11499         APIs and get the source file name from the symbol table.  Convert
11500         source file name to corresponding object file name.  Print info
11501         message when adding new input files.
11502         (parse_readelf_line): New function.
11503         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11504         * testsuite/plugin_test_2.sh: Likewise.
11505         * testsuite/plugin_test_3.sh: Likewise.
11506         * testsuite/plugin_test_4.sh: New test case.
11507
11508 2009-01-07  Ian Lance Taylor  <iant@google.com>
11509
11510         * version.cc (version_string): Bump to 1.8.
11511
11512 2008-12-23  Cary Coutant  <ccoutant@google.com>
11513
11514         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11515         * plugin.cc (Plugin_manager::finish): Rename as
11516         layout_deferred_objects.  Move cleanup to separate function.
11517         (Plugin_manager::cleanup): New function.
11518         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11519         separately.
11520         * plugin.h (Plugin_manager::finish): Rename as
11521         layout_deferred_objects.
11522         (Plugin_manager::cleanup): New function.
11523         (Plugin_manager::cleanup_done): New field.
11524
11525 2008-12-23  Cary Coutant  <ccoutant@google.com>
11526
11527         * plugin.cc (is_visible_from_outside): New function.
11528         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11529         so we don't return "IR only" status for exported symbols or -r links.
11530
11531         * testsuite/Makefile.am (plugin_test_3): New test case.
11532         * testsuite/Makefile.in: Regenerate.
11533         * testsuite/plugin_test_3.sh: New file.
11534
11535 2008-12-22  Cary Coutant  <ccoutant@google.com>
11536
11537         * object.cc (Sized_relobj::layout_section): New function.
11538         (Sized_relobj::do_layout): Defer layout of input sections until after
11539         plugin has provided replacement files.
11540         (Sized_relobj::do_layout_deferred_sections): New function.
11541         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11542         (Relobj::layout_deferred_sections): New function.
11543         (Relobj::do_layout_deferred_sections): New function.
11544         (Sized_relobj::do_layout_deferred_sections): New function.
11545         (Sized_relobj::layout_section): New function.
11546         (Sized_relobj::Deferred_layout): New structure.
11547         (Sized_relobj::deferred_layout_): New field.
11548         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11549         Change all callers.  Layout deferred sections.
11550         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11551         references.
11552         (Plugin_hook::run): Move code from do_plugin_hook inline.
11553         (Plugin_hook::do_plugin_hook): Remove.
11554         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11555         (Plugin_manager::finish): Renamed, was cleanup.
11556         (Plugin_manager::should_defer_layout): New function.
11557         (Plugin_manager::add_deferred_layout_object): New function.
11558         (Plugin_manager::Deferred_layout_list): New type.
11559         (Plugin_manager::deferred_layout_objects_): New field.
11560         (Plugin_hook::do_plugin_hook): Remove.
11561
11562 2008-12-17  Ian Lance Taylor  <iant@google.com>
11563
11564         * options.h (class General_options): Add --no case for
11565         --export-dynamic.
11566
11567 2008-12-16  Cary Coutant  <ccoutant@google.com>
11568
11569         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11570         vector.
11571         (Plugin_manager::claim_file): Create plugin object even if
11572         plugin did not call the add_symbols callback.
11573         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11574         asking for more symbols than were added.
11575         * testsuite/Makefile.am (plugin_test_1): Add test case with
11576         no global symbols.
11577         (empty.syms): New target.
11578         * testsuite/Makefile.in: Regenerate.
11579         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11580         message. Don't call add_symbols if no globals.
11581         (all_symbols_read_hook): Don't provide replacement for empty
11582         claimed file.
11583
11584 2008-12-12  Ian Lance Taylor  <iant@google.com>
11585
11586         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11587         r_type == 0 for a local symbol with r_sym == 0.
11588         (scan_relocatable_relocs): Pass r_sym to
11589         local_non_section_strategy.
11590         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11591         r_sym parameter.
11592
11593         * configure.ac: Update test for TLS descriptors: they are
11594         supported as of glibc 2.9.
11595         * configure: Rebuild.
11596
11597 2008-12-11  Ian Lance Taylor  <iant@google.com>
11598
11599         PR 7091
11600         * target-reloc.h (Default_scan_relocatable_relocs): For each
11601         function, map r_type == 0 to RELOC_DISCARD.
11602
11603 2008-12-10  Cary Coutant  <ccoutant@google.com>
11604
11605         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11606         object to override a kept COMDAT group from a plugin object.
11607
11608 2008-12-09  Ian Lance Taylor  <iant@google.com>
11609
11610         PR 7088
11611         * yyscript.y (file_cmd): Handle INPUT.
11612
11613         * testsuite/initpri1.c: Change all declarations to be full
11614         prototypes by adding void, to avoid compiler warnings.
11615
11616 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11617
11618         * options.cc (General_options::parse_plugin_opt): New.
11619         (General_options::add_plugin): The argument now is just the filename.
11620         (General_options::add_plugin_option): New.
11621         * options.h (plugin_opt): New.
11622         (add_plugin): Change argument name.
11623         (add_plugin_option): New.
11624         * plugin.cc (Plugin::load): Don't parse the plugin option.
11625         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11626         (Plugin::add_option): New.
11627         (Plugin::args_): Change type.
11628         (Plugin::filename_): New.
11629         (Plugin_manager::add_plugin_option): New.
11630         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11631         * testsuite/Makefile.in: Regenerate.
11632
11633 2008-12-05  Cary Coutant  <ccoutant@google.com>
11634
11635         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11636         Handle --strip-lto-sections option.
11637         * options.h (strip_lto_sections): New option.
11638
11639 2008-12-01  Cary Coutant  <ccoutant@google.com>
11640
11641         * plugin.cc (ld_plugin_message): Change format parameter to const.
11642         Fix mismatch between new[] and delete.
11643
11644 2008-11-14  Cary Coutant  <ccoutant@google.com>
11645
11646         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11647         instead of -1U.
11648
11649 2008-11-05  Craig Silverstein  <csilvers@google.com>
11650
11651         * options.cc (General_options::parse_dynamic_list): New function.
11652         * options.h (General_options): New flags dynamic_list,
11653         dynamic_list_data, dynamic_list_cpp_new, and
11654         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11655         (General_options::in_dynamic_list): New function.
11656         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11657         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11658         (Lex::can_continue_name): Likewise.
11659         (yylex): Likewise.
11660         (read_script_file): New parameter script_options.
11661         (read_dynamic_list): New function.
11662         (Script_options::define_dynamic_list): New function.
11663         (dynamic_list_keyword_parsecodes): New variable.
11664         (dynamic_list_keywords): New variable.
11665         * script.h (Script_options::define_dynamic_list): New function
11666         prototype.
11667         (read_dynamic_list): New function prototype.
11668         * symtab.cc (strprefix): New macro.
11669         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11670         dynamic_list_data, dynamic_list_cpp_new, and
11671         dynamic_list_cpp_typeinfo.
11672         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11673         (dynamic_list_expr): New rule.
11674         (dynamic_list_nodes): Likewise.
11675         (dynamic_list_node): Likewise.
11676         * testsuite/Makefile.am (dynamic_list): New test.
11677         * testsuite/Makefile.in: Regenerated.
11678         * testsuite/dynamic_list.t: New file.
11679         * testsuite/dynamic_list.sh: New file.
11680
11681 2008-11-05  Craig Silverstein  <csilvers@google.com>
11682
11683         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11684         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11685         (t11_last): Likewise.
11686         * testsuite/ver_test_6.c (main): Likewise.
11687
11688 2008-10-07  Cary Coutant  <ccoutant@google.com>
11689
11690         * options.c (General_options::finalize): Add check for -static and
11691         -shared.
11692         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11693         is not empty.
11694
11695 2008-10-02  Cary Coutant  <ccoutant@google.com>
11696
11697         * plugin.cc (make_sized_plugin_object): Fix conditional
11698         compilation to work when not all targets are enabled.
11699
11700 2008-09-29  Cary Coutant  <ccoutant@google.com>
11701
11702         * archive.cc (Archive::get_file_and_offset): Use filename instead
11703         of name to get library path.
11704         (Archive::include_member): Unlock external member of a thin archive.
11705
11706         * testsuite/Makefile.am (TEST_AR): New variable.
11707         (thin_archive_test_1): New test.
11708         (thin_archive_test_2): New test.
11709         * testsuite/Makefile.in: Regenerate.
11710         * testsuite/thin_archive_main.cc: New file.
11711         * testsuite/thin_archive_test_1.cc: New file.
11712         * testsuite/thin_archive_test_2.cc: New file.
11713         * testsuite/thin_archive_test_3.cc: New file.
11714         * testsuite/thin_archive_test_4.cc: New file.
11715
11716 2008-09-29  Cary Coutant  <ccoutant@google.com>
11717
11718         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11719         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11720         instead of -1U.
11721         (Sized_relobj::do_finalize_local_symbols): Likewise.
11722         (Sized_relobj::map_to_kept_section): Likewise.
11723         * object.h (Sized_relobj::invalid_address): New constant.
11724         (Sized_relobj::do_output_section_offset): Check for invalid_address
11725         and return -1ULL.
11726         * output.cc (Output_reloc::local_section_offset): Use constant
11727         invalid_address instead of -1U.
11728         (Output_reloc::get_address): Likewise.
11729         (Output_section::output_address): Change -1U to -1ULL.
11730         * output.h (Output_reloc::invalid_address): New constant.
11731         * reloc.cc (Sized_relobj::write_sections): Use constant
11732         invalid_address instead of -1U.
11733         (Sized_relobj::relocate_sections): Likewise.
11734         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11735         values for merge sections.
11736         * target-reloc.h (relocate_for_relocatable): Use constant
11737         invalid_address instead of -1U.
11738
11739 2008-09-19  Cary Coutant  <ccoutant@google.com>
11740
11741         Add plugin functionality for link-time optimization (LTO).
11742         * configure.ac (plugins): Add --enable-plugins option.
11743         * configure: Regenerate.
11744         * config.in: Regenerate.
11745         * Makefile.am (LIBDL): New variable.
11746         (CCFILES): Add plugin.cc.
11747         (HFILES): Add plugin.h.
11748         (ldadd_var): Add LIBDL.
11749         * Makefile.in: Regenerate.
11750
11751         * archive.cc: Include "plugin.h".
11752         (Archive::setup): Don't preread archive symbols when using a plugin.
11753         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11754         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11755         files.
11756         (Archive::include_member): Add symbols from plugin objects.
11757         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11758         * descriptors.cc (Descriptors::open): Check for file descriptors
11759         abandoned by plugins.
11760         (Descriptors::claim_for_plugin): New function.
11761         * descriptors.h (Descriptors::claim_for_plugin): New function.
11762         (Open_descriptor::is_claimed): New field.
11763         (claim_descriptor_for_plugin): New function.
11764         * fileread.cc (File_read::claim_for_plugin): New function.
11765         * fileread.h (File_read::claim_for_plugin): New function.
11766         (File_read::descriptor): New function.
11767         * gold.cc: Include "plugin.h".
11768         (queue_initial_tasks): Add task to call plugin hooks for generating
11769         new object files.
11770         * main.cc: Include "plugin.h".
11771         (main): Load plugin libraries.
11772         * object.h (Pluginobj): Declare.
11773         (Object::pluginobj): New function.
11774         (Object::do_pluginobj): New function.
11775         (Object::set_target): New function.
11776         * options.cc: Include "plugin.h".
11777         (General_options::parse_plugin): New function.
11778         (General_options::General_options): Initialize plugins_ field.
11779         (General_options::add_plugin): New function.
11780         * options.h (Plugin_manager): Declare.
11781         (General_options): Add --plugin option.
11782         (General_options::has_plugins): New function.
11783         (General_options::plugins): New function.
11784         (General_options::add_plugin): New function.
11785         (General_options::plugins_): New field.
11786         * plugin.cc: New file.
11787         * plugin.h: New file.
11788         * readsyms.cc: Include "plugin.h".
11789         (Read_symbols::do_read_symbols): Check for archive before checking
11790         for ELF file.  Call plugin hooks to claim files.
11791         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11792         from a real object file; force override when processing replacement
11793         files.
11794         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11795         (Symbol::init_base_object): Likewise.
11796         (Symbol::init_base_output_data): Likewise.
11797         (Symbol::init_base_output_segment): Likewise.
11798         (Symbol::init_base_constant): Likewise.
11799         (Symbol::init_base_undefined): Likewise.
11800         (Symbol::output_section): Assert that object is not a plugin.
11801         (Symbol_table::add_from_pluginobj): New function.
11802         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11803         undefined.
11804         (Symbol_table::sized_write_globals): Likewise.
11805         (Symbol_table::add_from_pluginobj): Instantiate template.
11806         * symtab.h (Sized_pluginobj): Declare.
11807         (Symbol::in_real_elf): New function.
11808         (Symbol::set_in_real_elf): New function.
11809         (Symbol::in_real_elf_): New field.
11810         (Symbol_table::add_from_pluginobj): New function.
11811
11812         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11813         (LIBDL): New variable.
11814         (LDADD): Add LIBDL.
11815         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11816         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11817         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11818         (MOSTLYCLEANFILES): Likewise.
11819         * testsuite/Makefile.in: Regenerate.
11820         * testsuite/plugin_test.c: New file.
11821         * testsuite/plugin_test_1.sh: New file.
11822         * testsuite/plugin_test_2.sh: New file.
11823
11824 2008-09-16  Ian Lance Taylor  <iant@google.com>
11825
11826         * target-reloc.h (relocate_section): Check whether a symbol is
11827         defined by the ABI before reporting an undefined symbol error.
11828         * target.h (Target::is_defined_by_abi): Make parameter const.
11829         (Target::do_is_defined_by_abi): Likewise.
11830         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11831         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11832         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11833         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11834         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11835         * testsuite/Makefile.in: Rebuild.
11836
11837         * fileread.cc (make_view): Add casts to avoid warning.
11838
11839 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11840
11841         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11842         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11843
11844 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11845
11846         * options.h (General_options::output_is_executable): New.
11847         (General_options::output_is_pie): New.
11848         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11849         for shared libraries.
11850         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11851
11852 2008-09-11  Chris Demetriou  <cgd@google.com>
11853
11854         * options.h (origin): New -z option.
11855         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11856         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11857         in DT_FLAGS_1.
11858
11859 2008-09-05  Cary Coutant  <ccoutant@google.com>
11860
11861         * fileread.cc (File_read::make_view): Add check for attempt to map
11862         beyond end of file.
11863
11864 2008-09-05  Cary Coutant  <ccoutant@google.com>
11865
11866         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11867         explicit instantiations.
11868
11869 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11870
11871         PR gold/6858
11872         * options.cc (General_options::finalize): Allow undefined symbols
11873         in shlibs if linking -shared.
11874
11875         PR gold/6859
11876         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11877         symbols as not needing a dynsym entry.
11878
11879 2008-08-20  Craig Silverstein  <csilvers@google.com>
11880
11881         * fileread.cc (File_read::open): Do not lock the file unless it
11882         was successfully opened.
11883
11884 2008-08-14  Cary Coutant  <ccoutant@google.com>
11885
11886         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11887         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11888         * testsuite/tls_test.cc (struct int128): 128-bit struct
11889         for testing TLS relocs with non-zero addend.
11890         (v12): New TLS variable.
11891         (t12): New test.
11892         (t_last): Add check for v12.
11893         * testsuite/tls_test.h (t12): New function.
11894         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11895
11896 2008-08-13  Ian Lance Taylor  <iant@google.com>
11897
11898         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11899         set tls_segment_ or relro_segment_.
11900         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11901         when appropriate.
11902         * output.h (Output_section::clear_is_relro): New function.
11903         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11904         sections specially even when output_data_ is empty.
11905         (Output_segment::maximum_alignment): When first section is relro,
11906         only force alignment for PT_LOAD segments.
11907         * script.cc (script_data_segment_align): New function.
11908         (script_data_segment_relro_end): New function.
11909         * script-c.h (script_data_segment_align): Declare.
11910         (script_data_segment_relro_end): Declare.
11911         * script-sections.h (class Script_sections): Declare
11912         data_segment_align and data_segment_relro_end.  Add fields
11913         segment_align_index_ and saw_relro_end_.
11914         * script-sections.cc (class Sections_element): Add set_is_relro
11915         virtual function.  Add new bool* parameter to place_orphan_here.
11916         Add get_output_section virtual function.
11917         (class Output_section_definition): Add set_is_relro.  Add new
11918         bool* parameter to place_orphan_here.  Add get_output_section.
11919         Add is_relro_ field.
11920         (Output_section_definition::Output_section_definition): Initialize
11921         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11922         and is_relro_ fields.
11923         (Output_section_definition::place_orphan_here): Add is_relro
11924         parameter.
11925         (Output_section_definition::set_section_addresses): Set relro for
11926         output section.
11927         (Output_section_definition::alternate_constraint): Likewise.
11928         (class Orphan_output_section): Add new bool* parameter to
11929         place_orphan_here.  Add get_output_section.
11930         (Orphan_output_section::place_orphan_here): Add is_relro
11931         parameter.
11932         (Script_sections::Script_sections): Initialize
11933         data_segment_align_index_ and saw_relro_end_.
11934         (Script_sections::data_segment_align): New function.
11935         (Script_sections::data_segment_relro_end): New function.
11936         (Script_sections::place_orphan): Set or clear is_relro.
11937         (Script_sections::set_section_addresses): Force alignment of first
11938         TLS section.
11939         * yyscript.y (exp): Call script_data_segment_align and
11940         script_data_segment_relro_end.
11941         * testsuite/relro_script_test.t: New file.
11942         * testsuite/relro_test.cc (using_script): Declare.
11943         (t1, t2): Test using_script.
11944         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11945         (relro_script_test_SOURCES): Define.
11946         (relro_script_test_DEPENDENCIES): Define.
11947         (relro_script_test_LDFLAGS): Define.
11948         (relro_script_test_LDADD): Define.
11949         (relro_script_test.so): New target.
11950         * testsuite/Makefile.in: Rebuild.
11951
11952 2008-08-06  Cary Coutant <ccoutant@google.com>
11953
11954         * archive.cc (Archive::total_archives, Archive::total_members)
11955         (Archive::total_members_loaded): New variables.
11956         (Archive::setup): Add parameter.  Add option to preread
11957         archive symbols.
11958         (Archive::read_armap): Add counter.
11959         (Archive::get_file_and_offset): New function.
11960         (Archive::get_elf_object_for_member): New function.
11961         (Archive::read_all_symbols): New function.
11962         (Archive::read_symbols): New function.
11963         (Archive::add_symbols): Add counters.
11964         (Archive::include_all_members): Use armap to find members if it's
11965         already built.
11966         (Archive::include_member): Skip reading symbols if already read.
11967         Factored code into Archive::get_file_and_offset and
11968         Archive::get_elf_object_for_member.  Changed call to
11969         Mapfile::report_include_archive_member.
11970         (Archive::print_stats): New function.
11971         * archive.h: Declare Object and Read_symbols_data classes.
11972         (Archive::Archive): Add initializers for new members.
11973         (Archive::setup): Add parameter.
11974         (Archive::print_stats): New function.
11975         (Archive::total_archives, Archive::total_members)
11976         (Archive::total_members_loaded): New variables.
11977         (Archive::get_file_and_offset): New function.
11978         (Archive::get_elf_object_for_member): New function.
11979         (Archive::read_all_symbols): New function.
11980         (Archive::read_symbols): New function.
11981         (Archive::Archive_member): New class.
11982         (Archive::members_): New member.
11983         (Archive::num_members_): New member.
11984         * main.cc: Include archive.h.
11985         (main): Call Archive::print_stats.
11986         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11987         archive parameter; member_name is now the fully-decorated name.
11988         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11989         * options.h: (General_options): Add --preread-archive-symbols option.
11990         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11991         Archive::setup.
11992
11993 2008-08-04  Ian Lance Taylor  <iant@google.com>
11994
11995         * symtab.h (Symbol::use_plt_offset): New function.
11996         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11997         * powerpc.cc (Relocate::relocate): Likewise.
11998         * sparc.cc (Relocate::relocate): Likewise.
11999         * x86_64.cc (Relocate::relocate): Likewise.
12000         * testsuite/weak_plt.sh: New test.
12001         * testsuite/weak_plt_main.cc: New test.
12002         * testsuite/weak_plt_shared.cc: New test.
12003         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12004         (check_PROGRAMS): Add weak_plt.
12005         (check_DATA): Add weak_plt_shared.so.
12006         (weak_plt_main_pic.o, weak_plt): New targets.
12007         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12008         * testsuite/Makefile.in: Rebuild.
12009
12010         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12011         gcctestdir/ld.
12012         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12013         * testsuite/Makefile.in: Rebuild.
12014
12015 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12016
12017         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12018         * Makefile.in: Regenerate.
12019         * po/POTFILES.in: Regenerate.
12020
12021 2008-07-29  Ian Lance Taylor  <iant@google.com>
12022
12023         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12024         symbols before other symbols.
12025         * testsuite/script_test_2.cc (test_addr): Declare.
12026         (test_addr_alias): Declare.
12027         (main): Check that test_addr and test_addr_alias have the right
12028         values.
12029         * testsuite/script_test_2.t: Define test_addr_alias and
12030         test_addr.
12031
12032 2008-07-24  Ian Lance Taylor  <iant@google.com>
12033
12034         PR 5990
12035         * descriptors.cc: New file.
12036         * descriptors.h: New file.
12037         * gold-threads.h (class Hold_optional_lock): New class.
12038         * fileread.cc: Include "descriptors.h".
12039         (File_read::~File_read): Release descriptor rather than closing
12040         it.
12041         (File_read::open) [file]: Call open_descriptor rather than open.
12042         Set is_descriptor_opened_.
12043         (File_read::open) [memory]: Assert that descriptor is not open.
12044         (File_read::reopen_descriptor): New function.
12045         (File_read::release): Release descriptor.
12046         (File_read::do_read): Make non-const.  Reopen descriptor.
12047         (File_read::read): Make non-const.
12048         (File_read::make_view): Reopen descriptor.
12049         (File_read::do_readv): Likewise.
12050         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12051         Update declarations.
12052         * layout.cc: Include "descriptors.h".
12053         (Layout::create_build_id): Use open_descriptor rather than open.
12054         * output.cc: Include "descriptors.h".
12055         (Output_file::open): Use open_descriptor rather than open.
12056         * archive.cc (Archive::const_iterator): Change Archive to be
12057         non-const.
12058         (Archive::begin, Archive::end): Make non-const.
12059         (Archive::count_members): Likewise.
12060         * archive.h (class Archive): Update declarations.
12061         * object.h (Object::read): Make non-const.
12062         * Makefile.am (CCFILES): Add descriptors.cc.
12063         (HFILES): Add descriptors.h.
12064         * Makefile.in: Rebuild.
12065
12066         PR 6716
12067         * gold.h: Always include <clocale>.  Add Solaris workarounds
12068         following code in binutils/sysdep.h.
12069
12070         PR 6048
12071         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12072         this->eh_frame_hdr_ is NULL before using it.
12073
12074         * dynobj.cc (Versions::Versions): Update comment.
12075
12076         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12077         the base version name.
12078
12079         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12080         array size plus one.
12081         (Stringpool_template::set_string_offsets): Subtract one from key
12082         before using it as an array index.
12083         (Stringpool_template::get_offset_with_length): Likewise.
12084         (Stringpool_template::write_to_buffer): Likewise.
12085         * stringpool.h (Stringpool_template::get_offset_from_key):
12086         Likewise.
12087
12088 2008-07-23  Ian Lance Taylor  <iant@google.com>
12089
12090         PR 6658
12091         * object.h (Merged_symbol_value::value): Do our best to handle a
12092         negative addend.
12093
12094         PR 6647
12095         * script.cc (Version_script_info::get_versions): Don't add empty
12096         version tag to return value.
12097         (Version_script_info::get_symbol_version_helper): Change return
12098         type to bool.  Add pversion parameter.  Change all callers.
12099         (script_register_vers_node): Don't require a non-NULL tag.
12100         * script.h (class Version_script_info): Update declarations.
12101         (Version_script_info::get_symbol_version): Change return type to
12102         bool.  Add version parameter.  Change all callers.
12103         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12104         handling.  Handle an empty version from a version script.
12105         (Symbol_table::define_special_symbol): Likewise.
12106         * testsuite/ver_test_10.script: New file.
12107         * testsuite/ver_test_10.sh: New file.
12108         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12109         (check_DATA): Add ver_test_10.syms.
12110         (ver_test_10.syms, ver_test_10.so): New target.
12111         * testsuite/Makefile.in: Rebuild.
12112
12113 2008-07-23  Simon Baldwin  <simonb@google.com>
12114
12115         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12116         to zero for undefined symbols from dynamic libraries.
12117
12118 2008-07-23  Ian Lance Taylor  <iant@google.com>
12119
12120         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12121         Change all callers.
12122         * symtab.h (class Symbol_table): Update declaration.
12123         * testsuite/ver_test_9.cc: New file.
12124         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12125         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12126         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12127         (ver_test_9.so, ver_test_9.o): New targets.
12128         * testsuite/Makefile.in: Rebuild.
12129
12130 2008-07-22  Ian Lance Taylor  <iant@google.com>
12131
12132         * options.h (class General_options): Define --check-sections.
12133         * layout.cc (Layout::set_segment_offsets): Handle
12134         --check-sections.
12135
12136         * options.h (class General_options): Define -n/--nmagic and
12137         -N/--omagic.
12138         * options.cc (General_options::finalize): For -n/--nmagic or
12139         -N/--omagic, set -static.
12140         * layout.cc (Layout::attach_allocated_section_to_segment): If
12141         -N/--omagic, don't put read-only and read-write sections in
12142         different segments.
12143         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12144         finding a read-only segment.
12145         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12146         don't set the minimum segment alignment to the common page size,
12147         and don't set the file offset to the address modulo the page size.
12148         * script-sections.cc (Script_sections::create_segments): If
12149         -n/--omagic, don't put read-only and read-write sections in
12150         different segments.
12151
12152         * cref.cc: New file.
12153         * cref.h: New file.
12154         * options.h (class General_options): Add --print-symbol-counts.
12155         * main.cc (main): Issue defined symbol report if requested.
12156         * archive.cc (Archive::interpret_header): Make into a const member
12157         function.
12158         (Archive::add_symbols): Call Input_objects::archive_start and
12159         archive_stop.
12160         (Archive::const_iterator): Define new class.
12161         (Archive::begin, Archive::end): New functions.
12162         (Archive::include_all_members): Rewrite to use iterator.
12163         (Archive::count_members): New function.
12164         * archive.h (class Archive): Update declarations.
12165         (Archive::filename): New function.
12166         * object.cc: Include "cref.h".
12167         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12168         (Sized_relobj::do_get_global_symbol_counts): New function.
12169         (Input_objects::add_object): Add object to cross-referencer.
12170         (Input_objects::archive_start): New function.
12171         (Input_objects::archive_stop): New function.
12172         (Input_objects::print_symbol_counts): New function.
12173         * object.h: Declare Cref and Archive.
12174         (Object::get_global_symbol_counts): New function.
12175         (Object::do_get_global_symbol_counts): New pure virtual function.
12176         (class Sized_relobj): Add defined_count_ field.  Update
12177         declarations.
12178         (class Input_objects): Add cref_ field.  Update constructor.
12179         Update declarations.
12180         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12181         defined_count_.
12182         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12183         symbol counts.
12184         (Sized_dynobj::do_get_global_symbol_counts): New function.
12185         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12186         defined_count_.  Update declarations.  Define Symbols typedef.
12187         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12188         parameter.  Change all callers.
12189         (Symbol_table::add_from_dynobj): Add sympointers and defined
12190         parameters.  Change all callers.
12191         * symtab.h (class Symbol_table): Update declarations.
12192         * Makefile.am (CCFILES): Add cref.cc.
12193         (HFILES): Add cref.h.
12194         * Makefile.in: Rebuild.
12195
12196 2008-07-22  Simon Baldwin  <simonb@google.com>
12197
12198         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12199         to zero when writing undefined symbols.
12200
12201 2008-07-22  Ian Lance Taylor  <iant@google.com>
12202
12203         * output.cc (Output_section::add_input_section): Don't try to
12204         merge empty merge sections.
12205
12206 2008-07-21  Craig Silverstein  <csilvers@google.com>
12207
12208         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12209         Include symbol version in error message.
12210
12211 2008-07-20  Chris Demetriou  <cgd@google.com>
12212
12213         * configure.ac (gold_cv_c_random_seed): New configured variable.
12214         (RANDOM_SEED_CFLAGS): New substituted variable.
12215         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12216         * configure: Rebuild.
12217         * Makefile.in: Likewise.
12218         * testsuite/Makefile.in: Likewise.
12219
12220 2008-07-18  Ian Lance Taylor  <iant@google.com>
12221
12222         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12223         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12224         * testsuite/ver_test_main.cc (main): Call t4.
12225         (t4, t4_2a): Define.
12226         * testsuite/ver_test_2.cc (t4_2): Define.
12227         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12228         * testsuite/ver_test_4.cc (t4_2a): Define.
12229         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12230         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12231
12232 2008-07-17  Ian Lance Taylor  <iant@google.com>
12233
12234         * dynobj.cc (Versions::add_def): If we give an error about a
12235         missing version, go ahead and create the version anyhow.
12236
12237 2008-07-10  Ian Lance Taylor  <iant@google.com>
12238
12239         Handle output sections with more than 0x7fffffff bytes.
12240         * object.h (class Relobj): Change map_to_output_ to
12241         output_sections_, and just keep a section pointer.  Change all
12242         uses.  Move comdat group support to Sized_relobj.
12243         (Relobj::is_section_specially_mapped): Remove.
12244         (Relobj::output_section): Remove poff parameter.  Change all
12245         callers.
12246         (Relobj::output_section_offset): New function.
12247         (Relobj::set_section_offset): Rewrite.
12248         (Relobj::map_to_output): Remove.
12249         (Relobj::output_sections): New function.
12250         (Relobj::do_output_section_offset): New pure virtual function.
12251         (Relobj::do_set_section_offset): Likewise.
12252         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12253         group support from Relobj.  Update declarations.
12254         (Sized_relobj::get_output_section_offset): New function.
12255         (Sized_relobj::do_output_section_offset): New function.
12256         (Sized_relobj::do_set_section_offset): New function.
12257         * object.cc (Relobj::output_section_address): Remove.
12258         (Sized_relobj::Sized_relobj): Initialize new fields.
12259         (Sized_relobj::include_section_group): Cast find_kept_object to
12260         Sized_relobj.
12261         (Sized_relobj::include_linkonce_section): Likewise.
12262         (Sized_relobj::do_layout): Use separate arrays for output section
12263         and output offset.
12264         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12265         output_sections.
12266         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12267         output_sections and section_offsets.
12268         (Sized_relobj::write_local_symbols): Likewise.
12269         (map_to_kept_section): Compute output address directly.
12270         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12271         output_sections and section_offsets.
12272         (Sized_relobj::write_sections): Likewise.
12273         (Sized_relobj::relocate_sections): Likewise.
12274         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12275         * output.h (class Output_reloc): Update declarations.  Change
12276         u2_.relobj to Sized_relobj*.
12277         (class Output_data_reloc): Change add functions to use
12278         Sized_relobj*.
12279         * output.cc (Output_reloc::Output_reloc): Change relobj to
12280         Sized_relobj*.
12281         (Output_reloc::local_section_offset): Change return type to
12282         Elf_Addr.  Use get_output_section_offset.
12283         (Output_reloc::get_address): Likewise.
12284         (Output_section::is_input_address_mapped): Don't call
12285         is_section_specially_mapped.
12286         (Output_section::output_offset): Likewise.
12287         (Output_section::output_address): Likewise.
12288         (Output_section::starting_output_address): Likewise.
12289         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12290         parameter to Sized_relobj*.
12291         (Copy_relocs::need_copy_reloc): Likewise.
12292         (Copy_relocs::save): Likewise.
12293         * copy-relocs.h (class Copy_relocs): Update declarations.
12294         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12295         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12296         * target-reloc.h (relocate_for_relocatable): Change
12297         offset_in_output_section type to Elf_Addr.  Change code that uses
12298         it as well.
12299         * layout.cc (Layout::layout): Always set *off.
12300         * mapfile.cc (Mapfile::print_input_section): Use
12301         output_section_offset.
12302         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12303         Sized_relobj*.
12304         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12305         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12306         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12307
12308 2008-07-03  Ian Lance Taylor  <iant@google.com>
12309
12310         * layout.cc (Layout::include_section): Do not discard unrecognized
12311         SHT_STRTAB sections.
12312
12313 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12314
12315         * script.cc (Lex::can_continue_name): Make '?' allowable in
12316         version-script names.
12317         * testsuite/version_script.map: Change glob pattern to use '?'
12318
12319 2008-06-30  Manish Singh  <yosh@gimp.org>
12320
12321         PR 6585
12322         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12323         Correct typo.
12324
12325 2008-06-30  Ian Lance Taylor  <iant@google.com>
12326
12327         PR 6660
12328         PR 6682
12329         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12330         versions]: Don't try to read the value in the contents, since we
12331         don't use it.  Use the template endianness when writing.
12332
12333 2008-06-25  Cary Coutant  <ccoutant@google.com>
12334
12335         * fileread.cc (File_read::make_view): Assert on zero-length view.
12336         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12337         symbol table when there are no symbols to read.
12338
12339 2008-06-23  Craig Silverstein  <csilvers@google.com>
12340
12341         * version.cc (version_string): Bump to 1.7
12342
12343 2008-06-18  Craig Silverstein  <csilvers@google.com>
12344
12345         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12346         constant 0xFFFF to type Valtype.
12347         (Powerpc_relocate_functions::rel16_ha): Likewise.
12348
12349 2008-06-17  Ian Lance Taylor  <iant@google.com>
12350
12351         * output.h (Output_section::Input_section): Initialize p2align_ to
12352         zero for Output_section_data constructors.
12353         (Output_section::Input_section::addralign): If not an input
12354         section, return the alignment of the Output_section_data.
12355         * testsuite/copy_test.cc: New file.
12356         * testsuite/copy_test_1.cc: New file.
12357         * testsuite/copy_test_2.cc: New file.
12358         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12359         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12360         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12361         (copy_test_1_pic.o, copy_test_1.so): New targets.
12362         (copy_test_2_pic.o, copy_test_2.so): New targets.
12363         * testsuite/Makefile.in: Rebuild.
12364
12365         * script-sections.cc (Script_sections::place_orphan): Initialize
12366         local variable exact.
12367
12368 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12369
12370         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12371
12372 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12373             David S. Miller  <davem@davemloft.net>
12374
12375         * powerpc.cc: New file.
12376         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12377         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12378         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12379         * Makefile.in: Rebuild.
12380
12381 2008-06-09  Ian Lance Taylor  <iant@google.com>
12382
12383         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12384         <exception>.
12385         (throwing, orig_terminate): New static variables.
12386         (terminate_handler): New static function.
12387         (t2): Set terminate handler.
12388
12389 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12390
12391         PR 6584
12392         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12393         alignment.
12394
12395 2008-05-30  Cary Coutant  <ccoutant@google.com>
12396
12397         * archive.cc (Archive::include_all_members) Correct to step
12398         over symbol table and extended name table in thin archives.
12399
12400 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12401
12402         PR 6407
12403         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12404         calculation.
12405
12406 2008-05-28  Caleb Howe  <cshowe@google.com>
12407
12408         * reduced_debug_output.cc: New file.
12409         * reduced_debug_output.h: New file.
12410         * options.h (class General_options): Add --strip-debug-non-line.
12411         * options.cc (General_options::finalize): Add strip_debug_non_line
12412         to the strip heirarchy.
12413         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12414         fields.
12415         * layout.cc: Include "reduced_debug_output.h".
12416         (Layout::Layout): Initialize new fields.
12417         (line_only_debug_sections): New static array.
12418         (is_lines_only_debug_sections): New static inline function.
12419         (Layout::include_section): Handle --strip-debug-non-line.
12420         (Layout::make_output_section): If --strip-debug-non-line, build
12421         new output sections for .debug_abbrev and .debug_info.
12422         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12423         gold.  Warn about possible overflow.
12424         (read_signed_LEB_128): Likewise.
12425         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12426         (read_signed_LEB_128): Declare.
12427         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12428         (HFILES): Add reduced_debug_output.h.
12429         * Makefile.in: Rebuild.
12430
12431 2008-05-21  Ian Lance Taylor  <iant@google.com>
12432
12433         * mapfile.cc: New file.
12434         * mapfile.h: New file.
12435         * options.h (class General_options): Add -M/--print-map and -Map.
12436         * options.cc (General_options::finalize): Make -M equivalent to
12437         -Map -.
12438         * main.cc: Include <cstdio> and "mapfile.h".
12439         (main): Open mapfile if requested.
12440         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12441         constructor.  Change caller.
12442         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12443         (queue_middle_tasks): Likewise.
12444         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12445         declarations.
12446         * archive.cc: Include "mapfile.h".
12447         (Archive::add_symbols): Add mapfile parameter.  Change all
12448         callers.  Pass mapfile, symbol, and reason to include_member.
12449         (Archive::include_all_members): Add mapfile parameter.  Change all
12450         callers.
12451         (Archive::include_member): Add mapfile, sym, and why parameters.
12452         Change all callers.  Report inclusion to map file.
12453         * archive.h: Include "fileread.h".
12454         (class Archive): Update declarations.
12455         (Archive::file): New const method.
12456         (class Add_archive_symbols): Add mapfile_ field.  Update
12457         constructor.  Change all callers.
12458         * readsyms.h (class Read_symbols): Likewise.
12459         (class Finish_group): Likewise.
12460         (class Read_script): Likewise.
12461         * common.cc: Include "mapfile.h".
12462         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12463         all callers.
12464         (Symbol_table::do_allocate_commons): Likewise.
12465         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12466         symbol allocation to mapfile.
12467         * common.h (class Allocate_commons_task): Add mapfile_ field.
12468         Update constructor.  Change all callers.
12469         * symtab.h (class Symbol_table): Update declarations.
12470         * layout.cc: Include "mapfile.h".
12471         (Layout_task_runner::run): Print information to mapfile.
12472         (Layout::create_gold_note): Change Output_data_fixed_space to
12473         Output_data_zero_fill.
12474         (Layout::create_build_id): Likewise.
12475         (Layout::print_to_mapfile): New function.
12476         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12477         constructor.  Change caller.
12478         (class Layout): Declare print_to_mapfile.
12479         * output.cc (Output_section::Input_section::print_to_mapfile): New
12480         function.
12481         (Output_section::add_input_section): If producing a map, always
12482         add to input_sections_ list.
12483         (Output_section::do_print_to_mapfile): New function.
12484         (Output_segment::print_sections_to_mapfile): New function.
12485         (Output_segment::print_section_list_to_mapfile): New function.
12486         * output.h: Include "mapfile.h".
12487         (Output_data::print_to_mapfile): New function.
12488         (Output_data::do_print_to_mapfile): New virtual function.
12489         (Output_segment_headers::do_print_to_mapfile): New function.
12490         (Output_file_header::do_print_to_mapfile): New function.
12491         (Output_data_const::do_print_to_mapfile): New function.
12492         (class Output_data_const_buffer): Add map_name_ field.  Update
12493         constructor.  Change all callers.  Add do_print_to_mapfile
12494         function.
12495         (class Output_data_fixed_space): Likewise.
12496         (class Output_data_space): Likewise.
12497         (class Output_data_zero_fill): New class.
12498         (Output_data_strtab::do_print_to_mapfile): New function.
12499         (Output_data_reloc_base::do_print_to_mapfile): New function.
12500         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12501         (Output_data_group::do_print_to_mapfile): New function.
12502         (Output_data_got::do_print_to_mapfile): New function.
12503         (Output_data_dynamic::do_print_to_mapfile): New function.
12504         (Output_symtab_xindex::do_print_to_mapfile): New function.
12505         (class Output_section): Declare do_print_to_mapflie.  Declare
12506         print_to_mapfile in Input_section.
12507         (class Output_segment): Declare new functions.
12508         * object.h (Sized_relobj::symbol_count): New function.
12509         * script-sections.cc
12510         (Output_section_element_dot_assignment::set_section_addresses):
12511         Change Output_data_fixed_space to Output_data_zero_fill.
12512         (Output_data_expression::do_print_to_mapfile): New function.
12513         * script.cc (read_input_script): Add mapfile parameter.  Change
12514         all callers.
12515         * script.h (read_input_script): Update declaration.
12516         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12517         (Eh_frame::do_print_to_mapfile): New function.
12518         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12519         (Output_merge_string::do_print_to_mapfile): New function.
12520         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12521         function.
12522         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12523         function.
12524         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12525         function.
12526         * Makefile.am (CCFILES): Add mapfile.cc.
12527         (HFILES): Add mapfile.h.
12528         * Makefile.in: Rebuild.
12529
12530 2008-05-19  Ian Lance Taylor  <iant@google.com>
12531
12532         * options.h (class General_options): Add -z relro.
12533         * layout.cc (Layout::Layout): Initialize relro_segment_.
12534         (Layout::add_output_section_data): Return the output section.
12535         (Layout::make_output_section): Rcognize relro sections and mark
12536         them appropriately.
12537         (Layout::attach_allocated_section_to_segment): Put relro sections
12538         in a PT_GNU_RELRO segment.
12539         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12540         section as relro.
12541         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12542         PT_TLS segments.
12543         (Layout::linkonce_mapping): Map d.rel.ro.local to
12544         .data.rel.ro.local.
12545         (Layout::output_section_name): Us .data.rel.ro.local for any
12546         section which begins with that.
12547         * layout.h (class Layout): Update add_output_section_data
12548         declaration.  Add relro_segment_ field.
12549         * output.cc (Output_section::Output_section): Initialize is_relro_
12550         and is_relro_local_ fields.
12551         (Output_segment::add_output_section): Group relro sections.
12552         (Output_segment::is_first_section_relro): New function.
12553         (Output_segment::maximum_alignment): If there is a relro section,
12554         align the segment to the common page size.
12555         (Output_segment::set_section_addresses): Track whether we are
12556         looking at relro sections.  If the last section is a relro
12557         section, align to the common page size.
12558         (Output_segment::set_section_list_addresses): Add in_relro
12559         parameter.  Change all callers.  Align to the page size when
12560         moving from relro to non-relro section.
12561         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12562         segment.
12563         * output.h (class Output_section): Add is_relro_ and
12564         is_relro_local_ fields.
12565         (Output_section::is_relro): New function.
12566         (Output_section::set_is_relro): New function.
12567         (Output_section::is_relro_local): New function.
12568         (Output_section::set_is_relro_local): New function.
12569         (class Output_segment): Update declarations.
12570         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12571         * sparc.cc (Target_sparc::got_section): Likewise.
12572         * x86_64.cc (Target_x86_64::got_section): Likewise.
12573         * testsuite/relro_test_main.cc: New file.
12574         * testsuite/relro_test.cc: New file.
12575         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12576         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12577         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12578         (relro_test.so, relro_test_pic.o): New targets.
12579         * testsuite/Makefile.in: Rebuild.
12580
12581 2008-05-16  Ian Lance Taylor  <iant@google.com>
12582
12583         * output.cc (Output_segment::add_output_section): Remove front
12584         parameter.
12585         * output.h (class Output_segment): Remove
12586         add_initial_output_section and overloaded add_output_section.
12587         Update declaration of remaining add_output_section.
12588         * layout.cc (Layout::create_interp): Call add_output_section
12589         rather than add_initial_output_section.
12590         (Layout::finish_dynamic_section): Likewise.
12591
12592         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12593         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12594         know the dynamic type.
12595         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12596         field.  Initialize it in constructor.
12597         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12598         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12599         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12600         reloc.
12601
12602         * output.cc (Output_reloc::get_address): Change return type to
12603         Elf_Addr.
12604         * output.h (class Output_reloc): Update get_address declaration.
12605         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12606         for section addresses.
12607
12608 2008-05-09  Ian Lance Taylor  <iant@google.com>
12609
12610         PR 6493
12611         * gold.cc (gold_nomem): Use return value of write.
12612
12613 2008-05-08  Ian Lance Taylor  <iant@google.com>
12614
12615         * symtab.c (Symbol::init_base_output_data): Add version
12616         parameter.  Change all callers.
12617         (Symbol::init_base_output_segment): Likewise.
12618         (Symbol::init_base_constant): Likewise.
12619         (Symbol::init_base_undefined): Likewise.
12620         (Sized_symbol::init_output_data): Likewise.
12621         (Sized_symbol::init_output_segment): Likewise.
12622         (Sized_symbol::init_constant): Likewise.
12623         (Sized_symbol::init_undefined): Likewise.
12624         (Symbol_table::do_define_in_output_data): If the new symbol has a
12625         version, mark it as the default.
12626         (Symbol_table::do_define_in_output_segment): Likewise.
12627         (Symbol_table::do_define_as_constant): Likewise.
12628         * symtab.h (class Symbol): Update declarations.
12629         (class Sized_symbol): Likewise.
12630         * resolve.cc (Symbol::override_version): New function.
12631         (Symbol::override_base): Call override_version.
12632         (Symbol::override_base_with_special): Likewise.
12633         * testsuite/ver_script_8.script: New file.
12634         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12635         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12636         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12637         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12638
12639 2008-05-06  Ian Lance Taylor  <iant@google.com>
12640
12641         PR 6049
12642         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12643         functions.
12644         (class General_options): Remove existing --undefined, and add
12645         --no-undefined instead.  Add new --undefined as synonym for -u.
12646         * archive.cc (Archive::add_symbols): Check whether symbol was
12647         named with -u.
12648         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12649         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12650         all uses.  Add IS_UNDEFINED.  Update declarations to split
12651         different versions of init_base.  Declare init_base_undefined.
12652         (Symbol::is_defined): Handle IS_UNDEFINED.
12653         (Symbol::is_undefined): Likewise.
12654         (Symbol::is_weak_undefined): Call is_undefined.
12655         (Symbol::is_absolute): Handle IS_CONSTANT.
12656         (class Sized_symbol): Update declarations to split different
12657         versions of init.  Declare init_undefined.
12658         (class Symbol_table): Declare new functions.
12659         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12660         Change all callers.
12661         (Symbol::init_base_output_data): Likewise.
12662         (Symbol::init_base_output_segment): Likewise.
12663         (Symbol::init_base_constant): Likewise.
12664         (Symbol::init_base_undefined): New function.
12665         (Sized_symbol::init_object): Rename from init.  Change all
12666         callers.
12667         (Sized_symbol::init_output_data): Likewise.
12668         (Sized_symbol::init_output_segment): Likewise.
12669         (Sized_symbol::init_constant): Likewise.
12670         (Sized_symbol::init_undefined): New function.
12671         (Symbol_table::add_undefined_symbols_from_command_line): New
12672         function.
12673         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12674         function.
12675         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12676         (Symbol::output_section): Likewise.
12677         (Symbol::set_output_section): Likewise.
12678         (Symbol_table::sized_finalize_symbol): Likewise.
12679         (Symbol_table::sized_write_globals): Likewise.
12680         * resolve.cc (Symbol_table::should_override): Likewise.
12681         (Symbol::override_base_with_special): Likewise.
12682
12683         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12684         symbol, change it to have default visibility.
12685         * testsuite/protected_1.cc: New file.
12686         * testsuite/protected_2.cc: New file.
12687         * testsuite/protected_3.cc: New file.
12688         * testsuite/protected_main_1.cc: New file.
12689         * testsuite/protected_main_2.cc: New file.
12690         * testsuite/protected_main_3.cc: New file.
12691         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12692         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12693         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12694         (protected_1.so): New target.
12695         (protected_1_pic.o, protected_2_pic.o): New targets.
12696         (protected_3_pic.o): New target.
12697         (check_PROGRAMS): Add protected_2.
12698         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12699         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12700         * testsuite/Makefile.in: Rebuild.
12701
12702         * options.h (DEFINE_var): Add set_user_set_##varname__.
12703         (DEFINE_bool_alias): New macro.
12704         (class General_options): Define -Bstatic using DEFINE_bool_alias
12705         rather than DEFINE_special.  Add --undefined as an alias for -z
12706         defs.
12707         * options.cc (General_options::parse_Bstatic): Remove.
12708
12709         * options.h (class General_options): Add --fatal-warnings.
12710         * main.cc (main): Implement --fatal-warnings.
12711         * errors.h (Errors::warning_count): New function.
12712
12713         * options.h (class General_options): Add -Bsymbolic-functions.
12714         * symtab.h (Symbol::is_preemptible): Check for
12715         -Bsymbolic-functions.
12716
12717 2008-05-05  Ian Lance Taylor  <iant@google.com>
12718
12719         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12720         as noVARNAME rather than no-VARNAME.
12721         (class General_options): Add option -z combreloc.
12722         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12723         get_address.
12724         (Output_reloc::sort_before) [SHT_REL]: New function.
12725         (Output_reloc::sort_before) [SHT_RELA]: New function.
12726         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12727         Sort_relocs_comparison.
12728         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12729         parameter.  Change all callers.
12730         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12731         sort_relocs parameter.  Change all callers.
12732         * output.cc (Output_reloc::get_address): New function, broken out
12733         of write_rel.
12734         (Output_reloc::write_rel): Call it.
12735         (Output_reloc::compare): New function.
12736         (Output_data_reloc_base::do_write): Optionally sort relocs.
12737
12738         * configure.ac: If targ_extra_obj is set, link it in.
12739         * configure.tgt: Initialize all variables.
12740         (x86_64*): Set targ_extra_obj and targ_extra_size.
12741         * configure: Rebuild.
12742
12743         * object.cc (Sized_relobj::include_section_group): Adjust section
12744         indexes read from group data.  Build vector to pass to
12745         layout_group.
12746         * layout.cc (Layout::layout_group): Add flags and shndxes
12747         parameters.  Remove contents parameter.  Change caller.  Update
12748         explicit instantiations.
12749         * layout.h (class Layout): Update layout_group declaration.
12750         * output.cc (Output_data_group::Output_data_group): Add flags and
12751         input_shndxes parameters.  Remove contents parameter.  Change
12752         caller.
12753         (Output_data_group::do_write): Change input_sections_ to
12754         input_shndxes_.
12755         * output.h (class Output_data_group): Update constructor
12756         declaration.  Rename input_sections_ to input_shndxes_.
12757         * testsuite/many_sections_test.cc: Add template.
12758
12759 2008-04-30  Cary Coutant  <ccoutant@google.com>
12760
12761         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12762
12763         * layout.cc (Layout::include_section): Refactored check for debug
12764         info section.
12765         (Layout::add_comdat): Add new parameters.  Change type
12766         of signature parameter.  Add object and shndx to signatures table.
12767         (Layout::find_kept_object): New function.
12768         * layout.h: Include <cstring>.
12769         (Layout::is_debug_info_section): New function.
12770         (Layout::add_comdat): Add new parameters.
12771         (Layout::find_kept_object): New function.
12772         (Layout::Kept_section): New struct.
12773         (Layout::Signatures): Change type of map range.
12774         * object.cc (Relobj::output_section_address): New function.
12775         (Sized_relobj::include_section_group): Add new parameters.  Change
12776         calls to Layout::add_comdat.  Change to build table of kept comdat
12777         groups and table mapping discarded sections to kept sections.
12778         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12779         (Sized_relobj::do_layout): Change calls to include_section_group and
12780         include_linkonce_section.
12781         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12782         value to zero when section is discarded.
12783         (Sized_relobj::map_to_kept_section): New function.
12784         * object.h (Relobj::output_section_address): New function.
12785         (Relobj::Comdat_group): New type.
12786         (Relobj::find_comdat_group): New function.
12787         (Relobj::Comdat_group_table): New type.
12788         (Relobj::Kept_comdat_section): New type.
12789         (Relobj::Kept_comdat_section_table): New type.
12790         (Relobj::add_comdat_group): New function.
12791         (Relobj::set_kept_comdat_section): New function.
12792         (Relobj::get_kept_comdat_section): New function.
12793         (Relobj::comdat_groups_): New field.
12794         (Relobj::kept_comdat_sections_): New field.
12795         (Symbol_value::input_value): Update comment.
12796         (Sized_relobj::map_to_kept_section) New function.
12797         (Sized_relobj::include_linkonce_section): Add new parameter.
12798         * target-reloc.h (Comdat_behavior): New type.
12799         (get_comdat_behavior): New function.
12800         (relocate_section): Add code to map a discarded section to the
12801         corresponding kept section when applying a relocation.
12802
12803 2008-04-30  Craig Silverstein  <csilvers@google.com>
12804
12805         * dwarf_reader.cc (next_generation_count): New static var.
12806         (Addr2line_cache_entry): New struct.
12807         (addr2line_cache): New static var.
12808         (Dwarf_line_info::one_addr2line): Added caching.
12809         (Dwarf_line_info::clear_addr2line_cache): New function.
12810         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12811         cache-size parameter.
12812         (Dwarf_line_info::one_addr2line_cache): New function.
12813         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12814         new cache-size argument to one_addr2line(), and clear cache.
12815
12816 2008-04-28  Cary Coutant  <ccoutant@google.com>
12817
12818         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12819         R_386_PC8 relocations.
12820
12821 2008-04-23  Ian Lance Taylor  <iant@google.com>
12822
12823         * object.cc (Sized_relobj::include_section_group): Check for
12824         invalid section group.
12825
12826         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12827         header size.
12828
12829         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12830         than read for file header.
12831         * archive.cc (Archive::include_member): Likewise.
12832
12833 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12834
12835         * aclocal.m4: Regenerate.
12836         * configure: Regenerate.
12837
12838 2008-04-19  Ian Lance Taylor  <iant@google.com>
12839
12840         * version.cc (version_string): Bump to 1.6.
12841
12842         * testsuite/Makefile.am (many_sections_r_test): New target.
12843         (many_sections_r_test_SOURCES): Remove.
12844         (many_sections_r_test_DEPENDENCIES): Remove.
12845         (many_sections_r_test_LDFLAGS): Remove.
12846         (many_sections_r_test_LDADD): Remove.
12847
12848         * object.cc (Sized_relobj::do_add_symbols): Always pass
12849         local_symbol_count_ to add_from_relobj.
12850
12851         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12852         every thousand variables.
12853         * testsuite/Makefile.in: Rebuild.
12854
12855         * object.cc (Xindex::initialize_symtab_xindex): New function.
12856         (Xindex::read_symtab_xindex): New function.
12857         (Xindex::sym_xindex_to_shndx): New function.
12858         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12859         available.
12860         (Sized_relobj::do_initialize_xindex): New function.
12861         (Sized_relobj::do_read_symbols): Adjust section links.
12862         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12863         parameter.  Change all callers.
12864         (Sized_relobj::include_section_group): Adjust section links and
12865         symbol section indexes.
12866         (Sized_relobj::do_layout): Adjust section links.
12867         (Sized_relobj::do_count_local_symbols): Adjust section links and
12868         symbol section indexes.
12869         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12870         ordinary and special symbols.
12871         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12872         dynsym_xindex parameters.  Change all callers.  Adjust section
12873         links.  Use SHN_XINDEX when needed.
12874         (Sized_relobj::get_symbol_location_info): Adjust section links.
12875         Don't get fooled by special symbols.
12876         * object.h (class Xindex): Define.
12877         (class Object): Add xindex_ parameter.  Declare virtual functoin
12878         do_initialize_xindex.
12879         (Object::adjust_sym_shndx): New function.
12880         (Object::set_xindex): New protected function.
12881         (class Symbol_value): Add is_ordinary_shndx_ field.
12882         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12883         (Symbol_value::value): Assert ordinary section.
12884         (Symbol_value::initialize_input_to_output_map): Likewise.
12885         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12886         Change all callers.
12887         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12888         all callers.
12889         (class Sized_relobj): Update declarations.
12890         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12891         parameter.  Change all callers.
12892         (Sized_relobj::adjust_shndx): New function.
12893         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12894         field.
12895         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12896         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12897         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12898         (Sized_dynobj::read_dynsym_section): Adjust section links.
12899         (Sized_dynobj::read_dynamic): Likewise.
12900         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12901         section links.
12902         (Sized_dynobj::do_initialize_xindex): New function.
12903         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12904         do_initialize_xindex.
12905         (Sized_dynobj::adjust_shndx): New function.
12906         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12907         dynsym_xindex_ fields.
12908         (Layout::finalize): Add a call to set_section_indexes before
12909         creating the symtab sections.
12910         (Layout::set_section_indexes): Don't do anything if the section
12911         already has a section index.
12912         (Layout::create_symtab_sections): Add shnum parameter.  Change
12913         caller.  Create .symtab_shndx section if needed.
12914         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12915         caller.
12916         (Layout::allocated_output_section_count): New function.
12917         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12918         needed.
12919         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12920         fields.  Update declarations.
12921         (Layout::symtab_xindex): New function.
12922         (Layout::dynsym_xindex): New function.
12923         (class Write_symbols_task): Add layout_ field.
12924         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12925         Change caller.
12926         * output.cc (Output_section_headers::Output_section_headers): Add
12927         shstrtab_section parameter.  Change all callers.
12928         (Output_section_headers::do_sized_write): Store overflow values
12929         for section count and section string table section index in
12930         section header zero.
12931         (Output_file_header::do_sized_write): Check for overflow of
12932         section count and section string table section index.
12933         (Output_symtab_xindex::do_write): New function.
12934         (Output_symtab_xindex::endian_do_write): New function.
12935         * output.h (class Output_section_headers): Add shstrtab_section_.
12936         Update declarations.
12937         (class Output_symtab_xindex): Define.
12938         (Output_section::has_out_shndx): New function.
12939         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12940         field.
12941         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12942         Change all callers.
12943         (Sized_symbol::init): Likewise.
12944         (Symbol::output_section): Check for ordinary symbol.
12945         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12946         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12947         callers.
12948         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12949         Change all callers.  Simplify handling of symbols from sections
12950         not included in the link.
12951         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12952         distinction.
12953         (Weak_alias_sorter::operator()): Assert that symbols are
12954         ordinary.
12955         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12956         distinction.
12957         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12958         parameters.  Change all callers.
12959         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12960         symbol distinction.  Use SHN_XINDEX when needed.
12961         (Symbol_table::write_section_symbol): Add symtab_xindex
12962         parameter.  Change all callers.
12963         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12964         SHN_XINDEX when needed.
12965         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12966         declarations.
12967         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12968         (Symbol::is_defined): Check is_ordinary.
12969         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12970         (Symbol::is_absolute, Symbol::is_common): Likewise.
12971         (class Sized_symbol): Update declarations.
12972         (class Symbol_table): Update declarations.
12973         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12974         parameters.  Change all callers.
12975         (Sized_symbol::override): Likewise.
12976         (Symbol_table::override): Likewise.
12977         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12978         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12979         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12980         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12981         to be in an ordinary section.
12982         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12983         object and is_ordinary parameters.  Change all callers.
12984         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12985         Change all callers.  Don't add undefined or non-ordinary symbols
12986         to reloc_map_.
12987         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12988         Change all callers.
12989         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12990         declarations.
12991         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12992         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12993         (Sized_relobj::relocate_sections): Likewise.
12994         * target-reloc.h (scan_relocs): Adjust section symbol index.
12995         (scan_relocatable_relocs): Likewise.
12996         * i386.cc (Scan::local): Check for ordinary symbols.
12997         * sparc.cc (Scan::local): Likewise.
12998         * x86_64.cc (Scan::local): Likewise.
12999         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13000         to symbol_section_and_value.
13001         * testsuite/many_sections_test.cc: New file.
13002         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13003         (check_PROGRAMS): Add many_sections_test.
13004         (many_sections_test_SOURCES): Define.
13005         (many_sections_test_DEPENDENCIES): Define.
13006         (many_sections_test_LDFLAGS): Define.
13007         (BUILT_SOURCES): Add many_sections_define.h.
13008         (many_sections_define.h): New target.
13009         (BUILT_SOURCES): Add many_sections_check.h.
13010         (many_sections_check.h): New target.
13011         (check_PROGRAMS): Add many_sections_r_test.
13012         (many_sections_r_test_SOURCES): Define.
13013         (many_sections_r_test_DEPENDENCIES): Define.
13014         (many_sections_r_test_LDFLAGS): Define.
13015         (many_sections_r_test_LDADD): Define.
13016         (many_sections_r_test.o): New target.
13017         * testsuite/Makefile.in: Rebuild.
13018
13019 2008-04-17  Cary Coutant  <ccoutant@google.com>
13020
13021         * errors.cc (Errors::info): New function.
13022         (gold_info): New function.
13023         * errors.h (Errors::info): New function.
13024         * gold.h (gold_info): New function.
13025         * object.cc (Input_objects::add_object): Print trace output.
13026         * options.cc (options::parse_set): New function.
13027         (General_options::parse_wrap): Deleted.
13028         (General_options::General_options): Deleted initializer.
13029         * options.h (options::String_set): New typedef.
13030         (options::parse_set): New function.
13031         (DEFINE_set): New macro.
13032         (General_options::wrap): Changed to use DEFINE_set. Changed
13033         callers of any_wrap_symbols and is_wrap_symbol.
13034         (General_options::trace, General_options::trace_symbol):
13035         New options.
13036         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13037         (General_options::wrap_symbols_): Deleted.
13038         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13039
13040 2008-04-17  David S. Miller  <davem@davemloft.net>
13041
13042         * options.cc (General_options::parse_V): New function.
13043         * options.h: Add entries for -V and -Qy.
13044
13045 2008-04-17  Ian Lance Taylor  <iant@google.com>
13046
13047         * common.cc (Symbol_table::allocate_commons): Remove options
13048         parameter.  Change caller.
13049         (Symbol_table::do_allocate_commons): Remove options parameter.
13050         Change caller.  Just call do_allocate_commons_list twice.
13051         (Symbol_table::do_allocate_commons_list): New function, broken out
13052         of do_allocate_commons.
13053         * common.h (class Allocate_commons_task): Remove options_ field.
13054         Update constructor.
13055         * symtab.cc (Symbol_table::Symbol_table): Initialize
13056         tls_commons_.
13057         (Symbol_table::add_from_object): Put TLS common symbols on
13058         tls_commons_ list.
13059         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13060         which are IN_OUTPUT_DATA.
13061         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13062         allocate_commons and do_allocate_commons declarations.  Declare
13063         do_allocate_commons_list.
13064         * gold.cc (queue_middle_tasks): Update creation of
13065         Allocate_commons_task to not pass options.
13066         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13067         (TLS_TEST_C_FLAGS): New variable.
13068         (tls_test_c_pic.o): New target.
13069         (tls_test_shared.so): Link in tls_test_c_pic.o.
13070         (tls_test_c_pic_ie.o): New target.
13071         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13072         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13073         (tls_test_c.o): New target.
13074         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13075         (tls_pic_test_LDADD): Likewise.
13076         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13077         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13078         (tls_test_c_gnu2.o): New target.
13079         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13080         tls_test_c_gnu2.o.
13081         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13082         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13083         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13084         * testsuite/tls_test.cc: Include "config.h".
13085         (t_last): Call t11_last.
13086         * testsuite/tls_test.h (t11, t11_last): Declare.
13087         * testsuite/tls_test_c.c: New file.
13088         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13089         * configure.ac: Check for OpenMP support.
13090         * configure, config.in, Makefile.in: Rebuild.
13091         * testsuite/Makefile.in: Rebuild.
13092
13093 2008-04-16  Cary Coutant  <ccoutant@google.com>
13094
13095         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13096         (Target_i386::tls_base_symbol_defined_): New field.
13097         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13098         (Target_i386::Scan::global): Likewise.
13099         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13100         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13101         (Target_x86_64::tls_base_symbol_defined_): New field.
13102         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13103         (Target_x86_64::Scan::global): Likewise.
13104
13105 2008-04-16  Cary Coutant  <ccoutant@google.com>
13106
13107         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13108         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13109         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13110         building shared libraries.
13111         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13112         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13113         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13114         * testsuite/Makefile.in: Rebuild.
13115         * testsuite/weak_undef.h: New file.
13116         * testsuite/weak_undef_file1.cc: Add extra test cases.
13117         * testsuite/weak_undef_file2.cc: Likewise.
13118         * testsuite/weak_undef_test.cc: Likewise.
13119
13120 2008-04-16  David S. Miller  <davem@davemloft.net>
13121
13122         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13123         Add issued_non_pic_error_ field.  Declare check_non_pic.
13124         (Target_sparc::Scan::check_non_pic): New function.
13125         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13126         (Target_sparc::Scan::global): Likewise.
13127
13128         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13129         * configure: Rebuild.
13130
13131         * options.h (DEFINE_enable): New macro.
13132         (new_dtags): New enable option.
13133         (initfirst, interpose, loadfltr, nodefaultlib,
13134         nodelete, nodlopen, nodump): New -z options.
13135         * layout.cc (Layout:finish_dynamic_section): If new
13136         dtags enabled, emit DT_RUNPATH.  Also, emit a
13137         DT_FLAGS_1 containing any specified -z flags.
13138
13139 2008-04-16  Ian Lance Taylor  <iant@google.com>
13140
13141         * copy-relocs.cc: New file.
13142         * copy-relocs.h: New file.
13143         * reloc.cc: Remove Copy_relocs code.
13144         * reloc.h: Likewise.
13145         * reloc-types.h (struct Reloc_types) [both versions]: Add
13146         get_reloc_addend_noerror.
13147         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13148         variants of add_global which take an addend which must be zero.
13149         * i386.cc: Include "copy-relocs.h".
13150         (class Target_i386): Change type of copy_relocs_ to variable,
13151         update initializer.
13152         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13153         Change all callers.
13154         (Target_i386::do_finalize_sections): Change handling of
13155         copy_relocs_.
13156         * sparc.cc: Include "copy-relocs.h".
13157         (class Target_sparc): Change type of copy_relocs_ to variable,
13158         update initializer.
13159         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13160         Change all callers.
13161         (Target_sparc::do_finalize_sections): Change handling of
13162         copy_relocs_.
13163         * x86_64.cc: Include "copy-relocs.h".
13164         (class Target_x86_64): Change type of copy_relocs_ to variable,
13165         update initializer.
13166         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13167         class.  Change all callers.
13168         (Target_x86_64::do_finalize_sections): Change handling of
13169         copy_relocs_.
13170         * Makefile.am (CCFILES): Add copy-relocs.cc.
13171         (HFILES): Add copy-relocs.h.
13172
13173         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13174
13175         * testsuite/script_test_4.sh: Permit leading zeroes.
13176
13177 2008-04-15  Ian Lance Taylor  <iant@google.com>
13178
13179         * script-sections.cc (Script_sections::create_segments): Use
13180         header_size_adjustment even when there is enough room for the
13181         headers.
13182         * testsuite/script_test_4.sh: New file.
13183         * testsuite/script_test_4.t: New file.
13184         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13185         (check_DATA): Add script_test_4.stdout.
13186         (MOSTLYCLEANFILES): Likewise.
13187         (script_test_4): New target.
13188         (script_test_4.stdout): New target.
13189         * testsuite/Makefile.in: Rebuild.
13190
13191         * sparc.cc: Add definitions for Output_data_plt_sparc class
13192         constants.
13193
13194 2008-04-14  David S. Miller  <davem@davemloft.net>
13195
13196         * sparc.cc: New file.
13197         * Makefile.am (TARGETSOURCES): Add sparc.cc
13198         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13199         * configure.tgt: Document targ_extra_size and
13200         targ_extra_big_endian.  Add entries for sparc-* and
13201         sparc64-*.
13202         * configure.ac: Handle targ_extra_size and
13203         targ_extra_big_endian.
13204         * Makefile.in: Rebuild.
13205         * configure: Likewise.
13206         * po/POTFILES.in: Likewise.
13207         * po/gold.pot: Likewise.
13208
13209 2008-04-14  Ian Lance Taylor  <iant@google.com>
13210
13211         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13212         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13213         in the name/type/flags to section mapping.  Don't call
13214         allocate_output_section.
13215         (Layout::choose_output_section): Change parameter from adjust_name
13216         to is_input_section.  Don't permit input sections after sections
13217         are attached to segments.  Don't call allocate_output_section.
13218         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13219         not write_enable_output_section.
13220         (Layout::make_output_section): Don't push to
13221         unattached_section_list_ nor call attach_to_segment.  Call
13222         attach_section_to_segment if sections are attached.
13223         (Layout::attach_sections_to_segments): New function.
13224         (Layout::attach_section_to_segment): New function.
13225         (Layout::attach_allocated_section_to_segment): Rename from
13226         attach_to_segment.  Remove flags parameter.
13227         (Layout::allocate_output_section): Remove function.
13228         (Layout::write_enable_output_section): Remove function.
13229         * layout.h (class Layout): Update for above changes.  Add new
13230         field sections_are_attached_.
13231         * output.h (Output_section::update_flags_for_input_section): New
13232         function.
13233         * output.cc (Output_section::add_input_section): Call
13234         update_flags_for_input_section.
13235         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13236
13237 2008-04-11  Cary Coutant  <ccoutant@google.com>
13238
13239         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13240         thought unnecessary.
13241         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13242
13243 2008-04-11  Ian Lance Taylor  <iant@google.com>
13244
13245         * output.h (class Output_section_data): Remove inline definition
13246         of set_addralign.
13247         * output.cc (Output_section_data::set_addralign): New function.
13248
13249 2008-04-11  Cary Coutant  <ccoutant@google.com>
13250
13251         Add support for TLS descriptors for i386 and x86_64.
13252         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13253         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13254         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13255         GOT_TYPE_TLS_DESC.
13256         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13257         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13258         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13259         relocations.
13260         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13261         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13262         Fix problem with initial-exec relocations.
13263         (Target_i386::Relocate::relocate_tls): Likewise.
13264         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13265         relaxation.
13266         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13267         support for section-plus-offset dynamic table entries.
13268         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13269         (Output_data_dynamic::Dynamic_entry): Add support for
13270         section-plus-offset dynamic table entries.
13271         (Output_data_dynamic::Classification): Likewise.
13272         (Output_data_dynamic::classification_): Renamed offset_.
13273         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13274         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13275         (Target_x86_64::make_plt_section): New function.
13276         (Target_x86_64::reserve_tlsdesc_entries): New function.
13277         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13278         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13279         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13280         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13281         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13282         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13283         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13284         add extra PLT entry for TLS descriptors.
13285         (Output_data_plt_x86_64::got_): New field.
13286         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13287         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13288         fields.
13289         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13290         descriptors.
13291         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13292         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13293         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13294         R_386_TLS_DESC_CALL relocations.
13295         (Target_x86_64::Scan::global): Likewise.
13296         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13297         for TLS descriptors.
13298         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13299         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13300         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13301         GD-to-IE relaxation.
13302         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13303         and TLS_DESCRIPTORS.
13304         * Makefile.in: Rebuild.
13305         * configure: Rebuild.
13306         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13307         (tls_test_shared2.so): New target.
13308         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13309         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13310         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13311         (tls_shared_gd_to_ie_test_LDADD): New variable.
13312         (tls_shared_gnu2_gd_to_ie_test): New target.
13313         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13314         New targets.
13315         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13316         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13317         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13318         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13319         (tls_shared_gnu2_test): New target.
13320         (tls_test_gnu2_shared.so): New target.
13321         (tls_shared_gnu2_test_SOURCES): New variable.
13322         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13323         (tls_shared_gnu2_test_LDFLAGS): New variable.
13324         (tls_shared_gnu2_test_LDADD): New variable.
13325         * testsuite/Makefile.in: Rebuild.
13326         * testsuite/Makefile.
13327
13328 2008-04-11  Ian Lance Taylor  <iant@google.com>
13329
13330         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13331         justsyms.t.
13332         * testsuite/Makefile.in: Rebuild.
13333
13334         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13335         long.
13336         * testsuite/script_test_2.cc (main): Adjust test.
13337
13338 2008-04-11  David S. Miller  <davem@davemloft.net>
13339             Ian Lance Taylor  <iant@google.com>
13340
13341         * options.h (General_options): Add entries for '-Y' and
13342         '-relax'.
13343         * options.cc (General_options:finalize): If -Y was used, add those
13344         entries to the library path instead of the default "/lib" and
13345         "/usr/lib".
13346
13347 2008-04-11  David S. Miller  <davem@davemloft.net>
13348
13349         * testsuite/justsyms.t: Start at 0x100.
13350         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13351         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13352         long.
13353         * testsuite/script_test_2.cc: Adjust string and section length
13354         checks.
13355
13356 2008-04-09  Ian Lance Taylor  <iant@google.com>
13357
13358         PR gold/5996
13359         * script-sections.cc (Sections_element::allocate_to_segment): Add
13360         orphan parameter.
13361         (Output_section_definition::allocate_to_segment): Likewise.
13362         (Orphan_output_section::allocate_to_segment): Likewise.
13363         (Script_sections::attach_sections_using_phdrs_clause): Don't
13364         propagate non-PT_LOAD segments to orphan sections.
13365         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13366         readelf rather than objdump.
13367         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13368         .interp section and PT_INTERP segment are the same size.
13369         * testsuite/Makefile.in: Rebuild.
13370
13371         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13372         aliases for symbols defined in the same object.
13373         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13374         (weak_alias_test_SOURCES): New variable.
13375         (weak_alias_test_DEPENDENCIES): New variable.
13376         (weak_alias_test_LDFLAGS): New variable.
13377         (weak_alias_test_LDADD): New variable.
13378         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13379         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13380         (weak_alias_test_3.o): New target.
13381         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13382         * testsuite/weak_alias_test_main.cc: New file.
13383         * testsuite/weak_alias_test_1.cc: New file.
13384         * testsuite/weak_alias_test_2.cc: New file.
13385         * testsuite/weak_alias_test_3.cc: New file.
13386
13387 2008-04-08  Ian Lance Taylor  <iant@google.com>
13388
13389         * options.h (class General_options): Add --noinhibit-exec option.
13390         * main.cc (main): Check --noinhibit-exec.
13391
13392         * options.h (class General_options): Define --wrap as a special
13393         option.  Add wrap_symbols_ field.
13394         (General_options::any_wrap_symbols): New function.
13395         (General_options::is_wrap_symbol): New function.
13396         * options.cc (General_options::parse_wrap): New function.
13397         (General_options::General_options): Initialize wrap_symbols_.
13398         * symtab.cc (Symbol_table::wrap_symbol): New function.
13399         (Symbol_table::add_from_object): Handle --wrap.
13400         * symtab.h (class Symbol_table): Declare wrap_symbol.
13401         * target.h (Target::wrap_char): New function.
13402         (Target::Target_info): Add wrap_char field.
13403         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13404         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13405         * testsuite/testfile.cc (Target_test::test_target_info):
13406         Likewise.
13407
13408         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13409         there is one.
13410
13411         * layout.h (class Layout): Add added_eh_frame_data_ field.
13412         * layout.cc (Layout::Layout): Initialize new field.
13413         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13414         output section until we find a section we merged successfully.
13415         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13416         that the size be non-zero.
13417
13418         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13419         qualifier.
13420
13421 2008-04-08  Craig Silverstein  <csilvers@google.com>
13422
13423         * configure.ac: Export new conditional variable HAVE_ZLIB.
13424         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13425         on HAVE_ZLIB.
13426         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13427         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13428
13429 2008-04-07  Ian Lance Taylor  <iant@google.com>
13430
13431         * version.cc (version_string): Set to "1.5".
13432
13433         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13434         Add issued_non_pic_error_ field.  Declare check_non_pic.
13435         (Target_x86_64::Scan::check_non_pic): New function.
13436         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13437         (Target_x86_64::Scan::global): Likewise.
13438
13439         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13440         addend parameter.  Change caller.  Handle merge sections.
13441         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13442         Address to Addend.  Don't add in the result of
13443         local_section_offset, pass down the addend and use the returned
13444         value.
13445         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13446         Update declarations of local_section_offset and symbol_value.
13447         * testsuite/two_file_test_1.cc (t18): New function.
13448         * testsuite/two_file_test_2.cc (f18): New function.
13449         * testsuite/two_file_test_main.cc (main): Call t18.
13450         * testsuite/two_file_test.h (t18, f18): Declare.
13451
13452         * configure.ac: Don't test for objdump, c++filt, or readelf.
13453         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13454         conditionals.
13455         (TEST_READELF): New variable.
13456         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13457         (check_PROGRAMS): Add two_file_strip_test.
13458         (two_file_strip_test): New target.
13459         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13460         (two_file_same_shared_strip_test_SOURCES): New variable.
13461         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13462         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13463         (two_file_same_shared_strip_test_LDADD): New variable.
13464         (two_file_shared_strip.so): New target.
13465         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13466         (ver_test_5.syms, ver_test_7.syms): Likewise.
13467         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13468         (strip_test_3.stdout): Use TEST_OBJDUMP.
13469         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13470
13471 2008-04-04  Cary Coutant  <ccoutant@google.com>
13472
13473         * symtab.h (Symbol::is_weak_undefined): New function.
13474         (Symbol::is_strong_undefined): New function.
13475         (Symbol::is_absolute): New function.
13476         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13477         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13478         absolute symbols.
13479         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13480         (weak_undef_test): New target.
13481         * testsuite/Makefile.in: Rebuild.
13482         * testsuite/weak_undef_file1.cc: New file.
13483         * testsuite/weak_undef_file2.cc: New file.
13484         * testsuite/weak_undef_test.cc: New file.
13485
13486 2008-04-03  Craig Silverstein  <csilvers@google.com>
13487
13488         * compressed_output.h (class Output_compressed_section): Use
13489         unsigned buffer.
13490         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13491         add zlib header.
13492         (zlib_compressed_suffix): Removed.
13493         (Output_compressed_section::set_final_data_size): Use unsigned
13494         buffers.
13495         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13496         Fix linker invocation.
13497         (flagstest_o_specialfile_and_compress_debug_sections):
13498         Likewise.
13499         * testsuite/Makefile.in: Regenerated.
13500
13501 2008-04-02  David S. Miller  <davem@davemloft.net>
13502
13503         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13504         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13505
13506 2008-04-02  Craig Silverstein  <csilvers@google.com>
13507
13508         * TODO: New file.
13509
13510 2008-04-02  Ian Lance Taylor  <iant@google.com>
13511
13512         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13513         parameters.  Update for new key type to views_.  Change all
13514         callers.
13515         (File_read::read): Adjust for byteshift in returned view.
13516         (File_read::add_view): New function, broken out of
13517         find_and_make_view.
13518         (File_read::make_view): New function, broken out of
13519         find_and_make_view.
13520         (File_read::find_or_make_view): Add offset and aligned
13521         parameters.  Rewrite accordingly.  Change all callers.
13522         (File_read::get_view): Add offset and aligned parameters.  Adjust
13523         for byteshift in return value.
13524         (File_read::get_lasting_view): Likewise.
13525         * fileread.h (class File_read): Update declarations.
13526         (class File_read::View): Add byteshift_ field.  Add byteshift to
13527         constructor.  Add byteshift method.
13528         * archive.h (Archive::clear_uncached_views): New function.
13529         (Archive::get_view): Add aligned parameter.  Change all callers.
13530         * object.h (Object::get_view): Add aligned parameter.  Change all
13531         callers.
13532         (Object::get_lasting_view): Likewise.
13533
13534         * fileread.cc (File_read::release): Don't call clear_views if
13535         there are multiple objects.
13536         * fileread.h (File_read::clear_uncached_views): New function.
13537         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13538         on the archive.
13539
13540 2008-03-31  Cary Coutant  <ccoutant@google.com>
13541
13542         Add thin archive support.
13543         * archive.cc (Archive::armagt): New const.
13544         (Archive::setup): Remove task parameter and calls to unlock.
13545         (Archive::unlock_nested_archives): New function.
13546         (Archive::read_header): Add nested_off parameter. Change
13547         all callers.
13548         (Archive::interpret_header): Likewise.
13549         (Archive::include_all_members): Change to handle thin
13550         archives.
13551         (Archive::include_member): Likewise.
13552         * archive.h (Archive::Archive): Add new parameters and
13553         initializers.
13554         (Archive::armagt): New const.
13555         (Archive::setup): Remove task parameter.
13556         (Archive::unlock_nested_archives): New function.
13557         (Archive::read_header): Add nested_off parameter.
13558         (Archive::interpret_header): Likewise.
13559         (Archive::Nested_archive_table): New typedef.
13560         (Archive::is_thin_archive_): New field.
13561         (Archive::nested_archives_): New field.
13562         (Archive::options_): New field.
13563         (Archive::dirpath_): New field.
13564         (Archive::task_): New field.
13565         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13566         for thin archives.  Pass additional parameters to
13567         Archive::Archive.  Unlock the archive file after calling
13568         Archive::setup.
13569
13570 2008-03-29  Ian Lance Taylor  <iant@google.com>
13571
13572         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13573         version symbol to be local.
13574         * testsuite/ver_test_4.sh: New file.
13575         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13576         (check_DATA): Add ver_test_4.syms.
13577         (ver_test_4.syms): New target.
13578         * testsuite/Makefile.in: Rebuild.
13579
13580         * output.cc
13581         (Output_section::Input_section_sort_entry::has_priority): New
13582         function.
13583         (Output_section::Input_section_sort_entry::match_file_name): New
13584         function.
13585         (Output_section::Input_section_sort_entry::match_section_name):
13586         Remove.
13587         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13588         Remove.
13589         (Output_section::Input_section_sort_entry::match_section_file):
13590         Remove.
13591         (Output_section::Input_section_sort_compare::operator()): Rewrite
13592         using new Input_section_sort_entry functions.  Sort crtbegin and
13593         crtend first.  Sort sections with no priority before sections with
13594         a priority.
13595         * testsuite/initpri1.c (d3): Check j != 4.
13596         (cd5): New constructor/destructor function.
13597         (main): Check j != 2.
13598
13599         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13600         new symbol when resolving, don't call set_is_default.
13601         * testsuite/ver_test_7.cc: New file.
13602         * testsuite/ver_test_7.sh: New file.
13603         * testsuite/Makefile.am (ver_test_7.so): New target.
13604         (ver_test_7.o): New target.
13605         (check_SCRIPTS): Add ver_test_7.sh.
13606         (check_DATA): Add ver_test_7.syms.
13607         (ver_test_7.syms): New target.
13608
13609 2008-03-28  Ian Lance Taylor  <iant@google.com>
13610
13611         * layout.cc (Layout::layout): If we see an input section with a
13612         name that needs sorting, set the must_sort flag for the output
13613         section.
13614         (Layout::make_output_section): If the name of the output section
13615         indicates that it might require sorting, set the may_sort flag.
13616         * output.h (Output_section::may_sort_attached_input_sections): New
13617         function.
13618         (Output_section::set_may_sort_attached_input_sections): New
13619         function.
13620         (Output_section::must_sort_attached_input_sections): New
13621         function.
13622         (Output_section::set_must_sort_attached_input_sections): New
13623         function.
13624         (class Output_section): Declare Input_section_sort_entry.  Define
13625         Input_section_sort_compare.  Declare
13626         sort_attached_input_sections.  Add new fields:
13627         may_sort_attached_input_sections_,
13628         must_sort_attached_input_sections_,
13629         attached_input_sections_are_sorted_.
13630         * output.cc (Output_section::Output_section): Initialize new
13631         fields.
13632         (Output_section::add_input_section): Add an entry to
13633         input_sections_ if may_sort or must_sort are true.
13634         (Output_section::set_final_data_size): Call
13635         sort_attached_input_sections if necessary.
13636         (Output_section::Input_section_sort_entry): Define new class.
13637         (Output_section::Input_section_sort_compare::operator()): New
13638         function.
13639         (Output_section::sort_attached_input_sections): New function.
13640         * configure.ac: Check whether the compiler supports constructor
13641         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13642         * testsuite/initpri1.c: New file.
13643         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13644         CONSTRUCTOR_PRIORITY.
13645         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13646         (initpri1_LDFLAGS): New variable.
13647         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13648
13649 2008-03-27  Ian Lance Taylor  <iant@google.com>
13650
13651         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13652         * testsuite/common_test_1.c: New file.
13653         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13654         (common_test_1_SOURCES): New variable.
13655         (common_test_1_DEPENDENCIES): New variable.
13656         (common_test_1_LDFLAGS): New variable.
13657
13658         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13659         and commons_ correctly when NAME/VERSION does not override
13660         NAME/NULL.
13661         * testsuite/ver_test_6.c: New file.
13662         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13663         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13664         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13665
13666 2008-03-26  Ian Lance Taylor  <iant@google.com>
13667
13668         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13669         of an undefined symbol from a version script.
13670         * testsuite/Makefile.am (ver_test_5.so): New target.
13671         (ver_test_5.o): New target.
13672         (check_SCRIPTS): Add ver_test_5.sh.
13673         (check_DATA): Add ver_test_5.syms.
13674         (ver_test_5.syms): New target.
13675         * testsuite/ver_test_5.cc: New file.
13676         * testsuite/ver_test_5.script: New file.
13677         * testsuite/ver_test_5.sh: New file.
13678         * Makefile.in, testsuite/Makefile.in: Rebuild.
13679
13680         PR gold/5986
13681         Fix problems building gold with gcc 4.3.0.
13682         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13683         (gold_error_at_location, gold_warning_at_location): Use it.
13684         * configure.ac: Check whether we can compile and use a template
13685         function with a printf attribute.
13686         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13687         when jumping over bytes.
13688         * object.cc: Instantiate Object::read_section_data.
13689         * debug.h: Include <cstring>
13690         * dwarf_reader.cc: Include <algorithm>
13691         * main.cc: Include <cstring>.
13692         * options.cc: Include <cstring>.
13693         * output.cc: Include <cstring>.
13694         * script.cc: Include <cstring>.
13695         * script.h: Include <string>.
13696         * symtab.cc: Include <cstring> and <algorithm>.
13697         * target-select.cc: Include <cstring>.
13698         * version.cc: Include <string>.
13699         * testsuite/testmain.cc: Include <cstdlib>.
13700         * configure, config.in: Rebuild.
13701
13702 2008-03-25  Ian Lance Taylor  <iant@google.com>
13703
13704         * options.cc: Include "../bfd/bfdver.h".
13705         (options::help): Print bug reporting address.
13706
13707         * version.cc (print_version): Adjust output for current value of
13708         BFD_VERSION_STRING.
13709
13710         * NEWS: New file.
13711
13712         * options.cc (options::help): Print list of supported targets.
13713         * target-select.h: Include <vector>.
13714         (class Target_selector): Make machine_, size_, and is_big_endian_
13715         fields const.  Add bfd_name_ and instantiated_target_ fields.
13716         (Target_selector::Target_selector): Add bfd_name parameter.
13717         (Target_selector::recognize): Make non-virtual, call
13718         do_recognize.
13719         (Target_selector::recognize_by_name): Make non-virtual, call
13720         do_recognize_by_name.
13721         (Target_selector::supported_names): New function.
13722         (Target_selector::bfd_name): New function.
13723         (Target_selector::do_instantiate_target): New pure virtual
13724         function.
13725         (Target_selector::do_recognize): New virtual function.
13726         (Target_selector::do_recognize_by_name): New virtual function.
13727         (Target_selector::instantiate_target): New private function.
13728         (supported_target_names): Declare.
13729         * target-select.cc (Target_selector::Target_selector): Update for
13730         new parameter and fields.
13731         (select_target_by_name): Check that the name matches before
13732         calling recognize_by_name.
13733         (supported_target_names): New function.
13734         * i386.cc (class Target_selector_i386): Update Target_selector
13735         constructor call.  Remove recognize and recognize_by_name.  Add
13736         do_instantiate_target.
13737         * x86_64.cc (class Target_selector_x86_64): Likewise.
13738         * testsuite/testfile.cc (class Target_selector_test): Update for
13739         changes to Target_selector.
13740
13741         * README: Rewrite, with some notes on unsupported features.
13742
13743 2008-03-24  Cary Coutant  <ccoutant@google.com>
13744
13745         * i386.cc (Target_i386::Got_type): New enum declaration.
13746         (Target_i386::Scan::local): Updated callers of Output_data_got
13747         member functions.
13748         (Target_i386::Scan::global): Likewise.
13749         (Target_i386::Relocate::relocate): Likewise.
13750         (Target_i386::Relocate::relocate_tls): Likewise.
13751         * object.h (Got_offset_list): New class.
13752         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13753         (Sized_relobj::local_got_offset): Likewise.
13754         (Sized_relobj::set_local_got_offset): Likewise.
13755         (Sized_relobj::local_has_tls_got_offset): Removed.
13756         (Sized_relobj::local_tls_got_offset): Removed.
13757         (Sized_relobj::set_local_tls_got_offset): Removed.
13758         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13759         * output.cc (Output_data_got::add_global): Added got_type parameter.
13760         (Output_data_got::add_global_with_rel): Likewise.
13761         (Output_data_got::add_global_with_rela): Likewise.
13762         (Output_data_got::add_global_pair_with_rel): New function.
13763         (Output_data_got::add_global_pair_with_rela): New function.
13764         (Output_data_got::add_local): Added got_type parameter.
13765         (Output_data_got::add_local_with_rel): Likewise.
13766         (Output_data_got::add_local_with_rela): Likewise.
13767         (Output_data_got::add_local_pair_with_rel): New function.
13768         (Output_data_got::add_local_pair_with_rela): New function.
13769         (Output_data_got::add_global_tls): Removed.
13770         (Output_data_got::add_global_tls_with_rel): Removed.
13771         (Output_data_got::add_global_tls_with_rela): Removed.
13772         (Output_data_got::add_local_tls): Removed.
13773         (Output_data_got::add_local_tls_with_rel): Removed.
13774         (Output_data_got::add_local_tls_with_rela): Removed.
13775         * output.h (Output_data_got::add_global): Added got_type parameter.
13776         (Output_data_got::add_global_with_rel): Likewise.
13777         (Output_data_got::add_global_with_rela): Likewise.
13778         (Output_data_got::add_global_pair_with_rel): New function.
13779         (Output_data_got::add_global_pair_with_rela): New function.
13780         (Output_data_got::add_local): Added got_type parameter.
13781         (Output_data_got::add_local_with_rel): Likewise.
13782         (Output_data_got::add_local_with_rela): Likewise.
13783         (Output_data_got::add_local_pair_with_rel): New function.
13784         (Output_data_got::add_local_pair_with_rela): New function.
13785         (Output_data_got::add_global_tls): Removed.
13786         (Output_data_got::add_global_tls_with_rel): Removed.
13787         (Output_data_got::add_global_tls_with_rela): Removed.
13788         (Output_data_got::add_local_tls): Removed.
13789         (Output_data_got::add_local_tls_with_rel): Removed.
13790         (Output_data_got::add_local_tls_with_rela): Removed.
13791         * resolve.cc (Symbol::override_base_with_special): Removed
13792         reference to has_got_offset_ field.
13793         * symtab.cc (Symbol::init_fields): Replaced initialization
13794         of got_offset_ with got_offsets_.  Removed initialization
13795         of has_got_offset_
13796         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13797         (Symbol::got_offset): Likewise.
13798         (Symbol::set_got_offset): Likewise.
13799         (Symbol::has_tls_got_offset): Removed.
13800         (Symbol::tls_got_offset): Removed.
13801         (Symbol::set_tls_got_offset): Removed.
13802         (Symbol::got_offset_): Removed.
13803         (Symbol::tls_mod_got_offset_): Removed.
13804         (Symbol::tls_pair_got_offset_): Removed.
13805         (Symbol::got_offsets_): New field.
13806         (Symbol::has_got_offset): Removed.
13807         (Symbol::has_tls_mod_got_offset): Removed.
13808         (Symbol::has_tls_pair_got_offset): Removed.
13809         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13810         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13811         member functions.
13812         (Target_x86_64::Scan::global): Likewise.
13813         (Target_x86_64::Relocate::relocate): Likewise.
13814         (Target_x86_64::Relocate::relocate_tls): Likewise.
13815
13816 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13817
13818         * yyscript.y: Fix spelling error in comment.
13819
13820 2008-03-24  Ian Lance Taylor  <iant@google.com>
13821
13822         * options.h (class General_options): Define build_id option.
13823         * layout.h (class Layout): Declare write_build_id, create_note,
13824         create_build_id.  Add build_id_note_ member.
13825         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13826         "libiberty.h", "md5.h", "sha1.h".
13827         (Layout::Layout): Initialize eh_frame_data_,
13828         eh_frame_hdr_section_, and build_id_note_.
13829         (Layout::finalize): Call create_build_id.
13830         (Layout::create_note): New function, broken out of
13831         Layout::create_gold_note.
13832         (Layout::create_gold_note): Call create_note.
13833         (Layout::create_build_id): New function.
13834         (Layout::write_build_id): New function.
13835         (Close_task_runner::run): Call write_build_id.
13836
13837         * x86_64.cc: Correct license to GPLv3.
13838
13839 2008-03-23  Ian Lance Taylor  <iant@google.com>
13840
13841         * options.cc: Include "demangle.h".
13842         (parse_optional_string): New function.
13843         (parse_long_option): Handle takes_optional_argument.
13844         (parse_short_option): Update dash_z initializer.  Handle
13845         takes_optional_argument.
13846         (General_options::General_options): Initialize do_demangle_.
13847         (General_options::finalize): Set do_demangle_.  Handle demangling
13848         style.
13849         * options.h (parse_optional_string): Declare.
13850         (struct One_option): Add optional_arg field.  Update constructor.
13851         Update call constructor calls.  Add takes_optional_argument
13852         function.
13853         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13854         (DEFINE_optional_string): Define.
13855         (General_options::demangle): Change from DEFINE_bool to
13856         DEFINE_optional_string.
13857         (General_options::no_demangle): New function.
13858         (General_options::do_demangle): New function.
13859         (General_options::set_do_demangle): New function.
13860         (General_options::execstack_status_): Move definition to end of
13861         class definition.
13862         (General_options::static_): Likewise.
13863         (General_options::do_demangle_): New field.
13864         * object.cc (big_endian>::get_symbol_location_info): Call
13865         Options::do_demangle, not Options::demangle.
13866         * symtab.cc (demangle): Likewise.
13867
13868 2008-03-22  Ian Lance Taylor  <iant@google.com>
13869
13870         * gold.h: Include <cstddef> and <sys/types.h>
13871         * options.h: Include <cstring>.
13872
13873 2008-03-21  Ian Lance Taylor  <iant@google.com>
13874
13875         * Added source code to GNU binutils.