Add support for tilegx in gold.
[external/binutils.git] / gold / ChangeLog
1 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2
3         * tilegx.cc: New file.
4         * Makefile.am (TARGETSOURCES): Add tilegx.cc
5         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
6         * configure.tgt: Add entries for tilegx*.
7         * configure.ac: Likewise.
8         * Makefile.in: Rebuild.
9         * configure: Likewise.
10         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
11         tilegx.
12
13 2012-09-13  Alan Modra  <amodra@gmail.com>
14
15         * target-reloc.h (scan_relocs): Call scan.local for relocs
16         against symbols in discarded sections.  Pass is_discarded
17         param.
18         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
19         Add is_discarded param.
20         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
21         is_discarded to flag opd entry as discarded.  Don't emit dyn
22         relocs on such entries.
23         (Target_powerpc::Scan::global): Similarly detect and handle
24         such opd entries.
25         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
26         opd_ent_.  Update all uses.
27         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
28         (Target_powerpc::relocate_section): Zero out discarded opd
29         entry relocs.
30
31 2012-09-12  Ian Lance Taylor  <iant@google.com>
32
33         PR gold/14570
34         * output.cc: Rename Output_data_got template parameter from size
35         to got_size for all functions.  Compile all variants of
36         Output_data_got.
37         (Output_data_got::Got_entry::write): Correct use of size for
38         symbol value.  Use local_is_tls rather than casting to
39         Sized_relobj_file.
40         * object.h (class Object): Add local_is_tls and do_local_is_tls.
41         (class Sized_relobj_file): Add do_local_is_tls.
42         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
43
44 2012-09-11  Alan Modra  <amodra@gmail.com>
45
46         PR gold/14566
47         * layout.cc (Layout::set_segment_offsets): When using
48         common-page-size alignment, ensure we are on a new max-page-size
49         page.
50         * output.cc (Output_segment::set_section_addresses): Use
51         abi_pagesize, not common_pagesize for relro boundary.
52         (Output_segment::set_offset): Likewise.
53
54 2012-09-11  Alan Modra  <amodra@gmail.com>
55
56         * output.h (Output_data_got::add_global_tls, add_local_tls,
57         add_local_tls_pair): New functions.
58         (Output_data_got::add_local_pair_with_rel): Remove second
59         reloc param.  Expand comment.
60         (Output_data_got::Got_entry): Rename use_plt_offset_ to
61         use_plt_or_tls_offset_, similarly for constructor param.
62         (Output_data_got::Got_entry::write): Add got_index param.
63         * output.cc (Output_data_got::add_global_tls, add_local_tls,
64         add_local_tls_pair): New functions.
65         (Output_data_got::Got_entry::write): Handle tls symbols
66         with use_plt_or_tls_offset_ set specially.
67         (Output_data_got::add_local_pair_with_rel): Only one reloc.
68         (Output_data_got::do_write): Replace iterator with index, pass
69         index to entry write function.
70         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
71         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
72         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
73         call.
74         * i386.cc (Target_i386::Scan::local): Likewise.
75         * sparc.cc (Target_sparc::Scan::local): Likewise.
76         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
77         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
78         do_tls_offset_for_global): New functions.
79         (Target_powerpc::Scan::local): Correct TLS relocations and got
80         entry values.
81         (Target_powerpc::Scan::global): Don't emit unnecessary
82         dynamic relocations on TLS GOT entries.
83
84 2012-09-10  Matthias Klose  <doko@ubuntu.com>
85
86         * config.in: Disable sanity check for kfreebsd.
87
88 2012-09-10  Sterling Augustine  <saugustine@google.com>
89
90         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
91         (Gdb_index::pubtypes_read): New parameter.
92         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
93         to calls.
94         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
95         pubtypes_object_.
96
97 2012-09-09  Alan Modra  <amodra@gmail.com>
98
99         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
100         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
101         * gc.h (gc_process_relocs): Call target gc_add_reference.
102         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
103         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
104         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
105         unnecessary cast.
106         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
107         to cater for when we don't need code offset.  Update use.
108         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
109         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
110         set_opd_valid): New functions.
111         (Target_powerpc::do_gc_add_reference): New function.
112         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
113         stashed refs.
114         (Target_powerpc::do_gc_mark_symbol): New function.
115
116 2012-09-06  Cary Coutant  <ccoutant@google.com>
117
118         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
119         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
120         (Dwarf_die::skip_attributes): Likewise.
121         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
122         * testsuite/gdb_index_test.cc (inline_func_1): New function.
123         (main): Call it.
124         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
125
126 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
127
128         * testsuite/script_test_3.t: Add .got.plt output section
129         statement.
130         * testsuite/script_test_4.t: Likewise.
131
132 2012-09-05  Alan Modra  <amodra@gmail.com>
133
134         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
135         update all uses and lose "enum" when using type.
136
137 2012-09-05  Alan Modra  <amodra@gmail.com>
138
139         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
140         * configure: Regenerate.
141         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
142         (plugin_final_layout.stdout): Likewise.
143         (memory_test): Set page sizes to 0x1000.
144         * testsuite/Makefile.in: Regenerate.
145         * testsuite/discard_locals_test.sh: Add FIXME comment.
146         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
147         * testsuite/pr14265.t: Add .got output section statement.
148         * testsuite/script_test_2.t: Likewise.
149         * testsuite/script_test_3.t: Likewise.
150         * testsuite/script_test_4.t: Likewise.
151         * testsuite/script_test_5.t: Likewise.
152         * testsuite/script_test_6.t: Likewise.
153         * testsuite/script_test_7.t: Likewise.
154         * testsuite/script_test_9.t: Likewise.
155
156 2012-09-05  Alan Modra  <amodra@gmail.com>
157
158         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
159         (Powerpc_relocate_functions::Status): New typedef.
160         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
161         (Target_powerpc::Scan::local): Handle REL64.
162         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
163         for REL32 and REL64.
164         (Target_powerpc::symval_for_branch): New function, extracted from..
165         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
166         checks.  Report overflow errors.
167
168 2012-09-05  Alan Modra  <amodra@gmail.com>
169
170         * object.h (Sized_relobj_file::emit_relocs): Delete.
171         (Sized_relobj_file::emit_relocs_reltype): Delete.
172         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
173         relocate_relocs for --emit-relocs.
174         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
175         * output.h: Update comment.
176         (Output_segment::first_section): New function.
177         (Output_segment::first_section_load_address): Use first_section.
178         * output.cc (Output_segment::first_section): New function extracted..
179         (Output_segment::first_section_load_address): ..from here.  Delete.
180         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
181         * target.h (Sized_target::relocate_for_relocatable): Likewise.
182         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
183         adjust call to target.h function.
184         * i386.cc (Target_i386): Likewise.
185         * sparc.cc (Target_sparc): Likewise.
186         * x86_64.cc (Target_x86_64): Likewise.
187         * powerpc.cc (Target_powerpc): Likewise.
188         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
189         first tls section has section symbol for optimised local dynamic
190         output relocs.
191         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
192         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
193         optimised tls code.
194         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
195         Rename to relocate_relocs.  Update error message.
196
197 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
198
199         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
200         --just-symbols.
201
202 2012-08-31  Alan Modra  <amodra@gmail.com>
203
204         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
205         (Powerpc_relobj::toc_base_offset): New stub function.
206         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
207         got_mod_index_offset to tlsld_got_offset.  Update all refs.
208         (Target_powerpc::Relocate::enum skip_tls): New.
209         (Target_powerpc::call_tls_get_addr_): New var.
210         (Target_powerpc::is_branch_reloc): Move to file scope.
211         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
212         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
213         New functions.
214         (Target_powerpc::enum Got_type): Delete old values, add new ones.
215         (powerpc_info): Correct common_pagesize for ppc64.
216         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
217         (Powerpc_relocate_functions): Add overflow check enums and functions.
218         Add non-shift version of rela, rela_ua.  Delete all rel public
219         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
220         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
221         addr16_ha3, addr14 functions.
222         (Output_data_got_powerpc::add_constant_pair): New function.
223         (Output_data_got_powerpc::got_base_offset): Likewise.
224         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
225         (instruction constants): Sort, add some more.
226         (Output_data_glink::do_write): Add and use Address typedef.  Use
227         object->toc_base_offset() stub for 64-bit.
228         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
229         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
230         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
231         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
232         Always treat .opd relocs as against locally defined symbol.
233         Correct condition for RELATIVE relocs.
234         (Target_powerpc::do_finalize_sections): Test for NULL sections.
235         (Target_powerpc::Relocate::relocate): Use plt call stub as value
236         for 32-bit syms with a plt entry.  Correct ppc64 toc base
237         calculations.  Handle TLS relocs, and more.  Add overflow
238         checking and adjust for Powerpc_relocate_functions changes.
239         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
240         Reinstate --emit-relocs code with FIXME.
241
242 2012-08-30  Alan Modra  <amodra@gmail.com>
243
244         * layout.cc (Layout::set_segment_offsets): Set p_align to
245         abi_pagesize, not common_pagesize.
246         (Layout::relaxation_loop_body): Similarly use abi_pagesize
247         to determine whether file header can go in segment.
248
249 2012-08-30  Alan Modra  <amodra@gmail.com>
250
251         * output.h (Output_reloc::Output_reloc <output section>): Add
252         is_relative param.  Adjust calls.
253         (Output_reloc::add_output_section_relative): New functions.
254         * output.cc (Output_reloc::Output_reloc <output section>): Handle
255         is_relative.
256         (Output_reloc::symbol_value): Handle SECTION_CODE.
257
258 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
259
260         * gold.cc (queue_middle_tasks): Call layout again when unique
261         segments for sections is desired.
262         * layout.cc (Layout::Layout): Initialize new members.
263         (Layout::get_output_section_flags): New function.
264         (Layout::choose_output_section): Call get_output_section_flags.
265         (Layout::layout): Make output section for mapping to a unique segment.
266         (Layout::insert_section_segment_map): New function.
267         (Layout::attach_allocated_section_to_segment): Make unique segment for
268         output sections marked so.
269         (Layout::segment_precedes): Check for unique segments when sorting.
270         * layout.h (Layout::Unique_segment_info): New struct.
271         (Layout::Section_segment_map): New typedef.
272         (Layout::insert_section_segment_map): New function.
273         (Layout::get_output_section_flags): New function.
274         (Layout::is_unique_segment_for_sections_specified): New function.
275         (Layout::set_unique_segment_for_sections_specified): New function.
276         (Layout::unique_segment_for_sections_specified_): New member.
277         (Layout::section_segment_map_): New member.
278         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
279         Rename is_gc_pass_one to is_pass_one.
280         Rename is_gc_pass_two to is_pass_two.
281         Rename is_gc_or_icf to is_two_pass.
282         Check for which pass based on whether symbols data is present.
283         Make it two pass when unique segments for sections is desired.
284         * output.cc (Output_section::Output_section): Initialize new
285         members.
286         * output.h (Output_section::is_unique_segment): New function.
287         (Output_section::set_is_unique_segment): New function.
288         (Output_section::is_unique_segment_): New member.
289         (Output_section::extra_segment_flags): New function.
290         (Output_section::set_extra_segment_flags): New function.
291         (Output_section::extra_segment_flags_): New member.
292         (Output_section::segment_alignment): New function.
293         (Output_section::set_segment_alignment): New function.
294         (Output_section::segment_alignment_): New member.
295         (Output_segment::Output_segment): Initialize is_unique_segment_.
296         (Output_segment::is_unique_segment): New function.
297         (Output_segment::set_is_unique_segment): New function.
298         (Output_segment::is_unique_segment_): New member.
299         * plugin.cc (allow_unique_segment_for_sections): New function.
300         (unique_segment_for_sections): New function.
301         (Plugin::load): Add new functions to transfer vector.
302         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
303         * Makefile.in: Regenerate.
304         * testsuite/plugin_final_layout.sh: Check if unique segment
305         functionality works.
306         * testsuite/plugin_section_order.c (onload): Check if new interfaces
307         are available.
308         (allow_unique_segment_for_sections): New global.
309         (unique_segment_for_sections): New global.
310         (claim_file_hook): Call allow_unique_segment_for_sections.
311         (all_symbols_read_hook): Call unique_segment_for_sections.
312
313 2012-08-22  Cary Coutant  <ccoutant@google.com>
314
315         * layout.cc (Layout::include_section): Don't assert on GROUP
316         sections with --emit-relocs.
317
318 2012-08-21  Cary Coutant  <ccoutant@google.com>
319
320         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
321         if --export-dynamic-symbol names an undef symbol.
322
323 2012-08-18  Alan Modra  <amodra@gmail.com>
324
325         * powerpc.cc: Formatting and white space.
326         (Powerpc_relobj): Rename got2_section_ to special_.
327         Add opd_ent_shndx_ and opd_ent_off_ vectors.
328         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
329         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
330         (Target_powerpc): Add Address typedef and invalid_address.  Use
331         throughout.
332         (Target_powerpc::is_branch_reloc): New function.
333         (Powerpc_relocate_functions): Add Address typedef, use throughout.
334         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
335         for dst_mask, value and addend.
336         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
337         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
338         (Output_data_glink::do_write): Correct toc base.  Don't try to use
339         uint16_t for 24-bit offset.  Use get_output_section_offset and
340         check return.
341         (Target_powerpc::Scan::local): Handle more relocs.
342         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
343         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
344         Plug in toc restoring insn after plt calls.  Translate branches
345         to function descriptor symbols to corresponding entry point.
346         (Target_powerpc::relocate_for_relocatable): Check return from
347         get_output_section_offset.
348         * symtab.h: Comment typo.
349
350 2012-08-14  Ian Lance Taylor  <iant@google.com>
351
352         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
353         unsupported_relocal_local to call unsupported_reloc_global.
354
355 2012-08-14  Nick Clifton  <nickc@redhat.com>
356
357         PR ld/14265
358         * script-sections.cc (Sections_element::output_section_name): Add
359         keep return parameter.
360         (Output_section_element::match_name): Add keep return parameter.
361         Return the value of the keep_ member.
362         * script-sections.h (class Output_section): Update
363         output_section_name prototype.
364         * layout.cc (Layout::keep_input_section): New public member
365         function.
366         (Layout::choose_output_section): Pass keep parameter to
367         output_section_name.
368         * layout.h (class Layout): Add keep_input_section.
369         * object.cc (Sized_relobj_file::do_layout): Check for kept input
370         sections.
371         * testsuite/Makefile.am: Add a test.
372         * testsuite/Makefile.in: Regenerate.
373         * testsuite/pr14265.c: Source file for the test.
374         * testsuite/pr14265.t: Linker script for the test.
375         * testsuite/pr14265.sh: Shell script for the test.
376
377 2012-08-14  Alan Modra  <amodra@gmail.com>
378
379         * target.h (Target::output_section_name): New function.
380         (Target::do_output_section_name): New function.
381         * layout.cc (Layout::choose_output_section): Call the above.
382         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
383
384 2012-08-14  Alan Modra  <amodra@gmail.com>
385
386         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
387         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
388         for replace_constant call.
389         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
390         (Output_data_glink::do_print_to_mapfile): New function.
391         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
392         (Target_powerpc::Relocate::relocate): Likewise.
393
394 2012-08-14  Alan Modra  <amodra@gmail.com>
395
396         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
397         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
398         (Output_data_glink::add_entry,find_entry): Remove shndx param.
399         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
400         all references to shndx_.  Handle special case for R_PPC_PLTREL24
401         here.
402         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
403         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
404         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
405         here.
406         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
407         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
408
409 2012-08-12  Alan Modra  <amodra@gmail.com>
410
411         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
412         (glink insn constants): Use uint32_t.
413         (Output_data_glink::add_entry): Use insert, not [] operator.
414
415 2012-08-11  Alan Modra  <amodra@gmail.com>
416
417         * object.h (Sized_relobj_file::find_shdr): New function.
418         (Sized_relobj_file::find_special_sections): New function.
419         * object.cc (Sized_relobj_file::find_shdr): New function.
420         (Sized_relobj_file::find_eh_frame): Use find_shdr.
421         (Sized_relobj_file::find_special_sections): New function, split out..
422         (Sized_relobj_file::do_read_symbols): ..from here.
423         * output.h (Output_data_got::replace_constant): New function.
424         (Output_data_got::num_entries): New function.
425         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
426         (Output_data_got::got_offset): Protected rather than private.
427         (Output_data_got::replace_got_entry): New function.
428         * output.cc (Output_data_got::replace_got_entry): New function.
429         * powerpc.cc (class Powerpc_relobj): New.
430         (class Powerpc_relocate_functions): Delete all psymval variants or
431         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
432         Implement _ha functions using corresponding _hi function.
433         (Powerpc_relobj::find_special_sections): New function.
434         (Target_powerpc::do_make_elf_object): New function.
435         (class Output_data_got_powerpc): New.
436         (class Output_data_glink): New.
437         (class Powerpc_scan_relocatable_reloc): New.
438         Many more changes througout file.
439
440 2012-08-09  Nick Clifton  <nickc@redhat.com>
441
442         * po/vi.po: Updated Vietnamese translation.
443
444 2012-08-07  Ian Lance Taylor  <iant@google.com>
445
446         * layout.cc (Layout::add_target_dynamic_tags): If
447         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
448         plt_rel.
449
450 2012-07-30  Nick Clifton  <nickc@redhat.com>
451
452         * po/gold.pot: Updated template.
453         * po/es.po: Updated Spanish translation.
454
455 2012-07-18  Cary Coutant  <ccoutant@google.com>
456
457         PR gold/14344
458         * configure.ac: Add check for -gpubnames support.
459         * configure: Regenerate.
460         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
461         support; force -gno-pubnames.
462         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
463         support.
464         (gdb_index_test_4): New test.
465         * testsuite/Makefile.in: Regenerate.
466         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
467         * testsuite/gdb_index_test_2.sh: Likewise.
468         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
469         * testsuite/gdb_index_test_4.sh: New script.
470         * testsuite/gdb_index_test_comm.sh: New script with common code;
471         don't look for space after colon.
472
473 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
474
475         * gold.cc (queue_middle_tasks): Update function order only after
476         deferred objects due to plugins are processed.
477
478 2012-07-11  Ian Lance Taylor  <iant@google.com>
479
480         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
481         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
482         (Target_arm::scan_reloc_for_stub): Likewise.
483         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
484         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
485         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
486         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
487         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
488
489 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
490             Ian Lance Taylor  <iant@google.com>
491
492         PR gold/14309
493         * configure.ac: Test whether std::tr1::hash<off_t> works.
494         * gold.h: Add a specialization for std::tr1::hash<off_t> if
495         needed.
496         * output.h (class Output_fill): Add virtual destructor.
497         * configure, config.in: Rebuild.
498
499 2012-06-22  Roland McGrath  <mcgrathr@google.com>
500
501         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
502
503 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
504
505         * plugin.cc (Plugin::load): Handle position independent executables.
506
507 2012-06-06  Cary Coutant  <ccoutant@google.com>
508
509         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
510         add .debug_macro.
511         (lines_only_debug_sections): Likewise.
512         (gdb_fast_lookup_sections): New static array.
513         (is_gdb_debug_section): Rename formal parameter.
514         (is_lines_only_debug_section): Likewise.
515         (is_gdb_fast_lookup_section): New function.
516         (Layout::include_section): Check for ".zdebug_" prefix; pass
517         section name suffix to is_gdb_debug_section, et al.; check for
518         fast-lookup sections when building .gdb_index.
519         * options.h (--strip-debug-gdb): Update GDB version number.
520
521 2012-06-06  Cary Coutant  <ccoutant@google.com>
522
523         * configure.ac: Add check for fallocate.
524         * configure: Regenerate.
525         * config.in: Regenerate.
526
527         * options.h (class General_options): Add --mmap-output-file and
528         --posix-fallocate options.
529         * output.cc: (posix_fallocate): Remove; replace with...
530         (gold_fallocate): New function.
531         (Output_file::map_no_anonymous): Call gold_fallocate.
532         (Output_file::map): Check --mmap-output-file option.
533
534 2012-06-05  Jing Yu  <jingyu@google.com>
535
536         * gold.h (textdomain): Add do {} to empty while(0).
537         (bindtextdomain): Likewise.
538
539 2012-06-04  Cary Coutant  <ccoutant@google.com>
540
541         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
542         has_dynsym_index.
543
544 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
545
546         * symtab.cc (Symbol_table::define_special_symbol):
547         Initialize *poldsym to prevent uninitialized variable errors.
548
549 2012-05-23  Cary Coutant  <ccoutant@google.com>
550
551         * layout.cc (Layout::section_name_mapping): Add rules to handle
552         exact match on .data.rel.ro.local or .data.rel.ro.
553         (Layout::output_section_name): Check for exact matches.
554
555 2012-05-23  Cary Coutant  <ccoutant@google.com>
556
557         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
558         more carefully.
559
560 2012-05-22  Cary Coutant  <ccoutant@google.com>
561
562         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
563         object before exporting symbol.
564
565 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
566
567         * testsuite/tls_test.cc: Include "config.h" first.
568         * testsuite/tls_test_c.c: Likewise.
569
570 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
571             Nick Clifton  <nickc@redhat.com>
572
573         PR 14072
574         * configure.in: Add check that sysdep.h has been included before
575         any system header files.
576         * configure: Regenerate.
577         * config.in: Regenerate.
578
579 2012-05-14  Cary Coutant  <ccoutant@google.com>
580
581         * layout.cc (Layout::make_output_section): Mark .tdata section
582         as RELRO.
583         * testsuite/relro_test.cc: Add a TLS variable.
584
585 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
586
587         PR gold/14091
588         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
589         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
590         R_X86_64_64.
591
592 2012-05-08  Cary Coutant  <ccoutant@google.com>
593
594         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
595         (lines_only_debug_sections): Likewise.
596
597 2012-05-02  Roland McGrath  <mcgrathr@google.com>
598
599         * nacl.cc: New file.
600         * nacl.h: New file.
601         * Makefile.am (CCFILES, HFILES): Add them.
602         * Makefile.in: Regenerate.
603         * i386.cc (Output_data_plt_i386_nacl): New class.
604         (Output_data_plt_i386_nacl_exec): New class.
605         (Output_data_plt_i386_nacl_dyn): New class.
606         (Target_i386_nacl): New class.
607         (Target_selector_i386_nacl): New class.
608         (target_selector_i386): Use it instead of Target_selector_i386.
609         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
610         (Target_x86_64_nacl): New class.
611         (Target_selector_x86_64_nacl): New class.
612         (target_selector_x86_64, target_selector_x32): Use it instead of
613         Target_selector_x86_64.
614         * arm.cc (Output_data_plt_arm_nacl): New class.
615         (Target_arm_nacl): New class.
616         (Target_selector_arm_nacl): New class.
617         (target_selector_arm, target_selector_armbe): Use it instead of
618         Target_selector_arm.
619
620         * target-select.cc (select_target): Take new Input_file* and off_t
621         arguments, pass them on to recognize method of selector.
622         * object.cc (make_elf_sized_object): Update caller.
623         * parameters.cc (parameters_force_valid_target): Likewise.
624         * incremental.cc (make_sized_incremental_binary): Likewise.
625         * target-select.h: Update decl.
626         (Target_selector::recognize): Take new Input_file* argument,
627         pass it on to do_recognize.
628         (Target_selector::do_recognize): Take new Input_file* argument.
629         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
630         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
631         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
632         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
633
634         * target.h (Target::Target_info): New members isolate_execinstr
635         and rosegment_gap.
636         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
637         * arm.cc (Target_arm::arm_info): Update initializer.
638         * i386.cc (Target_i386::i386_info): Likewise.
639         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
640         * sparc.cc (Target_sparc::sparc_info): Likewise.
641         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
642         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
643         * layout.cc (Layout::attach_allocated_section_to_segment):
644         Take new const Target* argument.  If target->isolate_execinstr(), act
645         like --rosegment.
646         (Layout::find_first_load_seg): Take new const Target* argument;
647         if target->isolate_execinstr(), reject PF_X segments.
648         (Layout::relaxation_loop_body): Update caller.
649         (Layout::set_segment_offsets): If target->isolate_execinstr(),
650         reset file offset to zero when we hit LOAD_SEG, and then do a second
651         loop over the segments before LOAD_SEG to reassign offsets after
652         addresses have been determined.  Handle target->rosegment_gap().
653         (Layout::attach_section_to_segment): Take new const Target* argument;
654         pass it to attach_allocated_section_to_segment.
655         (Layout::make_output_section): Update caller.
656         (Layout::attach_sections_to_segments): Take new const Target* argument;
657         pass it to attach_section_to_segment.
658         * gold.cc (queue_middle_tasks): Update caller.
659         * layout.h (Layout): Update method decls with new arguments.
660
661         * arm.cc (Target_arm::Target_arm): Take optional argument for the
662         Target_info pointer to use.
663         (Target_arm::do_make_data_plt): New virtual method.
664         (Target_arm::make_data_plt): New method that calls it.
665         (Target_arm::make_plt_entry): Use it.
666         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
667         for the section alignment.
668         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
669         method.
670         (Output_data_plt_arm::first_plt_entry_offset): Call it.
671         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
672         method.
673         (Output_data_plt_arm::get_plt_entry_size): Call it.
674         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
675         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
676         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
677         method.
678         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
679         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
680         method instead of sizeof(plt_entry).
681         (Output_data_plt_arm::add_entry): Likewise.
682         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
683         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
684         than static method.
685         (Target_arm::plt_entry_size): Likewise.
686         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
687         Move to ...
688         (Output_data_plt_arm_standard): ... here, new class.
689         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
690         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
691         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
692
693         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
694         Take additional argument for the PLT entry size.
695         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
696         Use get_plt_entry_size method rather than plt_entry_size variable.
697         (Output_data_plt_x86_64::reserve_slot): Likewise.
698         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
699         (Output_data_plt_x86_64::add_entry): Likewise.
700         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
701         (Output_data_plt_x86_64::address_for_global): Likewise.
702         (Output_data_plt_x86_64::address_for_local): Likewise.
703         (Output_data_plt_x86_64::set_final_data_size): Likewise.
704         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
705         Make method non-static.
706         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
707         method.
708         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
709         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
710         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
711         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
712         virtual method.
713         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
714         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
715         virtual method.
716         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
717         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
718         virtual method.
719         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
720         (Output_data_plt_x86_64::plt_entry_size)
721         (Output_data_plt_x86_64::first_plt_entry)
722         (Output_data_plt_x86_64::plt_entry)
723         (Output_data_plt_x86_64::tlsdesc_plt_entry)
724         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
725         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
726         (Output_data_plt_x86_64_standard): ... here, new class.
727         (Target_x86_64::Target_x86_64): Take optional argument for the
728         Target_info pointer to use.
729         (Target_x86_64::do_make_data_plt): New virtual method.
730         (Target_x86_64::make_data_plt): New method to call it.
731         (Target_x86_64::init_got_plt_for_update): Use that.
732         Call this->plt_->add_eh_frame method here.
733         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
734         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
735         rather than static method.
736         (Target_x86_64::plt_entry_size): Likewise.
737         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
738         rather than plt_entry_size variable.  Move guts of PLT filling to...
739         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
740         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
741         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
742
743         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
744         additional argument for the section alignment.
745         Don't do add_eh_frame_for_plt here.
746         (Output_data_plt_i386::first_plt_entry_offset): Make the method
747         non-static.  Use get_plt_entry_size method rather than plt_entry_size
748         variable.
749         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
750         method.
751         (Output_data_plt_i386::get_plt_entry_size): Call it.
752         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
753         (Output_data_plt_i386::add_eh_frame): New method to call it.
754         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
755         method.
756         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
757         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
758         method.
759         (Output_data_plt_i386::fill_plt_entry): New method to call it.
760         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
761         method instead of plt_entry_size.
762         (Output_data_plt_i386::plt_entry_size)
763         (Output_data_plt_i386::plt_eh_frame_fde_size)
764         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
765         (Output_data_plt_i386_standard): ... here, new class.
766         (Output_data_plt_i386_exec): New class.
767         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
768         (Output_data_plt_i386_exec::first_plt_entry): ... here.
769         (Output_data_plt_i386::exec_plt_entry): Move to ...
770         (Output_data_plt_i386_exec::plt_entry): ... here.
771         (Output_data_plt_i386_dyn): New class.
772         (Output_data_plt_i386::first_plt_entry): Move to ...
773         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
774         (Output_data_plt_i386::dyn_plt_entry): Move to ...
775         (Output_data_plt_i386_dyn::plt_entry): ... here.
776         (Target_i386::Target_i386): Take optional argument for the Target_info
777         pointer to use.
778         (Target_i386::do_make_data_plt): New virtual method.
779         (Target_i386::make_data_plt): New method to call it.
780         (Target_i386::make_plt_section): Use that.
781         Call this->plt_->add_eh_frame method here.
782         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
783         rather than plt_entry_size variable.
784         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
785         (Output_data_plt_i386::address_for_local): Likewise.
786         (Output_data_plt_i386::do_write): Likewise.
787         Move guts of PLT filling to...
788         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
789         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
790         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
791         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
792
793 2012-05-01  Cary Coutant  <ccoutant@google.com>
794
795         * dwarf_reader.cc (Dwarf_die::read_attributes)
796         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
797         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
798         * reduced_debug_output.cc
799         (Output_reduced_debug_info_section::get_die_end): Remove
800         DW_FORM_GNU_ref_index.  Add default case.
801
802 2012-04-26  Mark Wielaard  <mjw@redhat.com>
803
804         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
805         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
806         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
807         DW_AT_high_pc as offset from DW_AT_low_pc.
808
809         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
810         * testsuite/Makefile.in: Regenerate.
811         * testsuite/gdb_index_test_3.c: New test source file.
812         * testsuite/gdb_index_test_3.sh: New test source file.
813
814 2012-04-25  Ian Lance Taylor  <iant@google.com>
815
816         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
817         pointer.
818         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
819         as a class, not a struct.
820         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
821         (Target_arm::apply_cortex_a8_workaround): Likewise.
822         * gc.h: Declare Reloc_types as a struct, not a class.
823         * object.h: Declare Symbols_data as a struct.
824         * reloc.h: Declare Read_relocs_data as a struct.
825         * target.h: Declare Relocate_info as a struct.
826
827 2012-04-24  David S. Miller  <davem@davemloft.net>
828
829         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
830         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
831         and R_SPARC_WPLT30.
832
833 2012-04-24  Cary Coutant  <ccoutant@google.com>
834
835         * incremental-dump.cc (find_input_containing_global): Replace
836         magic number with symbolic constant.
837         (dump_incremental_inputs): Update version number.
838         * incremental.cc (Output_section_incremental_inputs): Update version
839         number; import symbolic constants from Incremental_inputs_reader.
840         (Incremental_inputs::create_data_sections): Align relocations
841         section correctly for 64-bit targets.
842         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
843         constants; add padding.
844         (Output_section_incremental_inputs::write_header): Add assert for
845         header_size.
846         (Output_section_incremental_inputs::write_input_files): Add assert
847         for input_entry_size.
848         (Output_section_incremental_inputs::write_info_blocks): Add padding;
849         add assert for object_info_size, input_section_entry_size,
850         global_sym_entry_size.
851         * incremental.h (Incremental_inputs_reader): Add symbolic constants
852         for data structure sizes; use them.
853         (Incremental_input_entry_reader): Import symbolic constants from
854         Incremental_inputs_reader; use them.
855
856 2012-04-23  David S. Miller  <davem@davemloft.net>
857
858         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
859         and elf_flags_set_.
860         (Target_sparc::Target_sparc): Initialize new fields.
861         (Target_sparc::do_make_elf_object): New function.
862         (Target_sparc::do_adjust_elf_header): New function.
863
864 2012-04-23  Cary Coutant  <ccoutant@google.com>
865
866         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
867         CU range table of gdb index.
868
869 2012-04-20  David S. Miller  <davem@davemloft.net>
870
871         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
872         instead of false.
873
874 2012-04-16  David S. Miller  <davem@davemloft.net>
875
876         * sparc.cc (Target_sparc::got_address): New function.
877         (Sparc_relocate_functions::gdop_hix22): New function.
878         (Sparc_relocate_functions::gdop_lox10): New function.
879         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
880         relocs.
881         (Target_sparc::Scan::local): Likewise if the global symbol is not
882         preemptible and is not IFUNC.
883         (Target_sparc::Relocate::relocate): Perform GOTDATA code
884         transformations for local and non-preemptible non-IFUNC global
885         symbols.
886
887         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
888         writing out 64-bit part of ranges.
889
890         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
891         -fpic and -fpie respectively.
892         * Makefile.in: Regenerate.
893
894         * sparc.cc (class Target_sparc): Add rela_ifunc_.
895         (Target_sparc::Target_sparc): Initialize new field.
896         (Target_sparc::do_plt_section_for_global): New function.
897         (Target_sparc::do_plt_section_for_local): New function.
898         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
899         (Target_sparc::make_plt_section): New function, broken out of
900         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
901         (Target_sparc::make_plt_entry): Call make_plt_section.
902         (Target_sparc::make_local_ifunc_plt_entry): New function.
903         (Target_sparc::rela_ifunc_section): New function.
904         (Target_sparc::plt_section): Remove const.
905         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
906         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
907         and ifunc_count_ fields.
908         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
909         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
910         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
911         (Output_data_plt_sparc::rela_ifunc): New function.
912         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
913         (Output_data_plt_sparc::has_ifunc_section): New function.
914         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
915         (Output_data_plt_sparc::address_for_global): New function.
916         (Output_data_plt_sparc::address_for_local): New function.
917         (Output_data_plt_sparc::plt_index_to_offset): New function.
918         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
919         and entry_count.
920         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
921         entry_count.
922         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
923         R_SPARC_JMP_IREL to switch.
924         (Target_sparc::Scan::check_non_pic): Likewise.
925         (Target_sparc::Scan::local): Handle IFUNC symbols.
926         (Target_sparc::Scan::local): Likewise.
927         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
928         and plt_address_for_local.
929         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
930         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
931
932         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
933         (class Output_data_reloc): Adjust calls to Output_reloc_type.
934         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
935         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
936         global relocs too.
937         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
938         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
939         calls.
940         * sparc.cc (Target_sparc::Scan::global): Likewise.
941         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
942
943 2012-04-16  Cary Coutant  <ccoutant@google.com>
944
945         * archive.cc (Library_base::should_include_member): Check for
946         --export-dynamic-symbol.
947         * options.h (class General_options): Add --export-dynamic-symbol.
948         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
949         --export-dynamic-symbol.
950         (Symbol_table::gc_mark_undef_symbols): Likewise.
951         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
952
953 2012-04-12  David S. Miller  <davem@davemloft.net>
954
955         * sparc.cc (Reloc::wdisp10): New relocation method.
956         (Reloc::h34): Likewise.
957         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
958         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
959         R_SPARC_WDISP10.
960         (Target_sparc::Scan::local): Likewise.
961         (Target_sparc::Scan::global): Likewise.
962         (Target_sparc::Relocate::relocate): Likewise.
963
964 2012-04-09  Cary Coutant  <ccoutant@google.com>
965
966         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
967         low_pc == 0.
968
969 2012-04-06  Ian Lance Taylor  <iant@google.com>
970
971         * timer.cc: #include <unistd.h>.
972
973 2012-04-06  Roland McGrath  <mcgrathr@google.com>
974
975         * configure.in (AC_CHECK_HEADERS): Add locale.h.
976         * config.in: Regenerate.
977         * configure: Regenerate.
978
979 2012-04-05  Nick Clifton  <nickc@redhat.com>
980
981         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
982         (AM_LC_MESSAGES): Add.
983         * aclocal.m4: Regenerate.
984         * config.in: Regenerate.
985         * configure: Regenerate.
986
987 2012-03-21  Cary Coutant  <ccoutant@google.com>
988
989         * Makefile.am: Add gdb-index.cc, gdb-index.h.
990         * Makefile.in: Regenerate.
991         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
992         (Sized_elf_reloc_mapper::symbol_section): New function.
993         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
994         (make_elf_reloc_mapper): New function.
995         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
996         (Dwarf_abbrev_table::do_read_abbrevs): New function.
997         (Dwarf_abbrev_table::do_get_abbrev): New function.
998         (Dwarf_ranges_table::read_ranges_table): New function.
999         (Dwarf_ranges_table::read_range_list): New function.
1000         (Dwarf_pubnames_table::read_section): New function.
1001         (Dwarf_pubnames_table::read_header): New function.
1002         (Dwarf_pubnames_table::next_name): New function.
1003         (Dwarf_die::Dwarf_die): New function.
1004         (Dwarf_die::read_attributes): New function.
1005         (Dwarf_die::skip_attributes): New function.
1006         (Dwarf_die::set_name): New function.
1007         (Dwarf_die::set_linkage_name): New function.
1008         (Dwarf_die::attribute): New function.
1009         (Dwarf_die::string_attribute): New function.
1010         (Dwarf_die::int_attribute): New function.
1011         (Dwarf_die::uint_attribute): New function.
1012         (Dwarf_die::ref_attribute): New function.
1013         (Dwarf_die::child_offset): New function.
1014         (Dwarf_die::sibling_offset): New function.
1015         (Dwarf_info_reader::check_buffer): New function.
1016         (Dwarf_info_reader::parse): New function.
1017         (Dwarf_info_reader::do_parse): New function.
1018         (Dwarf_info_reader::do_read_string_table): New function.
1019         (Dwarf_info_reader::lookup_reloc): New function.
1020         (Dwarf_info_reader::get_string): New function.
1021         (Dwarf_info_reader::visit_compilation_unit): New function.
1022         (Dwarf_info_reader::visit_type_unit): New function.
1023         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1024         Sized_elf_reloc_mapper.
1025         (Sized_dwarf_line_info::symbol_section): Remove function.
1026         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1027         (Sized_dwarf_line_info::read_line_mappings): Remove object
1028         parameter, adjust callers.
1029         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1030         * dwarf_reader.h: Include <sys/types.h>.
1031         (class Track_relocs): Remove forward declaration.
1032         (class Elf_reloc_mapper): New class.
1033         (class Sized_elf_reloc_mapper): New class.
1034         (class Dwarf_abbrev_table): New class.
1035         (class Dwarf_range_list): New class.
1036         (class Dwarf_ranges_table): New class.
1037         (class Dwarf_pubnames_table): New class.
1038         (class Dwarf_die): New class.
1039         (class Dwarf_info_reader): New class.
1040         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1041         (Sized_dwarf_line_info::symbol_section): Remove member function.
1042         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1043         base class.
1044         * gdb-index.cc: New source file.
1045         * gdb-index.h: New source file.
1046         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1047         and .debug_types sections, call Layout::add_to_gdb_index.
1048         (Sized_relobj_incr::do_section_name): Implement.
1049         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1050         return type; Implement.
1051         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1052         return type.
1053         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1054         parameter list and return type.
1055         (Sized_incr_dynobj::do_section_contents): Likewise.
1056         * layout.cc: Include gdb-index.h.
1057         (Layout::Layout): Initialize gdb_index_data_.
1058         (Layout::init_fixed_output_section): Check for .gdb_index section.
1059         (Layout::add_to_gdb_index): New function. Instantiate.
1060         * layout.h: Add forward declaration for class Gdb_index.
1061         (Layout::add_to_gdb_index): New member function.
1062         (Layout::gdb_index_data_): New data member.
1063         * main.cc: Include gdb-index.h.
1064         (main): Print statistics for gdb index.
1065         * object.cc (Object::section_contents): Move code into
1066         do_section_contents.
1067         (need_decompressed_section): Check for sections needed when building
1068         gdb index.
1069         (build_compressed_section_map): Likewise.
1070         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1071         gdb index.
1072         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1073         sections; call Layout::add_to_gdb_index.
1074         (Sized_relobj_file::do_decompressed_section_contents): Call
1075         do_section_contents directly.
1076         * object.h (Object::do_section_contents): Adjust parameter list and
1077         return type.
1078         (Object::do_decompressed_section_contents): Call do_section_contents
1079         directly.
1080         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1081         return type.
1082         * options.h (class General_options): Add --gdb-index option.
1083         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1084         list and return type.
1085         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1086         * reloc.h (Track_relocs::checkpoint): New function.
1087         (Track_relocs::reset): New function.
1088
1089         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1090         New test cases.
1091         * testsuite/Makefile.in: Regenerate.
1092         * testsuite/gdb_index_test.cc: New test source file.
1093         * testsuite/gdb_index_test_1.sh: New test source file.
1094         * testsuite/gdb_index_test_2.sh: New test source file.
1095
1096 2012-03-19  Doug Kwan  <dougkwan@google.com>
1097
1098         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1099         (Target_arm::do_finalize_sections): Remove code which defines
1100         __exidx_start and __exidx_end.  Make symbol table parameter
1101         anonymous as it is not used.
1102         * gold.cc (queue_middle_tasks): Call target hook to define any
1103         target-specific symbols.
1104         * target.h (Target::define_standard_symbols): New method.
1105         (Target::do_define_standard_symbols): Same.
1106         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1107         * testsuite/Makefile.in: Regenerate.
1108         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1109         and __exidx_end.
1110         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1111         relocations are generated for __exidx_start and __exidx_end.
1112
1113 2012-03-16  Doug Kwan  <dougkwan@google.com>
1114
1115         * testsuite/Makefile.am: Disable test initpri3b.
1116         * testsuite/Makefile.in: Regenerate.
1117
1118 2012-03-15  Doug Kwan  <dougkwan@google.com>
1119
1120         * arm.cc (Target_arm::got_section): Make .got section read-only
1121         if -z now is given.
1122
1123 2012-03-15  Ian Lance Taylor  <iant@google.com>
1124
1125         PR gold/13850
1126         * layout.cc (Layout::make_output_section): Correctly mark
1127         SHT_INIT_ARRAY, et. al., as relro.
1128
1129 2012-03-14  Doug Kwan  <dougkwan@google.com>
1130
1131         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1132         dynamic relocations for protected symbols in shared objects.
1133
1134 2012-03-13  Ian Lance Taylor  <iant@google.com>
1135
1136         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1137         keep the larger alignment.
1138
1139 2012-03-12  Cary Coutant  <ccoutant@google.com>
1140
1141         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1142         handling of DW_LNE_define_file.
1143
1144 2012-03-12  Cary Coutant  <ccoutant@google.com>
1145
1146         * reduced_debug_output.cc
1147         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1148         codes to switch.
1149
1150 2012-02-29  Cary Coutant  <ccoutant@google.com>
1151
1152         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1153
1154 2012-02-29  Cary Coutant  <ccoutant@google.com>
1155
1156         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1157         Call Object::decompressed_section_contents.
1158         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1159         New dtor.
1160         (Sized_dwarf_line_info::buffer_start_): New data member.
1161         * merge.cc (Output_merge_data::do_add_input_section): Call
1162         Object::decompressed_section_contents.
1163         (Output_merge_string::do_add_input_section): Likewise.
1164         * object.cc (need_decompressed_section): New function.
1165         (build_compressed_section_map): Decompress sections needed later.
1166         (Sized_relobj_file::do_decompressed_section_contents): New function.
1167         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1168         * object.h (Object::decompressed_section_contents): New function.
1169         (Object::discard_decompressed_sections): New function.
1170         (Object::do_decompressed_section_contents): New function.
1171         (Object::do_discard_decompressed_sections): New function.
1172         (Compressed_section_info): New type.
1173         (Compressed_section_map): Include decompressed section contents.
1174         (Sized_relobj_file::do_decompressed_section_contents): New function.
1175         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1176
1177 2012-02-16  Cary Coutant  <ccoutant@google.com>
1178
1179         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1180         * testsuite/Makefile.in: Regenerate.
1181
1182 2012-02-14  Cary Coutant  <ccoutant@google.com>
1183
1184         * options.cc (General_options::finalize): Disallow -pie and -static.
1185
1186 2012-02-03  Doug Kwan  <dougkwan@google.com>
1187
1188         * arm.cc (Arm_relocate_functions::abs8,
1189         Arm_relocate_functions::abs16): Use
1190         Bits::has_signed_unsigned_overflow32.
1191         (Arm_relocate_functions::thm_abs8): Correct range of
1192         overflow check.
1193         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1194         in assertions.
1195
1196 2012-02-02  Doug Kwan  <dougkwan@google.com>
1197
1198         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1199         position independent outputs, not just shared objects.
1200
1201 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1202
1203         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1204         * configure: Regenerated.
1205
1206 2012-01-27  Ian Lance Taylor  <iant@google.com>
1207
1208         * reloc.h (Bits): New class with static functions, copied from
1209         namespace utils in arm.cc.
1210         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1211         instead.
1212
1213 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1214
1215         * incremental.cc (write_info_blocks): Correct relocation offset.
1216
1217 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1218
1219         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1220         (Relocate::tls_gd_to_le): Likewise.
1221
1222 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1223
1224         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1225
1226 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1227
1228         * configure.ac: Check if -mcmodel=medium works.
1229         * configure: Regenerated.
1230
1231 2012-01-24  Cary Coutant  <ccoutant@google.com>
1232
1233         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1234         definition and ...
1235         (read_unsigned_LEB_128_x): ... this new function.
1236         (read_signed_LEB_128): Replaced with inline definition and ...
1237         (read_signed_LEB_128_x): ... this new function.
1238         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1239         (read_unsigned_LEB_128): Add inline definition.
1240         (read_signed_LEB_128_x): New function.
1241         (read_signed_LEB_128): Add inline definition.
1242         * testsuite/Makefile.am (leb128_unittest): New unit test.
1243         * testsuite/Makefile.in: Regenerate.
1244         * testsuite/leb128_unittest.cc: New unit test.
1245
1246 2012-01-23  Ian Lance Taylor  <iant@google.com>
1247
1248         PR gold/13617
1249         * i386.cc (Target_i386::do_code_fill): When using a jmp
1250         instruction, pad with nop instructions.
1251         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1252
1253 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1254
1255         * x86_64.cc (gc_process_relocs): Add typename on types used in
1256         template.
1257         (scan_relocs): Likewise.
1258         (relocate_section): Likewise.
1259         (apply_relocation): Likewise.
1260
1261 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1262
1263         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1264         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1265         under x32.
1266
1267 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1268
1269         * x86_64.cc: Initial support for x32.
1270
1271 2012-01-03  Cary Coutant  <ccoutant@google.com>
1272
1273         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1274         Use abstract base class for GOT.
1275         * gold/output.h (class Output_data_got_base): New abstract base class.
1276         (class Output_data_got): Derive from new base class, adjust ctors.
1277         (Output_data_got::reserve_slot): Make virtual; rename to
1278         do_reserve_slot; Adjust callers.
1279         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1280         pointer to abstract base class.
1281         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1282
1283 2011-12-18  Ian Lance Taylor  <iant@google.com>
1284
1285         * object.h (Relobj::local_symbol_value): New function.
1286         (Relobj::local_plt_offset): New function.
1287         (Relobj::local_has_got_offset): New function.
1288         (Relobj::local_got_offset): New function.
1289         (Relobj::set_local_got_offset): New function.
1290         (Relobj::do_local_symbol_value): New pure virtual function.
1291         (Relobj::do_local_plt_offset): Likewise.
1292         (Relobj::do_local_has_got_offset): Likewise.
1293         (Relobj::do_local_got_offset): Likewise.
1294         (Relobj::do_set_local_got_offset): Likewise.
1295         (Sized_relobj::do_local_has_got_offset): Rename from
1296         local_has_got_offset.
1297         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1298         (Sized_relobj::do_set_local_got_offset): Rename from
1299         set_local_got_offset.
1300         (Sized_relobj_file::do_local_plt_offset): Rename from
1301         local_plt_offset.
1302         (Sized_relobj_file::do_local_symbol_value): New function.
1303         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1304         local_plt_offset.
1305         * output.cc (Output_data_got::Got_entry::write): Change object to
1306         Relobj.  Use local_symbol_value.
1307         (Output_data_got::add_global_with_rel): Change rel_dyn to
1308         Output_data_reloc_generic*.  Use add_global_generic.
1309         (Output_data_got::add_global_with_rela): Remove.  Change all
1310         callers to use add_global_with_rel.
1311         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1312         Output_data_reloc_generic*.  Use add_global_generic.
1313         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1314         callers to use add_global_pair_with_rel.
1315         (Output_data_got::add_local): Change object to Relobj*.
1316         (Output_data_got::add_local_plt): Likewise.
1317         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1318         change rel_dyn to Output_data_reloc_generic*.  Use
1319         add_local_generic.
1320         (Output_data_got::add_local_with_rela): Remove.  Change all
1321         callers to use all_local_with_rel.
1322         (Output_data_got::add_local_pair_with_rel): Change object to
1323         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1324         add_output_section_generic.
1325         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1326         callers to use add_local_pair_with_rel.
1327         (Output_data_got::reserve_local): Change object to Relobj*.
1328         * output.h: (class Output_data_reloc_generic): Add pure virtual
1329         declarations for add_global_generic, add_local_generic,
1330         add_output_section_generic.
1331         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1332         functions for Output_data_reloc_generic.  Update declarations for
1333         changes listed in output.cc.
1334         (class Output_data_got): Change template parameter to got_size.
1335         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1336         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1337         function.
1338         (Sized_relobj_incr::do_local_plt_offset): New function.
1339         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1340         add_global_generic.
1341
1342 2011-12-17  Cary Coutant  <ccoutant@google.com>
1343
1344         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1345         * resolve.cc (Symbol_table::resolve): Likewise.
1346         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1347         arrays.
1348         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1349
1350 2011-12-16  Ian Lance Taylor  <iant@google.com>
1351
1352         * output.h (Output_data_reloc_generic::add): Only call
1353         add_dynamic_reloc if this is a dynamic reloc section.
1354
1355 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1356
1357         PR gold/13505
1358         * target-reloc.h (apply_relocation): Replace <64, false> with
1359         <size, big_endian>.
1360
1361 2011-11-25  Nick Clifton  <nickc@redhat.com>
1362
1363         * po/it.po: New Italian translation.
1364
1365 2011-11-17  Sterling Augustine  <saugustine@google.com>
1366
1367         * script.cc (script_include_directive): Implement.
1368         (read_script_file): New local variables name and search_path. Update
1369         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1370         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1371         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1372
1373 2011-11-11  Sterling Augustine  <saugustine@google.com>
1374
1375         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1376         (file_or_sections_cmd): Likewise.
1377
1378 2011-11-11  Doug Kwan  <dougkwan@google.com>
1379
1380         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1381         if --just-symbols is given.
1382
1383 2011-11-10  Doug Kwan  <dougkwan@google.com>
1384
1385         PR gold/13362
1386         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1387         when processing data relocs.
1388         * reloc.h (Relocate_functions::rel_unaligned): New method.
1389         (Relocate_functions::pcrel_unaligned): Ditto.
1390         (Relocate_functions::rel32_unaligned): Ditto.
1391         (Relocate_functions::pcrel32_unaligned): Ditto.
1392
1393 2011-11-09  Doug Kwan  <dougkwan@google.com>
1394
1395         PR gold/13362
1396         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1397         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1398         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1399         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1400         (Relocate_functions::rel_unaligned): New.
1401         (Relocate_functions::rel32_unaligned): New.
1402         * target-reloc.h (relocate_for_relocatable): Add code to handle
1403         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1404         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1405         arm_unaligned_reloc_r): New targets.
1406         * testsuite/Makefile.in: Regenerate.
1407         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1408         linking.
1409
1410 2011-11-02  Ian Lance Taylor  <iant@google.com>
1411
1412         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1413         NATIVE_LINKER.
1414         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1415         * options.cc (General_options::finalize): Use library search path
1416         from configure script if specified.  If not native and no sysroot,
1417         only search TOOLLIBDIR.
1418         * options.h (Search_directory::Search_directory): Change name to
1419         const std::string&.
1420         (General_options::add_to_library_path_with_sysroot): Change arg to
1421         const std::string&.
1422         * configure, Makefile.in, config.in: Rebuild.
1423
1424 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1425
1426         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1427         we are working around the ARM1176 Erratum.
1428         * options.h (General_options::fix_arm1176): Add option.
1429         * testsuite/Makefile.am: Add testcases, and keep current ones
1430         working.
1431         * testsuite/Makefile.in: Regenerate.
1432         * testsuite/arm_fix_1176.s: New file.
1433         * testsuite/arm_fix_1176.sh: Likewise.
1434
1435 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1436
1437         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1438         may_use_blx_.
1439         (Target_arm::may_use_blx): Remove method.
1440         (Target_arm::set_may_use_blx): Likewise.
1441         (Target_arm::may_use_v4t_interworking): New method.
1442         (Target_arm::may_use_v5t_interworking): Likewise.
1443         (Target_arm::may_use_blx_): Remove member variable.
1444         (Arm_relocate_functions::arm_branch_common): Check for v5T
1445         interworking.
1446         (Arm_relocate_functions::thumb_branch_common): Likewise.
1447         (Reloc_stub::stub_type_for_reloc): Likewise.
1448         (Target_arm::do_finalize_sections): Correct interworking checks.
1449         * testsuite/Makefile.am: Add new tests.
1450         * testsuite/Makefile.in: Regenerate.
1451         * testsuite/arm_farcall_arm_arm.s: New test.
1452         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1453         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1454         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1455         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1456         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1457         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1458         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1459
1460 2011-10-31  Cary Coutant  <ccoutant@google.com>
1461
1462         PR gold/13023
1463         * expression.cc (Expression::eval_with_dot): Add
1464         is_section_dot_assignment parameter.
1465         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1466         absolute and assigning to dot within a section.
1467         * script-sections.cc
1468         (Output_section_element_assignment::set_section_addresses): Pass
1469         dot_section to set_if_absolute.
1470         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1471         as is_section_dot_assignment flag to eval_with_dot.
1472         (Output_section_element_dot_assignment::set_section_addresses):
1473         Likewise.
1474         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1475         parameter.  Also set value if relative to dot_section; set the
1476         symbol's output_section.
1477         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1478         parameter.  Adjust all callers.
1479         (Expression::eval_maybe_dot): Likewise.
1480         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1481         Adjust all callers.
1482         * testsuite/script_test_2.t: Test assignment of an absolute value
1483         to dot within an output section element.
1484
1485 2011-10-31  Cary Coutant  <ccoutant@google.com>
1486
1487         * options.h (class General_options): Add --[no-]gnu-unique options.
1488         * symtab.cc (Symbol_table::sized_write_globals): Convert
1489         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1490
1491 2011-10-31  Cary Coutant  <ccoutant@google.com>
1492
1493         PR gold/13359
1494         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1495         unnecessary assertion.
1496         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1497
1498 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1499
1500         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1501         gc_mark_symbol.
1502         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1503         gc_mark_symbol.
1504         Change to just keep the section associated with symbol.
1505         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1506         they are externally visible and --export-dynamic is turned on.
1507         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1508
1509 2011-10-19  Ian Lance Taylor  <iant@google.com>
1510
1511         PR gold/13163
1512         * script-sections.cc
1513         (Output_section_element_dot_assignment::needs_output_section): New
1514         function.
1515
1516 2011-10-19  Ian Lance Taylor  <iant@google.com>
1517
1518         PR gold/13204
1519         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1520         --section-start option was seen.
1521         * options.h (General_options::any_section_start): New function.
1522
1523 2011-10-18  David S. Miller  <davem@davemloft.net>
1524
1525         PR binutils/13301
1526         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1527         member to track relocation locations that have moved during TLS
1528         reloc optimizations.
1529         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1530         (Target_sparc::Relocate::relocate): Adjust view down by 4
1531         bytes if it matches reloc_adjust_addr_.
1532         (Target_sparc::Relocate::relocate_tls): Always move the
1533         __tls_get_addr call delay slot instruction forward 4 bytes when
1534         performing relaxation.
1535
1536 2011-10-18  Cary Coutant  <ccoutant@google.com>
1537
1538         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1539         (Output_file::map_no_anonymous): Check for non-zero
1540         return code from posix_fallocate.
1541
1542 2011-10-17  Cary Coutant  <ccoutant@google.com>
1543
1544         PR gold/13245
1545         * plugin.cc (is_visible_from_outside): Check for symbols
1546         referenced from dynamic objects.
1547         * resolve.cc (Symbol_table::resolve): Don't count references
1548         from dynamic objects as references from real ELF files.
1549         * testsuite/plugin_test_2.sh: Adjust expected result.
1550
1551 2011-10-17  Cary Coutant  <ccoutant@google.com>
1552
1553         * gold.cc: Include timer.h.
1554         (queue_middle_tasks): Stamp time.
1555         (queue_final_tasks): Likewise.
1556         * main.cc (main): Store timer in parameters.  Print timers
1557         for each pass.
1558         * parameters.cc (Parameters::Parameters): Initialize timer_.
1559         (Parameters::set_timer): New function.
1560         (set_parameters_timer): New function.
1561         * parameters.h (Parameters::set_timer): New function.
1562         (Parameters::timer): New function.
1563         (Parameters::timer_): New data member.
1564         (set_parameters_timer): New function.
1565         * timer.cc (Timer::stamp): New function.
1566         (Timer::get_pass_time): New function.
1567         * timer.h (Timer::stamp): New function.
1568         (Timer::get_pass_time): New function.
1569         (Timer::pass_times_): New data member.
1570
1571 2011-10-17  Cary Coutant  <ccoutant@google.com>
1572
1573         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1574         task for members of lib groups.
1575
1576 2011-10-17  Cary Coutant  <ccoutant@google.com>
1577
1578         PR gold/13288
1579         * fileread.cc (File_read::find_view): Add assert.
1580         (File_read::make_view): Move bounds check (replace with assert)...
1581         (File_read::find_or_make_view): ... to here.
1582
1583 2011-10-12  Cary Coutant  <ccoutant@google.com>
1584
1585         * output.cc (Output_file::open_base_file): Handle case where
1586         ::read returns less than requested size.
1587
1588 2011-10-10  Cary Coutant  <ccoutant@google.com>
1589
1590         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1591         Initialize defined_count_.
1592         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1593         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1594         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1595         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1596         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1597         * incremental.h (Sized_relobj_incr::defined_count_): New data
1598         member.
1599         (Sized_incr_dynobj::defined_count_): New data member.
1600         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1601         Return zeroes instead of internal error.
1602
1603 2011-10-10  Cary Coutant  <ccoutant@google.com>
1604
1605         PR gold/13249
1606         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1607         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1608         * output.h (class Output_reloc): Add use_plt_offset flag.
1609         (Output_reloc::type_): Adjust size of bit field.
1610         (Output_reloc::use_plt_offset_): New bit field.
1611         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1612         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1613         flag.  Adjust all callers.
1614         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1615         creating RELATIVE relocations.
1616
1617 2011-10-10  Nick Clifton  <nickc@redhat.com>
1618
1619         * po/es.po: Updated Spanish translation.
1620         * po/fi.po: Updated Finnish translation.
1621
1622 2011-10-03   Diego Novillo  <dnovillo@google.com>
1623
1624         * options.cc (parse_uint): Fix dereference of RETVAL.
1625
1626 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1627
1628         * layout.h (section_order_map_): New member.
1629         (get_section_order_map): New member function.
1630         * output.cc (Output_section::add_input_section): Check for patterns
1631         only when --section-ordering-file is specified.
1632         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1633         output_sections have been formed.
1634         * layout.cc (Layout_Layout): Initialize section_order_map_.
1635         * plugin.cc (update_section_order): Store order in order_map. Do not
1636         update the order.
1637         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1638         * testsuite/Makefile.in: Regenerate.
1639         * testsuite/plugin_section_order.c: New file.
1640         * testsuite/plugin_final_layout.cc: New file.
1641         * testsuite/plugin_final_layout.sh: New file.
1642
1643 2011-09-29  Cary Coutant  <ccoutant@google.com>
1644
1645         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1646         Check for NULL.
1647         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1648         symbols during incremental update.
1649         (Symbol_table::add_from_dynobj): Likewise.
1650
1651 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1652             Ian Lance Taylor  <iant@google.com>
1653
1654         * symtab.cc (Symbol_table::define_special_symbol): Always
1655         canonicalize version string.
1656
1657 2011-09-26  Cary Coutant  <ccoutant@google.com>
1658
1659         * gold.cc (queue_initial_tasks): Move option checks ...
1660         * options.cc (General_options::finalize): ... to here. Disable
1661         some options; make others fatal.
1662
1663 2011-09-26  Cary Coutant  <ccoutant@google.com>
1664
1665         gcc PR lto/47247
1666         * plugin.cc (get_symbols_v2): New function.
1667         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1668         (is_referenced_from_outside): New function.
1669         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1670         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1671         (get_symbols): Pass version parameter.
1672         (get_symbols_v2): New function.
1673         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1674         parameter.
1675         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1676         (onload): Add LDPT_GET_SYMBOLS_V2.
1677         (all_symbols_read_hook): Use get_symbols_v2; check for
1678         LDPR_PREVAILING_DEF_IRONLY_EXP.
1679         * testsuite/plugin_test_3.sh: Update expected results.
1680
1681 2011-09-23  Simon Baldwin  <simonb@google.com>
1682
1683         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1684         configuration options.
1685         * configure: Regenerate.
1686         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1687         * Makefile.in: Regenerate.
1688         * testsuite/Makefile.in: Regenerate.
1689
1690 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1691
1692         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1693
1694 2011-09-19  Cary Coutant  <ccoutant@google.com>
1695
1696         * incremental.cc (can_incremental_update): Fix typo in comment.
1697         * incremental.h (can_incremental_update): Likewise.
1698
1699 2011-09-18  Cary Coutant  <ccoutant@google.com>
1700
1701         * incremental.cc (can_incremental_update): New function.
1702         * incremental.h (can_incremental_update): New function.
1703         * layout.cc (Layout::init_fixed_output_section): Call it.
1704         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1705         * object.cc (Sized_relobj_file::do_layout): Call
1706         can_incremental_update.
1707
1708 2011-09-13  Cary Coutant  <ccoutant@google.com>
1709
1710         * configure.ac: Check for glibc support for gnu_indirect_function
1711         support with static linking, setting automake conditional
1712         IFUNC_STATIC.
1713         * Makefile.in: Regenerate.
1714         * configure: Regenerate.
1715
1716         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1717         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1718         for IFUNC_STATIC.
1719         * testsuite/Makefile.in: Regenerate.
1720
1721 2011-09-13  Cary Coutant  <ccoutant@google.com>
1722
1723         * incremental.cc (Sized_relobj_incr::do_layout): Call
1724         report_comdat_group for kept comdat sections.
1725         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1726         * testsuite/Makefile.in: Regenerate.
1727         * testsuite/incr_comdat_test_1.cc: New source file.
1728         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1729         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1730         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1731
1732 2011-09-13  Ian Lance Taylor  <iant@google.com>
1733
1734         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1735         variable external_symbols_offset.
1736
1737 2011-09-12  Ian Lance Taylor  <iant@google.com>
1738
1739         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1740         triggered if object has no symbols.
1741
1742 2011-09-09  David S. Miller  <davem@davemloft.net>
1743
1744         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1745         (Output_fill_debug_line::do_write): Likewise.
1746
1747 2011-08-29  Cary Coutant  <ccoutant@google.com>
1748
1749         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1750         casts to match formatting specs.
1751         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1752
1753 2011-08-26  Cary Coutant  <ccoutant@google.com>
1754
1755         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1756         remaining hole size when allocating.
1757         (Layout::make_output_section): Set fill methods for debug sections.
1758         * layout.h (Free_list::Free_list_node): Move from private to
1759         public.
1760         (Free_list::set_min_hole_size): New function.
1761         (Free_list::begin, Free_list::end): New functions.
1762         (Free_list::min_hole_): New data member.
1763         * output.cc: Include dwarf.h.
1764         (Output_fill_debug_info::do_minimum_hole_size): New function.
1765         (Output_fill_debug_info::do_write): New function.
1766         (Output_fill_debug_line::do_minimum_hole_size): New function.
1767         (Output_fill_debug_line::do_write): New function.
1768         (Output_section::Output_section): Initialize new data member.
1769         (Output_section::set_final_data_size): Ensure patch space is larger
1770         than minimum hole size.
1771         (Output_section::do_write): Fill holes in debug sections.
1772         * output.h (Output_fill): New class.
1773         (Output_fill_debug_info): New class.
1774         (Output_fill_debug_line): New class.
1775         (Output_section::set_free_space_fill): New function.
1776         (Output_section::free_space_fill_): New data member.
1777         * testsuite/Makefile.am (incremental_test_3): Add
1778         --incremental-patch option.
1779         (incremental_test_4): Likewise.
1780         (incremental_test_5): Likewise.
1781         (incremental_test_6): Likewise.
1782         (incremental_copy_test): Likewise.
1783         (incremental_common_test_1): Likewise.
1784         * testsuite/Makefile.in: Regenerate.
1785
1786 2011-08-26  Nick Clifton  <nickc@redhat.com>
1787
1788         * po/es.po: Updated Spanish translation.
1789
1790 2011-08-01  Cary Coutant  <ccoutant@google.com>
1791
1792         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1793         * gold/testsuite/Makefile.in: Regenerate.
1794         * gold/testsuite/justsyms_exec.c: New source file.
1795         * gold/testsuite/justsyms_lib.c: New source file.
1796
1797 2011-08-01  Cary Coutant  <ccoutant@google.com>
1798
1799         * layout.cc (Layout::set_segment_offsets): Don't realign text
1800         segment if -Ttext was specified.
1801         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1802         file type.
1803         * object.h (Sized_relobj_file::e_type): New function.
1804         (Sized_relobj_file::e_type_): New data member.
1805         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1806         base address for ET_EXEC files.
1807         * target.cc (Target::do_make_elf_object_implementation): Allow
1808         ET_EXEC files with --just-symbols option.
1809
1810 2011-07-28  Cary Coutant  <ccoutant@google.com>
1811
1812         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1813         Add thread_number parameter.
1814         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1815         * workqueue-threads.cc
1816         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1817         current thread if its thread number is greater than desired thread
1818         count.
1819         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1820         Add thread_number parameter.
1821         (Workqueue::should_cancel_thread): Likewise.
1822         (Workqueue::find_runnable_or_wait): Pass thread_number to
1823         should_cancel_thread.
1824         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1825         parameter.
1826
1827 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1828
1829         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1830         only after checking if it cannot be forced local.
1831         * symtab.h (is_externally_visible): Check if the symbol is not forced
1832         local.
1833
1834 2011-07-15  Ian Lance Taylor  <iant@google.com>
1835
1836         * options.h (class General_options): Add --print-output-format.
1837         Move -EL next to -EB, for  better --help output.
1838         * target-select.cc: Include <cstdio>, "options.h", and
1839         "parameters.h".
1840         (Target_selector::do_target_bfd_name): New function.
1841         (print_output_format): New function.
1842         * target-select.h (class Target_selector): Update declarations.
1843         (Target_selector::target_bfd_name): New function.
1844         (print_output_format): Declare.
1845         * main.cc: Include "target-select.h".
1846         (main): Handle --print-output-format.
1847         * gold.cc: Include "target-select.h".
1848         (queue_initial_tasks): Handle --print-output-format when there are
1849         no input files.
1850         * parameters.cc (parameters_force_valid_target): Give a better
1851         error message if -EB/-EL does not match target.
1852         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1853         function.
1854
1855 2011-07-15  Ian Lance Taylor  <iant@google.com>
1856
1857         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1858         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1859         (Output_data_plt_i386::do_write): Write address of .dynamic
1860         section to first entry in .got.plt section.
1861         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1862         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1863         Initialize layout_.
1864         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1865         section to first entry in .got.plt section.
1866         * layout.h (Layout::dynamic_section): New function.
1867
1868 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1869
1870         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1871         to claim_file call.
1872         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1873         input_section_position_, and input_section_glob_.
1874         (read_layout_from_file): Call function section_ordering_specified.
1875         * layout.h (is_section_ordering_specified): New function.
1876         (section_ordering_specified): New function.
1877         (section_ordering_specified_): New boolean member.
1878         * main.cc(main): Call load_plugins after layout object is defined.
1879         * output.cc (Output_section::add_input_section): Use
1880         function section_ordering_specified to check if section ordering is
1881         needed.
1882         * output.cc (Output_section::add_relaxed_input_section): Use
1883         function section_ordering_specified to check if section ordering is
1884         needed.
1885         (Output_section::update_section_layout): New function.
1886         (Output_section::sort_attached_input_sections): Check if input section
1887         must be reordered.
1888         * output.h (Output_section::update_section_layout): New function.
1889         * plugin.cc (get_section_count): New function.
1890         (get_section_type): New function.
1891         (get_section_name): New function.
1892         (get_section_contents): New function.
1893         (update_section_order): New function.
1894         (allow_section_ordering): New function.
1895         (Plugin::load): Add the new interfaces to the transfer vector.
1896         (Plugin_manager::load_plugins): New parameter.
1897         (Plugin_manager::all_symbols_read): New parameter.
1898         (Plugin_manager::claim_file): New parameter. Save the elf object for
1899         unclaimed objects.
1900         (Plugin_manager::get_elf_object): New function.
1901         (Plugin_manager::get_view): Change to directly use the bool to check
1902         if get_view is called from claim_file_hook.
1903         * plugin.h (input_objects): New function
1904         (Plugin__manager::load_plugins): New parameter.
1905         (Plugin_manager::claim_file): New parameter.
1906         (Plugin_manager::get_elf_object): New function.
1907         (Plugin_manager::in_claim_file_handler): New function.
1908         (Plugin_manager::in_claim_file_handler_): New member.
1909         (layout): New function.
1910         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1911         handler with an extra parameter. Make the elf object before calling
1912         claim_file handler.
1913         * testsuite/plugin_test.c (get_section_count): New function pointer.
1914         (get_section_type): New function pointer.
1915         (get_section_name): New function pointer.
1916         (get_section_contents): New function pointer.
1917         (update_section_order): New function pointer.
1918         (allow_section_ordering): New function pointer.
1919         (onload): Check if the new interfaces exist.
1920
1921 2011-07-13  Ian Lance Taylor  <iant@google.com>
1922
1923         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1924         relro section.
1925         * x86_64.cc (Target_x86_64::got_section): Likewise.
1926         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1927         (relro_now_test_SOURCES): New variable.
1928         (relro_now_test_DEPENDENCIES): New variable.
1929         (relro_now_test_LDFLAGS): New variable.
1930         (relro_now_test_LDADD): New variable.
1931         (relro_now_test.so): New target.
1932         * testsuite/Makefile.in: Rebuild.
1933
1934 2011-07-12  Ian Lance Taylor  <iant@google.com>
1935
1936         PR gold/12980
1937         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1938         GLOB_DAT relocation rather than a RELATIVE relocation for a
1939         protected symbol when creating a shared library.
1940         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1941         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1942         * testsuite/protected_main_1.cc (main): Test that protected
1943         function has same address.
1944
1945 2011-07-11  Ian Lance Taylor  <iant@google.com>
1946
1947         PR gold/12979
1948         * options.h (class General_options): Add -Bgroup.
1949         * options.cc (General_options::finalize): If -Bgroup is set,
1950         default to --unresolved-symbols=report-all.
1951         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1952         * target-reloc.h (issue_undefined_symbol_error): Handle
1953         --unresolved-symbols=report-all.
1954
1955 2011-07-08  Ian Lance Taylor  <iant@google.com>
1956
1957         PR gold/11985
1958         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1959         if linker script discards key sections.
1960         (Layout::create_dynamic_symtab): Likewise.
1961         (Layout::assign_local_dynsym_offsets): Likewise.
1962         (Layout::sized_create_version_sections): Likewise.
1963         (Layout::create_interp): Likewise.
1964         (Layout::finish_dynamic_section): Likewise.
1965         (Layout::set_dynamic_symbol_size): Likewise.
1966
1967 2011-07-08  Ian Lance Taylor  <iant@google.com>
1968
1969         PR gold/12386
1970         * options.h (class General_options): Add --unresolved-symbols.
1971         * target-reloc.h (issue_undefined_symbol_error): Check
1972         --unresolved-symbols.  Add comments.
1973
1974 2011-07-08  Ian Lance Taylor  <iant@google.com>
1975
1976         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1977         expression more complex.
1978
1979 2011-07-08  Ian Lance Taylor  <iant@google.com>
1980
1981         PR gold/11317
1982         * target-reloc.h (issue_undefined_symbol_error): New inline
1983         function, broken out of relocate_section.
1984         (relocate_section): Call issue_undefined_symbol_error.
1985         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1986         there is no TLS segment if we are about to issue an undefined
1987         symbol error.
1988         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1989
1990 2011-07-08  Ian Lance Taylor  <iant@google.com>
1991
1992         PR gold/12279
1993         * resolve.cc (Symbol_table::should_override): Add fromtype
1994         parameter.  Change all callers.  Give error when linking together
1995         TLS and non-TLS symbol.
1996         (Symbol_table::should_override_with_special): Add fromtype
1997         parameter.  Change all callers.
1998         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1999         there is no TLS segment if we have reported some errors.
2000         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2001
2002 2011-07-08  Ian Lance Taylor  <iant@google.com>
2003
2004         PR gold/12372
2005         * target.h (Target::plt_address_for_global): New function.
2006         (Target::plt_address_for_local): New function.
2007         (Target::plt_section_for_global): Remove.
2008         (Target::plt_section_for_local): Remove.
2009         (Target::do_plt_address_for_global): New virtual function.
2010         (Target::do_plt_address_for_local): New virtual function.
2011         (Target::do_plt_section_for_global): Remove.
2012         (Target::do_plt_section_for_local): Remove.
2013         (Target::register_global_plt_entry): Add Symbol_table and Layout
2014         parameters.
2015         * output.cc (Output_data_got::Got_entry::write): Use
2016         plt_address_for_global and plt_address_for_local.
2017         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2018         address of output section.
2019         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2020         got_irelative_, and irelative_count_ fields.  Update
2021         declarations.
2022         (Output_data_plt_i386::has_irelative_section): New function.
2023         (Output_data_plt_i386::entry_count): Add irelative_count_.
2024         (Output_data_plt_i386::set_final_data_size): Likewise.
2025         (class Target_i386): Add got_irelative_ and rel_irelative_
2026         fields.  Update declarations.
2027         (Target_i386::Target_i386): Initialize new fields.
2028         (Target_i386::do_plt_address_for_global): New function replacing
2029         do_plt_section_for_global.
2030         (Target_i386::do_plt_address_for_local): New function replacing
2031         do_plt_section_for_local.
2032         (Target_i386::got_section): Create got_irelative_.
2033         (Target_i386::rel_irelative_section): New function.
2034         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2035         fields.  Don't define __rel_iplt_{start,end}.
2036         (Output_data_plt_i386::add_entry): Add symtab and layout
2037         parameters.  Change all callers.  Use different PLT and GOT for
2038         IFUNC symbols.
2039         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2040         layout parameters.  Change all callers.  Use different PLT and
2041         GOT.
2042         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2043         (Output_data_plt_i386::rel_irelative): New function.
2044         (Output_data_plt_i386::address_for_global): New function.
2045         (Output_data_plt_i386::address_for_local): New function.
2046         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2047         IRELATIVE GOT when changing IFUNC GOT entries.
2048         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2049         reloc.
2050         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2051         if we didn't create an IRELATIVE GOT.
2052         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2053         plt_address_for_local.
2054         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2055         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2056         got_irelative_, and irelative_count_ fields.  Update
2057         declarations.
2058         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2059         Initialize new fields.  Remove symtab parameter.  Change all
2060         callers.
2061         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2062         irelative_count_.
2063         (Output_data_plt_x86_64::has_irelative_section): New function.
2064         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2065         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2066         fields.  Update declarations.
2067         (Target_x86_64::Target_x86_64): Initialize new fields.
2068         (Target_x86_64::do_plt_address_for_global): New function replacing
2069         do_plt_section_for_global.
2070         (Target_x86_64::do_plt_address_for_local): New function replacing
2071         do_plt_section_for_local.
2072         (Target_x86_64::got_section): Create got_irelative_.
2073         (Target_x86_64::rela_irelative_section): New function.
2074         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2075         all callers.  Don't create __rel_iplt_{start,end}.
2076         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2077         parameters.  Change all callers.  Use different PLT and GOT for
2078         IFUNC symbols.
2079         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2080         layout parameters.  Change all callers.  Use different PLT and
2081         GOT.
2082         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2083         parameters.  Change all callers.  Use different PLT and GOT for
2084         IFUNC symbols.
2085         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2086         (Output_data_plt_x86_64::rela_irelative): New function.
2087         (Output_data_plt_x86_64::address_for_global): New function.
2088         (Output_data_plt_x86_64::address_for_local): New function.
2089         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2090         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2091         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2092         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2093         parameters.
2094         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2095         reloc.
2096         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2097         symbols if we didn't create an IRELATIVE GOT.
2098         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2099         plt_address_for_local.
2100         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2101         * testsuite/ifuncvar1.c: New test file.
2102         * testsuite/ifuncvar2.c: New test file.
2103         * testsuite/ifuncvar3.c: New test file.
2104         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2105         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2106         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2107         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2108         * testsuite/Makefile.in: Rebuild.
2109
2110 2011-07-07  Cary Coutant  <ccoutant@google.com>
2111
2112         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2113         (two_file_test_1_ndebug.o): Likewise.
2114         (two_file_test_1b_ndebug.o): Likewise.
2115         (two_file_test_2_ndebug.o): Likewise.
2116         (two_file_test_main_ndebug.o): Likewise.
2117         (incremental_test_2): Link with no-debug versions.
2118
2119 2011-07-06  Cary Coutant  <ccoutant@google.com>
2120
2121         * gold/incremental.cc
2122         (Output_section_incremental_inputs::write_info_blocks): Check for
2123         hidden and internal symbols.
2124
2125 2011-07-06  Cary Coutant  <ccoutant@google.com>
2126
2127         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2128         Check disposition for startup file.
2129         (Incremental_inputs::report_command_line): Ignore
2130         --incremental-startup-unchanged option.
2131         * options.cc (General_options::parse_incremental_startup_unchanged):
2132         New function.
2133         (General_options::General_options): Initialize new data member.
2134         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2135         (General_options): Add --incremental-startup-unchanged option.
2136         (General_options::incremental_startup_disposition): New function.
2137         (General_options::incremental_startup_disposition_): New data member.
2138
2139 2011-07-06  Cary Coutant  <ccoutant@google.com>
2140
2141         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2142         input file index to Script_info ctor.
2143         (Sized_incremental_binary::do_file_has_changed): Find the
2144         command-line argument for files named in scripts.
2145         * incremental.h (Script_info::Script_info): New ctor
2146         with input file index.
2147         (Script_info::input_file_index): New function.
2148         (Script_info::input_file_index_): New data member.
2149         (Incremental_binary::get_library): Add const.
2150         (Incremental_binary::get_script_info): Add const.
2151         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2152         * testsuite/Makefile.am (incremental_test_5): New test case.
2153         (incremental_test_6): New test case.
2154         * testsuite/Makefile.in: Regenerate.
2155
2156 2011-07-06  Cary Coutant  <ccoutant@google.com>
2157
2158         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2159         debug output when command lines differ.
2160
2161 2011-07-06  Cary Coutant  <ccoutant@google.com>
2162
2163         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2164         --incremental-patch option.
2165         * layout.cc (Free_list::allocate): Extend allocation beyond original
2166         end if enabled.
2167         (Layout::make_output_section): Mark sections that should get
2168         patch space.
2169         * options.cc (parse_percent): New function.
2170         * options.h (parse_percent): New function.
2171         (DEFINE_percent): New macro.
2172         (General_options): Add --incremental-patch option.
2173         * output.cc (Output_section::Output_section): Initialize new data
2174         members.
2175         (Output_section::add_input_section): Print section name when out
2176         of patch space.
2177         (Output_section::add_output_section_data): Likewise.
2178         (Output_section::set_final_data_size): Add patch space when
2179         doing --incremental-full.
2180         (Output_section::do_reset_address_and_file_offset): Remove patch
2181         space.
2182         (Output_segment::set_section_list_addresses): Print debug output
2183         only if --incremental-update.
2184         * output.h (Output_section::set_is_patch_space_allowed): New function.
2185         (Output_section::is_patch_space_allowed_): New data member.
2186         (Output_section::patch_space_): New data member.
2187         * parameters.cc (Parameters::incremental_full): New function.
2188         * parameters.h (Parameters::incremental_full): New function
2189         * testsuite/Makefile.am (incremental_test_2): Add test for
2190         --incremental-patch option.
2191         * testsuite/Makefile.in: Regenerate.
2192         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2193         (t18): Remove function body.
2194
2195 2011-07-05  Doug Kwan  <dougkwan@google.com>
2196
2197         PR gold/12771
2198         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2199         Arm_Address type for relocation result.
2200         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2201         overflow check.
2202         (Arm_relocate_functions::abs32): Use unaligned access.
2203         (Arm_relocate_functions::rel32): Ditto.
2204         (Arm_relocate_functions::prel31): Ditto.
2205         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2206         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2207         static data relocations.
2208         * testsuite/Makefile.in: Regnerate.
2209         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2210
2211 2011-07-05  Ian Lance Taylor  <iant@google.com>
2212
2213         PR gold/12392
2214         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2215         symbols if necessary.
2216         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2217
2218 2011-07-05  Ian Lance Taylor  <iant@google.com>
2219
2220         PR gold/12952
2221         * resolve.cc (Symbol::override_base_with_special): Simply override
2222         version with special symbol version, ignoring previous version.
2223
2224 2011-07-05  Ian Lance Taylor  <iant@google.com>
2225
2226         * object.cc (Sized_relobj_file::include_section_group): Add
2227         information to comment about signature location.
2228
2229 2011-07-02  Ian Lance Taylor  <iant@google.com>
2230
2231         PR gold/12957
2232         * options.h (class General_options): Add -f and -F.
2233         * options.cc (General_options::finalize): Fatal error if -f/-F
2234         are used without -shared.
2235         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2236
2237 2011-07-02  Ian Lance Taylor  <iant@google.com>
2238
2239         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2240
2241 2011-07-01  Ian Lance Taylor  <iant@google.com>
2242
2243         PR gold/12525
2244         PR gold/12952
2245         * resolve.cc (Symbol::override_base_with_special): Don't override
2246         the version if the overriding symbol has a different name.
2247         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2248         all callers.  If we give an error about an undefined version,
2249         define the base version if necessary.
2250         * dynobj.h (class Versions): Update declaration.
2251         * testsuite/weak_alias_test_5.cc: New file.
2252         * testsuite/weak_alias_test.script: New file.
2253         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2254         and versioned_alias have the right value, and call t2.
2255         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2256         weak_alias_test_5.so.
2257         (weak_alias_test_LDADD): Likewise.
2258         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2259         * testsuite/Makefile.in: Rebuild.
2260
2261 2011-07-01  Ian Lance Taylor  <iant@google.com>
2262
2263         PR gold/12525
2264         * options.h (class General_options): Support -z notext.
2265         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2266         -Wl,-z,notext.
2267         (two_file_shared_nonpic.so): Likewise.
2268         (two_file_shared_mixed.so): Likewise.
2269         (two_file_shared_mixed_1.so): Likewise.
2270         (weak_undef_lib_nonpic.so): Likewise.
2271         (alt/weak_undef_lib_nonpic.so): Likewise.
2272         (tls_test_shared_nonpic.so): Likewise.
2273         * testsuite/Makefile.in: Rebuild.
2274
2275 2011-07-01  Ian Lance Taylor  <iant@google.com>
2276
2277         PR gold/12525
2278         * configure.ac: Test whether static linking works, setting
2279         the automake conditional HAVE_STATIC.
2280         * testsuite/Makefile.am: Disable tests using -static if
2281         HAVE_STATIC is not true.
2282         * configure, testsuite/Makefile.in: Rebuild.
2283
2284 2011-07-01  Ian Lance Taylor  <iant@google.com>
2285
2286         PR gold/12525
2287         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2288         Assert if we see DW_EH_PE_indirect.
2289         * target.h (Target::ehframe_datarel_base): New function.
2290         (Target::do_ehframe_datarel_base): New target function.
2291         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2292         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2293         function.
2294
2295 2011-07-01  Ian Lance Taylor  <iant@google.com>
2296
2297         PR gold/12571
2298         * options.h (class General_options): Add
2299         --ld-generated-unwind-info.
2300         * ehframe.cc (Fde::write): Add address parameter.  Change all
2301         callers.  If associated with PLT, fill in address and size.
2302         (Cie::set_output_offset): Only add merge mapping if there is an
2303         object.
2304         (Cie::write): Add address parameter.  Change all callers.
2305         (Eh_frame::add_ehframe_for_plt): New function.
2306         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2307         input_offset_ fields into union u_, with new plt field.
2308         (Fde::Fde): Adjust for new union field.
2309         (Fde::Fde) [Output_data version]: New constructor.
2310         (Fde::add_mapping): Only add merge mapping if there is an object.
2311         (class Cie): Update declarations.
2312         (class Eh_frame): Declare add_ehframe_for_plt.
2313         * layout.cc (Layout::layout_eh_frame): Break out code into
2314         make_eh_frame_section, and call it.
2315         (Layout::make_eh_frame_section): New function.
2316         (Layout::add_eh_frame_for_plt): New function.
2317         * layout.h (class Layout): Update declarations.
2318         * merge.cc (Merge_map::add_mapping): Add assertion.
2319         * i386.cc: Include "dwarf.h".
2320         (class Output_data_plt_i386): Make first_plt_entry,
2321         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2322         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2323         and plt_eh_frame_fde.
2324         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2325         boundary.  Call add_eh_frame_for_plt if appropriate.
2326         * x86_64.cc: Include "dwarf.h".
2327         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2328         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2329         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2330         and plt_eh_frame_fde.
2331         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2332         appropriate.
2333
2334 2011-06-29  Ian Lance Taylor  <iant@google.com>
2335
2336         PR gold/12629
2337         * object.cc (Sized_relobj_file::layout_section): Change shdr
2338         parameter to be const.
2339         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2340         out of do_layout.
2341         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2342         appropriate.  Call layout_eh_frame_section.
2343         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2344         sections.
2345         * object.h (class Sized_relobj_file): Update declarations.
2346
2347 2011-06-29  Ian Lance Taylor  <iant@google.com>
2348
2349         PR gold/12652
2350         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2351         modifier.
2352         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2353
2354 2011-06-29  Ian Lance Taylor  <iant@google.com>
2355
2356         PR gold/12675
2357         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2358         SHT_X86_64_UNWIND.
2359         * layout.cc (Layout::layout_eh_frame): Likewise.
2360
2361 2011-06-29  Ian Lance Taylor  <iant@google.com>
2362
2363         PR gold/12695
2364         * layout.cc (Layout::symtab_section_shndx): New function.
2365         * layout.h (class Layout): Declare symtab_section_shndx.
2366         * output.cc (Output_section::write_header): Call it.
2367
2368 2011-06-29  Ian Lance Taylor  <iant@google.com>
2369
2370         PR gold/12818
2371         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2372         symbols which are not used in a relocation.
2373
2374 2011-06-28  Ian Lance Taylor  <iant@google.com>
2375
2376         PR gold/12898
2377         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2378         script create indistinguishable segments.
2379         (Layout::set_segment_offsets): Use stable_sort when sorting
2380         segments.  Pass this to Compare_segments constructor.
2381         * layout.h (class Layout): Make segment_precedes non-static.
2382         (class Compare_segments): Change from struct to class.  Add
2383         layout_ field.  Add constructor.
2384         * script-sections.cc
2385         (Script_sections::attach_sections_using_phdrs_clause): Rename
2386         local orphan to is_orphan.  Don't report failure to put empty
2387         section in segment.  On attachment failure, report name of
2388         section, and attach to first PT_LOAD segment.
2389
2390 2011-06-28  Ian Lance Taylor  <iant@google.com>
2391
2392         PR gold/12934
2393         * target-select.cc (Target_selector::Target_selector): Add
2394         emulation parameter.  Change all callers.
2395         (select_target_by_bfd_name): Rename from select_target_by_name.
2396         Change all callers.
2397         (select_target_by_emulation): New function.
2398         (supported_emulation_names): New function.
2399         * target-select.h (class Target_selector): Add emulation_ field.
2400         Update declarations.
2401         (Target_selector::recognize_by_bfd_name): Rename from
2402         recognize_by_name.  Change all callers.
2403         (Target_selector::supported_bfd_names): Rename from
2404         supported_names.  Change all callers.
2405         (Target_selector::recognize_by_emulation): New function.
2406         (Target_selector::supported_emulations): New function.
2407         (Target_selector::emulation): New function.
2408         (Target_selector::do_recognize_by_bfd_name): Rename from
2409         do_recognize_by_name.  Change all callers.
2410         (Target_selector::do_supported_bfd_names): Rename from
2411         do_supported_names.  Change all callers.
2412         (Target_selector::do_recognize_by_emulation): New function.
2413         (Target_selector::do_supported_emulations): New function.
2414         (select_target_by_bfd_name): Change name in declaration.
2415         (select_target_by_emulation): Declare.
2416         (supported_emulation_names): Declare.
2417         * parameters.cc (parameters_force_valid_target): Try to find
2418         target based on emulation from -m option.
2419         * options.h (class General_options): Change doc string for -m.
2420         * options.cc (help): Print emulations.
2421         (General_options::parse_V): Likewise.
2422         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2423         Add emulation parameter.  Change all callers.
2424
2425 2011-06-28  Ian Lance Taylor  <iant@google.com>
2426
2427         * target.h (class Target): Add osabi_ field.
2428         (Target::osabi): New function.
2429         (Target::set_osabi): New function.
2430         (Target::Target): Initialize osabi_.
2431         (Target::do_adjust_elf_header): Make pure virtual.
2432         (Sized_target::do_adjust_elf_header): Declare.
2433         * target.cc (Sized_target::do_adjust_elf_header): New function.
2434         (class Sized_target): Instantiate all versions.
2435         * freebsd.h (class Target_freebsd): Remove.
2436         (Target_selector_freebsd::do_recognize): Call set_osabi on
2437         Target.
2438         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2439         (Target_selector_freebsd::set_osabi): Remove.
2440         * i386.cc (class Target_i386): Inherit from Sized_target rather
2441         than Target_freebsd.
2442         * x86_64.cc (class Target_x86_64): Likewise.
2443
2444 2011-06-28  Ian Lance Taylor  <iant@google.com>
2445
2446         * target.h (Target::can_check_for_function_pointers): Rewrite.
2447         Make non-virtual.
2448         (Target::can_icf_inline_merge_sections): Likewise.
2449         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2450         (Target::Target_info): Add can_icf_inline_merge_sections field.
2451         (Target::do_can_check_for_function_pointers): New virtual
2452         function.
2453         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2454         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2455         from can_check_for_function_pointers, move in file.
2456         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2457         section_may_have_icf_unsafe_poineters, move in file.
2458         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2459         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2460         Rename from can_check_for_function_pointers, move in file.
2461         (Target_i386::can_icf_inline_merge_sections): Remove.
2462         (Target_i386::i386_info): Initialize
2463         can_icf_inline_merge_sections.
2464         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2465         Initialize can_icf_inline_merge_sections.
2466         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2467         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2468         Rename from can_check_for_function_pointers, move in file.
2469         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2470         (Target_x86_64::x86_64_info): Initialize
2471         can_icf_inline_merge_sections.
2472         * testsuite/testfile.cc (Target_test::test_target_info):
2473         Likewise.
2474         * icf.cc (get_section_contents): Correct formatting.
2475
2476 2011-06-27  Ian Lance Taylor  <iant@google.com>
2477
2478         * symtab.cc (Symbol::versioned_name): New function.
2479         (Symbol_table::add_to_final_symtab): Use versioned_name when
2480         appropriate.
2481         (Symbol_table::sized_write_symbol): Likewise.
2482         * symtab.h (class Symbol): Declare versioned_name.
2483         * stringpool.h (class Stringpool_template): Add variant of add
2484         which takes a std::basic_string.
2485         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2486         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2487         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2488         (ver_test_12.o): New target.
2489         * testsuite/Makefile.in: Rebuild.
2490
2491 2011-06-27  Doug Kwan  <dougkwan@google.com>
2492
2493         * arm.cc (Arm_relocate_functions::thm_jump8,
2494         Arm_relocate_functions::thm_jump11): Use a wider signed
2495         type to compute offset.
2496         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2497         arm_thm_jump8.
2498         * testsuite/Makefile.in: Regenerate.
2499         * testsuite/arm_branch_in_range.sh: Check test results of
2500         arm_thm_jump11 and arm_thm_jump8.
2501         * testsuite/arm_thm_jump11.s: New test source file.
2502         * testsuite/arm_thm_jump11.t: New linker script.
2503         * testsuite/arm_thm_jump8.s: New test source file.
2504         * testsuite/arm_thm_jump8.t: New linker script.
2505
2506 2011-06-24  Ian Lance Taylor  <iant@google.com>
2507
2508         * layout.cc: Include "object.h".
2509         (ctors_sections_in_init_array): New static variable.
2510         (Layout::is_ctors_in_init_array): New function.
2511         (Layout::layout): Add entry to ctors_sections_in_init_array if
2512         appropriate.
2513         * layout.h (class Layout): Declare is_ctors_in_init_array.
2514         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2515         is_ctors_reverse_view is set.
2516         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2517         all callers.  Set is_ctors_reverse_view field of View_size.
2518         (Sized_relobj_file::reverse_words): New function.
2519         * object.h (Sized_relobj_file::View_size): Add
2520         is_ctors_reverse_view field.
2521         (class Sized_relobj_file): Update declarations.
2522         * testsuite/initpri3.c: New test.
2523         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2524         initpri3b.
2525         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2526         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2527         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2528         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2529         * testsuite/Makefile.in: Rebuild.
2530
2531 2011-06-24  Cary Coutant  <ccoutant@google.com>
2532
2533         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2534         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2535         (debug_msg_cdebug.err): New targets.
2536         * testsuite/Makefile.in: Regenerate.
2537         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2538         Fix checks for link with shared library.
2539
2540 2011-06-24  Doug Kwan  <dougkwan@google.com>
2541
2542         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2543         skip empty text sections.
2544         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2545
2546 2011-06-22  Ian Lance Taylor  <iant@google.com>
2547
2548         PR gold/12910
2549         * options.h (class General_options): Add --ctors-in-init-array.
2550         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2551         friends as SHT_PROGBITS for merging sections.
2552         (Layout::layout): Remove special handling of .init_array and
2553         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2554         and .dtors if ctors_in_init_array.
2555         (Layout::make_output_section): Force correct section types for
2556         .init_array and friends.  Don't sort if doing relocatable link,
2557         Don't sort .ctors and .dtors if ctors_in_init_array.
2558         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2559         (Layout::output_section_name): Add relobj parameter.  Change all
2560         callers.  Handle .ctors. and .dtors. in code rather than table.
2561         Handle .ctors and .dtors if ctors_in_init_array.
2562         (Layout::match_file_name): New function, moved from output.cc.
2563         * layout.h (class Layout): Update declarations.
2564         * output.cc: Include "layout.h".
2565         (Input_section_sort_entry::get_priority): New function.
2566         (Input_section_sort_entry::match_file_name): Just call
2567         Layout::match_file_name.
2568         (Output_section::Input_section_sort_init_fini_compare::operator()):
2569         Handle .ctors and .dtors.  Sort by explicit priority rather than
2570         by name.
2571         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2572         * testsuite/initpri2.c: New test.
2573         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2574         (check_PROGRAMS): Add initpri2.
2575         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2576         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2577         * configure, testsuite/Makefile.in: Rebuild.
2578
2579 2011-06-19  Ian Lance Taylor  <iant@google.com>
2580
2581         PR gold/12880
2582         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2583         .interp section to a PT_INTERP segment even if we have seen a
2584         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2585         clause in a linker script.
2586         (Layout::finalize): Don't create a .interp section if we've
2587         already create a PT_INTERP segment.
2588         (Layout::create_interp): Always call choose_output_section (revert
2589         patch of 2011-06-17).  Don't create PT_INTERP segment.
2590         * script-sections.cc
2591         (Script_sections::create_note_and_tls_segments): Add a .interp
2592         section to a PT_INTERP segment even if we have seen a
2593         --dynamic-linker option.
2594
2595 2011-06-18  Ian Lance Taylor  <iant@google.com>
2596
2597         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2598         merely because a non-PT_LOAD segment has a dynamic reloc.
2599
2600 2011-06-18  Ian Lance Taylor  <iant@google.com>
2601
2602         * layout.cc (Layout::finish_dynamic_section): Don't create
2603         DT_FLAGS entry if not needed.
2604
2605 2011-06-18  Ian Lance Taylor  <iant@google.com>
2606
2607         PR gold/12745
2608         * layout.cc (Layout::layout_eh_frame): Correct handling of
2609         writable .eh_frame section.
2610
2611 2011-06-17  Ian Lance Taylor  <iant@google.com>
2612
2613         PR gold/12893
2614         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2615         symbol is redefined with the exact same object and value.
2616
2617 2011-06-17  Ian Lance Taylor  <iant@google.com>
2618
2619         PR gold/12880
2620         * layout.h (class Layout): Add interp_segment_ field.
2621         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2622         (Layout::attach_allocated_section_to_segment): If making shared
2623         library, put .interp section in PT_INTERP segment.
2624         (Layout::finalize): Also call create_interp if -dynamic-linker
2625         option was used.
2626         (Layout::create_interp): Assert that there is no PT_INTERP
2627         segment.  If not using a SECTIONS clause, use make_output_section.
2628         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2629         * script-sections.cc
2630         (Script_sections::create_note_and_tls_segments): If making shared
2631         library, put .interp section in PT_INTERP segment.
2632
2633 2011-06-17  Ian Lance Taylor  <iant@google.com>
2634
2635         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2636         when making a shared library.
2637
2638 2011-06-17  Ian Lance Taylor  <iant@google.com>
2639
2640         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2641         parameter.  Change all callers.  Don't issue warning about PC32
2642         against locally defined symbol.
2643
2644 2011-06-16  Ian Lance Taylor  <iant@google.com>
2645
2646         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2647         occurs in same object.
2648
2649 2011-06-14  Alan Modra  <amodra@gmail.com>
2650
2651         * po/POTFILES.in: Regenerate.
2652
2653 2011-06-09  Ian Lance Taylor  <iant@google.com>
2654
2655         * script-sections.cc
2656         (Orphan_output_section::set_section_addresses): For a relocatable
2657         link set address to 0.
2658
2659 2011-06-09  Cary Coutant  <ccoutant@google.com>
2660
2661         PR gold/12804
2662         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2663         used with --compress-debug-sections.
2664         * gold/object.cc (Sized_relobj_file::do_layout): Report
2665         uncompressed size of compressed input sections.
2666
2667 2011-06-08  Cary Coutant  <ccoutant@google.com>
2668
2669         PR gold/12804
2670         * testsuite/two_file_test_2_v1.cc: Change initialization of
2671         v2 to keep it in .data.
2672
2673 2011-06-07  Cary Coutant  <ccoutant@google.com>
2674
2675         * common.cc (Symbol_table::do_allocate_commons_list): Call
2676         gold_fallback.
2677         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2678         (Errors::fallback): New function.
2679         (gold_fallback): New function.
2680         * errors.h (Errors::fallback): New function.
2681         * gold.cc (gold_exit): Change status parameter to enum; adjust
2682         all callers.
2683         (queue_initial_tasks): Call gold_fallback.
2684         * gold.h: Include cstdlib.
2685         (Exit_status): New enum type.
2686         (gold_exit): Change status parameter to enum.
2687         (gold_fallback): New function.
2688         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2689         (Layout::create_symtab_sections): Likewise.
2690         (Layout::create_shdrs): Likewise.
2691         * main.cc (main): Adjust call to gold_exit.
2692         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2693         (Output_data_got::add_got_entry_pair): Likewise.
2694         (Output_section::add_input_section): Likewise.
2695         (Output_section::add_output_section_data): Likewise.
2696         (Output_segment::set_section_list_addresses): Likewise.
2697         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2698
2699 2011-06-07  Cary Coutant  <ccoutant@google.com>
2700
2701         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2702         for incremental links.
2703         * output.cc (Output_segment::set_section_list_addresses): Remove
2704         FIXME and test for TLS or BSS.
2705
2706 2011-06-07  Cary Coutant  <ccoutant@google.com>
2707
2708         * testsuite/Makefile.am: Add incremental_copy_test,
2709         incremental_common_test_1.
2710         * testsuite/Makefile.in: Regenerate.
2711         * testsuite/common_test_1_v1.c: New source file.
2712         * testsuite/common_test_1_v2.c: New source file.
2713         * testsuite/copy_test_v1.cc: New source file.
2714
2715 2011-06-07  Cary Coutant  <ccoutant@google.com>
2716
2717         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2718         update, allocate common from bss section's free list.
2719         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2720         linker-defined symbols.
2721         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2722         Skip GOT and PLT entries that are no longer referenced.
2723         (Output_section_incremental_inputs::write_info_blocks): Mark
2724         linker-defined symbols.
2725         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2726         * output.cc (Output_section::allocate): New function.
2727         * output.h (Output_section::allocate): New function.
2728         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2729         linker-defined symbols.
2730         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2731         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2732         (Symbol::init_base_output_data): Likewise.
2733         (Symbol::init_base_output_segment): Likewise.
2734         (Symbol::init_base_constant): Likewise.
2735         (Sized_symbol::init_output_data): Likewise.
2736         (Sized_symbol::init_output_segment): Likewise.
2737         (Sized_symbol::init_constant): Likewise.
2738         (Symbol_table::do_define_in_output_data): Likewise.
2739         (Symbol_table::do_define_in_output_segment): Likewise.
2740         (Symbol_table::do_define_as_constant): Likewise.
2741         * symtab.h (Symbol::is_predefined): New function.
2742         (Symbol::init_base_output_data): Add is_predefined parameter.
2743         (Symbol::init_base_output_segment): Likewise.
2744         (Symbol::init_base_constant): Likewise.
2745         (Symbol::is_predefined_): New data member.
2746         (Sized_symbol::init_output_data): Add is_predefined parameter.
2747         (Sized_symbol::init_output_segment): Likewise.
2748         (Sized_symbol::init_constant): Likewise.
2749         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2750
2751 2011-06-07  Cary Coutant  <ccoutant@google.com>
2752
2753         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2754         instead of emit_copy_reloc.
2755         (Copy_relocs::emit_copy_reloc): Refactor.
2756         (Copy_relocs::make_copy_reloc): New function.
2757         (Copy_relocs::add_copy_reloc): Remove.
2758         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2759         section.
2760         (Copy_relocs::make_copy_reloc): New function.
2761         (Copy_relocs::add_copy_reloc): Remove.
2762         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2763         unchanged input files.
2764         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2765         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2766         Reserve BSS space for COPY relocations.
2767         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2768         (Output_section_incremental_inputs::write_info_blocks): Record
2769         whether a symbol is copied from a shared object.
2770         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2771         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2772         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2773         (Incremental_input_entry_reader::get_output_symbol_index): Add
2774         is_copy parameter.
2775         (Incremental_binary::emit_copy_relocs): New function.
2776         (Incremental_binary::do_emit_copy_relocs): New function.
2777         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2778         new data member.
2779         (Sized_incremental_binary::add_copy_reloc): New function.
2780         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2781         (Sized_incremental_binary::Copy_reloc): New struct.
2782         (Sized_incremental_binary::Copy_relocs): New typedef.
2783         (Sized_incremental_binary::copy_relocs_): New data member.
2784         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2785         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2786         * target.h (Sized_target::emit_copy_reloc): New function.
2787         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2788
2789 2011-06-02  Cary Coutant  <ccoutant@google.com>
2790
2791         PR gold/12163
2792         * gold/archive.cc (Archive::Archive): Initialize new data member.
2793         (Archive::include_all_members): Return if archive has already been
2794         included.
2795         * gold/archive.h (Archive::include_all_members_): New data member.
2796
2797 2011-06-02  Nick Clifton  <nickc@redhat.com>
2798
2799         * dynobj.h: Fix spelling mistake in comment.
2800         * output.cc: Likewise.
2801
2802 2011-05-31  Doug Kwan  <dougkwan@google.com>
2803             Asier Llano
2804
2805         PR gold/12826
2806         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2807         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2808         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2809         redundant arm_exidx_test.so.
2810         * testsuite/Makefile.in: Regenerate.
2811         (check_SCRIPTS): Add pr12826.sh
2812         (check_DATA): Add pr12826.stdout
2813         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2814         * testsuite/pr12826.sh: New file.
2815         * testsuite/pr12826_1.s: Ditto.
2816         * testsuite/pr12826_1.s: Ditto.
2817
2818 2011-05-30  Ian Lance Taylor  <iant@google.com>
2819
2820         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2821         sections.
2822
2823 2011-05-29  Ian Lance Taylor  <iant@google.com>
2824
2825         PR gold/12804
2826         * testsuite/Makefile.am: Use different file name for two_file_test
2827         temporary file for each incremental test.
2828         * testsuite/Makefile.in: Rebuild.
2829
2830 2011-05-29  Ian Lance Taylor  <iant@google.com>
2831
2832         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2833         binary input file is empty.
2834
2835 2011-05-27  Ian Lance Taylor  <iant@google.com>
2836
2837         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2838         (ver_test_9.so): Likewise.
2839         * testsuite/Makefile.in: Rebuild.
2840
2841 2011-05-26 Cary Coutant  <ccoutant@google.com>
2842
2843         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2844         * incremental.cc (Incremental_inputs::report_input_section): Fix
2845         comment, indentation.
2846         (Incremental_inputs::report_comdat_group): New function.
2847         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2848         of data for incremental input file entry.
2849         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2850         group count, COMDAT group signatures.
2851         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2852         an unchanged input file.
2853         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2854         Initialize new data member.
2855         (Incremental_object_entry::add_comdat_group): New function.
2856         (Incremental_object_entry::get_comdat_group_count): New function.
2857         (Incremental_object_entry::get_comdat_signature_key): New function.
2858         (Incremental_object_entry::groups_): New data member.
2859         (Incremental_inputs::report_comdat_group): New function.
2860         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2861         data for incremental input file entry.
2862         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2863         (Incremental_input_entry_reader::get_input_section): Adjust size of
2864         data for incremental input file entry.
2865         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2866         (Incremental_input_entry_reader::get_comdat_group_signature): New
2867         function.
2868         * object.cc (Sized_relobj::include_section_group): Report kept
2869         COMDAT groups for incremental links.
2870
2871 2011-05-24  David Meyer  <pdox@google.com>
2872
2873         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2874         with name parameter.  Add found_name parameter.
2875         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2876         * dirsearch.h (class Dirsearch): Update declaration.
2877
2878 2011-05-24  Ian Lance Taylor  <iant@google.com>
2879
2880         * archive.cc (Library_base::should_include_member): Pull in object
2881         from archive if it defines the entry symbol.
2882         * parameters.cc (Parameters::entry): New function.
2883         * parameters.h (class Parameters): Declare entry.
2884         * output.h (class Output_file_header): Remove entry_ field.
2885         * output.cc (Output_file_header::Output_file_header): Remove entry
2886         parameter.  Change all callers.
2887         (Output_file_header::entry): Use parameters->entry.
2888         * gold.cc (queue_middle_tasks): Likewise.
2889         * plugin.cc (Plugin_hook::run): Likewise.
2890
2891 2011-05-24 Cary Coutant  <ccoutant@google.com>
2892
2893         * gold.cc (queue_initial_tasks): Pass incremental base filename
2894         to Output_file::open_base_file; don't print error message.
2895         * incremental-dump.cc (main): Adjust call to
2896         Output_file::open_for_modification.
2897         * incremental-dump.cc (main): Likewise.
2898         * incremental.cc (Incremental_inputs::report_command_line):
2899         Ignore --incremental-base option when comparing command lines.
2900         Ignore parameter when given as separate argument.
2901         * options.h (class General_options): Add --incremental-base.
2902         * output.cc (Output_file::Output_file):
2903         (Output_file::open_base_file): Add base_name and writable parameters;
2904         read base file into new file; print error message here.
2905         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2906         callers.
2907         * output.h (Output_file::open_for_modification): Rename to...
2908         (Output_file::open_base_file): ...this; add base_name and
2909         writable parameters; adjust all callers.
2910         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2911         callers.
2912         * testsuite/Makefile.am (incremental_test_4): Test
2913         --incremental-base.
2914         * testsuite/Makefile.in: Regenerate.
2915
2916 2011-05-24 Cary Coutant  <ccoutant@google.com>
2917
2918         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2919         incremental_test_4.
2920         * testsuite/Makefile.in: Regenerate.
2921         * testsuite/two_file_test_1_v1.cc: New test source file.
2922         * testsuite/two_file_test_1b_v1.cc: New test source file.
2923         * testsuite/two_file_test_2_v1.cc: New test source file.
2924
2925 2011-05-24 Cary Coutant  <ccoutant@google.com>
2926
2927         * dynobj.h (Dynobj::do_dynobj): New function.
2928         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2929         flag and soname for shared objects.
2930         * incremental.cc (Incremental_inputs::report_object): Make
2931         either Incremental_object_entry or Incremental_dynobj_entry; add
2932         soname to string table.
2933         (Incremental_inputs::report_input_section): Add assertion.
2934         (Output_section_incremental_inputs::set_final_data_size): Adjust
2935         type of input file entry for shared libraries; adjust size of
2936         shared library info entry.
2937         (Output_section_incremental_inputs::write_input_files): Write
2938         as_needed flag for shared libraries.
2939         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2940         of input file entry for shared libraries; write soname.
2941         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2942         soname from incremental info.
2943         * incremental.h (enum Incremental_input_flags): Add
2944         INCREMENTAL_INPUT_AS_NEEDED.
2945         (Incremental_input_entry::Incremental_input_entry): Initialize new
2946         data member.
2947         (Incremental_input_entry::set_as_needed): New function.
2948         (Incremental_input_entry::as_needed): New function.
2949         (Incremental_input_entry::do_dynobj_entry): New function.
2950         (Incremental_input_entry::as_needed_): New data member.
2951         (Incremental_object_entry::Incremental_object_entry): Don't check
2952         for shared library.
2953         (Incremental_object_entry::do_type): Likewise.
2954         (class Incremental_dynobj_entry): New class.
2955         (Incremental_input_entry_reader::as_needed): New function.
2956         (Incremental_input_entry_reader::get_soname): New function.
2957         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2958         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2959         size of shared library info entry.
2960         * layout.cc (Layout::finish_dynamic_section): Don't test for
2961         incremental link when adding DT_NEEDED entries.
2962         * object.h (Object::Object): Initialize new data member.
2963         (Object::dynobj): New function.
2964         (Object::set_as_needed): New function.
2965         (Object::as_needed): New function.
2966         (Object::do_dynobj): New function.
2967         (Object::as_needed_): New data member.
2968
2969 2011-05-24 Cary Coutant  <ccoutant@google.com>
2970
2971         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2972         info; adjust display of GOT entries.
2973         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2974         vector of input objects; remove file_status_.
2975         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2976         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2977         got_plt reader; call target hooks to reserve GOT entries.
2978         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2979         of input file info header and GOT info entry.
2980         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2981         relocation info.
2982         (Got_plt_view_info::got_descriptor): Remove.
2983         (Got_plt_view_info::sym_index): New data member.
2984         (Got_plt_view_info::input_index): New data member.
2985         (Local_got_offset_visitor::visit): Write input file index.
2986         (Global_got_offset_visitor::visit): Write 0 for input file index.
2987         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2988         with sym_index and input_index.
2989         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2990         incremental info GOT entry; replace got_descriptor with input_index.
2991         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2992         map from input file index to object.
2993         (Sized_relobj_incr::do_layout): Replace direct data member reference
2994         with accessor function.
2995         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2996         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2997         Adjust size of input file info header.
2998         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2999         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3000         (Incremental_input_entry_reader::get_input_section): Adjust size of
3001         input file info header.
3002         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3003         of incremental info GOT entry.
3004         (Incremental_got_plt_reader::get_got_desc): Remove.
3005         (Incremental_got_plt_reader::get_got_symndx): New function.
3006         (Incremental_got_plt_reader::get_got_input_index): New function.
3007         (Sized_incremental_binary::Sized_incremental_binary): Remove
3008         file_status_; add input_objects_.
3009         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3010         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3011         (Sized_incremental_binary::file_is_unchanged): Remove.
3012         (Sized_incremental_binary::set_input_object): New function.
3013         (Sized_incremental_binary::input_object): New function.
3014         (Sized_incremental_binary::file_status_): Remove.
3015         (Sized_incremental_binary::input_objects_): New data member.
3016         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3017         references.
3018         (Sized_relobj_incr::invalid_address): Move to base class.
3019         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3020         class.
3021         (Sized_relobj_incr::do_output_section_offset): Likewise.
3022         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3023         (Sized_relobj_incr::section_offsets_): Likewise.
3024         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3025         function.
3026         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3027         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3028         with accessor function.
3029         (Sized_relobj_file::do_layout): Likewise.
3030         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3031         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3032         (Sized_relobj_file::compute_final_local_value): Replace refs to
3033         section_offsets_ with accessor function.
3034         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3035         * object.h (Relobj::Relobj): Initialize new data members.
3036         (Relobj::add_dyn_reloc): New function.
3037         (Relobj::first_dyn_reloc): New function.
3038         (Relobj::dyn_reloc_count): New function.
3039         (Relobj::first_dyn_reloc_): New data member.
3040         (Relobj::dyn_reloc_count_): New data member.
3041         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3042         references.
3043         (Sized_relobj::Address): New typedef.
3044         (Sized_relobj::invalid_address): Move here from child class.
3045         (Sized_relobj::Sized_relobj): Initialize new data members.
3046         (Sized_relobj::sized_relobj): New function.
3047         (Sized_relobj::is_output_section_offset_invalid): Move here from
3048         child class.
3049         (Sized_relobj::get_output_section_offset): Likewise.
3050         (Sized_relobj::local_has_got_offset): Likewise.
3051         (Sized_relobj::local_got_offset): Likewise.
3052         (Sized_relobj::set_local_got_offset): Likewise.
3053         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3054         (Sized_relobj::clear_got_offsets): New function.
3055         (Sized_relobj::section_offsets): Move here from child class.
3056         (Sized_relobj::do_output_section_offset): Likewise.
3057         (Sized_relobj::do_set_section_offset): Likewise.
3058         (Sized_relobj::Local_got_offsets): Likewise.
3059         (Sized_relobj::local_got_offsets_): Likewise.
3060         (Sized_relobj::section_offsets_): Likewise.
3061         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3062         references.
3063         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3064         class.
3065         (Sized_relobj_file::sized_relobj): New function
3066         (Sized_relobj_file::local_has_got_offset): Move to base class.
3067         (Sized_relobj_file::local_got_offset): Likewise.
3068         (Sized_relobj_file::set_local_got_offset): Likewise.
3069         (Sized_relobj_file::get_output_section_offset): Likewise.
3070         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3071         (Sized_relobj_file::do_output_section_offset): Likewise.
3072         (Sized_relobj_file::do_set_section_offset): Likewise.
3073         (Sized_relobj_file::Local_got_offsets): Likewise.
3074         (Sized_relobj_file::local_got_offsets_): Likewise.
3075         (Sized_relobj_file::section_offsets_): Likewise.
3076         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3077         (all constructors).
3078         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3079         (Output_reloc::get_symbol_index): Likewise.
3080         (Output_reloc::local_section_offset): Likewise.
3081         (Output_reloc::get_address): Likewise.
3082         (Output_reloc::symbol_value): Likewise.
3083         (Output_data_got::reserve_slot): Move to class definition.
3084         (Output_data_got::reserve_local): New function.
3085         (Output_data_got::reserve_slot_for_global): Remove.
3086         (Output_data_got::reserve_global): New function.
3087         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3088         (all constructors, two instantiations).
3089         (Output_reloc::get_relobj): New function (two instantiations).
3090         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3091         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3092         (Output_data_reloc::add_global): Adjust type of relobj.
3093         (Output_data_reloc::add_global_relative): Likewise.
3094         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3095         (Output_data_reloc::add_local): Likewise.
3096         (Output_data_reloc::add_local_relative): Likewise.
3097         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3098         (Output_data_reloc::add_local_section): Likewise.
3099         (Output_data_reloc::add_output_section): Likewise.
3100         (Output_data_reloc::add_absolute): Likewise.
3101         (Output_data_reloc::add_target_specific): Likewise.
3102         (Output_data_got::reserve_slot): Move definition here.
3103         (Output_data_got::reserve_local): New function.
3104         (Output_data_got::reserve_global): New function.
3105         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3106         section_offsets_ with accessor function.
3107         (Sized_relobj_file::write_sections): Likewise.
3108         (Sized_relobj_file::do_relocate_sections): Likewise.
3109         * target.h (Sized_target::reserve_local_got_entry): New function.
3110         (Sized_target::reserve_global_got_entry): New function.
3111         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3112         (Target_x86_64::reserve_global_got_entry): New function.
3113         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3114
3115 2011-05-23 Cary Coutant  <ccoutant@google.com>
3116
3117         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3118         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3119         bit when checking got_type.
3120         * incremental.cc (Sized_incremental_binary::setup_readers):
3121         Store symbol table and string table locations; initialize bit vector
3122         of file status flags.
3123         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3124         unchanged files.
3125         (Sized_incremental_binary::do_process_got_plt): New function.
3126         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3127         (Output_section_incremental_inputs::set_final_data_size): Record
3128         file index for each input file.
3129         (Output_section_incremental_inputs::write_got_plt): Store file index
3130         instead of input entry offset for each GOT entry.
3131         * incremental.h
3132         (Incremental_input_entry::Incremental_input_entry): Initialize new
3133         data member.
3134         (Incremental_input_entry::set_offset): Store file index.
3135         (Incremental_input_entry::get_file_index): New function.
3136         (Incremental_input_entry::file_index_): New data member.
3137         (Incremental_binary::process_got_plt): New function.
3138         (Incremental_binary::do_process_got_plt): New function.
3139         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3140         data members.
3141         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3142         (Sized_incremental_binary::set_file_is_unchanged): New function.
3143         (Sized_incremental_binary::file_is_unchanged): New function.
3144         (Sized_incremental_binary::do_process_got_plt): New function.
3145         (Sized_incremental_binary::file_status_): New data member.
3146         (Sized_incremental_binary::main_symtab_loc_): New data member.
3147         (Sized_incremental_binary::main_strtab_loc_): New data member.
3148         * output.cc (Output_data_got::Got_entry::write): Add case
3149         RESERVED_CODE.
3150         (Output_data_got::add_global): Call add_got_entry.
3151         (Output_data_got::add_global_plt): Likewise.
3152         (Output_data_got::add_global_with_rel): Likewise.
3153         (Output_data_got::add_global_with_rela): Likewise.
3154         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3155         (Output_data_got::add_global_pair_with_rela): Likewise.
3156         (Output_data_got::add_local): Call add_got_entry.
3157         (Output_data_got::add_local_plt): Likewise.
3158         (Output_data_got::add_local_with_rel): Likewise.
3159         (Output_data_got::add_local_with_rela): Likewise.
3160         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3161         (Output_data_got::add_local_pair_with_rela): Likewise.
3162         (Output_data_got::reserve_slot): New function.
3163         (Output_data_got::reserve_slot_for_global): New function.
3164         (Output_data_got::add_got_entry): New function.
3165         (Output_data_got::add_got_entry_pair): New function.
3166         (Output_section::add_output_section_data): Edit FIXME.
3167         * output.h
3168         (Output_section_data_build::Output_section_data_build): New
3169         constructor with size parameter.
3170         (Output_data_space::Output_data_space): Likewise.
3171         (Output_data_got::Output_data_got): Initialize new data member; new
3172         constructor with size parameter.
3173         (Output_data_got::add_constant): Call add_got_entry.
3174         (Output_data_got::reserve_slot): New function.
3175         (Output_data_got::reserve_slot_for_global): New function.
3176         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3177         (Output_data_got::add_got_entry): New function.
3178         (Output_data_got::add_got_entry_pair): New function.
3179         (Output_data_got::free_list_): New data member.
3180         * target.h (Sized_target::init_got_plt_for_update): New function.
3181         (Sized_target::register_global_plt_entry): New function.
3182         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3183         Initialize new data member; call init; add constructor with PLT count.
3184         (Output_data_plt_x86_64::init): New function.
3185         (Output_data_plt_x86_64::add_relocation): New function.
3186         (Output_data_plt_x86_64::reserve_slot): New function.
3187         (Output_data_plt_x86_64::free_list_): New data member.
3188         (Target_x86_64::init_got_plt_for_update): New function.
3189         (Target_x86_64::register_global_plt_entry): New function.
3190         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3191         incremental updates.
3192         (Output_data_plt_x86_64::add_relocation): New function.
3193         * testsuite/object_unittest.cc (Object_test): Set default options.
3194
3195 2011-05-16  Ian Lance Taylor  <iant@google.com>
3196
3197         * options.h (class General_options): Make -i a synonym for -r.
3198
3199 2011-05-16  Ian Lance Taylor  <iant@google.com>
3200
3201         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3202
3203 2011-05-10 Cary Coutant  <ccoutant@google.com>
3204
3205         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3206         strip_all (-s).
3207
3208 2011-05-06  Ian Lance Taylor  <iant@google.com>
3209
3210         * layout.cc (Layout::layout): If the output section flags change,
3211         update the ordering.
3212
3213 2011-04-25 Cary Coutant  <ccoutant@google.com>
3214
3215         * incremental-dump.cc (dump_incremental_inputs): Print local
3216         symbol info for each input file.
3217         * incremental.cc
3218         (Output_section_incremental_inputs::set_final_data_size): Add local
3219         symbol info to input file entries in incremental info.
3220         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3221         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3222         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3223         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3224         implementation.
3225         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3226         (Sized_incr_relobj::do_relocate): Write the local symbols.
3227         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3228         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3229         Adjust size of input file header.
3230         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3231         (Incremental_inputs_reader::get_local_symbol_count): New function.
3232         (Incremental_inputs_reader::get_input_section): Adjust size of input
3233         file header.
3234         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3235         (Sized_incr_relobj::This): New typedef.
3236         (Sized_incr_relobj::sym_size): New const data member.
3237         (Sized_incr_relobj::Local_symbol): New struct.
3238         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3239         (Sized_incr_relobj::do_local_symbol_offset): New function.
3240         (Sized_incr_relobj::local_symbol_count_): New data member.
3241         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3242         (Sized_incr_relobj::local_symbol_index_): New data member.
3243         (Sized_incr_relobj::local_symbol_offset_): New data member.
3244         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3245         (Sized_incr_relobj::local_symbols_): New data member.
3246         * object.h (Relobj::output_local_symbol_count): New function.
3247         (Relobj::local_symbol_offset): New function.
3248         (Relobj::do_output_local_symbol_count): New function.
3249         (Relobj::do_local_symbol_offset): New function.
3250         (Sized_relobj::do_output_local_symbol_count): New function.
3251         (Sized_relobj::do_local_symbol_offset): New function.
3252
3253 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3254
3255         * descriptors.cc (set_close_on_exec): New function.
3256         (Descriptors::open): Use set_close_on_exec.
3257         * output.cc (S_ISLNK): Define if not defined.
3258
3259 2011-04-22 Cary Coutant  <ccoutant@google.com>
3260
3261         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3262         global symbol map.
3263         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3264         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3265         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3266         relocations.
3267         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3268         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3269         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3270         * incremental.h
3271         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3272         function.
3273         (Incremental_binary::apply_incremental_relocs): New function.
3274         (Incremental_binary::do_apply_incremental_relocs): New function.
3275         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3276         data member.
3277         (Sized_incremental_binary::add_global_symbol): New function.
3278         (Sized_incremental_binary::global_symbol): New function.
3279         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3280         (Sized_incremental_binary::symbol_map_): New data member.
3281         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3282         * target.h (Sized_target::apply_relocation): New function.
3283         * target-reloc.h (apply_relocation): New function.
3284         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3285
3286 2011-04-22  Doug Kwan  <dougkwan@google.com>
3287
3288         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3289         flag of a SHT_ARM_EXIDX section.
3290         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3291         * testsuite/Makefile.in: Regenerate.
3292         * testsuite/arm_exidx_test.s: New file.
3293         * testsuite/arm_exidx_test.sh: Same.
3294
3295 2011-04-20 Cary Coutant  <ccoutant@google.com>
3296
3297         PR gold/12689
3298         * archive.h (Incremental_archive_entry::Archive_member):
3299         Initialize arg_serial_ (second constructor).
3300
3301 2011-04-17  Ian Lance Taylor  <iant@google.com>
3302
3303         * object.cc (Relocate_info::location): Simplify location string.
3304         * errors.cc (Errors::error_at_location): Don't print program
3305         name.
3306         (Errors::warning_at_location): Likewise.
3307         (Errors::undefined_symbol): Likewise.
3308         * testsuite/debug_msg.sh: Update accordingly.
3309
3310 2011-04-14 Cary Coutant  <ccoutant@google.com>
3311
3312         * gold/layout.cc (Layout::symtab_section_offset): New function.
3313         * gold/layout.h (Layout::symtab_section_offset): New function.
3314         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3315
3316 2011-04-12  Ian Lance Taylor  <iant@google.com>
3317
3318         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3319         with MREMAP_MAYMOVE.
3320         * output.h (class Output_file): Add map_is_allocated_ field.
3321         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3322         not available, provide stubs.  If mremap is not available, #define
3323         it to gold_mremap.
3324         (MREMAP_MAYMOVE): Define if not defined.
3325         (Output_file::Output_file): Initialize map_is_allocated_.
3326         (Output_file::resize): Check map_is_allocated_.
3327         (Output_file::map_anonymous): If mmap fails, use malloc.
3328         (Output_file::unmap): Don't do anything for an anonymous map.
3329         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3330         is not available, provide stubs.
3331         (File_read::View::~View): Use free rather than delete[].
3332         (File_read::make_view): Use malloc rather than new[].  If mmap
3333         fails, use malloc.
3334         (File_read::find_or_make_view): Use malloc rather than new[].
3335         * gold.h: Remove HAVE_REMAP code.
3336         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3337         exists.  Rename mremap to gold_mremap.  If mmap is not available
3338         don't do anything.
3339         * configure, config.in: Rebuild.
3340
3341 2011-04-11  Ian Lance Taylor  <iant@google.com>
3342
3343         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3344         initialize local variable v.
3345
3346 2011-04-11  Cary Coutant  <ccoutant@google.com>
3347
3348         * archive.cc (Archive::include_member): Adjust call to
3349         report_object.
3350         (Add_archive_symbols::run): Track argument serial numbers.
3351         (Lib_group::include_member): Likewise.
3352         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3353         * archive.h (Incremental_archive_entry::Archive_member):
3354         Initialize arg_serial_.
3355         (Archive_member::arg_serial_): New data member.
3356         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3357         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3358         incremental link.
3359         (Sized_dynobj::do_for_all_local_got_entries): New function.
3360         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3361         function.
3362         * fileread.cc (get_mtime): New function.
3363         * fileread.h (get_mtime): New function.
3364         * gold.cc (queue_initial_tasks): Check for incremental update.
3365         (process_incremental_input): New function.
3366         (queue_middle_tasks): Don't force valid target for incremental
3367         update.
3368         * incremental-dump.cc (find_input_containing_global): Adjust
3369         size of symbol info entry.
3370         (dump_incremental_inputs): Dump argument serial number and
3371         in_system_directory flag; bias shndx by 1; print symbol names
3372         when dumping per-file symbol lists; use new symbol info readers.
3373         * incremental.cc
3374         (Output_section_incremental_inputs:update_data_size): New function.
3375         (Sized_incremental_binary::setup_readers): Setup input readers
3376         for each input file; build maps for files added from libraries
3377         and scripts.
3378         (Sized_incremental_binary::check_input_args): New function.
3379         (Sized_incremental_binary::do_check_inputs): Build map of argument
3380         serial numbers to input arguments.
3381         (Sized_incremental_binary::do_file_has_changed): Rename
3382         do_file_is_unchanged to this; compare file modification times.
3383         (Sized_incremental_binary::do_init_layout): New function.
3384         (Sized_incremental_binary::do_reserve_layout): New function.
3385         (Sized_incremental_binary::do_get_input_reader): Remove.
3386         (Sized_incremental_binary::get_symtab_view): New function.
3387         (Incremental_checker::can_incrementally_link_output_file): Remove.
3388         (Incremental_inputs::report_command_line): Exclude --debug options.
3389         (Incremental_inputs::report_archive_begin): Add parameter; track
3390         argument serial numbers; don't put input file entry for archive
3391         before archive members.
3392         (Incremental_inputs::report_archive_end): Put input file entry
3393         for archive after archive members.
3394         (Incremental_inputs::report_object): Add parameter; track argument
3395         serial numbers and in_system_directory flag.
3396         (Incremental_inputs::report_script): Add parameter; track argument
3397         serial numbers.
3398         (Output_section_incremental_inputs::set_final_data_size): Adjust
3399         size of symbol info entry; check for forwarding symbols.
3400         (Output_section_incremental_inputs::write_input_files): Write
3401         in_system_directory flag and argument serial number.
3402         (Output_section_incremental_inputs::write_info_blocks): Map section
3403         indices between incremental info and original input file; store
3404         input section index for each symbol.
3405         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3406         change operator() to visit().
3407         (class Global_got_offset_visitor): Likewise.
3408         (class Global_symbol_visitor_got_plt):
3409         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3410         classes.
3411         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3412         (Sized_incr_relobj::do_read_symbols): New function.
3413         (Sized_incr_relobj::do_layout): New function.
3414         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3415         (Sized_incr_relobj::do_add_symbols): New function.
3416         (Sized_incr_relobj::do_should_include_member): New function.
3417         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3418         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3419         (Sized_incr_relobj::do_section_size): New function.
3420         (Sized_incr_relobj::do_section_name): New function.
3421         (Sized_incr_relobj::do_section_contents): New function.
3422         (Sized_incr_relobj::do_section_flags): New function.
3423         (Sized_incr_relobj::do_section_entsize): New function.
3424         (Sized_incr_relobj::do_section_address): New function.
3425         (Sized_incr_relobj::do_section_type): New function.
3426         (Sized_incr_relobj::do_section_link): New function.
3427         (Sized_incr_relobj::do_section_info): New function.
3428         (Sized_incr_relobj::do_section_addralign): New function.
3429         (Sized_incr_relobj::do_initialize_xindex): New function.
3430         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3431         (Sized_incr_relobj::do_read_relocs): New function.
3432         (Sized_incr_relobj::do_gc_process_relocs): New function.
3433         (Sized_incr_relobj::do_scan_relocs): New function.
3434         (Sized_incr_relobj::do_count_local_symbols): New function.
3435         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3436         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3437         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3438         (Sized_incr_relobj::do_relocate): New function.
3439         (Sized_incr_relobj::do_set_section_offset): New function.
3440         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3441         (Sized_incr_dynobj::do_read_symbols): New function.
3442         (Sized_incr_dynobj::do_layout): New function.
3443         (Sized_incr_dynobj::do_add_symbols): New function.
3444         (Sized_incr_dynobj::do_should_include_member): New function.
3445         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3446         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3447         (Sized_incr_dynobj::do_section_size): New function.
3448         (Sized_incr_dynobj::do_section_name): New function.
3449         (Sized_incr_dynobj::do_section_contents): New function.
3450         (Sized_incr_dynobj::do_section_flags): New function.
3451         (Sized_incr_dynobj::do_section_entsize): New function.
3452         (Sized_incr_dynobj::do_section_address): New function.
3453         (Sized_incr_dynobj::do_section_type): New function.
3454         (Sized_incr_dynobj::do_section_link): New function.
3455         (Sized_incr_dynobj::do_section_info): New function.
3456         (Sized_incr_dynobj::do_section_addralign): New function.
3457         (Sized_incr_dynobj::do_initialize_xindex): New function.
3458         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3459         (make_sized_incremental_object): New function.
3460         (Incremental_library::copy_unused_symbols): New function.
3461         (Incremental_library::do_for_all_unused_symbols): New function.
3462         * incremental.h (enum Incremental_input_flags): New type.
3463         (class Incremental_checker): Remove.
3464         (Incremental_input_entry::Incremental_input_entry): Add argument
3465         serial number.
3466         (Incremental_input_entry::arg_serial): New function.
3467         (Incremental_input_entry::set_is_in_system_directory): New function.
3468         (Incremental_input_entry::is_in_system_directory): New function.
3469         (Incremental_input_entry::arg_serial_): New data member.
3470         (Incremental_input_entry::is_in_system_directory_): New data member.
3471         (class Script_info): Move here from script.h.
3472         (Script_info::Script_info): Add filename parameter.
3473         (Script_info::filename): New function.
3474         (Script_info::filename_): New data member.
3475         (Incremental_script_entry::Incremental_script_entry): Add argument
3476         serial number.
3477         (Incremental_object_entry::Incremental_object_entry): Likewise.
3478         (Incremental_object_entry::add_input_section): Build list of input
3479         sections with map to original shndx.
3480         (Incremental_object_entry::get_input_section_index): New function.
3481         (Incremental_object_entry::shndx_): New data member.
3482         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3483         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3484         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3485         serial number.
3486         (Incremental_inputs::report_archive_begin): Likewise.
3487         (Incremental_inputs::report_object): Likewise.
3488         (Incremental_inputs::report_script): Likewise.
3489         (class Incremental_global_symbol_reader): New class.
3490         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3491         and store flags and input file type.
3492         (Incremental_input_entry_reader::arg_serial): New function.
3493         (Incremental_input_entry_reader::type): Extract type from flags.
3494         (Incremental_input_entry_reader::is_in_system_directory): New function.
3495         (Incremental_input_entry_reader::get_input_section_count): Call
3496         accessor function for type.
3497         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3498         function for type; adjust size of global symbol entry.
3499         (Incremental_input_entry_reader::get_global_symbol_count): Call
3500         accessor function for type.
3501         (Incremental_input_entry_reader::get_object_count): Likewise.
3502         (Incremental_input_entry_reader::get_object_offset): Likewise.
3503         (Incremental_input_entry_reader::get_member_count): Likewise.
3504         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3505         (Incremental_input_entry_reader::get_member_offset): Likewise.
3506         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3507         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3508         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3509         (Incremental_input_entry_reader::get_global_symbol_reader): New
3510         function.
3511         (Incremental_input_entry_reader::get_output_symbol_index): New
3512         function.
3513         (Incremental_input_entry_reader::type_): Remove.
3514         (Incremental_input_entry_reader::flags_): New data member.
3515         (Incremental_inputs_reader::input_file_offset): New function.
3516         (Incremental_inputs_reader::input_file_index): New function.
3517         (Incremental_inputs_reader::input_file): Call input_file_offset.
3518         (Incremental_inputs_reader::input_file_at_offset): New function.
3519         (Incremental_relocs_reader::get_r_type): Reformat.
3520         (Incremental_relocs_reader::get_r_shndx): Reformat.
3521         (Incremental_relocs_reader::get_r_offset): Reformat.
3522         (Incremental_relocs_reader::data): New function.
3523         (Incremental_binary::Incremental_binary): Initialize new data members.
3524         (Incremental_binary::check_inputs): Add cmdline parameter.
3525         (Incremental_binary::file_is_unchanged): Remove.
3526         (Input_reader::arg_serial): New function.
3527         (Input_reader::get_unused_symbol_count): New function.
3528         (Input_reader::get_unused_symbol): New function.
3529         (Input_reader::do_arg_serial): New function.
3530         (Input_reader::do_get_unused_symbol_count): New function.
3531         (Input_reader::do_get_unused_symbol): New function.
3532         (Incremental_binary::input_file_count): New function.
3533         (Incremental_binary::get_input_reader): Change signature to use
3534         index instead of filename.
3535         (Incremental_binary::file_has_changed): New function.
3536         (Incremental_binary::get_input_argument): New function.
3537         (Incremental_binary::get_library): New function.
3538         (Incremental_binary::get_script_info): New function.
3539         (Incremental_binary::init_layout): New function.
3540         (Incremental_binary::reserve_layout): New function.
3541         (Incremental_binary::output_file): New function.
3542         (Incremental_binary::do_check_inputs): New function.
3543         (Incremental_binary::do_file_is_unchanged): Remove.
3544         (Incremental_binary::do_file_has_changed): New function.
3545         (Incremental_binary::do_init_layout): New function.
3546         (Incremental_binary::do_reserve_layout): New function.
3547         (Incremental_binary::do_input_file_count): New function.
3548         (Incremental_binary::do_get_input_reader): Change signature.
3549         (Incremental_binary::input_args_map_): New data member.
3550         (Incremental_binary::library_map_): New data member.
3551         (Incremental_binary::script_map_): New data member.
3552         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3553         new data members.
3554         (Sized_incremental_binary::output_section): New function.
3555         (Sized_incremental_binary::inputs_reader): Add const.
3556         (Sized_incremental_binary::symtab_reader): Add const.
3557         (Sized_incremental_binary::relocs_reader): Add const.
3558         (Sized_incremental_binary::got_plt_reader): Add const.
3559         (Sized_incremental_binary::get_symtab_view): New function.
3560         (Sized_incremental_binary::Inputs_reader): New typedef.
3561         (Sized_incremental_binary::Input_entry_reader): New typedef.
3562         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3563         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3564         (Sized_incremental_binary::do_file_has_changed): New function.
3565         (Sized_incremental_binary::do_init_layout): New function.
3566         (Sized_incremental_binary::do_reserve_layout): New function.
3567         (Sized_input_reader::Inputs_reader): Remove.
3568         (Sized_input_reader::Input_entry_reader): Remove.
3569         (Sized_input_reader::do_arg_serial): New function.
3570         (Sized_input_reader::do_get_unused_symbol_count): New function.
3571         (Sized_input_reader::do_get_unused_symbol): New function.
3572         (Sized_incremental_binary::do_input_file_count): New function.
3573         (Sized_incremental_binary::do_get_input_reader): Change signature;
3574         use index instead of filename.
3575         (Sized_incremental_binary::section_map_): New data member.
3576         (Sized_incremental_binary::input_entry_readers_): New data member.
3577         (class Sized_incr_relobj): New class.
3578         (class Sized_incr_dynobj): New class.
3579         (make_sized_incremental_object): New function.
3580         (class Incremental_library): New class.
3581         * layout.cc (Free_list::num_lists): New static data member.
3582         (Free_list::num_nodes): New static data member.
3583         (Free_list::num_removes): New static data member.
3584         (Free_list::num_remove_visits): New static data member.
3585         (Free_list::num_allocates): New static data member.
3586         (Free_list::num_allocate_visits): New static data member.
3587         (Free_list::init): New function.
3588         (Free_list::remove): New function.
3589         (Free_list::allocate): New function.
3590         (Free_list::dump): New function.
3591         (Free_list::print_stats): New function.
3592         (Layout_task_runner::run): Resize output file for incremental updates.
3593         (Layout::Layout): Initialize new data members.
3594         (Layout::set_incremental_base): New function.
3595         (Layout::init_fixed_output_section): New function.
3596         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3597         incremental updates.
3598         (Layout::create_gold_note): Do not create gold note section for
3599         incremental updates.
3600         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3601         for incremental updates.
3602         (Layout::set_section_offsets): For incremental updates, allocate space
3603         from free list.
3604         (Layout::create_symtab_sections): Layout with offsets relative to
3605         start of section; for incremental updates, allocate space from free
3606         list.
3607         (Layout::create_shdrs): For incremental updates, allocate space from
3608         free list.
3609         (Layout::finish_dynamic_section): For incremental updates, do not
3610         check --as-needed (fixed in subsequent patch).
3611         * layout.h (class Free_list): New class.
3612         (Layout::set_incremental_base): New function.
3613         (Layout::incremental_base): New function.
3614         (Layout::init_fixed_output_section): New function.
3615         (Layout::allocate): New function.
3616         (Layout::incremental_base_): New data member.
3617         (Layout::free_list_): New data member.
3618         * main.cc (main): Print Free_list statistics.
3619         * object.cc (Relobj::finalize_incremental_relocs): Add
3620         clear_counts parameter; clear counts only when clear_counts is set.
3621         (Sized_relobj::Sized_relobj): Initialize new base class.
3622         (Sized_relobj::do_layout): Don't report special sections.
3623         (Sized_relobj::do_for_all_local_got_entries): New function.
3624         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3625         symtab_off to all symbol table offsets.
3626         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3627         * object.h (class Got_offset_list): Move to top of file.
3628         (Object::Object): Allow case where input_file == NULL.
3629         (Object::~Object): Likewise.
3630         (Object::input_file): Assert that input_file != NULL.
3631         (Object::lock): Allow case where input_file == NULL.
3632         (Object::unlock): Likewise.
3633         (Object::is_locked): Likewise.
3634         (Object::token): Likewise.
3635         (Object::release): Likewise.
3636         (Object::is_incremental): New function.
3637         (Object::get_mtime): New function.
3638         (Object::for_all_local_got_entries): New function.
3639         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3640         (Object::set_is_in_system_directory): New function.
3641         (Object::is_in_system_directory): New function.
3642         (Object::do_is_incremental): New function.
3643         (Object::do_get_mtime): New function.
3644         (Object::do_for_all_local_got_entries): New function.
3645         (Object::is_in_system_directory_): New data member.
3646         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3647         (class Sized_relobj_base): New class.
3648         (class Sized_relobj): Derive from Sized_relobj_base.
3649         (class Sized_relobj::Symbols): Redeclare from base class.
3650         (class Sized_relobj::local_got_offset_list): Remove.
3651         (class Sized_relobj::Output_sections): Redeclare from base class.
3652         (class Sized_relobj::do_for_all_local_got_entries): New function.
3653         (class Sized_relobj::write_local_symbols): Add offset parameter.
3654         (class Sized_relobj::local_symbol_offset_): Update comment.
3655         (class Sized_relobj::local_dynsym_offset_): Update comment.
3656         * options.cc (Input_arguments::add_file): Remove const.
3657         * options.h (Input_file_argument::Input_file_argument):
3658         Initialize arg_serial_ (all constructors).
3659         (Input_file_argument::set_arg_serial): New function.
3660         (Input_file_argument::arg_serial): New function.
3661         (Input_file_argument::arg_serial_): New data member.
3662         (Input_arguments::Input_arguments): Initialize file_count_.
3663         (Input_arguments::add_file): Remove const.
3664         (Input_arguments::number_of_input_files): New function.
3665         (Input_arguments::file_count_): New data member.
3666         (Command_line::number_of_input_files): Call
3667         Input_arguments::number_of_input_files.
3668         * output.cc (Output_segment_headers::Output_segment_headers):
3669         Set current size.
3670         (Output_section::Input_section::current_data_size): New function.
3671         (Output_section::Output_section): Initialize new data members.
3672         (Output_section::add_input_section): Don't do merge sections for
3673         an incremental link; allocate space from free list for an
3674         incremental update.
3675         (Output_section::add_output_section_data): Allocate space from
3676         free list for an incremental update.
3677         (Output_section::update_data_size): New function.
3678         (Output_section::set_fixed_layout): New function.
3679         (Output_section::reserve): New function.
3680         (Output_segment::set_section_addresses): Remove const.
3681         (Output_segment::set_section_list_addresses): Remove const; allocate
3682         space from free list for an incremental update.
3683         (Output_segment::set_offset): Adjust size of RELRO segment for an
3684         incremental update.
3685         * output.h (Output_data::current_data_size): Move here from
3686         child classes.
3687         (Output_data::pre_finalize_data_size): New function.
3688         (Output_data::update_data_size): New function.
3689         (Output_section_headers::update_data_size): new function.
3690         (Output_section_data_build::current_data_size): Move to Output_data.
3691         (Output_data_strtab::update_data_size): New function.
3692         (Output_section::current_data_size): Move to Output_data.
3693         (Output_section::set_fixed_layout): New function.
3694         (Output_section::has_fixed_layout): New function.
3695         (Output_section::reserve): New function.
3696         (Output_section::update_data_size): New function.
3697         (Output_section::has_fixed_layout_): New data member.
3698         (Output_section::free_list_): New data member.
3699         (Output_segment::set_section_addresses): Remove const.
3700         (Output_segment::set_section_list_addresses): Remove const.
3701         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3702         New function.
3703         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3704         New function.
3705         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3706         parameter when calling Add_symbols constructor; store argument
3707         serial number for members of a lib group.
3708         (Add_symbols::locks): Allow case where token == NULL.
3709         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3710         (Read_member::~Read_member): New function.
3711         (Read_member::is_runnable): New function.
3712         (Read_member::locks): New function.
3713         (Read_member::run): New function.
3714         (Check_script::~Check_script): New function.
3715         (Check_script::is_runnable): New function.
3716         (Check_script::locks): New function.
3717         (Check_script::run): New function.
3718         (Check_library::~Check_library): New function.
3719         (Check_library::is_runnable): New function.
3720         (Check_library::locks): New function.
3721         (Check_library::run): New function.
3722         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3723         (Add_symbols::library_): New data member.
3724         (class Read_member): New class.
3725         (class Check_script): New class.
3726         (class Check_library): New class.
3727         * reloc.cc (Read_relocs::is_runnable): Allow case where
3728         token == NULL.
3729         (Read_relocs::locks): Likewise.
3730         (Scan_relocs::locks): Likewise.
3731         (Relocate_task::locks): Likewise.
3732         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3733         to clear counters.
3734         (Sized_relobj::incremental_relocs_scan): Fix comment.
3735         (Sized_relobj::do_relocate): Pass output file offset to
3736         write_local_symbols.
3737         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3738         from class declaration.
3739         * script.cc (read_input_script): Allocate Script_info; pass
3740         argument serial number to report_script.
3741         * script.h (class Script_info): Move to incremental.h.
3742         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3743         * symtab.h (Symbol_table::add_from_incrobj): New function.
3744         (Symbol_table::set_file_offset): New function.
3745
3746 2011-04-05  Cary Coutant  <ccoutant@google.com>
3747
3748         * incremental-dump.cc (dump_incremental_inputs): Change signature
3749         to take a Sized_incremental_binary; change caller.  Use readers
3750         in Sized_incremental_binary.
3751         * incremental.cc
3752         (Sized_incremental_binary::find_incremental_inputs_sections):
3753         Rename do_find_incremental_inputs_sections to this.
3754         (Sized_incremental_binary::setup_readers): New function.
3755         (Sized_incremental_binary::do_check_inputs): Check
3756         has_incremental_info_ flag; move setup code to setup_readers;
3757         use input readers.
3758         (Sized_incremental_binary::do_file_is_unchanged): New function.
3759         (Sized_incremental_binary::do_get_input_reader): New function.
3760         * incremental.h (class Incremental_binary): Move to end of file.
3761         (Incremental_binary::file_is_unchanged): New function.
3762         (Incremental_binary::do_file_is_unchanged): New function.
3763         (Incremental_binary::Input_reader): New class.
3764         (Incremental_binary::get_input_reader): New function.
3765         (class Sized_incremental_binary): Move to end of file.
3766         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3767         input section reader classes.
3768         (Sized_incremental_binary::has_incremental_info): New function.
3769         (Sized_incremental_binary::inputs_reader): New function.
3770         (Sized_incremental_binary::symtab_reader): New function.
3771         (Sized_incremental_binary::relocs_reader): New function.
3772         (Sized_incremental_binary::got_plt_reader): New function.
3773         (Sized_incremental_binary::do_file_is_unchanged): New function.
3774         (Sized_incremental_binary::Sized_input_reader): New class.
3775         (Sized_incremental_binary::get_input_reader): New function.
3776         (Sized_incremental_binary::find_incremental_inputs_sections):
3777         Rename do_find_incremental_inputs_sections to this.
3778         (Sized_incremental_binary::setup_readers): New function.
3779         (Sized_incremental_binary::has_incremental_info_): New data member.
3780         (Sized_incremental_binary::inputs_reader_): New data member.
3781         (Sized_incremental_binary::symtab_reader_): New data member.
3782         (Sized_incremental_binary::relocs_reader_): New data member.
3783         (Sized_incremental_binary::got_plt_reader_): New data member.
3784         (Sized_incremental_binary::current_input_file_): New data member.
3785
3786 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3787
3788         PR gold/12640
3789         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3790         violation.
3791
3792 2011-03-30  Cary Coutant  <ccoutant@google.com>
3793
3794         * archive.cc (Archive::include_member): Adjust call to report_object.
3795         (Add_archive_symbols::run): Add script_info to call to
3796         report_archive_begin.
3797         (Lib_group::include_member): Adjust call to report_object.
3798         (Add_lib_group_symbols::run): Adjust call to report_object.
3799         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3800         blocks.  Add object count for script input files.
3801         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3802         script_info parameter; change all callers.
3803         (Incremental_inputs::report_object): Add script_info parameter;
3804         change all callers.
3805         (Incremental_inputs::report_script): Store backpointer to
3806         incremental info entry.
3807         (Output_section_incremental_inputs::set_final_data_size): Record
3808         additional information for scripts.
3809         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3810         * incremental.h (Incremental_script_entry::add_object): New function.
3811         (Incremental_script_entry::get_object_count): New function.
3812         (Incremental_script_entry::get_object): New function.
3813         (Incremental_script_entry::objects_): New data member; adjust
3814         constructor.
3815         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3816         (Incremental_inputs::report_object): Add script_info parameter.
3817         (Incremental_inputs_reader::get_object_count): New function.
3818         (Incremental_inputs_reader::get_object_offset): New function.
3819         * options.cc (Input_arguments::add_file): Return reference to
3820         new input argument.
3821         * options.h (Input_argument::set_script_info): New function.
3822         (Input_argument::script_info): New function.
3823         (Input_argument::script_info_): New data member; adjust all
3824         constructors.
3825         (Input_file_group::add_file): Return reference to new input argument.
3826         (Input_file_lib::add_file): Likewise.
3827         (Input_arguments::add_file): Likewise.
3828         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3829         * script.cc (Parser_closure::Parser_closure): Add script_info
3830         parameter; adjust all callers.
3831         (Parser_closure::script_info): New function.
3832         (Parser_closure::script_info_): New data member.
3833         (read_input_script): Report scripts earlier to incremental info.
3834         (script_add_file): Set script_info in Input_argument.
3835         (script_add_library): Likewise.
3836         * script.h (Script_options::Script_info): Rewrite class.
3837
3838 2011-03-29  Cary Coutant  <ccoutant@google.com>
3839
3840         * archive.cc (Library_base::should_include_member): Move
3841         method here from class Archive.
3842         (Archive::Archive): Initialize base class.
3843         (Archive::should_include_member): Move to base class.
3844         (Archive::do_for_all_unused_symbols): New function.
3845         (Add_archive_symbols::run): Remove redundant access to
3846         incremental_inputs.
3847         (Lib_group::Lib_group): Initialize base class.
3848         (Lib_group::do_filename): New function.
3849         (Lib_group::include_member): Pass pointer to Lib_group to
3850         report_object.
3851         (Lib_group::do_for_all_unused_symbols): New function.
3852         (Add_lib_group_symbols::run): Report archive information for
3853         incremental links.
3854         * archive.h (class Library_base): New base class.
3855         (class Archive): Derive from Library_base.
3856         (Archive::filename): Move to base class.
3857         (Archive::set_incremental_info): Likewise.
3858         (Archive::incremental_info): Likewise.
3859         (Archive::Should_include): Likewise.
3860         (Archive::should_include_member): Likewise.
3861         (Archive::Armap_entry): Remove.
3862         (Archive::Unused_symbol_iterator): Remove.
3863         (Archive::unused_symbols_begin): Remove.
3864         (Archive::unused_symbols_end): Remove.
3865         (Archive::do_filename): New function.
3866         (Archive::do_get_mtime): New function.
3867         (Archive::do_for_all_unused_symbols): New function.
3868         (Archive::task_): Move to base class.
3869         (Archive::incremental_info_): Likewise.
3870         (class Lib_group): Derive from Library_base.
3871         (Lib_group::do_filename): New function.
3872         (Lib_group::do_get_mtime): New function.
3873         (Lib_group::do_for_all_unused_symbols): New function.
3874         (Lib_group::task_): Move to base class.
3875         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3876         function.
3877         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3878         function.
3879         * incremental.cc (Incremental_inputs::report_archive_begin):
3880         Use Library_base; call library's get_mtime; add incremental inputs
3881         entry before members.
3882         (class Unused_symbol_visitor): New class.
3883         (Incremental_inputs::report_archive_end): Use Library_base; use
3884         visitor class to record unused symbols; don't add incremental inputs
3885         entry after members.
3886         (Incremental_inputs::report_object): Use Library_base.
3887         * incremental.h
3888         (Incremental_archive_entry::Incremental_archive_entry): Remove
3889         unused Archive parameter.
3890         (Incremental_inputs::report_archive_begin): Use Library_base.
3891         (Incremental_inputs::report_archive_end): Likewise.
3892         (Incremental_inputs::report_object): Likewise.
3893         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3894         function.
3895         * object.h (Object::for_all_global_symbols): New function.
3896         (Object::do_for_all_global_symbols): New function.
3897         (Sized_relobj::do_for_all_global_symbols): New function.
3898         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3899         function.
3900         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3901         function.
3902
3903 2011-03-27  Ian Lance Taylor  <iant@google.com>
3904
3905         * archive.cc (Archive::interpret_header): Return -1 if something
3906         goes wrong.  Change callers accordingly.
3907
3908 2011-03-25  Cary Coutant  <ccoutant@google.com>
3909
3910         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3911         * testsuite/Makefile.in: Regenerate.
3912
3913 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3914
3915         * plugin.cc (get_view): New.
3916         (Plugin::load): Pass get_view to the plugin.
3917         (Plugin_manager::get_view): New.
3918
3919 2011-03-21  Ian Lance Taylor  <iant@google.com>
3920
3921         * testsuite/final_layout.sh: Rewrite to not use dc.
3922         * testsuite/relro_test.sh: Fail if dc is not present.
3923
3924 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3925
3926         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3927         Change == to -eq.
3928         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3929         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3930         Change == to -eq.
3931         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3932         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3933
3934 2011-03-14  Ian Lance Taylor  <iant@google.com>
3935
3936         * script-sections.cc (Sort_output_sections::script_compare):
3937         Rename from is_before, change return type.
3938         (Sort_output_sections::operator()): Adjust accordingly.
3939
3940 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3941
3942         PR gold/12572
3943         * testsuite/odr_violation2.cc: Add comment to make all error line
3944         numbers double digits.
3945         * testsuite/debug_msg.sh: Adjust expected errors.
3946
3947 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3948
3949         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3950         but mark earlier ones as non-canonical
3951         (offset_to_iterator): Update search target and example
3952         (do_addr2line): Return extra lines in a vector*
3953         (format_file_lineno): Extract from do_addr2line
3954         (one_addr2line): Add vector* out-param
3955         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3956         when a lineno entry appeared last for its instruction
3957         (Dwarf_line_info): Add vector* out-param
3958         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3959         * symtab.cc (Odr_violation_compare): Include the lineno in the
3960         comparison again.
3961         (linenos_from_loc): New. Combine the canonical line for an
3962         address with its other lines.
3963         (True_if_intersect): New. Helper functor to make
3964         std::set_intersection a query.
3965         (detect_odr_violations): Compare sets of lines instead of just
3966         one line for each function. This became less deterministic, but
3967         has fewer false positives.
3968         * symtab.h: Declarations.
3969         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3970         mix an optimized and non-optimized object in the same binary
3971         (odr_violation2.so): Same.
3972         * testsuite/Makefile.in: Regenerate from Makefile.am.
3973         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3974         * testsuite/debug_msg.sh: Update line numbers and add
3975         assertions.
3976         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3977         non-optimized context.
3978         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3979         isn't inlined, and use OdrDerived in an optimized context.
3980         * testsuite/odr_header1.h: Defines OdrDerived, where
3981         optimization will change the
3982         first-instruction-in-the-destructor's file and line number.
3983         * testsuite/odr_header2.h: Defines OdrBase.
3984
3985 2011-03-09  Ian Lance Taylor  <iant@google.com>
3986
3987         * fileread.cc (File_read::clear_views): Don't delete the whole
3988         file view.
3989
3990 2011-03-08  Ian Lance Taylor  <iant@google.com>
3991
3992         PR gold/12525
3993         * fileread.cc: #include <climits>.
3994         (GOLD_IOV_MAX): Define.
3995         (File_read::read_multiple): Limit number of entries by iov_max.
3996         * fileread.h (class File_read): Always set max_readv_entries to
3997         128.
3998
3999 2011-03-07  Ian Lance Taylor  <iant@google.com>
4000
4001         PR gold/12525
4002         * options.h (class General_options): Add -dy and -dn.
4003
4004 2011-03-02  Cary Coutant  <ccoutant@google.com>
4005
4006         * testsuite/script_test_9.t: Add TLS segment.
4007
4008 2011-03-02  Simon Baldwin  <simonb@google.com>
4009
4010         * configure.ac: Add check for gnu_indirect_function support in
4011         the toolchain building binutils.
4012         * configure: Rebuild.
4013
4014 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4015
4016         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4017         plugin only symbols.
4018         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4019         in plugin files as not needed in the symbol table.
4020
4021 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4022
4023         * output.cc (Output_section::add_input_section): Delay fill
4024         generation for section ordering.
4025
4026 2011-02-09  Ian Lance Taylor  <iant@google.com>
4027
4028         PR gold/12316
4029         * object.h (class Sized_relobj): Remove clear_local_symbols.
4030         * reloc.cc (Sized_relobj::do_relocate): Don't call
4031         clear_local_symbols.
4032
4033 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4034
4035         * plugin.cc (is_visible_from_outside): Return true for symbols
4036         in the -u option.
4037
4038 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4039
4040         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4041         filename.
4042
4043 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4044
4045         * icf.h (is_section_foldable_candidate): Change type of parameter
4046         to std::string.
4047         * icf.cc (Icf::find_identical_sections): Change type of local variable
4048         section_name to be std::string.
4049         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4050
4051 2011-01-25  Ian Lance Taylor  <iant@google.com>
4052
4053         * script.cc (script_add_extern): Rewrite to use
4054         add_symbol_reference.
4055
4056 2011-01-25  Doug Kwan  <dougkwan@google.com>
4057
4058         * icf.cc (get_section_contents): Always lock section's object.
4059
4060 2011-01-24  Ian Lance Taylor  <iant@google.com>
4061
4062         * options.h (class General_options): Accept
4063         --no-detect-odr-violations.
4064
4065 2011-01-24  Ian Lance Taylor  <iant@google.com>
4066
4067         * version.cc (version_string): Bump to 1.11.
4068
4069 2011-01-24  Ian Lance Taylor  <iant@google.com>
4070
4071         * plugin.cc (class Plugin_rescan): Define new class.
4072         (Plugin_manager::claim_file): Set any_claimed_.
4073         (Plugin_manager::save_archive): New function.
4074         (Plugin_manager::save_input_group): New function.
4075         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4076         necessary.
4077         (Plugin_manager::new_undefined_symbol): New function.
4078         (Plugin_manager::rescan): New function.
4079         (Plugin_manager::rescannable_defines): New function.
4080         (Plugin_manager::add_input_file): Set any_added_.
4081         * plugin.h (class Plugin_manager): define new fields rescannable_,
4082         undefined_symbols_, any_claimed_, and any_added_.  Declare
4083         Plugin_rescan as friend.  Declare new functions.
4084         (Plugin_manager::Rescannable): Define type.
4085         (Plugin_manager::Rescannable_list): Define type.
4086         (Plugin_manager::Undefined_symbol_list): Define type.
4087         (Plugin_manager::Plugin_manager): Initialize new fields.
4088         * archive.cc (Archive::defines_symbol): New function.
4089         (Add_archive_symbols::run): Pass archive to plugins if any.
4090         * archive.h (class Archive): Declare defines_symbol.
4091         * readsyms.cc (Input_group::~Input_group): New function.
4092         (Finish_group::run): Pass input_group to plugins if any.
4093         * readsyms.h (class Input_group): Declare destructor.
4094         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4095         any.
4096
4097 2011-01-10  Ian Lance Taylor  <iant@google.com>
4098
4099         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4100         section as relro.
4101         (Layout::set_segment_offsets): Reset increase_relro before calling
4102         set_section_addresses a second time.
4103
4104 2011-01-04  Cary Coutant  <ccoutant@google.com>
4105
4106         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4107         sections before NOBITS sections.
4108
4109 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4110
4111         * version.cc (print_version): Update copyright to 2011.
4112
4113 2010-12-23  Cary Coutant  <ccoutant@google.com>
4114
4115         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4116         of OS to this->add.  Add OD parameter to second form of the function.
4117
4118 2010-12-20  Ian Lance Taylor  <iant@google.com>
4119
4120         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4121         second of two consecutive entries with same offset.
4122
4123 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4124
4125         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4126         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4127         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4128         to avoid unneeded links against $(LDADD).
4129         * testsuite/Makefile.in: Regenerate.
4130
4131 2010-12-15  Ian Lance Taylor  <iant@google.com>
4132
4133         PR gold/12324
4134         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4135         for R_X86_64_32 and R_X86_64_PC32.
4136         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4137         ver_matching_def_pic.o.
4138         (ver_matching_def_pic.o): New target.
4139
4140 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4141
4142         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4143         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4144         Move definition before File_read::View member definitions.
4145         (File_read::View::~View): Initialize and hold lock before
4146         updating current_mapped_bytes.
4147
4148 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4149
4150         * dwarf_reader.cc: Remove outdated comment.
4151         * gold-threads.cc: Fix typo in error message.
4152         * archive.cc: Fix typos in comments.
4153         * archive.h: Likewise.
4154         * arm-reloc-property.cc: Likewise.
4155         * arm-reloc-property.h: Likewise.
4156         * arm-reloc.def: Likewise.
4157         * arm.cc: Likewise.
4158         * attributes.h: Likewise.
4159         * cref.cc: Likewise.
4160         * ehframe.cc: Likewise.
4161         * fileread.h: Likewise.
4162         * gold.h: Likewise.
4163         * i386.cc: Likewise.
4164         * icf.cc: Likewise.
4165         * incremental.h: Likewise.
4166         * int_encoding.cc: Likewise.
4167         * layout.h: Likewise.
4168         * main.cc: Likewise.
4169         * merge.h: Likewise.
4170         * object.cc: Likewise.
4171         * object.h: Likewise.
4172         * options.cc: Likewise.
4173         * readsyms.cc: Likewise.
4174         * reduced_debug_output.cc: Likewise.
4175         * reloc.cc: Likewise.
4176         * script-sections.cc: Likewise.
4177         * sparc.cc: Likewise.
4178         * symtab.h: Likewise.
4179         * target-reloc.h: Likewise.
4180         * target.cc: Likewise.
4181         * target.h: Likewise.
4182         * timer.cc: Likewise.
4183         * timer.h: Likewise.
4184         * x86_64.cc: Likewise.
4185
4186 2010-12-09  Cary Coutant  <ccoutant@google.com>
4187
4188         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4189         stack.
4190         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4191         parameter; change all callers.
4192         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4193         * options.h (warn_execstack): New option.
4194
4195 2010-12-07  Doug Kwan  <dougkwan@google.com>
4196
4197         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4198         like function call relocations.
4199
4200 2010-12-07  Ian Lance Taylor  <iant@google.com>
4201
4202         * archive.cc (Archive::get_elf_object_for_member): Permit
4203         punconfigured to be NULL.
4204         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4205         (Archive::include_member): Pass NULL to get_elf_object_for_member
4206         if we searched for the archive and this is the first included
4207         object.
4208
4209 2010-12-01  Ian Lance Taylor  <iant@google.com>
4210
4211         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4212         track_relocs_type_ field.
4213         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4214         Set track_relocs_type_.
4215         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4216         contents when using RELA relocs.
4217         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4218         reloc_map_.
4219         * reloc.cc (Track_relocs::next_addend): New function.
4220         * reloc.h (class Track_relocs): Declare next_addend.
4221
4222 2010-12-01  Ian Lance Taylor  <iant@google.com>
4223
4224         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4225         virtual destructor.
4226
4227 2010-12-01  Ian Lance Taylor  <iant@google.com>
4228
4229         * README: Update compilers known to work and fail.
4230
4231 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4232
4233         * configure.in: For --enable-gold, handle value `default' instead of
4234         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4235         not the default.
4236         * configure: Regenerate.
4237
4238 2010-11-18  Doug Kwan  <dougkwan@google.com>
4239
4240         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4241         and right_alignment to be zero.  Store result alignment only if it is
4242         greater than existing alignment.
4243
4244 2010-11-16  Cary Coutant  <ccoutant@google.com>
4245
4246         PR gold/12220
4247         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4248         Check for ".zdebug_line".
4249
4250 2010-11-16  Doug Kwan  <dougkwan@google.com>
4251             Cary Coutant  <ccoutant@google.com>
4252
4253         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4254         by reference; adjust all callers.
4255         * output.cc (Output_segment::set_section_addresses): Adjust references
4256         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4257         list is empty.
4258         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4259         end at page boundary.
4260
4261 2010-11-16  Cary Coutant  <ccoutant@google.com>
4262
4263         PR gold/12220
4264         * layout.cc (Layout::choose_output_section): Transform names of
4265         compressed sections even when using a script with a SECTIONS clause.
4266         (Layout::output_section_name): Remove code to transform
4267         compressed debug section names.
4268         * output.cc (Output_section::add_input_section): Use uncompressed
4269         section size when tracking input sections.
4270
4271 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4272
4273         * symtab.h (Symbol::NON_PIC_REF): Remove.
4274         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4275         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4276         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4277         (Symbol::use_plt_offset): Take a flags argument and pass it
4278         directly to needs_dynamic_reloc.  Restrict check for undefined
4279         weak symbols to function calls.
4280         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4281         (Target_arm::Scan::global): Use it.
4282         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4283         (Target_arm::Relocate::relocate): Likewise.
4284         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4285         parameter with an r_type parameter.  Use get_reference_flags
4286         to get the flags.
4287         (Target_arm::Relocate::relocate): Update accordingly.
4288         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4289         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4290         (Target_i386::Scan::global): Likewise.
4291         (Target_i386::Relocate::relocate): Likewise.
4292         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4293         parameter with an r_type parameter.  Use get_reference_flags
4294         to get the flags.
4295         (Target_i386::Relocate::relocate): Update accordingly.
4296         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4297         (Target_powerpc::Scan::global): Use it.
4298         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4299         (Target_powerpc::Relocate::relocate): Likewise.
4300         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4301         (Target_sparc::Scan::global): Use it.
4302         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4303         (Target_sparc::Relocate::relocate): Likewise.
4304         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4305         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4306         (Target_x86_64::Scan::global): Likewise.
4307         (Target_x86_64::Relocate::relocate): Likewise.
4308
4309 2010-11-08  Doug Kwan  <dougkwan@google.com>
4310             Cary Coutant  <ccoutant@google.com>
4311
4312         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4313         (Arm_exidx_merge_section::section_contents_): New data member.
4314         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4315         (Arm_input_section::~Arm_input_section): De-allocate memory.
4316         (Arm_input_section::original_contents_): New data member.
4317         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4318         in parameters instead of calling Object::section_contents without
4319         locking.
4320         (Arm_output_section::group_section): New parameter TASK.  Pass it
4321         to callees that need locking objects.
4322         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4323         to lock EXIDX input sections.  Fix a formatting issue.  Call
4324         Arm_exidx_merged_section::build_contents to create merged section
4325         contents.
4326         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4327         to lock object of stub table owner.
4328         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4329         TEXT_SIZE to initialize data member TEXT_SIZE_.
4330         (Arm_exidx_input_section::addralign): Fix typo in comment.
4331         (Arm_exidx_input_section::text_size): New method.
4332         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4333         that require locking objects.  Lock objects before scanning for stubs
4334         and updating local symbols.
4335         (Arm_input_section<big_endian>::init): Copy contents of original
4336         input section.
4337         (Arm_input_section<big_endian>::do_write): Use saved contents of
4338         original input section instead of calling Object::section_contents
4339         without locking.
4340         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4341         size without calling Object::section_size().
4342         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4343         for size.  Allocate a buffer for merged EXIDX entries.
4344         (Arm_exidx_merged_section::build_contents): New method.
4345         (Arm_exidx_merged_section::do_write): Move merge section contents
4346         building code to Arm_exidx_merged_section::build_contetns.  Write
4347         out contetns in buffer instead of building it on the fly.
4348         (Arm_relobj::make_exidx_input_section): Also pass text section size
4349         to Arm_exidx_input_section constructor.
4350         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4351         (Arm_dynobj::do_read_symbols): Fix memory leak.
4352         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4353         * target.h: (class Task): Add forward declaration.
4354         (Target::relax): Add new parameter TASK and pass it to
4355         Target::do_relax().
4356         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4357
4358 2010-11-05  Cary Coutant  <ccoutant@google.com>
4359
4360         PR gold/10708
4361         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4362         object when reading from the file.
4363         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4364         second layout pass.
4365         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4366         when reading section contents.
4367         (get_section_contents): Likewise.
4368         (icf::find_identical_sections): Likewise.
4369         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4370         object when reading from the file.
4371         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4372         the object when doing deferred section layout.
4373
4374 2010-11-03  Nick Clifton  <nickc@redhat.com>
4375
4376         PR gold/12001
4377         * script.h (class Symbol_assignment: name): New member.  Returns
4378         the name of the symbol.
4379         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4380         Returns true if the given symbol name is on the list of
4381         assignments wating to be processed.
4382         * archive.cc (should_incldue_member): If the symbol is undefined,
4383         check to see if it is on the list of symbols pending assignment.
4384
4385 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4386
4387         * script-sections.cc (Script_sections::find_memory_region): Check
4388         for a NULL output section pointer.
4389
4390 2010-10-29  Doug Kwan  <dougkwan@google.com>
4391
4392         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4393         Output_section::add_relaxed_input_section.
4394         * output.cc (Output_section::add_relaxed_input_section): Add new
4395         arguments LAYOUT and NAME.  Set section order index.
4396         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4397         Copy section order index.
4398         * output.h (Output_section::add_relaxed_input_section): Add new
4399         arguments LAYOUT and NAME.
4400
4401 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4402
4403         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4404         NATIVE_OR_CROSS_LINKER.
4405         * testsuite/Makefile.in: Regenerate.
4406
4407 2010-10-20  Doug Kwan  <dougkwan@google.com>
4408
4409         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4410         without SHF_LINK_ORDER flags.
4411         * layout.cc (Layout::choose_output_section): Do not filter
4412         SHF_LINK_ORDER flag in a relocatable link.
4413
4414 2010-10-17  Cary Coutant  <ccoutant@google.com>
4415
4416         * output.h (Output_segment::set_section_addresses): Change function
4417         signature.  Update all callers.
4418         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4419         sections.
4420         (Output_segment::set_section_addresses): Align after last TLS
4421         section.  Add padding before last relro section instead of after.
4422
4423 2010-10-17  Doug Kwan  <dougkwan@google.com>
4424
4425         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4426         GOT output section to be writable.
4427
4428 2010-10-14  Cary Coutant  <ccoutant@google.com>
4429
4430         * debug.h (DEBUG_INCREMENTAL): New flag.
4431         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4432         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4433         mode.
4434         * incremental.cc (report_command_line): Ignore all forms of
4435         --incremental.
4436         * layout.cc (Layout::Layout): Check parameters for incremental link
4437         mode.
4438         * options.cc (General_options::parse_incremental): New function.
4439         (General_options::parse_no_incremental): New function.
4440         (General_options::parse_incremental_full): New function.
4441         (General_options::parse_incremental_update): New function.
4442         (General_options::incremental_mode_): New data member.
4443         (General_options::finalize): Check incremental_mode_.
4444         * options.h (General_options): Update help text for --incremental.
4445         Add --no-incremental, --incremental-full, --incremental-update.
4446         (General_options::Incremental_mode): New enum type.
4447         (General_options::incremental_mode): New function.
4448         (General_options::incremental_mode_): New data member.
4449         * parameters.cc (Parameters::incremental_mode_): New data member.
4450         (Parameters::set_options): Set incremental_mode_.
4451         (Parameters::set_incremental_full): New function.
4452         (Parameters::incremental): New function.
4453         (Parameters::incremental_update): New function.
4454         (set_parameters_incremental_full): New function.
4455         * parameters.h (Parameters::set_incremental_full): New function.
4456         (Parameters::incremental): New function.
4457         (Parameters::incremental_update): New function.
4458         (Parameters::incremental_mode_): New data member.
4459         (set_parameters_incremental_full): New function.
4460         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4461         incremental link mode.
4462         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4463         (Sized_relobj::do_relocate_sections): Likewise.
4464         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4465         option.
4466         * testsuite/Makefile.in: Regenerate.
4467         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4468
4469 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4470
4471         * script-sections.h (class Script_sections): Make
4472         Sections_elements typedef public.
4473         * script-sections.cc (class Sort_output_sections): Add elements_
4474         field.  Add constructor which sets it; change all callers.
4475         (Sort_output_sections::is_before): New function.
4476         (Sort_output_sections::operator()): Call is_before.
4477         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4478         conditional.
4479         * testsuite/script_test_10.sh: New test. Test script section
4480         order.
4481         * testsuite/script_test_10.t: Likewise.
4482         * testsuite/script_test_10.s: Likewise.
4483         * testsuite/Makefile.am: Wrap the cross linker tests and the
4484         common tests into NATIVE_OR_CROSS_LINKER.
4485         (check_SCRIPTS): Add script_test_10.sh.
4486         (check_DATA): Add script_test_10.stdout.
4487         (script_test_10.o, script_test_10): New targets.
4488         (script_test_10.stdout): New target.
4489         * configure, testsuite/Makefile.in: Regenerate.
4490
4491 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4492
4493         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4494         error for the deprecated relocations.
4495         (Target_arm::Scan::global): Likewise.
4496         (Target_arm::Relocate::relocate): Likewise.
4497
4498 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4499
4500         * fileread.cc (Input_file::find_file): Initialize *found_name
4501         and *namep when using the fallback search for case 4.
4502
4503 2010-10-11  Cary Coutant  <ccoutant@google.com>
4504
4505         * options.h (class General_options): Redefine -z lazy as an alias for
4506         the negation of -z now.
4507
4508 2010-10-11  Ian Lance Taylor  <iant@google.com>
4509
4510         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4511         binding.
4512
4513 2010-10-06  Nick Clifton  <nickc@redhat.com>
4514
4515         * script-sections.cc(class Memory_region): Remove
4516         current_lma_offset_ field.  Rename current_vma_offset_ to
4517         current_offset_.  Add last_section_ field.
4518         (Memory_region::get_current_vma_address): Rename to
4519         get_current_address.
4520         (Memory_region::get_current_lma_address): Delete.
4521         (Memory_region::increment_vma_offset): Rename to
4522         increment_offset.
4523         (Memory_region::increment_lma_offset): Delete.
4524         (Memory_region::attributes_compatible): New method.  Returns
4525         true if the provided section is compatible with the region.
4526         (Memory_region::get_last_section): New method.  Returns the last
4527         section to use the region.
4528         (Memory_region::set_last_section): New method.  Stores the last
4529         section to use the region.
4530         (Script_sections::block_in_region): New method.  Returns true if
4531         a block of memory is contained within a region.
4532         (Script_sections::find_memory_region): New method.  Locates a
4533         memory region to be used to set a VMA or LMA address.
4534         (Output_section_definition::set_section_addresses): Add code to
4535         check for addresses set by memory regions.
4536         (Output_segment::set_section_addresses): Remove memory region
4537         walking code.
4538         (Script_sections::create_segment): Add a warning if a header
4539         segment is created outside of any region.
4540         * script-sections.h (class Script_sections): Add prototypes for
4541         find_memory_region and block_in_region methods.
4542         * testsuite/memory_test.s: Use .long instead of .word.
4543         * testsuite/memory_test.t: Add some more output sections.
4544         * testsuite/memory_test.sh: Update expected output.
4545
4546 2010-10-02  Doug Kwan  <dougkwan@google.com>
4547
4548         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4549         defintion to symtab.h
4550         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4551         declaration to defintion.
4552
4553 2010-10-01  Nick Clifton  <nickc@redhat.com>
4554
4555         * expression.cc (eval): Replace dummy argument with NULL.
4556         (eval_maybe_dot): Check for a NULL result section pointer.
4557         (Symbol_expression::value): Likewise.
4558         (Dot_expression::value): Likewise.
4559         (BINARY_EXPRESSION): Likewise.
4560         (Max_expression::value): Likewise.
4561         (Min_expression::value): Likewise.
4562         (Absolute_expression::value): Likewise.
4563         (Addr_expression::value_from_output_section): Likewise.
4564         (Loaddddr_expression::value_from_output_section): Likewise.
4565         (Segment_start_expression::value): Likewise.
4566         * script-sections.cc
4567         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4568         argument with NULL.
4569         (Sections_elememt_dot_assignment::set_section_addresses):
4570         Likewise.
4571         (Output_data_expression::do_write_to_buffer): Likewise.
4572         (Output_section_definition::finalize_symbols): Likewise.
4573         (Output_section_definition::set_section_addresses): Likewise.
4574
4575 2010-09-30  Doug Kwan  <dougkwan@google.com>
4576
4577         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4578
4579 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4580
4581         * target.h (Target::can_icf_inline_merge_sections): New virtual
4582         function.
4583         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4584         virtual function.
4585         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4586         virtual function.
4587         * icf.cc (get_section_contents): Inline merge sections only when
4588         target allows it.
4589
4590 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4591
4592         * configure: Regenerate.
4593
4594 2010-09-17  Ian Lance Taylor  <iant@google.com>
4595
4596         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4597         * testsuite/Makefile.am (memory_test.o): New target.
4598         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4599         memory_test.t.
4600         * testsuite/Makefile.in: Rebuild.
4601
4602 2010-09-17  Doug Kwan  <dougkwan@google.com>
4603
4604         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4605         defintion if relocation uses GOT entries of the symbol.
4606         * testsuite/icf_safe_test.sh: Fix test.
4607         * testsuite/icf_safe_so_test.sh: Fix test.
4608
4609 2010-09-16  Cary Coutant  <ccoutant@google.com>
4610
4611         * script_sections.cc (class Memory_region): Remove "NULL" from
4612         vector initializations.
4613
4614 2010-09-15  Cary Coutant  <ccoutant@google.com>
4615
4616         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4617         Resolve forwarding symbols.
4618
4619 2010-09-15  Doug Kwan  <dougkwan@google.com>
4620
4621         * gold/testsuite/script_test_3.t: Add ARM special sections.
4622         * gold/testsuite/script_test_4.t: Same.
4623         * gold/testsuite/script_test_5.t: Same.
4624         * gold/testsuite/script_test_6.t: Same.
4625         * gold/testsuite/script_test_7.t: Same.
4626         * gold/testsuite/script_test_7.t: Same.
4627         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4628
4629 2010-09-14  Cary Coutant  <ccoutant@google.com>
4630
4631         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4632         (Target_x86_64::Relocate::relocate_tls): Replace check for
4633         saw_tls_block_reloc_ with test for executable section.
4634
4635 2010-09-12  Cary Coutant  <ccoutant@google.com>
4636
4637         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4638         position-independent executables to shared libraries need dynamic
4639         relocations.
4640         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4641         position-independent executables.
4642         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4643         * testsuite/Makefile.in: Regenerate.
4644
4645 2010-09-10  Nick Clifton  <nickc@redhat.com>
4646
4647         PR gold/11997
4648         * testsuite/memory_test.t: Discard any sections that are not
4649         needed.
4650
4651 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4652
4653         PR gold/11996
4654         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4655         "This::" to work around a bug in gcc 4.2.
4656
4657         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4658
4659 2010-09-09  Rafael Espindola  <espindola@google.com>
4660
4661         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4662         sections with different PF_X flags in the same segment.
4663         (Layout::find_first_load_seg): Search all segments to find the first
4664         one.
4665         * options.h (rosegment): New.
4666
4667 2010-09-08  Rafael Espindola  <espindola@google.com>
4668
4669         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4670
4671 2010-09-08  Doug Kwan  <dougkwan@google.com>
4672
4673         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4674         (Arm_relobj::do_relocate_sections): Add new parameter for output
4675         file to match the parent.
4676         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4677         of local symbols instead of input values.  Update code to track
4678         changes in gold::relocate_section.
4679         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4680         (Sized_relobj::compute_final_local_value_internal): New methods.
4681         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4682         body into private version of Sized_relobj::compute_final_local_value.
4683         Call the inline method.
4684         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4685         merged symbol value if there is one.
4686         (Symbol_value::has_output_value): New method defintiion.
4687         (Sized_relobj::Compute_final_local_value_status): New enum type.
4688         (Sized_relobj::compute_final_local_value): New methods.
4689         (Sized_relobj::compute_final_local_value_internal): New methods.
4690         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4691         and arm_cortex_a8.sh.
4692         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4693         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4694         New tests.
4695         * Makefile.in: Regenerate.
4696         * testsuite/arm_bl_out_of_range.s: Update test.
4697         * testsuite/thumb_bl_out_of_range.s: Ditto.
4698         * testsuite/thumb_blx_out_of_range.s: Ditto.
4699         * testsuite/arm_branch_out_of_range.sh: New file.
4700         * testsuite/arm_cortex_a8.sh: Ditto.
4701         * testsuite/arm_cortex_a8_b.s: Ditto.
4702         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4703         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4704         * testsuite/arm_cortex_a8_bl.s: Ditto.
4705         * testsuite/arm_cortex_a8_blx.s: Ditto.
4706         * testsuite/arm_cortex_a8_local.s: Ditto.
4707         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4708         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4709
4710 2010-09-08  Rafael Espindola  <espindola@google.com>
4711
4712         * Makefile.am (memory_test.stdout): Run readelf with -W.
4713         * Makefile.in: Regenerate.
4714         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4715         64 bit output.
4716
4717 2010-09-08  Rafael Espindola  <espindola@google.com>
4718
4719         * script-sections.cc (Script_sections::add_memory_region): Convert
4720         field precision to int.
4721         * script.cc (script_set_section_region, script_set_section_region):
4722         Convert field precision to int.
4723
4724 2010-09-08  Rafael Espindola  <espindola@google.com>
4725
4726         * arm.cc (do_finalize_sections): Create the __exidx_start and
4727         __exdix_end symbols even when the section is missing.
4728
4729 2010-09-08  Nick Clifton  <nickc@redhat.com>
4730
4731         * README: Remove claim that MEMORY is not supported.
4732         * expression.cc (script_exp_function_origin)
4733         (script_exp_function_length): Move from here to ...
4734         * script.cc: ... here.
4735         (script_set_section_region, script_add_memory)
4736         (script_parse_memory_attr, script_include_directive): New
4737         functions.
4738         * script-sections.cc
4739         (class Memory_region): New class.
4740         (class Output_section_definition): Add set_memory_region,
4741         set_section_vma, set_section_lma and get_section_name methods.
4742         (class Script_Sections): Add add_memory_region,
4743         find_memory_region, find_memory_region_origin,
4744         find_memory_region_length and set_memory_region methods.
4745         Have set_section_addresses method walk the list of set memory
4746         regions.
4747         Extend the print methos to display memory regions.
4748         * script-sections.h: Add prototypes for new methods.
4749         Add enum for MEMORY region attributes.
4750         * yyscript.y: Add support for parsing MEMORY regions.
4751         * script-c.h: Add prototypes for new functions.
4752         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4753         * testsuite/Makefile.in: Regenerate.
4754         * testsuite/memory_test.sh: New script.
4755         * testsuite/memory_test.s: New assembler source file.
4756         * testsuite/memory_test.t: New linker script.
4757
4758 2010-08-27  Doug Kwan  <dougkwan@google.com>
4759
4760         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4761         reference override an existing dynamic weak reference.
4762         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4763         * testsuite/Makefile.in: Regenerate.
4764         * testsuite/dyn_weak_ref.sh: New file.
4765         * testsuite/dyn_weak_ref_1.c: Ditto.
4766         * testsuite/dyn_weak_ref_2.c: Ditto.
4767
4768 2010-08-27  Ian Lance Taylor  <iant@google.com>
4769
4770         * incremental.h (class Incremental_input_entry): Add virtual
4771         destructor.
4772
4773 2010-08-27  Ian Lance Taylor  <iant@google.com>
4774
4775         * testsuite/start_lib_test_3.c: Mark t3 as used.
4776
4777 2010-08-27  Nick Clifton  <nickc@redhat.com>
4778
4779         * options.cc (version_script): Fix small typo in previous
4780         whitespace tidyup.
4781
4782 2010-08-25  Nick Clifton  <nickc@redhat.com>
4783
4784         * archive.cc: Formatting fixes: Remove whitespace between
4785         typename and following asterisk.  Remove whitespace between
4786         function name and opening parenthesis.
4787         * archive.h: Likewise.
4788         * arm.cc: Likewise.
4789         * attributes.cc: Likewise.
4790         * attributes.h: Likewise.
4791         * common.cc: Likewise.
4792         * copy-relocs.cc: Likewise.
4793         * dirsearch.h: Likewise.
4794         * dynobj.cc: Likewise.
4795         * ehframe.cc: Likewise.
4796         * ehframe.h: Likewise.
4797         * expression.cc: Likewise.
4798         * fileread.cc: Likewise.
4799         * fileread.h: Likewise.
4800         * gc.h: Likewise.
4801         * gold-threads.cc: Likewise.
4802         * gold.cc: Likewise.
4803         * i386.cc: Likewise.
4804         * icf.h: Likewise.
4805         * incremental-dump.cc: Likewise.
4806         * incremental.cc: Likewise.
4807         * layout.cc: Likewise.
4808         * layout.h: Likewise.
4809         * main.cc: Likewise.
4810         * merge.cc: Likewise.
4811         * merge.h: Likewise.
4812         * object.cc: Likewise.
4813         * object.h: Likewise.
4814         * options.cc: Likewise.
4815         * options.h: Likewise.
4816         * output.cc: Likewise.
4817         * output.h: Likewise.
4818         * plugin.cc: Likewise.
4819         * plugin.h: Likewise.
4820         * powerpc.cc: Likewise.
4821         * reloc.cc: Likewise.
4822         * script-c.h: Likewise.
4823         * script-sections.cc: Likewise.
4824         * script.cc: Likewise.
4825         * stringpool.cc: Likewise.
4826         * symtab.cc: Likewise.
4827         * symtab.h: Likewise.
4828         * target.cc: Likewise.
4829         * timer.cc: Likewise.
4830         * timer.h: Likewise.
4831         * version.cc: Likewise.
4832         * x86_64.cc: Likewise.
4833
4834 2010-08-24  Nick Clifton  <nickc@redhat.com>
4835
4836         PR 11899
4837         * layout.cc (segment_precedes): Sort segments by their physical
4838         addresses, if they have been set.
4839
4840 2010-08-23  Cary Coutant  <ccoutant@google.com>
4841
4842         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4843         symbols data.
4844         (Lib_group::include_member): Unlock object after deleting its
4845         symbols data.
4846         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4847         the bug fixed here.
4848
4849 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4850             Cary Coutant  <ccoutant@google.com>
4851
4852         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4853         constructor, and set_blocker.
4854         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4855         readsyms_blocker_.
4856         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4857         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4858         * testsuite/Makefile.am (start_lib_test): New test case.
4859         * testsuite/Makefile.in: Regenerate.
4860         * testsuite/start_lib_test_main.c: New file.
4861         * testsuite/start_lib_test_1.c: New file.
4862         * testsuite/start_lib_test_2.c: New file.
4863         * testsuite/start_lib_test_3.c: New file.
4864
4865 2010-08-19  Ian Lance Taylor  <iant@google.com>
4866
4867         * Makefile.in: Rebuild with automake 1.11.1.
4868         * aclocal.m4: Likewise.
4869         * testsuite/Makefile.in: Likewise.
4870
4871 2010-08-19  Ian Lance Taylor  <iant@google.com>
4872
4873         PR 10893
4874         * i386.cc (class Output_data_plt_i386): Update declarations.
4875         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4876         local_ifuncs_ fields.
4877         (Target_i386::do_plt_section_for_global): New function.
4878         (Target_i386::do_plt_section_for_local): New function.
4879         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4880         parameter; change all callers.  Initialize global_ifuncs_ and
4881         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4882         __rel_iplt_end.
4883         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4884         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4885         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4886         symbols.
4887         (Target_i386::make_plt_section): New function, broken out of
4888         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4889         (Target_i386::make_plt_entry): Call make_plt_section.
4890         (Target_i386::make_local_ifunc_plt_entry): New function.
4891         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4892         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4893         R_386_IRELATIVE to switch.
4894         (Target_i386::Scan::global): Likewise.
4895         (Target_i386::Relocate::relocate): Likewise.
4896         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4897         switch.
4898         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4899         (Target_x86_64::do_plt_section_for_global): New function.
4900         (Target_x86_64::do_plt_section_for_local): New function.
4901         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4902         parameter; change all callers.  If doing a static link define
4903         __rela_iplt_start and __rela_iplt_end.
4904         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4905         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4906         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4907         to point to .plt.
4908         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4909         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4910         switch.
4911         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4912         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4913         R_X86_64_IRELATIVE to switch.
4914         (Target_x86_64::Scan::global): Likewise.
4915         (Target_x86_64::Relocate::relocate): Likewise.
4916         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4917         switch.
4918         * target.h (class Target): Add plt_section_for_global and
4919         plt_section_for_local functions.  Add do_plt_section_for_global
4920         and do_plt_section_for_local virtual functions.
4921         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4922         clarifying comments.
4923         (Symbol::use_plt_offset): Handle IFUNC symbol.
4924         * object.cc (Sized_relobj::Sized_relobj): Initialize
4925         local_plt_offsets_.
4926         (Sized_relobj::local_has_plt_offset): New function.
4927         (Sized_relobj::local_plt_offset): New function.
4928         (Sized_relobj::set_local_plt_offset): New function.
4929         (Sized_relobj::do_count): Handle IFUNC symbol.
4930         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4931         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4932         is_ifunc_symbol functions.
4933         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4934         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4935         local_plt_offsets_ field.
4936         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4937         * output.h (class Output_section_data): Add non-const
4938         output_section function.
4939         (class Output_data_got): Update declarations.
4940         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4941         Add use_plt_offset parameter to global and local constructors.
4942         Change all callers.  Change local_sym_index_ field to 31 bits.
4943         Change GSYM_CODE and CONSTANT_CODE accordingly.
4944         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4945         doing a static link don't set sh_link field.
4946         (Output_data_got::Got_entry::write): Use PLT offset if
4947         appropriate.
4948         (Output_data_got::add_global_plt): New function.
4949         (Output_data_got::add_local_plt): New function.
4950         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4951         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4952         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4953         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4954         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4955         IFUNC conditional.
4956         * testsuite/ifunc-sel.h: New file.
4957         * testsuite/ifuncmain1.c: New file.
4958         * testsuite/ifuncmain1vis.c: New file.
4959         * testsuite/ifuncmod1.c: New file.
4960         * testsuite/ifuncdep2.c: New file.
4961         * testsuite/ifuncmain2.c: New file.
4962         * testsuite/ifuncmain3.c: New file.
4963         * testsuite/ifuncmod3.c: New file.
4964         * testsuite/ifuncmain4.c: New file.
4965         * testsuite/ifuncmain5.c: New file.
4966         * testsuite/ifuncmod5.c: New file.
4967         * testsuite/ifuncmain6pie.c: New file.
4968         * testsuite/ifuncmod6.c: New file.
4969         * testsuite/ifuncmain7.c: New file.
4970         * configure, testsuite/Makefile.in: Rebuild.
4971
4972 2010-08-18  Ian Lance Taylor  <iant@google.com>
4973
4974         * incremental.cc
4975         (Output_section_incremental_inputs::write_input_files): Add cast
4976         to avoid signed/unsigned comparison warning.
4977         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4978
4979 2010-08-12  Cary Coutant  <ccoutant@google.com>
4980
4981         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4982
4983 2010-08-13  Ian Lance Taylor  <iant@google.com>
4984
4985         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4986
4987 2010-08-12  Cary Coutant  <ccoutant@google.com>
4988             Doug Kwan  <dougkwan@google.com>
4989
4990         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4991         defintion overrides non-weak undef, remember that the original undef
4992         is not weak.
4993         * symtab.cc (Symbol_table::sized_write_global): For undef without
4994         an original weak binding, set binding to global in output.
4995         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4996         * testsuite/Makefile.in: Regenerate.
4997         * testsuite/strong_ref_weak_def.sh: New file.
4998         * testsuite/strong_ref_weak_def_1.c: Ditto.
4999         * testsuite/strong_ref_weak_def_2.c: Ditto.
5000
5001 2010-08-12  Cary Coutant  <ccoutant@google.com>
5002
5003         * testsuite/incremental_test.sh: Rewrite.
5004         * testsuite/incremental_test_1.c: Rewrite.
5005         * testsuite/incremental_test_2.c: Rewrite.
5006
5007 2010-08-12  Cary Coutant  <ccoutant@google.com>
5008
5009         * arm.cc (Target_arm::got_size): Add const.
5010         (Target_arm::got_entry_count): New function.
5011         (Target_arm::plt_entry_count): New function.
5012         (Target_arm::first_plt_entry_offset): New function.
5013         (Target_arm::plt_entry_size): New function.
5014         (Output_data_plt_arm::entry_count): New function.
5015         (Output_data_plt_arm::first_plt_entry_offset): New function.
5016         (Output_data_plt_arm::get_plt_entry_size): New function.
5017         * i386.cc (Target_i386::got_size): Add const.
5018         (Target_i386::got_entry_count): New function.
5019         (Target_i386::plt_entry_count): New function.
5020         (Target_i386::first_plt_entry_offset): New function.
5021         (Target_i386::plt_entry_size): New function.
5022         (Output_data_plt_i386::entry_count): New function.
5023         (Output_data_plt_i386::first_plt_entry_offset): New function.
5024         (Output_data_plt_i386::get_plt_entry_size): New function.
5025         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5026         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5027         * incremental.cc: Include target.h.
5028         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5029         parameter.  Adjust all callers.  Find incremental_got_plt section.
5030         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5031         section.
5032         (Output_section_incremental_inputs::set_final_data_size): Calculate
5033         size of incremental_got_plt section.
5034         (Output_section_incremental_inputs::do_write): Write the
5035         incremental_got_plt section.
5036         (Got_plt_view_info): New struct.
5037         (Local_got_offset_visitor): New class.
5038         (Global_got_offset_visitor): New class.
5039         (Global_symbol_visitor_got_plt): New class.
5040         (Output_section_incremental_inputs::write_got_plt): New function.
5041         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5042         Add parameter.  Adjust all callers.
5043         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5044         (Incremental_inputs::got_plt_section): New function.
5045         (Incremental_inputs::got_plt_section_): New data member.
5046         (Incremental_got_plt_reader): New class.
5047         * layout.cc (Layout::create_incremental_info_sections): Add the
5048         incremental_got_plt section.
5049         * object.h (Got_offset_list::get_list): New function.
5050         (Got offset_list::for_all_got_offsets): New function.
5051         (Sized_relobj::local_got_offset_list): New function.
5052         * powerpc.cc (Target_powerpc::got_size): Add const.
5053         (Target_powerpc::got_entry_count): New function.
5054         (Target_powerpc::plt_entry_count): New function.
5055         (Target_powerpc::first_plt_entry_offset): New function.
5056         (Target_powerpc::plt_entry_size): New function.
5057         (Output_data_plt_powerpc::entry_count): New function.
5058         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5059         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5060         * sparc.cc (Target_sparc::got_size): Add const.
5061         (Target_sparc::got_entry_count): New function.
5062         (Target_sparc::plt_entry_count): New function.
5063         (Target_sparc::first_plt_entry_offset): New function.
5064         (Target_sparc::plt_entry_size): New function.
5065         (Output_data_plt_sparc::entry_count): New function.
5066         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5067         (Output_data_plt_sparc::get_plt_entry_size): New function.
5068         * symtab.h (Symbol::got_offset_list): New function.
5069         (Symbol_table::for_all_symbols): New function.
5070         * target.h (Sized_target::got_entry_count): New function.
5071         (Sized_target::plt_entry_count): New function.
5072         (Sized_target::plt_entry_size): New function.
5073         * x86_64.cc (Target_x86_64::got_size): Add const.
5074         (Target_x86_64::got_entry_count): New function.
5075         (Target_x86_64::plt_entry_count): New function.
5076         (Target_x86_64::first_plt_entry_offset): New function.
5077         (Target_x86_64::plt_entry_size): New function.
5078         (Output_data_plt_x86_64::entry_count): New function.
5079         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5080         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5081
5082 2010-08-12  Cary Coutant  <ccoutant@google.com>
5083
5084         * archive.cc: Include incremental.h.
5085         (Archive::Archive): Initialize incremental_info_.
5086         (Archive::include_member): Record archive members in incremental info.
5087         (Add_archive_symbols::run): Record begin and end of an archive in
5088         incremental info.
5089         (Lib_group::include_member): Record objects in incremental info.
5090         * archive.h (Incremental_archive_entry): Forward declaration.
5091         (Archive::set_incremental_info): New member function.
5092         (Archive::incremental_info): New member function.
5093         (Archive::Unused_symbol_iterator): New class.
5094         (Archive::unused_symbols_begin): New member function.
5095         (Archive::unused_symbols_end): New member function.
5096         (Archive::incremental_info_): New data member.
5097         * incremental-dump.cc (find_input_containing_global): New function.
5098         (dump_incremental_inputs): Dump new incremental info sections.
5099         * incremental.cc: Include symtab.h.
5100         (Output_section_incremental_inputs): New class.
5101         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5102         new incremental info sections.
5103         (Sized_incremental_binary::do_check_inputs): Likewise.
5104         (Incremental_inputs::report_archive): Remove.
5105         (Incremental_inputs::report_archive_begin): New function.
5106         (Incremental_inputs::report_archive_end): New function.
5107         (Incremental_inputs::report_object): New function.
5108         (Incremental_inputs::finalize_inputs): Remove.
5109         (Incremental_inputs::report_input_section): New function.
5110         (Incremental_inputs::report_script): Rewrite.
5111         (Incremental_inputs::finalize): Do nothing but finalize string table.
5112         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5113         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5114         (Incremental_inputs::create_data_sections): New function.
5115         (Incremental_inputs::relocs_entsize): New function.
5116         (Output_section_incremental_inputs::set_final_data_size): New function.
5117         (Output_section_incremental_inputs::do_write): New function.
5118         (Output_section_incremental_inputs::write_header): New function.
5119         (Output_section_incremental_inputs::write_input_files): New function.
5120         (Output_section_incremental_inputs::write_info_blocks): New function.
5121         (Output_section_incremental_inputs::write_symtab): New function.
5122         * incremental.h (Incremental_script_entry): Forward declaration.
5123         (Incremental_object_entry): Forward declaration.
5124         (Incremental_archive_entry): Forward declaration.
5125         (Incremental_inputs): Forward declaration.
5126         (Incremental_inputs_header_data): Remove.
5127         (Incremental_inputs_header): Remove.
5128         (Incremental_inputs_header_write): Remove.
5129         (Incremental_inputs_entry_data): Remove.
5130         (Incremental_inputs_entry): Remove.
5131         (Incremental_inputs_entry_write): Remove.
5132         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5133         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5134         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5135         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5136         Likewise.
5137         (Incremental_input_entry): New class.
5138         (Incremental_script_entry): New class.
5139         (Incremental_object_entry): New class.
5140         (Incremental_archive_entry): New class.
5141         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5142         (Incremental_inputs::report_inputs): Remove.
5143         (Incremental_inputs::report_archive): Remove.
5144         (Incremental_inputs::report_archive_begin): New function.
5145         (Incremental_inputs::report_archive_end): New function.
5146         (Incremental_inputs::report_object): Change prototype.
5147         (Incremental_inputs::report_input_section): New function.
5148         (Incremental_inputs::report_script): Change prototype.
5149         (Incremental_inputs::get_reloc_count): New function.
5150         (Incremental_inputs::set_reloc_count): New function.
5151         (Incremental_inputs::create_data_sections): New function.
5152         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5153         (Incremental_inputs::inputs_section): New function.
5154         (Incremental_inputs::symtab_section): New function.
5155         (Incremental_inputs::relocs_section): New function.
5156         (Incremental_inputs::get_stringpool): Add const.
5157         (Incremental_inputs::command_line): Add const.
5158         (Incremental_inputs::inputs): Remove.
5159         (Incremental_inputs::command_line_key): New function.
5160         (Incremental_inputs::input_file_count): New function.
5161         (Incremental_inputs::input_files): New function.
5162         (Incremental_inputs::relocs_entsize): New function.
5163         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5164         (Incremental_inputs::finalize_inputs): Remove.
5165         (Incremental_inputs::Input_info): Remove.
5166         (Incremental_inputs::lock_): Remove.
5167         (Incremental_inputs::inputs_): Change type.
5168         (Incremental_inputs::inputs_map_): Remove.
5169         (Incremental_inputs::current_object_entry_): New data member.
5170         (Incremental_inputs::inputs_section_): New data member.
5171         (Incremental_inputs::symtab_section_): New data member.
5172         (Incremental_inputs::relocs_section_): New data member.
5173         (Incremental_inputs::reloc_count_): New data member.
5174         (Incremental_inputs_reader): New class.
5175         (Incremental_symtab_reader): New class.
5176         (Incremental_relocs_reader): New class.
5177         * layout.cc (Layout::finalize): Move finalization of incremental info
5178         and creation of incremental info sections to follow finalization of
5179         symbol table.  Set offsets for postprocessing sections.
5180         (Layout::create_incremental_info_sections): Call
5181         Incremental_inputs::create_data_sections.  Add incremental symtab
5182         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5183         sections to layout after input sections.
5184         * layout.h (struct Timespec): Forward declaration.
5185         (Layout::incremental_inputs): Add const.
5186         (Layout::create_incremental_info_sections): Add parameter.
5187         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5188         * object.cc: Include incremental.h.
5189         (Relobj::finalize_incremental_relocs): New function.
5190         (Sized_relobj::do_layout): Record input sections in incremental info.
5191         * object.h (Object::output_section): New function.
5192         (Object::output_section_offset): Moved from Relobj.
5193         (Object::get_incremental_reloc_base): New function.
5194         (Object::get_incremental_reloc_count): New function.
5195         (Object::do_output_section): New function.
5196         (Object::do_output_section_offset): Moved from Relobj.
5197         (Object::do_get_incremental_reloc_base): New function.
5198         (Object::do_get_incremental_reloc_count): New function.
5199         (Object::Object): Initialize new data members.
5200         (Relobj::output_section): Renamed do_output_section and moved to
5201         protected.
5202         (Relobj::output_section_offset): Moved to Object.
5203         (Relobj::do_get_incremental_reloc_base): New function.
5204         (Relobj::do_get_incremental_reloc_count): New function.
5205         (Relobj::allocate_incremental_reloc_counts): New function.
5206         (Relobj::count_incremental_reloc): New function.
5207         (Relobj::finalize_incremental_relocs): New function.
5208         (Relobj::next_incremental_reloc_index): New function.
5209         (Relobj::reloc_counts_): New data member.
5210         (Relobj::reloc_bases_): New data member.
5211         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5212         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5213         (Sized_relobj::incremental_relocs_scan): New function.
5214         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5215         (Sized_relobj::incremental_relocs_write): New function.
5216         (Sized_relobj::incremental_relocs_write_reltype): New function.
5217         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5218         incremental link.
5219         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5220         archives and object files elsewhere.
5221         (Add_symbols::run): Report object files here.
5222         (Finish_group::run): Report end of archive at end of group.
5223         * reloc.cc: Include layout.h, incremental.h.
5224         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5225         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5226         (Sized_relobj::incremental_relocs_scan): New function.
5227         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5228         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5229         (Sized_relobj::incremental_relocs_write): New function.
5230         (Sized_relobj::incremental_relocs_write_reltype): New function.
5231         * script.cc (read_input_script): Rewrite test for incremental link.
5232         Change call to Incremental_inputs::report_script.
5233         * symtab.h (Symbol_table::first_global_index): New function.
5234         (Symbol_table::output_count): New function.
5235
5236 2010-08-12  Doug Kwan  <dougkwan@google.com>
5237
5238         * arm.cc (Target_arm::merge_object_attributes): Check command line
5239         options --no-wchar-size-warning and --no-enum-size-warning.
5240         * options.h (General_options): Add ld-compatible options
5241         --no-enum-size-warning and --no-wchar-size-warning.
5242
5243 2010-08-04  Ian Lance Taylor  <iant@google.com>
5244
5245         * x86_64.cc (Target_x86_64::Scan::local): Use
5246         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5247         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5248         (Target_x86_64::Scan::global): Likewise.
5249         (Target_x86_64::Relocate::relocate): Likewise.
5250         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5251         Likewise.
5252
5253 2010-08-03  Cary Coutant  <ccoutant@google.com>
5254
5255         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5256         to reserve space in merged_strings vector. Keep total input size
5257         for stats.
5258         (Output_merge_string::do_print_merge_stats): Print total input size.
5259         * merge.h (Output_merge_string): Add input_size_ field.
5260         * stringpool.cc (Stringpool_template::string_length): Move
5261         implementations out of Stringpool_template class and place in
5262         stringpool.h.
5263         * stringpool.h (string_length): Move out of Stringpool_template.
5264
5265 2010-08-03  Ian Lance Taylor  <iant@google.com>
5266
5267         PR 11712
5268         * layout.cc (relaxation_loop_body): If address of load segment is
5269         set, adjust address to include headers if possible.
5270
5271 2010-08-03  Ian Lance Taylor  <iant@google.com>
5272
5273         * version.cc (version_string): Bump to 1.10.
5274
5275 2010-08-03  Ian Lance Taylor  <iant@google.com>
5276
5277         PR 11805
5278         * layout.h (enum Output_section_order): Define.
5279         (class Layout): Update declarations.
5280         * layout.cc (Layout::get_output_section): Add order parameter.
5281         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5282         is_first_non_relro parameters.  Change all callers.
5283         (Layout::choose_output_section): Likewise.
5284         (Layout::add_output_section_data): Likewise.
5285         (Layout::make_output_section): Likewise.  Set order.
5286         (Layout::default_section_order): New function.
5287         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5288         * output.cc (Output_section::Output_section): Initialize order_.
5289         Don't initialize deleted fields.
5290         (Output_segment::Output_segment): Don't initialize deleted
5291         fields.
5292         (Output_segment::add_output_section_to_load): New function
5293         replacing add_output_section.  Change all callers to call this or
5294         add_output_section_to_nonload.
5295         (Output_segment::add_output_section_to_nonload): New function.
5296         (Output_segment::remove_output_section): Rewrite.
5297         (Output_segment::add_initial_output_data): Likewise.
5298         (Output_segment::has_any_data_sections): Likewise.
5299         (Output_segment::is_first_section_relro): Likewise.
5300         (Output_segment::maximum_alignment): Likewise.
5301         (Output_segment::has_dynamic_reloc): New function replacing
5302         dynamic_reloc_count.  Change all callers.
5303         (Output_segment::has_dynamic_reloc_list): New function replacing
5304         dynamic_reloc_count_list.  Change all callers.
5305         (Output_segment::set_section_addresses): Rewrite.
5306         (Output_segment::set_offset): Rewrite.
5307         (Output_segment::find_first_and_last_list): Remove.
5308         (Output_segment::set_tls_offsets): Rewrite.
5309         (Output_segment::first_section_load_address): Likewise.
5310         (Output_segment::output_section_count): Likewise.
5311         (Output_segment::section_with_lowest_load_address): Likewise.
5312         (Output_segment::write_section_headers): Likewise.
5313         (Output_segment::print_sections_to_map): Likewise.
5314         * output.h (class Output_data): Remove dynamic_reloc_count_
5315         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5316         (Output_data::add_dynamic_reloc): Rewrite.
5317         (Output_data::has_dynamic_reloc): New function.
5318         (Output_data::dynamic_reloc_count): Remove.
5319         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5320         is_last_relro_, is_first_non_relro_, is_interp_,
5321         is_dynamic_linker_section_ fields.  Add order and set_order
5322         functions.  Remove is_relro_local, set_is_relro_local,
5323         is_last_relro, set_is_last_relro, is_first_non_relro,
5324         set_is_first_non_relro functions, is_interp, set_is_interp,
5325         is_dynamic_linker_section, and set_is_dynamic_linker_section
5326         functions.
5327         (class Output_segment): Change Output_data_list from std::list to
5328         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5329         output_bss_ fields.  Update declarations.
5330
5331 2010-08-02  Ian Lance Taylor  <iant@google.com>
5332
5333         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5334         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5335         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5336
5337 2010-08-02  Ian Lance Taylor  <iant@google.com>
5338
5339         PR 11855
5340         * script.cc (Script_options::Script_options): Initialize
5341         symbol_definitions_ and symbol_references_.
5342         (Script_options::add_symbol_assignment): Update
5343         symbol_definitions_ and symbol_references_.
5344         (Script_options::add_symbol_reference): New function.
5345         (script_symbol): New function.
5346         * script.h (class Script_options): Add symbol_definitions_ and
5347         symbol_references_ fields.
5348         (Script_options::referenced_const_iterator): New type.
5349         (Script_options::referenced_begin): New function.
5350         (Script_options::referenced_end): New function.
5351         (Script_options::is_referenced): New function.
5352         (Script_options::any_unreferenced): New function.
5353         * script-c.h (script_symbol): Declare.
5354         * yyscript.y (exp): Call script_symbol.
5355         * symtab.cc: Include "script.h".
5356         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5357         Change all callers.  Check symbols referenced by scripts.
5358         (Symbol_table::add_undefined_symbols_from_command_line): Add
5359         layout parameter.  Change all callers.
5360         (Symbol_table::do_add_undefined_symbols_from_command_line):
5361         Likewise.  Break out loop body.  Check symbols referenced by
5362         scripts.
5363         (Symbol_table::add_undefined_symbol_from_command_line): New
5364         function broken out of
5365         do_add_undefined_symbols_from_command_line.
5366         * symtab.h (class Symbol_table): Update declarations.
5367         * archive.cc: Include "layout.h".
5368         (Archive::should_include_member): Add layout parameter.  Change
5369         all callers.  Check for symbol mentioned in expression.
5370         * archive.h (class Archive): Update declaration.
5371         * object.cc (Sized_relobj::do_should_include_member): Add layout
5372         parameter.
5373         * object.h (Object::should_include_member): Add layout parameter.
5374         Change all callers.
5375         (Object::do_should_include_member): Add layout parameter.
5376         (class Sized_relobj): Update declaration.
5377         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5378         parameter.
5379         * dynobj.h (class Sized_dynobj): Update declaration.
5380         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5381         layout parameter.
5382         * plugin.h (class Sized_pluginobj): Update declaration.
5383
5384 2010-08-02  Ian Lance Taylor  <iant@google.com>
5385
5386         PR 11866
5387         * output.cc (Output_segment::set_offset): Search for the first and
5388         last sections rather than assuming that the list is in order.
5389         (Output_segment::find_first_and_last_list): New function.
5390         * output.h (class Output_segment): Update declarations.
5391         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5392         (relro_strip_test_SOURCES): New variable.
5393         (relro_strip_test_DEPENDENCIES): New variable.
5394         (relro_strip_test_LDFLAGS): New variable.
5395         (relro_strip_test_LDADD): New variable.
5396         (relro_strip_test.so): New target.
5397
5398 2010-08-02  Ian Lance Taylor  <iant@google.com>
5399
5400         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5401         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5402         (Target_i386::got_tlsdesc_section): New function.
5403         (Target_i386::got_section): Create space for GOT entries for
5404         TLSDESC relocations.
5405         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5406         R_386_TLS_GOTDESC.
5407         (Target_i386::Scan::global): Likewise.
5408         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5409         using TLSDESC GOT.
5410         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5411         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5412         (Target_x86_64::got_tlsdesc_section): New function.
5413         (Target_x86_64::got_section): Create space for GOT entries for
5414         TLSDESC relocations.
5415         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5416         R_386_TLS_GOTDESC.
5417         (Target_x86_64::Scan::global): Likewise.
5418         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5419         using TLSDESC GOT.
5420
5421 2010-08-02  Ian Lance Taylor  <iant@google.com>
5422
5423         * testsuite/final_layout.sh: Use dc to convert from hex to
5424         decimal.
5425
5426 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5427
5428         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5429         paramter to the call to gold::gc_process_relocs.
5430         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5431         paramter to the call to gold::gc_process_relocs.
5432         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5433         parameter to the call to gold::gc_process_relocs.
5434         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5435         template parameter to the call to gold::gc_process_relocs.
5436         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5437         paramter to the call to gold::gc_process_relocs.
5438         * gc.h (get_embedded_addend_size): New function.
5439         (gc_process_relocs): Save the size of the reloc for use by ICF.
5440         * icf.cc (get_section_contents): Get the addend from the text section
5441         for SHT_REL relocation sections.
5442         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5443         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5444         * int_encoding.h (read_from_pointer): New overloaded function.
5445         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5446         * testsuite/icf_sht_rel_addend_test.sh: New file.
5447         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5448         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5449
5450 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5451
5452         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5453         * Makefile.in: Regenerate.
5454         * testsuite/Makefile.in: Regenerate.
5455
5456 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5457
5458         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5459         * gold/testsuite/debug_msg.cc: Likewise.
5460         * gold/testsuite/odr_violation1.cc
5461         * gold/testsuite/odr_violation2.cc
5462
5463 2010-07-21  Cary Coutant  <ccoutant@google.com>
5464
5465         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5466         string, and length fields.
5467         (Output_merge_string::Merged_strings_list): New type.
5468         (Output_merge_string::Merged_strings_lists): New typedef.
5469         (Output_merge_string): Replace merged_strings_ with
5470         merged_strings_lists_.
5471         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5472         Merged_strings_list per input object and section.  Don't store pointer
5473         to the string.  Don't store length with each merged string entry.
5474         (Output_merge_string::finalize_merged_data): Loop over list of merged
5475         strings lists.  Recompute length of each merged string.
5476
5477 2010-07-15  Cary Coutant  <ccoutant@google.com>
5478
5479         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5480         here.
5481
5482 2010-07-14  Ian Lance Taylor  <iant@google.com>
5483
5484         * descriptors.cc (Descriptors::open): Report correct name in error
5485         message.
5486
5487 2010-07-13  Doug Kwan  <dougkwan@google.com>
5488
5489         * arm.cc (Arm_input_section::Arm_input_section): For a
5490         SHT_ARM_EXIDX section, always keeps the input sections.
5491         (Arm_input_section::set_exidx_section_link): New method.
5492         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5493         has_errors_ to false.
5494         (Arm_exidx_input_section::has_errors,
5495         Arm_exidx_input_section::set_has_errors): New methods.
5496         (Arm_exidx_input_section::has_errors_): New data member.
5497         (Arm_relobj::get_exidx_shndx_list): New method.
5498         (Arm_output_section::append_text_sections_to_list): Do not skip
5499         section without SHF_EXECINSTR.
5500         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5501         errors.
5502         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5503         section header.  Make error messages more verbose.  Check for
5504         a non-executable section linked to an EXIDX section.
5505         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5506         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5507         check that there is no deferred EXIDX section if we exit early.
5508         Instead of not making an EXIDX section in case of an error, make one
5509         and set the has_errors flag of it.
5510         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5511         in a relocatable link.
5512         (Target_arm::do_relax): Look for the EXIDX output section instead of
5513         assuming that it is called .ARM.exidx.
5514         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5515         section list.  Do not check for SHF_EXECINSTR section flags but
5516         skip any input section with errors.
5517         * output.cc (Output_section::Output_section): Initialize
5518         always_keeps_input_sections_ to false.
5519         (Output_section::add_input_section): Check for
5520         always_keeps_input_sections_.
5521         *  output.h (Output_section::always_keeps_input_sections,
5522         Output_section::set_always_keeps_input_sections): New methods.
5523         (Output_section::always_keeps_input_sections): New data member.
5524
5525 2010-07-13  Rafael Espindola  <espindola@google.com>
5526
5527         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5528         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5529
5530 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5531             Ian Lance Taylor  <iant@google.com>
5532
5533         * output.h (Output_section_lookup_maps::add_merge_section):
5534         Correct check of whether value was inserted.
5535         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5536         (Output_section_lookup_maps::add_relaxed_input_section):
5537         Likewise.
5538         * arm.cc (Target_arm::got_section): Remove used local os.
5539         * i386.cc (Target_i386::got_section): Likewise.
5540         * x86_64.cc (Target_x86_64::got_section): Likewise.
5541         * sparc.cc (Target_sparc::got_section): Likewise.
5542         (Target_sparc::relocate): Remove unused local have_got_offset.
5543         * powerpc.cc (Target_powerpc::relocate): Likewise.
5544
5545 2010-07-13  Ian Lance Taylor  <iant@google.com>
5546
5547         * compressed_output.cc (zlib_decompress): Fix signature in
5548         !HAVE_ZLIB_H case.
5549
5550         * archive.cc (Archive::include_member): Unlock an external member
5551         of a thin archive.  Don't bother to delete an object we know is
5552         NULL.
5553
5554 2010-07-12  Cary Coutant  <ccoutant@google.com>
5555
5556         * compressed_output.cc (zlib_decompress): New function.
5557         (get_uncompressed_size): New function.
5558         (decompress_input_section): New function.
5559         * compressed_output.h (get_uncompressed_size): New function.
5560         (decompress_input_section): New function.
5561         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5562         Handle compressed debug sections.
5563         * layout.cc (is_compressed_debug_section): New function.
5564         (Layout::output_section_name): Map compressed section names to
5565         canonical names.
5566         * layout.h (is_compressed_debug_section): New function.
5567         (is_debug_info_section): Recognize compressed debug sections.
5568         * merge.cc: Include compressed_output.h.
5569         (Output_merge_data::do_add_input_section): Handle compressed
5570         debug sections.
5571         (Output_merge_string::do_add_input_section): Handle compressed
5572         debug sections.
5573         * object.cc: Include compressed_output.h.
5574         (Sized_relobj::Sized_relobj): Initialize new data members.
5575         (build_compressed_section_map): New function.
5576         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5577         * object.h (Object::section_is_compressed): New method.
5578         (Object::do_section_is_compressed): New method.
5579         (Sized_relobj::Compressed_section_map): New type.
5580         (Sized_relobj::do_section_is_compressed): New method.
5581         (Sized_relobj::compressed_sections_): New data member.
5582         * output.cc (Output_section::add_input_section): Handle compressed
5583         debug sections.
5584         * reloc.cc: Include compressed_output.h.
5585         (Sized_relobj::write_sections): Handle compressed debug sections.
5586
5587 2010-07-08  Cary Coutant  <ccoutant@google.com>
5588
5589         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5590         weak when resolving to a dynamic def.
5591         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5592         for weak undef/dynamic def cases. Adjust callers.
5593         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5594         undef_binding_weak_.
5595         (Symbol_table::sized_write_globals): Adjust symbol binding.
5596         (Symbol_table::sized_write_symbol): Add binding parameter.
5597         * symtab.h (Symbol::set_undef_binding): New method.
5598         (Symbol::is_undef_binding_weak): New method.
5599         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5600         (Symbol_table::should_override): Add new parameter.
5601         (Symbol_table::sized_write_symbol): Add new parameter.
5602
5603         * testsuite/weak_undef_file1.cc: Add new test case.
5604         * testsuite/weak_undef_file2.cc: Fix header comment.
5605         * testsuite/weak_undef_test.cc: Add new test case.
5606
5607 2010-06-29  Doug Kwan  <dougkwan@google.com>
5608
5609         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5610         Initialize USE_SYMBOL_.
5611         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5612         definition.
5613         (Arm_reloc_property::uses_symbol_): New data member declaration.
5614         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5615         uses symbol value and symbol is undefined but not weakly undefined.
5616
5617 2010-06-28  Rafael Espindola  <espindola@google.com>
5618
5619         * plugin.cc (Plugin::load): Use dlerror.
5620
5621 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5622
5623         * symtab.cc (detect_odr_violations): When reporting an ODR
5624         violation, report an object where the symbol is defined.
5625
5626 2010-06-25  Doug Kwan  <dougkwan@google.com>
5627
5628         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5629         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5630         definition.
5631         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5632         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5633         target hook to detect function points.
5634         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5635         * icf.h (Icf::check_section_for_function_pointers): Change type of
5636         parameter SECTION_NAME to const reference to std::string.  Use
5637         target hook to determine if section may have unsafe pointers.
5638         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5639         method definition.
5640
5641 2010-06-21  Rafael Espindola  <espindola@google.com>
5642
5643         * fileread.cc (Input_file::find_fie): New
5644         (Input_file::open): Use Input_file::find_fie.
5645         * fileread.h (Input_file::find_fie): New
5646         * plugin.cc (set_extra_library_path): New.
5647         (Plugin::load): Add set_extra_library_path to the transfer vector.
5648         (Plugin_manager::set_extra_library_path): New.
5649         (Plugin_manager::add_input_file): Use the extra search path if set.
5650         (set_extra_library_path(): New.
5651         * plugin.h (Plugin_manager): Add set_extra_library_path and
5652         extra_search_path_.
5653
5654 2010-06-19  Cary Coutant  <ccoutant@google.com>
5655
5656         * layout.cc (gdb_sections): Add .debug_types.
5657         (lines_only_debug_sections): Likewise.
5658
5659 2010-06-18  Rafael Espindola  <espindola@google.com>
5660
5661         * plugin.cc (add_input_file,add_input_library)
5662         (Plugin_manager::add_input_file): Make filename arguments const.
5663         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5664         const.
5665
5666 2010-06-16  Doug Kwan  <dougkwan@google.com>
5667
5668         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5669         .ARM.attributes section if we have not merged any input
5670         attributes sections.
5671
5672 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5673
5674         * arm.cc: Allow combining objects with no EABI version
5675         information.
5676
5677 2010-06-15  Rafael Espindola  <espindola@google.com>
5678
5679         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5680
5681 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5682
5683         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5684         (struct iovec): Correct !HAVE_READV definition.
5685
5686 2010-06-10  Cary Coutant  <ccoutant@google.com>
5687
5688         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5689         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5690         reloc sections.
5691         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5692
5693         PR 11683
5694         * symtab.h (Symbol::is_placeholder): New member function.
5695         * target-reloc.h (relocate_section): Check for placeholder symbols.
5696
5697         * testsuite/Makefile.am (plugin_test_8): New test.
5698         (plugin_test_9): New test.
5699         * testsuite/Makefile.in: Regenerate.
5700
5701 2010-06-09  Nick Clifton  <nickc@redhat.com>
5702
5703         * yyscript.y (input_list_element): Allow strings prefixed with
5704         the '-' character.  Treat these as libraries.
5705         * script.cc (script_add_library): New function.  Adds a library
5706         specified by "-l<name>" found in an input script.
5707         * script-c.h: Add prototype for script_add_library.
5708
5709 2010-06-07  Doug Kwan  <dougkwan@google.com>
5710
5711         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5712         Restrict stub-group size to be within long conditional branch
5713         range when working around cortex-A8 erratum.
5714
5715 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5716
5717         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5718         #ifdef typo.
5719
5720 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5721
5722         PR gold/11658
5723         * output.cc
5724         (Output_section::Input_section_sort_entry::compare_section_ordering):
5725         Change to return non-zero correctly.
5726         (Output_section::Input_section_sort_section_order_index_compare
5727         ::operator()): Change to fix ambiguity in comparisons.
5728
5729 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5730
5731         * gold.h (is_wildcard_string): New function.
5732         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5733         (Layout::layout_eh_frame): Ditto.
5734         (Layout::find_section_order_index): New method.
5735         (Layout::read_layout_from_file): New method.
5736         * layout.h (Layout::find_section_order_index): New method.
5737         (Layout::read_layout_from_file): New method.
5738         (Layout::input_section_position_): New private member.
5739         (Layout::input_section_glob_): New private member.
5740         * main.cc (main): Call read_layout_from_file here.
5741         * options.h (--section-ordering-file): New option.
5742         * output.cc (Output_section::input_section_order_specified_): New
5743         member.
5744         (Output_section::Output_section): Initialize new member.
5745         (Output_section::add_input_section): Add new parameter.
5746         Keep input sections when --section-ordering-file is used.
5747         (Output_section::set_final_data_size): Sort input sections when
5748         section ordering file is specified.
5749         (Output_section::Input_section_sort_entry): Add new parameter.
5750         Check sorting type.
5751         (Output_section::Input_section_sort_entry::compare_section_ordering):
5752         New method.
5753         (Output_section::Input_section_sort_compare::operator()): Change to
5754         consider section_order_index.
5755         (Output_section::Input_section_sort_init_fini_compare::operator()):
5756         Change to consider section_order_index.
5757         (Output_section::Input_section_sort_section_order_index_compare
5758         ::operator()): New method.
5759         (Output_section::sort_attached_input_sections): Change to sort
5760         according to section order when specified.
5761         (Output_section::add_input_section<32, true>): Add new parameter.
5762         (Output_section::add_input_section<64, true>): Add new parameter.
5763         (Output_section::add_input_section<32, false>): Add new parameter.
5764         (Output_section::add_input_section<64, false>): Add new parameter.
5765         * output.h (Output_section::add_input_section): Add new parameter.
5766         (Output_section::input_section_order_specified): New
5767         method.
5768         (Output_section::set_input_section_order_specified): New method.
5769         (Input_section::Input_section): Initialize section_order_index_.
5770         (Input_section::section_order_index): New method.
5771         (Input_section::set_section_order_index): New method.
5772         (Input_section::section_order_index_): New member.
5773         (Input_section::Input_section_sort_section_order_index_compare): New
5774         struct.
5775         (Output_section::input_section_order_specified_): New member.
5776         * script-sections.cc (is_wildcard_string): Delete and move modified
5777         method to gold.h.
5778         (Output_section_element_input::Output_section_element_input): Modify
5779         call to is_wildcard_string.
5780         (Output_section_element_input::Input_section_pattern
5781         ::Input_section_pattern): Ditto.
5782         (Output_section_element_input::Output_section_element_input): Ditto.
5783         * testsuite/Makefile.am (final_layout): New test case.
5784         * testsuite/Makefile.in: Regenerate.
5785         * testsuite/final_layout.cc: New file.
5786         * testsuite/final_layout.sh: New file.
5787
5788 2010-06-01  Rafael Espindola  <espindola@google.com>
5789
5790         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5791
5792 2010-06-01  Rafael Espindola  <espindola@google.com>
5793
5794         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5795         visibility of symbols.
5796
5797 2010-05-27  Doug Kwan  <dougkwan@google.com>
5798
5799         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5800         from start of output section instead of address for a local symbol
5801         in a merged or relaxed section when doing a relocatable link.
5802
5803 2010-05-26  Rafael Espindola  <espindola@google.com>
5804
5805         PR 11604
5806         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5807         adding sections the garbage collector removed.
5808         * gold/testsuite/Makefile.am: Add test.
5809         * gold/testsuite/Makefile.in: Regenerate.
5810         * gold/testsuite/plugin_test_7.sh: New.
5811         * gold/testsuite/plugin_test_7_1.c: New.
5812         * gold/testsuite/plugin_test_7_2.c: New.
5813
5814 2010-05-26  Rafael Espindola  <espindola@google.com>
5815
5816         * script-sections.cc (Output_section_definition::set_section_addresses):
5817         Check for --section-start.
5818
5819 2010-05-26  Doug Kwan  <dougkwan@google.com>
5820
5821         * arm.cc (Arm_scan_relocatable_relocs): New class.
5822         (Target_arm::relocate_special_relocatable): New method.
5823         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5824         (Arm_relocate_functions::thumb_branch_common): Same.
5825         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5826         instead of Default_scan_relocatable_relocs.
5827         * target-reloc.h (relocate_for_relocatable): Let target handle
5828         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5829         * target.h (Sized_target::relocate_special_relocatable): New method.
5830
5831 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5832
5833         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5834
5835 2010-05-23  Doug Kwan  <dougkwan@google.com>
5836
5837         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5838         instead of a cast.
5839         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5840         with a direct branch, not a conditional branch, to a stub.
5841         * merge.cc (Output_merge_base::record_input_section): New method
5842         defintion.
5843         (Output_merge_data::do_add_input_section): Record input section if
5844         keeps-input-sections flag is set.
5845         (Output_merge_string::do_add_input_section): Ditto.
5846         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5847         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5848         INPUT_SECTIONS_.
5849         (Output_merge_base::keeps_input_sections,
5850         Output_merge_base::set_keeps_input_sections,
5851         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5852         method definitions.
5853         (Output_merge_base::Input_sections): New type declaration.
5854         (Output_merge_base::input_sections_begin,
5855         Output_merge_base::input_sections_end,
5856         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5857         (Output_merge_base::bool keeps_input_sections_,
5858         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5859         Output_merge_base::input_sections_): New data members.
5860         (Output_merge_data::do_set_keeps_input_sections): New method
5861         defintion.
5862         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5863         * output.cc (Output_section::Input_section::relobj): Move method
5864         defintion from class declaration to here and handle merge sections.
5865         (Output_section::Input_section::shndx): Ditto.
5866         (Output_section::Output_section): Remove initializations of removed
5867         data members and initialize new data member LOOKUP_MAPS_.
5868         (Output_section::add_input_section): Set keeps-input-sections flag
5869         for a newly created merge output section as appropriate.  Adjust code
5870         to use Output_section_lookup_maps class.
5871         (Output_section::add_relaxed_input_section): Adjst code for lookup
5872         maps code refactoring.
5873         (Output_section::add_merge_input_section): Add a new parameter
5874         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5875         class.  If adding input section to a newly created merge output
5876         section fails, remove the new merge section.
5877         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5878         Adjust code for use of the Output_section_lookup_maps class.
5879         (Output_section::find_merge_section): Ditto.
5880         (Output_section::build_lookup_maps): New method defintion.
5881         (Output_section::find_relaxed_input_section): Adjust code to use
5882         Output_section_lookup_maps class.
5883         (Output_section::get_input_sections): Export merge sections.  Adjust
5884         code to use Output_section_lookup_maps class.
5885         (Output_section:::add_script_input_section): Adjust code to use
5886         Output_section_lookup_maps class.  Update lookup maps for merge
5887         sections also.
5888         (Output_section::discard_states): Use Output_section_lookup_maps.
5889         (Output_section::restore_states): Same.
5890         * output.h (Merge_section_properties): Move class defintion out of
5891         Output_section.
5892         (Output_section_lookup_maps): New class.
5893         (Output_section::Input_section::is_merge_section): New method
5894         defintion.
5895         (Output_section::Input_section::relobj): Move defintion out of class
5896         defintion.  Declare method only.
5897         (Output_section::Input_section::shndx): Ditto.
5898         (Output_section::Input_section::output_merge_base): New method defintion.
5899         (Output_section::Input_section::u2_.pomb): New union field.
5900         (Output_section::Merge_section_by_properties_map,
5901         Output_section::Output_section_data_by_input_section_map,
5902         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5903         Remove types.
5904         (Output_section::add_merge_input_section): Add new parameter
5905         KEEPS_INPUT_SECTIONS.
5906         (Output_section::build_lookup_maps): New method declaration.
5907         (Output_section::merge_section_map_,
5908         Output_section::merge_section_by_properties_map_,
5909         Output_section::relaxed_input_section_map_,
5910         Output_section::is_relaxed_input_section_map_valid_): Remove data
5911         members.
5912         (Output_section::lookup_maps_): New data member.
5913
5914 2010-05-21  Doug Kwan  <dougkwan@google.com>
5915
5916         PR gold/11619
5917         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5918         avoid a compilation error.
5919
5920 2010-05-19  Rafael Espindola  <espindola@google.com>
5921
5922         * script-sections.cc (Output_section_definition::allocate_to_segment):
5923         Update the phdrs_list even when the output section is NULL.
5924         * testsuite/Makefile.am: Add test.
5925         * testsuite/Makefile.in: Regenerate.
5926         * testsuite/script_test_9.cc: New.
5927         * testsuite/script_test_9.sh: New.
5928         * testsuite/script_test_9.t: New.
5929
5930 2010-05-19  Doug Kwan  <dougkwan@google.com>
5931
5932         * arm.cc (Arm_input_section::original_size): New method.
5933         (Arm_input_section::do_addralign): Add a cast.
5934         (Arm_input_section::do_output_offset): Remove static cast.
5935         (Arm_input_section::original_addralign,
5936          Arm_input_section::original_size_): Change type to uint32_t.
5937         (Arm_input_section::init): Add safe casts for section alignment
5938         and size.
5939         (Arm_input_section::set_final_data_size): Do not set address and
5940         offset of stub table.
5941         (Arm_output_section::fix_exidx_coverage): Change use of of
5942         Output_section::Simple_input_section to that of
5943         Output_section::Input_section.
5944         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5945         except for the first pass.
5946         * output.cc (Output_section::get_input_sections): Change type of
5947         input_sections to std::list<Input_section>.
5948         (Output_section::add_script_input_section): Rename from
5949         Output_section::add_simple_input_section.  Change type of SIS
5950         parameter from Simple_input_section to Input_section.
5951         * output.h (Output_section::Simple_input_section): Remove class.
5952         (Output_section::Input_section): Change class visibility to public.
5953         (Output_section::Input_section::addralign): Use stored alignments
5954         for special input sections if set.
5955         (Output_section::Input_section::set_addralign): New method.
5956         (Output_section::get_input_sections): Change parameter type from
5957         list of Simple_input_section to list of Input_section.
5958         (Output_section::add_script_input_section): Rename from
5959         Output_section::add_simple_input_section. Change first parameter's
5960         type from Simple_input_section to Input_section and remove the
5961         second and third parameters.
5962         * script-sections.cc (Input_section::Input_section_list): Change
5963         type to list of Output_section::Input_section/
5964         (Input_section_info::Input_section_info): Change parameter type of
5965         INPUT_SECTION to Output_section::Input_section.
5966         (Input_section_info::input_section): Change return type.
5967         (Input_section_info::input_section_): Change type to
5968         Output_section::Input_section.
5969         (Output_section_element_input::set_section_addresses): Adjust code
5970         to use Output_section::Input_section instead of
5971         Output_section::Simple_input_section.  Adjust code for renaming
5972         of Output_section::add_simple_input_section.
5973         (Orphan_output_section::set_section_addresses): Ditto.
5974
5975 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5976
5977         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5978         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5979
5980 2010-05-18  Rafael Espindola  <espindola@google.com>
5981
5982         * options.cc (General_options::finalize): Handle -nostdlib.
5983         * options.h (nostdlib): New option.
5984         * script.cc (script_add_search_dir): Handle -nostdlib.
5985
5986 2010-05-12  Doug Kwan  <dougkwan@google.com>
5987
5988         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5989         attributes section only if there no attributes section after merging.
5990         (Target_arm::merge_object_attributes): Move value of
5991         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5992         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5993         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5994         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5995         and arm_attr_merge_7.stdout.
5996         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5997         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5998         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5999         arm_attr_merge_7b.o): New rules.
6000         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6001         arm_attr_merge_7
6002         * testsuite/Makefile.in: Regenerate.
6003         * testsuite/arm_attr_merge.sh: New file.
6004         * testsuite/arm_attr_merge_[67][ab].s: Same.
6005
6006 2010-05-05  Nick Clifton  <nickc@redhat.com>
6007
6008         * po/es.po: Updated Spanish translation.
6009
6010 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6011
6012         * Makefile.am (install-exec-local): Properly install gold as
6013         default cross linker.
6014         * Makefile.in: Regenerated.
6015
6016 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6017             Nick Clifton  <nickc@redhat.com>
6018
6019         * configure.ac (install_as_default): Define and set to false
6020         unless --enable-gold or --enable-gold=both/gold has been
6021         specified.
6022         * configure: Regenerate.
6023
6024         * Makefile.am (install-exec-local): Install the executable as
6025         'ld.gold'.  If install_as_default is true then also install it as
6026         'ld'.
6027         * Makefile.in: Regenerated.
6028
6029 2010-04-24  Ian Lance Taylor  <iant@google.com>
6030
6031         * layout.cc (Layout::layout_reloc): In relocatable link don't
6032         combine reloc sections for grouped sections.
6033
6034 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6035
6036         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6037         sections that are not ordinary to icf.
6038         * icf.cc (get_section_contents): Handle relocation pointing to section
6039         with no object or shndx information.
6040         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6041         * testsuite/Makefile.in: Regenerate.
6042         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6043         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6044
6045 2010-04-22  Ian Lance Taylor  <iant@google.com>
6046
6047         * expression.cc (Expression::Expression_eval_info): Add
6048         result_alignment_pointer field.
6049         (Expression::eval_with_dot): Add result_alignment_pointer
6050         parameter.  Change all callers.
6051         (Expression::eval_maybe_dot): Likewise.
6052         (class Binary_expression): Add alignment_pointer parameter to
6053         left_value and right_value.  Change all callers.
6054         (BINARY_EXPRESSION): Set result alignment.
6055         (class Trinary_expression): Add alignment_pointer parameter to
6056         arg2_value and arg3_value.  Change all callers.
6057         (Trinary_cond::value): Set result alignment.
6058         (Max_expression::value, Min_expression::value): Likewise.
6059         (Align_expression::value): Likewise.
6060         * script-sections.cc (class Sections_element): Add dot_alignment
6061         parameter to set_section_addresses virtual function.  Update
6062         instantiations.
6063         (class Output_section_element): Likewise.
6064         (Script_sections::create_segments): Add dot_alignment parameter.
6065         Change all callers.
6066         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6067         (Script_sections::set_phdrs_clause_addresses): Likewise.
6068         * script-sections.h: Update declarations.
6069         * script.h: Update declarations.
6070         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6071         min_p_align.
6072         * testsuite/script_test_3.t: Set large alignment.
6073         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6074         segment has expected alignment.
6075
6076 2010-04-22  Nick Clifton  <nickc@redhat.com>
6077
6078         * po/gold.pot: Updated by the Translation project.
6079         * po/vi.po: Updated Vietnamese translation.
6080
6081 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6082
6083         * testsuite/Makefile.am (check_PROGRAMS): Add
6084         icf_virtual_function_folding_test.
6085         * testsuite/Makefile.in: Regenerated.
6086
6087 2010-04-15  Andrew Haley  <aph@redhat.com>
6088
6089         * options.h (merge_exidx_entries): New option.
6090         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6091         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6092         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6093         (Target_arm::merge_exidx_entries): New function.
6094         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6095         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6096         to Arm_exidx_fixup constructor.
6097         Add new arg, merge_exidx_entries.
6098         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6099         Arm_output_section::fix_exidx_coverage.
6100
6101 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6102
6103         * icf.cc (get_section_contents): Check for preemptible functions.
6104         Ignore addend when appropriate.
6105         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6106         section folded.
6107         (add_from_relobj): Check for section folded.
6108         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6109         * symtab.h (should_add_dynsym_entry): Add new parameter.
6110         * target-reloc.h (scan_relocs): Check for section folded.
6111         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6112         Check reloc types for function pointers in shared objects.
6113         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6114         case.
6115         (icf_preemptible_functions_test): New test case.
6116         (icf_string_merge_test): New test case.
6117         * testsuite.Makefile.in: Regenerate.
6118         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6119         bar_glob.  Refactor code.
6120         * testsuite/icf_preemptible_functions_test.cc: New file.
6121         * testsuite/icf_preemptible_functions_test.sh: New file.
6122         * testsuite/icf_string_merge_test.cc: New file.
6123         * testsuite/icf_string_merge_test.sh: New file.
6124         * testsuite/icf_virtual_function_folding_test.cc: New file.
6125         * testsuite/icf_virtual_function_folding_test.sh: New file.
6126
6127 2010-04-14  Doug Kwan  <dougkwan@google.com>
6128
6129         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6130         for local symbol recounting if we remove a section due to ICF.
6131         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6132         there are no regular objects in input.
6133
6134 2010-04-13  Doug Kwan  <dougkwan@google.com>
6135
6136         * arm.cc (Arm_input_section::set_final_data_size): Compute
6137         accurate final data size instead of using current data size.
6138
6139 2010-04-09  Doug Kwan  <dougkwan@google.com>
6140
6141         * layout.cc (Layout::choose_output_section): Handle script section
6142         types.
6143         (Layout::make_output_section_for_script): Add section type parameter.
6144         Handle script section types.
6145         * layout.h (Layout::make_output_section_for_script): Add section
6146         type parameter.
6147         * output.cc (Output_section::Output_section): Initialize data member
6148         is_noload_.
6149         (Output_section::do_reset_address_and_file_offset): Do not set address
6150         to 0 if section is a NOLOAD section.
6151         * output.h (Output_section::is_noload): New method.
6152         (Output_section::set_is_noload): Ditto.
6153         (Output_section::is_noload_): New data member.
6154         * script-c.h (Script_section_type): New enum type.
6155         (struct Parser_output_section_header): Add new file section_type.
6156         * script-sections.cc (Sections_element::output_section_name): Add
6157         parameter for returning script section type.
6158         (Output_section_definition::output_section_name): Ditto.
6159         (Output_section_definition::section_type)P; New method.
6160         (Output_section_definiton::script_section_type_name): Ditto.
6161         (Output_section_definition::script_section_type_): New data member.
6162         (Output_section_definition::Output_section_definition): Initialize
6163         data member Output_section_definition::script_section_type_.
6164         (Output_section_definition::create_sections): Pass script section type
6165         to Layout::make_output_section_for_script.
6166         (Output_section_definition::output_section_name): Return script
6167         section type to caller.
6168         (Output_section_definition::set_section_address): Do not advance
6169         dot value and load address if section type is NOLOAD.  Set address
6170         of NOLOAD sections regardless of section flags.
6171         (Output_section_definition::print): Print section type if it is
6172         not SCRIPT_SECTION_TYPE_NONE.
6173         (Output_section_definition::section_type): New method.
6174         (Output_section_definition::script_section_type_name): Ditto.
6175         (Script_sections::output_section_name): Add new parameter
6176         PSECTION_TYPE for returning script section type.  Pass it to
6177         section elements.  Handle discard sections.
6178         (Sort_output_sections::operator()): Handle NOLOAD sections.
6179         * script-sections.h (Script_sections::Section_type): New enum type.
6180         (Script_sections::output_section_name): Add a new parameter for
6181         returning script section type.
6182         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6183         INFO and NOLOAD.
6184         * yyscript.y (union): Add new field SECTION_TYPE.
6185         (COPY, DSECT, INFO, NOLOAD): New tokens.
6186         (opt_address_and_section_type): Change type to output_section_header.
6187         (section_type): New non-terminal
6188         (section_header): Handle section type.
6189         (opt_address_and_section_type): Return section type value.
6190
6191 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6192
6193         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6194         * testsuite/plugin_common_test_2.c (foo): Likewise.
6195
6196 2010-04-08  Doug Kwan  <dougkwan@google.com>
6197
6198         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6199         Output_merge_data.
6200         * output.cc (Output_section::add_merge_input_section): Simplify
6201         code and return status of Output_merge_base::add_input_section.
6202         Update merge section map only if Output_merge_base::add_input_section
6203         returns true.
6204
6205 2010-04-07  Doug Kwan  <dougkwan@google.com>
6206
6207         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6208         if section is marked as containing instructions but has no mapping
6209         symbols.
6210         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6211         correct section index.
6212         (Arm_relobj::find_linked_text_section): Ditto.
6213
6214 2010-04-07  Cary Coutant  <ccoutant@google.com>
6215
6216         * archive.cc (include_member): Destroy Read_symbols_data object before
6217         releasing file.
6218         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6219         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6220         (Read_symbols_data::~Read_symbols_data) New destructor.
6221         (Section_relocs::Section_relocs) New constructor.
6222         (Section_relocs::~Section_relocs) New destructor.
6223         (Read_relocs_data::Read_relocs_data) New constructor.
6224         (Read_relocs_data::~Read_relocs_data) New destructor.
6225         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6226         pointers to NULL after deleting.
6227
6228 2010-04-07  Doug Kwan  <dougkwan@google.com>
6229
6230         * arm.cc: Replace "endianity" with "endianness" in comments.
6231         (Arm_exidx_cantunwind): Ditto.
6232         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6233         (Arm_relobj::merge_flags_and_attributes): New method.
6234         (Arm_relobj::merge_flags_and_attributes_): New data member.
6235         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6236         (Arm_relobj::scan_sections_for_stubs): Ditto.
6237         (Arm_relobj::do_read_symbols): Check to see if we really want to
6238         merge processor-specific flags and attributes.  Exit early if
6239         an object is empty except for section names and the undefined symbol.
6240         (Target_arm::do_finalize_sections): Move check for ELF format to
6241         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6242         attributes from a regular object only when we have determined that
6243         it is aapropriate.  Do not create an .ARM.attributes section in
6244         output if there is no regular input object.
6245         (Target_arm::merge_processor_specific_flags): Check
6246         --warn-mismatch before printing any error.
6247         (Target_arm::merge_object_attributes): Ditto.
6248         * gold.cc (queue_middle_tasks): Handle the case in which there is
6249         no regular object in input.
6250         * options.cc (General_options::parse_EB): New method.
6251         (General_options::parse_EL): Same.
6252         (General_options::General_options): Initialize endianness_.
6253         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6254         New options.
6255         (General_options::Endianness): New enum.
6256         (General_options::endianness): New method.
6257         (General_options::endianness_): New data member.
6258         * parameters.cc (Parameters::set_options): Check target endianness.
6259         (Parameters::set_target_once): Ditto.
6260         (Parameters::check_target_endianness): New method.
6261         (parameters_force_valid_target): If either -EL or -EB is specified,
6262         use it to define endianness of default target.
6263         * parameters.h (Parameters::check_target_endianness): New method
6264         declaration.
6265         * target.h (class Target): Change "endianity" to "endianness"
6266         in comments.
6267
6268 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6269
6270         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6271         * configure: Regenerate.
6272         * Makefile.in: Regenerate.
6273         * testsuite/Makefile.in: Regenerate.
6274
6275 2010-04-06  Cary Coutant  <ccoutant@google.com>
6276
6277         gcc PR lto/42757
6278         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6279         prevailing definitions of common symbols.
6280         * testsuite/plugin_test_6.sh: New test case.
6281         * testsuite/plugin_common_test_1.c: New test case.
6282         * testsuite/plugin_common_test_2.c: New test case.
6283         * testsuite/Makefile.am (plugin_test_6): New test case.
6284         * testsuite/Makefile.in: Regenerate.
6285
6286 2010-04-06  Nick Clifton  <nickc@redhat.com>
6287
6288         * po/vi.po: New Vietnamese translation.
6289
6290 2010-03-30  Doug Kwan  <dougkwan@google.com>
6291
6292         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6293
6294 2010-03-25  Doug Kwan  <dougkwan@google.com>
6295
6296         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6297         to avoid a conversion warning on a 32-bit host.
6298
6299 2010-03-24  Ian Lance Taylor  <iant@google.com>
6300
6301         * testsuite/script_test_3.t: Add a TLS segment.
6302         * testsuite/Makefile.am (check_PROGRAMS): Add
6303         tls_phdrs_script_test.
6304         (tls_phdrs_script_test_SOURCES): Define.
6305         (tls_phdrs_script_test_DEPENDENCIES): Define.
6306         (tls_phdrs_script_test_LDFLAGS): Define.
6307         (tls_phdrs_script_test_LDADD): Define.
6308         * testsuite/Makefile.in: Rebuild.
6309
6310 2010-03-23  Cary Coutant  <ccoutant@google.com>
6311
6312         * fileread.cc (find_or_make_view): Fix comment.
6313
6314 2010-03-23  Ian Lance Taylor  <iant@google.com>
6315
6316         * script-sections.cc (class Orphan_section_placement): Define
6317         PLACE_TLS and PLACE_TLS_BSS.
6318         (Orphan_section_placement::Orphan_section_placement): Initialize
6319         new places.
6320         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6321         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6322         (tls_script_test_SOURCES): Define.
6323         (tls_script_test_DEPENDENCIES): Define.
6324         (tls_script_test_LDFLAGS): Define.
6325         (tls_script_test_LDADD): Define.
6326         * testsuite/Makefile.in: Rebuild.
6327
6328 2010-03-22  Doug Kwan  <dougkwan@google.com>
6329
6330         * arm.cc (Arm_relocate_functions::abs8,
6331         Arm_relocate_functions::abs16): Use correct check for overflow
6332         specified in the ARM ELF specs.
6333         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6334         target of a BLX instruction specially.
6335         (Reloc_stub::stub_type_for_reloc): Ditto.
6336         (Relocate::relocate): Use symbolic names instead of numeric relocation
6337         codes to report error.
6338         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6339         workaround.
6340         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6341         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6342         thumb2_blx_out_of_range.stdout
6343         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6344         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6345         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6346         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6347         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6348         thumb2_blx_in_range, thumb2_blx_in_range.o,
6349         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6350         thumb2_blx_out_of_range.o): New rules.
6351         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6352         thumb2_blx_in_range and thumb2_blx_out_of_range.
6353         * testsuite/Makefile.in: Regenerate.
6354         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6355         * testsuite/thumb_blx_in_range.s: New file.
6356         * testsuite/thumb_blx_out_of_range.s: New file.
6357
6358 2010-03-22  Rafael Espindola  <espindola@google.com>
6359
6360         * archive.cc (Should_include): Move to archive.h.
6361         (should_include_member): Make it a member of Archive.
6362         (Lib_group): New.
6363         (Add_lib_group_symbols): New.
6364         * archive.h: Include options.h.
6365         (Archive_member): Moved from Archive.
6366         (Should_include): Moved from archive.cc.
6367         (Lib_group): New.
6368         (Add_lib_group_symbols): New.
6369         * dynobj.cc (do_should_include_member): New.
6370         * dynobj.h (do_should_include_member): New.
6371         * gold.cc (queue_initial_tasks): Update call to queue.
6372         * main.cc (main): Print lib group stats.
6373         * object.cc (do_should_include_member): New.
6374         * object.h: Include archive.h.
6375         (Object::should_include_member): New.
6376         (Object::do_should_include_member): New.
6377         (Sized_relobj::do_should_include_member): New.
6378         * options.cc (General_options::parse_start_lib): New.
6379         (General_options::parse_end_lib): New.
6380         (Input_arguments::add_file): Handle lib groups.
6381         (Input_arguments::start_group): Check we are not in a lib.
6382         (Input_arguments::start_lib): New.
6383         (Input_arguments::end_lib): New.
6384         * options.h (General_options): Add start_lib and end_lib.
6385         (Input_argument::lib_): New.
6386         (Input_argument::lib): New.
6387         (Input_argument::is_lib): New.
6388         (Input_file_lib): New.
6389         (Input_arguments::in_lib_): New.
6390         (Input_arguments::in_lib): New.
6391         (Input_arguments::start_lib): New.
6392         (Input_arguments::end_lib_): New.
6393         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6394         in unused members as preempted.
6395         (Sized_pluginobj::do_should_include_member): New.
6396         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6397         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6398         return the blocker.
6399         (Read_symbols::do_whole_lib_group): New.
6400         (Read_symbols::do_lib_group): New.
6401         (Read_symbols::do_read_symbols): Handle lib groups.
6402         (Read_symbols::get_name): Handle lib groups.
6403         * readsyms.h (Read_symbols): Add an archive member pointer.
6404         (Read_symbols::do_whole_lib_group): New.
6405         (Read_symbols::do_lib_group): New.
6406         (Read_symbols::member_): New.
6407         * script.cc (read_input_script): Update call to queue_soon.
6408
6409 2010-03-19  Doug Kwan  <dougkwan@google.com>
6410
6411         * arm.cc (Stub_table::Stub_table): Initialize new data members
6412         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6413         (Stub_table::add_reloc_stub): Assign stub offset and update
6414         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6415         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6416         New data members.
6417         (Stub_table::update_data_size_and_addralign): Use
6418         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6419         instead of going over all reloc stubs.
6420         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6421         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6422         Stringpool_template::offset_ to size of Stringpool_char.
6423         (Stringpool_template::new_key_offset): Remove code to initialize
6424         Stringpool_template::offset_.
6425         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6426         Stringpool_template::offset_ to zero.
6427
6428 2010-03-15  Doug Kwan  <dougkwan@google.com>
6429
6430         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6431         offset_.
6432         (Stringpool_template::new_key_offset): New method.
6433         (Stringpool_template::add_string): Assign offsets when adding new
6434         strings.
6435         (Stringpool_template::set_string_offsets): Do not set string offsets
6436         when not optimizing.
6437         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6438         member size_.
6439         (Chunked_vector::clear): Clear size_.
6440         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6441         (Chunked_vector::size): Return size_.
6442         (Chunked_vector::push_back): Use size_ to find insert position.
6443         (Chunked_vector::size_): New data member.
6444         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6445         (Stringpool_template::new_key_offset): New method declaration.
6446         (Stringpool_template::offset_): New data member.
6447
6448 2010-03-15   Rafael Espindola  <espindola@google.com>
6449
6450         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6451         Add_symbols' constructor.
6452         * readsyms.h (Add_symbols): Remove the input_group member.
6453
6454 2010-03-10  Ian Lance Taylor  <iant@google.com>
6455
6456         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6457         target to ask whether a reference to a symbol requires a stack
6458         split.
6459         * target.h (Target::is_call_to_non_split): New function.
6460         (Target::do_is_call_to_non_split): Declare virtual function.
6461         * target.cc: Include "symtab.h".
6462         (Target::do_is_call_to_non_split): New function.
6463         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6464
6465 2010-03-10  Cary Coutant  <ccoutant@google.com>
6466
6467         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6468         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6469         (File_read::open[2]): Add whole_file_view_ to list of views.
6470         (File_read::make_view): Remove test of whole_file_view_.
6471         (File_read::find_or_make_view): Create whole_file_view_ if
6472         necessary.
6473         (File_read::clear_views): Replace bool parameter with enum;
6474         adjust all callers.  Don't delete views with permanent data;
6475         do delete cached views and views from archives if
6476         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6477         if clearing the corresponding view.
6478         * fileread.h (File_read::Clear_views_mode): New enum.
6479         (File_read::View::is_permanent_view): New method.
6480         (File_read::clear_views): Replace bool parameter
6481         with enum; adjust all callers.
6482         * options.h (General_options): Change keep_files_mapped option;
6483         add map_whole_files.
6484         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6485         releasing the file.
6486         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6487         the file.
6488
6489 2010-03-10  David S. Miller  <davem@davemloft.net>
6490
6491         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6492
6493 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6494
6495         * icf.cc (get_section_contents): Add '@' marker after processing the
6496         merge reloc.
6497
6498 2010-03-08  Doug Kwan  <dougkwan@google.com>
6499
6500         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6501         due to a conversion warning.
6502         (Arm_relobj::update_output_local_symbol_count): Check for local
6503         symbol with unset output index.
6504
6505 2010-03-05  Ian Lance Taylor  <iant@google.com>
6506
6507         * options.h (class General_options): Add --spare-dynamic-tags.
6508         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6509         --spare-dynamic-tags.
6510
6511 2010-03-05  Ian Lance Taylor  <iant@google.com>
6512
6513         * incremental.cc: Include "libiberty.h".
6514
6515 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6516
6517         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6518         function, is_info_ member.
6519         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6520         (Versions::Versions): Update caller.
6521         (Versions::define_base_version): Likewise.
6522         (Versions::add_def): Likewise.
6523
6524 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6525
6526         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6527         (Scan::possible_function_pointer_reloc): New function.
6528         (Scan::local_reloc_may_be_function_pointer): Change to call
6529         possible_function_pointer_reloc.
6530         (Scan::global_reloc_may_be_function_pointer): Ditto.
6531         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6532         relocations in ".data.rel.ro._ZTV" section.
6533         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6534         * testsuite/icf_safe_so_test.cc: Ditto.
6535         * testsuite/icf_safe_test.cc: Ditto.
6536         * testsuite/icf_safe_test.sh: Ditto.
6537
6538 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6539             Ian Lance Taylor  <iant@google.com>
6540
6541         * target-reloc.h (relocate_section): Check the symbol table index
6542         for -1U before setting the local symbol index.
6543         (scan_relocatable_relocs): If copying the relocation, record that
6544         the local symbol is required.
6545         * object.h (Symbol_value::is_output_symtab_index_set): New
6546         function.
6547         (Symbol_value::may_be_discarded_from_output_symtab): New
6548         function.
6549         (Symbol_value::has_output_symtab_entry): New function.
6550         (Symbol_value::needs_output_symtab_entry): Remove.
6551         (Symbol_value::output_symtab_index): Make sure the symbol index is
6552         set.
6553         (Symbol_value::set_output_symtab_index): Make sure the symbol
6554         index is not set.  Make sure the new index is valid.
6555         (Symbol_value::set_must_have_output_symtab_entry): New function.
6556         (Symbol_value::has_output_dynsym_entry): New function.
6557         (Symbol_value::set_output_dynsym_index): Make sure the new index
6558         is valid.
6559         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6560         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6561         local symbol if permitted.
6562         (Sized_relobj::do_finalize_local_symbols): Call
6563         is_output_symtab_index_set rather than needs_output_symtab_entry.
6564         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6565         rather than needs_output_symtab_entry.  Call
6566         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6567         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6568         is_output_symtab_index_set rather than needs_output_symtab_entry.
6569         * testsuite/discard_locals_relocatable_test.c: New file.
6570         * testsuite/discard_locals_test.sh: Test -r.
6571         * testsuite/Makefile.am (check_DATA): Add
6572         discard_locals_relocatable_test1.syms,
6573         discard_local_relocatable_test2.syms.
6574         (MOSTLYCLEANFILES): Likewise.  Also add
6575         discard_locals_relocatable_test1.lout and
6576         discard_locals_relocatable_test2.out.
6577         (discard_locals_relocatable_test1.syms): New target.
6578         (discard_locals_relocatable_test.o): New target.
6579         (discard_locals_relocatable_test1.out): New target.
6580         (discard_locals_relocatable_test2.syms): New target.
6581         (discard_locals_relocatable_test2.out): New target.
6582         (various): Add missing ../ld-new dependencies.
6583         * testsuite/Makefile.in: Rebuild.
6584
6585 2010-03-03  Nick Clifton  <nickc@redhat.com>
6586
6587         * po/fi.po: New Finnish translation.
6588
6589 2010-03-01  Doug Kwan  <dougkwan@google.com>
6590
6591         * layout.cc (Layout::Layout): Force section types of .init_array*,
6592         .preinit_array* and .fini_array* sections.
6593         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6594         Fix check of return value of std::string::find.().
6595         (Output_section::Input_section_sort_compare::operator()): Remove
6596         comment about .init_array.
6597         (Output_section::Input_section_sort_init_fini_compare::operator()):
6598         New method.
6599         (Output_section::sort_attached_input_sections): Handle .init_array
6600         and .fini_array specially.
6601         * output.h (Output_section::Inut_section_sort_compare): Update
6602         comment.
6603         (Output_section::Input_section_sort_init_fini_compare): New struct.
6604
6605 2010-02-26  Doug Kwan  <dougkwan@google.com>
6606
6607         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6608         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6609         * testsuite/debug_msg.sh: Avoid matching source line number for
6610         use of global variable undef_int.
6611
6612 2010-02-26  Doug Kwan  <dougkwan@google.com>
6613
6614         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6615         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6616         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6617         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6618         * options.cc (General_options::General_options): Initialize member
6619         fix_v4bx_.
6620         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6621         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6622         and rm_no_fix_v4bx.stdout
6623         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6624         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6625         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6626         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6627         and arm_no_fix_v4bx.
6628         * Makefile.in: Regenerate.
6629         * testsuite/arm_fix_v4bx.s: New file.
6630         * testsuite/arm_fix_v4bx.sh: Ditto.
6631
6632 2010-02-24  Doug Kwan  <dougkwan@google.com>
6633
6634         * arm.cc (Target_arm::got_section): Make the .got section the first
6635         non RELRO section in the data segment.
6636         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6637         suffixes of section names.
6638
6639 2010-02-24  Doug Kwan  <dougkwan@google.com>
6640
6641         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6642         flags and attributes merging if an input file is a binary file.
6643         * fileread.cc (Input_file::open): Record format of original file.
6644         * fileread.h (Input_file::Format): New enum type.
6645         (Input_file::Input_file): Initialize data member format_.
6646         (Input_file::format): New method definition.
6647         (Input_file::format_):: New data member.
6648
6649 2010-02-24  Doug Kwan  <dougkwan@google.com>
6650
6651         * arm.cc (Arm_output_data_got): New class.
6652         (ARM_TCB_SIZE): New constant
6653         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6654         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6655         If user uses a script with a SECTIONS clause, issue only a warning
6656         for a misplaced EXIDX input section.  Otherwise, issue an error.
6657         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6658         garbage collection.
6659         (Target_arm::got_mode_index_entry): Handle static linking.
6660         (Target_arm::Scan::local): Ditto.
6661         (Target_arm::Scan::global): Ditto.
6662         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6663         all incorrectly implemented relocations.
6664         (Target_arm::fix_exidx_coverage): Pass layout to
6665         Arm_output_section::fix_exidx_coverage.
6666         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6667         from ".ARM.exidx." and ".ARM.extab.".
6668
6669 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6670
6671         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6672         section if it does not already exist.
6673         * attributes.cc (Attributes_section_data::Attributes_section_data):
6674         Don't crash if size is zero.
6675
6676 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6677             Ian Lance Taylor  <iant@google.com>
6678
6679         * gold.cc (queue_middle_tasks): If no input files were opened,
6680         exit.
6681         * workqueue.h (Task_function::Task_function): Assert that there is
6682         a blocker.
6683
6684 2010-02-22  Doug Kwan  <dougkwan@google.com>
6685
6686         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6687         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6688         types to avoid warnings due to different uint64_t implementations
6689         on different hosts.
6690
6691 2010-02-21  Doug Kwan  <dougkwan@google.com>
6692
6693         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6694         handling of the maximum backward branch offset.
6695         (Arm_relocate_functions::thumb_branch_common): Ditto.
6696         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6697         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6698         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6699         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6700         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6701         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6702         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6703         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6704         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6705         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6706         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6707         thumb2_bl_out_of_range.o): New rules.
6708         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6709         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6710         thumb2_bl_out_of_range
6711         * testsuite/Makefile.in: Regenerate.
6712         * testsuite/arm_bl_in_range.s: New file.
6713         * testsuite/arm_bl_out_of_range.s: Ditto.
6714         * testsuite/arm_branch_in_range.sh: Ditto.
6715         * testsuite/arm_branch_range.t: Ditto.
6716         * testsuite/thumb2_branch_range.t: Ditto.
6717         * testsuite/thumb_bl_in_range.s: Ditto.
6718         * testsuite/thumb_bl_out_of_range.s: Ditto.
6719         * testsuite/thumb_branch_range.t: Ditto.
6720
6721 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6722
6723         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6724         Add reloc offset information.
6725         * icf.cc (get_section_contents): Change iterators to point to the new
6726         vectors. Add reloc offset information to the contents.
6727         * icf.h (Icf::Sections_reachable_info): New typedef.
6728         (Icf::Sections_reachable_list): New typedef.
6729         (Icf::Offset_info): New typedef.
6730         (Icf::Reloc_info): New struct typedef.
6731         (Icf::Reloc_info_list): New typedef.
6732         (Icf::symbol_reloc_list): Delete method.
6733         (Icf::addend_reloc_list): Delete method.
6734         (Icf::section_reloc_list): Delete method.
6735         (Icf::reloc_info_list): New method.
6736         (Icf::reloc_info_list_): New member.
6737
6738 2010-02-19  Doug Kwan  <dougkwan@google.com>
6739
6740         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6741         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6742         * arm.cc (Arm_relocation_functions): New forward declaration.
6743         (Target_arm::Target_arm): Initialize new data members
6744         got_mod_index_offset_ and tls_base_symbol_defined_.
6745         (Target_arm::Relocate::relocate_tls): New method.
6746         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6747          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6748         New methods.
6749         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6750         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6751         (Target_arm::got_mod_index_offset_,
6752         Target_arm::tls_base_symbol_defined_): New data members.
6753         (Target_arm::Scan::local, Target::Scan::global,
6754         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6755         relocations.
6756
6757 2010-02-18  Doug Kwan  <dougkwan@google.com>
6758
6759         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6760         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6761         text section as a parameter becuase some broken tools may not set
6762         the link in section header.
6763         (Target_arm::has_got_section): New method.
6764         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6765         without any mapping symbol as data only.  Remove warning.
6766         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6767         link in its section header, try to discover the link by inspecting the
6768         REL31 relocation at the beginning of the section.
6769         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6770         in error message.
6771         (Target_arm::Scan::global): Treat any reference to the symbol
6772         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6773
6774 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6775
6776         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6777         (Scan::global_reloc_may_be_function_pointer): New function.
6778         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6779         (Scan::global_reloc_may_be_function_pointer): New function.
6780         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6781         (Scan::global_reloc_may_be_function_pointer): New function.
6782         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6783         (Scan::global_reloc_may_be_function_pointer): New function.
6784         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6785         (Scan::global_reloc_may_be_function_pointer): New function.
6786         (Scan::possible_function_pointer_reloc): New function.
6787         (Target_x86_64::can_check_for_function_pointers): New function.
6788         * gc.h (gc_process_relocs): Scan relocation types to determine if
6789         function pointers were taken for targets that support it.
6790         * icf.cc (Icf::find_identical_sections): Include functions for
6791         folding in safe ICF whose pointer is not taken.
6792         * icf.h (Secn_fptr_taken_set): New typedef.
6793         (fptr_section_id_): New member.
6794         (section_has_function_pointers): New function.
6795         (set_section_has_function_pointers): New function.
6796         (check_section_for_function_pointers): New function.
6797         * options.h: Fix comment for safe ICF option.
6798         * target.h (can_check_for_function_pointers): New function.
6799         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6800         Modify icf_safe_test for X86-64.
6801         * testsuite/Makefile.in: Regenerate.
6802         * testsuite/icf_safe_so_test.cc: New file.
6803         * testsuite/icf_safe_so_test.sh: New file.
6804         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6805         (main): Change to take pointer to function kept_func_3.
6806         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6807         folding is done correctly for X86-64.
6808
6809 2010-02-12  David S. Miller  <davem@davemloft.net>
6810
6811         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6812         is_symbolless parameter.
6813         (Output_reloc<SHT_REL>::is_symbolless): New.
6814         (Output_reloc<SHT_REL>::is_symbolless_): New.
6815         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6816         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6817         (Output_reloc<SHT_RELA>::is_symbolless): New.
6818         (Output_data_reloc::add_global): Handle is_symbolless.
6819         (Output_data_reloc::add_global_relative): Likewise.
6820         (Output_data_reloc::add_local): Likewise.
6821         (Output_data_reloc::add_local_relative): Likewise.
6822         (Output_data_reloc::add_symbolless_global_addend): New.
6823         (Output_data_reloc::add_symbolless_local_addend): New.
6824         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6825         is_symbolless.
6826         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6827         instead of ->is_relative_
6828         (Output_reloc::write): Likewise.
6829         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6830         (Output_reloc::write_rel): Simplify.
6831
6832         * sparc.cc (Target_sparc::Scan::local): Use
6833         ->add_symbolless_local_addend as needed.
6834         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6835         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6836         based upon relocation offset.
6837
6838 2010-02-11  Doug Kwan  <dougkwan@google.com>
6839
6840         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6841         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6842         beginning of function.
6843         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6844         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6845         parameter is_32bit in calls to should_apply_static_reloc.
6846         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6847         (check_DATA): Add arm_abs_global.stdout.
6848         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6849         arm_abs_global.stdout): New rules.
6850         (MOSTLLYCLEANFILES): Add arm_abs_global
6851         * Makefile.in: Regenerate.
6852         * testsuite/arm_abs_global.s: New file.
6853         * testsuite/arm_abs_global.sh: Ditto.
6854         * testsuite/arm_abs_lib.s: Ditto.
6855
6856 2010-02-11  Ian Lance Taylor  <iant@google.com>
6857
6858         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6859         Read_relocs task.
6860         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6861         Allocate_commons_task first.
6862         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6863         task, rather than symtab_lock_.
6864         (Gc_process_relocs::~Gc_process_relocs): New function.
6865         (Gc_process_relocs::is_runnable): Check this_blocker_.
6866         (Gc_process_relocs::locks): Use next_blocker_ rather than
6867         blocker_.
6868         (Scan_relocs::~Scan_relocs): New function.
6869         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6870         symtab_lock_.
6871         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6872         next_blocker_.
6873         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6874         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6875         constructor accordingly.
6876         (class Gc_process_relocs): Likewise.
6877         (class Scan_relocs): Likewise.
6878         * common.h (class Allocate_commons_task): Remove symtab_lock_
6879         field, and corresponding constructor parameter.
6880         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6881         symtab_lock_.
6882         (Allocate_commons_task::locks): Likewise.
6883
6884 2010-02-11  Ian Lance Taylor  <iant@google.com>
6885
6886         * gold-threads.h (class Once): Define.
6887         (class Initialize_lock): Rewrite as child of Once.
6888         * gold-threads.cc (class Once_initialize): Define.
6889         (once_pointer_control): New static variable.
6890         (once_pointer, once_arg): New static variables.
6891         (c_run_once): New static function.
6892         (Once::Once, Once::run_once, Once::internal_run): New functions.
6893         (class Initialize_lock_once): Remove.
6894         (initialize_lock_control): Remove.
6895         (initialize_lock_pointer): Remove.
6896         (initialize_lock_once): Remove.
6897         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6898         (Initialize_lock::initialize): Rewrite.
6899         (Initialize_lock::do_run_once): New function.
6900         * archive.cc (Archive::interpret_header): Only clear name if it is
6901         not already empty.
6902         * fileread.cc: Include "gold-threads.h"
6903         (file_counts_lock): New static variable.
6904         (file_counts_initialize_lock): Likewise.
6905         (File_read::release): Only increment counts when using --stats.
6906         Use a lock around the increment.
6907         * parameters.cc (class Set_parameters_target_once): Define.
6908         (set_parameters_target_once): New static variable.
6909         (Parameters::Parameters): Move here from parameters.h.
6910         (Parameters::set_target): Rewrite.
6911         (Parameters::set_target_once): New function.
6912         (Parameters::clear_target): Move here and rewrite.
6913         * parameters.h (class Parameters): Update declarations.  Add
6914         set_parameters_target_once_ field.
6915         (Parameters::Parameters): Move to parameters.cc.
6916         (Parameters::clear_target): Likewise.
6917         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6918         task.
6919         (Start_group::~Start_group): New function.
6920         (Start_group::is_runnable): New function.
6921         (Start_group::locks, Start_group::run): New functions.
6922         (Finish_group::run): Change saw_undefined to size_t.
6923         * readsyms.h (class Start_group): Define.
6924         (class Finish_group): Change saw_undefined_ field to size_t.
6925         (Finish_group::Finish_group): Remove saw_undefined and
6926         this_blocker parameters.  Change all callers.
6927         (Finish_group::set_saw_undefined): New function.
6928         (Finish_group::set_blocker): New function.
6929         * symtab.h (class Symbol_table): Change saw_undefined to return
6930         size_t.  Change saw_undefined_ field to size_t.
6931         * target-select.cc (Set_target_once::do_run_once): New function.
6932         (Target_selector::Target_selector): Initialize set_target_once_
6933         field.  Don't initialize lock_ and initialize_lock_ fields.
6934         (Target_selector::instantiate_target): Rewrite.
6935         (Target_selector::set_target): New function.
6936         * target-select.h (class Set_target_once): Define.
6937         (class Target_selector): Update declarations.  Make
6938         Set_target_once a friend.  Remove lock_ and initialize_lock_
6939         fields.  Add set_target_once_ field.
6940
6941 2010-02-10  Ian Lance Taylor  <iant@google.com>
6942
6943         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6944         queueing any tasks.
6945         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6946         (queue_middle_tasks): Add all blockers before queueing any tasks.
6947         (queue_final_tasks): Likewise.
6948         * token.h (Task_token::add_blockers): New function.
6949         * object.h (Input_objects::number_of_relobjs): New function.
6950
6951 2010-02-10  Ian Lance Taylor  <iant@google.com>
6952
6953         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6954         shared, not if not position independent.
6955         * x86_64.cc (Relocate::relocate_tls): Likewise.
6956         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6957         (tls_pie_pic_test): New target.
6958         * testsuite/Makefile.in: Rebuild.
6959
6960         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6961         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6962         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6963         * testsuite/Makefile.in: Rebuild.
6964
6965 2010-02-09  David S. Miller  <davem@davemloft.net>
6966
6967         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6968         R_SPARC_RELATIVE using ->add_local_relative().
6969         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6970
6971         * output.h (Output_data_dynamic::add_section_size): New method
6972         that takes two Output_data objects.
6973         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6974         entry param.  Handle it in initializers.
6975         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6976         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6977         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6978         arg.
6979         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6980         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6981         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6982         for dynrel_includes_plt.
6983         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6984         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6985         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6986         before .rela.plt
6987         (Target_sparc::do_finalize_sections): Update to pass true for
6988         dynrel_includes_plt.
6989         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6990         output before .rela.plt
6991         (Target_powerpc::do_finalize_sections): Update to pass true for
6992         dynrel_includes_plt when 32-bit.
6993
6994 2010-02-08  Doug Kwan  <dougkwan@google.com>
6995
6996         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6997         method.
6998         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6999         Arm_relobj::scan_section_for_cortex_a8_stubs,
7000         Arm_relobj::do_relocation_section): Instead of calling
7001         Output_section::output_address, use faster
7002         Arm_relobj::simple_input_section_output_address.
7003
7004 2010-02-08  David S. Miller  <davem@davemloft.net>
7005
7006         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7007         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7008         relocation helper function.
7009
7010         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7011         just like R_SPARC_GOT{10,13,22}.
7012         (Target_sparc::Scan::local): Likewise.
7013         (Target_sparc::Relocate:relocate): Likewise.
7014
7015 2010-02-06  Ian Lance Taylor  <iant@google.com>
7016
7017         * configure.ac: Rewrite targetobjs duplicate removal code to use
7018         only shell constructs.
7019         * configure: Rebuild.
7020
7021 2010-02-05  Doug Kwan  <dougkwan@google.com>
7022
7023         PR 11247
7024         * arm.cc (Arm_relobj::section_is_scannable): New method.
7025         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7026         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7027
7028 2010-02-04  Doug Kwan  <dougkwan@google.com>
7029
7030         PR 11247
7031         * arm-reloc-property.cc (cstdio): Include.
7032         * configure.ac (targetobjs): Remove duplicates.
7033         * configure: Regenerate.
7034         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7035         big and little endian version for a given address size.
7036
7037 2010-02-03  Doug Kwan  <dougkwan@google.com>
7038
7039         * arm-reloc-property.cc
7040         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7041         definition.
7042         * arm-reloc-property.h
7043         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7044         New method definition.
7045         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7046         declaration.
7047         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7048         overflow to N.
7049         (GOT_PREL): Change implemented to Y.
7050         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7051         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7052         (Arm_relocate_functions::movw_abs_nc): Remove method.
7053         (Arm_relocate_functions::movt_abs): Ditto.
7054         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7055         (Arm_relocate_functions::thm_movt_abs): Ditto.
7056         (Arm_relocate_functions::movw_rel_nc): Ditto.
7057         (Arm_relocate_functions::movw_rel): Ditto.
7058         (Arm_relocate_functions::movt_rel): Ditto.
7059         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7060         (Arm_relocate_functions:thm_movw_rel): Ditto.
7061         (Arm_relocate_functions:thm_movt_rel): Ditto.
7062         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7063         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7064         New method definitions.
7065         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7066         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7067         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7068         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7069         (Target_arm::Relocate::relocate): Check for non-static or
7070         unimplemented relocation code and exit early.  Change calls to
7071         Target_arm::reloc_uses_thumb_bit and
7072         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7073         instead.  Refactor code to handle similar relocations to increase
7074         code sharing.  Remove check for unsupported relocation code in switch
7075         statement.
7076         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7077         relocation property table to find out size.  Change error message to
7078         print out the name of a relocation code instead of the numeric value.
7079         (Target_arm::scan_reloc_for_stub): Use relocation property table
7080         instead of calling Target_arm::reloc_uses_thumb_bit().
7081
7082 2010-02-02  Doug Kwan  <dougkwan@google.com>
7083
7084         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7085         types of relaxed input section.
7086
7087 2010-02-02  Doug Kwan  <dougkwan@google.com>
7088
7089         * Makefile.am (HFILES): Add arm-reloc-property.h.
7090         (DEFFILES): New.
7091         (TARGETSOURCES): Add arm-reloc-property.cc
7092         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7093         (libgold_a_SOURCES): $(DEFFILES)
7094         * Makefile.in: Regenerate.
7095         * arm-reloc-property.cc: New file.
7096         * arm-reloc-property.h: New file.
7097         * arm-reloc.def: New file.
7098         * arm.cc: Update comments.
7099         (arm-reloc-property.h): New included header.
7100         (arm_reloc_property_table): New global variable.
7101         (Target_arm::do_select_as_default_target): New method definition.
7102         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7103         arm-reloc-property to targ_extra_obj.
7104         * parameters.cc (set_parameters_target): Call
7105         Target::select_as_default_target().
7106         * target.h (Target::select_as_default_target): New method definition.
7107         (Target::do_select_as_default_target): Same.
7108
7109 2010-02-01  Doug Kwan  <dougkwan@google.com>
7110
7111         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7112         first_output_text_section_.
7113         (Arm_exidx_fixup::first_output_text_section): New method definition.
7114         (Arm_exidx_fixup::first_output_text_section_): New data member.
7115         (Arm_exidx_fixup::process_exidx_section): Record the first text
7116         output section seen.
7117         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7118         and entsize in output section header.
7119
7120 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7121
7122         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7123         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7124         (Arm_relocate_functions::thm_alu11): New Method.
7125         (Arm_relocate_functions::thm_pc8): New Method.
7126         (Arm_relocate_functions::thm_pc12): New Method.
7127         (Target_arm::Scan::local): Handle the relocations.
7128         (Target_arm::Scan::global): Likewise.
7129         (Target_arm::Relocate::relocate): Likewise.
7130         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7131
7132 2010-01-29  Doug Kwan  <dougkwan@google.com>
7133
7134         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7135         of relocation types as ld.
7136
7137 2010-01-29  Doug Kwan  <dougkwan@google.com>
7138
7139         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7140         to public.
7141         (Arm_relocate_functions::thumb_branch_common): Ditto.
7142         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7143         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7144         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7145         Arm_relocate_functions::jump24): Remove.
7146         (Target_arm::Relocate::relocate): Adjust code to call
7147         Arm_relocation_functions::arm_branch_common and
7148         Arm_relocation_functions::thumb_branch_common instead of their removed
7149         wrappers.  Merge switch-cases together to reduce source code size.
7150
7151 2010-01-29  Doug Kwan  <dougkwan@google.com>
7152
7153         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7154         output_local_symbol_count_needs_update_.
7155         (Arm_relobj::output_local_symbol_count_needs_update,
7156          Arm_relobj::set_output_local_symbol_count_needs_update,
7157          Arm_relobj::update_output_local_symbol_count): New methods.
7158         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7159         member.
7160         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7161         of pointed function as in a R_ARM_PREL31 relocation.
7162         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7163         for output local symbol count updating.
7164         (Target_arm::do_relax): Update output local symbol counts in objects
7165         if necessary.
7166         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7167
7168 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7169
7170         * arm.cc: Added support for the ARM relocations:
7171         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7172         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7173         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7174         movw_prel_nc).
7175         (Arm_relocate_functions::movw_rel): New method.
7176         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7177         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7178         thm_movw_prel_nc).
7179         (Arm_relocate_functions::thm_movw_rel): New method.
7180         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7181         thm_movt_prel).
7182         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7183         relocations.
7184         (Target_arm::Scan::global): Likewise.
7185         (Target_arm::Relocate::relocate): Likewise.
7186         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7187         Likewise.
7188
7189 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7190
7191         * arm.cc: Added support for ARM group relocations.
7192         (Target_arm::reloc_needs_sym_origin): New method.
7193         (Arm_relocate_functions::calc_grp_kn): New method.
7194         (Arm_relocate_functions::calc_grp_residual): New method.
7195         (Arm_relocate_functions::calc_grp_gn): New method.
7196         (Arm_relocate_functions::arm_grp_alu): New Method.
7197         (Arm_relocate_functions::arm_grp_ldr): New Method.
7198         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7199         (Arm_relocate_functions::arm_grp_ldc): New Method.
7200         (Target_arm::Scan::local): Handle the ARM group relocations.
7201         (Target_arm::Scan::global): Likewise.
7202         (Target_arm::Relocate::relocate): Likewise.
7203         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7204         Likewise.
7205
7206 2010-01-26  Doug Kwan  <dougkwan@google.com>
7207
7208         * arm.cc (set): Include.
7209         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7210         pointer type.
7211         (Arm_output_section::Text_section_list): New type.
7212         (Arm_output_section::append_text_sections_to_list): New method.
7213         (Arm_output_section::fix_exidx_coverage): Ditto.
7214         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7215         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7216         Relobj::set_section_offset() instead of
7217         Sized_relobj::invalidate_section_offset().
7218         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7219         parameter for section headers. Ignore relocation sections for
7220         unallocated sections and EXIDX sections.
7221         (Target_arm::fix_exidx_coverage): New method.
7222         (Target_arm::output_section_address_less_than): New type.
7223         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7224         linked text section instead of the EXIDX section.
7225         (Arm_output_section::create_stub_group): Add an assertion to check
7226         that this is not an EXIDX output section.
7227         (Arm_output_section::append_text_sections_to_list): New method.
7228         (Arm_output_section::fix_exidx_coverage): Ditto.
7229         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7230         Arm_relobj::section_needs_reloc_stub_scanning.
7231         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7232         first pass.
7233         (Target_arm::fix_exidx_coverage): New method.
7234         * object.h (Relobj::set_output_section): New method.
7235         (Sized_relobj::invalidate_section_offset): Remove method.
7236         (Sized_relobj::do_invalidate_section_offset): Remove method.
7237         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7238
7239 2010-01-25  Doug Kwan  <dougkwan@google.com>
7240
7241         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7242         Fix warning due to signed and unsigned comparison on a 32-bit host.
7243
7244 2010-01-22  Doug Kwan  <dougkwan@google.com>
7245
7246         * arm.cc (Target_arm::do_relax): Record an output section for section
7247         offset adjustment it contains any stub table that has changed.
7248         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7249         offsets in an output section if necessary.
7250         * output.cc (Output_section::Output_section): Initialize
7251         section_offsets_need_adjustments_.
7252         (Output_section::add_input_section_for_script): Renamed to
7253         Output_section::add_simple_input_section.
7254         (Output_section::save_states): Add a comment.
7255         (Output_section::discard_states): New method defintion.
7256         (Output_section::adjust_section_offsets): Same.
7257         * output.h (Output_section::add_input_section_for_script): Renamed to
7258         Output_section::add_simple_input_section.
7259         (Output_section::discard_states): New method declaration.
7260         (Output_section::adjust_section_offsets): Same.
7261         (Output_section::section_offsets_need_adjustment,
7262         Output_section::set_section_offsets_need_adjustment): New method
7263         definitions.
7264         (Output_section::section_offsets_need_adjustment_): New data member.
7265         * script-sections.cc
7266         (Output_section_element_input::set_section_address): Adjust code for
7267         renaming of Output_section::add_input_section_for_script.
7268         (Orphan_output_section::set_section_address): Same.
7269
7270 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7271
7272         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7273         Fix_v4bx enum values .
7274         * gold/options.h (General_options): New option definitions.
7275         (General_options::fix_v4bx): New method.
7276         (General_options::Fix_v4bx): New enum.
7277         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7278         (General_options::parse_fix_v4bx_interworking): New method.
7279
7280 2010-01-22  Doug Kwan  <dougkwan@google.com>
7281
7282         * arm.cc (Arm_exidx_fixup): New class.
7283
7284 2010-01-21  Doug Kwan  <dougkwan@google.com>
7285
7286         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7287         classes.
7288         (Arm_exidx_section_offset_map): New type.
7289
7290 2010-01-21  Doug Kwan  <dougkwan@google.com>
7291
7292         * arm.cc (Arm_exidx_input_section): New class.
7293         (Arm_relobj::exidx_input_section_by_link,
7294         Arm_relobj::exidx_input_section_by_shndx,
7295         Arm_relobj::make_exidx_input_section): New methods.
7296         (read_arm_attributes_section): Remove.
7297         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7298         information about them.
7299         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7300         to here.
7301
7302 2010-01-20  Doug Kwan  <dougkwan@google.com>
7303
7304         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7305         Input_section_specifier to Section_id.
7306         (Target_arm::new_arm_input_section: Adjust code for change of key
7307         type.
7308         (Target_arm::find_arm_input_section): Ditto.
7309         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7310         (Section_id): Remove.
7311         (Garbage_collection::Section_id_hash): Remove.
7312         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7313         (Section_id): Remove.
7314         (Icf::Section_id_hash): Remove.
7315         * object.h (Section_id, Const_section_id, Section_id_hash,
7316         Const_section_id_hash): New type definitions.
7317         * output.cc (Output_section::add_relaxed_input_section): Change to
7318         use Const_section_id instead of Input_section_specifier as key type.
7319         (Output_section::add_merge_input_section): Ditto.
7320         (Output_section::build_relaxation_map): Change to use Section_id
7321         instead of Input_section_specifier as key type.
7322         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7323         Ditto.
7324         (Output_section::convert_input_sections_to_relaxed_sections): Change
7325         to use Const_section_id instead of Input_section_specifier as key type.
7326         (Output_section::find_merge_section): Ditto.
7327         (Output_section::find_relaxed_input_section): Ditto.
7328         * output.h (Input_section_specifier): Remove class.
7329         (Output_section::Output_section_data_by_input_section_map): Change
7330         key type to Const_section_id.
7331         (Output_section::Output_relaxed_input_section_by_input_section_map):
7332         Ditto.
7333         (Output_section::Relaxation_map): Change key type to Section_id.
7334
7335 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7336
7337         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7338         (class Arm_v4bx_stub): New class.
7339         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7340         (Stub_factory::make_arm_v4bx_stub): New method.
7341         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7342         (Stub_table::empty): Handle v4bx stubs.
7343         (Stub_table::add_arm_v4bx_stub): New method.
7344         (Stub_table::find_arm_v4bx_stub): New method.
7345         (Arm_relocate_functions::v4bx): New method.
7346         (Target_arm::fix_v4bx): New method.
7347         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7348         (Stub_table::relocate_stubs): Likewise.
7349         (Stub_table::do_write): Likewise.
7350         (Stub_table::update_data_size_and_addralign): Likewise.
7351         (Stub_table::finalize_stubs):  Likewise.
7352         (Target_arm::Scan::local): Likewise.
7353         (Target_arm::Scan::global): Likewise.
7354         (Target_arm::do_finalize_sections): Likewise.
7355         (Target_arm::Relocate::relocate): Likewise.
7356         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7357         Likewise.
7358         (Target_arm::scan_reloc_for_stub): Likewise.
7359         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7360
7361 2010-01-19  Ian Lance Taylor  <iant@google.com>
7362
7363         * output.cc (Output_section_headers::do_sized_write): Write large
7364         segment count to sh_info field.
7365         (Output_file_header::do_sized_write): For large segment count,
7366         write PN_XNUM to e_phnum field.
7367
7368 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7369
7370         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7371         (Arm_relocate_functions::thm_jump8): New function.
7372         (Arm_relocate_functions::thm_jump11): New function.
7373         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7374         R_ARM_THM_JUMP11.
7375         (Target_arm::Scan::global): Likewise.
7376         (Target_arm::Relocate::relocate): Likewise.
7377         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7378         Likewise.
7379
7380 2010-01-14  Doug Kwan  <dougkwan@google.com>
7381
7382         * arm.cc (map, utility): Include headers.
7383         (Target_arm::apply_cortex_a8_workaround): New method.
7384         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7385         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7386         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7387         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7388         the --[no-]fix-cortex-a8 command line options.
7389         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7390         (Target_arm::relocate_stub): Use addend in instruction template.
7391         * options.h (DEFINE_bool): Set the user-set flag.
7392         (General_options): Add --[no-]-fix-cortex options.
7393         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7394         : Update fast look-up map after conversion.
7395
7396 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7397
7398         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7399         in the first pass of do_layout.
7400
7401 2010-01-13  Doug Kwan  <dougkwan@google.com>
7402
7403         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7404         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7405         apparent compiler problem of not folding static constant integral
7406         data members of elfcpp::Elf_sizes<32>.
7407
7408 2010-01-13  Doug Kwan  <dougkwan@google.com>
7409
7410         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7411         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7412         Arm_relobj::scan_section_for_cortex_a8_erratum,
7413         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7414         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7415         sections to scan for relocation stubs into a new method
7416         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7417         relocation and Cortex-A8 stub scanning.
7418         (Target_arm::do_relax): Force stubs to be after stubbed sections
7419         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7420         the beginning of a new relaxation pass.  Update a comment.
7421         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7422
7423 2010-01-12  Ian Lance Taylor  <iant@google.com>
7424
7425         * target-reloc.h (visibility_error): New inline function.
7426         (relocate_section): Call visibility_error.
7427         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7428         (MOSTLYCLEANFILES): Likewise.
7429         (protected_4_pic.o, protected_3.err): New targets.
7430         * testsuite/protected_4.cc: New file.
7431
7432 2010-01-12  Doug Kwan  <dougkwan@google.com>
7433
7434         * arm.cc (Cortex_a8_reloc): New class.
7435         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7436         and cortex_a8_relocs_info_.
7437         (Target_arm::fix_cortex_a8): New method definition.
7438         (Target_arm::Cortex_a8_relocs_info): New type.
7439         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7440         New data member declarations.
7441         (Target_arm::scan_reloc_for_stub): Record information about
7442         relocations for THUMB branches that might be exempted from the
7443         Cortex-A8 workaround.
7444         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7445         at the beginning of a relaxation pass.
7446
7447 2010-01-12  Doug Kwan  <dougkwan@google.com>
7448
7449         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7450         (Arm_relobj::Mapping_symbol_position,
7451          Arm_reloj::Mapping_symbol_position_less,
7452          Arm_relobj::Mapping_symbols_info): New types.
7453         (Target_arm::is_mapping_symbol_name): New method definition.
7454         (Arm_relobj::do_count_local_symbols): Save information about mapping
7455         symbols.
7456
7457 2010-01-11  Doug Kwan  <dougkwan@google.com>
7458
7459         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7460         Arm_relocate_functions::thumb32_branch_upper,
7461         Arm_relocate_functions::thumb32_branch_lower,
7462         Arm_relocate_functions::thumb32_cond_branch_offset,
7463         Arm_relocate_functions::thumb32_cond_branch_upper,
7464         Arm_relocate_functions::thumb32_cond_branch_lower,
7465         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7466         branch offset encoding.
7467         (Arm_relocate_functions::thumb_branch_common): Use new branch
7468         offset encoding methods to avoid code duplication.
7469         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7470         (Stub_addend_reader::operator()): Use new branch encoding method
7471         to avoid code duplication.
7472
7473 2010-01-11  Doug Kwan  <dougkwan@google.com>
7474
7475         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7476         (Target_arm::do_finalize_sections): Define special EXIDX section
7477         symbols only if referenced.
7478         * gc.h (Garbage_collection::add_reference): New method.
7479         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7480         code duplication.
7481
7482 2010-01-11  Ian Lance Taylor  <iant@google.com>
7483
7484         * script.cc (Version_script_info::build_expression_list_lookup):
7485         Change complaing about duplicate wildcard match from error to
7486         warning.
7487
7488         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7489         of 2009-12-30.
7490         (Version_script_info::Version_script_info): Initialize globs_,
7491         default_version_, default_is_global_, and exact_.  Don't
7492         initialize globals_ or locals_.
7493         (Version_script_info::build_lookup_tables): Build local symbols
7494         first.
7495         (Version_script_info::unquote): New function.
7496         (Version_script_info::add_exact_match): New function.
7497         (Version_script_info::build_expression_list_lookup): Remove lookup
7498         parameter.  Add is_global parameter.  Change all callers.  Handle
7499         wildcard pattern specially.  Unquote pattern.  Call
7500         add_exact_match.
7501         (Version_script_info::get_name_to_match): New function.
7502         (Version_script_info::get_symbol_version): New function.
7503         (Version_script_info::get_symbol_version_helper): Remove.
7504         (Version_script_info::check_unmatched_names): Call unquote.
7505         * script.h (class Version_script_info): Change get_symbol_version
7506         to be non-inline and add is_global parameter; change all callers.
7507         Rewrite symbol_is_local.  Update declarations.  Define struct
7508         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7509         Remove globals_ and locals_ members.  Add exact_, globs_,
7510         default_version_, is_global_.
7511         (Version_script_info::Glob): Remove pattern, add expression and
7512         is_global.  Update constructor.  Change all callers.
7513         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7514         default version.
7515         (Versions::symbol_section_contents): If a symbol is undefined, or
7516         defined in a dynamic object, set the version index to
7517         VER_NDX_LOCAL.
7518         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7519         symbol_is_local.
7520         (Symbol_table::add_from_pluginobj): Likewise.
7521         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7522
7523 2010-01-11  Doug Kwan  <dougkwan@google.com>
7524
7525         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7526         (incremental_dump_LDADD): Add linking option for libintl.
7527         * Makefile.in: Regenerate.
7528
7529 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7530
7531         PR gold/11144
7532         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7533         instead of -Ds.
7534         * testsuite/Makefile.in: Regenerated.
7535
7536 2010-01-10  Doug Kwan  <dougkwan@google.com>
7537
7538         * options.h (DEFINE_var): Use parentheses around argument varname__
7539         in macro body to avoid any unintended subsequent substitutions.
7540
7541 2010-01-10  Ian Lance Taylor  <iant@google.com>
7542
7543         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7544         candidates before doing symbol resolution.
7545
7546         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7547         ODR candidates if only one is weak.
7548
7549 2010-01-08  Ian Lance Taylor  <iant@google.com>
7550
7551         * script.cc (Version_script_info::build_expression_list_lookup):
7552         Don't warn about ambiguous version, just record the ambiguity.
7553         (Version_script_info::get_symbol_version_helper): Give error if
7554         version is ambiguous.
7555
7556 2010-01-08  Doug Kwan  <dougkwan@google.com>
7557
7558         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7559         prev_data_size_ and prev_addralign_.  Remove initializer for
7560         deleted data member has_been_changed_.
7561         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7562         to determine if the table is empty.
7563         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7564         Remove.
7565         (Stub_table::add_reloc_stub): Define method in class definition
7566         instead of just declaring it there.
7567         (Stub_table::add_cortex_a8_stub): New method definition.
7568         (Stub_table::update_data_size_and_addralign): Ditto.
7569         (Stub_table::finalize_stubs): Ditto.
7570         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7571         (Stub_table::do_addralign_): Return address alignment in the
7572         (Stub_table::do_reset_address_and_file_offset): Define method in
7573         class definition instead of declaring it there.  Set current data
7574         size to be the data size of the previous pass.
7575         (Stub_table::set_final_data_size): Use current data size as the
7576         final data size.
7577         (Stub_table::relocate_stub): Change parameter type of stub from
7578         Reloc_stub pointer to Stub pointer.
7579         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7580         (Stub_table::Cortex_a8_stub_list): New typedef.
7581         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7582          Stub_table::prev_addralign_): New data member.
7583         (Arm_relobj::Arm_relobj): Initialize data member
7584         section_has_cortex_a8_workaround_.
7585         (Arm_relobj::section_has_cortex_a8_workaround,
7586          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7587          definitions.
7588         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7589         declarations.
7590         (Target_arm::relocate_stub): Change parameter type of stub from
7591         Reloc_stub pointer to Stub pointer.
7592         (Insn_template::size, Insn_template::alignment): Handle
7593         THUMB16_SPECIAL_TYPE.
7594         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7595          Stub_table::update_data_size_and_addralign,
7596          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7597         definitions.
7598         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7599         (Stub_table::do_write): Ditto.
7600         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7601
7602 2010-01-08  Ian Lance Taylor  <iant@google.com>
7603
7604         PR 11108
7605         * symtab.h (class Symbol): Remove fields is_target_special_ and
7606         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7607         (Symbol::is_defined_in_discarded_section): New function.
7608         (Symbol::set_is_defined_in_discarded_section): New function.
7609         (Symbol::has_plt_offset): Rewrite.
7610         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7611         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7612         Don't initialize is_target_special_ or has_plt_offset_.
7613         Initialize is_defined_in_discarded_section_.
7614         (Symbol_table::add_from_relobj): If appropriate, set
7615         is_defined_in_discarded_section.
7616         * resolve.cc (Symbol::override_base_with_special): Don't test
7617         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7618         * target-reloc.h (relocate_section): Do special handling for
7619         symbols defined in discarded sections for global symbols as well
7620         as local symbols.
7621
7622 2010-01-08  Ian Lance Taylor  <iant@google.com>
7623
7624         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7625         the SHT_SYMTAB case.
7626
7627 2010-01-08  Ian Lance Taylor  <iant@google.com>
7628
7629         * object.cc (Sized_relobj::do_layout): Don't get confused if
7630         layout_eh_frame returns NULL.
7631
7632 2010-01-08  Ian Lance Taylor  <iant@google.com>
7633
7634         PR 11084
7635         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7636         dynamic symbol table, use the normal symbol table.
7637         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7638         symbol table.
7639
7640 2010-01-08  Ian Lance Taylor  <iant@google.com>
7641
7642         PR 11072
7643         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7644         sections.
7645
7646 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7647
7648         * version.cc (print_version): Change to "Copyright 2010".
7649
7650 2010-01-08  Ian Lance Taylor  <iant@google.com>
7651
7652         PR 10287
7653         PR 11063
7654         * i386.cc (class Target_i386): Change return type of plt_section
7655         to be non-const.
7656         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7657         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7658         tls_desc_rel_ field.
7659         (Output_data_plt_i386::rel_tls_desc): New function.
7660         (Target_i386::rel_tls_desc_section): New function.
7661         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7662         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7663         R_386_TLS_DESC reloc in rel_tls_desc_section.
7664         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7665         Define struct Tlsdesc_info.
7666         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7667         (Target_x86_64::do_reloc_symbol_index): New function.
7668         (Target_x86_64::add_tlsdesc_info): New function.
7669         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7670         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7671         tlsdesc_rel_ field.
7672         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7673         all callers.
7674         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7675         (Target_x86_64::rela_tlsdesc_section): New function.
7676         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7677         handling.
7678         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7679         (Target_x86_64::do_reloc_addend): New function.
7680         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7681         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7682         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7683         (Output_reloc::type): New function.
7684         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7685         (Output_reloc::is_target_specific): New function.
7686         (Output_reloc::target_arg): New function.
7687         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7688         absolute relocs and target specific relocs.
7689         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7690         add_target_specific.
7691         (class Output_data_reloc) [SHT_RELA]: Likewise.
7692         * output.cc (Output_reloc::Output_reloc): Add four new versions
7693         for absolute relocs and target specific relocs.
7694         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7695         (Output_reloc::get_symbol_index): Likewise.
7696         (Output_reloc::local_section_offset): Check that local_sym_index_
7697         is not TARGET_CODE or 0.
7698         (Output_reloc::symbol_value): Likewise.
7699         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7700         reloc.
7701         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7702         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7703         functions.
7704         * layout.cc (add_target_dynamic_tags): Use output section for
7705         DT_PLTRELSZ and DT_JMPREL.
7706
7707 2010-01-07  Ian Lance Taylor  <iant@google.com>
7708
7709         PR 11061
7710         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7711         function.
7712         (class Output_data_reloc_generic): Define.
7713         (class Output_data_reloc_base): Change base class to
7714         Output_data_reloc_generic.  Change add() method to call
7715         bump_relative_reloc_count for a relative reloc.  Remove
7716         sort_relocs_ field.
7717         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7718         to sort_relocs().
7719         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7720         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7721         appropriate.
7722         * layout.h (class Layout): Update declaration.
7723
7724 2010-01-07  Ian Lance Taylor  <iant@google.com>
7725
7726         * output.h (class Output_data): Add const version of
7727         output_section and do_output_section.
7728         (class Output_section_data): Add const version of
7729         do_output_section.
7730         (class Output_section): Likewise.
7731         * layout.cc (Layout::add_target_dynamic_tags): New function.
7732         * layout.h (class Layout): Update declarations.
7733         * arm.cc (Target_arm::do_finalize_sections): Use
7734         add_target_dynamic_tags.
7735         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7736         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7737         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7738         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7739
7740 2010-01-07  Ian Lance Taylor  <iant@google.com>
7741
7742         PR 11042
7743         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7744         object as needed.
7745
7746 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7747             Ian Lance Taylor  <iant@google.com>
7748
7749         PR 11019
7750         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7751         Xindex::read_symtab_xindex.
7752
7753 2010-01-07  Doug Kwan  <dougkwan@google.com>
7754
7755         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7756         (Insn_template::thumb16_bcond_insn): New method declaration.
7757         (Insn_template): Fix spelling.
7758         (Stub::thumb16_special): New method declaration.
7759         (Stub::do_write): Define virtual method which was previously pure
7760         virtual.
7761         (Stub::do_thumb16_special): New method declaration.
7762         (Stub::do_fixed_endian_write): New template member.
7763         (Reloc_stub::do_write): Remove.
7764         (Reloc_stub::do_fixed_endian_write): Remove.
7765         (Cortex_a8_stub): New class definition.
7766         (Stub_factory::make_cortex_a8_stub): New method definition.
7767         (Stub_factory::Stub_factory): Add missing static storage class
7768         qualifier for elf32_arm_stub_a8_veneer_blx.
7769
7770 2010-01-07  Ian Lance Taylor  <iant@google.com>
7771
7772         PR 10980
7773         * options.h (class General_options): Add --warn-unresolved-symbols
7774         and --error-unresolved-symbols.
7775         * errors.cc (Errors::undefined_symbol): Implement
7776         --warn-unresolved-symbols.
7777
7778         * options.h (class General_options): Add -z text and -z textoff.
7779         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7780
7781 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7782
7783         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7784         (Garbage_collection::cident_sections): New function.
7785         (Garbage_collection::add_cident_section): New function.
7786         (Garbage_collection::cident_sections_): New member.
7787         (gc_process_relocs): Add references to sections whose names are C
7788         identifiers.
7789         * gold.h (cident_section_start_prefix): New constant.
7790         (cident_section_stop_prefix): New constant.
7791         (is_cident): New function.
7792         * layout.cc (Layout::define_section_symbols): Replace string constants
7793         with the newly defined constants.
7794         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7795         C identifiers.
7796         * testsuite/Makefile.am: Add gc_orphan_section_test.
7797         * testsuite/Makefile.in: Regenerate.
7798         * testsuite/gc_orphan_section_test.cc: New file.
7799         * testsuite/gc_orphan_section_test.sh: New file.
7800
7801 2010-01-06  Ian Lance Taylor  <iant@google.com>
7802
7803         PR 10980
7804         * options.h (class General_options): Add --warn-shared-textrel.
7805         * layout.cc (Layout::finish_dynamic_section): Implement
7806         --warn-shared-textrel.
7807
7808         PR 10980
7809         * options.h (class General_options): Add --warn-multiple-gp.
7810
7811 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7812
7813         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7814         $(THREADSLIB) and $(LIBDL).
7815         * Makefile.in: Rebuild.
7816
7817 2010-01-06  Ian Lance Taylor  <iant@google.com>
7818
7819         PR 10980
7820         * options.cc (General_options::parse_section_start): New function.
7821         (General_options::section_start): New function.
7822         (General_options::General_options): Initialize all members.
7823         * options.h: Include <map>
7824         (class General_options): Add --section-start.  Add section_starts_
7825         member.
7826         * layout.cc (Layout::attach_allocated_section_to_segment): If
7827         --section-start was used, set the address of the segment.  Remove
7828         local sort_sections.
7829         (Layout::relaxation_loop_body): If the address of the load segment
7830         has been set by --section-start, don't use it.
7831         * output.h (Output_segment::update_flags_for_output_section): New
7832         function.
7833         * output.cc (Output_segment::add_output_section): Call
7834         update_flags_for_output_section.
7835
7836 2010-01-05  Ian Lance Taylor  <iant@google.com>
7837
7838         PR 10980
7839         * options.h (class General_options): Add --undefined-version.
7840         * script.cc (struct Version_expression): Add was_matched_by_symbol
7841         field.
7842         (Version_script_info::matched_symbol): New function.
7843         (Version_script_info::get_symbol_version_helper): Call
7844         matched_symbol.
7845         (Version_script_info::check_unmatched_names): New function.
7846         * script.h (class Version_script_info): Update declarations.
7847         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7848
7849         * options.h (class General_options): Use DEFINE_bool_alias for
7850         allow_multiple_definition.
7851         * resolve.cc (Symbol_table::should_override): Don't test
7852         allow_multiple_definition.
7853
7854         PR 10980
7855         * options.h (class General_options): Add --cref.
7856         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7857         until after printing cref table.
7858         * cref.cc: Include "symtab.h".
7859         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7860         (Cref_table_compare::operator()): New function.
7861         (Cref_inputs::gather_cref): New function.
7862         (filecol): New static const.
7863         (Cref_inputs::print_cref): New function.
7864         (Cref::print_cref): New function.
7865         * cref.h: Include <cstdio>.
7866         (class Cref): Update declarations.
7867         * mapfile.h (Mapfile::file): New function.
7868         * object.h (class Object): Define Symbols.  Declare virtual
7869         do_get_global_symbols.
7870         (Object::get_global_symbols): New function.
7871         * object.cc (Input_objects::add_object): Pass object to cref_ if
7872         --cref.
7873         (Input_objects::archive_start): Likewise.
7874         (Input_objects::archive_stop): Likewise.
7875         (Input_objects::print_cref): New function.
7876         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7877         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7878         --cref.
7879         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7880         function.
7881         * plugin.h (class Sized_pluginobj): Update declarations.
7882
7883 2010-01-05  Ian Lance Taylor  <iant@google.com>
7884
7885         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7886         to is_default_version.  Rename insdef to insdefault.
7887         (Symbol_table::add_from_relobj): Rename def to is_default_version
7888         and local to is_forced_local.
7889         (Symbol_table::add_from_pluginobj): Likewise.
7890         (Symbol_table::add_from_dynobj): Likewise.
7891         (Symbol_table::define_special_symbol): Rename insdef to
7892         insdefault.
7893
7894 2010-01-04  Ian Lance Taylor  <iant@google.com>
7895
7896         PR 10980
7897         * options.h (class General_options): Add
7898         --allow-multiple-definition and -z muldefs.
7899         * resolve.cc (Symbol_table::should_override): Don't warn about a
7900         multiple symbol definition if --allow-multiple-definition or -z
7901         muldefs.
7902
7903         PR 10980
7904         * options.h (class General_options): Add --add-needed and
7905         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7906         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7907         error if --copy-dt-needed-entries aka --add-needed is used and
7908         would cause a change in behaviour.
7909
7910         PR 10980
7911         * options.h (class General_options): Add -G as a short version of
7912         --shared.  Add no-op options -assert, -g, and -i.
7913
7914 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7915
7916         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7917         check for .text or .gnu.linkonce.t sections.
7918         * icf.cc (Icf::find_identical_sections): Ditto.
7919         Change the detection for mangled function name within the section
7920         name.
7921         * icf.h (is_section_foldable_candidate): New function.
7922
7923 2009-12-30  Ian Lance Taylor  <iant@google.com>
7924
7925         PR 10980
7926         * options.h (class General_options): Permit two dashes with
7927         --retain-symbols-file.
7928
7929 2009-12-30  Ian Lance Taylor  <iant@google.com>
7930
7931         PR 10979
7932         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7933         don't put the file header and segment headers in the text
7934         segment.
7935
7936         PR 10979
7937         * common.cc (Sort_commons::operator()): Stabilize sort when both
7938         entries are NULL.
7939         (Symbol_table::do_allocate_commons_list): When allocating common
7940         symbols, skip a symbol which is no longer common.
7941         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7942         an object before checking its type.
7943         * testsuite/common_test_2.c: New file.
7944         * testsuite/common_test_3.c: New file.
7945         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7946         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7947         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7948         (common_test_2_pic.o, common_test_2.so): New targets.
7949         (common_test_3_pic.o, common_test_3.so): New targets.
7950         * testsuite/Makefile.in: Rebuild.
7951
7952         PR 10979
7953         * script.cc (read_input_script): If we see a new SECTIONS clause,
7954         and we have added an input section, give an error.
7955         * layout.h (class Layout): Add have_added_input_section function.
7956         Add have_added_input_section_ field.
7957         * layout.cc (Layout::Layout): Initialize
7958         have_added_input_section_.
7959         (Layout::layout): Set have_added_input_section_.
7960         (Layout::layout_eh_frame): Likewise.
7961
7962 2009-12-30  Ian Lance Taylor  <iant@google.com>
7963
7964         PR 10931
7965         * options.h (class General_options): Add --sort-common option.
7966         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7967         * common.cc (Sort_common): Add sort_order parameter to
7968         constructor.  Add sort_order_ field.
7969         (Sort_commons::operator): Check sort_order_.
7970         (Symbol_table::allocate_commons): Determine the sort order.
7971         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7972         Change all callers.
7973         (Symbol_table::do_allocate_commons_list): Likewise.
7974
7975 2009-12-30  Ian Lance Taylor  <iant@google.com>
7976
7977         PR 10916
7978         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7979         symbols from this object, don't change the visibility of an
7980         undefined symbol.
7981         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7982
7983 2009-12-30  Ian Lance Taylor  <iant@google.com>
7984
7985         PR 10861
7986         * script.h (class Version_script_info): Define Language enum.
7987         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7988         new fields globals_, locals_, and is_finalized_.
7989         * script.cc: Various formatting fixes.
7990         (class Parser_closure): Change language_stack_ from a vector of
7991         std::string to one of Version_script_info::Language.  Adjust all
7992         uses accordingly.
7993         (class Lazy_demangler): Remove.
7994         (struct Version_expression): Change language from std::string to
7995         Version_script_info::Language.
7996         (Version_script_info::Version_script_info): New function.
7997         (Version_script_info::~Version_script_info): Don't call clear.
7998         (Version_script_info::finalize): New function.
7999         (Version_script_info::build_lookup_tables): New function.
8000         (Version_script_info::build_expression_list_lookup): New
8001         function.
8002         (Version_script_info::get_symbol_version_helper): Rewrite to use
8003         lookup tables.
8004         (Version_script_info::print_expression_list): Adjust to use
8005         Version_script_info::Language.
8006         (script_push_lex_into_version_mode): Check that the version script
8007         has not been finalized.
8008         (version_script_push_lang): Change language string to
8009         Version_script_info::Language.
8010         * options.cc (Command_line::version_script): New function.
8011         * options.h (class General_options): Add finalize_dynamic_list
8012         function.  Change version_script from declaration to definition.
8013         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8014         * testsuite/version_script.map: Remove duplicate def of foo.
8015         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8016         version_script.map.
8017         * testsuite/Makefile.in: Rebuild.
8018
8019 2009-12-30  Ian Lance Taylor  <iant@google.com>
8020
8021         PR 10843
8022         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8023         if the input symbol index is 0, make the output symbol index 0.
8024
8025 2009-12-30  Ian Lance Taylor  <iant@google.com>
8026
8027         PR 10670
8028         * options.h (class General_options): Add -x/--discard-all.
8029         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8030         --discard-all.  If the local symbol needs a dynamic entry, check
8031         that before handling --discard-locals.
8032
8033 2009-12-30  Ian Lance Taylor  <iant@google.com>
8034
8035         PR 10450
8036         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8037         flags to PF_R.
8038         (Output_segment::add_output_section): Don't change the flags if
8039         the type is PT_TLS.
8040
8041         PR 10450
8042         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8043         GNU hash table if they need a dynamic value.  Otherwise, don't add
8044         them if they are defined in a dynamic object or are forced local.
8045
8046 2009-12-29  Ian Lance Taylor  <iant@google.com>
8047
8048         PR 10450
8049         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8050         .gnu.hash table for a 32-bit target.
8051
8052         PR 10450
8053         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8054         regular and a dynamic object only needs a dynamic symbol table
8055         entry if it is externally visible.
8056
8057         PR 10450
8058         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8059         constructor.  Add global_offset_table_ field.
8060         (Target_i386::got_section): Set global_offset_table_.
8061         (Target_i386::do_finalize_sections): Set global_offset_table_
8062         size.
8063         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8064         in constructor.  Add global_offset_table_ field.
8065         (Target_x86_64::got_section): Set global_offset_table_.
8066         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8067         size.
8068
8069         * layout.cc (Layout::Layout): Initialize increase_relro_.
8070         (Layout::get_output_section): Add is_relro, is_last_relro, and
8071         is_first_non_relro parameters.  Change all callers.
8072         (Layout::choose_output_section): Likewise.
8073         (Layout::add_output_section_data): Likewise.
8074         (Layout::make_output_section): Likewise.
8075         (Layout::set_segment_offsets): Clear increase_relro when using a
8076         linker script.
8077         * layout.h (class Layout): Add increase_relro method.  Add
8078         increase_relro_ field.  Update declarations.
8079         * output.cc (Output_section::Output_section): Initialize
8080         is_last_relro_ and is_first_non_relro_.
8081         (Output_segment::add_output_section): Group relro sections is
8082         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8083         (Output_segment::maximum_alignment): Remove relro handling.
8084         (Output_segment::set_section_addresses): Add increase_relro
8085         parameter.  Change all callers.  Add initial alignment to align
8086         relro sections on separate page.  Remove old relro handling.
8087         (Output_segment::set_section_list_addresses): Remove in_relro
8088         parameter.  Change all callers.
8089         (Output_segment::set_offset): Add increase parameter.  Change all
8090         callers.  Remove old relro handling.
8091         * output.h (class Output_section): Add new methods: is_last_relro,
8092         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8093         Add is_last_relro_ and is_first_non_relro_ fields.
8094         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8095         Create separate .got.plt section.  Call increase_relro.
8096         * x86_64.cc (Target_x86_64::got_section): Likewise.
8097         * testsuite/relro_script_test.t: Add .got.plt.
8098
8099         PR 10450
8100         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8101         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8102         (Layout::finalize): Call set_dynamic_symbol_size.
8103         (Layout::set_dynamic_symbol_size): New function.
8104         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8105         set_dynamic_symbol_size.
8106
8107         PR 10450
8108         * output.h (class Output_section): Add is_entsize_zero_ field.
8109         * output.cc (Output_section::Output_section): Initialize
8110         is_entsize_zero_.
8111         (Output_section::set_entsize): If two different entsizes are
8112         requested, force it to zero.
8113         (Output_section::add_input_section): Set flags for .debug_str
8114         before updating section flags.  Set entsize.
8115         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8116         and SHF_STRING if all input sections have those flags.
8117
8118 2009-12-29   Rafael Espindola  <espindola@google.com>
8119
8120         * main.cc (main): Fix the sys time reporting.
8121         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8122         reporting.
8123
8124 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8125
8126         * options.cc (General_options::parse_version): Allow -v to exit
8127         without an error if there is nothing to link.
8128
8129 2009-12-29  Ian Lance Taylor  <iant@google.com>
8130
8131         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8132         using a version of gcc before 4.1.
8133         * configure: Rebuild.
8134
8135 2009-12-28  Chris Demetriou  <cgd@google.com>
8136
8137         * attributes.cc (Output_attributes_section_data::do_write): Use
8138         std::vector::front rather than std::vector::data.
8139
8140 2009-12-28  Ian Lance Taylor  <iant@google.com>
8141
8142         * symtab.h (class Symbol_table): Add enum Defined.
8143         * resolve.cc (Symbol_table::should_override): Add defined
8144         parameter.  Change all callers.  Test whether object is NULL
8145         before calling a method on it.
8146         (Symbol_table::report_resolve_problem): Add defined parameter.
8147         Change all callers.
8148         (Symbol_table::should_override_with_special): Likewise.
8149         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8150         parameter.  Change all callers.
8151         (Symbol_table::do_define_in_output_data): Likewise.
8152         (Symbol_table::define_in_output_segment): Likewise.
8153         (Symbol_table::do_define_in_output_segment): Likewise.
8154         (Symbol_table::define_as_constant): Likewise.
8155         (Symbol_table::do_define_as_constant): Likewise.
8156         * script.h (class Symbol_assignment): Add is_defsym parameter to
8157         constructor; change all callers.
8158         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8159         parameter.  Change all callers.  Add is_defsym_ field.
8160         (class Parser_closure): Add parsing_defsym parameter to
8161         constructor; change all callers.  Add parsing_defsym accessor
8162         function.  Add parsing_defsym_ field.
8163
8164 2009-12-28  Ian Lance Taylor  <iant@google.com>
8165
8166         * gold.cc (queue_middle_tasks): Fix formatting.
8167         * object.cc (Relobj::is_section_name_included): Likewise.
8168
8169 2009-12-23  Ian Lance Taylor  <iant@google.com>
8170
8171         * i386.cc (Target_i386::do_calls_non_split): Recognize
8172         -fsplit-stack prologue for a function with a static chain.
8173         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8174         -fsplit-stack prologue when using %r11.
8175
8176 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8177
8178         * options.cc (General_options::parse_version): Make -v continue and do
8179         the link like GNU ld does.
8180
8181 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8182
8183         * Makefile.am (CCFILES): Add timer.cc.
8184         (HFILES): Add timer.h.
8185         * configure.ac: Check for sysconf and times.
8186         * main.cc: include timer.h.
8187         (main): Use Timer instead of get_run_time.
8188         * timer.cc: New.
8189         * timer.h: New.
8190         * workqueue.cc: include timer.h.
8191         (Workqueue::find_and_run_task):
8192         Report user, sys and wall time.
8193         * Makefile.in: Regenerate.
8194         * config.in: Regenerate.
8195         * configure: Regenerate.
8196
8197 2009-12-16  Doug Kwan  <dougkwan@google.com>
8198
8199         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8200         sections.
8201         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8202         relaxed input sections.
8203         * output.cc (Output_section::find_relaxed_input_section): Change
8204         return type to Output_relaxed_input_section pointer.  Adjust code
8205         for new type of relaxed_input_section_map_.
8206         * output.h (Output_section::find_relaxed_input_section): Change
8207         return type to Output_relaxed_input_section pointer.
8208         (Output_section::Output_relaxed_input_section_by_input_section_map):
8209         New type.
8210         (Output_section::relaxed_input_section_map_): Change type to
8211         Output_section::Output_relaxed_input_section_by_input_section_map.
8212         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8213         input section.
8214
8215 2009-12-15  Ian Lance Taylor  <iant@google.com>
8216
8217         * layout.cc (Layout::create_shstrtab): Only write out after input
8218         sections if we are compressing debug sections.
8219
8220 2009-12-15  Ian Lance Taylor  <iant@google.com>
8221
8222         * archive.cc (Archive::add_symbols): Only look up a symbol without
8223         a version if there is, in fact, a version.
8224
8225 2009-12-14  Ian Lance Taylor  <iant@google.com>
8226
8227         Revert -Wshadow changes, all changes from:
8228         2009-12-11  Doug Kwan  <dougkwan@google.com>
8229         2009-12-11  Nick Clifton  <nickc@redhat.com>
8230         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8231
8232 2009-12-11  Doug Kwan  <dougkwan@google.com>
8233
8234         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8235         due to -Wshadow.
8236         * attributes.cc (Object_attribute::size): Ditto.
8237         (Attributes_section_data::size): Ditto.
8238         (Attributes_section_data::Attributes_section_data): Ditto.
8239         (Output_attributes_section_data::do_write): Ditto.
8240         * attributes.h (Object_attribute::set_type): Ditto.
8241         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8242
8243 2009-12-11  Nick Clifton  <nickc@redhat.com>
8244
8245         * archive.cc: Fix shadowed variable warnings.
8246         * arm.cc: Likewise.
8247         * compressed_output.cc: Likewise.
8248         * compressed_output.h: Likewise.
8249         * configure: Likewise.
8250         * dwarf_reader.cc: Likewise.
8251         * dynobj.cc: Likewise.
8252         * dynobj.h: Likewise.
8253         * ehframe.cc: Likewise.
8254         * ehframe.h: Likewise.
8255         * errors.cc: Likewise.
8256         * expression.cc: Likewise.
8257         * fileread.cc: Likewise.
8258         * fileread.h: Likewise.
8259         * freebsd.h: Likewise.
8260         * i386.cc: Likewise.
8261         * icf.cc: Likewise.
8262         * incremental.h: Likewise.
8263         * layout.cc: Likewise.
8264         * layout.h: Likewise.
8265         * mapfile.cc: Likewise.
8266         * merge.cc: Likewise.
8267         * merge.h: Likewise.
8268         * object.cc: Likewise.
8269         * object.h: Likewise.
8270         * options.h: Likewise.
8271         * output.cc: Likewise.
8272         * output.h: Likewise.
8273         * parameters.cc: Likewise.
8274         * plugin.cc: Likewise.
8275         * powerpc.cc: Likewise.
8276         * reduced_debug_output.cc: Likewise.
8277         * reduced_debug_output.h: Likewise.
8278         * reloc.cc: Likewise.
8279         * reloc.h: Likewise.
8280         * resolve.cc: Likewise.
8281         * script-sections.cc: Likewise.
8282         * script.cc: Likewise.
8283         * script.h: Likewise.
8284         * sparc.cc: Likewise.
8285         * symtab.cc: Likewise.
8286         * symtab.h: Likewise.
8287         * target-select.cc: Likewise.
8288         * target-select.h: Likewise.
8289         * token.h: Likewise.
8290         * workqueue.cc: Likewise.
8291         * workqueue.h: Likewise.
8292         * x86_64.cc: Likewise.
8293
8294 2009-12-10  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (attributes.h): New include.
8297         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8298         (Arm_relobj::~Arm_relobj): Delete object pointed by
8299         attributes_section_data_.
8300         (Arm_relobj::attributes_section_data): New method definition.
8301         (Arm_relobj::attributes_section_data_): New data member declaration.
8302         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8303         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8304         attributes_section_data_.
8305         (Arm_dynobj::attributes_section_data): New method definition.
8306         (Arm_dynobj::attributes_section_data_): New data member declaration.
8307         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8308         initialization value of may_use_blx_ to false.
8309         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8310         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8311         object attributes to compute results instead of hard-coding.
8312         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8313         Target_arm::get_secondary_compatible_arch,
8314         Target_arm::set_secondary_compatible_arch
8315         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8316         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8317         New method declarations.
8318         (Target_arm::get_aeabi_object_attribute): New method definition.
8319         (Target_arm::attributes_section_data_): New data member declaration.
8320         (read_arm_attributes_section): New template definition.
8321         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8322         (Arm_dynobj::do_read_symbols): Ditto.
8323         (Target_arm::do_finalize_sections): Merge attributes sections from
8324         input.  Check for BLX use after attributes section merging.
8325         Fix __exidx_start and __exidx_end visibility.  Create an
8326         .ARM.attributes section if necessary.
8327         (Target_arm::get_secondary_compatible_arch,
8328         Target_arm::set_secondary_compatible_arch,
8329         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8330         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8331         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8332         New method definitions.
8333
8334 2009-12-09  Ian Lance Taylor  <iant@google.com>
8335
8336         * plugin.cc (Plugin::load): Don't cast from void* to a function
8337         pointer.
8338
8339 2009-12-09  Ian Lance Taylor  <iant@google.com>
8340
8341         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8342         information fields.
8343
8344 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8345
8346         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8347         Replace two_file_shared_1.so with two_file_shared_2.so.
8348         * testsuite/Makefile.in: Regenerated.
8349
8350 2009-12-08  Doug Kwan  <dougkwan@google.com>
8351
8352         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8353         (HFILES): Add attributes.h and int_encoding.h.
8354         * Makefile.in: Regenerate.
8355         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8356         function definitions to int_encoding.cc
8357         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8358         prototypes to int_encoding.h
8359         * reduced_debug_output.cc (int_encoding.h): New include.
8360         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8361         function definitions to int_encoding.cc
8362         (insert_into_vector, read_from_pointer): Move template definitions to
8363         int_encoding.h
8364         * attributes.cc: New file.
8365         * attributes.h: New file.
8366         * int_encoding.cc: New file.
8367         * int_encoding.h: New file.
8368
8369 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8370
8371         PR gold/11055
8372         * incremental-dump.cc (dump_incremental_inputs): New.
8373         (main): Use dump_incremental_inputs.
8374
8375 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8376
8377         PR gold/10893
8378         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8379         checking elfcpp::STT_FUNC.
8380         (Target_i386::Relocate::relocate): Likewise.
8381         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8382
8383         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8384         symbols from shared libraries into normal FUNC symbols.
8385
8386         * symtab.h (Symbol): Add is_func and use it.
8387
8388 2009-12-05  Doug Kwan  <dougkwan@google.com>
8389
8390         * arm.cc (Target_arm::arm_info): Initialize new fields
8391         attributes_section and attributes_vendor.
8392         * i386.cc (Target_i386::i386_info): Same.
8393         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8394         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8395         fields attributes_section and attributes_vendor.
8396         * sparc.cc (Target_sparc::sparc_info): Same.
8397         * target.h (Target::attributes_section, Target::attributes_vendor,
8398         Target::is_attributes_section, Target::attribute_arg_type,
8399         Target::attributes_order): New method definitions.
8400         (Target::Target_info::attributes_section,
8401         Target::Target_info::attributes_vendor): New fields.
8402         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8403         virtual method definitions.
8404         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8405         attributes_section and attributes_vendor.
8406         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8407
8408 2009-12-05  Doug Kwan  <dougkwan@google.com>
8409
8410         * arm.cc: Update comments about interworking and stub generation.
8411         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8412         considered as non-PIC.
8413         (Arm_relocate_functions::base_abs): Fix formatting.
8414         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8415         of function to use GOT entry address instead of offset.
8416         (Target_arm::Scan::global): Issue an error if a symbol would need a
8417         PLT does not get one because it is untyped.  Remove code to create
8418         dynamic symbols for relative branches.
8419         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8420         takes unsigned integer instead of boolean.
8421
8422 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8423
8424         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8425         (two_file_test_LDADD): Likewise.
8426         (common_test_1_LDADD): Likewise.
8427         (exception_test_LDADD) Likewise.
8428         (weak_test_LDADD): Likewise.
8429         (many_sections_test_LDADD): Likewise.
8430         (initpri1_LDADD): Likewise.
8431         (script_test_1_LDADD): Likewise.
8432         (script_test_2_LDADD): Likewise.
8433         (justsyms_LDADD): Likewise.
8434         (binary_test_LDADD): Likewise.
8435         (large_LDADD): Likewise.
8436         * testsuite/Makefile.in: Regenerated.
8437
8438 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8439
8440         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8441         (Symbol_table::override_with_special): Likewise.
8442         (Symbol_table::add_from_object): Likewise.
8443
8444 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8445
8446         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8447         Don't set the data_offset twice.
8448
8449 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8450
8451         * testsuite/Makefile.in: Regenerate.
8452
8453 2009-12-03  Doug Kwan  <dougkwan@google.com>
8454
8455         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8456         (Target_arm::do_finalize_sections): Add parameter for symbol table
8457         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8458         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8459         parameter for symbol table pointer.
8460         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8461         an additional parameter for a pointer to symbol table.
8462         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8463         parameter for a symbol table pointer.
8464         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8465         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8466         Ditto.
8467         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8468         parameter for a symbol table pointer.
8469
8470 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8471
8472         * incremental.cc (Incremental_inputs_header)
8473         (Incremental_inputs_header_write, Incremental_inputs_entry)
8474         (Incremental_inputs_entry_write): Move ...
8475         * incremental.h (Incremental_inputs_header)
8476         (Incremental_inputs_header_write, Incremental_inputs_entry)
8477         (Incremental_inputs_entry_write): here.
8478
8479 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8480
8481         * incremental.cc (make_sized_incremental_binary): Set the target.
8482         Error if it is incompatible.
8483         * output.h (Output_file): Add filename method.
8484
8485 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8486
8487         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8488         from the get_* methods.
8489
8490 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8491
8492         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8493         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8494         Write 0 for the data_offset of scripts.
8495
8496 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8497
8498         * testsuite/Makefile.am: Add the incremental_test.sh test.
8499         * testsuite/incremental_test.sh: New.
8500         * testsuite/incremental_test_1.c: New.
8501         * testsuite/incremental_test_2.c: New.
8502
8503 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8504
8505         * incremental-dump.cc (main): Fix typos.
8506
8507 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8508
8509         PR gold/11025
8510         * incremental-dump.cc (main): Use llu to print 64 bit values.
8511
8512 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8513             H.J. Lu  <hongjiu.lu@intel.com>
8514
8515         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8516         $(LIBDL).
8517         (incremental_dump_LDADD): Likewise.
8518         * Makefile.in: Regenerated.
8519
8520 2009-11-25  Doug Kwan  <dougkwan@google.com>
8521
8522         Revert:
8523
8524         2009-11-25  Doug Kwan  <dougkwan@google.com>
8525
8526                 * arm.cc (Target_arm::Target_arm): Move method definition
8527                 outside of class definition.  Add code to handle
8528                 --target1-rel, --target1-abs and --target2= options.
8529                 (Target_arm::get_reloc_reloc_type): Change method to be
8530                 non-static and const.
8531                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8532                 New data member declaration.
8533                 (Target_arm::Scan::local, Target_arm::Scan::global,
8534                 Target_arm::Relocate::relocate,
8535                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8536                 Adjust call to Target_arm::get_real_reloc_type.
8537                 (Target_arm::get_real_reloc_type): Use command line options
8538                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8539                 * options.h (--target1-rel, --target1-abs, --target2): New
8540                 ARM-only options.
8541
8542 2009-11-25  Doug Kwan  <dougkwan@google.com>
8543
8544         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8545         class definition.  Add code to handle --target1-rel, --target1-abs
8546         and --target2= options.
8547         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8548         and const.
8549         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8550         member declaration.
8551         (Target_arm::Scan::local, Target_arm::Scan::global,
8552         Target_arm::Relocate::relocate,
8553         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8554         call to Target_arm::get_real_reloc_type.
8555         (Target_arm::get_real_reloc_type): Use command line options to
8556         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8557         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8558         options.
8559
8560 2009-11-25  Doug Kwan  <dougkwan@google.com>
8561
8562         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8563         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8564         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8565         formatting.
8566         (Arm_relocate_functions::thm_call): Replace body with a call to
8567         Arm_relocate_functions::thumb_branch_common.
8568         (Arm_relocate_functions::thm_jump24,
8569         Arm_relocate_functions::thm_xpc22): New method definitions.
8570         (Arm_relocate_functions::thumb_branch_common): New method definition.
8571         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8572         operator.
8573         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8574         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8575
8576 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8577
8578         * Makefile.am: Build incremental-dump
8579         * Makefile.in: Regenerate.
8580         * incremental-dump.cc: New.
8581         * incremental.cc (Incremental_inputs_header_data,
8582         Incremental_inputs_entry_data): Move to incremental.h
8583         * incremental.h: (Incremental_inputs_header_data,
8584         Incremental_inputs_entry_data): Move from incremental.cc
8585
8586 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8587
8588         * incremental.cc (Incremental_inputs_header,
8589         Incremental_inputs_header_write, Incremental_inputs_entry,
8590         Incremental_inputs_entry_write): Add a typedef with the data type.
8591
8592 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8593
8594         * incremental.cc (Incremental_inputs_header,
8595         Incremental_inputs_header_write, Incremental_inputs_entry,
8596         Incremental_inputs_entry_write): Update comment about which
8597         type has the filed descriptions.
8598
8599 2009-11-15  Doug Kwan  <dougkwan@google.com>
8600
8601         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8602         (Arm_relocate_functions::arm_branch_common): Change method defintion
8603         in class definition to a method declaration and update list of formal
8604         parameters.
8605         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8606         Arm_relocation_functions::jump24): Adjust call to
8607         Arm_relocate_functions::arm_branch_common.  Update list of formal
8608         parameters.
8609         (Arm_relocate_functions::xpc25): New method definition.
8610         (Arm_relocate_functions::arm_branch_common): Move method defintion
8611         out from class definition.  Use stubs for mode-switching and extending
8612         branch ranges.
8613         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8614         specially.  Change code to enable use of stubs in ARM branches.
8615
8616 2009-11-10  Doug Kwan  <dougkwan@google.com>
8617
8618         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8619         in method declaration.
8620         (Target_arm::relocate_stub): New method declaration.
8621         (Target_arm::default_target): Change to return a pointer instead of
8622         a const reference.
8623         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8624         Target_arm::default_target.
8625         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8626         method definition.
8627         (Target_arm::relocate_section): Adjust view.
8628         (Target_arm::relocate_stub): New method definition.
8629
8630 2009-11-10  Doug Kwan  <dougkwan@google.com>
8631
8632         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8633         a format warning.
8634         * incremental.cc (open_incremental_binary): Initialized local
8635         variables to avoid warnings.
8636         * object.cc (make_elf_object): Ditto.
8637         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8638         a format warning.
8639
8640 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8641
8642         PR gold/10930
8643         * testsuite/plugin_test.c: Include "config.h".
8644
8645 2009-11-09  Doug Kwan  <dougkwan@google.com>
8646
8647         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8648         (arm_symbol_value): Remove.
8649         (Arm_relocate_functions::arm_branch_common,
8650         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8651         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8652         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8653         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8654         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8655         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8656         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8657         Arm_relocate_functions::thm_mobw_abs_nc,
8658         Arm_relocate_functions::thm_mov_abs,
8659         Arm_relocate_functions::movw_prel_nc,
8660         Arm_relocate_functions::thm_movt_abs,
8661         Arm_relocate_functions::movt_prel,
8662         Arm_relocate_functions::thm_movw_prel_nc,
8663         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8664         (Target_arm::Relocate::relocate): Only decompose address into two
8665         parts if relocation type uses the thumb-bit and pass the actual
8666         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8667         calls to methods in Arm_relocate_functions for this change.
8668
8669 2009-11-08  Ian Lance Taylor  <iant@google.com>
8670
8671         PR 10925
8672         * reloc.cc: Instantiate
8673         Sized_relobj::initialize_input_to_output_maps and
8674         Sized_relobj:free_input_to_output_maps.
8675
8676 2009-11-06  Ian Lance Taylor  <iant@google.com>
8677
8678         PR 10876
8679         * defstd.cc (in_segment): Set only_if_ref true for "end".
8680
8681 2009-11-06  Doug Kwan  <dougkwan@google.com>
8682
8683         * arm.cc (class Reloc_stub): Correct a comment.
8684         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8685         (Target_arm::scan_section_for_stubs): New method declaration.
8686         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8687         Change methods from private to protected.
8688         (Target_arm::do_may_relax): New method definition.
8689         (Target_arm::do_relax, Target_arm::group_sections,
8690         Target_arm::scan_reloc_for_stub,
8691         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8692         (Target_arm::arm_input_section_map_): New data member declaration.
8693         (Target_arm::scan_reloc_for_stub,
8694         Target_arm::scan_reloc_section_for_stubs,
8695         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8696         Target_arm::do_relax): New method definitions.
8697
8698 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8699
8700         * configure.ac: Check for (struct stat)::st_mtim
8701         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8702         * config.in: Regenerate.
8703         * configure: Regenerate.
8704
8705 2009-11-05  Ian Lance Taylor  <iant@google.com>
8706
8707         PR 10910
8708         * output.cc (Output_segment::add_output_section): Add missing
8709         return statement.
8710
8711 2009-11-04  Ian Lance Taylor  <iant@google.com>
8712
8713         PR 10880
8714         * object.h (class Object): Add is_needed and set_is_needed
8715         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8716         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8717         defined in a dynamic object and referenced by a regular object,
8718         set is_needed for the dynamic object.
8719         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8720         if the file is marked with as_needed and it is not needed.
8721
8722 2009-11-04  Ian Lance Taylor  <iant@google.com>
8723
8724         PR 10887
8725         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8726         tags if data is discarded by linker script.
8727         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8728         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8729         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8730         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8731
8732 2009-11-04  Ian Lance Taylor  <iant@google.com>
8733
8734         * layout.cc (Layout::get_output_section): Add is_interp and
8735         is_dynamic_linker_section parameters.  Change all callers.
8736         (Layout::choose_output_section): Likewise.
8737         (Layout::make_output_section): Likewise.
8738         (Layout::add_output_section_data): Add is_dynamic_linker_section
8739         parameter.  Change all callers.
8740         * layout.h (class Layout): Update declarations.
8741         * output.h (class Output_section): Add is_interp, set_is_interp,
8742         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8743         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8744         generate_code_fills_at_write_ to a bitfield.
8745         * output.cc (Output_section::Output_sections): Initialize new
8746         fields.
8747         (Output_segment::add_output_section): Add do_sort parameter.
8748         Change all callers.
8749
8750 2009-11-03  Ian Lance Taylor  <iant@google.com>
8751
8752         PR 10860
8753         * options.h (class General_options): Add --warn-common.
8754         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8755         merging two common symbols.
8756         (Symbol_table::should_override): Handle --warn-common when merging
8757         a common symbol with a defined symbol.  Use report_resolve_problem
8758         for multiple definitions.
8759         (Symbol_table::report_resolve_problem): New function.
8760         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8761
8762 2009-11-03  Doug Kwan  <dougkwan@google.com>
8763
8764         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8765         stub_factory_.
8766         (Target_arm::stub_factory): New method definition.
8767         (Target_arm::new_arm_input_section,
8768         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8769         Target_arm::reloc_uses_thumb_bit): New method declarations.
8770         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8771         New type definitions.
8772         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8773         member declarations.
8774         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8775         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8776         New method definitions.
8777
8778 2009-11-03  Ian Lance Taylor  <iant@google.com>
8779
8780         * options.h (class General_options): Add --warn_constructors.
8781
8782 2009-11-03  Ian Lance Taylor  <iant@google.com>
8783
8784         PR 10893
8785         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8786         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8787
8788 2009-11-03  Ian Lance Taylor  <iant@google.com>
8789
8790         PR 10895
8791         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8792         --msgid-bugs-address.
8793         (install-pdf): New target.
8794         (install-data_yes): Look up one directory to find mkinstalldirs.
8795
8796 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8797
8798         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8799         tree.
8800
8801 2009-10-30  Doug Kwan  <dougkwan@google.com>
8802
8803         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8804
8805 2009-10-30  Doug Kwan  <dougkwan@google.com>
8806
8807         * arm.cc (Stub_addend_reader): New struct template definition
8808         and partial specializations.
8809         (Stub_addend_reader::operator()): New method definition for a
8810         partially specialized template.
8811
8812 2009-10-30  Doug Kwan  <dougkwan@google.com>
8813
8814         * arm.cc (Arm_relobj::processor_specific_flags): New method
8815         definition.
8816         (Arm_relobj::do_read_symbols): New method declaration.
8817         (Arm_relobj::processor_specific_flags_): New data member declaration.
8818         (Arm_dynobj): New class definition.
8819         (Target_arm::do_finalize_sections): Add input_objects parameter.
8820         (Target_arm::do_adjust_elf_header): New method declaration.
8821         (Target_arm::are_eabi_versions_compatible,
8822         (Target_arm::merge_processor_specific_flags): New method declaration.
8823         (Target_arm::do_make_elf_object): New overloaded method definitions
8824         and declaration.
8825         (Arm_relobj::do_read_symbols): New method definition.
8826         (Arm_dynobj::do_read_symbols): Ditto.
8827         (Target_arm::do_finalize_sections): Add input_objects parameters.
8828         Merge processor-specific flags from all input objects.
8829         (Target_arm::are_eabi_versions_compatible,
8830         Target_arm::merge_processor_specific_flags,
8831         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8832         New method definitions.
8833         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8834         Input_objects pointer type parameter.
8835         * layout.cc (Layout::finalize): Pass input objects to target's.
8836         finalize_sections function.
8837         * output.cc (Output_file_header::do_sized_write): Set ELF file
8838         header's processor-specific flags.
8839         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8840         Input_objects pointer type parameter.
8841         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8842         * target.h (Input_objects): New forward class declaration.
8843         (Target::processor_specific_flags,
8844         Target::are_processor_specific_flags_sect): New method definitions.
8845         (Target::finalize_sections): Add input_objects parameter.
8846         (Target::Target): Initialize processor_specific_flags_ and
8847         are_processor_specific_flags_set_.
8848         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8849         parameter.
8850         (Target::set_processor_specific_flags): New method definition.
8851         (Target::processor_specific_flags_,
8852         Target::are_processor_specific_flags_set_): New data member
8853         declarations.
8854         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8855         Input_objects pointer type parameter.
8856
8857 2009-10-30  Doug Kwan  <dougkwan@google.com>
8858
8859         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8860
8861 2009-10-28  Ian Lance Taylor  <iant@google.com>
8862
8863         * object.h (class Relobj): Drop options parameter from
8864         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8865         do_scan_relocs, do_relocate.  Change all callers.
8866         (class Sized_relobj): Drop options parameters from
8867         do_gc_process_relocs, do_scan_relocs, do_relocate,
8868         do_relocate_sections, relocate_sections, emit_relocs_scan,
8869         emit_relocs_scan_reltype.  Change all callers.
8870         (struct Relocate_info): Remove options field and all references to
8871         it.
8872         * reloc.h (class Read_relocs): Remove options constructor
8873         parameter and options_ field.  Change all callers.
8874         (class Gc_process_relocs, class Scan_relocs): Likewise.
8875         (class Relocate_task): Likewise.
8876         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8877         all callers.
8878         (scan_relocatable_relocs): Likewise.
8879         * target.h (class Sized_target): Remove options parameter from
8880         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8881         all callers.
8882         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8883         callers.
8884         * arm.cc: Update functions to remove options parameters.
8885         * i386.cc: Likewise.
8886         * powerpc.cc: Likewise.
8887         * sparc.cc: Likewise.
8888         * x86_64.cc: Likewise.
8889         * testsuite/testfile.cc: Likewise.
8890
8891 2009-10-28  Doug Kwan  <dougkwan@google.com>
8892
8893         * arm.cc (Arm_relobj): New class definition.
8894         (Arm_relobj::scan_sections_for_stubs,
8895         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8896         New method definitions.
8897
8898 2009-10-28  Cary Coutant  <ccoutant@google.com>
8899
8900         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8901         (Plugin::cleanup_done_): New member.
8902         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8903         (Plugin_manager::cleanup_done_): Remove.
8904         (Plugin_manager::add_input_file): Edit error message.
8905         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8906         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8907
8908 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8909
8910         * fileread.cc: (File_read::View::~View): Use the new
8911         data_ownership_ filed.
8912         (File_read::~File_read): Dispose the new whole_file_view_.
8913         (File_read::open): Mmap the whole file if needed.
8914         (File_read::open): Use whole_file_view_ instead of contents_.
8915         (File_read::find_view): Use whole_file_view_ if applicable.
8916         (File_read::do_read): Use whole_file_view_ instead of contents_.
8917         (File_read::make_view): Use whole_file_view_ instead of contents_,
8918         update File_read::View::View call.
8919         (File_read::find_or_make_view): Update File_read::View::View
8920         call.
8921         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8922         remove contents_
8923         (File_read::View::Data_ownership): New enum.
8924         (File_read::View::View): Replace bool mapped_ with Data_ownership
8925         argument.
8926         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8927         (File_read::View::data_ownership_): New field.
8928         (File_read::contents_): Remove (replaced by whole_file_view_).
8929         (File_read::whole_file_view_): New field.
8930         * options.h (class General_options): Add --keep-files-mapped.
8931
8932 2009-10-27  Cary Coutant  <ccoutant@google.com>
8933
8934         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8935         * testsuite/Makefile.am (plugin_test_5): New test case.
8936         * testsuite/Makefile.in: Regenerate.
8937
8938 2009-10-25  Doug Kwan  <dougkwan@google.com>
8939
8940         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8941         from private to protected to allow access by child class.
8942         (Sized_relobj::do_relocate_sections): New method declaration.
8943         (Sized_relobj::relocate_sections): Virtualize.
8944         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8945         Sized_relobj::relocate_sections.  Instantiate template explicitly
8946         for different target sizes and endianity.
8947
8948 2009-10-24  Doug Kwan  <dougkwan@google.com>
8949
8950         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8951         (Arm_input_section::as_arm_input_section): New method.
8952         (Arm_output_section): New class definition.
8953         (Arm_output_section::create_stub_group,
8954         Arm_output_section::group_sections): New method definitions.
8955
8956 2009-10-22  Doug Kwan  <dougkwan@google.com>
8957
8958         * arm.cc (Arm_input_section): New class definition.
8959         (Arm_input_section::init, Arm_input_section:do_write,
8960         Arm_input_section::set_final_data_size,
8961         Arm_input_section::do_reset_address_and_file_offset): New method
8962         definitions.
8963
8964 2009-10-21  Doug Kwan  <dougkwan@google.com>
8965
8966         * arm.cc (Stub_table, Arm_input_section): New forward class
8967         declarations.
8968         (Stub_table): New class defintion.
8969         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8970         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8971         New method definition.
8972
8973 2009-10-21  Doug Kwan  <dougkwan@google.com>
8974
8975         * arm.cc: Update copyright comments.
8976         (Target_arm): New forward class template declaration.
8977         (Arm_address): New type.
8978         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8979         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8980         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8981         constants.
8982         (Insn_template): Same.
8983         (DEF_STUBS): New macro.
8984         (Stub_type): New enum type.
8985         (Stub_template): New class definition.
8986         (Stub): Same.
8987         (Reloc_stub): Same.
8988         (Stub_factory): Same.
8989         (Target_arm::Target_arm): Initialize may_use_blx_ and
8990         should_force_pic_veneer_.
8991         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8992         Target_arm::should_force_pic_veneer,
8993         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8994         Target_arm::using_thumb_only, Target_arm:;default_target): New
8995         method defintions.
8996         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8997         New data member declarations.
8998         (Insn_template::size, Insn_template::alignment): New method defintions.
8999         (Stub_template::Stub_template): New method definition.
9000         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9001         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9002         (Stub_factory::Stub_factory): New method definition.
9003         * gold.h (string_hash): New template.
9004         * output.h (Input_section_specifier::hash_value): Use
9005         gold::string_hash.
9006         (Input_section_specifier::string_hash): Remove.
9007         * stringpool.cc (Stringpool_template::string_hash): Use
9008         gold::string_hash.
9009
9010 2009-10-20  Doug Kwan  <dougkwan@google.com>
9011
9012         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9013         symbols of relaxed input sections.
9014         * output.h (Output_section::find_relaxed_input_section): Make
9015         method public.
9016
9017 2009-10-16  Doug Kwan  <dougkwan@google.com>
9018
9019         * dynobj.cc (Versions::Versions): Initialize version_script_.
9020         Only insert base version symbol definition for a shared object
9021         if version script defines any version versions.
9022         (Versions::define_base_version): New method definition.
9023         (Versions::add_def): Check that base version is not needed.
9024         (Versions::add_need): Define base version lazily.
9025         * dynobj.h (Versions::define_base_version): New method declaration.
9026         (Versions::needs_base_version_): New data member declaration.
9027         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9028         (check_DATA): Add no_version_test.stdout.
9029         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9030         New make rules.
9031         * testsuite/Makefile.in: Regenerate.
9032         * testsuite/no_version_test.c: New file.
9033         * testsuite/no_version_test.sh: Ditto.
9034
9035 2009-10-16  Doug Kwan  <dougkwan@google.com>
9036
9037         * expression.cc (class Segment_start_expression): New class definition.
9038         (Segment_start_expression::value): New method definition.
9039         (script_exp_function_segment_start): Return a new
9040         Segment_start_expression.
9041         * gold/script-c.h (script_saw_segment_start_expression): New function
9042         prototype.
9043         * script-sections.cc (Script_sections::Script_sections): Initialize
9044         SAW_SEGMENT_START_EXPRESSION_ to false.
9045         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9046         and -Tbbs options to specify section addresses if given in
9047         command line and no SEGMENT_START expression is seen in a script.
9048         * script-sections.h (Script_sections::saw_segment_start_expression,
9049         Script_sections::set_saw_segment_start_expression): New method
9050         definition.
9051         (Script_sections::saw_segment_start_expression_): New data member
9052         declaration.
9053         * script.cc (script_saw_segment_start_expression): New function.
9054         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9055         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9056         script_test_7.sh and script_test_8.sh.
9057         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9058         script_test_8.stdout.
9059         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9060         (script_test_6, script_test_6.stdout, script_test_7,
9061         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9062         * Makefile.in: Regenerate.
9063         * testsuite/script_test_6.sh: New file.
9064         * testsuite/script_test_6.t: Same.
9065         * testsuite/script_test_7.sh: Same.
9066         * testsuite/script_test_7.t: Same.
9067         * testsuite/script_test_8.sh: Same.
9068
9069 2009-10-16  Doug Kwan  <dougkwan@google.com>
9070
9071         * output.cc (Output_segment::set_section_list_address): Cast
9072         expressions to unsigned long long type to avoid format warnings.
9073
9074 2009-10-15  Ian Lance Taylor  <iant@google.com>
9075
9076         * script.cc (Script_options::add_symbol_assignment): Always add a
9077         dot assignment to script_sections_.
9078         * script-sections.cc (Script_sections::add_dot_assignment):
9079         Initialize if necessary.
9080
9081         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9082         program headers with no load segment if there is a linker script.
9083
9084         * layout.cc (Layout::set_segment_offsets): Align the file offset
9085         to the segment aligment for -N or -n with no load segment.
9086         * output.cc (Output_segment::add_output_section): Don't crash if
9087         the first section is a TLS section.
9088         (Output_segment::set_section_list_addresses): Print an error
9089         message if the address moves backward in a linker script.
9090         * script-sections.cc
9091         (Output_section_element_input::set_section_addresses): Don't
9092         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9093         (Orphan_output_section::set_section_addresses): Likewise.
9094
9095 2009-10-15  Doug Kwan  <dougkwan@google.com>
9096
9097         * layout.cc (Layout::finish_dynamic_section): Generate tags
9098         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9099         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9100         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9101
9102 2009-10-14  Ian Lance Taylor  <iant@google.com>
9103
9104         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9105         fields.
9106         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9107         data_shdr fields of relinfo.
9108         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9109         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9110         R_386_TLS_LDO_32, adjust based on section flags.
9111         (Target_i386::Relocate::fix_up_ldo): Remove.
9112
9113 2009-10-13  Ian Lance Taylor  <iant@google.com>
9114
9115         Add support for -pie.
9116         * options.h (class General_options): Add -pie and
9117         --pic-executable.
9118         (General_options::output_is_position_independent): Test -pie.
9119         (General_options::output_is_executable): Return true if not shared
9120         and not relocatable.
9121         (General_options::output_is_pie): Remove.
9122         * options.cc (General_options::finalize): Reject incompatible uses
9123         of -pie.
9124         * gold.cc (queue_middle_tasks): A -pie link is not static.
9125         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9126         * symtab.cc (Symbol::final_value_is_known): Return false if
9127         output_is_position_independent.
9128         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9129         output_is_position_independent.
9130         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9131         output_is_position_independent.
9132         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9133         output_is_position_independent.
9134         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9135         two_file_pie_test.
9136         (basic_pie_test.o, basic_pie_test): New targets.
9137         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9138         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9139         (two_file_pie_test): New target.
9140         * testsuite/Makefile.in: Rebuild.
9141         * README: Remove note saying that -pie is not supported.
9142
9143 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9144
9145         * options.h (class General_options): Add -init and -fini.
9146         * layout.cc (Layout::finish_dynamic_section): Emit
9147         given init and fini functions.
9148
9149 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9150
9151         * gc.h (gc_process_relocs): Check if icf is enabled using new
9152         function.
9153         * gold.cc (queue_initial_tasks): Likewise.
9154         (queue_middle_tasks): Likewise.
9155         * object.cc (do_layout): Likewise.
9156         * symtab.cc (is_section_folded): Likewise.
9157         * main.cc (main): Likewise.
9158         * reloc.cc (Read_relocs::run): Likewise.
9159         (Sized_relobj::do_scan_relocs): Likewise.
9160         * icf.cc (is_function_ctor_or_dtor): New function.
9161         (Icf::find_identical_sections): Check if function is ctor or dtor when
9162         safe icf is chosen.
9163         * options.h (General_options::icf): Change option to be an enum.
9164         (Icf_status): New enum.
9165         (icf_enabled): New method.
9166         (icf_safe_folding): New method.
9167         (set_icf_status): New method.
9168         (icf_status_): New variable.
9169         * (options.cc) (General_options::finalize): Set icf_status_.
9170         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9171         icf_test and icf_keep_unique_test to use the --icf enum flag.
9172         * testsuite/icf_safe_test.sh: New file.
9173         * testsuite/icf_safe_test.cc: New file.
9174
9175 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9176
9177         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9178         includes to gc.h and icf.h.
9179         * arm.cc: Include gc.h.
9180         * gold.cc: Likewise.
9181         * i386.cc: Likewise.
9182         * powerpc.cc: Likewise.
9183         * sparc.cc: Likewise.
9184         * x86_64.cc: Likewise.
9185         * gc.h: Include icf.h.
9186
9187 2009-10-11  Ian Lance Taylor  <iant@google.com>
9188
9189         * plugin.cc: Include "gold.h" before other header files.
9190
9191 2009-10-10  Chris Demetriou  <cgd@google.com>
9192
9193         * options.h (Input_file_argument::Input_file_type): New enum.
9194         (Input_file_argument::is_lib_): Replace with...
9195         (Input_file_argument::type_): New member.
9196         (Input_file_argument::Input_file_argument): Take Input_file_type
9197         'type' rather than boolean 'is_lib' as second argument.
9198         (Input_file_argument::is_lib): Use type_.
9199         (Input_file_argument::is_searched_file): New function.
9200         (Input_file_argument::may_need_search): Handle is_searched_file.
9201         * options.cc (General_options::parse_library): Support -l:filename.
9202         (General_options::parse_just_symbols): Update for Input_file_argument
9203         changes.
9204         (Command_line::process): Likewise.
9205         * archive.cc (Archive::get_file_and_offset): Likewise.
9206         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9207         * script.cc (read_script_file, script_add_file): Likewise.
9208         * fileread.cc (Input_file::Input_file): Likewise.
9209         (Input_file::will_search_for): Handle is_searched_file.
9210         (Input_file::open): Likewise.
9211         * readsyms.cc (Read_symbols::get_name): Likewise.
9212         * testsuite/Makefile.am (searched_file_test): New test.
9213         * testsuite/Makefile.in: Regenerate.
9214         * testsuite/searched_file_test.cc: New file.
9215         * testsuite/searched_file_test_lib.cc: New file.
9216
9217 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9218             Ian Lance Taylor  <iant@google.com>
9219
9220         * descriptor.cc: Include <cstdio> and "binary-io.h".
9221         (Descriptors::open): Open the files in binary mode always.
9222         * script.cc (Lex::get_token): Treat \r as whitespace.
9223
9224 2009-10-09  Ian Lance Taylor  <iant@google.com>
9225
9226         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9227
9228 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9229             Ian Lance Taylor  <iant@google.com>
9230
9231         * configure.ac: Check for readv function also.
9232         * fileread.cc (readv): Define if not HAVE_READV.
9233         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9234         does not exist.
9235         * config.in: Regenerate.
9236         * configure: Regenerate.
9237
9238 2009-10-09  Doug Kwan  <dougkwan@google.com>
9239
9240         * layout.cc (Layout::make_output_section): Call target hook to make
9241         ordinary output section.
9242         (Layout::finalize): Adjust parameter list of call the
9243         Target::may_relax().
9244         * layout.h (class Layout::section_list): New method.
9245         * merge.h (Output_merge_base::entsize): Change visibility to public.
9246         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9247         New methods.
9248         (Output_merge_string::do_is_string): New method.
9249         * object.cc (Sized_relobj::do_setup): renamed from
9250         Sized_relobj::set_up.
9251         * object.h (Sized_relobj::adjust_shndx,
9252         Sized_relobj::initializ_input_to_output_maps,
9253         Sized_relobj::free_input_to_output_maps): Change visibilities to
9254         protected.
9255         (Sized_relobj::setup): Virtualize.
9256         (Sized_relobj::do_setup): New method declaration.
9257         (Sized_relobj::invalidate_section_offset,
9258         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9259         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9260         * options.cc (parse_int): New function.
9261         * options.h (parse_int): New declaration.
9262         (DEFINE_int): New macro.
9263         (stub_group_size): New option.
9264         * output.cc (Output_section::Output_section): Initialize memebers
9265         merge_section_map_, merge_section_by_properties_map_,
9266         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9267         (Output_section::add_input_section): Handled deferred code-fill
9268         generation and remove an old comment.
9269         (Output_section::add_relaxed_input_section): New method definition.
9270         (Output_section::add_merge_input_section): Use merge section by
9271         properties map to speed to search.  Update merge section maps
9272         as appropriate.
9273         (Output_section::build_relaxation_map): New method definition.
9274         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9275         Same.
9276         (Output_section::relax_input_section): Renamed to
9277         Output_section::convert_input_sections_to_relaxed_sections and change
9278         interface to take a vector of pointers to relaxed sections.
9279         (Output_section::find_merge_section,
9280         Output_section::find_relaxed_input_section): New method definitions.
9281         (Output_section::is_input_address_mapped,
9282         Output_section::output_offset, Output_section::output_address):
9283         Use output section data maps to speed up searching.
9284         (Output_section::find_starting_output_address): Add comments.
9285         (Output_section::do_write,
9286         Output_section::write_to_postprocessing_buffer): Do code-fill
9287         generation as appropriate.
9288         (Output_section::get_input_sections): Invalidate relaxed input section
9289         map.
9290         (Output_section::restore_states): Adjust type of checkpoint .
9291         Invalidate relaxed input section map.
9292         * output.h (Output_merge_base): New class declaration.
9293         (Input_section_specifier): New class defintion.
9294         (class Output_relaxed_input_section) Change base class to
9295         Output_section_data_build.
9296         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9297         base class initializer.
9298         (Output_section::add_relaxed_input_section): New method declaration.
9299         (Output_section::Input_section): Change visibility to protected.
9300         (Output_section::Input_section::relobj,
9301         Output_section::Input_section::shndx): Handle relaxed input sections.
9302         Output_section::input_sections) Change visibility to protected.  Also
9303         define overload to return a non-const pointer.
9304         (Output_section::Merge_section_properties): New class defintion.
9305         (Output_section::Merge_section_by_properties_map,
9306         Output_section::Output_section_data_by_input_section_map,
9307         Output_section::Relaxation_map): New types.
9308         (Output_section::relax_input_section): Rename method to
9309         Output_section::convert_input_sections_to_relaxed_sections and change
9310         interface to take a vector of relaxed section pointers.
9311         (Output_section::find_merge_section,
9312         Output_section::find_relaxed_input_section,
9313         Output_section::build_relaxation_map,
9314         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9315         New method declarations.
9316         (Output_section::merge_section_map_
9317         Output_section::merge_section_by_properties_map_,
9318         Output_section::relaxed_input_section_map_,
9319         Output_section::is_relaxed_input_section_map_valid_,
9320         Output_section::generate_code_fills_at_write_): New data members.
9321         * script-sections.cc
9322         (Output_section_element_input::set_section_addresses): Call
9323         current_data_size and addralign methods of relaxed input sections.
9324         (Orphan_output_section::set_section_addresses): Call current_data_size
9325         and addralign methods of relaxed input sections.
9326         * symtab.cc (Symbol_table::compute_final_value): Extract template
9327         from the body of Symbol_table::sized_finalize_symbol.
9328         (Symbol_table::sized_finalized_symbol): Call
9329         Symbol_table::compute_final_value.
9330         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9331         (Symbol_table::compute_final_value): New templated method declaration.
9332         * target.cc (Target::do_make_output_section): New method defintion.
9333         * target.h (Target::make_output_section): New method declaration.
9334         (Target::relax): Add more parameters for input objects, symbol table
9335         and layout.  Adjust call to do_relax.
9336         (Target::do_make_output_section): New method declaration.
9337         (Target::do_relax): Add parameters for input objects, symbol table
9338         and layout.
9339
9340 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9341
9342         * pread.c: Include stdio.h.
9343
9344 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9345
9346         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9347         defined.
9348
9349 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9350
9351         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9352         Change read_shndx type to unsigned int.
9353         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9354         int.
9355         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9356         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9357         Change read_shndx type to unsigned int.
9358         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9359         int.
9360         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9361         * layout.cc (Layout::create_symtab_sections): Cast the result of
9362         local_symcount * symsize to off_t in the gold_assert.
9363
9364 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9365
9366         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9367         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9368         R_ARM_BASE_ABS.
9369         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9370         (Arm_relocate_functions::thm_abs5): New function.
9371         (Arm_relocate_functions::abs12): New function.
9372         (Arm_relocate_functions::abs16): New function.
9373         (Arm_relocate_functions::base_abs): New function.
9374         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9375         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9376         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9377         R_ARM_BASE_ABS.
9378         (Scan::global): Likewise.
9379         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9380         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9381         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9382         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9383         R_ARM_BASE_ABS.
9384
9385 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9386
9387         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9388         (Arm_relocate_functions::movt_prel): New function.
9389         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9390         (Arm_relocate_functions::thm_movt_prel): New function.
9391         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9392         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9393         (Scan::global, Relocate::relocate): Likewise.
9394         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9395
9396 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9397
9398         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9399         Incremental_checker.
9400         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9401         unsigned int.
9402         (class Incremental_inputs_header): New class.
9403         (Incremental_inputs_header_writer): Edit comment.
9404         (Incremental_inputs_entry): New class.
9405         (Incremental_inputs_entry_writer): Edit comment.
9406         (Sized_incremental_binary::do_find_incremental_inputs_section):
9407         Add *strtab_shndx parameter, fill it.
9408         (Sized_incremental_binary::do_check_inputs): New method.
9409         (Incremental_checker::can_incrementally_link_output_file): Use
9410         Sized_incremental_binary::check_inputs.
9411         (Incremental_inputs::report_command_line): Save command line in
9412         command_line_.
9413         * incremental.h:
9414         (Incremental_binary::find_incremental_inputs_section): New
9415         method.
9416         (Incremental_binary::do_find_incremental_inputs_section): Add
9417         strtab_shndx parameter.
9418         (Incremental_binary::do_check_inputs): New pure virtual method.
9419         (Sized_incremental_binary::do_check_inputs): Declare.
9420         (Incremental_checker::Incremental_checker): Add incremental_inputs
9421         parameter, use it to initialize incremental_inputs_.
9422         (Incremental_checker::incremental_inputs_): New field.
9423         (Incremental_checker::command_line): New method.
9424         (Incremental_checker::inputs): New method.
9425         (Incremental_checker::command_line_): New field.
9426
9427 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9428
9429         * incremental.cc: Include <cstdarg> and "target-select.h".
9430         (vexplain_no_incremental): New function.
9431         (explain_no_incremental): New function.
9432         (Incremental_binary::error): New method.
9433         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9434         method.
9435         (make_sized_incremental_binary): New function.
9436         (open_incremental_binary): New function.
9437         (can_incrementally_link_file): Add checks if output is ELF and has
9438         inputs section.
9439         * incremental.h: Include "elfcpp_file.h" and "output.h".
9440         (Incremental_binary): New class.
9441         (Sized_incremental_binary): New class.
9442         (open_incremental_binary): Declare.
9443         * object.cc (is_elf_object): Use
9444         elfcpp::Elf_recognizer::is_elf_file.
9445         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9446         * output.h (Output_file::filesize): New method.
9447
9448 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9449
9450         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9451         New function.
9452         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9453         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9454         function.
9455         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9456         function.
9457         (Arm_relocate_functions::movw_abs_nc): New function.
9458         (Arm_relocate_functions::movt_abs): New function.
9459         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9460         (Arm_relocate_functions::thm_movt_abs): New function.
9461         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9462         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9463         (Scan::global): Likewise.
9464         (Relocate::relocate): Likewise.
9465         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9466
9467 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9468
9469         * arm.cc (Arm_relocate_functions::got_prel) New function.
9470         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9471         (Relocate::relocate): Likewise.
9472         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9473
9474 2009-10-06  Ian Lance Taylor  <iant@google.com>
9475
9476         * options.h (class General_options): Define
9477         split_stack_adjust_size parameter.
9478         * object.h (class Object): Add uses_split_stack_ and
9479         has_no_split_stack_ fields.  Add uses_split_stack and
9480         has_no_split_stack accessor functions.  Declare
9481         handle_split_stack_section.
9482         (class Reloc_symbol_changes): Define.
9483         (class Sized_relobj): Define Function_offsets.  Declare
9484         split_stack_adjust, split_stack_adjust_reltype, and
9485         find_functions.
9486         * object.cc (Object::handle_split_stack_section): New function.
9487         (Sized_relobj::do_layout): Call handle_split_stack_section.
9488         * dynobj.cc (Sized_dynobj::do_layout): Call
9489         handle_split_stack_section.
9490         * reloc.cc (Sized_relobj::relocate_sections): Call
9491         split_stack_adjust for executable sections in split_stack
9492         objects.  Pass reloc_map to relocate_section.
9493         (Sized_relobj::split_stack_adjust): New function.
9494         (Sized_relobj::split_stack_adjust_reltype): New function.
9495         (Sized_relobj::find_functions): New function.
9496         * target-reloc.h: Include "object.h".
9497         (relocate_section): Add reloc_symbol_changes parameter.  Change
9498         all callers.
9499         * target.h (class Target): Add calls_non_split method.  Declare
9500         do_calls_non_split virtual method.  Declare match_view and
9501         set_view_to_nop.
9502         * target.cc: Include "elfcpp.h".
9503         (Target::do_calls_non_split): New function.
9504         (Target::match_view): New function.
9505         (Target::set_view_to_nop): New function.
9506         * gold.cc (queue_middle_tasks): Give an error if mixing
9507         split-stack and non-split-stack objects with -r.
9508         * i386.cc (Target_i386::relocate_section): Add
9509         reloc_symbol_changes parameter.
9510         (Target_i386::do_calls_non_split): New function.
9511         * x86_64.cc (Target_x86_64::relocate_section): Add
9512         reloc_symbol_changes parameter.
9513         (Target_x86_64::do_calls_non_split): New function.
9514         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9515         parameter.
9516         * powerpc.cc (Target_powerpc::relocate_section): Add
9517         reloc_symbol_changes parameter.
9518         * sparc.cc (Target_sparc::relocate_section): Add
9519         reloc_symbol_changes parameter.
9520         * configure.ac: Call AM_CONDITIONAL for the default target.
9521         * configure: Rebuild.
9522         * testsuite/Makefile.am (TEST_AS): New variable.
9523         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9524         (check_DATA): Add split_i386 and split_x86_64 files.
9525         (SPLIT_DEFSYMS): Define.
9526         (split_i386_[1234n].o): New targets.
9527         (split_i386_[124]): New targets.
9528         (split_i386_[1234r].stdout): New targets.
9529         (split_x86_64_[1234n].o): New targets.
9530         (split_x86_64_[124]): New targets.
9531         (split_x86_64_[1234r].stdout): New targets.
9532         (MOSTLYCLEANFILES): Add new executables.
9533         * testsuite/split_i386.sh: New file.
9534         * testsuite/split_x86_64.sh: New file.
9535         * testsuite/split_i386_1.s: New file.
9536         * testsuite/split_i386_2.s: New file.
9537         * testsuite/split_i386_3.s: New file.
9538         * testsuite/split_i386_4.s: New file.
9539         * testsuite/split_i386_n.s: New file.
9540         * testsuite/split_x86_64_1.s: New file.
9541         * testsuite/split_x86_64_2.s: New file.
9542         * testsuite/split_x86_64_3.s: New file.
9543         * testsuite/split_x86_64_4.s: New file.
9544         * testsuite/split_x86_64_n.s: New file.
9545         * testsuite/testfile.cc (Target_test): Update relocation_section
9546         function.
9547         * testsuite/Makefile.in: Rebuild.
9548
9549 2009-10-06  Ian Lance Taylor  <iant@google.com>
9550
9551         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9552         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9553         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9554         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9555         the address on ldo_addrs_.
9556         (Target_i386::Relocate::fix_up_ldo): New function.
9557
9558 2009-10-06   Rafael Espindola  <espindola@google.com>
9559
9560         * plugin.cc (add_input_library): New.
9561         (Plugin::load): Add add_input_library to tv.
9562         (Plugin_manager::add_input_file): Add the is_lib argument.
9563         (add_input_file): Update call to Plugin_manager::add_input_file.
9564         (add_input_library): New.
9565         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9566
9567 2009-09-30  Doug Kwan  <dougkwan@google.com>
9568
9569         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9570         symbol and call Symbol::may_need_copy_reloc to determine if
9571         a copy reloc is needed.
9572         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9573         nocopyreloc is given in command line.
9574         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9575         given in command line.
9576         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9577         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9578         of the removed Target_i386::may_need_copy_reloc.
9579         * options.h (copyreloc): New option with default value false.
9580         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9581         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9582         instead of the removed Target_powerpc::may_need_copy_reloc.
9583         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9584         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9585         instead of the removed Target_sparc::may_need_copy_reloc.
9586         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9587         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9588         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9589         instead of the removed Target_x86_64::may_need_copy_reloc.
9590
9591 2009-09-30  Ian Lance Taylor  <iant@google.com>
9592
9593         * object.h (class Object): Remove target_ field, and target,
9594         sized_target, and set_target methods.
9595         (Object::sized_target): Remove.
9596         (class Sized_relobj): Update declarations.  Remove sized_target.
9597         * object.cc (Sized_relobj::setup): Remove target parameter.
9598         Change all callers.
9599         (Input_objects::add_object): Don't do anything with the target.
9600         (make_elf_sized_object): Add punconfigured parameter.  Change all
9601         callers.  Set or test parameter target.
9602         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9603         Change all callers.
9604         * parameters.cc (Parameters::set_target): Change parameter type to
9605         be non-const.
9606         (Parameters::default_target): Remove.
9607         (set_parameters_target): Change parameter type to be non-const.
9608         (parameters_force_valid_target): New function.
9609         (parameters_clear_target): New function.
9610         * parameters.h (class Parameters): Update declarations.  Remove
9611         default_target method.  Add sized_target and clear_target
9612         methods.  Change target_ to be non-const.
9613         (set_parameters_target): Update declaration.
9614         (parameters_force_valid_target): Declare.
9615         (parameters_clear_target): Declare.
9616         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9617         as NULL if we aren't searching.
9618         (Add_symbols::run): Don't check for compatible target.
9619         * fileread.cc (Input_file::open_binary): Call
9620         parameters_force_valid_target.
9621         * gold.cc (queue_middle_tasks): Likewise.
9622         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9623         set_target on object.
9624         * dynobj.h (class Sized_dynobj): Update declarations.
9625         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9626         make_elf_object returns NULL.
9627         (Archive::include_member): Don't check whether object target is
9628         compatible.
9629         * output.cc (Output_section::add_input_section): Get target from
9630         parameters.
9631         (Output_section::relax_input_section): Likewise.
9632         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9633         parameters.
9634         (Sized_relobj::do_scan_relocs): Likewise.
9635         (Sized_relobj::relocate_sections): Likewise.
9636         * resolve.cc (Symbol_table::resolve): Likewise.
9637         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9638         parameter.  Change all callers.
9639         (Symbol_table::add_from_object): Get target from parameters.
9640         (Symbol_table::add_from_relobj): Don't check object target.
9641         (Symbol_table::add_from_dynobj): Likewise.
9642         (Symbol_table::define_special_symbol): Get target from
9643         parameters.
9644         * symtab.h (class Symbol_table): Update declaration.
9645         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9646         parameter.  Change all callers.  Clear parameter target.
9647         (Binary_test): Test target here.
9648         * testsuite/object_unittest.cc (gold_testsuite): Remove
9649         target_test_pointer parameter.  Change all callers.
9650         (Object_test): Test target here.
9651
9652 2009-09-26  Ian Lance Taylor  <iant@google.com>
9653
9654         * testsuite/initpri1.c: Don't try to use constructor priorities if
9655         compiling with gcc before 4.3.
9656
9657 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9658
9659         * testsuite/retain_symbols_file_test.sh (check_present): Change
9660         output file name to retain_symbols_file_test.stdout.
9661         (check_absent): Likewise.
9662
9663 2009-09-18  Craig Silverstein  <csilvers@google.com>
9664
9665         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9666         * options.cc: Include <cerrno> and <fstream>.
9667         (General_options::finalize): Parse -retain-symbols-file tag.
9668         * options.h: New flag.
9669         (General_options): New method should_retain_symbol, new
9670         variable symbols_to_retain.
9671         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9672         should_retain_symbol map.
9673         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9674         * testsuite/Makefile.in: Regenerate.
9675         * testsuite/retain_symbols_file_test.sh: New file.
9676
9677 2009-09-18  Nick Clifton  <nickc@redhat.com>
9678
9679         * po/es.po: Updated Spanish translation.
9680
9681 2009-09-17  Doug Kwan  <dougkwan@google.com>
9682
9683         * debug.h (DEBUG_RELAXATION): New constant.
9684         (DEBUG_ALL): Add DEBUG_RELAXATION.
9685         (debug_string_to_enum): Add relaxation debug option.
9686         * layout.cc
9687         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9688         Layout::Relaxation_debug_check::read_sections,
9689         Layout::Relaxation_debug_check::read_sections): New method definitions.
9690         (Layout::Layout): Initialize data members
9691         record_output_section_data_from_scrips_,
9692         script_output_section_data_list_ and relaxation_debug_check_.
9693         (Layout::save_segments, Layout::restore_segments,
9694         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9695         Layout::relaxation_loop_body): New method definitions.
9696         (Layout::finalize): Support relaxation.  Move section layout code to
9697         Layout::relaxation_loop_body.
9698         (Layout::set_asection_address_from_script): Move code for orphan
9699         section placement out.
9700         (Layout::place_orphan_sections_in_script): New method definition.
9701         * layout.h (Output_segment_headers, Output_file_header):
9702         New forward class declarations.
9703         (Layout::~Layout): Define.
9704         (Layout::new_output_section_data_from_script): New method definition.
9705         (Layout::place_orphan_sections_in_script): New method declaration.
9706         (Layout::Segment_states): New type declaration.
9707         (Layout::save_segments, Layout::restore_segments,
9708         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9709         Layout::relaxation_loop_body): New method declarations.
9710         (Layout::Output_section_data_list): New type declaration.
9711         (Layout::Relaxation_debug_check): New class definition.
9712         (Layout::record_output_section_data_from_script_,
9713         Layout::script_output_section_data_list_, Layout::segment_states_,
9714         Layout::relaxation_debug_check_): New data members.
9715         * output.cc: (Output_section_headers::do_size): New method definition.
9716         (Output_section_headers::Output_section_headers): Move size
9717         computation to Output_section_headers::do_size.
9718         (Output_segment_headers::do_size): New method definition.
9719         (Output_file_header::Output_file_header): Move size computation to
9720         Output_file_header::do_size and call it.
9721         (Output_file_header::do_size): New method definition.
9722         (Output_data_group::Output_data_group): Adjust call to
9723         Output_section_data.
9724         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9725         (Output_symtab_xindex::do_write): Add array bound check.
9726         (Output_section::Input_section::print_to_mapfile): Handle
9727         RELAXED_INPUT_SECTION_CODE.
9728         (Output_section::Output_section): Initialize data member checkpoint_.
9729         (Output_section::~Output_section): Delete checkpoint object pointed
9730         by checkpoint_.
9731         (Output_section::add_input_section): Always add an Input_section if
9732         relaxing.
9733         (Output_section::add_merge_input_section): Add assert.
9734         (Output_section::relax_input_section): New method definition.
9735         (Output_section::set_final_data_size): Set load address to zero for
9736         an unallocated section.
9737         (Output_section::do_address_and_file_offset_have_reset_values):
9738         New method definition.
9739         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9740         Handle relaxed input section.
9741         (Output_section::sort_attached_input_sections): Checkpoint input
9742         section list lazily.
9743         (Output_section::get_input_sections): Change type of input_sections to
9744         list of Simple_input_section pointers.  Checkpoint input section list
9745         lazily.  Also handle relaxed input sections.
9746         (Output_section::add_input_section_for_script): Take a reference to
9747         a Simple_input_section object instead of Relobj pointer and section
9748         index as parameter.  Handle relaxed input sections.
9749         (Output_section::save_states, Output_section::restore_states): New
9750         method definitions.
9751         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9752         (Output_data::is_data_size_fixed): New method definition.
9753         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9754         if it is fixed.
9755         (Output_data::address_and_file_offset_have_reset_values): New method
9756         definition.
9757         (Output_data::do_address_and_file_offset_have_reset_values): New method
9758         definition.
9759         (Output_data::set_data_size): Check that data size is not fixed.
9760         (Output_data::fix_data_size): New method definition.
9761         (Output_data::is_data_size_fixed_): New data member.
9762         (Output_section_headers::set_final_data_size): New method definition.
9763         (Output_section_headers::do_size): New method declaration.
9764         (Output_segment_headers::set_final_data_size): New method definition.
9765         (Output_segment_headers::do_size): New method declaration.
9766         (Output_file_header::set_final_data_size)::New method definition.
9767         (Output_file_header::do_size)::New method declaration.
9768         (Output_section_data::Output_section_data): Add new parameter
9769         is_data_size_fixed and use it to fix data size.
9770         (Output_data_const::Output_data_const): Adjust call to base class
9771         constructor and fix data size.
9772         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9773         base class constructor and fix data size.
9774         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9775         base class constructor and fix data size.
9776         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9777         class constructor and fix data size.
9778         (Output_data_group::set_final_data_size): New method definition.
9779         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9780         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9781         class constructor and fix data size.
9782         (Output_relaxed_input_section): New class definition.
9783         (Output_section::Simple_input_section): New class definition.
9784         (Output_section::get_input_sections): Adjust parameter list.
9785         (Output_section::add_input_section_for_script): Same.
9786         (Output_section::save_states, Output_section::restore_states,
9787         Output_section::do_address_and_file_offset_have_reset_values,
9788         (Output_section::Input_section::Input_section): Handle
9789         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9790         Output_relaxed_input_section.
9791         (Output_section::Input_section::is_input_section,
9792         Output_section::Input_section::set_output_section): Handle relaxed
9793         input section.
9794         (Output_section::Input_section::is_relaxed_input_section,
9795         Output_section::Input_section::output_section_data,
9796         Output_section::Input_section::relaxed_input_section): New method
9797         definitions.
9798         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9799         value.
9800         (Output_section::Input_section::u1_): Update comments.
9801         (Output_section::Input_section::u2_): Add new union member poris.
9802         (Output_section::Checkpoint_output_section): New classs definition.
9803         (Output_section::relax_input_section): New method declaration.
9804         (Output_section::checkpoint_): New data member.
9805         (Output_segment): Update comments.
9806         (Output_segment::Output_segment): Un-privatize copy constructor.
9807         (Output_segment::operator=): Un-privatize.
9808         * script-sections.cc (Output_section_element::Input_section_list):
9809         Change element type to Output_section::Simple_input_section.
9810         (Output_section_element_dot_assignment::set_section_addresses):
9811         Register output section data for relaxation clean up.
9812         (Output_data_exression::Output_data_expression): Adjust call to base
9813         constructor to fix data size.
9814         (Output_section_element_data::set_section_addresses): Register
9815         Output_data_expression object for relaxation clean up.
9816         (struct Input_section_info): Replace Relobj pointer and section index
9817         pair with Output_section::Simple_input_section and Convert struct to a
9818         class.
9819         (Input_section_sorter::operator()): Adjust access to
9820         Input_section_info data member to use accessors.
9821         (Output_section_element_input::set_section_addresses): Use layout
9822         parameter.  Adjust code to use Output_section::Simple_input_section
9823         and Input_secction_info classes.  Register filler for relaxation
9824         clean up.
9825         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9826         and section index pair with Output_section::Simple_input_section
9827         class.  Adjust code accordingly.
9828         (Phdrs_element::release_segment): New method definition.
9829         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9830         segment list.
9831         (Script_sections::release_segments): New method definition.
9832         * gold/script-sections.h (Script_sections::release_segments): New
9833         method declaration.
9834         * gold/target.h (Target::may_relax, Target::relax,
9835         Target::do_may_relax, Target::do_relax): New method definitions.
9836
9837 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9838
9839         * arm.cc (has_signed_unsigned_overflow): New function.
9840         (Arm_relocate_functions::abs8): New function.
9841         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9842         (Target_arm::Scan::global): Likewise.
9843         (Target_arm::relocate::relocate): Likewise.
9844         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9845         Likewise.
9846
9847 2009-09-16  Cary Coutant  <ccoutant@google.com>
9848
9849         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9850         * testsuite/Makefile.in: Regenerate.
9851
9852 2009-09-11  Nick Clifton  <nickc@redhat.com>
9853
9854         * po/gold.pot: Updated by the Translation project.
9855
9856 2009-09-08  Cary Coutant  <ccoutant@google.com>
9857
9858         * output.cc (Output_file::open): Add execute permission to empty file.
9859         * testsuite/Makefile.am (permission_test): New test.
9860         * testsuite/Makefile.in: Regenerate.
9861
9862 2009-09-02  Ian Lance Taylor  <iant@google.com>
9863
9864         * output.cc (Output_file::resize): Call map_no_anonymous rather
9865         than map.
9866
9867 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9868
9869         * gold.cc: Include "incremental.h".
9870         (queue_initial_tasks): Call Incremental_checker methods.
9871         * incremental.cc: Include "output.h".
9872         (Incremental_checker::can_incrementally_link_output_file): New
9873         method.
9874         * incremental.h (Incremental_checker): New class.
9875
9876         * output.cc (Output_file::open_for_modification): New method.
9877         (Output_file::map_anonymous): Changed return type to bool.  Record
9878         map in base_ field.
9879         (Output_file::map_no_anonymous): New method, broken out of map.
9880         (Output_file::map): Use map_no_anonymous and map_anonymous.
9881         * output.h (class Output_file): Update declarations.
9882
9883 2009-08-24  Cary Coutant  <ccoutant@google.com>
9884
9885         * options.h (Command_line::Pre_options): New class.
9886         (Command_line::pre_options): New member.
9887         * options.cc (gold::options::ready_to_register): New variable.
9888         (One_option::register_option): Do nothing if not registering options.
9889         Assert if same short option registered twice.
9890         (General_options::General_options): Turn off option registration when
9891         done constructing.
9892         (Command_line::Pre_options::Pre_options): New constructor.
9893
9894 2009-08-24  Cary Coutant  <ccoutant@google.com>
9895
9896         * options.h (General_options::no_keep_memory): Remove incorrect
9897         short option.
9898
9899 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9900
9901         * Makefile.am (am__skiplex, am__skipyacc): New.
9902         * Makefile.in: Regenerate.
9903
9904 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9905
9906         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9907         (INCLUDES): ... this.
9908         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9909         (AM_CPPFLAGS): Renamed from ...
9910         (INCLUDE): ... this.
9911         * Makefile.in, testsuite/Makefile.in: Regenerate.
9912
9913         * Makefile.in: Regenerate.
9914         * aclocal.m4: Likewise.
9915         * config.in: Likewise.
9916         * configure: Likewise.
9917         * testsuite/Makefile.in: Likewise.
9918
9919         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9920         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9921         * Makefile.in: Regenerate.
9922         * testsuite/Makefile.in: Regenerate.
9923
9924 2009-08-19  Cary Coutant  <ccoutant@google.com>
9925
9926         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9927         symbols in shared libraries overridden by hidden or internal symbols
9928         in the main program.
9929
9930 2009-08-19  Chris Demetriou  <cgd@google.com>
9931
9932         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9933         checking source file names in error messages.
9934
9935 2009-08-18  Doug Kwan  <dougkwan@google.com>
9936
9937         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9938         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9939         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9940         an elfcpp::Ehdr as parameter.
9941         * object.cc (Object::set_target): Remove the version that looks up
9942         a target and sets it.
9943         (Sized_relobj::setup): Take a Target object instead of
9944         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9945         (make_elf_sized_object): Find target and ask target to
9946         make an ELF object.
9947         * object.h: (Object::set_target): Remove the version that looks up
9948         a target and sets it.
9949         (Sized_relobj::setup): Take a Target object instead of
9950         an elfcpp:Ehdr as parameter.
9951         * target.cc: Include dynobj.h.
9952         (Target::do_make_elf_object_implementation): New.
9953         (Target::do_make_elf_object): New.
9954         * target.h (Target::make_elf_object): New template declaration.
9955         (Target::do_make_elf_object): New method declarations.
9956         (Target::do_make_elf_object_implementation): New template declaration.
9957
9958 2009-08-14  Ian Lance Taylor  <iant@google.com>
9959
9960         * gold.h (FUNCTION_NAME): Define.
9961         (gold_unreachable): Use FUNCTION_NAME.
9962
9963 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9964
9965         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9966         symbol in the --keep-unique list is not found.
9967
9968 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9969
9970         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9971         been maked as --keep-unique.
9972         (Icf::unfold_section): New function.
9973         * icf.h (Icf::unfold_section): New function.
9974         * options.h (General_options::keep_unique): New option.
9975         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9976         * testsuite/Makefile.in: Regenerate.
9977         * testsuite/icf_keep_unique_test.sh: New file.
9978         * testsuite/icf_keep_unique_test.cc: New file.
9979
9980 2009-08-12  Cary Coutant  <ccoutant@google.com>
9981
9982         PR 10471
9983         * resolve.cc (Symbol_table::resolve): Check for references from
9984         dynamic objects to hidden and internal symbols.
9985         * testsuite/Makefile.am (hidden_test.sh): New test.
9986         * testsuite/Makefile.in: Regenerate.
9987         * testsuite/hidden_test.sh: New script.
9988         * testsuite/hidden_test_1.c: New test source.
9989         * testsuite/hidden_test_main.c: New test source.
9990
9991 2009-08-11  Doug Kwan  <dougkwan@google.com>
9992
9993         * arm.cc: Update comments.
9994         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9995         segment to locate the .ARM.exidx section if present.
9996
9997 2009-08-09  Doug Kwan  <dougkwan@google.com>
9998
9999         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10000         patch.
10001
10002 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10003         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10004         compiler warnings.
10005
10006 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10007
10008         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10009         valid tls_segment only for non-debug-section relocations.
10010         * testsuite/Makefile.am: Add gc_tls_test.
10011         * testsuite/Makefile.in: Regenerate.
10012         * testsuite/gc_tls_test.cc: New file.
10013         * testsuite/gc_tls_test.sh: New file.
10014
10015 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10016
10017         * icf.cc: New file.
10018         * icf.h: New file.
10019         * Makefile.am (CCFILES): Add icf.cc.
10020         (HFILES): Add icf.h
10021         * Makefile.in: Regenerate.
10022         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10023         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10024         section, symbol and addend information for the relocs.
10025         * gold.cc (queue_middle_tasks): Call identical code folding.
10026         * gold.h: Add defines for multimap.
10027         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10028         to the call of finalize_local_symbols.
10029         * main.cc (main): Create object of class Icf.
10030         * object.cc (Sized_relobj::do_layout): Allow this function to be
10031         called twice during icf.
10032         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10033         to sections marked as identical by icf.
10034         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10035         when available.
10036         (Sized_relobj::do_section_entsize): New function.
10037         * object.h (Object::section_entsize): New function.
10038         (Object::do_section_entsize): New pure virtual function.
10039         (Relobj::finalize_local_symbols): Add new parameter.
10040         (Relobj::do_section_entsize): New function.
10041         * options.h (General_options::icf): New option.
10042         (General_options::icf_iterations): New option.
10043         (General_options::print_icf_sections): New option.
10044         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10045         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10046         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10047         icf.
10048         * symtab.cc (Symbol_table::is_section_folded): New function.
10049         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10050         to sections marked as identical by icf.
10051         * symtab.h (Symbol_table::set_icf): New function.
10052         (Symbol_table::icf): New function.
10053         (Symbol_table::is_section_folded): New function.
10054         (Symbol_table::icf_): New data member.
10055         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10056         * testsuite/Makefile.am: Add commands to build icf_test.
10057         * testsuite/Makefile.in: Regenerate.
10058         * testsuite/icf_test.sh: New file.
10059         * testsuite/icf_test.cc: New file.
10060
10061 2009-07-24  Chris Demetriou  <cgd@google.com>
10062
10063         * layout.cc (is_compressible_debug_section): Fix incorrect
10064         comment about compressed section names.
10065
10066 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10067
10068         PR 10419
10069         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10070
10071 2009-07-16  Ian Lance Taylor  <iant@google.com>
10072
10073         PR 10400
10074         * layout.h: #include <map>.
10075         (class Kept_section): Change from struct to class.  Add accessors
10076         and setters.  Add section size to Comdat_group mapping.  Change
10077         Comdat_group to std::map.  Add is_comdat_ field.  Add
10078         linkonce_size field in union.
10079         (class Layout): Update declaration of find_or_add_kept_section.
10080         Don't declare find_kept_object.
10081         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10082         parameter.  Add object, shndx, is_comdat, and is_group_name
10083         parameters.  Change all callers.  Adjust for new Kept_section.
10084         (Layout::find_kept_object): Remove.
10085         * object.cc (Sized_relobj::include_section_group): Update use of
10086         Kept_section.  Rename secnum to shndx.  Only record
10087         Kept_comdat_section if sections are the same size.
10088         (Sized_relobj::include_linkonce_section): Update use of
10089         Kept_section.  Only record Kept_comdat_section if sections are the
10090         same size.  Set size of linkonce section.
10091         (Sized_relobj::map_to_kept_section): Update call to
10092         get_kept_comdat_section.
10093         * object.h (class Sized_relobj): Rename fields in
10094         Kept_comdat_section to drop trailing underscores; change object
10095         field to Relobj*.  Change Kept_comdat_section_table to store
10096         struct rather than pointer.
10097         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10098         Add kept_object and kept_shndx parameters.  Change all callers.
10099         (Sized_relobj::get_kept_comdat_section): Change return type to
10100         bool.  Add kept_object and kept_shndx parameters.  Change all
10101         callers.
10102         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10103         Layout::find_or_add_kept_section.
10104
10105 2009-07-09  Ian Lance Taylor  <iant@google.com>
10106
10107         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10108         Reserve space in the hash table.
10109
10110 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10111
10112         * fileread.cc (File_read::get_mtime): New method.
10113         * fileread.h (Timespec): New structure.
10114         (File_read::get_mtime): New method.
10115         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10116         Renamed from timestamp_nsec.
10117         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10118         Elf_Xword.
10119         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10120         timestamp_nsec.
10121         (Incremental_inputs::report_archive): Save mtime; style fix.
10122         (Incremental_inputs::report_obejct): Save mtime; style fix.
10123         (Incremental_inputs::report_script): Save mtime; style fix.
10124         (Incremental_inputs::finalize_inputs): Style fix.
10125         (Incremental_inputs::finalize): Style fix.
10126         (Incremental_inputs::create_input_section_data): Store inputs
10127         mtime.
10128         * incremental.h (Incremental_inputs::report_script): Add mtime
10129         argument.
10130         (Incremental_inputs::Input_info::Input_info): Intialize only one
10131         union member.
10132         (Incremental_inputs::Input_info::archive): Move to nameless
10133         union.
10134         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10135         (Incremental_inputs::Input_info::script): Move to nameless union.
10136         (Incremental_inputs::mtime): New field.
10137         * script.cc (read_input_script): Pass file mtime to
10138         Incremental_input.
10139         * script.h (Script_info::inputs): Style fix.
10140
10141 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10142
10143         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10144         instead of 32.
10145
10146 2009-06-24  Ian Lance Taylor  <iant@google.com>
10147
10148         PR 10156
10149         * layout.cc (Layout::choose_output_section): If we find an
10150         existing section, update the flags.
10151         (Layout::create_notes): New function, broken out of
10152         Layout::finalize.
10153         (Layout::finalize): Don't create note sections.
10154         (Layout::create_note): Don't crash if linker script discards
10155         section.
10156         (Layout::create_gold_note): Likewise.
10157         (Layout::create_build_id): Likewise.  Don't set
10158         after_input_sections on the section.
10159         (Layout::create_executable_stack_info): Remove target parameter.
10160         Change caller.
10161         * layout.h (class Layout): Declare create_notes.  Update
10162         declaration of create_executable_stack_info.
10163         * gold.cc (queue_middle_tasks): Call create_notes.
10164         * output.cc (Output_section::update_flags_for_input_section): Move
10165         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10166         invalid.
10167         * output.h (Output_data::mark_address_invalid): New function.
10168         (class Output_section): Only declare, not define,
10169         update_flags_for_input_section.  Remove set_flags.
10170
10171 2009-06-24  Ian Lance Taylor  <iant@google.com>
10172
10173         * script-sections.cc (Output_section_definition::
10174         set_section_addresses): Rename shadowing local load_address to
10175         laddr.
10176
10177 2009-06-24  Ian Lance Taylor  <iant@google.com>
10178
10179         PR 10244
10180         * reloc.cc (relocate_sections): Skip empty relocation sections.
10181
10182 2009-06-23  Ian Lance Taylor  <iant@google.com>
10183
10184         PR 10156
10185         * layout.cc (Layout::create_note): Use choose_output_section
10186         rather than make_output_section.
10187
10188 2009-06-23  Ian Lance Taylor  <iant@google.com>
10189
10190         PR 10237
10191         * options.cc (General_options::parse_V): Set printed_version_.
10192         (General_options::General_options): Initialize printed_version_.
10193         * options.h (class General_options): Add printed_version_ field.
10194         * gold.cc (queue_initial_tasks): If there are no input files,
10195         don't give a fatal error if we printed the version information.
10196         (queue_middle_tasks): If using -r with a shared object, give a
10197         fatal error rather than an ordinary error.
10198
10199 2009-06-23  Ian Lance Taylor  <iant@google.com>
10200
10201         PR 10219
10202         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10203         (Layout::make_output_section): Set have_stabstr_section_ if we see
10204         a .stab*str section.
10205         (Layout::finalize): Call link_stabs_sections.
10206         (Layout::link_stabs_sections): New file.
10207         * layout.h (class Layout): Add have_stabstr_section_ field.
10208         Declare link_stabs_sections.
10209
10210 2009-06-23  Doug Kwan  <dougkwan@google.com>
10211
10212         * Makefile.am (libgold_a_LIBADD): New.
10213         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10214         * Makefile.in: Regenerate.
10215         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10216         * configure: Regenerate.
10217         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10218         * fileread.cc: Include sys/state.h
10219         * gold.h: Declare memmem and strndup if found missing.
10220         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10221
10222 2009-06-23  Ian Lance Taylor  <iant@google.com>
10223
10224         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10225         * configure: Rebuild.
10226
10227 2009-06-23  Ian Lance Taylor  <iant@google.com>
10228
10229         PR 10147
10230         * object.cc (Object::section_contents): Don't try to get a view if
10231         the section has length zero.
10232         (Object::handle_gnu_warning_section): If the section is empty, use
10233         the name of the section as the warning.
10234
10235 2009-06-23  Ian Lance Taylor  <iant@google.com>
10236
10237         PR 10133
10238         * stringpool.h (class Stringpool_template): Add optimize_ field.
10239         (Stringpool_template::set_optimize): New function.
10240         * stringpool.cc (Stringpool_template::Stringpool_template):
10241         Initialize optimize_ field.
10242         (Stringpool_template::set_string_offsets): Test local optimize
10243         fild rather than parameter.
10244         * layout.cc (Layout::Layout): Call set_optimize on the section
10245         name stringpool.
10246
10247 2009-06-22  Ian Lance Taylor  <iant@google.com>
10248
10249         PR 10030
10250         * yyscript.y: Parse TARGET.
10251         * script.cc (script_set_target): New function.
10252         * script-c.h (script_set_target): Declare.
10253         * options.cc (General_options::string_to_object_format): Rename
10254         from string_to_object_format in anonymous namespace.  Change
10255         callers.
10256         * options.h (class General_options): Declare
10257         string_to_object_format.
10258
10259 2009-06-22  Ian Lance Taylor  <iant@google.com>
10260
10261         * script-sections.cc (Script_sections::create_segments): Don't put
10262         program headers in a PT_LOAD segment if -n or -N.
10263
10264 2009-06-22  Ian Lance Taylor  <iant@google.com>
10265
10266         PR 10141
10267         * options.h (class General_options): Add -z lazy and -z now.  Sort
10268         -z options into alphabetical order.
10269         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10270
10271 2009-06-21  Ian Lance Taylor  <iant@google.com>
10272
10273         * layout.cc (Layout::make_output_section): Call
10274         Target::new_output_section.
10275         (Layout::attach_allocated_section_to_segment): Put large section
10276         sections in a separate load segment with the large segment flag
10277         set.
10278         (Layout::segment_precedes): Sort large data segments after other
10279         load segments.
10280         (align_file_offset): New static function.
10281         (Layout::set_segment_offsets): Use align_file_offset.
10282         * output.h (class Output_section): Add is_small_section_ and
10283         is_large_section_ fields.
10284         (Output_section::is_small_section): New function.
10285         (Output_section::set_is_small_section):  New function.
10286         (Output_section::is_large_section): New function.
10287         (Output_section::set_is_large_section): New function.
10288         (Output_section::is_large_data_section): New function.
10289         (class Output_segment): Add is_large_data_segment_ field.
10290         (Output_segment::is_large_data_segment): New function.
10291         (Output_segment::set_is_large_data_segment): New function.
10292         * output.cc (Output_section::Output_section): Initialize new
10293         fields.
10294         (Output_segment::Output_segment): Likewise.
10295         (Output_segment::add_output_section): Add assertion that large
10296         data sections always go in large data segments.  Force small data
10297         sections to the end of the list of data sections.  Force small BSS
10298         sections to the start of the list of BSS sections.  For large BSS
10299         sections to the end of the list of BSS sections.
10300         * symtab.h (class Symbol): Declare is_common_shndx.
10301         (Symbol::is_defined): Check Symbol::is_common_shndx.
10302         (Symbol::is_common): Likewise.
10303         (class Symbol_table): Define enum Commons_section_type.  Update
10304         declarations.  Add small_commons_ and large_commons_ fields.
10305         * symtab.cc (Symbol::is_common_shndx): New function.
10306         (Symbol_table::Symbol_table): Initialize new fields.
10307         (Symbol_table::add_from_object): Put small and large common
10308         symbols in the right list.
10309         (Symbol_table::sized_finalized_symbol): Check
10310         Symbol::is_common_shndx.
10311         (Symbol_table::sized_write_globals): Likewise.
10312         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10313         common symbol lists.  Don't call do_allocate_commons_list if the
10314         list is empty.
10315         (Symbol_table::do_allocate_commons_list): Remove is_tls
10316         parameter.  Add comons_section_type parameter.  Change all
10317         callers.  Handle small and large common symbols.
10318         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10319         Symbol::is_common_shndx.
10320         * resolve.cc (symbol_to_bits): Likewise.
10321         * target.h (Target::small_common_shndx): New function.
10322         (Target::small_common_section_flags): New function.
10323         (Target::large_common_shndx): New function.
10324         (Target::large_common_section_flags): New function.
10325         (Target::new_output_section): New function.
10326         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10327         small_common_section_flags, and large_common_section_flags
10328         fields.
10329         (Target::do_new_output_section): New virtual function.
10330         * arm.cc (Target_arm::arm_info): Initialize new fields.
10331         * i386.cc (Target_i386::i386_info): Likewise.
10332         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10333         Likewise.
10334         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10335         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10336         (Target_x86_64::do_new_output_section): New function.
10337         * configure.ac: Define conditional MCMODEL_MEDIUM.
10338         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10339         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10340         (large_LDFLAGS): Define.
10341         * testsuite/large.c: New file.
10342         * testsuite/testfile.cc (Target_test::test_target_info):
10343         Initialize new fields.
10344         * configure, testsuite/Makefile.in: Rebuild.
10345
10346 2009-06-05  Doug Kwan  <dougkwan@google.com>
10347
10348         * Makefile.am (CCFILES): Add target.cc.
10349         * Makefile.in: Regenerate.
10350         * i386.cc (class Target_i386): Define new virtual method to
10351         override do_is_local_label_name in parent.
10352         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10353         local symbols if --discard-locals or -X is given.
10354         * options.h (class General_options): Declare new options
10355         '--discard-locals' and '-X' for discarding locals.
10356         * target.h (class Target): Define new methods is_local_label_name.
10357         Declare new virtual method do_is_local_label_name.
10358         * target.cc: New file.
10359         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10360         (check_SCRIPTS): Add discard_locals_test.sh.
10361         (check_DATA): Add discard_local_tests.syms.
10362         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10363         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10364         * testsuite/Makefile.in: Regenerate.
10365         * testsuite/discard_locals_test.c: New file.
10366         * testsuite/discard_locals_test.sh: Same.
10367
10368 2009-06-05  Doug Kwan  <dougkwan@google.com>
10369
10370         * object.cc (Sized_relobj::Sized_relobj): Initialize
10371         discarded_eh_frame_shndx_ to -1U.
10372         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10373         section.
10374         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10375         a discarded .eh_frame section.
10376         (Sized_relobj::do_finalize_local_symbols): Ditto.
10377         * object.h (class Sized_relobj): Declare new member
10378         discarded_eh_frame_shndx_.
10379         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10380         (local_labels_test.o, local_labels_test): New rules.
10381         * testsuite/Makefile.in: Regenerate.
10382
10383 2009-06-04  Doug Kwan  <dougkwan@google.com>
10384
10385         * layout.cc (Layout::section_name_mapping): Add mapping for
10386         special ARM sections.
10387
10388 2009-06-03  Doug Kwan  <dougkwan@google.com>
10389
10390         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10391         (utils::has_overflow): Same.
10392
10393 2009-06-03  Ian Lance Taylor  <iant@google.com>
10394
10395         * layout.cc (Layout::section_name_mapping): New array, replacing
10396         Layout::linkonce_mapping.
10397         (Layout::section_name_mapping_count): New variable, replacing
10398         Layout::linkonce_mapping_count.
10399         (Layout::linkonce_output_name): Remove.
10400         (Layout::output_section_name): Rewrite.
10401         * layout.h (class Layout): Rename Linkonce_mapping to
10402         Section_name_mapping, linkonce_mapping to section_name_mapping,
10403         linkonce_mapping_count to section_name_mapping_count.  Don't
10404         declare linkonce_output_name.
10405
10406 2009-06-03  Doug Kwan  <dougkwan@google.com>
10407
10408         * gold/arm.cc (namespace utils): New.
10409         (Target_arm::reloc_is_non_pic): Define new method.
10410         (class Arm_relocate_functions): New.
10411         (Target_arm::Relocate::relocate): Handle relocation types used by
10412         Android.
10413
10414 2009-06-03  Ian Lance Taylor  <iant@google.com>
10415
10416         * arm.cc (Target_arm::scan::global): Use || instead of |.
10417
10418 2009-06-02  Doug Kwan  <dougkwan@google.com>
10419
10420         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10421         issued_non_pic_error_.
10422         (class Target_arm::Scan): Declare new method check_non_pic.
10423         Define new method symbol_needs_plt_entry.
10424         Declare new data member issued_non_pic_error_.
10425         (class Target_arm::Relocate): Declare new method
10426         should_apply_static_reloc.
10427         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10428         (Target_arm::Scan::check_non_pic): Define new method.
10429         (Target_arm::Scan::local): Handle a small subset of reloc types used
10430         by Android.
10431         (Target_arm::Scan::local): Same.
10432         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10433
10434 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10435
10436         * incremental.cc (Incremental_inputs::report_command_line): Filter
10437         out --incremental-* options.
10438
10439 2009-05-29  Doug Kwan  <dougkwan@google.com>
10440
10441         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10442         template class.
10443         (class Target_arm): Update comment.
10444         (Target_arm::Target_arm): Initialize new data members GOT_,
10445         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10446         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10447         and Target_arm::rel_dyn_section.
10448         Declare new_enum Target_arm::Got_type.
10449         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10450         and DYNBSS_.
10451         Update commments for member do_dynsym_value.
10452         (Target_arm::got_size, Target_arm::plt_section,
10453         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10454         new methods inside class defintion.
10455         (Target_arm::got_section): Define new method.
10456         (Target_arm::rel_dyn_section): Same.
10457         (Output_data_plt_arm): New template class.
10458         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10459         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10460         (Output_data_plt_arm::add_entry): Same.
10461         (Output_data_plt_arm::first_plt_entry): Define new
10462         static data member for PLT instruction template.
10463         (Output_data_plt_arm::plt_entry): Same.
10464         (Output_data_plt_arm::do_write): Define new method.
10465         (Target_arm::make_plt_entry): Same.
10466         (Target_arm::do_finalize_sections): Same.
10467         (Target_arm::do_dynsym_value): Same.
10468
10469 2009-05-28  Doug Kwan  <dougkwan@google.com>
10470
10471         * Makefile.am (TARGETSOURCES): Add arm.cc.
10472         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10473         * Makefile.in: Regenerate.
10474         * arm.cc: New file.
10475         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10476
10477 2009-05-26  Doug Kwan  <dougkwan@google.com>
10478
10479         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10480         (General_options::check_excluded_libs): Strip off directories in
10481         archive name before matching like GNU ld does.
10482         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10483         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10484         (exclude_libs_test_LDFLAGS): Add linker option
10485         -Wl,--exclude-libs,libexclude_libs_test_3
10486         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10487         an explicit archive without using -l.
10488         (alt/libexclude_libs_test_3.a): New make rule.
10489         * testsuite/Makefile.in: Regenerate.
10490         * testsuite/exclude_libs_test.c : Declare lib3_default().
10491         (main): Call it.
10492         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10493         * exclude_libs_test_3.c: New file.
10494
10495 2009-05-26  Nick Clifton  <nickc@redhat.com>
10496
10497         * po/id.po: New Indonesian translation.
10498         * po/gold.pot: Updated template file.
10499
10500 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10501
10502         * testsuite/Makefile.am: Add -ffunction-sections to compile
10503         gc_comdat_test files.  Add -Wl,--gc-sections to build
10504         gc_comdat_test.
10505         * testsuite/Makefile.in: Regenerate.
10506         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10507
10508 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10509
10510         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10511         kept comdat section was garbage collected.
10512         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10513         * testsuite/Makefile.in: Regenerate.
10514         * testsuite/gc_comdat_test.sh: New file.
10515         * testsuite/gc_comdat_test_1.cc: New file.
10516         * testsuite/gc_comdat_test_2.cc: New file.
10517
10518 2009-05-19  Doug Kwan  <dougkwan@google.com>
10519
10520         * archive.cc (Archive::Archive): Move constructor from archive.h
10521         to here.  Initialize no_export_.
10522         (Archive::get_elf_object_for_member): Set no_export flag of object.
10523         * archive.h (Archive::Archive): Move constructor body to
10524         archive.cc.
10525         (Archive::no_export): New method.
10526         (Archive::no_export_): New field.
10527         * object.h (Object::Object): Initialize no_export_ to false.
10528         (Object::no_export, Object::set_no_export): New methods.
10529         (Object::no_export_): New field.
10530         * options.cc (General_options::parse_exclude_libs): New method.
10531         (General_options::check_excluded_libs) Same.
10532         * options.h (exclude_libs): New option.
10533         (General_options::check_excluded_libs): New method declaration.
10534         (General_options::excluded_libs_): New field.
10535         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10536         default or protected visibility if an object has no-export flag set.
10537         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10538         (check_SCRIPTS): Add exclude_libs_test.sh.
10539         (check_DATA): Add exclude_libs_test.syms.
10540         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10541         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10542         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10543         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10544         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10545         libexclude_libs_test_2.a): New rules.
10546         * testsuite/Makefile.in: Regenerate.
10547         * testsuite/exclude_libs_test.c: New file.
10548         * testsuite/exclude_libs_test.sh: Ditto.
10549         * testsuite/exclude_libs_test_1.c: Ditto.
10550         * testsuite/exclude_libs_test_2.c: Ditto.
10551
10552 2009-05-15  Ian Lance Taylor  <iant@google.com>
10553
10554         * configure.ac: Check for declarations for cases where libiberty.h
10555         checks HAVE_DECL_xxx.
10556         * configure, config.in: Rebuild.
10557
10558 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10559
10560         * gold.h (Incremental_argument_list): Remove (invalid) forward
10561         declaration.
10562         * incremental.cc (Incremental_inputs::report_achive): New method.
10563         (Incremental_inputs::report_object): New method.
10564         (Incremental_inputs::report_script): New method.
10565         (Incremental_inputs::finalize_inputs): New method.
10566         (Incremental_inputs::finalize): Call finalize_inputs().
10567         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10568         Create inputs entries.
10569         * incremental.h (Incremental_input_type): New enum.
10570         (Incremental_inputs::Incremental_input): Initialize new fields.
10571         (Incremental_inputs::report_inputs): New method.
10572         (Incremental_inputs::report_achive): New method.
10573         (Incremental_inputs::report_object): New method.
10574         (Incremental_inputs::report_script): New method.
10575         (Incremental_inputs::finalize_inputs): New method.
10576         (Incremental_inputs::Input_info): New struct.
10577         (Incremental_inputs::Input_info_map): New typedef.
10578         (Incremental_inputs::lock_): New field.
10579         (Incremental_inputs::Inputs_): New field.
10580         (Incremental_inputs::Inputs_map): New field.
10581         * main.cc (main): Call Incremental_input::report_inputs.
10582         * options.h (Input_argument_list): Typedef moved from
10583         Input_arguments.
10584         (Input_file_group::Files): Remove, use ::Input_argument_list.
10585         (Input_file_group::Input_argument_list): Remove, use
10586         ::Input_argument_list.
10587         * plugin.cc (Plugin_manager::add_input_file): Add error in
10588         incremental build.
10589         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10590         functions.
10591         * script.cc (read_input_script): Call
10592         Incremental_input::report_script.
10593         * script.h (Script_info): New class.
10594
10595 2009-04-27  Ian Lance Taylor  <iant@google.com>
10596
10597         * x86_64.cc (do_adjust_output_section): Set entsize to
10598         plt_entry_size.
10599
10600 2009-04-23  Elliott Hughes  <enh@google.com>
10601
10602         * output.cc (Output_file::close): After short writes, continue
10603         writing from the correct offset in the buffer being written.
10604
10605 2009-04-23  Chris Demetriou  <cgd@google.com>
10606
10607         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10608         * configure: Regenerate.
10609         * config.in: Regenerate.
10610         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10611         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10612
10613 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10614
10615         * incremental.cc (Incremental_inputs_header_data): Renamed from
10616         Incremental_input_header_data.
10617         (Incremental_inputs_header_data::data_size): New field.
10618         (Incremental_inputs_header_data::put_input_file_count): Renamed
10619         from input_file_count.
10620         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10621         from command_line_offset.
10622         (Incremental_inputs_header_data::put_reserved): Renamed from
10623         put_reserved.
10624         (Incremental_inputs_entry_data): Renamed from
10625         Incremental_input_entry_data.
10626         (Incremental_inputs_entry_data::data_size): New field.
10627         (Incremental_inputs::report_command_line): New method.
10628         (Incremental_inputs::finalize): New method.
10629         (Incremental_inputs::create_incremental_inputs_data): New method.
10630         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10631         * incremental.h: New file.
10632         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10633         (Layout::finalize): Create incremental inputs section in
10634         incremental builds.
10635         (Layout::create_incremental_info_sections): New method.
10636         * layout.h (Layout::incremental_inputs): New method.
10637         (Layout::create_incremental_info_sections): New method.
10638         (Layout::incremental_inputs_): New field.
10639         * main.cc (main): Notify Incremental_input of the command line.
10640
10641 2009-04-01  Ian Lance Taylor  <iant@google.com>
10642             Mikolaj Zalewski  <mikolajz@google.com>
10643
10644         * gold.h (reserve_unordered_map): Define, three versions, one for
10645         each version of Unordered_map.
10646         * layout.cc (Layout::Layout): Remove options parameter.  Add
10647         number_of_input_files parameter.  Don't initialize options_.
10648         Initialize number_of_input_files_ and resized_signatures_.  Move
10649         sections_are_attached_.
10650         (Layout::layout_group): Reserve space for group_signatures_.
10651         (Layout::find_or_add_kept_section): Change name parameter to be a
10652         reference.  Resize signatures_ map when it gets large enough.
10653         (Layout::layout_eh_frame): Use parameters->options() instead of
10654         this->options_.
10655         (Layout::make_output_section): Likewise.
10656         (Layout::attach_allocated_section_to_segment): Likewise.
10657         (Layout::finalize, Layout::create_executable_stack): Likewise.
10658         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10659         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10660         * layout.h (class Layout): Update declarations.  Remove options_
10661         field.  Add number_of_input_files_ and resized_signatures_
10662         fields.  Move sections_are_attached_ field.
10663         * main.cc (main): Pass number of input files to Layout
10664         constructor.  Don't pass options.
10665
10666 2009-03-30  Ian Lance Taylor  <iant@google.com>
10667
10668         * ffsll.c (ffsll): Correct implementation.
10669
10670 2009-03-27  Ian Lance Taylor  <iant@google.com>
10671
10672         * ffsll.c: New file.
10673         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10674         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10675         * ftruncate.c (ftruncate): Declare before definition.
10676         * mremap.c (mremap): Likewise.
10677         * pread.c (pread): Likewise.
10678         * configure, Makefile.in, config.in: Rebuild.
10679
10680         * mremap.c: New file.
10681         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10682         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10683         (mremap): Declare if HAVE_MREMAP is not defined.
10684         * configure, Makefile.in, config.in: Rebuild.
10685
10686 2009-03-27  Cary Coutant  <ccoutant@google.com>
10687
10688         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10689         position independent.
10690         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10691         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10692
10693 2009-03-24  Cary Coutant  <ccoutant@google.com>
10694
10695         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10696         an executable.
10697         (needs_dynamic_reloc): Likewise.
10698
10699 2009-03-24  Ian Lance Taylor  <iant@google.com>
10700
10701         * yyscript.y (file_cmd): Recognize EXTERN.
10702         (extern_name_list, extern_name_list_body): New nonterminals.
10703         * script.cc (script_add_extern): Define.
10704         * script-c.h (script_add_extern): Declare.
10705
10706 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10707
10708         * object.cc (is_elf_object): Define.
10709         * object.h (is_elf_object): Declare.
10710         * archive.cc (Archive::get_elf_object_for_member): Call
10711         is_elf_object.
10712         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10713
10714 2009-03-24  Elliott Hughes  <enh@google.com>
10715
10716         * output.cc (Output_file::map_anonymous): Define.
10717         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10718         try an anonymous one.  Report the size if the mmap fails.
10719         * output.h (class Output_file): Declare map_anonymous.
10720
10721 2009-03-24  Ian Lance Taylor  <iant@google.com>
10722
10723         * target-select.cc (instantiate_target): Don't acquire the lock if
10724         the instantiated_target_ field has already been set.
10725
10726 2009-03-23  Ian Lance Taylor  <iant@google.com>
10727
10728         * gold-threads.h (class Initialize_lock): Define.
10729         * gold-threads.cc (class Initialize_lock_once): Define.
10730         (initialize_lock_control): New static variable.
10731         (initialize_lock_pointer): New static variable.
10732         (initialize_lock_once): New static function.
10733         (Initialize_lock::Initialize_lock): Define.
10734         (Initialize_lock::initialize): Define.
10735         * target-select.h: Include "gold-threads.h".
10736         (class Target_selector): Add lock_ and initialize_lock_ fields.
10737         Don't define instantiate_target, just declare it.
10738         * target-select.cc (Target_selector::Target_selector): Initialize
10739         new fields.
10740         (Target_selector::instantiate_target): Define.
10741         * descriptors.h: Include "gold-threads.h".
10742         (class Descriptors): Add initialize_lock_ field.
10743         * descriptors.cc (Descriptors::Descriptors): Initialize new
10744         field.
10745         (Descriptors::open): Use initialize_lock_ field
10746         * errors.h (class Errors): Add initialize_lock_ field.
10747         * errors.cc (Errors::Errors): Initialize new field.
10748         (Errors::initialize_lock): Use initialize_lock_ field.
10749         * powerpc.cc (class Target_selector_powerpc): Remove
10750         instantiated_target_ field.  In do_recognize call
10751         instantiate_target rather than do_instantiate_target.  In
10752         do_instantiate_target just allocate a new target.
10753         * sparc.cc (class Target_selector_sparc): Likewise.
10754
10755         * freebsd.h: New file.
10756         * i386.cc: Include "freebsd.h".
10757         (Target_i386): Derive from Target_freebsd rather than
10758         Sized_target.
10759         (Target_selector_i386): Derive from Target_selector_freebsd rather
10760         than Target_selector.
10761         * x86_64.cc: Include "freebsd.h".
10762         (Target_x86_64): Derive from Target_freebsd rather than
10763         Sized_target.
10764         (Target_selector_x86_64): Derive from Target_selector_freebsd
10765         rather than Target_selector.
10766         * target.h (class Target): Add adjust_elf_header and
10767         do_adjust_elf_header.
10768         * output.cc (Output_file_header:: do_sized_write): Call target
10769         adjust_elf_header routine.
10770         * configure.tgt: Set targ_osabi.
10771         * configure.ac: Define GOLD_DEFAULT_OSABI.
10772         * parameters.cc (Parameters::default_target): Pass
10773         GOLD_DEFAULT_OSABI to select_target.
10774         * target-select.h (class Target_selector): Make instantiate_target
10775         protected rather than private.
10776         * Makefile.am (HFILES): Add freebsd.h.
10777         * configure, Makefile.in, config.in: Rebuild.
10778
10779         * merge.cc (do_add_input_section): Correct pend value.  Change
10780         message about last entry not being null terminated from error to
10781         warning.
10782
10783 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10784
10785         * incremental.cc: New file.
10786         * Makefile.am (CCFILES): Add incremental.cc.
10787         * Makefile.in: Rebuild.
10788
10789 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10790
10791         * layout.cc (Layout::output_section_name): Preserve names
10792         of '.note.' sections.
10793
10794 2009-03-19  Ian Lance Taylor  <iant@google.com>
10795
10796         * descriptors.cc (Descriptors::open): Check that the options are
10797         valid before using them.
10798
10799 2009-03-18  Ian Lance Taylor  <iant@google.com>
10800
10801         * script-sections.h: Include <list>.
10802         (class Script_sections): Change Sections_elements from std::vector
10803         to std::list.  Typedef public Elements_iterator.  Add
10804         orphan_section_placement_, data_segment_align_start_, and
10805         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10806         field.
10807         * script-sections.cc (class Orphan_section_placement): New class.
10808         (class Sections_element): Add virtual functions is_relro and
10809         orphan_section_init.  Remove virtual function place_orphan_here.
10810         (class Output_section_definition): Add is_relro and
10811         orphan_section_init.  Remove place_orphan_here.
10812         (class Orphan_output_section): Likewise.
10813         (Script_sections::Script_sections): Update for field changes.
10814         (Script_sections::data_segment_align): Set saw_data_segment_align_
10815         and data_segment_align_start_, not data_segment_align_index.
10816         (Script_sections::data_segment_relro_end): Check
10817         saw_data_segment_align_.  Use data_segment_align_start_ rather
10818         than data_segment_align_index_.
10819         (Script_sections::place_orphan): Rewrite to use
10820         Orphan_section_placement.
10821
10822 2009-03-17  Ian Lance Taylor  <iant@google.com>
10823
10824         * archive.cc (Archive::add_symbols): Check for a version attached
10825         to the symbol name in the archive map.
10826         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10827         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10828         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10829         (ver_test_11.a): New target.
10830         * testsuite/Makefile.in: Rebuild.
10831
10832         * configure.ac: Check for chsize and posix_fallocate.  Replace
10833         ftruncate.
10834         * ftruncate.c: New file, from gnulib.
10835         * output.cc (posix_fallocate): Define dummy version if not
10836         HAVE_POSIX_FALLOCATE.
10837         (Output_file::map): Call posix_fallocate rather than lseek and
10838         write.
10839         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10840         * configure, Makefile.in, config.in: Rebuild.
10841
10842 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10843
10844         * layout.h (Layout::create_note): Add section_name parameter.
10845         * layout.cc (Layout::create_note): Likewise.
10846         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10847
10848 2009-03-17  Ian Lance Taylor  <iant@google.com>
10849
10850         * descriptors.cc: Include "options.h".
10851         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10852         (Descriptors::open): Always use O_CLOEXEC when opening a new
10853         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10854         then set FD_CLOEXEC.
10855
10856         * sparc.cc (class Target_sparc): Add has_got_section.
10857         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10858         make sure we have a GOT section.
10859
10860         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10861         (Target_sparc::Scan::local): Likewise.
10862         (Target_sparc::Scan::global): Likewise.
10863         (Target_sparc::Relocate::relocate): Likewise.
10864         (Target_sparc::Relocate::relocate_tls): Likewise.
10865
10866         * symtab.cc (Symbol_table::define_default_version): New function,
10867         broken out of add_from_object.
10868         (Symbol_table::add_from_object): Call define_default_version.
10869         (Symbol_table::define_special_symbol): Add resolve_oldsym
10870         parameter.  Change all callers.  If the version for a symbol comes
10871         from a version script, resolve it with the symbol with the same
10872         name with no version.  Also add the symbol without a version if
10873         appropriate.
10874         (do_define_in_output_data): If resolving with oldsym, don't delete
10875         sym.
10876         (do_define_in_output_segment): Likewise.
10877         (do_define_as_constant): Likewise.
10878         * symtab.h (class Symbol_table): Update declarations.
10879
10880 2009-03-13  Ian Lance Taylor  <iant@google.com>
10881
10882         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10883         (Read_symbols::requeue): New function.
10884         (Read_symbols::do_read_symbols): If make_elf_object fails because
10885         the target type is not configured, and the file was searched for,
10886         issue a warning and retry with the next directory.
10887         (Add_symbols::run): If the file has an incompatible format, and
10888         it was searched for, requeue the Read_symbols task.  On error,
10889         release the object.
10890         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10891         dirindex parameter to constructor.  Change all callers.  Declare
10892         incompatible_warning and requeue.
10893         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10894         input_argument_ and input_group_ fields.  Add them to
10895         constructor.  Change all callers.
10896         (class Read_script): Add dirindex_ field.  Add it to constructor.
10897         Change all callers.
10898         * archive.cc (Archive::setup): Remove input_objects parameter.
10899         Change all callers.
10900         (Archive::get_file_and_offset): Likewise.
10901         (Archive::read_all_symbols): Likewise.
10902         (Archive::read_symbols): Likewise.
10903         (Archive::get_elf_object_for_member): Remove input_objects
10904         parameter.  Add punconfigured parameter.  Change all callers.
10905         (Archive::add_symbols): Change return type to bool.  Check return
10906         value of include_member.
10907         (Archive::include_all_members): Likewise.
10908         (Archive::include_member): Change return type to bool.  Return
10909         false if first included object has incompatible target.  Set
10910         included_member_ field.
10911         (Add_archive_symbols::run): If add_symbols returns false, requeue
10912         Read_symbols task.
10913         * archive.h (class Archive): Add included_member_ field.
10914         Initialize it in constructor.  Add input_file and searched_for
10915         methods.  Update declarations.
10916         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10917         input_argument_ fields.  Add them to constructor.  Change all
10918         callers.
10919         * script.cc: Include "target-select.h".
10920         (class Parser_closure): Add skip_on_incompatible_target_ and
10921         found_incompatible_target_ fields.  Add
10922         skip_on_incompatible_target parameter to constructor.  Change all
10923         callers.  Add methods skip_on_incompatible_target,
10924         clear_skip_on_incompatible_target, found_incompatible_target, and
10925         set_found_incompatible_target.
10926         (read_input_script): Add dirindex parameter.  Change all callers.
10927         If parser finds an incompatible target, requeue Read_symbols
10928         task.
10929         (script_set_symbol): Clear skip_on_incompatible_target in
10930         closure.
10931         (script_add_assertion, script_parse_option): Likewise.
10932         (script_start_sections, script_add_phdr): Likewise.
10933         (script_check_output_format): New function.
10934         * script.h (read_input_script): Update declaration.
10935         * script-c.h (script_check_output_format): Declare.
10936         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10937         (ignore_cmd): Remove OUTPUT_FORMAT.
10938         * fileread.cc (Input_file::Input_file): Add explicit this.
10939         (Input_file::will_search_for): New function.
10940         (Input_file::open): Add pindex parameter.  Change all callers.
10941         * fileread.h (class Input_file): Add input_file_argument method.
10942         Declare will_search_for.  Update declarations.
10943         * object.cc (make_elf_object): Add punconfigured parameter.
10944         Change all callers.
10945         * object.h (class Object): Make input_file public.  Add
10946         searched_for method.
10947         (make_elf_object): Update declaration.
10948         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10949         restart search.
10950         * dirsearch.h (class Dirsearch): Update declaration.
10951         * options.h (class General_options): Add --warn-search-mismatch.
10952         * parameters.cc (Parameters::is_compatible_target): New function.
10953         * parameters.h (class Parameters): Declare is_compatible_target.
10954         * workqueue.cc (Workqueue::add_blocker): New function.
10955         * workqueue.h (class Workqueue): Declare add_blocker.
10956
10957         * fileread.cc (Input_file::open): Remove options parameter.
10958         Change all callers.
10959         (Input_file::open_binary): Likewise.
10960         * script.cc (read_input_script): Likewise.
10961         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10962         options parameter from constructor.  Change all callers.
10963         (class Read_script): Likewise.
10964         * fileread.h (class Input_file): Update declarations.
10965         * script.h (read_input_script): Update declaration.
10966
10967 2009-03-10  Nick Clifton  <nickc@redhat.com>
10968
10969         * po/es.po: New Spanish translation.
10970
10971 2009-03-06  Cary Coutant  <ccoutant@google.com>
10972
10973         * options.cc (parse_short_option): Keep dash_z from registering itself.
10974
10975 2009-03-03  Ian Lance Taylor  <iant@google.com>
10976
10977         PR 9918
10978         * target-reloc.h (relocate_section): Pass output_section to
10979         relocate.
10980         * i386.cc (Target_i386::should_apply_static_reloc): Add
10981         output_section parameter.  Change all callers.
10982         (Target_i386::Relocate::relocate): Add output_section parameter.
10983         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10984         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10985         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10986         * testsuite/two_file_shared.sh: New script.
10987         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10988         (check_DATA): Add two_file_shared.dbg.
10989         (two_file_shared.dbg): New target.
10990         * testsuite/Makefile.in: Rebuild.
10991
10992 2009-03-01  Ian Lance Taylor  <iant@google.com>
10993
10994         * configure.ac: Check for byteswap.h.
10995         * configure: Rebuild.
10996         * config.in: Rebuild.
10997
10998 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10999
11000         * layout.cc (Layout::find_or_add_kept_section): New function.
11001         (Layout::add_comdat): Removed.
11002         * layout.h (struct Kept_section): Move out of class Layout.
11003         Remove trailing underscores from field names.  Add group_sections
11004         field.  Rename group_ field to is_group.  Change all uses.
11005         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11006         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11007         comdat_groups_ field.
11008         (Sized_relobj::include_section_group): Use
11009         find_or_add_kept_section and Kept_section::group_sections.
11010         (Sized_relobj::include_linkonce_section): Likewise.
11011         * object.cc (class Sized_relobj): Don't define Comdat_group or
11012         Comdat_group_table.  Remove find_comdat_group and
11013         add_comdat_group.  Remove comdat_groups_ field.
11014         * plugin.cc (include_comdat_group): Use
11015         Layout::find_or_add_kept_section.
11016
11017 2009-02-28  Ian Lance Taylor  <iant@google.com>
11018
11019         * README: --gc-sections and map files are now supported.  Document
11020         some build requirements.
11021
11022         PR 6992
11023         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11024         relocatable link set the value of the section symbol to zero.
11025         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11026         relocatable link don't include the section address in the local
11027         symbol value.
11028
11029 2009-02-27  Ian Lance Taylor  <iant@google.com>
11030
11031         PR 6811
11032         * options.h (class Search_directory): Add is_system_directory.
11033         (class General_options): Declare is_in_system_directory.
11034         * options.cc (get_relative_sysroot): Make static.
11035         (get_default_sysroot): Make static.
11036         (General_optoins::is_in_system_directory): New function.
11037         * fileread.cc (Input_file::is_in_system_directory): New function.
11038         * fileread.h (class Input_file): Declare is_in_system_directory.
11039         * object.h (class Object): Add is_in_system_directory.
11040         (class Input_objects): Remove system_library_directory_ field.
11041         * object.cc (Input_objects::add_object): Don't set
11042         system_library_directory_.
11043         (input_objects::found_in_system_library_directory): Remove.
11044         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11045         parameter.  Change all callers.
11046         (Symbol_table::sized_write_globals): Likewise.
11047         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11048         Call Object::is_in_system_directory.
11049         * symtab.h (class Symbol_table): Update declarations.
11050
11051         PR 5990
11052         * descriptors.h (Open_descriptor): Add is_on_stack field.
11053         * descriptors.cc (Descriptors::open): If the descriptor is on the
11054         top of the stack, remove it.  Initialize is_on_stack field.
11055         (Descriptors::release): Only add pod to stack if it is not on the
11056         stack already.
11057         (Descriptors::close_some_descriptor): Clear stack_next and
11058         is_on_stack fields.
11059
11060         PR 7091
11061         * output.cc (Output_section::find_starting_output_address): Rename
11062         from starting_output_address; add PADDR parameter; change return
11063         type.
11064         * output.h (class Output_section): Declare
11065         find_starting_output_address instead of starting_output_address.
11066         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11067         section symbol for which we can't find a merge section.
11068
11069         PR 9836
11070         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11071         hidden or internal, force the symbol to be local.
11072         * resolve.cc (Symbol::override_visibility): Define.
11073         (Symbol::override_base): Use override_visibility.
11074         (Symbol_table::resolve): Likewise.
11075         (Symbol::override_base_with_special): Likewise.
11076         (Symbol_table::override_with_special): If the visibility is hidden
11077         or internal, force the symbol to be local.
11078         * symtab.h (class Symbol): Add set_visibility and
11079         override_visibility.
11080         * testsuite/ver_test_1.sh: New file.
11081         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11082         (check_DATA): Add ver_test_1.syms.
11083         (ver_test_1.syms): New target.
11084         * testsuite/Makefile.in: Rebuild.
11085
11086 2009-02-25  Cary Coutant  <ccoutant@google.com>
11087
11088         * layout.cc (Layout::choose_output_section): Don't rename sections
11089         when using a linker script that has a SECTIONS clause.
11090         * Makefile.in: Regenerate.
11091
11092         * testsuite/Makefile.am (script_test_5.sh): New test case.
11093         * testsuite/Makefile.in: Regenerate.
11094         * testsuite/script_test_5.cc: New file.
11095         * testsuite/script_test_5.sh: New file.
11096         * testsuite/script_test_5.t: New file.
11097
11098 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11099
11100         * archive.cc (Archive::include_member): Update calls to add_symbols.
11101         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11102         the Layout argument.
11103         * dynobj.h (do_add_symbols): Add the Layout argument.
11104         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11105         Layout argument.
11106         * object.h (Object::add_symbols): Add the Layout argument.
11107         (Object::do_add_symbols): Add the Layout argument.
11108         (Sized_relobj::do_add_symbols): Add the Layout argument.
11109         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11110         Unify the two versions.
11111         (Add_plugin_symbols): Remove.
11112         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11113         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11114         (Add_plugin_symbols): Remove.
11115         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11116         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11117         (Add_symbols::run): Make it work with Pulginobj.
11118
11119 2009-02-06  Ian Lance Taylor  <iant@google.com>
11120
11121         * object.cc (Sized_relobj::do_layout): Make info message start
11122         with lower case letter.
11123
11124 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11125
11126         * binary.cc: Fix file comment.
11127
11128         * options.h (enum Incremental_disposition): Define.
11129         (class General_options): Add new options: --incremental,
11130         --incremental_changed, --incremental_unchanged,
11131         --incremental_unknown.  Add incremental_disposition_ and
11132         implicit_incremental_ fields.
11133         (General_options::incremental_disposition): New function.
11134         (class Position_dependent_options): Add incremental_disposition
11135         option.
11136         (Position_dependent_options::copy_from_options): Set incremental
11137         dispositions.
11138         * options.cc (General_options::parse_incremental_changed): New
11139         function.
11140         (General_options::parse_incremental_unchanged): New function.
11141         (General_options::parse_incremental_unknown): New function.
11142         (General_options::General_options): Initialize new fields
11143         incremental_disposition_ and implicit_incremental_.
11144         (General_options::finalize): Check for uasge of --incremental-*
11145         without --incremental.
11146
11147 2009-02-06  Chris Demetriou  <cgd@google.com>
11148
11149         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11150         pointer and to report location as the file name associated with
11151         the symbol.
11152         (gold_undefined_symbol_at_location): New function to replace the
11153         old gold_undefined_symbol functionality.
11154         * target-reloc.h (relocate_section): Update to use
11155         gold_undefined_symbol_at_location.
11156         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11157         Call gold_undefined_symbol function rather than gold_error.
11158         * errors.h (Errors::undefined_symbol): Take location as a
11159         string, rather than calculating it from a relocation.
11160         * errors.cc (Errors::fatal): Print "fatal error:" before the
11161         formatted message.
11162         (Errors::error, Errors::error_at_location): Print "error: "
11163         before the formatted message.
11164         (Errors::undefined_symbol): Take location as a string, rather
11165         than calculating it from a relocation.
11166         (gold_undefined_symbol_at_location): New function akin to
11167         old gold_undefined_symbol, calculates location from relocation.
11168         (gold_undefined_symbol): Change to take only a Symbol pointer
11169         and to report location as the file name associated with the symbol.
11170         * testsuite/debug_msg.sh: Update for changed error messages.
11171         * testsuite/undef_symbol.sh: Likewise.
11172
11173 2009-02-04  Duncan Sands  <baldrick@free.fr>
11174
11175         PR 9812
11176         * reduced_debug_output.h
11177         (Output_reduced_debug_abbrev_section::failed): Use format for
11178         gold_warning.
11179         (Output_reduced_debug_info_section::faild): Likewise.
11180
11181 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11182
11183         * script.cc (Lazy_demangler): New class.
11184         (Version_script_info::get_symbol_version_helper): Demangle a
11185         symbol only once.
11186
11187 2009-01-29  Cary Coutant  <ccoutant@google.com>
11188
11189         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11190         to __tls_get_addr.
11191         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11192
11193 2009-01-28  Ian Lance Taylor  <iant@google.com>
11194
11195         * version.cc (version_string): Bump to 1.9.
11196
11197         * gold.h: Include <cstring> and <stdint.h>.
11198         * version.cc: Include <cstdio>.
11199         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11200         warning.
11201         * reduced_debug_output.cc (insert_into_vector): Rename from
11202         Insert_into_vector; change all callers.  Use Swap_unaligned to
11203         avoid aliasing issue; remove union since it is unnecessary.
11204
11205 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11206
11207         * Makefile.am (CCFILES): Add gc.cc.
11208         (HFILES): Add gc.h.
11209         * Makefile.in: Regenerate.
11210         * gold.cc (Gc_runner): New class.
11211         (queue_initial_tasks): Call garbage collection related tasks
11212         when corresponding options are invoked.
11213         (queue_middle_gc_tasks): New function.
11214         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11215         processed early before laying out sections during garbage collection.
11216         * gold.h (queue_middle_gc_tasks): New function.
11217         (is_prefix_of): Move from "layout.cc".
11218         * i386.cc (Target_i386::gc_process_relocs): New function.
11219         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11220         * main.cc (main): Create object of class "Garbage_collection".
11221         * object.cc (Relobj::copy_symbols_data): New function.
11222         (Relobj::is_section_name_included): New function.
11223         (Sized_relobj::do_layout): Allow this function to be called twice
11224         during garbage collection and defer layout of section during the
11225         first call.
11226         * object.h (Relobj::get_symbols_data): New function.
11227         (Relobj::is_section_name_included): New function.
11228         (Relobj::copy_symbols_data): New function.
11229         (Relobj::set_symbols_data): New function.
11230         (Relobj::get_relocs_data): New function.
11231         (Relobj::set_relocs_data): New function.
11232         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11233         (Relobj::gc_process_relocs): New function.
11234         (Relobj::do_gc_process_relocs): New pure virtual function.
11235         (Relobj::sd_): New data member.
11236         (Sized_relobj::is_output_section_offset_invalid): New function.
11237         (Sized_relobj::do_gc_process_relocs): New function.
11238         * options.h (General_options::gc_sections): Modify to not be a no-op.
11239         (General_options::print_gc_sections): New option.
11240         * plugin.cc (Plugin_finish::run): Remove function call to
11241         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11242         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11243         * reloc.cc (Read_relocs::run): Add task to process relocs and
11244         determine unreferenced sections when doing garbage collection.
11245         (Gc_process_relocs): New class.
11246         (Sized_relobj::do_gc_process_relocs): New function.
11247         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11248         sections that are garbage collected.
11249         * reloc.h (Gc_process_relocs): New class.
11250         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11251         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11252         symbols whose corresponding sections are garbage collected.
11253         (Symbol_table::Symbol_table): Add new parameter for the garbage
11254         collection object.
11255         (Symbol_table::gc_mark_undef_symbols): New function.
11256         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11257         (Symbol_table::gc_mark_dyn_syms): New function.
11258         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11259         as garbage.
11260         (Symbol_table::add_from_object): Likewise.
11261         (Symbol_table::add_from_relobj): When building shared objects, do not
11262         treat externally visible symbols as garbage.
11263         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11264         table information for static and relocatable links.
11265         * symtab.h (Symbol_table::set_gc): New function.
11266         (Symbol_table::gc): New function.
11267         (Symbol_table::gc_mark_undef_symbols): New function.
11268         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11269         (Symbol_table::gc_mark_dyn_syms): New function.
11270         (Symbol_table::gc_): New data member.
11271         * target.h (Sized_target::gc_process_relocs): New pure virtual
11272         function.
11273         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11274         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11275
11276 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11277
11278         * options.h (General_options::gc_sections): Define as a no-op for now.
11279         (General_options::no_keep_memory): Ditto.
11280         (General_options::Bshareable): Define.
11281         * options.cc (General_options::finalize): Honor -Bshareable.
11282
11283 2009-01-20  Andreas Schwab  <schwab@suse.de>
11284
11285         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11286         read the value in the contents, since we don't use it.  Use the
11287         template endianness when writing.
11288         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11289
11290 2009-01-19  Andreas Schwab  <schwab@suse.de>
11291
11292         * configure.tgt (powerpc64-*): Fix targ_obj.
11293
11294 2009-01-15  Ian Lance Taylor  <iant@google.com>
11295
11296         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11297         local symbols when stripping all symbols.
11298
11299 2009-01-14  Cary Coutant  <ccoutant@google.com>
11300
11301         * output.cc (Output_reloc): Add explicit instantiations.
11302
11303 2009-01-14  Cary Coutant  <ccoutant@google.com>
11304
11305         * archive.cc (Archive::get_elf_object_for_member): Remove call
11306         to File_read::claim_for_plugin.
11307         * descriptors.cc (Descriptors::open): Remove reference to
11308         is_claimed.
11309         (Descriptors::claim_for_plugin): Remove.
11310         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11311         (Descriptors::is_claimed): Remove.
11312         (claim_descriptor_for_plugin): Remove.
11313         * fileread.cc (File_read::claim_for_plugin): Remove.
11314         * fileread.h (File_read::claim_for_plugin): Remove.
11315         (File_read::descriptor): Reopen descriptor if necessary.
11316         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11317         (Plugin_manager::all_symbols_read): Add task parameter. Change
11318         all callers.
11319         (Plugin_manager::get_input_file): New function.
11320         (Plugin_manager::release_input_file): New function.
11321         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11322         corresponding data member.
11323         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11324         and pass to base constructor. Change all callers.
11325         (get_input_file, release_input_file): New functions.
11326         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11327         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11328         (Plugin_manager::all_symbols_read): Add task parameter.
11329         (Plugin_manager::get_input_file): New function.
11330         (Plugin_manager::release_input_file): New function.
11331         (Plugin_manager::task_): New data member.
11332         (Pluginobj::Pluginobj): Add filesize parameter.
11333         (Pluginobj::filename): New function.
11334         (Pluginobj::descriptor): New function.
11335         (Pluginobj::filesize): New function.
11336         (Pluginobj::filesize_): New data member.
11337         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11338         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11339         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11340
11341         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11342         with archive libraries.
11343         * testsuite/Makefile.in: Regenerate.
11344         * testsuite/plugin_test.c (struct sym_info): New type.
11345         (get_input_file, release_input_file): New static variables.
11346         (onload): Capture new transfer vector entries.
11347         (claim_file_hook): Stop reading at end of file according to filesize.
11348         Factor out parsing of readelf output into separate function.
11349         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11350         APIs and get the source file name from the symbol table.  Convert
11351         source file name to corresponding object file name.  Print info
11352         message when adding new input files.
11353         (parse_readelf_line): New function.
11354         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11355         * testsuite/plugin_test_2.sh: Likewise.
11356         * testsuite/plugin_test_3.sh: Likewise.
11357         * testsuite/plugin_test_4.sh: New test case.
11358
11359 2009-01-07  Ian Lance Taylor  <iant@google.com>
11360
11361         * version.cc (version_string): Bump to 1.8.
11362
11363 2008-12-23  Cary Coutant  <ccoutant@google.com>
11364
11365         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11366         * plugin.cc (Plugin_manager::finish): Rename as
11367         layout_deferred_objects.  Move cleanup to separate function.
11368         (Plugin_manager::cleanup): New function.
11369         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11370         separately.
11371         * plugin.h (Plugin_manager::finish): Rename as
11372         layout_deferred_objects.
11373         (Plugin_manager::cleanup): New function.
11374         (Plugin_manager::cleanup_done): New field.
11375
11376 2008-12-23  Cary Coutant  <ccoutant@google.com>
11377
11378         * plugin.cc (is_visible_from_outside): New function.
11379         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11380         so we don't return "IR only" status for exported symbols or -r links.
11381
11382         * testsuite/Makefile.am (plugin_test_3): New test case.
11383         * testsuite/Makefile.in: Regenerate.
11384         * testsuite/plugin_test_3.sh: New file.
11385
11386 2008-12-22  Cary Coutant  <ccoutant@google.com>
11387
11388         * object.cc (Sized_relobj::layout_section): New function.
11389         (Sized_relobj::do_layout): Defer layout of input sections until after
11390         plugin has provided replacement files.
11391         (Sized_relobj::do_layout_deferred_sections): New function.
11392         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11393         (Relobj::layout_deferred_sections): New function.
11394         (Relobj::do_layout_deferred_sections): New function.
11395         (Sized_relobj::do_layout_deferred_sections): New function.
11396         (Sized_relobj::layout_section): New function.
11397         (Sized_relobj::Deferred_layout): New structure.
11398         (Sized_relobj::deferred_layout_): New field.
11399         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11400         Change all callers.  Layout deferred sections.
11401         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11402         references.
11403         (Plugin_hook::run): Move code from do_plugin_hook inline.
11404         (Plugin_hook::do_plugin_hook): Remove.
11405         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11406         (Plugin_manager::finish): Renamed, was cleanup.
11407         (Plugin_manager::should_defer_layout): New function.
11408         (Plugin_manager::add_deferred_layout_object): New function.
11409         (Plugin_manager::Deferred_layout_list): New type.
11410         (Plugin_manager::deferred_layout_objects_): New field.
11411         (Plugin_hook::do_plugin_hook): Remove.
11412
11413 2008-12-17  Ian Lance Taylor  <iant@google.com>
11414
11415         * options.h (class General_options): Add --no case for
11416         --export-dynamic.
11417
11418 2008-12-16  Cary Coutant  <ccoutant@google.com>
11419
11420         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11421         vector.
11422         (Plugin_manager::claim_file): Create plugin object even if
11423         plugin did not call the add_symbols callback.
11424         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11425         asking for more symbols than were added.
11426         * testsuite/Makefile.am (plugin_test_1): Add test case with
11427         no global symbols.
11428         (empty.syms): New target.
11429         * testsuite/Makefile.in: Regenerate.
11430         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11431         message. Don't call add_symbols if no globals.
11432         (all_symbols_read_hook): Don't provide replacement for empty
11433         claimed file.
11434
11435 2008-12-12  Ian Lance Taylor  <iant@google.com>
11436
11437         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11438         r_type == 0 for a local symbol with r_sym == 0.
11439         (scan_relocatable_relocs): Pass r_sym to
11440         local_non_section_strategy.
11441         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11442         r_sym parameter.
11443
11444         * configure.ac: Update test for TLS descriptors: they are
11445         supported as of glibc 2.9.
11446         * configure: Rebuild.
11447
11448 2008-12-11  Ian Lance Taylor  <iant@google.com>
11449
11450         PR 7091
11451         * target-reloc.h (Default_scan_relocatable_relocs): For each
11452         function, map r_type == 0 to RELOC_DISCARD.
11453
11454 2008-12-10  Cary Coutant  <ccoutant@google.com>
11455
11456         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11457         object to override a kept COMDAT group from a plugin object.
11458
11459 2008-12-09  Ian Lance Taylor  <iant@google.com>
11460
11461         PR 7088
11462         * yyscript.y (file_cmd): Handle INPUT.
11463
11464         * testsuite/initpri1.c: Change all declarations to be full
11465         prototypes by adding void, to avoid compiler warnings.
11466
11467 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11468
11469         * options.cc (General_options::parse_plugin_opt): New.
11470         (General_options::add_plugin): The argument now is just the filename.
11471         (General_options::add_plugin_option): New.
11472         * options.h (plugin_opt): New.
11473         (add_plugin): Change argument name.
11474         (add_plugin_option): New.
11475         * plugin.cc (Plugin::load): Don't parse the plugin option.
11476         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11477         (Plugin::add_option): New.
11478         (Plugin::args_): Change type.
11479         (Plugin::filename_): New.
11480         (Plugin_manager::add_plugin_option): New.
11481         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11482         * testsuite/Makefile.in: Regenerate.
11483
11484 2008-12-05  Cary Coutant  <ccoutant@google.com>
11485
11486         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11487         Handle --strip-lto-sections option.
11488         * options.h (strip_lto_sections): New option.
11489
11490 2008-12-01  Cary Coutant  <ccoutant@google.com>
11491
11492         * plugin.cc (ld_plugin_message): Change format parameter to const.
11493         Fix mismatch between new[] and delete.
11494
11495 2008-11-14  Cary Coutant  <ccoutant@google.com>
11496
11497         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11498         instead of -1U.
11499
11500 2008-11-05  Craig Silverstein  <csilvers@google.com>
11501
11502         * options.cc (General_options::parse_dynamic_list): New function.
11503         * options.h (General_options): New flags dynamic_list,
11504         dynamic_list_data, dynamic_list_cpp_new, and
11505         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11506         (General_options::in_dynamic_list): New function.
11507         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11508         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11509         (Lex::can_continue_name): Likewise.
11510         (yylex): Likewise.
11511         (read_script_file): New parameter script_options.
11512         (read_dynamic_list): New function.
11513         (Script_options::define_dynamic_list): New function.
11514         (dynamic_list_keyword_parsecodes): New variable.
11515         (dynamic_list_keywords): New variable.
11516         * script.h (Script_options::define_dynamic_list): New function
11517         prototype.
11518         (read_dynamic_list): New function prototype.
11519         * symtab.cc (strprefix): New macro.
11520         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11521         dynamic_list_data, dynamic_list_cpp_new, and
11522         dynamic_list_cpp_typeinfo.
11523         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11524         (dynamic_list_expr): New rule.
11525         (dynamic_list_nodes): Likewise.
11526         (dynamic_list_node): Likewise.
11527         * testsuite/Makefile.am (dynamic_list): New test.
11528         * testsuite/Makefile.in: Regenerated.
11529         * testsuite/dynamic_list.t: New file.
11530         * testsuite/dynamic_list.sh: New file.
11531
11532 2008-11-05  Craig Silverstein  <csilvers@google.com>
11533
11534         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11535         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11536         (t11_last): Likewise.
11537         * testsuite/ver_test_6.c (main): Likewise.
11538
11539 2008-10-07  Cary Coutant  <ccoutant@google.com>
11540
11541         * options.c (General_options::finalize): Add check for -static and
11542         -shared.
11543         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11544         is not empty.
11545
11546 2008-10-02  Cary Coutant  <ccoutant@google.com>
11547
11548         * plugin.cc (make_sized_plugin_object): Fix conditional
11549         compilation to work when not all targets are enabled.
11550
11551 2008-09-29  Cary Coutant  <ccoutant@google.com>
11552
11553         * archive.cc (Archive::get_file_and_offset): Use filename instead
11554         of name to get library path.
11555         (Archive::include_member): Unlock external member of a thin archive.
11556
11557         * testsuite/Makefile.am (TEST_AR): New variable.
11558         (thin_archive_test_1): New test.
11559         (thin_archive_test_2): New test.
11560         * testsuite/Makefile.in: Regenerate.
11561         * testsuite/thin_archive_main.cc: New file.
11562         * testsuite/thin_archive_test_1.cc: New file.
11563         * testsuite/thin_archive_test_2.cc: New file.
11564         * testsuite/thin_archive_test_3.cc: New file.
11565         * testsuite/thin_archive_test_4.cc: New file.
11566
11567 2008-09-29  Cary Coutant  <ccoutant@google.com>
11568
11569         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11570         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11571         instead of -1U.
11572         (Sized_relobj::do_finalize_local_symbols): Likewise.
11573         (Sized_relobj::map_to_kept_section): Likewise.
11574         * object.h (Sized_relobj::invalid_address): New constant.
11575         (Sized_relobj::do_output_section_offset): Check for invalid_address
11576         and return -1ULL.
11577         * output.cc (Output_reloc::local_section_offset): Use constant
11578         invalid_address instead of -1U.
11579         (Output_reloc::get_address): Likewise.
11580         (Output_section::output_address): Change -1U to -1ULL.
11581         * output.h (Output_reloc::invalid_address): New constant.
11582         * reloc.cc (Sized_relobj::write_sections): Use constant
11583         invalid_address instead of -1U.
11584         (Sized_relobj::relocate_sections): Likewise.
11585         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11586         values for merge sections.
11587         * target-reloc.h (relocate_for_relocatable): Use constant
11588         invalid_address instead of -1U.
11589
11590 2008-09-19  Cary Coutant  <ccoutant@google.com>
11591
11592         Add plugin functionality for link-time optimization (LTO).
11593         * configure.ac (plugins): Add --enable-plugins option.
11594         * configure: Regenerate.
11595         * config.in: Regenerate.
11596         * Makefile.am (LIBDL): New variable.
11597         (CCFILES): Add plugin.cc.
11598         (HFILES): Add plugin.h.
11599         (ldadd_var): Add LIBDL.
11600         * Makefile.in: Regenerate.
11601
11602         * archive.cc: Include "plugin.h".
11603         (Archive::setup): Don't preread archive symbols when using a plugin.
11604         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11605         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11606         files.
11607         (Archive::include_member): Add symbols from plugin objects.
11608         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11609         * descriptors.cc (Descriptors::open): Check for file descriptors
11610         abandoned by plugins.
11611         (Descriptors::claim_for_plugin): New function.
11612         * descriptors.h (Descriptors::claim_for_plugin): New function.
11613         (Open_descriptor::is_claimed): New field.
11614         (claim_descriptor_for_plugin): New function.
11615         * fileread.cc (File_read::claim_for_plugin): New function.
11616         * fileread.h (File_read::claim_for_plugin): New function.
11617         (File_read::descriptor): New function.
11618         * gold.cc: Include "plugin.h".
11619         (queue_initial_tasks): Add task to call plugin hooks for generating
11620         new object files.
11621         * main.cc: Include "plugin.h".
11622         (main): Load plugin libraries.
11623         * object.h (Pluginobj): Declare.
11624         (Object::pluginobj): New function.
11625         (Object::do_pluginobj): New function.
11626         (Object::set_target): New function.
11627         * options.cc: Include "plugin.h".
11628         (General_options::parse_plugin): New function.
11629         (General_options::General_options): Initialize plugins_ field.
11630         (General_options::add_plugin): New function.
11631         * options.h (Plugin_manager): Declare.
11632         (General_options): Add --plugin option.
11633         (General_options::has_plugins): New function.
11634         (General_options::plugins): New function.
11635         (General_options::add_plugin): New function.
11636         (General_options::plugins_): New field.
11637         * plugin.cc: New file.
11638         * plugin.h: New file.
11639         * readsyms.cc: Include "plugin.h".
11640         (Read_symbols::do_read_symbols): Check for archive before checking
11641         for ELF file.  Call plugin hooks to claim files.
11642         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11643         from a real object file; force override when processing replacement
11644         files.
11645         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11646         (Symbol::init_base_object): Likewise.
11647         (Symbol::init_base_output_data): Likewise.
11648         (Symbol::init_base_output_segment): Likewise.
11649         (Symbol::init_base_constant): Likewise.
11650         (Symbol::init_base_undefined): Likewise.
11651         (Symbol::output_section): Assert that object is not a plugin.
11652         (Symbol_table::add_from_pluginobj): New function.
11653         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11654         undefined.
11655         (Symbol_table::sized_write_globals): Likewise.
11656         (Symbol_table::add_from_pluginobj): Instantiate template.
11657         * symtab.h (Sized_pluginobj): Declare.
11658         (Symbol::in_real_elf): New function.
11659         (Symbol::set_in_real_elf): New function.
11660         (Symbol::in_real_elf_): New field.
11661         (Symbol_table::add_from_pluginobj): New function.
11662
11663         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11664         (LIBDL): New variable.
11665         (LDADD): Add LIBDL.
11666         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11667         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11668         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11669         (MOSTLYCLEANFILES): Likewise.
11670         * testsuite/Makefile.in: Regenerate.
11671         * testsuite/plugin_test.c: New file.
11672         * testsuite/plugin_test_1.sh: New file.
11673         * testsuite/plugin_test_2.sh: New file.
11674
11675 2008-09-16  Ian Lance Taylor  <iant@google.com>
11676
11677         * target-reloc.h (relocate_section): Check whether a symbol is
11678         defined by the ABI before reporting an undefined symbol error.
11679         * target.h (Target::is_defined_by_abi): Make parameter const.
11680         (Target::do_is_defined_by_abi): Likewise.
11681         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11682         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11683         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11684         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11685         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11686         * testsuite/Makefile.in: Rebuild.
11687
11688         * fileread.cc (make_view): Add casts to avoid warning.
11689
11690 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11691
11692         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11693         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11694
11695 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11696
11697         * options.h (General_options::output_is_executable): New.
11698         (General_options::output_is_pie): New.
11699         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11700         for shared libraries.
11701         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11702
11703 2008-09-11  Chris Demetriou  <cgd@google.com>
11704
11705         * options.h (origin): New -z option.
11706         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11707         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11708         in DT_FLAGS_1.
11709
11710 2008-09-05  Cary Coutant  <ccoutant@google.com>
11711
11712         * fileread.cc (File_read::make_view): Add check for attempt to map
11713         beyond end of file.
11714
11715 2008-09-05  Cary Coutant  <ccoutant@google.com>
11716
11717         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11718         explicit instantiations.
11719
11720 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11721
11722         PR gold/6858
11723         * options.cc (General_options::finalize): Allow undefined symbols
11724         in shlibs if linking -shared.
11725
11726         PR gold/6859
11727         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11728         symbols as not needing a dynsym entry.
11729
11730 2008-08-20  Craig Silverstein  <csilvers@google.com>
11731
11732         * fileread.cc (File_read::open): Do not lock the file unless it
11733         was successfully opened.
11734
11735 2008-08-14  Cary Coutant  <ccoutant@google.com>
11736
11737         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11738         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11739         * testsuite/tls_test.cc (struct int128): 128-bit struct
11740         for testing TLS relocs with non-zero addend.
11741         (v12): New TLS variable.
11742         (t12): New test.
11743         (t_last): Add check for v12.
11744         * testsuite/tls_test.h (t12): New function.
11745         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11746
11747 2008-08-13  Ian Lance Taylor  <iant@google.com>
11748
11749         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11750         set tls_segment_ or relro_segment_.
11751         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11752         when appropriate.
11753         * output.h (Output_section::clear_is_relro): New function.
11754         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11755         sections specially even when output_data_ is empty.
11756         (Output_segment::maximum_alignment): When first section is relro,
11757         only force alignment for PT_LOAD segments.
11758         * script.cc (script_data_segment_align): New function.
11759         (script_data_segment_relro_end): New function.
11760         * script-c.h (script_data_segment_align): Declare.
11761         (script_data_segment_relro_end): Declare.
11762         * script-sections.h (class Script_sections): Declare
11763         data_segment_align and data_segment_relro_end.  Add fields
11764         segment_align_index_ and saw_relro_end_.
11765         * script-sections.cc (class Sections_element): Add set_is_relro
11766         virtual function.  Add new bool* parameter to place_orphan_here.
11767         Add get_output_section virtual function.
11768         (class Output_section_definition): Add set_is_relro.  Add new
11769         bool* parameter to place_orphan_here.  Add get_output_section.
11770         Add is_relro_ field.
11771         (Output_section_definition::Output_section_definition): Initialize
11772         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11773         and is_relro_ fields.
11774         (Output_section_definition::place_orphan_here): Add is_relro
11775         parameter.
11776         (Output_section_definition::set_section_addresses): Set relro for
11777         output section.
11778         (Output_section_definition::alternate_constraint): Likewise.
11779         (class Orphan_output_section): Add new bool* parameter to
11780         place_orphan_here.  Add get_output_section.
11781         (Orphan_output_section::place_orphan_here): Add is_relro
11782         parameter.
11783         (Script_sections::Script_sections): Initialize
11784         data_segment_align_index_ and saw_relro_end_.
11785         (Script_sections::data_segment_align): New function.
11786         (Script_sections::data_segment_relro_end): New function.
11787         (Script_sections::place_orphan): Set or clear is_relro.
11788         (Script_sections::set_section_addresses): Force alignment of first
11789         TLS section.
11790         * yyscript.y (exp): Call script_data_segment_align and
11791         script_data_segment_relro_end.
11792         * testsuite/relro_script_test.t: New file.
11793         * testsuite/relro_test.cc (using_script): Declare.
11794         (t1, t2): Test using_script.
11795         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11796         (relro_script_test_SOURCES): Define.
11797         (relro_script_test_DEPENDENCIES): Define.
11798         (relro_script_test_LDFLAGS): Define.
11799         (relro_script_test_LDADD): Define.
11800         (relro_script_test.so): New target.
11801         * testsuite/Makefile.in: Rebuild.
11802
11803 2008-08-06  Cary Coutant <ccoutant@google.com>
11804
11805         * archive.cc (Archive::total_archives, Archive::total_members)
11806         (Archive::total_members_loaded): New variables.
11807         (Archive::setup): Add parameter.  Add option to preread
11808         archive symbols.
11809         (Archive::read_armap): Add counter.
11810         (Archive::get_file_and_offset): New function.
11811         (Archive::get_elf_object_for_member): New function.
11812         (Archive::read_all_symbols): New function.
11813         (Archive::read_symbols): New function.
11814         (Archive::add_symbols): Add counters.
11815         (Archive::include_all_members): Use armap to find members if it's
11816         already built.
11817         (Archive::include_member): Skip reading symbols if already read.
11818         Factored code into Archive::get_file_and_offset and
11819         Archive::get_elf_object_for_member.  Changed call to
11820         Mapfile::report_include_archive_member.
11821         (Archive::print_stats): New function.
11822         * archive.h: Declare Object and Read_symbols_data classes.
11823         (Archive::Archive): Add initializers for new members.
11824         (Archive::setup): Add parameter.
11825         (Archive::print_stats): New function.
11826         (Archive::total_archives, Archive::total_members)
11827         (Archive::total_members_loaded): New variables.
11828         (Archive::get_file_and_offset): New function.
11829         (Archive::get_elf_object_for_member): New function.
11830         (Archive::read_all_symbols): New function.
11831         (Archive::read_symbols): New function.
11832         (Archive::Archive_member): New class.
11833         (Archive::members_): New member.
11834         (Archive::num_members_): New member.
11835         * main.cc: Include archive.h.
11836         (main): Call Archive::print_stats.
11837         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11838         archive parameter; member_name is now the fully-decorated name.
11839         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11840         * options.h: (General_options): Add --preread-archive-symbols option.
11841         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11842         Archive::setup.
11843
11844 2008-08-04  Ian Lance Taylor  <iant@google.com>
11845
11846         * symtab.h (Symbol::use_plt_offset): New function.
11847         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11848         * powerpc.cc (Relocate::relocate): Likewise.
11849         * sparc.cc (Relocate::relocate): Likewise.
11850         * x86_64.cc (Relocate::relocate): Likewise.
11851         * testsuite/weak_plt.sh: New test.
11852         * testsuite/weak_plt_main.cc: New test.
11853         * testsuite/weak_plt_shared.cc: New test.
11854         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11855         (check_PROGRAMS): Add weak_plt.
11856         (check_DATA): Add weak_plt_shared.so.
11857         (weak_plt_main_pic.o, weak_plt): New targets.
11858         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11859         * testsuite/Makefile.in: Rebuild.
11860
11861         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11862         gcctestdir/ld.
11863         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11864         * testsuite/Makefile.in: Rebuild.
11865
11866 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11867
11868         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11869         * Makefile.in: Regenerate.
11870         * po/POTFILES.in: Regenerate.
11871
11872 2008-07-29  Ian Lance Taylor  <iant@google.com>
11873
11874         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11875         symbols before other symbols.
11876         * testsuite/script_test_2.cc (test_addr): Declare.
11877         (test_addr_alias): Declare.
11878         (main): Check that test_addr and test_addr_alias have the right
11879         values.
11880         * testsuite/script_test_2.t: Define test_addr_alias and
11881         test_addr.
11882
11883 2008-07-24  Ian Lance Taylor  <iant@google.com>
11884
11885         PR 5990
11886         * descriptors.cc: New file.
11887         * descriptors.h: New file.
11888         * gold-threads.h (class Hold_optional_lock): New class.
11889         * fileread.cc: Include "descriptors.h".
11890         (File_read::~File_read): Release descriptor rather than closing
11891         it.
11892         (File_read::open) [file]: Call open_descriptor rather than open.
11893         Set is_descriptor_opened_.
11894         (File_read::open) [memory]: Assert that descriptor is not open.
11895         (File_read::reopen_descriptor): New function.
11896         (File_read::release): Release descriptor.
11897         (File_read::do_read): Make non-const.  Reopen descriptor.
11898         (File_read::read): Make non-const.
11899         (File_read::make_view): Reopen descriptor.
11900         (File_read::do_readv): Likewise.
11901         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11902         Update declarations.
11903         * layout.cc: Include "descriptors.h".
11904         (Layout::create_build_id): Use open_descriptor rather than open.
11905         * output.cc: Include "descriptors.h".
11906         (Output_file::open): Use open_descriptor rather than open.
11907         * archive.cc (Archive::const_iterator): Change Archive to be
11908         non-const.
11909         (Archive::begin, Archive::end): Make non-const.
11910         (Archive::count_members): Likewise.
11911         * archive.h (class Archive): Update declarations.
11912         * object.h (Object::read): Make non-const.
11913         * Makefile.am (CCFILES): Add descriptors.cc.
11914         (HFILES): Add descriptors.h.
11915         * Makefile.in: Rebuild.
11916
11917         PR 6716
11918         * gold.h: Always include <clocale>.  Add Solaris workarounds
11919         following code in binutils/sysdep.h.
11920
11921         PR 6048
11922         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11923         this->eh_frame_hdr_ is NULL before using it.
11924
11925         * dynobj.cc (Versions::Versions): Update comment.
11926
11927         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11928         the base version name.
11929
11930         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11931         array size plus one.
11932         (Stringpool_template::set_string_offsets): Subtract one from key
11933         before using it as an array index.
11934         (Stringpool_template::get_offset_with_length): Likewise.
11935         (Stringpool_template::write_to_buffer): Likewise.
11936         * stringpool.h (Stringpool_template::get_offset_from_key):
11937         Likewise.
11938
11939 2008-07-23  Ian Lance Taylor  <iant@google.com>
11940
11941         PR 6658
11942         * object.h (Merged_symbol_value::value): Do our best to handle a
11943         negative addend.
11944
11945         PR 6647
11946         * script.cc (Version_script_info::get_versions): Don't add empty
11947         version tag to return value.
11948         (Version_script_info::get_symbol_version_helper): Change return
11949         type to bool.  Add pversion parameter.  Change all callers.
11950         (script_register_vers_node): Don't require a non-NULL tag.
11951         * script.h (class Version_script_info): Update declarations.
11952         (Version_script_info::get_symbol_version): Change return type to
11953         bool.  Add version parameter.  Change all callers.
11954         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11955         handling.  Handle an empty version from a version script.
11956         (Symbol_table::define_special_symbol): Likewise.
11957         * testsuite/ver_test_10.script: New file.
11958         * testsuite/ver_test_10.sh: New file.
11959         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11960         (check_DATA): Add ver_test_10.syms.
11961         (ver_test_10.syms, ver_test_10.so): New target.
11962         * testsuite/Makefile.in: Rebuild.
11963
11964 2008-07-23  Simon Baldwin  <simonb@google.com>
11965
11966         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11967         to zero for undefined symbols from dynamic libraries.
11968
11969 2008-07-23  Ian Lance Taylor  <iant@google.com>
11970
11971         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11972         Change all callers.
11973         * symtab.h (class Symbol_table): Update declaration.
11974         * testsuite/ver_test_9.cc: New file.
11975         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11976         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11977         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11978         (ver_test_9.so, ver_test_9.o): New targets.
11979         * testsuite/Makefile.in: Rebuild.
11980
11981 2008-07-22  Ian Lance Taylor  <iant@google.com>
11982
11983         * options.h (class General_options): Define --check-sections.
11984         * layout.cc (Layout::set_segment_offsets): Handle
11985         --check-sections.
11986
11987         * options.h (class General_options): Define -n/--nmagic and
11988         -N/--omagic.
11989         * options.cc (General_options::finalize): For -n/--nmagic or
11990         -N/--omagic, set -static.
11991         * layout.cc (Layout::attach_allocated_section_to_segment): If
11992         -N/--omagic, don't put read-only and read-write sections in
11993         different segments.
11994         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11995         finding a read-only segment.
11996         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11997         don't set the minimum segment alignment to the common page size,
11998         and don't set the file offset to the address modulo the page size.
11999         * script-sections.cc (Script_sections::create_segments): If
12000         -n/--omagic, don't put read-only and read-write sections in
12001         different segments.
12002
12003         * cref.cc: New file.
12004         * cref.h: New file.
12005         * options.h (class General_options): Add --print-symbol-counts.
12006         * main.cc (main): Issue defined symbol report if requested.
12007         * archive.cc (Archive::interpret_header): Make into a const member
12008         function.
12009         (Archive::add_symbols): Call Input_objects::archive_start and
12010         archive_stop.
12011         (Archive::const_iterator): Define new class.
12012         (Archive::begin, Archive::end): New functions.
12013         (Archive::include_all_members): Rewrite to use iterator.
12014         (Archive::count_members): New function.
12015         * archive.h (class Archive): Update declarations.
12016         (Archive::filename): New function.
12017         * object.cc: Include "cref.h".
12018         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12019         (Sized_relobj::do_get_global_symbol_counts): New function.
12020         (Input_objects::add_object): Add object to cross-referencer.
12021         (Input_objects::archive_start): New function.
12022         (Input_objects::archive_stop): New function.
12023         (Input_objects::print_symbol_counts): New function.
12024         * object.h: Declare Cref and Archive.
12025         (Object::get_global_symbol_counts): New function.
12026         (Object::do_get_global_symbol_counts): New pure virtual function.
12027         (class Sized_relobj): Add defined_count_ field.  Update
12028         declarations.
12029         (class Input_objects): Add cref_ field.  Update constructor.
12030         Update declarations.
12031         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12032         defined_count_.
12033         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12034         symbol counts.
12035         (Sized_dynobj::do_get_global_symbol_counts): New function.
12036         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12037         defined_count_.  Update declarations.  Define Symbols typedef.
12038         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12039         parameter.  Change all callers.
12040         (Symbol_table::add_from_dynobj): Add sympointers and defined
12041         parameters.  Change all callers.
12042         * symtab.h (class Symbol_table): Update declarations.
12043         * Makefile.am (CCFILES): Add cref.cc.
12044         (HFILES): Add cref.h.
12045         * Makefile.in: Rebuild.
12046
12047 2008-07-22  Simon Baldwin  <simonb@google.com>
12048
12049         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12050         to zero when writing undefined symbols.
12051
12052 2008-07-22  Ian Lance Taylor  <iant@google.com>
12053
12054         * output.cc (Output_section::add_input_section): Don't try to
12055         merge empty merge sections.
12056
12057 2008-07-21  Craig Silverstein  <csilvers@google.com>
12058
12059         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12060         Include symbol version in error message.
12061
12062 2008-07-20  Chris Demetriou  <cgd@google.com>
12063
12064         * configure.ac (gold_cv_c_random_seed): New configured variable.
12065         (RANDOM_SEED_CFLAGS): New substituted variable.
12066         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12067         * configure: Rebuild.
12068         * Makefile.in: Likewise.
12069         * testsuite/Makefile.in: Likewise.
12070
12071 2008-07-18  Ian Lance Taylor  <iant@google.com>
12072
12073         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12074         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12075         * testsuite/ver_test_main.cc (main): Call t4.
12076         (t4, t4_2a): Define.
12077         * testsuite/ver_test_2.cc (t4_2): Define.
12078         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12079         * testsuite/ver_test_4.cc (t4_2a): Define.
12080         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12081         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12082
12083 2008-07-17  Ian Lance Taylor  <iant@google.com>
12084
12085         * dynobj.cc (Versions::add_def): If we give an error about a
12086         missing version, go ahead and create the version anyhow.
12087
12088 2008-07-10  Ian Lance Taylor  <iant@google.com>
12089
12090         Handle output sections with more than 0x7fffffff bytes.
12091         * object.h (class Relobj): Change map_to_output_ to
12092         output_sections_, and just keep a section pointer.  Change all
12093         uses.  Move comdat group support to Sized_relobj.
12094         (Relobj::is_section_specially_mapped): Remove.
12095         (Relobj::output_section): Remove poff parameter.  Change all
12096         callers.
12097         (Relobj::output_section_offset): New function.
12098         (Relobj::set_section_offset): Rewrite.
12099         (Relobj::map_to_output): Remove.
12100         (Relobj::output_sections): New function.
12101         (Relobj::do_output_section_offset): New pure virtual function.
12102         (Relobj::do_set_section_offset): Likewise.
12103         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12104         group support from Relobj.  Update declarations.
12105         (Sized_relobj::get_output_section_offset): New function.
12106         (Sized_relobj::do_output_section_offset): New function.
12107         (Sized_relobj::do_set_section_offset): New function.
12108         * object.cc (Relobj::output_section_address): Remove.
12109         (Sized_relobj::Sized_relobj): Initialize new fields.
12110         (Sized_relobj::include_section_group): Cast find_kept_object to
12111         Sized_relobj.
12112         (Sized_relobj::include_linkonce_section): Likewise.
12113         (Sized_relobj::do_layout): Use separate arrays for output section
12114         and output offset.
12115         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12116         output_sections.
12117         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12118         output_sections and section_offsets.
12119         (Sized_relobj::write_local_symbols): Likewise.
12120         (map_to_kept_section): Compute output address directly.
12121         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12122         output_sections and section_offsets.
12123         (Sized_relobj::write_sections): Likewise.
12124         (Sized_relobj::relocate_sections): Likewise.
12125         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12126         * output.h (class Output_reloc): Update declarations.  Change
12127         u2_.relobj to Sized_relobj*.
12128         (class Output_data_reloc): Change add functions to use
12129         Sized_relobj*.
12130         * output.cc (Output_reloc::Output_reloc): Change relobj to
12131         Sized_relobj*.
12132         (Output_reloc::local_section_offset): Change return type to
12133         Elf_Addr.  Use get_output_section_offset.
12134         (Output_reloc::get_address): Likewise.
12135         (Output_section::is_input_address_mapped): Don't call
12136         is_section_specially_mapped.
12137         (Output_section::output_offset): Likewise.
12138         (Output_section::output_address): Likewise.
12139         (Output_section::starting_output_address): Likewise.
12140         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12141         parameter to Sized_relobj*.
12142         (Copy_relocs::need_copy_reloc): Likewise.
12143         (Copy_relocs::save): Likewise.
12144         * copy-relocs.h (class Copy_relocs): Update declarations.
12145         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12146         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12147         * target-reloc.h (relocate_for_relocatable): Change
12148         offset_in_output_section type to Elf_Addr.  Change code that uses
12149         it as well.
12150         * layout.cc (Layout::layout): Always set *off.
12151         * mapfile.cc (Mapfile::print_input_section): Use
12152         output_section_offset.
12153         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12154         Sized_relobj*.
12155         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12156         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12157         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12158
12159 2008-07-03  Ian Lance Taylor  <iant@google.com>
12160
12161         * layout.cc (Layout::include_section): Do not discard unrecognized
12162         SHT_STRTAB sections.
12163
12164 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12165
12166         * script.cc (Lex::can_continue_name): Make '?' allowable in
12167         version-script names.
12168         * testsuite/version_script.map: Change glob pattern to use '?'
12169
12170 2008-06-30  Manish Singh  <yosh@gimp.org>
12171
12172         PR 6585
12173         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12174         Correct typo.
12175
12176 2008-06-30  Ian Lance Taylor  <iant@google.com>
12177
12178         PR 6660
12179         PR 6682
12180         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12181         versions]: Don't try to read the value in the contents, since we
12182         don't use it.  Use the template endianness when writing.
12183
12184 2008-06-25  Cary Coutant  <ccoutant@google.com>
12185
12186         * fileread.cc (File_read::make_view): Assert on zero-length view.
12187         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12188         symbol table when there are no symbols to read.
12189
12190 2008-06-23  Craig Silverstein  <csilvers@google.com>
12191
12192         * version.cc (version_string): Bump to 1.7
12193
12194 2008-06-18  Craig Silverstein  <csilvers@google.com>
12195
12196         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12197         constant 0xFFFF to type Valtype.
12198         (Powerpc_relocate_functions::rel16_ha): Likewise.
12199
12200 2008-06-17  Ian Lance Taylor  <iant@google.com>
12201
12202         * output.h (Output_section::Input_section): Initialize p2align_ to
12203         zero for Output_section_data constructors.
12204         (Output_section::Input_section::addralign): If not an input
12205         section, return the alignment of the Output_section_data.
12206         * testsuite/copy_test.cc: New file.
12207         * testsuite/copy_test_1.cc: New file.
12208         * testsuite/copy_test_2.cc: New file.
12209         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12210         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12211         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12212         (copy_test_1_pic.o, copy_test_1.so): New targets.
12213         (copy_test_2_pic.o, copy_test_2.so): New targets.
12214         * testsuite/Makefile.in: Rebuild.
12215
12216         * script-sections.cc (Script_sections::place_orphan): Initialize
12217         local variable exact.
12218
12219 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12220
12221         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12222
12223 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12224             David S. Miller  <davem@davemloft.net>
12225
12226         * powerpc.cc: New file.
12227         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12228         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12229         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12230         * Makefile.in: Rebuild.
12231
12232 2008-06-09  Ian Lance Taylor  <iant@google.com>
12233
12234         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12235         <exception>.
12236         (throwing, orig_terminate): New static variables.
12237         (terminate_handler): New static function.
12238         (t2): Set terminate handler.
12239
12240 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12241
12242         PR 6584
12243         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12244         alignment.
12245
12246 2008-05-30  Cary Coutant  <ccoutant@google.com>
12247
12248         * archive.cc (Archive::include_all_members) Correct to step
12249         over symbol table and extended name table in thin archives.
12250
12251 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12252
12253         PR 6407
12254         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12255         calculation.
12256
12257 2008-05-28  Caleb Howe  <cshowe@google.com>
12258
12259         * reduced_debug_output.cc: New file.
12260         * reduced_debug_output.h: New file.
12261         * options.h (class General_options): Add --strip-debug-non-line.
12262         * options.cc (General_options::finalize): Add strip_debug_non_line
12263         to the strip heirarchy.
12264         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12265         fields.
12266         * layout.cc: Include "reduced_debug_output.h".
12267         (Layout::Layout): Initialize new fields.
12268         (line_only_debug_sections): New static array.
12269         (is_lines_only_debug_sections): New static inline function.
12270         (Layout::include_section): Handle --strip-debug-non-line.
12271         (Layout::make_output_section): If --strip-debug-non-line, build
12272         new output sections for .debug_abbrev and .debug_info.
12273         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12274         gold.  Warn about possible overflow.
12275         (read_signed_LEB_128): Likewise.
12276         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12277         (read_signed_LEB_128): Declare.
12278         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12279         (HFILES): Add reduced_debug_output.h.
12280         * Makefile.in: Rebuild.
12281
12282 2008-05-21  Ian Lance Taylor  <iant@google.com>
12283
12284         * mapfile.cc: New file.
12285         * mapfile.h: New file.
12286         * options.h (class General_options): Add -M/--print-map and -Map.
12287         * options.cc (General_options::finalize): Make -M equivalent to
12288         -Map -.
12289         * main.cc: Include <cstdio> and "mapfile.h".
12290         (main): Open mapfile if requested.
12291         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12292         constructor.  Change caller.
12293         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12294         (queue_middle_tasks): Likewise.
12295         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12296         declarations.
12297         * archive.cc: Include "mapfile.h".
12298         (Archive::add_symbols): Add mapfile parameter.  Change all
12299         callers.  Pass mapfile, symbol, and reason to include_member.
12300         (Archive::include_all_members): Add mapfile parameter.  Change all
12301         callers.
12302         (Archive::include_member): Add mapfile, sym, and why parameters.
12303         Change all callers.  Report inclusion to map file.
12304         * archive.h: Include "fileread.h".
12305         (class Archive): Update declarations.
12306         (Archive::file): New const method.
12307         (class Add_archive_symbols): Add mapfile_ field.  Update
12308         constructor.  Change all callers.
12309         * readsyms.h (class Read_symbols): Likewise.
12310         (class Finish_group): Likewise.
12311         (class Read_script): Likewise.
12312         * common.cc: Include "mapfile.h".
12313         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12314         all callers.
12315         (Symbol_table::do_allocate_commons): Likewise.
12316         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12317         symbol allocation to mapfile.
12318         * common.h (class Allocate_commons_task): Add mapfile_ field.
12319         Update constructor.  Change all callers.
12320         * symtab.h (class Symbol_table): Update declarations.
12321         * layout.cc: Include "mapfile.h".
12322         (Layout_task_runner::run): Print information to mapfile.
12323         (Layout::create_gold_note): Change Output_data_fixed_space to
12324         Output_data_zero_fill.
12325         (Layout::create_build_id): Likewise.
12326         (Layout::print_to_mapfile): New function.
12327         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12328         constructor.  Change caller.
12329         (class Layout): Declare print_to_mapfile.
12330         * output.cc (Output_section::Input_section::print_to_mapfile): New
12331         function.
12332         (Output_section::add_input_section): If producing a map, always
12333         add to input_sections_ list.
12334         (Output_section::do_print_to_mapfile): New function.
12335         (Output_segment::print_sections_to_mapfile): New function.
12336         (Output_segment::print_section_list_to_mapfile): New function.
12337         * output.h: Include "mapfile.h".
12338         (Output_data::print_to_mapfile): New function.
12339         (Output_data::do_print_to_mapfile): New virtual function.
12340         (Output_segment_headers::do_print_to_mapfile): New function.
12341         (Output_file_header::do_print_to_mapfile): New function.
12342         (Output_data_const::do_print_to_mapfile): New function.
12343         (class Output_data_const_buffer): Add map_name_ field.  Update
12344         constructor.  Change all callers.  Add do_print_to_mapfile
12345         function.
12346         (class Output_data_fixed_space): Likewise.
12347         (class Output_data_space): Likewise.
12348         (class Output_data_zero_fill): New class.
12349         (Output_data_strtab::do_print_to_mapfile): New function.
12350         (Output_data_reloc_base::do_print_to_mapfile): New function.
12351         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12352         (Output_data_group::do_print_to_mapfile): New function.
12353         (Output_data_got::do_print_to_mapfile): New function.
12354         (Output_data_dynamic::do_print_to_mapfile): New function.
12355         (Output_symtab_xindex::do_print_to_mapfile): New function.
12356         (class Output_section): Declare do_print_to_mapflie.  Declare
12357         print_to_mapfile in Input_section.
12358         (class Output_segment): Declare new functions.
12359         * object.h (Sized_relobj::symbol_count): New function.
12360         * script-sections.cc
12361         (Output_section_element_dot_assignment::set_section_addresses):
12362         Change Output_data_fixed_space to Output_data_zero_fill.
12363         (Output_data_expression::do_print_to_mapfile): New function.
12364         * script.cc (read_input_script): Add mapfile parameter.  Change
12365         all callers.
12366         * script.h (read_input_script): Update declaration.
12367         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12368         (Eh_frame::do_print_to_mapfile): New function.
12369         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12370         (Output_merge_string::do_print_to_mapfile): New function.
12371         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12372         function.
12373         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12374         function.
12375         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12376         function.
12377         * Makefile.am (CCFILES): Add mapfile.cc.
12378         (HFILES): Add mapfile.h.
12379         * Makefile.in: Rebuild.
12380
12381 2008-05-19  Ian Lance Taylor  <iant@google.com>
12382
12383         * options.h (class General_options): Add -z relro.
12384         * layout.cc (Layout::Layout): Initialize relro_segment_.
12385         (Layout::add_output_section_data): Return the output section.
12386         (Layout::make_output_section): Rcognize relro sections and mark
12387         them appropriately.
12388         (Layout::attach_allocated_section_to_segment): Put relro sections
12389         in a PT_GNU_RELRO segment.
12390         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12391         section as relro.
12392         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12393         PT_TLS segments.
12394         (Layout::linkonce_mapping): Map d.rel.ro.local to
12395         .data.rel.ro.local.
12396         (Layout::output_section_name): Us .data.rel.ro.local for any
12397         section which begins with that.
12398         * layout.h (class Layout): Update add_output_section_data
12399         declaration.  Add relro_segment_ field.
12400         * output.cc (Output_section::Output_section): Initialize is_relro_
12401         and is_relro_local_ fields.
12402         (Output_segment::add_output_section): Group relro sections.
12403         (Output_segment::is_first_section_relro): New function.
12404         (Output_segment::maximum_alignment): If there is a relro section,
12405         align the segment to the common page size.
12406         (Output_segment::set_section_addresses): Track whether we are
12407         looking at relro sections.  If the last section is a relro
12408         section, align to the common page size.
12409         (Output_segment::set_section_list_addresses): Add in_relro
12410         parameter.  Change all callers.  Align to the page size when
12411         moving from relro to non-relro section.
12412         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12413         segment.
12414         * output.h (class Output_section): Add is_relro_ and
12415         is_relro_local_ fields.
12416         (Output_section::is_relro): New function.
12417         (Output_section::set_is_relro): New function.
12418         (Output_section::is_relro_local): New function.
12419         (Output_section::set_is_relro_local): New function.
12420         (class Output_segment): Update declarations.
12421         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12422         * sparc.cc (Target_sparc::got_section): Likewise.
12423         * x86_64.cc (Target_x86_64::got_section): Likewise.
12424         * testsuite/relro_test_main.cc: New file.
12425         * testsuite/relro_test.cc: New file.
12426         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12427         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12428         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12429         (relro_test.so, relro_test_pic.o): New targets.
12430         * testsuite/Makefile.in: Rebuild.
12431
12432 2008-05-16  Ian Lance Taylor  <iant@google.com>
12433
12434         * output.cc (Output_segment::add_output_section): Remove front
12435         parameter.
12436         * output.h (class Output_segment): Remove
12437         add_initial_output_section and overloaded add_output_section.
12438         Update declaration of remaining add_output_section.
12439         * layout.cc (Layout::create_interp): Call add_output_section
12440         rather than add_initial_output_section.
12441         (Layout::finish_dynamic_section): Likewise.
12442
12443         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12444         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12445         know the dynamic type.
12446         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12447         field.  Initialize it in constructor.
12448         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12449         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12450         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12451         reloc.
12452
12453         * output.cc (Output_reloc::get_address): Change return type to
12454         Elf_Addr.
12455         * output.h (class Output_reloc): Update get_address declaration.
12456         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12457         for section addresses.
12458
12459 2008-05-09  Ian Lance Taylor  <iant@google.com>
12460
12461         PR 6493
12462         * gold.cc (gold_nomem): Use return value of write.
12463
12464 2008-05-08  Ian Lance Taylor  <iant@google.com>
12465
12466         * symtab.c (Symbol::init_base_output_data): Add version
12467         parameter.  Change all callers.
12468         (Symbol::init_base_output_segment): Likewise.
12469         (Symbol::init_base_constant): Likewise.
12470         (Symbol::init_base_undefined): Likewise.
12471         (Sized_symbol::init_output_data): Likewise.
12472         (Sized_symbol::init_output_segment): Likewise.
12473         (Sized_symbol::init_constant): Likewise.
12474         (Sized_symbol::init_undefined): Likewise.
12475         (Symbol_table::do_define_in_output_data): If the new symbol has a
12476         version, mark it as the default.
12477         (Symbol_table::do_define_in_output_segment): Likewise.
12478         (Symbol_table::do_define_as_constant): Likewise.
12479         * symtab.h (class Symbol): Update declarations.
12480         (class Sized_symbol): Likewise.
12481         * resolve.cc (Symbol::override_version): New function.
12482         (Symbol::override_base): Call override_version.
12483         (Symbol::override_base_with_special): Likewise.
12484         * testsuite/ver_script_8.script: New file.
12485         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12486         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12487         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12488         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12489
12490 2008-05-06  Ian Lance Taylor  <iant@google.com>
12491
12492         PR 6049
12493         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12494         functions.
12495         (class General_options): Remove existing --undefined, and add
12496         --no-undefined instead.  Add new --undefined as synonym for -u.
12497         * archive.cc (Archive::add_symbols): Check whether symbol was
12498         named with -u.
12499         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12500         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12501         all uses.  Add IS_UNDEFINED.  Update declarations to split
12502         different versions of init_base.  Declare init_base_undefined.
12503         (Symbol::is_defined): Handle IS_UNDEFINED.
12504         (Symbol::is_undefined): Likewise.
12505         (Symbol::is_weak_undefined): Call is_undefined.
12506         (Symbol::is_absolute): Handle IS_CONSTANT.
12507         (class Sized_symbol): Update declarations to split different
12508         versions of init.  Declare init_undefined.
12509         (class Symbol_table): Declare new functions.
12510         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12511         Change all callers.
12512         (Symbol::init_base_output_data): Likewise.
12513         (Symbol::init_base_output_segment): Likewise.
12514         (Symbol::init_base_constant): Likewise.
12515         (Symbol::init_base_undefined): New function.
12516         (Sized_symbol::init_object): Rename from init.  Change all
12517         callers.
12518         (Sized_symbol::init_output_data): Likewise.
12519         (Sized_symbol::init_output_segment): Likewise.
12520         (Sized_symbol::init_constant): Likewise.
12521         (Sized_symbol::init_undefined): New function.
12522         (Symbol_table::add_undefined_symbols_from_command_line): New
12523         function.
12524         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12525         function.
12526         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12527         (Symbol::output_section): Likewise.
12528         (Symbol::set_output_section): Likewise.
12529         (Symbol_table::sized_finalize_symbol): Likewise.
12530         (Symbol_table::sized_write_globals): Likewise.
12531         * resolve.cc (Symbol_table::should_override): Likewise.
12532         (Symbol::override_base_with_special): Likewise.
12533
12534         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12535         symbol, change it to have default visibility.
12536         * testsuite/protected_1.cc: New file.
12537         * testsuite/protected_2.cc: New file.
12538         * testsuite/protected_3.cc: New file.
12539         * testsuite/protected_main_1.cc: New file.
12540         * testsuite/protected_main_2.cc: New file.
12541         * testsuite/protected_main_3.cc: New file.
12542         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12543         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12544         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12545         (protected_1.so): New target.
12546         (protected_1_pic.o, protected_2_pic.o): New targets.
12547         (protected_3_pic.o): New target.
12548         (check_PROGRAMS): Add protected_2.
12549         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12550         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12551         * testsuite/Makefile.in: Rebuild.
12552
12553         * options.h (DEFINE_var): Add set_user_set_##varname__.
12554         (DEFINE_bool_alias): New macro.
12555         (class General_options): Define -Bstatic using DEFINE_bool_alias
12556         rather than DEFINE_special.  Add --undefined as an alias for -z
12557         defs.
12558         * options.cc (General_options::parse_Bstatic): Remove.
12559
12560         * options.h (class General_options): Add --fatal-warnings.
12561         * main.cc (main): Implement --fatal-warnings.
12562         * errors.h (Errors::warning_count): New function.
12563
12564         * options.h (class General_options): Add -Bsymbolic-functions.
12565         * symtab.h (Symbol::is_preemptible): Check for
12566         -Bsymbolic-functions.
12567
12568 2008-05-05  Ian Lance Taylor  <iant@google.com>
12569
12570         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12571         as noVARNAME rather than no-VARNAME.
12572         (class General_options): Add option -z combreloc.
12573         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12574         get_address.
12575         (Output_reloc::sort_before) [SHT_REL]: New function.
12576         (Output_reloc::sort_before) [SHT_RELA]: New function.
12577         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12578         Sort_relocs_comparison.
12579         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12580         parameter.  Change all callers.
12581         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12582         sort_relocs parameter.  Change all callers.
12583         * output.cc (Output_reloc::get_address): New function, broken out
12584         of write_rel.
12585         (Output_reloc::write_rel): Call it.
12586         (Output_reloc::compare): New function.
12587         (Output_data_reloc_base::do_write): Optionally sort relocs.
12588
12589         * configure.ac: If targ_extra_obj is set, link it in.
12590         * configure.tgt: Initialize all variables.
12591         (x86_64*): Set targ_extra_obj and targ_extra_size.
12592         * configure: Rebuild.
12593
12594         * object.cc (Sized_relobj::include_section_group): Adjust section
12595         indexes read from group data.  Build vector to pass to
12596         layout_group.
12597         * layout.cc (Layout::layout_group): Add flags and shndxes
12598         parameters.  Remove contents parameter.  Change caller.  Update
12599         explicit instantiations.
12600         * layout.h (class Layout): Update layout_group declaration.
12601         * output.cc (Output_data_group::Output_data_group): Add flags and
12602         input_shndxes parameters.  Remove contents parameter.  Change
12603         caller.
12604         (Output_data_group::do_write): Change input_sections_ to
12605         input_shndxes_.
12606         * output.h (class Output_data_group): Update constructor
12607         declaration.  Rename input_sections_ to input_shndxes_.
12608         * testsuite/many_sections_test.cc: Add template.
12609
12610 2008-04-30  Cary Coutant  <ccoutant@google.com>
12611
12612         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12613
12614         * layout.cc (Layout::include_section): Refactored check for debug
12615         info section.
12616         (Layout::add_comdat): Add new parameters.  Change type
12617         of signature parameter.  Add object and shndx to signatures table.
12618         (Layout::find_kept_object): New function.
12619         * layout.h: Include <cstring>.
12620         (Layout::is_debug_info_section): New function.
12621         (Layout::add_comdat): Add new parameters.
12622         (Layout::find_kept_object): New function.
12623         (Layout::Kept_section): New struct.
12624         (Layout::Signatures): Change type of map range.
12625         * object.cc (Relobj::output_section_address): New function.
12626         (Sized_relobj::include_section_group): Add new parameters.  Change
12627         calls to Layout::add_comdat.  Change to build table of kept comdat
12628         groups and table mapping discarded sections to kept sections.
12629         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12630         (Sized_relobj::do_layout): Change calls to include_section_group and
12631         include_linkonce_section.
12632         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12633         value to zero when section is discarded.
12634         (Sized_relobj::map_to_kept_section): New function.
12635         * object.h (Relobj::output_section_address): New function.
12636         (Relobj::Comdat_group): New type.
12637         (Relobj::find_comdat_group): New function.
12638         (Relobj::Comdat_group_table): New type.
12639         (Relobj::Kept_comdat_section): New type.
12640         (Relobj::Kept_comdat_section_table): New type.
12641         (Relobj::add_comdat_group): New function.
12642         (Relobj::set_kept_comdat_section): New function.
12643         (Relobj::get_kept_comdat_section): New function.
12644         (Relobj::comdat_groups_): New field.
12645         (Relobj::kept_comdat_sections_): New field.
12646         (Symbol_value::input_value): Update comment.
12647         (Sized_relobj::map_to_kept_section) New function.
12648         (Sized_relobj::include_linkonce_section): Add new parameter.
12649         * target-reloc.h (Comdat_behavior): New type.
12650         (get_comdat_behavior): New function.
12651         (relocate_section): Add code to map a discarded section to the
12652         corresponding kept section when applying a relocation.
12653
12654 2008-04-30  Craig Silverstein  <csilvers@google.com>
12655
12656         * dwarf_reader.cc (next_generation_count): New static var.
12657         (Addr2line_cache_entry): New struct.
12658         (addr2line_cache): New static var.
12659         (Dwarf_line_info::one_addr2line): Added caching.
12660         (Dwarf_line_info::clear_addr2line_cache): New function.
12661         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12662         cache-size parameter.
12663         (Dwarf_line_info::one_addr2line_cache): New function.
12664         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12665         new cache-size argument to one_addr2line(), and clear cache.
12666
12667 2008-04-28  Cary Coutant  <ccoutant@google.com>
12668
12669         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12670         R_386_PC8 relocations.
12671
12672 2008-04-23  Ian Lance Taylor  <iant@google.com>
12673
12674         * object.cc (Sized_relobj::include_section_group): Check for
12675         invalid section group.
12676
12677         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12678         header size.
12679
12680         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12681         than read for file header.
12682         * archive.cc (Archive::include_member): Likewise.
12683
12684 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12685
12686         * aclocal.m4: Regenerate.
12687         * configure: Regenerate.
12688
12689 2008-04-19  Ian Lance Taylor  <iant@google.com>
12690
12691         * version.cc (version_string): Bump to 1.6.
12692
12693         * testsuite/Makefile.am (many_sections_r_test): New target.
12694         (many_sections_r_test_SOURCES): Remove.
12695         (many_sections_r_test_DEPENDENCIES): Remove.
12696         (many_sections_r_test_LDFLAGS): Remove.
12697         (many_sections_r_test_LDADD): Remove.
12698
12699         * object.cc (Sized_relobj::do_add_symbols): Always pass
12700         local_symbol_count_ to add_from_relobj.
12701
12702         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12703         every thousand variables.
12704         * testsuite/Makefile.in: Rebuild.
12705
12706         * object.cc (Xindex::initialize_symtab_xindex): New function.
12707         (Xindex::read_symtab_xindex): New function.
12708         (Xindex::sym_xindex_to_shndx): New function.
12709         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12710         available.
12711         (Sized_relobj::do_initialize_xindex): New function.
12712         (Sized_relobj::do_read_symbols): Adjust section links.
12713         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12714         parameter.  Change all callers.
12715         (Sized_relobj::include_section_group): Adjust section links and
12716         symbol section indexes.
12717         (Sized_relobj::do_layout): Adjust section links.
12718         (Sized_relobj::do_count_local_symbols): Adjust section links and
12719         symbol section indexes.
12720         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12721         ordinary and special symbols.
12722         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12723         dynsym_xindex parameters.  Change all callers.  Adjust section
12724         links.  Use SHN_XINDEX when needed.
12725         (Sized_relobj::get_symbol_location_info): Adjust section links.
12726         Don't get fooled by special symbols.
12727         * object.h (class Xindex): Define.
12728         (class Object): Add xindex_ parameter.  Declare virtual functoin
12729         do_initialize_xindex.
12730         (Object::adjust_sym_shndx): New function.
12731         (Object::set_xindex): New protected function.
12732         (class Symbol_value): Add is_ordinary_shndx_ field.
12733         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12734         (Symbol_value::value): Assert ordinary section.
12735         (Symbol_value::initialize_input_to_output_map): Likewise.
12736         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12737         Change all callers.
12738         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12739         all callers.
12740         (class Sized_relobj): Update declarations.
12741         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12742         parameter.  Change all callers.
12743         (Sized_relobj::adjust_shndx): New function.
12744         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12745         field.
12746         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12747         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12748         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12749         (Sized_dynobj::read_dynsym_section): Adjust section links.
12750         (Sized_dynobj::read_dynamic): Likewise.
12751         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12752         section links.
12753         (Sized_dynobj::do_initialize_xindex): New function.
12754         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12755         do_initialize_xindex.
12756         (Sized_dynobj::adjust_shndx): New function.
12757         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12758         dynsym_xindex_ fields.
12759         (Layout::finalize): Add a call to set_section_indexes before
12760         creating the symtab sections.
12761         (Layout::set_section_indexes): Don't do anything if the section
12762         already has a section index.
12763         (Layout::create_symtab_sections): Add shnum parameter.  Change
12764         caller.  Create .symtab_shndx section if needed.
12765         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12766         caller.
12767         (Layout::allocated_output_section_count): New function.
12768         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12769         needed.
12770         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12771         fields.  Update declarations.
12772         (Layout::symtab_xindex): New function.
12773         (Layout::dynsym_xindex): New function.
12774         (class Write_symbols_task): Add layout_ field.
12775         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12776         Change caller.
12777         * output.cc (Output_section_headers::Output_section_headers): Add
12778         shstrtab_section parameter.  Change all callers.
12779         (Output_section_headers::do_sized_write): Store overflow values
12780         for section count and section string table section index in
12781         section header zero.
12782         (Output_file_header::do_sized_write): Check for overflow of
12783         section count and section string table section index.
12784         (Output_symtab_xindex::do_write): New function.
12785         (Output_symtab_xindex::endian_do_write): New function.
12786         * output.h (class Output_section_headers): Add shstrtab_section_.
12787         Update declarations.
12788         (class Output_symtab_xindex): Define.
12789         (Output_section::has_out_shndx): New function.
12790         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12791         field.
12792         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12793         Change all callers.
12794         (Sized_symbol::init): Likewise.
12795         (Symbol::output_section): Check for ordinary symbol.
12796         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12797         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12798         callers.
12799         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12800         Change all callers.  Simplify handling of symbols from sections
12801         not included in the link.
12802         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12803         distinction.
12804         (Weak_alias_sorter::operator()): Assert that symbols are
12805         ordinary.
12806         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12807         distinction.
12808         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12809         parameters.  Change all callers.
12810         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12811         symbol distinction.  Use SHN_XINDEX when needed.
12812         (Symbol_table::write_section_symbol): Add symtab_xindex
12813         parameter.  Change all callers.
12814         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12815         SHN_XINDEX when needed.
12816         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12817         declarations.
12818         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12819         (Symbol::is_defined): Check is_ordinary.
12820         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12821         (Symbol::is_absolute, Symbol::is_common): Likewise.
12822         (class Sized_symbol): Update declarations.
12823         (class Symbol_table): Update declarations.
12824         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12825         parameters.  Change all callers.
12826         (Sized_symbol::override): Likewise.
12827         (Symbol_table::override): Likewise.
12828         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12829         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12830         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12831         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12832         to be in an ordinary section.
12833         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12834         object and is_ordinary parameters.  Change all callers.
12835         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12836         Change all callers.  Don't add undefined or non-ordinary symbols
12837         to reloc_map_.
12838         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12839         Change all callers.
12840         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12841         declarations.
12842         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12843         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12844         (Sized_relobj::relocate_sections): Likewise.
12845         * target-reloc.h (scan_relocs): Adjust section symbol index.
12846         (scan_relocatable_relocs): Likewise.
12847         * i386.cc (Scan::local): Check for ordinary symbols.
12848         * sparc.cc (Scan::local): Likewise.
12849         * x86_64.cc (Scan::local): Likewise.
12850         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12851         to symbol_section_and_value.
12852         * testsuite/many_sections_test.cc: New file.
12853         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12854         (check_PROGRAMS): Add many_sections_test.
12855         (many_sections_test_SOURCES): Define.
12856         (many_sections_test_DEPENDENCIES): Define.
12857         (many_sections_test_LDFLAGS): Define.
12858         (BUILT_SOURCES): Add many_sections_define.h.
12859         (many_sections_define.h): New target.
12860         (BUILT_SOURCES): Add many_sections_check.h.
12861         (many_sections_check.h): New target.
12862         (check_PROGRAMS): Add many_sections_r_test.
12863         (many_sections_r_test_SOURCES): Define.
12864         (many_sections_r_test_DEPENDENCIES): Define.
12865         (many_sections_r_test_LDFLAGS): Define.
12866         (many_sections_r_test_LDADD): Define.
12867         (many_sections_r_test.o): New target.
12868         * testsuite/Makefile.in: Rebuild.
12869
12870 2008-04-17  Cary Coutant  <ccoutant@google.com>
12871
12872         * errors.cc (Errors::info): New function.
12873         (gold_info): New function.
12874         * errors.h (Errors::info): New function.
12875         * gold.h (gold_info): New function.
12876         * object.cc (Input_objects::add_object): Print trace output.
12877         * options.cc (options::parse_set): New function.
12878         (General_options::parse_wrap): Deleted.
12879         (General_options::General_options): Deleted initializer.
12880         * options.h (options::String_set): New typedef.
12881         (options::parse_set): New function.
12882         (DEFINE_set): New macro.
12883         (General_options::wrap): Changed to use DEFINE_set. Changed
12884         callers of any_wrap_symbols and is_wrap_symbol.
12885         (General_options::trace, General_options::trace_symbol):
12886         New options.
12887         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12888         (General_options::wrap_symbols_): Deleted.
12889         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12890
12891 2008-04-17  David S. Miller  <davem@davemloft.net>
12892
12893         * options.cc (General_options::parse_V): New function.
12894         * options.h: Add entries for -V and -Qy.
12895
12896 2008-04-17  Ian Lance Taylor  <iant@google.com>
12897
12898         * common.cc (Symbol_table::allocate_commons): Remove options
12899         parameter.  Change caller.
12900         (Symbol_table::do_allocate_commons): Remove options parameter.
12901         Change caller.  Just call do_allocate_commons_list twice.
12902         (Symbol_table::do_allocate_commons_list): New function, broken out
12903         of do_allocate_commons.
12904         * common.h (class Allocate_commons_task): Remove options_ field.
12905         Update constructor.
12906         * symtab.cc (Symbol_table::Symbol_table): Initialize
12907         tls_commons_.
12908         (Symbol_table::add_from_object): Put TLS common symbols on
12909         tls_commons_ list.
12910         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12911         which are IN_OUTPUT_DATA.
12912         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12913         allocate_commons and do_allocate_commons declarations.  Declare
12914         do_allocate_commons_list.
12915         * gold.cc (queue_middle_tasks): Update creation of
12916         Allocate_commons_task to not pass options.
12917         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12918         (TLS_TEST_C_FLAGS): New variable.
12919         (tls_test_c_pic.o): New target.
12920         (tls_test_shared.so): Link in tls_test_c_pic.o.
12921         (tls_test_c_pic_ie.o): New target.
12922         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12923         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12924         (tls_test_c.o): New target.
12925         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12926         (tls_pic_test_LDADD): Likewise.
12927         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12928         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12929         (tls_test_c_gnu2.o): New target.
12930         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12931         tls_test_c_gnu2.o.
12932         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12933         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12934         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12935         * testsuite/tls_test.cc: Include "config.h".
12936         (t_last): Call t11_last.
12937         * testsuite/tls_test.h (t11, t11_last): Declare.
12938         * testsuite/tls_test_c.c: New file.
12939         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12940         * configure.ac: Check for OpenMP support.
12941         * configure, config.in, Makefile.in: Rebuild.
12942         * testsuite/Makefile.in: Rebuild.
12943
12944 2008-04-16  Cary Coutant  <ccoutant@google.com>
12945
12946         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12947         (Target_i386::tls_base_symbol_defined_): New field.
12948         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12949         (Target_i386::Scan::global): Likewise.
12950         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12951         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12952         (Target_x86_64::tls_base_symbol_defined_): New field.
12953         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12954         (Target_x86_64::Scan::global): Likewise.
12955
12956 2008-04-16  Cary Coutant  <ccoutant@google.com>
12957
12958         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12959         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12960         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12961         building shared libraries.
12962         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12963         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12964         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12965         * testsuite/Makefile.in: Rebuild.
12966         * testsuite/weak_undef.h: New file.
12967         * testsuite/weak_undef_file1.cc: Add extra test cases.
12968         * testsuite/weak_undef_file2.cc: Likewise.
12969         * testsuite/weak_undef_test.cc: Likewise.
12970
12971 2008-04-16  David S. Miller  <davem@davemloft.net>
12972
12973         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12974         Add issued_non_pic_error_ field.  Declare check_non_pic.
12975         (Target_sparc::Scan::check_non_pic): New function.
12976         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12977         (Target_sparc::Scan::global): Likewise.
12978
12979         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12980         * configure: Rebuild.
12981
12982         * options.h (DEFINE_enable): New macro.
12983         (new_dtags): New enable option.
12984         (initfirst, interpose, loadfltr, nodefaultlib,
12985         nodelete, nodlopen, nodump): New -z options.
12986         * layout.cc (Layout:finish_dynamic_section): If new
12987         dtags enabled, emit DT_RUNPATH.  Also, emit a
12988         DT_FLAGS_1 containing any specified -z flags.
12989
12990 2008-04-16  Ian Lance Taylor  <iant@google.com>
12991
12992         * copy-relocs.cc: New file.
12993         * copy-relocs.h: New file.
12994         * reloc.cc: Remove Copy_relocs code.
12995         * reloc.h: Likewise.
12996         * reloc-types.h (struct Reloc_types) [both versions]: Add
12997         get_reloc_addend_noerror.
12998         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12999         variants of add_global which take an addend which must be zero.
13000         * i386.cc: Include "copy-relocs.h".
13001         (class Target_i386): Change type of copy_relocs_ to variable,
13002         update initializer.
13003         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13004         Change all callers.
13005         (Target_i386::do_finalize_sections): Change handling of
13006         copy_relocs_.
13007         * sparc.cc: Include "copy-relocs.h".
13008         (class Target_sparc): Change type of copy_relocs_ to variable,
13009         update initializer.
13010         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13011         Change all callers.
13012         (Target_sparc::do_finalize_sections): Change handling of
13013         copy_relocs_.
13014         * x86_64.cc: Include "copy-relocs.h".
13015         (class Target_x86_64): Change type of copy_relocs_ to variable,
13016         update initializer.
13017         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13018         class.  Change all callers.
13019         (Target_x86_64::do_finalize_sections): Change handling of
13020         copy_relocs_.
13021         * Makefile.am (CCFILES): Add copy-relocs.cc.
13022         (HFILES): Add copy-relocs.h.
13023
13024         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13025
13026         * testsuite/script_test_4.sh: Permit leading zeroes.
13027
13028 2008-04-15  Ian Lance Taylor  <iant@google.com>
13029
13030         * script-sections.cc (Script_sections::create_segments): Use
13031         header_size_adjustment even when there is enough room for the
13032         headers.
13033         * testsuite/script_test_4.sh: New file.
13034         * testsuite/script_test_4.t: New file.
13035         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13036         (check_DATA): Add script_test_4.stdout.
13037         (MOSTLYCLEANFILES): Likewise.
13038         (script_test_4): New target.
13039         (script_test_4.stdout): New target.
13040         * testsuite/Makefile.in: Rebuild.
13041
13042         * sparc.cc: Add definitions for Output_data_plt_sparc class
13043         constants.
13044
13045 2008-04-14  David S. Miller  <davem@davemloft.net>
13046
13047         * sparc.cc: New file.
13048         * Makefile.am (TARGETSOURCES): Add sparc.cc
13049         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13050         * configure.tgt: Document targ_extra_size and
13051         targ_extra_big_endian.  Add entries for sparc-* and
13052         sparc64-*.
13053         * configure.ac: Handle targ_extra_size and
13054         targ_extra_big_endian.
13055         * Makefile.in: Rebuild.
13056         * configure: Likewise.
13057         * po/POTFILES.in: Likewise.
13058         * po/gold.pot: Likewise.
13059
13060 2008-04-14  Ian Lance Taylor  <iant@google.com>
13061
13062         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13063         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13064         in the name/type/flags to section mapping.  Don't call
13065         allocate_output_section.
13066         (Layout::choose_output_section): Change parameter from adjust_name
13067         to is_input_section.  Don't permit input sections after sections
13068         are attached to segments.  Don't call allocate_output_section.
13069         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13070         not write_enable_output_section.
13071         (Layout::make_output_section): Don't push to
13072         unattached_section_list_ nor call attach_to_segment.  Call
13073         attach_section_to_segment if sections are attached.
13074         (Layout::attach_sections_to_segments): New function.
13075         (Layout::attach_section_to_segment): New function.
13076         (Layout::attach_allocated_section_to_segment): Rename from
13077         attach_to_segment.  Remove flags parameter.
13078         (Layout::allocate_output_section): Remove function.
13079         (Layout::write_enable_output_section): Remove function.
13080         * layout.h (class Layout): Update for above changes.  Add new
13081         field sections_are_attached_.
13082         * output.h (Output_section::update_flags_for_input_section): New
13083         function.
13084         * output.cc (Output_section::add_input_section): Call
13085         update_flags_for_input_section.
13086         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13087
13088 2008-04-11  Cary Coutant  <ccoutant@google.com>
13089
13090         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13091         thought unnecessary.
13092         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13093
13094 2008-04-11  Ian Lance Taylor  <iant@google.com>
13095
13096         * output.h (class Output_section_data): Remove inline definition
13097         of set_addralign.
13098         * output.cc (Output_section_data::set_addralign): New function.
13099
13100 2008-04-11  Cary Coutant  <ccoutant@google.com>
13101
13102         Add support for TLS descriptors for i386 and x86_64.
13103         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13104         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13105         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13106         GOT_TYPE_TLS_DESC.
13107         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13108         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13109         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13110         relocations.
13111         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13112         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13113         Fix problem with initial-exec relocations.
13114         (Target_i386::Relocate::relocate_tls): Likewise.
13115         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13116         relaxation.
13117         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13118         support for section-plus-offset dynamic table entries.
13119         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13120         (Output_data_dynamic::Dynamic_entry): Add support for
13121         section-plus-offset dynamic table entries.
13122         (Output_data_dynamic::Classification): Likewise.
13123         (Output_data_dynamic::classification_): Renamed offset_.
13124         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13125         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13126         (Target_x86_64::make_plt_section): New function.
13127         (Target_x86_64::reserve_tlsdesc_entries): New function.
13128         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13129         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13130         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13131         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13132         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13133         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13134         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13135         add extra PLT entry for TLS descriptors.
13136         (Output_data_plt_x86_64::got_): New field.
13137         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13138         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13139         fields.
13140         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13141         descriptors.
13142         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13143         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13144         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13145         R_386_TLS_DESC_CALL relocations.
13146         (Target_x86_64::Scan::global): Likewise.
13147         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13148         for TLS descriptors.
13149         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13150         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13151         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13152         GD-to-IE relaxation.
13153         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13154         and TLS_DESCRIPTORS.
13155         * Makefile.in: Rebuild.
13156         * configure: Rebuild.
13157         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13158         (tls_test_shared2.so): New target.
13159         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13160         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13161         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13162         (tls_shared_gd_to_ie_test_LDADD): New variable.
13163         (tls_shared_gnu2_gd_to_ie_test): New target.
13164         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13165         New targets.
13166         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13167         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13168         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13169         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13170         (tls_shared_gnu2_test): New target.
13171         (tls_test_gnu2_shared.so): New target.
13172         (tls_shared_gnu2_test_SOURCES): New variable.
13173         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13174         (tls_shared_gnu2_test_LDFLAGS): New variable.
13175         (tls_shared_gnu2_test_LDADD): New variable.
13176         * testsuite/Makefile.in: Rebuild.
13177         * testsuite/Makefile.
13178
13179 2008-04-11  Ian Lance Taylor  <iant@google.com>
13180
13181         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13182         justsyms.t.
13183         * testsuite/Makefile.in: Rebuild.
13184
13185         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13186         long.
13187         * testsuite/script_test_2.cc (main): Adjust test.
13188
13189 2008-04-11  David S. Miller  <davem@davemloft.net>
13190             Ian Lance Taylor  <iant@google.com>
13191
13192         * options.h (General_options): Add entries for '-Y' and
13193         '-relax'.
13194         * options.cc (General_options:finalize): If -Y was used, add those
13195         entries to the library path instead of the default "/lib" and
13196         "/usr/lib".
13197
13198 2008-04-11  David S. Miller  <davem@davemloft.net>
13199
13200         * testsuite/justsyms.t: Start at 0x100.
13201         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13202         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13203         long.
13204         * testsuite/script_test_2.cc: Adjust string and section length
13205         checks.
13206
13207 2008-04-09  Ian Lance Taylor  <iant@google.com>
13208
13209         PR gold/5996
13210         * script-sections.cc (Sections_element::allocate_to_segment): Add
13211         orphan parameter.
13212         (Output_section_definition::allocate_to_segment): Likewise.
13213         (Orphan_output_section::allocate_to_segment): Likewise.
13214         (Script_sections::attach_sections_using_phdrs_clause): Don't
13215         propagate non-PT_LOAD segments to orphan sections.
13216         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13217         readelf rather than objdump.
13218         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13219         .interp section and PT_INTERP segment are the same size.
13220         * testsuite/Makefile.in: Rebuild.
13221
13222         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13223         aliases for symbols defined in the same object.
13224         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13225         (weak_alias_test_SOURCES): New variable.
13226         (weak_alias_test_DEPENDENCIES): New variable.
13227         (weak_alias_test_LDFLAGS): New variable.
13228         (weak_alias_test_LDADD): New variable.
13229         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13230         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13231         (weak_alias_test_3.o): New target.
13232         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13233         * testsuite/weak_alias_test_main.cc: New file.
13234         * testsuite/weak_alias_test_1.cc: New file.
13235         * testsuite/weak_alias_test_2.cc: New file.
13236         * testsuite/weak_alias_test_3.cc: New file.
13237
13238 2008-04-08  Ian Lance Taylor  <iant@google.com>
13239
13240         * options.h (class General_options): Add --noinhibit-exec option.
13241         * main.cc (main): Check --noinhibit-exec.
13242
13243         * options.h (class General_options): Define --wrap as a special
13244         option.  Add wrap_symbols_ field.
13245         (General_options::any_wrap_symbols): New function.
13246         (General_options::is_wrap_symbol): New function.
13247         * options.cc (General_options::parse_wrap): New function.
13248         (General_options::General_options): Initialize wrap_symbols_.
13249         * symtab.cc (Symbol_table::wrap_symbol): New function.
13250         (Symbol_table::add_from_object): Handle --wrap.
13251         * symtab.h (class Symbol_table): Declare wrap_symbol.
13252         * target.h (Target::wrap_char): New function.
13253         (Target::Target_info): Add wrap_char field.
13254         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13255         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13256         * testsuite/testfile.cc (Target_test::test_target_info):
13257         Likewise.
13258
13259         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13260         there is one.
13261
13262         * layout.h (class Layout): Add added_eh_frame_data_ field.
13263         * layout.cc (Layout::Layout): Initialize new field.
13264         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13265         output section until we find a section we merged successfully.
13266         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13267         that the size be non-zero.
13268
13269         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13270         qualifier.
13271
13272 2008-04-08  Craig Silverstein  <csilvers@google.com>
13273
13274         * configure.ac: Export new conditional variable HAVE_ZLIB.
13275         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13276         on HAVE_ZLIB.
13277         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13278         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13279
13280 2008-04-07  Ian Lance Taylor  <iant@google.com>
13281
13282         * version.cc (version_string): Set to "1.5".
13283
13284         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13285         Add issued_non_pic_error_ field.  Declare check_non_pic.
13286         (Target_x86_64::Scan::check_non_pic): New function.
13287         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13288         (Target_x86_64::Scan::global): Likewise.
13289
13290         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13291         addend parameter.  Change caller.  Handle merge sections.
13292         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13293         Address to Addend.  Don't add in the result of
13294         local_section_offset, pass down the addend and use the returned
13295         value.
13296         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13297         Update declarations of local_section_offset and symbol_value.
13298         * testsuite/two_file_test_1.cc (t18): New function.
13299         * testsuite/two_file_test_2.cc (f18): New function.
13300         * testsuite/two_file_test_main.cc (main): Call t18.
13301         * testsuite/two_file_test.h (t18, f18): Declare.
13302
13303         * configure.ac: Don't test for objdump, c++filt, or readelf.
13304         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13305         conditionals.
13306         (TEST_READELF): New variable.
13307         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13308         (check_PROGRAMS): Add two_file_strip_test.
13309         (two_file_strip_test): New target.
13310         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13311         (two_file_same_shared_strip_test_SOURCES): New variable.
13312         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13313         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13314         (two_file_same_shared_strip_test_LDADD): New variable.
13315         (two_file_shared_strip.so): New target.
13316         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13317         (ver_test_5.syms, ver_test_7.syms): Likewise.
13318         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13319         (strip_test_3.stdout): Use TEST_OBJDUMP.
13320         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13321
13322 2008-04-04  Cary Coutant  <ccoutant@google.com>
13323
13324         * symtab.h (Symbol::is_weak_undefined): New function.
13325         (Symbol::is_strong_undefined): New function.
13326         (Symbol::is_absolute): New function.
13327         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13328         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13329         absolute symbols.
13330         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13331         (weak_undef_test): New target.
13332         * testsuite/Makefile.in: Rebuild.
13333         * testsuite/weak_undef_file1.cc: New file.
13334         * testsuite/weak_undef_file2.cc: New file.
13335         * testsuite/weak_undef_test.cc: New file.
13336
13337 2008-04-03  Craig Silverstein  <csilvers@google.com>
13338
13339         * compressed_output.h (class Output_compressed_section): Use
13340         unsigned buffer.
13341         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13342         add zlib header.
13343         (zlib_compressed_suffix): Removed.
13344         (Output_compressed_section::set_final_data_size): Use unsigned
13345         buffers.
13346         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13347         Fix linker invocation.
13348         (flagstest_o_specialfile_and_compress_debug_sections):
13349         Likewise.
13350         * testsuite/Makefile.in: Regenerated.
13351
13352 2008-04-02  David S. Miller  <davem@davemloft.net>
13353
13354         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13355         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13356
13357 2008-04-02  Craig Silverstein  <csilvers@google.com>
13358
13359         * TODO: New file.
13360
13361 2008-04-02  Ian Lance Taylor  <iant@google.com>
13362
13363         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13364         parameters.  Update for new key type to views_.  Change all
13365         callers.
13366         (File_read::read): Adjust for byteshift in returned view.
13367         (File_read::add_view): New function, broken out of
13368         find_and_make_view.
13369         (File_read::make_view): New function, broken out of
13370         find_and_make_view.
13371         (File_read::find_or_make_view): Add offset and aligned
13372         parameters.  Rewrite accordingly.  Change all callers.
13373         (File_read::get_view): Add offset and aligned parameters.  Adjust
13374         for byteshift in return value.
13375         (File_read::get_lasting_view): Likewise.
13376         * fileread.h (class File_read): Update declarations.
13377         (class File_read::View): Add byteshift_ field.  Add byteshift to
13378         constructor.  Add byteshift method.
13379         * archive.h (Archive::clear_uncached_views): New function.
13380         (Archive::get_view): Add aligned parameter.  Change all callers.
13381         * object.h (Object::get_view): Add aligned parameter.  Change all
13382         callers.
13383         (Object::get_lasting_view): Likewise.
13384
13385         * fileread.cc (File_read::release): Don't call clear_views if
13386         there are multiple objects.
13387         * fileread.h (File_read::clear_uncached_views): New function.
13388         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13389         on the archive.
13390
13391 2008-03-31  Cary Coutant  <ccoutant@google.com>
13392
13393         Add thin archive support.
13394         * archive.cc (Archive::armagt): New const.
13395         (Archive::setup): Remove task parameter and calls to unlock.
13396         (Archive::unlock_nested_archives): New function.
13397         (Archive::read_header): Add nested_off parameter. Change
13398         all callers.
13399         (Archive::interpret_header): Likewise.
13400         (Archive::include_all_members): Change to handle thin
13401         archives.
13402         (Archive::include_member): Likewise.
13403         * archive.h (Archive::Archive): Add new parameters and
13404         initializers.
13405         (Archive::armagt): New const.
13406         (Archive::setup): Remove task parameter.
13407         (Archive::unlock_nested_archives): New function.
13408         (Archive::read_header): Add nested_off parameter.
13409         (Archive::interpret_header): Likewise.
13410         (Archive::Nested_archive_table): New typedef.
13411         (Archive::is_thin_archive_): New field.
13412         (Archive::nested_archives_): New field.
13413         (Archive::options_): New field.
13414         (Archive::dirpath_): New field.
13415         (Archive::task_): New field.
13416         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13417         for thin archives.  Pass additional parameters to
13418         Archive::Archive.  Unlock the archive file after calling
13419         Archive::setup.
13420
13421 2008-03-29  Ian Lance Taylor  <iant@google.com>
13422
13423         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13424         version symbol to be local.
13425         * testsuite/ver_test_4.sh: New file.
13426         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13427         (check_DATA): Add ver_test_4.syms.
13428         (ver_test_4.syms): New target.
13429         * testsuite/Makefile.in: Rebuild.
13430
13431         * output.cc
13432         (Output_section::Input_section_sort_entry::has_priority): New
13433         function.
13434         (Output_section::Input_section_sort_entry::match_file_name): New
13435         function.
13436         (Output_section::Input_section_sort_entry::match_section_name):
13437         Remove.
13438         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13439         Remove.
13440         (Output_section::Input_section_sort_entry::match_section_file):
13441         Remove.
13442         (Output_section::Input_section_sort_compare::operator()): Rewrite
13443         using new Input_section_sort_entry functions.  Sort crtbegin and
13444         crtend first.  Sort sections with no priority before sections with
13445         a priority.
13446         * testsuite/initpri1.c (d3): Check j != 4.
13447         (cd5): New constructor/destructor function.
13448         (main): Check j != 2.
13449
13450         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13451         new symbol when resolving, don't call set_is_default.
13452         * testsuite/ver_test_7.cc: New file.
13453         * testsuite/ver_test_7.sh: New file.
13454         * testsuite/Makefile.am (ver_test_7.so): New target.
13455         (ver_test_7.o): New target.
13456         (check_SCRIPTS): Add ver_test_7.sh.
13457         (check_DATA): Add ver_test_7.syms.
13458         (ver_test_7.syms): New target.
13459
13460 2008-03-28  Ian Lance Taylor  <iant@google.com>
13461
13462         * layout.cc (Layout::layout): If we see an input section with a
13463         name that needs sorting, set the must_sort flag for the output
13464         section.
13465         (Layout::make_output_section): If the name of the output section
13466         indicates that it might require sorting, set the may_sort flag.
13467         * output.h (Output_section::may_sort_attached_input_sections): New
13468         function.
13469         (Output_section::set_may_sort_attached_input_sections): New
13470         function.
13471         (Output_section::must_sort_attached_input_sections): New
13472         function.
13473         (Output_section::set_must_sort_attached_input_sections): New
13474         function.
13475         (class Output_section): Declare Input_section_sort_entry.  Define
13476         Input_section_sort_compare.  Declare
13477         sort_attached_input_sections.  Add new fields:
13478         may_sort_attached_input_sections_,
13479         must_sort_attached_input_sections_,
13480         attached_input_sections_are_sorted_.
13481         * output.cc (Output_section::Output_section): Initialize new
13482         fields.
13483         (Output_section::add_input_section): Add an entry to
13484         input_sections_ if may_sort or must_sort are true.
13485         (Output_section::set_final_data_size): Call
13486         sort_attached_input_sections if necessary.
13487         (Output_section::Input_section_sort_entry): Define new class.
13488         (Output_section::Input_section_sort_compare::operator()): New
13489         function.
13490         (Output_section::sort_attached_input_sections): New function.
13491         * configure.ac: Check whether the compiler supports constructor
13492         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13493         * testsuite/initpri1.c: New file.
13494         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13495         CONSTRUCTOR_PRIORITY.
13496         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13497         (initpri1_LDFLAGS): New variable.
13498         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13499
13500 2008-03-27  Ian Lance Taylor  <iant@google.com>
13501
13502         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13503         * testsuite/common_test_1.c: New file.
13504         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13505         (common_test_1_SOURCES): New variable.
13506         (common_test_1_DEPENDENCIES): New variable.
13507         (common_test_1_LDFLAGS): New variable.
13508
13509         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13510         and commons_ correctly when NAME/VERSION does not override
13511         NAME/NULL.
13512         * testsuite/ver_test_6.c: New file.
13513         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13514         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13515         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13516
13517 2008-03-26  Ian Lance Taylor  <iant@google.com>
13518
13519         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13520         of an undefined symbol from a version script.
13521         * testsuite/Makefile.am (ver_test_5.so): New target.
13522         (ver_test_5.o): New target.
13523         (check_SCRIPTS): Add ver_test_5.sh.
13524         (check_DATA): Add ver_test_5.syms.
13525         (ver_test_5.syms): New target.
13526         * testsuite/ver_test_5.cc: New file.
13527         * testsuite/ver_test_5.script: New file.
13528         * testsuite/ver_test_5.sh: New file.
13529         * Makefile.in, testsuite/Makefile.in: Rebuild.
13530
13531         PR gold/5986
13532         Fix problems building gold with gcc 4.3.0.
13533         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13534         (gold_error_at_location, gold_warning_at_location): Use it.
13535         * configure.ac: Check whether we can compile and use a template
13536         function with a printf attribute.
13537         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13538         when jumping over bytes.
13539         * object.cc: Instantiate Object::read_section_data.
13540         * debug.h: Include <cstring>
13541         * dwarf_reader.cc: Include <algorithm>
13542         * main.cc: Include <cstring>.
13543         * options.cc: Include <cstring>.
13544         * output.cc: Include <cstring>.
13545         * script.cc: Include <cstring>.
13546         * script.h: Include <string>.
13547         * symtab.cc: Include <cstring> and <algorithm>.
13548         * target-select.cc: Include <cstring>.
13549         * version.cc: Include <string>.
13550         * testsuite/testmain.cc: Include <cstdlib>.
13551         * configure, config.in: Rebuild.
13552
13553 2008-03-25  Ian Lance Taylor  <iant@google.com>
13554
13555         * options.cc: Include "../bfd/bfdver.h".
13556         (options::help): Print bug reporting address.
13557
13558         * version.cc (print_version): Adjust output for current value of
13559         BFD_VERSION_STRING.
13560
13561         * NEWS: New file.
13562
13563         * options.cc (options::help): Print list of supported targets.
13564         * target-select.h: Include <vector>.
13565         (class Target_selector): Make machine_, size_, and is_big_endian_
13566         fields const.  Add bfd_name_ and instantiated_target_ fields.
13567         (Target_selector::Target_selector): Add bfd_name parameter.
13568         (Target_selector::recognize): Make non-virtual, call
13569         do_recognize.
13570         (Target_selector::recognize_by_name): Make non-virtual, call
13571         do_recognize_by_name.
13572         (Target_selector::supported_names): New function.
13573         (Target_selector::bfd_name): New function.
13574         (Target_selector::do_instantiate_target): New pure virtual
13575         function.
13576         (Target_selector::do_recognize): New virtual function.
13577         (Target_selector::do_recognize_by_name): New virtual function.
13578         (Target_selector::instantiate_target): New private function.
13579         (supported_target_names): Declare.
13580         * target-select.cc (Target_selector::Target_selector): Update for
13581         new parameter and fields.
13582         (select_target_by_name): Check that the name matches before
13583         calling recognize_by_name.
13584         (supported_target_names): New function.
13585         * i386.cc (class Target_selector_i386): Update Target_selector
13586         constructor call.  Remove recognize and recognize_by_name.  Add
13587         do_instantiate_target.
13588         * x86_64.cc (class Target_selector_x86_64): Likewise.
13589         * testsuite/testfile.cc (class Target_selector_test): Update for
13590         changes to Target_selector.
13591
13592         * README: Rewrite, with some notes on unsupported features.
13593
13594 2008-03-24  Cary Coutant  <ccoutant@google.com>
13595
13596         * i386.cc (Target_i386::Got_type): New enum declaration.
13597         (Target_i386::Scan::local): Updated callers of Output_data_got
13598         member functions.
13599         (Target_i386::Scan::global): Likewise.
13600         (Target_i386::Relocate::relocate): Likewise.
13601         (Target_i386::Relocate::relocate_tls): Likewise.
13602         * object.h (Got_offset_list): New class.
13603         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13604         (Sized_relobj::local_got_offset): Likewise.
13605         (Sized_relobj::set_local_got_offset): Likewise.
13606         (Sized_relobj::local_has_tls_got_offset): Removed.
13607         (Sized_relobj::local_tls_got_offset): Removed.
13608         (Sized_relobj::set_local_tls_got_offset): Removed.
13609         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13610         * output.cc (Output_data_got::add_global): Added got_type parameter.
13611         (Output_data_got::add_global_with_rel): Likewise.
13612         (Output_data_got::add_global_with_rela): Likewise.
13613         (Output_data_got::add_global_pair_with_rel): New function.
13614         (Output_data_got::add_global_pair_with_rela): New function.
13615         (Output_data_got::add_local): Added got_type parameter.
13616         (Output_data_got::add_local_with_rel): Likewise.
13617         (Output_data_got::add_local_with_rela): Likewise.
13618         (Output_data_got::add_local_pair_with_rel): New function.
13619         (Output_data_got::add_local_pair_with_rela): New function.
13620         (Output_data_got::add_global_tls): Removed.
13621         (Output_data_got::add_global_tls_with_rel): Removed.
13622         (Output_data_got::add_global_tls_with_rela): Removed.
13623         (Output_data_got::add_local_tls): Removed.
13624         (Output_data_got::add_local_tls_with_rel): Removed.
13625         (Output_data_got::add_local_tls_with_rela): Removed.
13626         * output.h (Output_data_got::add_global): Added got_type parameter.
13627         (Output_data_got::add_global_with_rel): Likewise.
13628         (Output_data_got::add_global_with_rela): Likewise.
13629         (Output_data_got::add_global_pair_with_rel): New function.
13630         (Output_data_got::add_global_pair_with_rela): New function.
13631         (Output_data_got::add_local): Added got_type parameter.
13632         (Output_data_got::add_local_with_rel): Likewise.
13633         (Output_data_got::add_local_with_rela): Likewise.
13634         (Output_data_got::add_local_pair_with_rel): New function.
13635         (Output_data_got::add_local_pair_with_rela): New function.
13636         (Output_data_got::add_global_tls): Removed.
13637         (Output_data_got::add_global_tls_with_rel): Removed.
13638         (Output_data_got::add_global_tls_with_rela): Removed.
13639         (Output_data_got::add_local_tls): Removed.
13640         (Output_data_got::add_local_tls_with_rel): Removed.
13641         (Output_data_got::add_local_tls_with_rela): Removed.
13642         * resolve.cc (Symbol::override_base_with_special): Removed
13643         reference to has_got_offset_ field.
13644         * symtab.cc (Symbol::init_fields): Replaced initialization
13645         of got_offset_ with got_offsets_.  Removed initialization
13646         of has_got_offset_
13647         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13648         (Symbol::got_offset): Likewise.
13649         (Symbol::set_got_offset): Likewise.
13650         (Symbol::has_tls_got_offset): Removed.
13651         (Symbol::tls_got_offset): Removed.
13652         (Symbol::set_tls_got_offset): Removed.
13653         (Symbol::got_offset_): Removed.
13654         (Symbol::tls_mod_got_offset_): Removed.
13655         (Symbol::tls_pair_got_offset_): Removed.
13656         (Symbol::got_offsets_): New field.
13657         (Symbol::has_got_offset): Removed.
13658         (Symbol::has_tls_mod_got_offset): Removed.
13659         (Symbol::has_tls_pair_got_offset): Removed.
13660         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13661         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13662         member functions.
13663         (Target_x86_64::Scan::global): Likewise.
13664         (Target_x86_64::Relocate::relocate): Likewise.
13665         (Target_x86_64::Relocate::relocate_tls): Likewise.
13666
13667 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13668
13669         * yyscript.y: Fix spelling error in comment.
13670
13671 2008-03-24  Ian Lance Taylor  <iant@google.com>
13672
13673         * options.h (class General_options): Define build_id option.
13674         * layout.h (class Layout): Declare write_build_id, create_note,
13675         create_build_id.  Add build_id_note_ member.
13676         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13677         "libiberty.h", "md5.h", "sha1.h".
13678         (Layout::Layout): Initialize eh_frame_data_,
13679         eh_frame_hdr_section_, and build_id_note_.
13680         (Layout::finalize): Call create_build_id.
13681         (Layout::create_note): New function, broken out of
13682         Layout::create_gold_note.
13683         (Layout::create_gold_note): Call create_note.
13684         (Layout::create_build_id): New function.
13685         (Layout::write_build_id): New function.
13686         (Close_task_runner::run): Call write_build_id.
13687
13688         * x86_64.cc: Correct license to GPLv3.
13689
13690 2008-03-23  Ian Lance Taylor  <iant@google.com>
13691
13692         * options.cc: Include "demangle.h".
13693         (parse_optional_string): New function.
13694         (parse_long_option): Handle takes_optional_argument.
13695         (parse_short_option): Update dash_z initializer.  Handle
13696         takes_optional_argument.
13697         (General_options::General_options): Initialize do_demangle_.
13698         (General_options::finalize): Set do_demangle_.  Handle demangling
13699         style.
13700         * options.h (parse_optional_string): Declare.
13701         (struct One_option): Add optional_arg field.  Update constructor.
13702         Update call constructor calls.  Add takes_optional_argument
13703         function.
13704         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13705         (DEFINE_optional_string): Define.
13706         (General_options::demangle): Change from DEFINE_bool to
13707         DEFINE_optional_string.
13708         (General_options::no_demangle): New function.
13709         (General_options::do_demangle): New function.
13710         (General_options::set_do_demangle): New function.
13711         (General_options::execstack_status_): Move definition to end of
13712         class definition.
13713         (General_options::static_): Likewise.
13714         (General_options::do_demangle_): New field.
13715         * object.cc (big_endian>::get_symbol_location_info): Call
13716         Options::do_demangle, not Options::demangle.
13717         * symtab.cc (demangle): Likewise.
13718
13719 2008-03-22  Ian Lance Taylor  <iant@google.com>
13720
13721         * gold.h: Include <cstddef> and <sys/types.h>
13722         * options.h: Include <cstring>.
13723
13724 2008-03-21  Ian Lance Taylor  <iant@google.com>
13725
13726         * Added source code to GNU binutils.