* config.in: Disable sanity check for kfreebsd.
[external/binutils.git] / gold / ChangeLog
1 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2
3         * config.in: Disable sanity check for kfreebsd.
4
5 2012-09-10  Sterling Augustine  <saugustine@google.com>
6
7         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
8         (Gdb_index::pubtypes_read): New parameter.
9         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
10         to calls.
11         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
12         pubtypes_object_.
13
14 2012-09-09  Alan Modra  <amodra@gmail.com>
15
16         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
17         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
18         * gc.h (gc_process_relocs): Call target gc_add_reference.
19         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
20         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
21         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
22         unnecessary cast.
23         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
24         to cater for when we don't need code offset.  Update use.
25         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
26         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
27         set_opd_valid): New functions.
28         (Target_powerpc::do_gc_add_reference): New function.
29         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
30         stashed refs.
31         (Target_powerpc::do_gc_mark_symbol): New function.
32
33 2012-09-06  Cary Coutant  <ccoutant@google.com>
34
35         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
36         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
37         (Dwarf_die::skip_attributes): Likewise.
38         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
39         * testsuite/gdb_index_test.cc (inline_func_1): New function.
40         (main): Call it.
41         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
42
43 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
44
45         * testsuite/script_test_3.t: Add .got.plt output section
46         statement.
47         * testsuite/script_test_4.t: Likewise.
48
49 2012-09-05  Alan Modra  <amodra@gmail.com>
50
51         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
52         update all uses and lose "enum" when using type.
53
54 2012-09-05  Alan Modra  <amodra@gmail.com>
55
56         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
57         * configure: Regenerate.
58         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
59         (plugin_final_layout.stdout): Likewise.
60         (memory_test): Set page sizes to 0x1000.
61         * testsuite/Makefile.in: Regenerate.
62         * testsuite/discard_locals_test.sh: Add FIXME comment.
63         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
64         * testsuite/pr14265.t: Add .got output section statement.
65         * testsuite/script_test_2.t: Likewise.
66         * testsuite/script_test_3.t: Likewise.
67         * testsuite/script_test_4.t: Likewise.
68         * testsuite/script_test_5.t: Likewise.
69         * testsuite/script_test_6.t: Likewise.
70         * testsuite/script_test_7.t: Likewise.
71         * testsuite/script_test_9.t: Likewise.
72
73 2012-09-05  Alan Modra  <amodra@gmail.com>
74
75         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
76         (Powerpc_relocate_functions::Status): New typedef.
77         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
78         (Target_powerpc::Scan::local): Handle REL64.
79         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
80         for REL32 and REL64.
81         (Target_powerpc::symval_for_branch): New function, extracted from..
82         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
83         checks.  Report overflow errors.
84
85 2012-09-05  Alan Modra  <amodra@gmail.com>
86
87         * object.h (Sized_relobj_file::emit_relocs): Delete.
88         (Sized_relobj_file::emit_relocs_reltype): Delete.
89         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
90         relocate_relocs for --emit-relocs.
91         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
92         * output.h: Update comment.
93         (Output_segment::first_section): New function.
94         (Output_segment::first_section_load_address): Use first_section.
95         * output.cc (Output_segment::first_section): New function extracted..
96         (Output_segment::first_section_load_address): ..from here.  Delete.
97         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
98         * target.h (Sized_target::relocate_for_relocatable): Likewise.
99         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
100         adjust call to target.h function.
101         * i386.cc (Target_i386): Likewise.
102         * sparc.cc (Target_sparc): Likewise.
103         * x86_64.cc (Target_x86_64): Likewise.
104         * powerpc.cc (Target_powerpc): Likewise.
105         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
106         first tls section has section symbol for optimised local dynamic
107         output relocs.
108         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
109         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
110         optimised tls code.
111         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
112         Rename to relocate_relocs.  Update error message.
113
114 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
115
116         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
117         --just-symbols.
118
119 2012-08-31  Alan Modra  <amodra@gmail.com>
120
121         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
122         (Powerpc_relobj::toc_base_offset): New stub function.
123         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
124         got_mod_index_offset to tlsld_got_offset.  Update all refs.
125         (Target_powerpc::Relocate::enum skip_tls): New.
126         (Target_powerpc::call_tls_get_addr_): New var.
127         (Target_powerpc::is_branch_reloc): Move to file scope.
128         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
129         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
130         New functions.
131         (Target_powerpc::enum Got_type): Delete old values, add new ones.
132         (powerpc_info): Correct common_pagesize for ppc64.
133         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
134         (Powerpc_relocate_functions): Add overflow check enums and functions.
135         Add non-shift version of rela, rela_ua.  Delete all rel public
136         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
137         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
138         addr16_ha3, addr14 functions.
139         (Output_data_got_powerpc::add_constant_pair): New function.
140         (Output_data_got_powerpc::got_base_offset): Likewise.
141         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
142         (instruction constants): Sort, add some more.
143         (Output_data_glink::do_write): Add and use Address typedef.  Use
144         object->toc_base_offset() stub for 64-bit.
145         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
146         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
147         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
148         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
149         Always treat .opd relocs as against locally defined symbol.
150         Correct condition for RELATIVE relocs.
151         (Target_powerpc::do_finalize_sections): Test for NULL sections.
152         (Target_powerpc::Relocate::relocate): Use plt call stub as value
153         for 32-bit syms with a plt entry.  Correct ppc64 toc base
154         calculations.  Handle TLS relocs, and more.  Add overflow
155         checking and adjust for Powerpc_relocate_functions changes.
156         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
157         Reinstate --emit-relocs code with FIXME.
158
159 2012-08-30  Alan Modra  <amodra@gmail.com>
160
161         * layout.cc (Layout::set_segment_offsets): Set p_align to
162         abi_pagesize, not common_pagesize.
163         (Layout::relaxation_loop_body): Similarly use abi_pagesize
164         to determine whether file header can go in segment.
165
166 2012-08-30  Alan Modra  <amodra@gmail.com>
167
168         * output.h (Output_reloc::Output_reloc <output section>): Add
169         is_relative param.  Adjust calls.
170         (Output_reloc::add_output_section_relative): New functions.
171         * output.cc (Output_reloc::Output_reloc <output section>): Handle
172         is_relative.
173         (Output_reloc::symbol_value): Handle SECTION_CODE.
174
175 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
176
177         * gold.cc (queue_middle_tasks): Call layout again when unique
178         segments for sections is desired.
179         * layout.cc (Layout::Layout): Initialize new members.
180         (Layout::get_output_section_flags): New function.
181         (Layout::choose_output_section): Call get_output_section_flags.
182         (Layout::layout): Make output section for mapping to a unique segment.
183         (Layout::insert_section_segment_map): New function.
184         (Layout::attach_allocated_section_to_segment): Make unique segment for
185         output sections marked so.
186         (Layout::segment_precedes): Check for unique segments when sorting.
187         * layout.h (Layout::Unique_segment_info): New struct.
188         (Layout::Section_segment_map): New typedef.
189         (Layout::insert_section_segment_map): New function.
190         (Layout::get_output_section_flags): New function.
191         (Layout::is_unique_segment_for_sections_specified): New function.
192         (Layout::set_unique_segment_for_sections_specified): New function.
193         (Layout::unique_segment_for_sections_specified_): New member.
194         (Layout::section_segment_map_): New member.
195         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
196         Rename is_gc_pass_one to is_pass_one.
197         Rename is_gc_pass_two to is_pass_two.
198         Rename is_gc_or_icf to is_two_pass.
199         Check for which pass based on whether symbols data is present.
200         Make it two pass when unique segments for sections is desired.
201         * output.cc (Output_section::Output_section): Initialize new
202         members.
203         * output.h (Output_section::is_unique_segment): New function.
204         (Output_section::set_is_unique_segment): New function.
205         (Output_section::is_unique_segment_): New member.
206         (Output_section::extra_segment_flags): New function.
207         (Output_section::set_extra_segment_flags): New function.
208         (Output_section::extra_segment_flags_): New member.
209         (Output_section::segment_alignment): New function.
210         (Output_section::set_segment_alignment): New function.
211         (Output_section::segment_alignment_): New member.
212         (Output_segment::Output_segment): Initialize is_unique_segment_.
213         (Output_segment::is_unique_segment): New function.
214         (Output_segment::set_is_unique_segment): New function.
215         (Output_segment::is_unique_segment_): New member.
216         * plugin.cc (allow_unique_segment_for_sections): New function.
217         (unique_segment_for_sections): New function.
218         (Plugin::load): Add new functions to transfer vector.
219         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
220         * Makefile.in: Regenerate.
221         * testsuite/plugin_final_layout.sh: Check if unique segment
222         functionality works.
223         * testsuite/plugin_section_order.c (onload): Check if new interfaces
224         are available.
225         (allow_unique_segment_for_sections): New global.
226         (unique_segment_for_sections): New global.
227         (claim_file_hook): Call allow_unique_segment_for_sections.
228         (all_symbols_read_hook): Call unique_segment_for_sections.
229
230 2012-08-22  Cary Coutant  <ccoutant@google.com>
231
232         * layout.cc (Layout::include_section): Don't assert on GROUP
233         sections with --emit-relocs.
234
235 2012-08-21  Cary Coutant  <ccoutant@google.com>
236
237         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
238         if --export-dynamic-symbol names an undef symbol.
239
240 2012-08-18  Alan Modra  <amodra@gmail.com>
241
242         * powerpc.cc: Formatting and white space.
243         (Powerpc_relobj): Rename got2_section_ to special_.
244         Add opd_ent_shndx_ and opd_ent_off_ vectors.
245         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
246         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
247         (Target_powerpc): Add Address typedef and invalid_address.  Use
248         throughout.
249         (Target_powerpc::is_branch_reloc): New function.
250         (Powerpc_relocate_functions): Add Address typedef, use throughout.
251         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
252         for dst_mask, value and addend.
253         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
254         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
255         (Output_data_glink::do_write): Correct toc base.  Don't try to use
256         uint16_t for 24-bit offset.  Use get_output_section_offset and
257         check return.
258         (Target_powerpc::Scan::local): Handle more relocs.
259         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
260         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
261         Plug in toc restoring insn after plt calls.  Translate branches
262         to function descriptor symbols to corresponding entry point.
263         (Target_powerpc::relocate_for_relocatable): Check return from
264         get_output_section_offset.
265         * symtab.h: Comment typo.
266
267 2012-08-14  Ian Lance Taylor  <iant@google.com>
268
269         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
270         unsupported_relocal_local to call unsupported_reloc_global.
271
272 2012-08-14  Nick Clifton  <nickc@redhat.com>
273
274         PR ld/14265
275         * script-sections.cc (Sections_element::output_section_name): Add
276         keep return parameter.
277         (Output_section_element::match_name): Add keep return parameter.
278         Return the value of the keep_ member.
279         * script-sections.h (class Output_section): Update
280         output_section_name prototype.
281         * layout.cc (Layout::keep_input_section): New public member
282         function.
283         (Layout::choose_output_section): Pass keep parameter to
284         output_section_name.
285         * layout.h (class Layout): Add keep_input_section.
286         * object.cc (Sized_relobj_file::do_layout): Check for kept input
287         sections.
288         * testsuite/Makefile.am: Add a test.
289         * testsuite/Makefile.in: Regenerate.
290         * testsuite/pr14265.c: Source file for the test.
291         * testsuite/pr14265.t: Linker script for the test.
292         * testsuite/pr14265.sh: Shell script for the test.
293
294 2012-08-14  Alan Modra  <amodra@gmail.com>
295
296         * target.h (Target::output_section_name): New function.
297         (Target::do_output_section_name): New function.
298         * layout.cc (Layout::choose_output_section): Call the above.
299         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
300
301 2012-08-14  Alan Modra  <amodra@gmail.com>
302
303         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
304         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
305         for replace_constant call.
306         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
307         (Output_data_glink::do_print_to_mapfile): New function.
308         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
309         (Target_powerpc::Relocate::relocate): Likewise.
310
311 2012-08-14  Alan Modra  <amodra@gmail.com>
312
313         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
314         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
315         (Output_data_glink::add_entry,find_entry): Remove shndx param.
316         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
317         all references to shndx_.  Handle special case for R_PPC_PLTREL24
318         here.
319         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
320         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
321         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
322         here.
323         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
324         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
325
326 2012-08-12  Alan Modra  <amodra@gmail.com>
327
328         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
329         (glink insn constants): Use uint32_t.
330         (Output_data_glink::add_entry): Use insert, not [] operator.
331
332 2012-08-11  Alan Modra  <amodra@gmail.com>
333
334         * object.h (Sized_relobj_file::find_shdr): New function.
335         (Sized_relobj_file::find_special_sections): New function.
336         * object.cc (Sized_relobj_file::find_shdr): New function.
337         (Sized_relobj_file::find_eh_frame): Use find_shdr.
338         (Sized_relobj_file::find_special_sections): New function, split out..
339         (Sized_relobj_file::do_read_symbols): ..from here.
340         * output.h (Output_data_got::replace_constant): New function.
341         (Output_data_got::num_entries): New function.
342         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
343         (Output_data_got::got_offset): Protected rather than private.
344         (Output_data_got::replace_got_entry): New function.
345         * output.cc (Output_data_got::replace_got_entry): New function.
346         * powerpc.cc (class Powerpc_relobj): New.
347         (class Powerpc_relocate_functions): Delete all psymval variants or
348         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
349         Implement _ha functions using corresponding _hi function.
350         (Powerpc_relobj::find_special_sections): New function.
351         (Target_powerpc::do_make_elf_object): New function.
352         (class Output_data_got_powerpc): New.
353         (class Output_data_glink): New.
354         (class Powerpc_scan_relocatable_reloc): New.
355         Many more changes througout file.
356
357 2012-08-09  Nick Clifton  <nickc@redhat.com>
358
359         * po/vi.po: Updated Vietnamese translation.
360
361 2012-08-07  Ian Lance Taylor  <iant@google.com>
362
363         * layout.cc (Layout::add_target_dynamic_tags): If
364         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
365         plt_rel.
366
367 2012-07-30  Nick Clifton  <nickc@redhat.com>
368
369         * po/gold.pot: Updated template.
370         * po/es.po: Updated Spanish translation.
371
372 2012-07-18  Cary Coutant  <ccoutant@google.com>
373
374         PR gold/14344
375         * configure.ac: Add check for -gpubnames support.
376         * configure: Regenerate.
377         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
378         support; force -gno-pubnames.
379         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
380         support.
381         (gdb_index_test_4): New test.
382         * testsuite/Makefile.in: Regenerate.
383         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
384         * testsuite/gdb_index_test_2.sh: Likewise.
385         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
386         * testsuite/gdb_index_test_4.sh: New script.
387         * testsuite/gdb_index_test_comm.sh: New script with common code;
388         don't look for space after colon.
389
390 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
391
392         * gold.cc (queue_middle_tasks): Update function order only after
393         deferred objects due to plugins are processed.
394
395 2012-07-11  Ian Lance Taylor  <iant@google.com>
396
397         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
398         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
399         (Target_arm::scan_reloc_for_stub): Likewise.
400         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
401         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
402         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
403         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
404         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
405
406 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
407             Ian Lance Taylor  <iant@google.com>
408
409         PR gold/14309
410         * configure.ac: Test whether std::tr1::hash<off_t> works.
411         * gold.h: Add a specialization for std::tr1::hash<off_t> if
412         needed.
413         * output.h (class Output_fill): Add virtual destructor.
414         * configure, config.in: Rebuild.
415
416 2012-06-22  Roland McGrath  <mcgrathr@google.com>
417
418         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
419
420 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
421
422         * plugin.cc (Plugin::load): Handle position independent executables.
423
424 2012-06-06  Cary Coutant  <ccoutant@google.com>
425
426         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
427         add .debug_macro.
428         (lines_only_debug_sections): Likewise.
429         (gdb_fast_lookup_sections): New static array.
430         (is_gdb_debug_section): Rename formal parameter.
431         (is_lines_only_debug_section): Likewise.
432         (is_gdb_fast_lookup_section): New function.
433         (Layout::include_section): Check for ".zdebug_" prefix; pass
434         section name suffix to is_gdb_debug_section, et al.; check for
435         fast-lookup sections when building .gdb_index.
436         * options.h (--strip-debug-gdb): Update GDB version number.
437
438 2012-06-06  Cary Coutant  <ccoutant@google.com>
439
440         * configure.ac: Add check for fallocate.
441         * configure: Regenerate.
442         * config.in: Regenerate.
443
444         * options.h (class General_options): Add --mmap-output-file and
445         --posix-fallocate options.
446         * output.cc: (posix_fallocate): Remove; replace with...
447         (gold_fallocate): New function.
448         (Output_file::map_no_anonymous): Call gold_fallocate.
449         (Output_file::map): Check --mmap-output-file option.
450
451 2012-06-05  Jing Yu  <jingyu@google.com>
452
453         * gold.h (textdomain): Add do {} to empty while(0).
454         (bindtextdomain): Likewise.
455
456 2012-06-04  Cary Coutant  <ccoutant@google.com>
457
458         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
459         has_dynsym_index.
460
461 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
462
463         * symtab.cc (Symbol_table::define_special_symbol):
464         Initialize *poldsym to prevent uninitialized variable errors.
465
466 2012-05-23  Cary Coutant  <ccoutant@google.com>
467
468         * layout.cc (Layout::section_name_mapping): Add rules to handle
469         exact match on .data.rel.ro.local or .data.rel.ro.
470         (Layout::output_section_name): Check for exact matches.
471
472 2012-05-23  Cary Coutant  <ccoutant@google.com>
473
474         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
475         more carefully.
476
477 2012-05-22  Cary Coutant  <ccoutant@google.com>
478
479         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
480         object before exporting symbol.
481
482 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
483
484         * testsuite/tls_test.cc: Include "config.h" first.
485         * testsuite/tls_test_c.c: Likewise.
486
487 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
488             Nick Clifton  <nickc@redhat.com>
489
490         PR 14072
491         * configure.in: Add check that sysdep.h has been included before
492         any system header files.
493         * configure: Regenerate.
494         * config.in: Regenerate.
495
496 2012-05-14  Cary Coutant  <ccoutant@google.com>
497
498         * layout.cc (Layout::make_output_section): Mark .tdata section
499         as RELRO.
500         * testsuite/relro_test.cc: Add a TLS variable.
501
502 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
503
504         PR gold/14091
505         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
506         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
507         R_X86_64_64.
508
509 2012-05-08  Cary Coutant  <ccoutant@google.com>
510
511         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
512         (lines_only_debug_sections): Likewise.
513
514 2012-05-02  Roland McGrath  <mcgrathr@google.com>
515
516         * nacl.cc: New file.
517         * nacl.h: New file.
518         * Makefile.am (CCFILES, HFILES): Add them.
519         * Makefile.in: Regenerate.
520         * i386.cc (Output_data_plt_i386_nacl): New class.
521         (Output_data_plt_i386_nacl_exec): New class.
522         (Output_data_plt_i386_nacl_dyn): New class.
523         (Target_i386_nacl): New class.
524         (Target_selector_i386_nacl): New class.
525         (target_selector_i386): Use it instead of Target_selector_i386.
526         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
527         (Target_x86_64_nacl): New class.
528         (Target_selector_x86_64_nacl): New class.
529         (target_selector_x86_64, target_selector_x32): Use it instead of
530         Target_selector_x86_64.
531         * arm.cc (Output_data_plt_arm_nacl): New class.
532         (Target_arm_nacl): New class.
533         (Target_selector_arm_nacl): New class.
534         (target_selector_arm, target_selector_armbe): Use it instead of
535         Target_selector_arm.
536
537         * target-select.cc (select_target): Take new Input_file* and off_t
538         arguments, pass them on to recognize method of selector.
539         * object.cc (make_elf_sized_object): Update caller.
540         * parameters.cc (parameters_force_valid_target): Likewise.
541         * incremental.cc (make_sized_incremental_binary): Likewise.
542         * target-select.h: Update decl.
543         (Target_selector::recognize): Take new Input_file* argument,
544         pass it on to do_recognize.
545         (Target_selector::do_recognize): Take new Input_file* argument.
546         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
547         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
548         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
549         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
550
551         * target.h (Target::Target_info): New members isolate_execinstr
552         and rosegment_gap.
553         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
554         * arm.cc (Target_arm::arm_info): Update initializer.
555         * i386.cc (Target_i386::i386_info): Likewise.
556         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
557         * sparc.cc (Target_sparc::sparc_info): Likewise.
558         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
559         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
560         * layout.cc (Layout::attach_allocated_section_to_segment):
561         Take new const Target* argument.  If target->isolate_execinstr(), act
562         like --rosegment.
563         (Layout::find_first_load_seg): Take new const Target* argument;
564         if target->isolate_execinstr(), reject PF_X segments.
565         (Layout::relaxation_loop_body): Update caller.
566         (Layout::set_segment_offsets): If target->isolate_execinstr(),
567         reset file offset to zero when we hit LOAD_SEG, and then do a second
568         loop over the segments before LOAD_SEG to reassign offsets after
569         addresses have been determined.  Handle target->rosegment_gap().
570         (Layout::attach_section_to_segment): Take new const Target* argument;
571         pass it to attach_allocated_section_to_segment.
572         (Layout::make_output_section): Update caller.
573         (Layout::attach_sections_to_segments): Take new const Target* argument;
574         pass it to attach_section_to_segment.
575         * gold.cc (queue_middle_tasks): Update caller.
576         * layout.h (Layout): Update method decls with new arguments.
577
578         * arm.cc (Target_arm::Target_arm): Take optional argument for the
579         Target_info pointer to use.
580         (Target_arm::do_make_data_plt): New virtual method.
581         (Target_arm::make_data_plt): New method that calls it.
582         (Target_arm::make_plt_entry): Use it.
583         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
584         for the section alignment.
585         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
586         method.
587         (Output_data_plt_arm::first_plt_entry_offset): Call it.
588         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
589         method.
590         (Output_data_plt_arm::get_plt_entry_size): Call it.
591         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
592         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
593         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
594         method.
595         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
596         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
597         method instead of sizeof(plt_entry).
598         (Output_data_plt_arm::add_entry): Likewise.
599         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
600         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
601         than static method.
602         (Target_arm::plt_entry_size): Likewise.
603         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
604         Move to ...
605         (Output_data_plt_arm_standard): ... here, new class.
606         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
607         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
608         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
609
610         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
611         Take additional argument for the PLT entry size.
612         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
613         Use get_plt_entry_size method rather than plt_entry_size variable.
614         (Output_data_plt_x86_64::reserve_slot): Likewise.
615         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
616         (Output_data_plt_x86_64::add_entry): Likewise.
617         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
618         (Output_data_plt_x86_64::address_for_global): Likewise.
619         (Output_data_plt_x86_64::address_for_local): Likewise.
620         (Output_data_plt_x86_64::set_final_data_size): Likewise.
621         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
622         Make method non-static.
623         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
624         method.
625         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
626         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
627         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
628         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
629         virtual method.
630         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
631         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
632         virtual method.
633         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
634         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
635         virtual method.
636         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
637         (Output_data_plt_x86_64::plt_entry_size)
638         (Output_data_plt_x86_64::first_plt_entry)
639         (Output_data_plt_x86_64::plt_entry)
640         (Output_data_plt_x86_64::tlsdesc_plt_entry)
641         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
642         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
643         (Output_data_plt_x86_64_standard): ... here, new class.
644         (Target_x86_64::Target_x86_64): Take optional argument for the
645         Target_info pointer to use.
646         (Target_x86_64::do_make_data_plt): New virtual method.
647         (Target_x86_64::make_data_plt): New method to call it.
648         (Target_x86_64::init_got_plt_for_update): Use that.
649         Call this->plt_->add_eh_frame method here.
650         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
651         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
652         rather than static method.
653         (Target_x86_64::plt_entry_size): Likewise.
654         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
655         rather than plt_entry_size variable.  Move guts of PLT filling to...
656         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
657         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
658         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
659
660         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
661         additional argument for the section alignment.
662         Don't do add_eh_frame_for_plt here.
663         (Output_data_plt_i386::first_plt_entry_offset): Make the method
664         non-static.  Use get_plt_entry_size method rather than plt_entry_size
665         variable.
666         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
667         method.
668         (Output_data_plt_i386::get_plt_entry_size): Call it.
669         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
670         (Output_data_plt_i386::add_eh_frame): New method to call it.
671         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
672         method.
673         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
674         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
675         method.
676         (Output_data_plt_i386::fill_plt_entry): New method to call it.
677         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
678         method instead of plt_entry_size.
679         (Output_data_plt_i386::plt_entry_size)
680         (Output_data_plt_i386::plt_eh_frame_fde_size)
681         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
682         (Output_data_plt_i386_standard): ... here, new class.
683         (Output_data_plt_i386_exec): New class.
684         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
685         (Output_data_plt_i386_exec::first_plt_entry): ... here.
686         (Output_data_plt_i386::exec_plt_entry): Move to ...
687         (Output_data_plt_i386_exec::plt_entry): ... here.
688         (Output_data_plt_i386_dyn): New class.
689         (Output_data_plt_i386::first_plt_entry): Move to ...
690         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
691         (Output_data_plt_i386::dyn_plt_entry): Move to ...
692         (Output_data_plt_i386_dyn::plt_entry): ... here.
693         (Target_i386::Target_i386): Take optional argument for the Target_info
694         pointer to use.
695         (Target_i386::do_make_data_plt): New virtual method.
696         (Target_i386::make_data_plt): New method to call it.
697         (Target_i386::make_plt_section): Use that.
698         Call this->plt_->add_eh_frame method here.
699         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
700         rather than plt_entry_size variable.
701         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
702         (Output_data_plt_i386::address_for_local): Likewise.
703         (Output_data_plt_i386::do_write): Likewise.
704         Move guts of PLT filling to...
705         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
706         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
707         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
708         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
709
710 2012-05-01  Cary Coutant  <ccoutant@google.com>
711
712         * dwarf_reader.cc (Dwarf_die::read_attributes)
713         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
714         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
715         * reduced_debug_output.cc
716         (Output_reduced_debug_info_section::get_die_end): Remove
717         DW_FORM_GNU_ref_index.  Add default case.
718
719 2012-04-26  Mark Wielaard  <mjw@redhat.com>
720
721         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
722         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
723         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
724         DW_AT_high_pc as offset from DW_AT_low_pc.
725
726         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
727         * testsuite/Makefile.in: Regenerate.
728         * testsuite/gdb_index_test_3.c: New test source file.
729         * testsuite/gdb_index_test_3.sh: New test source file.
730
731 2012-04-25  Ian Lance Taylor  <iant@google.com>
732
733         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
734         pointer.
735         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
736         as a class, not a struct.
737         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
738         (Target_arm::apply_cortex_a8_workaround): Likewise.
739         * gc.h: Declare Reloc_types as a struct, not a class.
740         * object.h: Declare Symbols_data as a struct.
741         * reloc.h: Declare Read_relocs_data as a struct.
742         * target.h: Declare Relocate_info as a struct.
743
744 2012-04-24  David S. Miller  <davem@davemloft.net>
745
746         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
747         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
748         and R_SPARC_WPLT30.
749
750 2012-04-24  Cary Coutant  <ccoutant@google.com>
751
752         * incremental-dump.cc (find_input_containing_global): Replace
753         magic number with symbolic constant.
754         (dump_incremental_inputs): Update version number.
755         * incremental.cc (Output_section_incremental_inputs): Update version
756         number; import symbolic constants from Incremental_inputs_reader.
757         (Incremental_inputs::create_data_sections): Align relocations
758         section correctly for 64-bit targets.
759         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
760         constants; add padding.
761         (Output_section_incremental_inputs::write_header): Add assert for
762         header_size.
763         (Output_section_incremental_inputs::write_input_files): Add assert
764         for input_entry_size.
765         (Output_section_incremental_inputs::write_info_blocks): Add padding;
766         add assert for object_info_size, input_section_entry_size,
767         global_sym_entry_size.
768         * incremental.h (Incremental_inputs_reader): Add symbolic constants
769         for data structure sizes; use them.
770         (Incremental_input_entry_reader): Import symbolic constants from
771         Incremental_inputs_reader; use them.
772
773 2012-04-23  David S. Miller  <davem@davemloft.net>
774
775         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
776         and elf_flags_set_.
777         (Target_sparc::Target_sparc): Initialize new fields.
778         (Target_sparc::do_make_elf_object): New function.
779         (Target_sparc::do_adjust_elf_header): New function.
780
781 2012-04-23  Cary Coutant  <ccoutant@google.com>
782
783         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
784         CU range table of gdb index.
785
786 2012-04-20  David S. Miller  <davem@davemloft.net>
787
788         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
789         instead of false.
790
791 2012-04-16  David S. Miller  <davem@davemloft.net>
792
793         * sparc.cc (Target_sparc::got_address): New function.
794         (Sparc_relocate_functions::gdop_hix22): New function.
795         (Sparc_relocate_functions::gdop_lox10): New function.
796         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
797         relocs.
798         (Target_sparc::Scan::local): Likewise if the global symbol is not
799         preemptible and is not IFUNC.
800         (Target_sparc::Relocate::relocate): Perform GOTDATA code
801         transformations for local and non-preemptible non-IFUNC global
802         symbols.
803
804         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
805         writing out 64-bit part of ranges.
806
807         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
808         -fpic and -fpie respectively.
809         * Makefile.in: Regenerate.
810
811         * sparc.cc (class Target_sparc): Add rela_ifunc_.
812         (Target_sparc::Target_sparc): Initialize new field.
813         (Target_sparc::do_plt_section_for_global): New function.
814         (Target_sparc::do_plt_section_for_local): New function.
815         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
816         (Target_sparc::make_plt_section): New function, broken out of
817         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
818         (Target_sparc::make_plt_entry): Call make_plt_section.
819         (Target_sparc::make_local_ifunc_plt_entry): New function.
820         (Target_sparc::rela_ifunc_section): New function.
821         (Target_sparc::plt_section): Remove const.
822         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
823         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
824         and ifunc_count_ fields.
825         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
826         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
827         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
828         (Output_data_plt_sparc::rela_ifunc): New function.
829         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
830         (Output_data_plt_sparc::has_ifunc_section): New function.
831         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
832         (Output_data_plt_sparc::address_for_global): New function.
833         (Output_data_plt_sparc::address_for_local): New function.
834         (Output_data_plt_sparc::plt_index_to_offset): New function.
835         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
836         and entry_count.
837         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
838         entry_count.
839         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
840         R_SPARC_JMP_IREL to switch.
841         (Target_sparc::Scan::check_non_pic): Likewise.
842         (Target_sparc::Scan::local): Handle IFUNC symbols.
843         (Target_sparc::Scan::local): Likewise.
844         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
845         and plt_address_for_local.
846         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
847         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
848
849         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
850         (class Output_data_reloc): Adjust calls to Output_reloc_type.
851         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
852         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
853         global relocs too.
854         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
855         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
856         calls.
857         * sparc.cc (Target_sparc::Scan::global): Likewise.
858         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
859
860 2012-04-16  Cary Coutant  <ccoutant@google.com>
861
862         * archive.cc (Library_base::should_include_member): Check for
863         --export-dynamic-symbol.
864         * options.h (class General_options): Add --export-dynamic-symbol.
865         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
866         --export-dynamic-symbol.
867         (Symbol_table::gc_mark_undef_symbols): Likewise.
868         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
869
870 2012-04-12  David S. Miller  <davem@davemloft.net>
871
872         * sparc.cc (Reloc::wdisp10): New relocation method.
873         (Reloc::h34): Likewise.
874         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
875         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
876         R_SPARC_WDISP10.
877         (Target_sparc::Scan::local): Likewise.
878         (Target_sparc::Scan::global): Likewise.
879         (Target_sparc::Relocate::relocate): Likewise.
880
881 2012-04-09  Cary Coutant  <ccoutant@google.com>
882
883         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
884         low_pc == 0.
885
886 2012-04-06  Ian Lance Taylor  <iant@google.com>
887
888         * timer.cc: #include <unistd.h>.
889
890 2012-04-06  Roland McGrath  <mcgrathr@google.com>
891
892         * configure.in (AC_CHECK_HEADERS): Add locale.h.
893         * config.in: Regenerate.
894         * configure: Regenerate.
895
896 2012-04-05  Nick Clifton  <nickc@redhat.com>
897
898         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
899         (AM_LC_MESSAGES): Add.
900         * aclocal.m4: Regenerate.
901         * config.in: Regenerate.
902         * configure: Regenerate.
903
904 2012-03-21  Cary Coutant  <ccoutant@google.com>
905
906         * Makefile.am: Add gdb-index.cc, gdb-index.h.
907         * Makefile.in: Regenerate.
908         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
909         (Sized_elf_reloc_mapper::symbol_section): New function.
910         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
911         (make_elf_reloc_mapper): New function.
912         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
913         (Dwarf_abbrev_table::do_read_abbrevs): New function.
914         (Dwarf_abbrev_table::do_get_abbrev): New function.
915         (Dwarf_ranges_table::read_ranges_table): New function.
916         (Dwarf_ranges_table::read_range_list): New function.
917         (Dwarf_pubnames_table::read_section): New function.
918         (Dwarf_pubnames_table::read_header): New function.
919         (Dwarf_pubnames_table::next_name): New function.
920         (Dwarf_die::Dwarf_die): New function.
921         (Dwarf_die::read_attributes): New function.
922         (Dwarf_die::skip_attributes): New function.
923         (Dwarf_die::set_name): New function.
924         (Dwarf_die::set_linkage_name): New function.
925         (Dwarf_die::attribute): New function.
926         (Dwarf_die::string_attribute): New function.
927         (Dwarf_die::int_attribute): New function.
928         (Dwarf_die::uint_attribute): New function.
929         (Dwarf_die::ref_attribute): New function.
930         (Dwarf_die::child_offset): New function.
931         (Dwarf_die::sibling_offset): New function.
932         (Dwarf_info_reader::check_buffer): New function.
933         (Dwarf_info_reader::parse): New function.
934         (Dwarf_info_reader::do_parse): New function.
935         (Dwarf_info_reader::do_read_string_table): New function.
936         (Dwarf_info_reader::lookup_reloc): New function.
937         (Dwarf_info_reader::get_string): New function.
938         (Dwarf_info_reader::visit_compilation_unit): New function.
939         (Dwarf_info_reader::visit_type_unit): New function.
940         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
941         Sized_elf_reloc_mapper.
942         (Sized_dwarf_line_info::symbol_section): Remove function.
943         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
944         (Sized_dwarf_line_info::read_line_mappings): Remove object
945         parameter, adjust callers.
946         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
947         * dwarf_reader.h: Include <sys/types.h>.
948         (class Track_relocs): Remove forward declaration.
949         (class Elf_reloc_mapper): New class.
950         (class Sized_elf_reloc_mapper): New class.
951         (class Dwarf_abbrev_table): New class.
952         (class Dwarf_range_list): New class.
953         (class Dwarf_ranges_table): New class.
954         (class Dwarf_pubnames_table): New class.
955         (class Dwarf_die): New class.
956         (class Dwarf_info_reader): New class.
957         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
958         (Sized_dwarf_line_info::symbol_section): Remove member function.
959         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
960         base class.
961         * gdb-index.cc: New source file.
962         * gdb-index.h: New source file.
963         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
964         and .debug_types sections, call Layout::add_to_gdb_index.
965         (Sized_relobj_incr::do_section_name): Implement.
966         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
967         return type; Implement.
968         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
969         return type.
970         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
971         parameter list and return type.
972         (Sized_incr_dynobj::do_section_contents): Likewise.
973         * layout.cc: Include gdb-index.h.
974         (Layout::Layout): Initialize gdb_index_data_.
975         (Layout::init_fixed_output_section): Check for .gdb_index section.
976         (Layout::add_to_gdb_index): New function. Instantiate.
977         * layout.h: Add forward declaration for class Gdb_index.
978         (Layout::add_to_gdb_index): New member function.
979         (Layout::gdb_index_data_): New data member.
980         * main.cc: Include gdb-index.h.
981         (main): Print statistics for gdb index.
982         * object.cc (Object::section_contents): Move code into
983         do_section_contents.
984         (need_decompressed_section): Check for sections needed when building
985         gdb index.
986         (build_compressed_section_map): Likewise.
987         (Sized_relobj_file::do_read_symbols): Need local symbols when building
988         gdb index.
989         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
990         sections; call Layout::add_to_gdb_index.
991         (Sized_relobj_file::do_decompressed_section_contents): Call
992         do_section_contents directly.
993         * object.h (Object::do_section_contents): Adjust parameter list and
994         return type.
995         (Object::do_decompressed_section_contents): Call do_section_contents
996         directly.
997         (Sized_relobj_file::do_section_contents): Adjust parameter list and
998         return type.
999         * options.h (class General_options): Add --gdb-index option.
1000         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1001         list and return type.
1002         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1003         * reloc.h (Track_relocs::checkpoint): New function.
1004         (Track_relocs::reset): New function.
1005
1006         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1007         New test cases.
1008         * testsuite/Makefile.in: Regenerate.
1009         * testsuite/gdb_index_test.cc: New test source file.
1010         * testsuite/gdb_index_test_1.sh: New test source file.
1011         * testsuite/gdb_index_test_2.sh: New test source file.
1012
1013 2012-03-19  Doug Kwan  <dougkwan@google.com>
1014
1015         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1016         (Target_arm::do_finalize_sections): Remove code which defines
1017         __exidx_start and __exidx_end.  Make symbol table parameter
1018         anonymous as it is not used.
1019         * gold.cc (queue_middle_tasks): Call target hook to define any
1020         target-specific symbols.
1021         * target.h (Target::define_standard_symbols): New method.
1022         (Target::do_define_standard_symbols): Same.
1023         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1024         * testsuite/Makefile.in: Regenerate.
1025         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1026         and __exidx_end.
1027         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1028         relocations are generated for __exidx_start and __exidx_end.
1029
1030 2012-03-16  Doug Kwan  <dougkwan@google.com>
1031
1032         * testsuite/Makefile.am: Disable test initpri3b.
1033         * testsuite/Makefile.in: Regenerate.
1034
1035 2012-03-15  Doug Kwan  <dougkwan@google.com>
1036
1037         * arm.cc (Target_arm::got_section): Make .got section read-only
1038         if -z now is given.
1039
1040 2012-03-15  Ian Lance Taylor  <iant@google.com>
1041
1042         PR gold/13850
1043         * layout.cc (Layout::make_output_section): Correctly mark
1044         SHT_INIT_ARRAY, et. al., as relro.
1045
1046 2012-03-14  Doug Kwan  <dougkwan@google.com>
1047
1048         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1049         dynamic relocations for protected symbols in shared objects.
1050
1051 2012-03-13  Ian Lance Taylor  <iant@google.com>
1052
1053         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1054         keep the larger alignment.
1055
1056 2012-03-12  Cary Coutant  <ccoutant@google.com>
1057
1058         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1059         handling of DW_LNE_define_file.
1060
1061 2012-03-12  Cary Coutant  <ccoutant@google.com>
1062
1063         * reduced_debug_output.cc
1064         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1065         codes to switch.
1066
1067 2012-02-29  Cary Coutant  <ccoutant@google.com>
1068
1069         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1070
1071 2012-02-29  Cary Coutant  <ccoutant@google.com>
1072
1073         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1074         Call Object::decompressed_section_contents.
1075         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1076         New dtor.
1077         (Sized_dwarf_line_info::buffer_start_): New data member.
1078         * merge.cc (Output_merge_data::do_add_input_section): Call
1079         Object::decompressed_section_contents.
1080         (Output_merge_string::do_add_input_section): Likewise.
1081         * object.cc (need_decompressed_section): New function.
1082         (build_compressed_section_map): Decompress sections needed later.
1083         (Sized_relobj_file::do_decompressed_section_contents): New function.
1084         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1085         * object.h (Object::decompressed_section_contents): New function.
1086         (Object::discard_decompressed_sections): New function.
1087         (Object::do_decompressed_section_contents): New function.
1088         (Object::do_discard_decompressed_sections): New function.
1089         (Compressed_section_info): New type.
1090         (Compressed_section_map): Include decompressed section contents.
1091         (Sized_relobj_file::do_decompressed_section_contents): New function.
1092         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1093
1094 2012-02-16  Cary Coutant  <ccoutant@google.com>
1095
1096         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1097         * testsuite/Makefile.in: Regenerate.
1098
1099 2012-02-14  Cary Coutant  <ccoutant@google.com>
1100
1101         * options.cc (General_options::finalize): Disallow -pie and -static.
1102
1103 2012-02-03  Doug Kwan  <dougkwan@google.com>
1104
1105         * arm.cc (Arm_relocate_functions::abs8,
1106         Arm_relocate_functions::abs16): Use
1107         Bits::has_signed_unsigned_overflow32.
1108         (Arm_relocate_functions::thm_abs8): Correct range of
1109         overflow check.
1110         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1111         in assertions.
1112
1113 2012-02-02  Doug Kwan  <dougkwan@google.com>
1114
1115         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1116         position independent outputs, not just shared objects.
1117
1118 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1119
1120         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1121         * configure: Regenerated.
1122
1123 2012-01-27  Ian Lance Taylor  <iant@google.com>
1124
1125         * reloc.h (Bits): New class with static functions, copied from
1126         namespace utils in arm.cc.
1127         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1128         instead.
1129
1130 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1131
1132         * incremental.cc (write_info_blocks): Correct relocation offset.
1133
1134 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1135
1136         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1137         (Relocate::tls_gd_to_le): Likewise.
1138
1139 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1140
1141         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1142
1143 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1144
1145         * configure.ac: Check if -mcmodel=medium works.
1146         * configure: Regenerated.
1147
1148 2012-01-24  Cary Coutant  <ccoutant@google.com>
1149
1150         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1151         definition and ...
1152         (read_unsigned_LEB_128_x): ... this new function.
1153         (read_signed_LEB_128): Replaced with inline definition and ...
1154         (read_signed_LEB_128_x): ... this new function.
1155         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1156         (read_unsigned_LEB_128): Add inline definition.
1157         (read_signed_LEB_128_x): New function.
1158         (read_signed_LEB_128): Add inline definition.
1159         * testsuite/Makefile.am (leb128_unittest): New unit test.
1160         * testsuite/Makefile.in: Regenerate.
1161         * testsuite/leb128_unittest.cc: New unit test.
1162
1163 2012-01-23  Ian Lance Taylor  <iant@google.com>
1164
1165         PR gold/13617
1166         * i386.cc (Target_i386::do_code_fill): When using a jmp
1167         instruction, pad with nop instructions.
1168         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1169
1170 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1171
1172         * x86_64.cc (gc_process_relocs): Add typename on types used in
1173         template.
1174         (scan_relocs): Likewise.
1175         (relocate_section): Likewise.
1176         (apply_relocation): Likewise.
1177
1178 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1179
1180         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1181         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1182         under x32.
1183
1184 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1185
1186         * x86_64.cc: Initial support for x32.
1187
1188 2012-01-03  Cary Coutant  <ccoutant@google.com>
1189
1190         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1191         Use abstract base class for GOT.
1192         * gold/output.h (class Output_data_got_base): New abstract base class.
1193         (class Output_data_got): Derive from new base class, adjust ctors.
1194         (Output_data_got::reserve_slot): Make virtual; rename to
1195         do_reserve_slot; Adjust callers.
1196         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1197         pointer to abstract base class.
1198         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1199
1200 2011-12-18  Ian Lance Taylor  <iant@google.com>
1201
1202         * object.h (Relobj::local_symbol_value): New function.
1203         (Relobj::local_plt_offset): New function.
1204         (Relobj::local_has_got_offset): New function.
1205         (Relobj::local_got_offset): New function.
1206         (Relobj::set_local_got_offset): New function.
1207         (Relobj::do_local_symbol_value): New pure virtual function.
1208         (Relobj::do_local_plt_offset): Likewise.
1209         (Relobj::do_local_has_got_offset): Likewise.
1210         (Relobj::do_local_got_offset): Likewise.
1211         (Relobj::do_set_local_got_offset): Likewise.
1212         (Sized_relobj::do_local_has_got_offset): Rename from
1213         local_has_got_offset.
1214         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1215         (Sized_relobj::do_set_local_got_offset): Rename from
1216         set_local_got_offset.
1217         (Sized_relobj_file::do_local_plt_offset): Rename from
1218         local_plt_offset.
1219         (Sized_relobj_file::do_local_symbol_value): New function.
1220         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1221         local_plt_offset.
1222         * output.cc (Output_data_got::Got_entry::write): Change object to
1223         Relobj.  Use local_symbol_value.
1224         (Output_data_got::add_global_with_rel): Change rel_dyn to
1225         Output_data_reloc_generic*.  Use add_global_generic.
1226         (Output_data_got::add_global_with_rela): Remove.  Change all
1227         callers to use add_global_with_rel.
1228         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1229         Output_data_reloc_generic*.  Use add_global_generic.
1230         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1231         callers to use add_global_pair_with_rel.
1232         (Output_data_got::add_local): Change object to Relobj*.
1233         (Output_data_got::add_local_plt): Likewise.
1234         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1235         change rel_dyn to Output_data_reloc_generic*.  Use
1236         add_local_generic.
1237         (Output_data_got::add_local_with_rela): Remove.  Change all
1238         callers to use all_local_with_rel.
1239         (Output_data_got::add_local_pair_with_rel): Change object to
1240         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1241         add_output_section_generic.
1242         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1243         callers to use add_local_pair_with_rel.
1244         (Output_data_got::reserve_local): Change object to Relobj*.
1245         * output.h: (class Output_data_reloc_generic): Add pure virtual
1246         declarations for add_global_generic, add_local_generic,
1247         add_output_section_generic.
1248         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1249         functions for Output_data_reloc_generic.  Update declarations for
1250         changes listed in output.cc.
1251         (class Output_data_got): Change template parameter to got_size.
1252         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1253         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1254         function.
1255         (Sized_relobj_incr::do_local_plt_offset): New function.
1256         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1257         add_global_generic.
1258
1259 2011-12-17  Cary Coutant  <ccoutant@google.com>
1260
1261         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1262         * resolve.cc (Symbol_table::resolve): Likewise.
1263         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1264         arrays.
1265         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1266
1267 2011-12-16  Ian Lance Taylor  <iant@google.com>
1268
1269         * output.h (Output_data_reloc_generic::add): Only call
1270         add_dynamic_reloc if this is a dynamic reloc section.
1271
1272 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1273
1274         PR gold/13505
1275         * target-reloc.h (apply_relocation): Replace <64, false> with
1276         <size, big_endian>.
1277
1278 2011-11-25  Nick Clifton  <nickc@redhat.com>
1279
1280         * po/it.po: New Italian translation.
1281
1282 2011-11-17  Sterling Augustine  <saugustine@google.com>
1283
1284         * script.cc (script_include_directive): Implement.
1285         (read_script_file): New local variables name and search_path. Update
1286         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1287         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1288         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1289
1290 2011-11-11  Sterling Augustine  <saugustine@google.com>
1291
1292         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1293         (file_or_sections_cmd): Likewise.
1294
1295 2011-11-11  Doug Kwan  <dougkwan@google.com>
1296
1297         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1298         if --just-symbols is given.
1299
1300 2011-11-10  Doug Kwan  <dougkwan@google.com>
1301
1302         PR gold/13362
1303         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1304         when processing data relocs.
1305         * reloc.h (Relocate_functions::rel_unaligned): New method.
1306         (Relocate_functions::pcrel_unaligned): Ditto.
1307         (Relocate_functions::rel32_unaligned): Ditto.
1308         (Relocate_functions::pcrel32_unaligned): Ditto.
1309
1310 2011-11-09  Doug Kwan  <dougkwan@google.com>
1311
1312         PR gold/13362
1313         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1314         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1315         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1316         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1317         (Relocate_functions::rel_unaligned): New.
1318         (Relocate_functions::rel32_unaligned): New.
1319         * target-reloc.h (relocate_for_relocatable): Add code to handle
1320         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1321         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1322         arm_unaligned_reloc_r): New targets.
1323         * testsuite/Makefile.in: Regenerate.
1324         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1325         linking.
1326
1327 2011-11-02  Ian Lance Taylor  <iant@google.com>
1328
1329         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1330         NATIVE_LINKER.
1331         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1332         * options.cc (General_options::finalize): Use library search path
1333         from configure script if specified.  If not native and no sysroot,
1334         only search TOOLLIBDIR.
1335         * options.h (Search_directory::Search_directory): Change name to
1336         const std::string&.
1337         (General_options::add_to_library_path_with_sysroot): Change arg to
1338         const std::string&.
1339         * configure, Makefile.in, config.in: Rebuild.
1340
1341 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1342
1343         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1344         we are working around the ARM1176 Erratum.
1345         * options.h (General_options::fix_arm1176): Add option.
1346         * testsuite/Makefile.am: Add testcases, and keep current ones
1347         working.
1348         * testsuite/Makefile.in: Regenerate.
1349         * testsuite/arm_fix_1176.s: New file.
1350         * testsuite/arm_fix_1176.sh: Likewise.
1351
1352 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1353
1354         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1355         may_use_blx_.
1356         (Target_arm::may_use_blx): Remove method.
1357         (Target_arm::set_may_use_blx): Likewise.
1358         (Target_arm::may_use_v4t_interworking): New method.
1359         (Target_arm::may_use_v5t_interworking): Likewise.
1360         (Target_arm::may_use_blx_): Remove member variable.
1361         (Arm_relocate_functions::arm_branch_common): Check for v5T
1362         interworking.
1363         (Arm_relocate_functions::thumb_branch_common): Likewise.
1364         (Reloc_stub::stub_type_for_reloc): Likewise.
1365         (Target_arm::do_finalize_sections): Correct interworking checks.
1366         * testsuite/Makefile.am: Add new tests.
1367         * testsuite/Makefile.in: Regenerate.
1368         * testsuite/arm_farcall_arm_arm.s: New test.
1369         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1370         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1371         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1372         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1373         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1374         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1375         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1376
1377 2011-10-31  Cary Coutant  <ccoutant@google.com>
1378
1379         PR gold/13023
1380         * expression.cc (Expression::eval_with_dot): Add
1381         is_section_dot_assignment parameter.
1382         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1383         absolute and assigning to dot within a section.
1384         * script-sections.cc
1385         (Output_section_element_assignment::set_section_addresses): Pass
1386         dot_section to set_if_absolute.
1387         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1388         as is_section_dot_assignment flag to eval_with_dot.
1389         (Output_section_element_dot_assignment::set_section_addresses):
1390         Likewise.
1391         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1392         parameter.  Also set value if relative to dot_section; set the
1393         symbol's output_section.
1394         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1395         parameter.  Adjust all callers.
1396         (Expression::eval_maybe_dot): Likewise.
1397         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1398         Adjust all callers.
1399         * testsuite/script_test_2.t: Test assignment of an absolute value
1400         to dot within an output section element.
1401
1402 2011-10-31  Cary Coutant  <ccoutant@google.com>
1403
1404         * options.h (class General_options): Add --[no-]gnu-unique options.
1405         * symtab.cc (Symbol_table::sized_write_globals): Convert
1406         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1407
1408 2011-10-31  Cary Coutant  <ccoutant@google.com>
1409
1410         PR gold/13359
1411         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1412         unnecessary assertion.
1413         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1414
1415 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1416
1417         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1418         gc_mark_symbol.
1419         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1420         gc_mark_symbol.
1421         Change to just keep the section associated with symbol.
1422         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1423         they are externally visible and --export-dynamic is turned on.
1424         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1425
1426 2011-10-19  Ian Lance Taylor  <iant@google.com>
1427
1428         PR gold/13163
1429         * script-sections.cc
1430         (Output_section_element_dot_assignment::needs_output_section): New
1431         function.
1432
1433 2011-10-19  Ian Lance Taylor  <iant@google.com>
1434
1435         PR gold/13204
1436         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1437         --section-start option was seen.
1438         * options.h (General_options::any_section_start): New function.
1439
1440 2011-10-18  David S. Miller  <davem@davemloft.net>
1441
1442         PR binutils/13301
1443         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1444         member to track relocation locations that have moved during TLS
1445         reloc optimizations.
1446         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1447         (Target_sparc::Relocate::relocate): Adjust view down by 4
1448         bytes if it matches reloc_adjust_addr_.
1449         (Target_sparc::Relocate::relocate_tls): Always move the
1450         __tls_get_addr call delay slot instruction forward 4 bytes when
1451         performing relaxation.
1452
1453 2011-10-18  Cary Coutant  <ccoutant@google.com>
1454
1455         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1456         (Output_file::map_no_anonymous): Check for non-zero
1457         return code from posix_fallocate.
1458
1459 2011-10-17  Cary Coutant  <ccoutant@google.com>
1460
1461         PR gold/13245
1462         * plugin.cc (is_visible_from_outside): Check for symbols
1463         referenced from dynamic objects.
1464         * resolve.cc (Symbol_table::resolve): Don't count references
1465         from dynamic objects as references from real ELF files.
1466         * testsuite/plugin_test_2.sh: Adjust expected result.
1467
1468 2011-10-17  Cary Coutant  <ccoutant@google.com>
1469
1470         * gold.cc: Include timer.h.
1471         (queue_middle_tasks): Stamp time.
1472         (queue_final_tasks): Likewise.
1473         * main.cc (main): Store timer in parameters.  Print timers
1474         for each pass.
1475         * parameters.cc (Parameters::Parameters): Initialize timer_.
1476         (Parameters::set_timer): New function.
1477         (set_parameters_timer): New function.
1478         * parameters.h (Parameters::set_timer): New function.
1479         (Parameters::timer): New function.
1480         (Parameters::timer_): New data member.
1481         (set_parameters_timer): New function.
1482         * timer.cc (Timer::stamp): New function.
1483         (Timer::get_pass_time): New function.
1484         * timer.h (Timer::stamp): New function.
1485         (Timer::get_pass_time): New function.
1486         (Timer::pass_times_): New data member.
1487
1488 2011-10-17  Cary Coutant  <ccoutant@google.com>
1489
1490         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1491         task for members of lib groups.
1492
1493 2011-10-17  Cary Coutant  <ccoutant@google.com>
1494
1495         PR gold/13288
1496         * fileread.cc (File_read::find_view): Add assert.
1497         (File_read::make_view): Move bounds check (replace with assert)...
1498         (File_read::find_or_make_view): ... to here.
1499
1500 2011-10-12  Cary Coutant  <ccoutant@google.com>
1501
1502         * output.cc (Output_file::open_base_file): Handle case where
1503         ::read returns less than requested size.
1504
1505 2011-10-10  Cary Coutant  <ccoutant@google.com>
1506
1507         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1508         Initialize defined_count_.
1509         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1510         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1511         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1512         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1513         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1514         * incremental.h (Sized_relobj_incr::defined_count_): New data
1515         member.
1516         (Sized_incr_dynobj::defined_count_): New data member.
1517         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1518         Return zeroes instead of internal error.
1519
1520 2011-10-10  Cary Coutant  <ccoutant@google.com>
1521
1522         PR gold/13249
1523         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1524         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1525         * output.h (class Output_reloc): Add use_plt_offset flag.
1526         (Output_reloc::type_): Adjust size of bit field.
1527         (Output_reloc::use_plt_offset_): New bit field.
1528         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1529         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1530         flag.  Adjust all callers.
1531         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1532         creating RELATIVE relocations.
1533
1534 2011-10-10  Nick Clifton  <nickc@redhat.com>
1535
1536         * po/es.po: Updated Spanish translation.
1537         * po/fi.po: Updated Finnish translation.
1538
1539 2011-10-03   Diego Novillo  <dnovillo@google.com>
1540
1541         * options.cc (parse_uint): Fix dereference of RETVAL.
1542
1543 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1544
1545         * layout.h (section_order_map_): New member.
1546         (get_section_order_map): New member function.
1547         * output.cc (Output_section::add_input_section): Check for patterns
1548         only when --section-ordering-file is specified.
1549         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1550         output_sections have been formed.
1551         * layout.cc (Layout_Layout): Initialize section_order_map_.
1552         * plugin.cc (update_section_order): Store order in order_map. Do not
1553         update the order.
1554         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1555         * testsuite/Makefile.in: Regenerate.
1556         * testsuite/plugin_section_order.c: New file.
1557         * testsuite/plugin_final_layout.cc: New file.
1558         * testsuite/plugin_final_layout.sh: New file.
1559
1560 2011-09-29  Cary Coutant  <ccoutant@google.com>
1561
1562         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1563         Check for NULL.
1564         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1565         symbols during incremental update.
1566         (Symbol_table::add_from_dynobj): Likewise.
1567
1568 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1569             Ian Lance Taylor  <iant@google.com>
1570
1571         * symtab.cc (Symbol_table::define_special_symbol): Always
1572         canonicalize version string.
1573
1574 2011-09-26  Cary Coutant  <ccoutant@google.com>
1575
1576         * gold.cc (queue_initial_tasks): Move option checks ...
1577         * options.cc (General_options::finalize): ... to here. Disable
1578         some options; make others fatal.
1579
1580 2011-09-26  Cary Coutant  <ccoutant@google.com>
1581
1582         gcc PR lto/47247
1583         * plugin.cc (get_symbols_v2): New function.
1584         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1585         (is_referenced_from_outside): New function.
1586         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1587         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1588         (get_symbols): Pass version parameter.
1589         (get_symbols_v2): New function.
1590         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1591         parameter.
1592         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1593         (onload): Add LDPT_GET_SYMBOLS_V2.
1594         (all_symbols_read_hook): Use get_symbols_v2; check for
1595         LDPR_PREVAILING_DEF_IRONLY_EXP.
1596         * testsuite/plugin_test_3.sh: Update expected results.
1597
1598 2011-09-23  Simon Baldwin  <simonb@google.com>
1599
1600         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1601         configuration options.
1602         * configure: Regenerate.
1603         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1604         * Makefile.in: Regenerate.
1605         * testsuite/Makefile.in: Regenerate.
1606
1607 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1608
1609         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1610
1611 2011-09-19  Cary Coutant  <ccoutant@google.com>
1612
1613         * incremental.cc (can_incremental_update): Fix typo in comment.
1614         * incremental.h (can_incremental_update): Likewise.
1615
1616 2011-09-18  Cary Coutant  <ccoutant@google.com>
1617
1618         * incremental.cc (can_incremental_update): New function.
1619         * incremental.h (can_incremental_update): New function.
1620         * layout.cc (Layout::init_fixed_output_section): Call it.
1621         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1622         * object.cc (Sized_relobj_file::do_layout): Call
1623         can_incremental_update.
1624
1625 2011-09-13  Cary Coutant  <ccoutant@google.com>
1626
1627         * configure.ac: Check for glibc support for gnu_indirect_function
1628         support with static linking, setting automake conditional
1629         IFUNC_STATIC.
1630         * Makefile.in: Regenerate.
1631         * configure: Regenerate.
1632
1633         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1634         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1635         for IFUNC_STATIC.
1636         * testsuite/Makefile.in: Regenerate.
1637
1638 2011-09-13  Cary Coutant  <ccoutant@google.com>
1639
1640         * incremental.cc (Sized_relobj_incr::do_layout): Call
1641         report_comdat_group for kept comdat sections.
1642         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1643         * testsuite/Makefile.in: Regenerate.
1644         * testsuite/incr_comdat_test_1.cc: New source file.
1645         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1646         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1647         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1648
1649 2011-09-13  Ian Lance Taylor  <iant@google.com>
1650
1651         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1652         variable external_symbols_offset.
1653
1654 2011-09-12  Ian Lance Taylor  <iant@google.com>
1655
1656         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1657         triggered if object has no symbols.
1658
1659 2011-09-09  David S. Miller  <davem@davemloft.net>
1660
1661         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1662         (Output_fill_debug_line::do_write): Likewise.
1663
1664 2011-08-29  Cary Coutant  <ccoutant@google.com>
1665
1666         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1667         casts to match formatting specs.
1668         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1669
1670 2011-08-26  Cary Coutant  <ccoutant@google.com>
1671
1672         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1673         remaining hole size when allocating.
1674         (Layout::make_output_section): Set fill methods for debug sections.
1675         * layout.h (Free_list::Free_list_node): Move from private to
1676         public.
1677         (Free_list::set_min_hole_size): New function.
1678         (Free_list::begin, Free_list::end): New functions.
1679         (Free_list::min_hole_): New data member.
1680         * output.cc: Include dwarf.h.
1681         (Output_fill_debug_info::do_minimum_hole_size): New function.
1682         (Output_fill_debug_info::do_write): New function.
1683         (Output_fill_debug_line::do_minimum_hole_size): New function.
1684         (Output_fill_debug_line::do_write): New function.
1685         (Output_section::Output_section): Initialize new data member.
1686         (Output_section::set_final_data_size): Ensure patch space is larger
1687         than minimum hole size.
1688         (Output_section::do_write): Fill holes in debug sections.
1689         * output.h (Output_fill): New class.
1690         (Output_fill_debug_info): New class.
1691         (Output_fill_debug_line): New class.
1692         (Output_section::set_free_space_fill): New function.
1693         (Output_section::free_space_fill_): New data member.
1694         * testsuite/Makefile.am (incremental_test_3): Add
1695         --incremental-patch option.
1696         (incremental_test_4): Likewise.
1697         (incremental_test_5): Likewise.
1698         (incremental_test_6): Likewise.
1699         (incremental_copy_test): Likewise.
1700         (incremental_common_test_1): Likewise.
1701         * testsuite/Makefile.in: Regenerate.
1702
1703 2011-08-26  Nick Clifton  <nickc@redhat.com>
1704
1705         * po/es.po: Updated Spanish translation.
1706
1707 2011-08-01  Cary Coutant  <ccoutant@google.com>
1708
1709         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1710         * gold/testsuite/Makefile.in: Regenerate.
1711         * gold/testsuite/justsyms_exec.c: New source file.
1712         * gold/testsuite/justsyms_lib.c: New source file.
1713
1714 2011-08-01  Cary Coutant  <ccoutant@google.com>
1715
1716         * layout.cc (Layout::set_segment_offsets): Don't realign text
1717         segment if -Ttext was specified.
1718         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1719         file type.
1720         * object.h (Sized_relobj_file::e_type): New function.
1721         (Sized_relobj_file::e_type_): New data member.
1722         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1723         base address for ET_EXEC files.
1724         * target.cc (Target::do_make_elf_object_implementation): Allow
1725         ET_EXEC files with --just-symbols option.
1726
1727 2011-07-28  Cary Coutant  <ccoutant@google.com>
1728
1729         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1730         Add thread_number parameter.
1731         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1732         * workqueue-threads.cc
1733         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1734         current thread if its thread number is greater than desired thread
1735         count.
1736         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1737         Add thread_number parameter.
1738         (Workqueue::should_cancel_thread): Likewise.
1739         (Workqueue::find_runnable_or_wait): Pass thread_number to
1740         should_cancel_thread.
1741         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1742         parameter.
1743
1744 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1745
1746         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1747         only after checking if it cannot be forced local.
1748         * symtab.h (is_externally_visible): Check if the symbol is not forced
1749         local.
1750
1751 2011-07-15  Ian Lance Taylor  <iant@google.com>
1752
1753         * options.h (class General_options): Add --print-output-format.
1754         Move -EL next to -EB, for  better --help output.
1755         * target-select.cc: Include <cstdio>, "options.h", and
1756         "parameters.h".
1757         (Target_selector::do_target_bfd_name): New function.
1758         (print_output_format): New function.
1759         * target-select.h (class Target_selector): Update declarations.
1760         (Target_selector::target_bfd_name): New function.
1761         (print_output_format): Declare.
1762         * main.cc: Include "target-select.h".
1763         (main): Handle --print-output-format.
1764         * gold.cc: Include "target-select.h".
1765         (queue_initial_tasks): Handle --print-output-format when there are
1766         no input files.
1767         * parameters.cc (parameters_force_valid_target): Give a better
1768         error message if -EB/-EL does not match target.
1769         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1770         function.
1771
1772 2011-07-15  Ian Lance Taylor  <iant@google.com>
1773
1774         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1775         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1776         (Output_data_plt_i386::do_write): Write address of .dynamic
1777         section to first entry in .got.plt section.
1778         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1779         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1780         Initialize layout_.
1781         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1782         section to first entry in .got.plt section.
1783         * layout.h (Layout::dynamic_section): New function.
1784
1785 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1786
1787         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1788         to claim_file call.
1789         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1790         input_section_position_, and input_section_glob_.
1791         (read_layout_from_file): Call function section_ordering_specified.
1792         * layout.h (is_section_ordering_specified): New function.
1793         (section_ordering_specified): New function.
1794         (section_ordering_specified_): New boolean member.
1795         * main.cc(main): Call load_plugins after layout object is defined.
1796         * output.cc (Output_section::add_input_section): Use
1797         function section_ordering_specified to check if section ordering is
1798         needed.
1799         * output.cc (Output_section::add_relaxed_input_section): Use
1800         function section_ordering_specified to check if section ordering is
1801         needed.
1802         (Output_section::update_section_layout): New function.
1803         (Output_section::sort_attached_input_sections): Check if input section
1804         must be reordered.
1805         * output.h (Output_section::update_section_layout): New function.
1806         * plugin.cc (get_section_count): New function.
1807         (get_section_type): New function.
1808         (get_section_name): New function.
1809         (get_section_contents): New function.
1810         (update_section_order): New function.
1811         (allow_section_ordering): New function.
1812         (Plugin::load): Add the new interfaces to the transfer vector.
1813         (Plugin_manager::load_plugins): New parameter.
1814         (Plugin_manager::all_symbols_read): New parameter.
1815         (Plugin_manager::claim_file): New parameter. Save the elf object for
1816         unclaimed objects.
1817         (Plugin_manager::get_elf_object): New function.
1818         (Plugin_manager::get_view): Change to directly use the bool to check
1819         if get_view is called from claim_file_hook.
1820         * plugin.h (input_objects): New function
1821         (Plugin__manager::load_plugins): New parameter.
1822         (Plugin_manager::claim_file): New parameter.
1823         (Plugin_manager::get_elf_object): New function.
1824         (Plugin_manager::in_claim_file_handler): New function.
1825         (Plugin_manager::in_claim_file_handler_): New member.
1826         (layout): New function.
1827         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1828         handler with an extra parameter. Make the elf object before calling
1829         claim_file handler.
1830         * testsuite/plugin_test.c (get_section_count): New function pointer.
1831         (get_section_type): New function pointer.
1832         (get_section_name): New function pointer.
1833         (get_section_contents): New function pointer.
1834         (update_section_order): New function pointer.
1835         (allow_section_ordering): New function pointer.
1836         (onload): Check if the new interfaces exist.
1837
1838 2011-07-13  Ian Lance Taylor  <iant@google.com>
1839
1840         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1841         relro section.
1842         * x86_64.cc (Target_x86_64::got_section): Likewise.
1843         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1844         (relro_now_test_SOURCES): New variable.
1845         (relro_now_test_DEPENDENCIES): New variable.
1846         (relro_now_test_LDFLAGS): New variable.
1847         (relro_now_test_LDADD): New variable.
1848         (relro_now_test.so): New target.
1849         * testsuite/Makefile.in: Rebuild.
1850
1851 2011-07-12  Ian Lance Taylor  <iant@google.com>
1852
1853         PR gold/12980
1854         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1855         GLOB_DAT relocation rather than a RELATIVE relocation for a
1856         protected symbol when creating a shared library.
1857         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1858         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1859         * testsuite/protected_main_1.cc (main): Test that protected
1860         function has same address.
1861
1862 2011-07-11  Ian Lance Taylor  <iant@google.com>
1863
1864         PR gold/12979
1865         * options.h (class General_options): Add -Bgroup.
1866         * options.cc (General_options::finalize): If -Bgroup is set,
1867         default to --unresolved-symbols=report-all.
1868         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1869         * target-reloc.h (issue_undefined_symbol_error): Handle
1870         --unresolved-symbols=report-all.
1871
1872 2011-07-08  Ian Lance Taylor  <iant@google.com>
1873
1874         PR gold/11985
1875         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1876         if linker script discards key sections.
1877         (Layout::create_dynamic_symtab): Likewise.
1878         (Layout::assign_local_dynsym_offsets): Likewise.
1879         (Layout::sized_create_version_sections): Likewise.
1880         (Layout::create_interp): Likewise.
1881         (Layout::finish_dynamic_section): Likewise.
1882         (Layout::set_dynamic_symbol_size): Likewise.
1883
1884 2011-07-08  Ian Lance Taylor  <iant@google.com>
1885
1886         PR gold/12386
1887         * options.h (class General_options): Add --unresolved-symbols.
1888         * target-reloc.h (issue_undefined_symbol_error): Check
1889         --unresolved-symbols.  Add comments.
1890
1891 2011-07-08  Ian Lance Taylor  <iant@google.com>
1892
1893         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1894         expression more complex.
1895
1896 2011-07-08  Ian Lance Taylor  <iant@google.com>
1897
1898         PR gold/11317
1899         * target-reloc.h (issue_undefined_symbol_error): New inline
1900         function, broken out of relocate_section.
1901         (relocate_section): Call issue_undefined_symbol_error.
1902         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1903         there is no TLS segment if we are about to issue an undefined
1904         symbol error.
1905         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1906
1907 2011-07-08  Ian Lance Taylor  <iant@google.com>
1908
1909         PR gold/12279
1910         * resolve.cc (Symbol_table::should_override): Add fromtype
1911         parameter.  Change all callers.  Give error when linking together
1912         TLS and non-TLS symbol.
1913         (Symbol_table::should_override_with_special): Add fromtype
1914         parameter.  Change all callers.
1915         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1916         there is no TLS segment if we have reported some errors.
1917         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1918
1919 2011-07-08  Ian Lance Taylor  <iant@google.com>
1920
1921         PR gold/12372
1922         * target.h (Target::plt_address_for_global): New function.
1923         (Target::plt_address_for_local): New function.
1924         (Target::plt_section_for_global): Remove.
1925         (Target::plt_section_for_local): Remove.
1926         (Target::do_plt_address_for_global): New virtual function.
1927         (Target::do_plt_address_for_local): New virtual function.
1928         (Target::do_plt_section_for_global): Remove.
1929         (Target::do_plt_section_for_local): Remove.
1930         (Target::register_global_plt_entry): Add Symbol_table and Layout
1931         parameters.
1932         * output.cc (Output_data_got::Got_entry::write): Use
1933         plt_address_for_global and plt_address_for_local.
1934         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1935         address of output section.
1936         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1937         got_irelative_, and irelative_count_ fields.  Update
1938         declarations.
1939         (Output_data_plt_i386::has_irelative_section): New function.
1940         (Output_data_plt_i386::entry_count): Add irelative_count_.
1941         (Output_data_plt_i386::set_final_data_size): Likewise.
1942         (class Target_i386): Add got_irelative_ and rel_irelative_
1943         fields.  Update declarations.
1944         (Target_i386::Target_i386): Initialize new fields.
1945         (Target_i386::do_plt_address_for_global): New function replacing
1946         do_plt_section_for_global.
1947         (Target_i386::do_plt_address_for_local): New function replacing
1948         do_plt_section_for_local.
1949         (Target_i386::got_section): Create got_irelative_.
1950         (Target_i386::rel_irelative_section): New function.
1951         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1952         fields.  Don't define __rel_iplt_{start,end}.
1953         (Output_data_plt_i386::add_entry): Add symtab and layout
1954         parameters.  Change all callers.  Use different PLT and GOT for
1955         IFUNC symbols.
1956         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1957         layout parameters.  Change all callers.  Use different PLT and
1958         GOT.
1959         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1960         (Output_data_plt_i386::rel_irelative): New function.
1961         (Output_data_plt_i386::address_for_global): New function.
1962         (Output_data_plt_i386::address_for_local): New function.
1963         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1964         IRELATIVE GOT when changing IFUNC GOT entries.
1965         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1966         reloc.
1967         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1968         if we didn't create an IRELATIVE GOT.
1969         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1970         plt_address_for_local.
1971         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1972         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1973         got_irelative_, and irelative_count_ fields.  Update
1974         declarations.
1975         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1976         Initialize new fields.  Remove symtab parameter.  Change all
1977         callers.
1978         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1979         irelative_count_.
1980         (Output_data_plt_x86_64::has_irelative_section): New function.
1981         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1982         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1983         fields.  Update declarations.
1984         (Target_x86_64::Target_x86_64): Initialize new fields.
1985         (Target_x86_64::do_plt_address_for_global): New function replacing
1986         do_plt_section_for_global.
1987         (Target_x86_64::do_plt_address_for_local): New function replacing
1988         do_plt_section_for_local.
1989         (Target_x86_64::got_section): Create got_irelative_.
1990         (Target_x86_64::rela_irelative_section): New function.
1991         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1992         all callers.  Don't create __rel_iplt_{start,end}.
1993         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1994         parameters.  Change all callers.  Use different PLT and GOT for
1995         IFUNC symbols.
1996         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1997         layout parameters.  Change all callers.  Use different PLT and
1998         GOT.
1999         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2000         parameters.  Change all callers.  Use different PLT and GOT for
2001         IFUNC symbols.
2002         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2003         (Output_data_plt_x86_64::rela_irelative): New function.
2004         (Output_data_plt_x86_64::address_for_global): New function.
2005         (Output_data_plt_x86_64::address_for_local): New function.
2006         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2007         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2008         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2009         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2010         parameters.
2011         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2012         reloc.
2013         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2014         symbols if we didn't create an IRELATIVE GOT.
2015         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2016         plt_address_for_local.
2017         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2018         * testsuite/ifuncvar1.c: New test file.
2019         * testsuite/ifuncvar2.c: New test file.
2020         * testsuite/ifuncvar3.c: New test file.
2021         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2022         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2023         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2024         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2025         * testsuite/Makefile.in: Rebuild.
2026
2027 2011-07-07  Cary Coutant  <ccoutant@google.com>
2028
2029         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2030         (two_file_test_1_ndebug.o): Likewise.
2031         (two_file_test_1b_ndebug.o): Likewise.
2032         (two_file_test_2_ndebug.o): Likewise.
2033         (two_file_test_main_ndebug.o): Likewise.
2034         (incremental_test_2): Link with no-debug versions.
2035
2036 2011-07-06  Cary Coutant  <ccoutant@google.com>
2037
2038         * gold/incremental.cc
2039         (Output_section_incremental_inputs::write_info_blocks): Check for
2040         hidden and internal symbols.
2041
2042 2011-07-06  Cary Coutant  <ccoutant@google.com>
2043
2044         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2045         Check disposition for startup file.
2046         (Incremental_inputs::report_command_line): Ignore
2047         --incremental-startup-unchanged option.
2048         * options.cc (General_options::parse_incremental_startup_unchanged):
2049         New function.
2050         (General_options::General_options): Initialize new data member.
2051         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2052         (General_options): Add --incremental-startup-unchanged option.
2053         (General_options::incremental_startup_disposition): New function.
2054         (General_options::incremental_startup_disposition_): New data member.
2055
2056 2011-07-06  Cary Coutant  <ccoutant@google.com>
2057
2058         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2059         input file index to Script_info ctor.
2060         (Sized_incremental_binary::do_file_has_changed): Find the
2061         command-line argument for files named in scripts.
2062         * incremental.h (Script_info::Script_info): New ctor
2063         with input file index.
2064         (Script_info::input_file_index): New function.
2065         (Script_info::input_file_index_): New data member.
2066         (Incremental_binary::get_library): Add const.
2067         (Incremental_binary::get_script_info): Add const.
2068         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2069         * testsuite/Makefile.am (incremental_test_5): New test case.
2070         (incremental_test_6): New test case.
2071         * testsuite/Makefile.in: Regenerate.
2072
2073 2011-07-06  Cary Coutant  <ccoutant@google.com>
2074
2075         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2076         debug output when command lines differ.
2077
2078 2011-07-06  Cary Coutant  <ccoutant@google.com>
2079
2080         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2081         --incremental-patch option.
2082         * layout.cc (Free_list::allocate): Extend allocation beyond original
2083         end if enabled.
2084         (Layout::make_output_section): Mark sections that should get
2085         patch space.
2086         * options.cc (parse_percent): New function.
2087         * options.h (parse_percent): New function.
2088         (DEFINE_percent): New macro.
2089         (General_options): Add --incremental-patch option.
2090         * output.cc (Output_section::Output_section): Initialize new data
2091         members.
2092         (Output_section::add_input_section): Print section name when out
2093         of patch space.
2094         (Output_section::add_output_section_data): Likewise.
2095         (Output_section::set_final_data_size): Add patch space when
2096         doing --incremental-full.
2097         (Output_section::do_reset_address_and_file_offset): Remove patch
2098         space.
2099         (Output_segment::set_section_list_addresses): Print debug output
2100         only if --incremental-update.
2101         * output.h (Output_section::set_is_patch_space_allowed): New function.
2102         (Output_section::is_patch_space_allowed_): New data member.
2103         (Output_section::patch_space_): New data member.
2104         * parameters.cc (Parameters::incremental_full): New function.
2105         * parameters.h (Parameters::incremental_full): New function
2106         * testsuite/Makefile.am (incremental_test_2): Add test for
2107         --incremental-patch option.
2108         * testsuite/Makefile.in: Regenerate.
2109         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2110         (t18): Remove function body.
2111
2112 2011-07-05  Doug Kwan  <dougkwan@google.com>
2113
2114         PR gold/12771
2115         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2116         Arm_Address type for relocation result.
2117         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2118         overflow check.
2119         (Arm_relocate_functions::abs32): Use unaligned access.
2120         (Arm_relocate_functions::rel32): Ditto.
2121         (Arm_relocate_functions::prel31): Ditto.
2122         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2123         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2124         static data relocations.
2125         * testsuite/Makefile.in: Regnerate.
2126         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2127
2128 2011-07-05  Ian Lance Taylor  <iant@google.com>
2129
2130         PR gold/12392
2131         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2132         symbols if necessary.
2133         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2134
2135 2011-07-05  Ian Lance Taylor  <iant@google.com>
2136
2137         PR gold/12952
2138         * resolve.cc (Symbol::override_base_with_special): Simply override
2139         version with special symbol version, ignoring previous version.
2140
2141 2011-07-05  Ian Lance Taylor  <iant@google.com>
2142
2143         * object.cc (Sized_relobj_file::include_section_group): Add
2144         information to comment about signature location.
2145
2146 2011-07-02  Ian Lance Taylor  <iant@google.com>
2147
2148         PR gold/12957
2149         * options.h (class General_options): Add -f and -F.
2150         * options.cc (General_options::finalize): Fatal error if -f/-F
2151         are used without -shared.
2152         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2153
2154 2011-07-02  Ian Lance Taylor  <iant@google.com>
2155
2156         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2157
2158 2011-07-01  Ian Lance Taylor  <iant@google.com>
2159
2160         PR gold/12525
2161         PR gold/12952
2162         * resolve.cc (Symbol::override_base_with_special): Don't override
2163         the version if the overriding symbol has a different name.
2164         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2165         all callers.  If we give an error about an undefined version,
2166         define the base version if necessary.
2167         * dynobj.h (class Versions): Update declaration.
2168         * testsuite/weak_alias_test_5.cc: New file.
2169         * testsuite/weak_alias_test.script: New file.
2170         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2171         and versioned_alias have the right value, and call t2.
2172         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2173         weak_alias_test_5.so.
2174         (weak_alias_test_LDADD): Likewise.
2175         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2176         * testsuite/Makefile.in: Rebuild.
2177
2178 2011-07-01  Ian Lance Taylor  <iant@google.com>
2179
2180         PR gold/12525
2181         * options.h (class General_options): Support -z notext.
2182         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2183         -Wl,-z,notext.
2184         (two_file_shared_nonpic.so): Likewise.
2185         (two_file_shared_mixed.so): Likewise.
2186         (two_file_shared_mixed_1.so): Likewise.
2187         (weak_undef_lib_nonpic.so): Likewise.
2188         (alt/weak_undef_lib_nonpic.so): Likewise.
2189         (tls_test_shared_nonpic.so): Likewise.
2190         * testsuite/Makefile.in: Rebuild.
2191
2192 2011-07-01  Ian Lance Taylor  <iant@google.com>
2193
2194         PR gold/12525
2195         * configure.ac: Test whether static linking works, setting
2196         the automake conditional HAVE_STATIC.
2197         * testsuite/Makefile.am: Disable tests using -static if
2198         HAVE_STATIC is not true.
2199         * configure, testsuite/Makefile.in: Rebuild.
2200
2201 2011-07-01  Ian Lance Taylor  <iant@google.com>
2202
2203         PR gold/12525
2204         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2205         Assert if we see DW_EH_PE_indirect.
2206         * target.h (Target::ehframe_datarel_base): New function.
2207         (Target::do_ehframe_datarel_base): New target function.
2208         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2209         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2210         function.
2211
2212 2011-07-01  Ian Lance Taylor  <iant@google.com>
2213
2214         PR gold/12571
2215         * options.h (class General_options): Add
2216         --ld-generated-unwind-info.
2217         * ehframe.cc (Fde::write): Add address parameter.  Change all
2218         callers.  If associated with PLT, fill in address and size.
2219         (Cie::set_output_offset): Only add merge mapping if there is an
2220         object.
2221         (Cie::write): Add address parameter.  Change all callers.
2222         (Eh_frame::add_ehframe_for_plt): New function.
2223         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2224         input_offset_ fields into union u_, with new plt field.
2225         (Fde::Fde): Adjust for new union field.
2226         (Fde::Fde) [Output_data version]: New constructor.
2227         (Fde::add_mapping): Only add merge mapping if there is an object.
2228         (class Cie): Update declarations.
2229         (class Eh_frame): Declare add_ehframe_for_plt.
2230         * layout.cc (Layout::layout_eh_frame): Break out code into
2231         make_eh_frame_section, and call it.
2232         (Layout::make_eh_frame_section): New function.
2233         (Layout::add_eh_frame_for_plt): New function.
2234         * layout.h (class Layout): Update declarations.
2235         * merge.cc (Merge_map::add_mapping): Add assertion.
2236         * i386.cc: Include "dwarf.h".
2237         (class Output_data_plt_i386): Make first_plt_entry,
2238         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2239         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2240         and plt_eh_frame_fde.
2241         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2242         boundary.  Call add_eh_frame_for_plt if appropriate.
2243         * x86_64.cc: Include "dwarf.h".
2244         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2245         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2246         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2247         and plt_eh_frame_fde.
2248         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2249         appropriate.
2250
2251 2011-06-29  Ian Lance Taylor  <iant@google.com>
2252
2253         PR gold/12629
2254         * object.cc (Sized_relobj_file::layout_section): Change shdr
2255         parameter to be const.
2256         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2257         out of do_layout.
2258         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2259         appropriate.  Call layout_eh_frame_section.
2260         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2261         sections.
2262         * object.h (class Sized_relobj_file): Update declarations.
2263
2264 2011-06-29  Ian Lance Taylor  <iant@google.com>
2265
2266         PR gold/12652
2267         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2268         modifier.
2269         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2270
2271 2011-06-29  Ian Lance Taylor  <iant@google.com>
2272
2273         PR gold/12675
2274         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2275         SHT_X86_64_UNWIND.
2276         * layout.cc (Layout::layout_eh_frame): Likewise.
2277
2278 2011-06-29  Ian Lance Taylor  <iant@google.com>
2279
2280         PR gold/12695
2281         * layout.cc (Layout::symtab_section_shndx): New function.
2282         * layout.h (class Layout): Declare symtab_section_shndx.
2283         * output.cc (Output_section::write_header): Call it.
2284
2285 2011-06-29  Ian Lance Taylor  <iant@google.com>
2286
2287         PR gold/12818
2288         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2289         symbols which are not used in a relocation.
2290
2291 2011-06-28  Ian Lance Taylor  <iant@google.com>
2292
2293         PR gold/12898
2294         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2295         script create indistinguishable segments.
2296         (Layout::set_segment_offsets): Use stable_sort when sorting
2297         segments.  Pass this to Compare_segments constructor.
2298         * layout.h (class Layout): Make segment_precedes non-static.
2299         (class Compare_segments): Change from struct to class.  Add
2300         layout_ field.  Add constructor.
2301         * script-sections.cc
2302         (Script_sections::attach_sections_using_phdrs_clause): Rename
2303         local orphan to is_orphan.  Don't report failure to put empty
2304         section in segment.  On attachment failure, report name of
2305         section, and attach to first PT_LOAD segment.
2306
2307 2011-06-28  Ian Lance Taylor  <iant@google.com>
2308
2309         PR gold/12934
2310         * target-select.cc (Target_selector::Target_selector): Add
2311         emulation parameter.  Change all callers.
2312         (select_target_by_bfd_name): Rename from select_target_by_name.
2313         Change all callers.
2314         (select_target_by_emulation): New function.
2315         (supported_emulation_names): New function.
2316         * target-select.h (class Target_selector): Add emulation_ field.
2317         Update declarations.
2318         (Target_selector::recognize_by_bfd_name): Rename from
2319         recognize_by_name.  Change all callers.
2320         (Target_selector::supported_bfd_names): Rename from
2321         supported_names.  Change all callers.
2322         (Target_selector::recognize_by_emulation): New function.
2323         (Target_selector::supported_emulations): New function.
2324         (Target_selector::emulation): New function.
2325         (Target_selector::do_recognize_by_bfd_name): Rename from
2326         do_recognize_by_name.  Change all callers.
2327         (Target_selector::do_supported_bfd_names): Rename from
2328         do_supported_names.  Change all callers.
2329         (Target_selector::do_recognize_by_emulation): New function.
2330         (Target_selector::do_supported_emulations): New function.
2331         (select_target_by_bfd_name): Change name in declaration.
2332         (select_target_by_emulation): Declare.
2333         (supported_emulation_names): Declare.
2334         * parameters.cc (parameters_force_valid_target): Try to find
2335         target based on emulation from -m option.
2336         * options.h (class General_options): Change doc string for -m.
2337         * options.cc (help): Print emulations.
2338         (General_options::parse_V): Likewise.
2339         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2340         Add emulation parameter.  Change all callers.
2341
2342 2011-06-28  Ian Lance Taylor  <iant@google.com>
2343
2344         * target.h (class Target): Add osabi_ field.
2345         (Target::osabi): New function.
2346         (Target::set_osabi): New function.
2347         (Target::Target): Initialize osabi_.
2348         (Target::do_adjust_elf_header): Make pure virtual.
2349         (Sized_target::do_adjust_elf_header): Declare.
2350         * target.cc (Sized_target::do_adjust_elf_header): New function.
2351         (class Sized_target): Instantiate all versions.
2352         * freebsd.h (class Target_freebsd): Remove.
2353         (Target_selector_freebsd::do_recognize): Call set_osabi on
2354         Target.
2355         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2356         (Target_selector_freebsd::set_osabi): Remove.
2357         * i386.cc (class Target_i386): Inherit from Sized_target rather
2358         than Target_freebsd.
2359         * x86_64.cc (class Target_x86_64): Likewise.
2360
2361 2011-06-28  Ian Lance Taylor  <iant@google.com>
2362
2363         * target.h (Target::can_check_for_function_pointers): Rewrite.
2364         Make non-virtual.
2365         (Target::can_icf_inline_merge_sections): Likewise.
2366         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2367         (Target::Target_info): Add can_icf_inline_merge_sections field.
2368         (Target::do_can_check_for_function_pointers): New virtual
2369         function.
2370         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2371         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2372         from can_check_for_function_pointers, move in file.
2373         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2374         section_may_have_icf_unsafe_poineters, move in file.
2375         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2376         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2377         Rename from can_check_for_function_pointers, move in file.
2378         (Target_i386::can_icf_inline_merge_sections): Remove.
2379         (Target_i386::i386_info): Initialize
2380         can_icf_inline_merge_sections.
2381         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2382         Initialize can_icf_inline_merge_sections.
2383         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2384         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2385         Rename from can_check_for_function_pointers, move in file.
2386         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2387         (Target_x86_64::x86_64_info): Initialize
2388         can_icf_inline_merge_sections.
2389         * testsuite/testfile.cc (Target_test::test_target_info):
2390         Likewise.
2391         * icf.cc (get_section_contents): Correct formatting.
2392
2393 2011-06-27  Ian Lance Taylor  <iant@google.com>
2394
2395         * symtab.cc (Symbol::versioned_name): New function.
2396         (Symbol_table::add_to_final_symtab): Use versioned_name when
2397         appropriate.
2398         (Symbol_table::sized_write_symbol): Likewise.
2399         * symtab.h (class Symbol): Declare versioned_name.
2400         * stringpool.h (class Stringpool_template): Add variant of add
2401         which takes a std::basic_string.
2402         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2403         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2404         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2405         (ver_test_12.o): New target.
2406         * testsuite/Makefile.in: Rebuild.
2407
2408 2011-06-27  Doug Kwan  <dougkwan@google.com>
2409
2410         * arm.cc (Arm_relocate_functions::thm_jump8,
2411         Arm_relocate_functions::thm_jump11): Use a wider signed
2412         type to compute offset.
2413         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2414         arm_thm_jump8.
2415         * testsuite/Makefile.in: Regenerate.
2416         * testsuite/arm_branch_in_range.sh: Check test results of
2417         arm_thm_jump11 and arm_thm_jump8.
2418         * testsuite/arm_thm_jump11.s: New test source file.
2419         * testsuite/arm_thm_jump11.t: New linker script.
2420         * testsuite/arm_thm_jump8.s: New test source file.
2421         * testsuite/arm_thm_jump8.t: New linker script.
2422
2423 2011-06-24  Ian Lance Taylor  <iant@google.com>
2424
2425         * layout.cc: Include "object.h".
2426         (ctors_sections_in_init_array): New static variable.
2427         (Layout::is_ctors_in_init_array): New function.
2428         (Layout::layout): Add entry to ctors_sections_in_init_array if
2429         appropriate.
2430         * layout.h (class Layout): Declare is_ctors_in_init_array.
2431         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2432         is_ctors_reverse_view is set.
2433         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2434         all callers.  Set is_ctors_reverse_view field of View_size.
2435         (Sized_relobj_file::reverse_words): New function.
2436         * object.h (Sized_relobj_file::View_size): Add
2437         is_ctors_reverse_view field.
2438         (class Sized_relobj_file): Update declarations.
2439         * testsuite/initpri3.c: New test.
2440         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2441         initpri3b.
2442         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2443         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2444         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2445         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2446         * testsuite/Makefile.in: Rebuild.
2447
2448 2011-06-24  Cary Coutant  <ccoutant@google.com>
2449
2450         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2451         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2452         (debug_msg_cdebug.err): New targets.
2453         * testsuite/Makefile.in: Regenerate.
2454         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2455         Fix checks for link with shared library.
2456
2457 2011-06-24  Doug Kwan  <dougkwan@google.com>
2458
2459         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2460         skip empty text sections.
2461         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2462
2463 2011-06-22  Ian Lance Taylor  <iant@google.com>
2464
2465         PR gold/12910
2466         * options.h (class General_options): Add --ctors-in-init-array.
2467         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2468         friends as SHT_PROGBITS for merging sections.
2469         (Layout::layout): Remove special handling of .init_array and
2470         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2471         and .dtors if ctors_in_init_array.
2472         (Layout::make_output_section): Force correct section types for
2473         .init_array and friends.  Don't sort if doing relocatable link,
2474         Don't sort .ctors and .dtors if ctors_in_init_array.
2475         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2476         (Layout::output_section_name): Add relobj parameter.  Change all
2477         callers.  Handle .ctors. and .dtors. in code rather than table.
2478         Handle .ctors and .dtors if ctors_in_init_array.
2479         (Layout::match_file_name): New function, moved from output.cc.
2480         * layout.h (class Layout): Update declarations.
2481         * output.cc: Include "layout.h".
2482         (Input_section_sort_entry::get_priority): New function.
2483         (Input_section_sort_entry::match_file_name): Just call
2484         Layout::match_file_name.
2485         (Output_section::Input_section_sort_init_fini_compare::operator()):
2486         Handle .ctors and .dtors.  Sort by explicit priority rather than
2487         by name.
2488         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2489         * testsuite/initpri2.c: New test.
2490         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2491         (check_PROGRAMS): Add initpri2.
2492         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2493         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2494         * configure, testsuite/Makefile.in: Rebuild.
2495
2496 2011-06-19  Ian Lance Taylor  <iant@google.com>
2497
2498         PR gold/12880
2499         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2500         .interp section to a PT_INTERP segment even if we have seen a
2501         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2502         clause in a linker script.
2503         (Layout::finalize): Don't create a .interp section if we've
2504         already create a PT_INTERP segment.
2505         (Layout::create_interp): Always call choose_output_section (revert
2506         patch of 2011-06-17).  Don't create PT_INTERP segment.
2507         * script-sections.cc
2508         (Script_sections::create_note_and_tls_segments): Add a .interp
2509         section to a PT_INTERP segment even if we have seen a
2510         --dynamic-linker option.
2511
2512 2011-06-18  Ian Lance Taylor  <iant@google.com>
2513
2514         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2515         merely because a non-PT_LOAD segment has a dynamic reloc.
2516
2517 2011-06-18  Ian Lance Taylor  <iant@google.com>
2518
2519         * layout.cc (Layout::finish_dynamic_section): Don't create
2520         DT_FLAGS entry if not needed.
2521
2522 2011-06-18  Ian Lance Taylor  <iant@google.com>
2523
2524         PR gold/12745
2525         * layout.cc (Layout::layout_eh_frame): Correct handling of
2526         writable .eh_frame section.
2527
2528 2011-06-17  Ian Lance Taylor  <iant@google.com>
2529
2530         PR gold/12893
2531         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2532         symbol is redefined with the exact same object and value.
2533
2534 2011-06-17  Ian Lance Taylor  <iant@google.com>
2535
2536         PR gold/12880
2537         * layout.h (class Layout): Add interp_segment_ field.
2538         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2539         (Layout::attach_allocated_section_to_segment): If making shared
2540         library, put .interp section in PT_INTERP segment.
2541         (Layout::finalize): Also call create_interp if -dynamic-linker
2542         option was used.
2543         (Layout::create_interp): Assert that there is no PT_INTERP
2544         segment.  If not using a SECTIONS clause, use make_output_section.
2545         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2546         * script-sections.cc
2547         (Script_sections::create_note_and_tls_segments): If making shared
2548         library, put .interp section in PT_INTERP segment.
2549
2550 2011-06-17  Ian Lance Taylor  <iant@google.com>
2551
2552         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2553         when making a shared library.
2554
2555 2011-06-17  Ian Lance Taylor  <iant@google.com>
2556
2557         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2558         parameter.  Change all callers.  Don't issue warning about PC32
2559         against locally defined symbol.
2560
2561 2011-06-16  Ian Lance Taylor  <iant@google.com>
2562
2563         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2564         occurs in same object.
2565
2566 2011-06-14  Alan Modra  <amodra@gmail.com>
2567
2568         * po/POTFILES.in: Regenerate.
2569
2570 2011-06-09  Ian Lance Taylor  <iant@google.com>
2571
2572         * script-sections.cc
2573         (Orphan_output_section::set_section_addresses): For a relocatable
2574         link set address to 0.
2575
2576 2011-06-09  Cary Coutant  <ccoutant@google.com>
2577
2578         PR gold/12804
2579         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2580         used with --compress-debug-sections.
2581         * gold/object.cc (Sized_relobj_file::do_layout): Report
2582         uncompressed size of compressed input sections.
2583
2584 2011-06-08  Cary Coutant  <ccoutant@google.com>
2585
2586         PR gold/12804
2587         * testsuite/two_file_test_2_v1.cc: Change initialization of
2588         v2 to keep it in .data.
2589
2590 2011-06-07  Cary Coutant  <ccoutant@google.com>
2591
2592         * common.cc (Symbol_table::do_allocate_commons_list): Call
2593         gold_fallback.
2594         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2595         (Errors::fallback): New function.
2596         (gold_fallback): New function.
2597         * errors.h (Errors::fallback): New function.
2598         * gold.cc (gold_exit): Change status parameter to enum; adjust
2599         all callers.
2600         (queue_initial_tasks): Call gold_fallback.
2601         * gold.h: Include cstdlib.
2602         (Exit_status): New enum type.
2603         (gold_exit): Change status parameter to enum.
2604         (gold_fallback): New function.
2605         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2606         (Layout::create_symtab_sections): Likewise.
2607         (Layout::create_shdrs): Likewise.
2608         * main.cc (main): Adjust call to gold_exit.
2609         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2610         (Output_data_got::add_got_entry_pair): Likewise.
2611         (Output_section::add_input_section): Likewise.
2612         (Output_section::add_output_section_data): Likewise.
2613         (Output_segment::set_section_list_addresses): Likewise.
2614         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2615
2616 2011-06-07  Cary Coutant  <ccoutant@google.com>
2617
2618         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2619         for incremental links.
2620         * output.cc (Output_segment::set_section_list_addresses): Remove
2621         FIXME and test for TLS or BSS.
2622
2623 2011-06-07  Cary Coutant  <ccoutant@google.com>
2624
2625         * testsuite/Makefile.am: Add incremental_copy_test,
2626         incremental_common_test_1.
2627         * testsuite/Makefile.in: Regenerate.
2628         * testsuite/common_test_1_v1.c: New source file.
2629         * testsuite/common_test_1_v2.c: New source file.
2630         * testsuite/copy_test_v1.cc: New source file.
2631
2632 2011-06-07  Cary Coutant  <ccoutant@google.com>
2633
2634         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2635         update, allocate common from bss section's free list.
2636         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2637         linker-defined symbols.
2638         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2639         Skip GOT and PLT entries that are no longer referenced.
2640         (Output_section_incremental_inputs::write_info_blocks): Mark
2641         linker-defined symbols.
2642         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2643         * output.cc (Output_section::allocate): New function.
2644         * output.h (Output_section::allocate): New function.
2645         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2646         linker-defined symbols.
2647         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2648         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2649         (Symbol::init_base_output_data): Likewise.
2650         (Symbol::init_base_output_segment): Likewise.
2651         (Symbol::init_base_constant): Likewise.
2652         (Sized_symbol::init_output_data): Likewise.
2653         (Sized_symbol::init_output_segment): Likewise.
2654         (Sized_symbol::init_constant): Likewise.
2655         (Symbol_table::do_define_in_output_data): Likewise.
2656         (Symbol_table::do_define_in_output_segment): Likewise.
2657         (Symbol_table::do_define_as_constant): Likewise.
2658         * symtab.h (Symbol::is_predefined): New function.
2659         (Symbol::init_base_output_data): Add is_predefined parameter.
2660         (Symbol::init_base_output_segment): Likewise.
2661         (Symbol::init_base_constant): Likewise.
2662         (Symbol::is_predefined_): New data member.
2663         (Sized_symbol::init_output_data): Add is_predefined parameter.
2664         (Sized_symbol::init_output_segment): Likewise.
2665         (Sized_symbol::init_constant): Likewise.
2666         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2667
2668 2011-06-07  Cary Coutant  <ccoutant@google.com>
2669
2670         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2671         instead of emit_copy_reloc.
2672         (Copy_relocs::emit_copy_reloc): Refactor.
2673         (Copy_relocs::make_copy_reloc): New function.
2674         (Copy_relocs::add_copy_reloc): Remove.
2675         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2676         section.
2677         (Copy_relocs::make_copy_reloc): New function.
2678         (Copy_relocs::add_copy_reloc): Remove.
2679         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2680         unchanged input files.
2681         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2682         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2683         Reserve BSS space for COPY relocations.
2684         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2685         (Output_section_incremental_inputs::write_info_blocks): Record
2686         whether a symbol is copied from a shared object.
2687         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2688         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2689         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2690         (Incremental_input_entry_reader::get_output_symbol_index): Add
2691         is_copy parameter.
2692         (Incremental_binary::emit_copy_relocs): New function.
2693         (Incremental_binary::do_emit_copy_relocs): New function.
2694         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2695         new data member.
2696         (Sized_incremental_binary::add_copy_reloc): New function.
2697         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2698         (Sized_incremental_binary::Copy_reloc): New struct.
2699         (Sized_incremental_binary::Copy_relocs): New typedef.
2700         (Sized_incremental_binary::copy_relocs_): New data member.
2701         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2702         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2703         * target.h (Sized_target::emit_copy_reloc): New function.
2704         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2705
2706 2011-06-02  Cary Coutant  <ccoutant@google.com>
2707
2708         PR gold/12163
2709         * gold/archive.cc (Archive::Archive): Initialize new data member.
2710         (Archive::include_all_members): Return if archive has already been
2711         included.
2712         * gold/archive.h (Archive::include_all_members_): New data member.
2713
2714 2011-06-02  Nick Clifton  <nickc@redhat.com>
2715
2716         * dynobj.h: Fix spelling mistake in comment.
2717         * output.cc: Likewise.
2718
2719 2011-05-31  Doug Kwan  <dougkwan@google.com>
2720             Asier Llano
2721
2722         PR gold/12826
2723         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2724         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2725         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2726         redundant arm_exidx_test.so.
2727         * testsuite/Makefile.in: Regenerate.
2728         (check_SCRIPTS): Add pr12826.sh
2729         (check_DATA): Add pr12826.stdout
2730         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2731         * testsuite/pr12826.sh: New file.
2732         * testsuite/pr12826_1.s: Ditto.
2733         * testsuite/pr12826_1.s: Ditto.
2734
2735 2011-05-30  Ian Lance Taylor  <iant@google.com>
2736
2737         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2738         sections.
2739
2740 2011-05-29  Ian Lance Taylor  <iant@google.com>
2741
2742         PR gold/12804
2743         * testsuite/Makefile.am: Use different file name for two_file_test
2744         temporary file for each incremental test.
2745         * testsuite/Makefile.in: Rebuild.
2746
2747 2011-05-29  Ian Lance Taylor  <iant@google.com>
2748
2749         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2750         binary input file is empty.
2751
2752 2011-05-27  Ian Lance Taylor  <iant@google.com>
2753
2754         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2755         (ver_test_9.so): Likewise.
2756         * testsuite/Makefile.in: Rebuild.
2757
2758 2011-05-26 Cary Coutant  <ccoutant@google.com>
2759
2760         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2761         * incremental.cc (Incremental_inputs::report_input_section): Fix
2762         comment, indentation.
2763         (Incremental_inputs::report_comdat_group): New function.
2764         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2765         of data for incremental input file entry.
2766         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2767         group count, COMDAT group signatures.
2768         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2769         an unchanged input file.
2770         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2771         Initialize new data member.
2772         (Incremental_object_entry::add_comdat_group): New function.
2773         (Incremental_object_entry::get_comdat_group_count): New function.
2774         (Incremental_object_entry::get_comdat_signature_key): New function.
2775         (Incremental_object_entry::groups_): New data member.
2776         (Incremental_inputs::report_comdat_group): New function.
2777         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2778         data for incremental input file entry.
2779         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2780         (Incremental_input_entry_reader::get_input_section): Adjust size of
2781         data for incremental input file entry.
2782         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2783         (Incremental_input_entry_reader::get_comdat_group_signature): New
2784         function.
2785         * object.cc (Sized_relobj::include_section_group): Report kept
2786         COMDAT groups for incremental links.
2787
2788 2011-05-24  David Meyer  <pdox@google.com>
2789
2790         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2791         with name parameter.  Add found_name parameter.
2792         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2793         * dirsearch.h (class Dirsearch): Update declaration.
2794
2795 2011-05-24  Ian Lance Taylor  <iant@google.com>
2796
2797         * archive.cc (Library_base::should_include_member): Pull in object
2798         from archive if it defines the entry symbol.
2799         * parameters.cc (Parameters::entry): New function.
2800         * parameters.h (class Parameters): Declare entry.
2801         * output.h (class Output_file_header): Remove entry_ field.
2802         * output.cc (Output_file_header::Output_file_header): Remove entry
2803         parameter.  Change all callers.
2804         (Output_file_header::entry): Use parameters->entry.
2805         * gold.cc (queue_middle_tasks): Likewise.
2806         * plugin.cc (Plugin_hook::run): Likewise.
2807
2808 2011-05-24 Cary Coutant  <ccoutant@google.com>
2809
2810         * gold.cc (queue_initial_tasks): Pass incremental base filename
2811         to Output_file::open_base_file; don't print error message.
2812         * incremental-dump.cc (main): Adjust call to
2813         Output_file::open_for_modification.
2814         * incremental-dump.cc (main): Likewise.
2815         * incremental.cc (Incremental_inputs::report_command_line):
2816         Ignore --incremental-base option when comparing command lines.
2817         Ignore parameter when given as separate argument.
2818         * options.h (class General_options): Add --incremental-base.
2819         * output.cc (Output_file::Output_file):
2820         (Output_file::open_base_file): Add base_name and writable parameters;
2821         read base file into new file; print error message here.
2822         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2823         callers.
2824         * output.h (Output_file::open_for_modification): Rename to...
2825         (Output_file::open_base_file): ...this; add base_name and
2826         writable parameters; adjust all callers.
2827         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2828         callers.
2829         * testsuite/Makefile.am (incremental_test_4): Test
2830         --incremental-base.
2831         * testsuite/Makefile.in: Regenerate.
2832
2833 2011-05-24 Cary Coutant  <ccoutant@google.com>
2834
2835         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2836         incremental_test_4.
2837         * testsuite/Makefile.in: Regenerate.
2838         * testsuite/two_file_test_1_v1.cc: New test source file.
2839         * testsuite/two_file_test_1b_v1.cc: New test source file.
2840         * testsuite/two_file_test_2_v1.cc: New test source file.
2841
2842 2011-05-24 Cary Coutant  <ccoutant@google.com>
2843
2844         * dynobj.h (Dynobj::do_dynobj): New function.
2845         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2846         flag and soname for shared objects.
2847         * incremental.cc (Incremental_inputs::report_object): Make
2848         either Incremental_object_entry or Incremental_dynobj_entry; add
2849         soname to string table.
2850         (Incremental_inputs::report_input_section): Add assertion.
2851         (Output_section_incremental_inputs::set_final_data_size): Adjust
2852         type of input file entry for shared libraries; adjust size of
2853         shared library info entry.
2854         (Output_section_incremental_inputs::write_input_files): Write
2855         as_needed flag for shared libraries.
2856         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2857         of input file entry for shared libraries; write soname.
2858         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2859         soname from incremental info.
2860         * incremental.h (enum Incremental_input_flags): Add
2861         INCREMENTAL_INPUT_AS_NEEDED.
2862         (Incremental_input_entry::Incremental_input_entry): Initialize new
2863         data member.
2864         (Incremental_input_entry::set_as_needed): New function.
2865         (Incremental_input_entry::as_needed): New function.
2866         (Incremental_input_entry::do_dynobj_entry): New function.
2867         (Incremental_input_entry::as_needed_): New data member.
2868         (Incremental_object_entry::Incremental_object_entry): Don't check
2869         for shared library.
2870         (Incremental_object_entry::do_type): Likewise.
2871         (class Incremental_dynobj_entry): New class.
2872         (Incremental_input_entry_reader::as_needed): New function.
2873         (Incremental_input_entry_reader::get_soname): New function.
2874         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2875         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2876         size of shared library info entry.
2877         * layout.cc (Layout::finish_dynamic_section): Don't test for
2878         incremental link when adding DT_NEEDED entries.
2879         * object.h (Object::Object): Initialize new data member.
2880         (Object::dynobj): New function.
2881         (Object::set_as_needed): New function.
2882         (Object::as_needed): New function.
2883         (Object::do_dynobj): New function.
2884         (Object::as_needed_): New data member.
2885
2886 2011-05-24 Cary Coutant  <ccoutant@google.com>
2887
2888         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2889         info; adjust display of GOT entries.
2890         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2891         vector of input objects; remove file_status_.
2892         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2893         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2894         got_plt reader; call target hooks to reserve GOT entries.
2895         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2896         of input file info header and GOT info entry.
2897         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2898         relocation info.
2899         (Got_plt_view_info::got_descriptor): Remove.
2900         (Got_plt_view_info::sym_index): New data member.
2901         (Got_plt_view_info::input_index): New data member.
2902         (Local_got_offset_visitor::visit): Write input file index.
2903         (Global_got_offset_visitor::visit): Write 0 for input file index.
2904         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2905         with sym_index and input_index.
2906         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2907         incremental info GOT entry; replace got_descriptor with input_index.
2908         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2909         map from input file index to object.
2910         (Sized_relobj_incr::do_layout): Replace direct data member reference
2911         with accessor function.
2912         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2913         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2914         Adjust size of input file info header.
2915         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2916         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2917         (Incremental_input_entry_reader::get_input_section): Adjust size of
2918         input file info header.
2919         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2920         of incremental info GOT entry.
2921         (Incremental_got_plt_reader::get_got_desc): Remove.
2922         (Incremental_got_plt_reader::get_got_symndx): New function.
2923         (Incremental_got_plt_reader::get_got_input_index): New function.
2924         (Sized_incremental_binary::Sized_incremental_binary): Remove
2925         file_status_; add input_objects_.
2926         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2927         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2928         (Sized_incremental_binary::file_is_unchanged): Remove.
2929         (Sized_incremental_binary::set_input_object): New function.
2930         (Sized_incremental_binary::input_object): New function.
2931         (Sized_incremental_binary::file_status_): Remove.
2932         (Sized_incremental_binary::input_objects_): New data member.
2933         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2934         references.
2935         (Sized_relobj_incr::invalid_address): Move to base class.
2936         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2937         class.
2938         (Sized_relobj_incr::do_output_section_offset): Likewise.
2939         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2940         (Sized_relobj_incr::section_offsets_): Likewise.
2941         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2942         function.
2943         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2944         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2945         with accessor function.
2946         (Sized_relobj_file::do_layout): Likewise.
2947         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2948         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2949         (Sized_relobj_file::compute_final_local_value): Replace refs to
2950         section_offsets_ with accessor function.
2951         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2952         * object.h (Relobj::Relobj): Initialize new data members.
2953         (Relobj::add_dyn_reloc): New function.
2954         (Relobj::first_dyn_reloc): New function.
2955         (Relobj::dyn_reloc_count): New function.
2956         (Relobj::first_dyn_reloc_): New data member.
2957         (Relobj::dyn_reloc_count_): New data member.
2958         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2959         references.
2960         (Sized_relobj::Address): New typedef.
2961         (Sized_relobj::invalid_address): Move here from child class.
2962         (Sized_relobj::Sized_relobj): Initialize new data members.
2963         (Sized_relobj::sized_relobj): New function.
2964         (Sized_relobj::is_output_section_offset_invalid): Move here from
2965         child class.
2966         (Sized_relobj::get_output_section_offset): Likewise.
2967         (Sized_relobj::local_has_got_offset): Likewise.
2968         (Sized_relobj::local_got_offset): Likewise.
2969         (Sized_relobj::set_local_got_offset): Likewise.
2970         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2971         (Sized_relobj::clear_got_offsets): New function.
2972         (Sized_relobj::section_offsets): Move here from child class.
2973         (Sized_relobj::do_output_section_offset): Likewise.
2974         (Sized_relobj::do_set_section_offset): Likewise.
2975         (Sized_relobj::Local_got_offsets): Likewise.
2976         (Sized_relobj::local_got_offsets_): Likewise.
2977         (Sized_relobj::section_offsets_): Likewise.
2978         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2979         references.
2980         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2981         class.
2982         (Sized_relobj_file::sized_relobj): New function
2983         (Sized_relobj_file::local_has_got_offset): Move to base class.
2984         (Sized_relobj_file::local_got_offset): Likewise.
2985         (Sized_relobj_file::set_local_got_offset): Likewise.
2986         (Sized_relobj_file::get_output_section_offset): Likewise.
2987         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2988         (Sized_relobj_file::do_output_section_offset): Likewise.
2989         (Sized_relobj_file::do_set_section_offset): Likewise.
2990         (Sized_relobj_file::Local_got_offsets): Likewise.
2991         (Sized_relobj_file::local_got_offsets_): Likewise.
2992         (Sized_relobj_file::section_offsets_): Likewise.
2993         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2994         (all constructors).
2995         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2996         (Output_reloc::get_symbol_index): Likewise.
2997         (Output_reloc::local_section_offset): Likewise.
2998         (Output_reloc::get_address): Likewise.
2999         (Output_reloc::symbol_value): Likewise.
3000         (Output_data_got::reserve_slot): Move to class definition.
3001         (Output_data_got::reserve_local): New function.
3002         (Output_data_got::reserve_slot_for_global): Remove.
3003         (Output_data_got::reserve_global): New function.
3004         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3005         (all constructors, two instantiations).
3006         (Output_reloc::get_relobj): New function (two instantiations).
3007         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3008         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3009         (Output_data_reloc::add_global): Adjust type of relobj.
3010         (Output_data_reloc::add_global_relative): Likewise.
3011         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3012         (Output_data_reloc::add_local): Likewise.
3013         (Output_data_reloc::add_local_relative): Likewise.
3014         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3015         (Output_data_reloc::add_local_section): Likewise.
3016         (Output_data_reloc::add_output_section): Likewise.
3017         (Output_data_reloc::add_absolute): Likewise.
3018         (Output_data_reloc::add_target_specific): Likewise.
3019         (Output_data_got::reserve_slot): Move definition here.
3020         (Output_data_got::reserve_local): New function.
3021         (Output_data_got::reserve_global): New function.
3022         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3023         section_offsets_ with accessor function.
3024         (Sized_relobj_file::write_sections): Likewise.
3025         (Sized_relobj_file::do_relocate_sections): Likewise.
3026         * target.h (Sized_target::reserve_local_got_entry): New function.
3027         (Sized_target::reserve_global_got_entry): New function.
3028         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3029         (Target_x86_64::reserve_global_got_entry): New function.
3030         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3031
3032 2011-05-23 Cary Coutant  <ccoutant@google.com>
3033
3034         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3035         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3036         bit when checking got_type.
3037         * incremental.cc (Sized_incremental_binary::setup_readers):
3038         Store symbol table and string table locations; initialize bit vector
3039         of file status flags.
3040         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3041         unchanged files.
3042         (Sized_incremental_binary::do_process_got_plt): New function.
3043         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3044         (Output_section_incremental_inputs::set_final_data_size): Record
3045         file index for each input file.
3046         (Output_section_incremental_inputs::write_got_plt): Store file index
3047         instead of input entry offset for each GOT entry.
3048         * incremental.h
3049         (Incremental_input_entry::Incremental_input_entry): Initialize new
3050         data member.
3051         (Incremental_input_entry::set_offset): Store file index.
3052         (Incremental_input_entry::get_file_index): New function.
3053         (Incremental_input_entry::file_index_): New data member.
3054         (Incremental_binary::process_got_plt): New function.
3055         (Incremental_binary::do_process_got_plt): New function.
3056         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3057         data members.
3058         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3059         (Sized_incremental_binary::set_file_is_unchanged): New function.
3060         (Sized_incremental_binary::file_is_unchanged): New function.
3061         (Sized_incremental_binary::do_process_got_plt): New function.
3062         (Sized_incremental_binary::file_status_): New data member.
3063         (Sized_incremental_binary::main_symtab_loc_): New data member.
3064         (Sized_incremental_binary::main_strtab_loc_): New data member.
3065         * output.cc (Output_data_got::Got_entry::write): Add case
3066         RESERVED_CODE.
3067         (Output_data_got::add_global): Call add_got_entry.
3068         (Output_data_got::add_global_plt): Likewise.
3069         (Output_data_got::add_global_with_rel): Likewise.
3070         (Output_data_got::add_global_with_rela): Likewise.
3071         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3072         (Output_data_got::add_global_pair_with_rela): Likewise.
3073         (Output_data_got::add_local): Call add_got_entry.
3074         (Output_data_got::add_local_plt): Likewise.
3075         (Output_data_got::add_local_with_rel): Likewise.
3076         (Output_data_got::add_local_with_rela): Likewise.
3077         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3078         (Output_data_got::add_local_pair_with_rela): Likewise.
3079         (Output_data_got::reserve_slot): New function.
3080         (Output_data_got::reserve_slot_for_global): New function.
3081         (Output_data_got::add_got_entry): New function.
3082         (Output_data_got::add_got_entry_pair): New function.
3083         (Output_section::add_output_section_data): Edit FIXME.
3084         * output.h
3085         (Output_section_data_build::Output_section_data_build): New
3086         constructor with size parameter.
3087         (Output_data_space::Output_data_space): Likewise.
3088         (Output_data_got::Output_data_got): Initialize new data member; new
3089         constructor with size parameter.
3090         (Output_data_got::add_constant): Call add_got_entry.
3091         (Output_data_got::reserve_slot): New function.
3092         (Output_data_got::reserve_slot_for_global): New function.
3093         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3094         (Output_data_got::add_got_entry): New function.
3095         (Output_data_got::add_got_entry_pair): New function.
3096         (Output_data_got::free_list_): New data member.
3097         * target.h (Sized_target::init_got_plt_for_update): New function.
3098         (Sized_target::register_global_plt_entry): New function.
3099         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3100         Initialize new data member; call init; add constructor with PLT count.
3101         (Output_data_plt_x86_64::init): New function.
3102         (Output_data_plt_x86_64::add_relocation): New function.
3103         (Output_data_plt_x86_64::reserve_slot): New function.
3104         (Output_data_plt_x86_64::free_list_): New data member.
3105         (Target_x86_64::init_got_plt_for_update): New function.
3106         (Target_x86_64::register_global_plt_entry): New function.
3107         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3108         incremental updates.
3109         (Output_data_plt_x86_64::add_relocation): New function.
3110         * testsuite/object_unittest.cc (Object_test): Set default options.
3111
3112 2011-05-16  Ian Lance Taylor  <iant@google.com>
3113
3114         * options.h (class General_options): Make -i a synonym for -r.
3115
3116 2011-05-16  Ian Lance Taylor  <iant@google.com>
3117
3118         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3119
3120 2011-05-10 Cary Coutant  <ccoutant@google.com>
3121
3122         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3123         strip_all (-s).
3124
3125 2011-05-06  Ian Lance Taylor  <iant@google.com>
3126
3127         * layout.cc (Layout::layout): If the output section flags change,
3128         update the ordering.
3129
3130 2011-04-25 Cary Coutant  <ccoutant@google.com>
3131
3132         * incremental-dump.cc (dump_incremental_inputs): Print local
3133         symbol info for each input file.
3134         * incremental.cc
3135         (Output_section_incremental_inputs::set_final_data_size): Add local
3136         symbol info to input file entries in incremental info.
3137         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3138         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3139         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3140         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3141         implementation.
3142         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3143         (Sized_incr_relobj::do_relocate): Write the local symbols.
3144         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3145         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3146         Adjust size of input file header.
3147         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3148         (Incremental_inputs_reader::get_local_symbol_count): New function.
3149         (Incremental_inputs_reader::get_input_section): Adjust size of input
3150         file header.
3151         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3152         (Sized_incr_relobj::This): New typedef.
3153         (Sized_incr_relobj::sym_size): New const data member.
3154         (Sized_incr_relobj::Local_symbol): New struct.
3155         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3156         (Sized_incr_relobj::do_local_symbol_offset): New function.
3157         (Sized_incr_relobj::local_symbol_count_): New data member.
3158         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3159         (Sized_incr_relobj::local_symbol_index_): New data member.
3160         (Sized_incr_relobj::local_symbol_offset_): New data member.
3161         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3162         (Sized_incr_relobj::local_symbols_): New data member.
3163         * object.h (Relobj::output_local_symbol_count): New function.
3164         (Relobj::local_symbol_offset): New function.
3165         (Relobj::do_output_local_symbol_count): New function.
3166         (Relobj::do_local_symbol_offset): New function.
3167         (Sized_relobj::do_output_local_symbol_count): New function.
3168         (Sized_relobj::do_local_symbol_offset): New function.
3169
3170 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3171
3172         * descriptors.cc (set_close_on_exec): New function.
3173         (Descriptors::open): Use set_close_on_exec.
3174         * output.cc (S_ISLNK): Define if not defined.
3175
3176 2011-04-22 Cary Coutant  <ccoutant@google.com>
3177
3178         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3179         global symbol map.
3180         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3181         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3182         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3183         relocations.
3184         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3185         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3186         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3187         * incremental.h
3188         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3189         function.
3190         (Incremental_binary::apply_incremental_relocs): New function.
3191         (Incremental_binary::do_apply_incremental_relocs): New function.
3192         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3193         data member.
3194         (Sized_incremental_binary::add_global_symbol): New function.
3195         (Sized_incremental_binary::global_symbol): New function.
3196         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3197         (Sized_incremental_binary::symbol_map_): New data member.
3198         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3199         * target.h (Sized_target::apply_relocation): New function.
3200         * target-reloc.h (apply_relocation): New function.
3201         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3202
3203 2011-04-22  Doug Kwan  <dougkwan@google.com>
3204
3205         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3206         flag of a SHT_ARM_EXIDX section.
3207         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3208         * testsuite/Makefile.in: Regenerate.
3209         * testsuite/arm_exidx_test.s: New file.
3210         * testsuite/arm_exidx_test.sh: Same.
3211
3212 2011-04-20 Cary Coutant  <ccoutant@google.com>
3213
3214         PR gold/12689
3215         * archive.h (Incremental_archive_entry::Archive_member):
3216         Initialize arg_serial_ (second constructor).
3217
3218 2011-04-17  Ian Lance Taylor  <iant@google.com>
3219
3220         * object.cc (Relocate_info::location): Simplify location string.
3221         * errors.cc (Errors::error_at_location): Don't print program
3222         name.
3223         (Errors::warning_at_location): Likewise.
3224         (Errors::undefined_symbol): Likewise.
3225         * testsuite/debug_msg.sh: Update accordingly.
3226
3227 2011-04-14 Cary Coutant  <ccoutant@google.com>
3228
3229         * gold/layout.cc (Layout::symtab_section_offset): New function.
3230         * gold/layout.h (Layout::symtab_section_offset): New function.
3231         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3232
3233 2011-04-12  Ian Lance Taylor  <iant@google.com>
3234
3235         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3236         with MREMAP_MAYMOVE.
3237         * output.h (class Output_file): Add map_is_allocated_ field.
3238         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3239         not available, provide stubs.  If mremap is not available, #define
3240         it to gold_mremap.
3241         (MREMAP_MAYMOVE): Define if not defined.
3242         (Output_file::Output_file): Initialize map_is_allocated_.
3243         (Output_file::resize): Check map_is_allocated_.
3244         (Output_file::map_anonymous): If mmap fails, use malloc.
3245         (Output_file::unmap): Don't do anything for an anonymous map.
3246         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3247         is not available, provide stubs.
3248         (File_read::View::~View): Use free rather than delete[].
3249         (File_read::make_view): Use malloc rather than new[].  If mmap
3250         fails, use malloc.
3251         (File_read::find_or_make_view): Use malloc rather than new[].
3252         * gold.h: Remove HAVE_REMAP code.
3253         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3254         exists.  Rename mremap to gold_mremap.  If mmap is not available
3255         don't do anything.
3256         * configure, config.in: Rebuild.
3257
3258 2011-04-11  Ian Lance Taylor  <iant@google.com>
3259
3260         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3261         initialize local variable v.
3262
3263 2011-04-11  Cary Coutant  <ccoutant@google.com>
3264
3265         * archive.cc (Archive::include_member): Adjust call to
3266         report_object.
3267         (Add_archive_symbols::run): Track argument serial numbers.
3268         (Lib_group::include_member): Likewise.
3269         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3270         * archive.h (Incremental_archive_entry::Archive_member):
3271         Initialize arg_serial_.
3272         (Archive_member::arg_serial_): New data member.
3273         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3274         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3275         incremental link.
3276         (Sized_dynobj::do_for_all_local_got_entries): New function.
3277         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3278         function.
3279         * fileread.cc (get_mtime): New function.
3280         * fileread.h (get_mtime): New function.
3281         * gold.cc (queue_initial_tasks): Check for incremental update.
3282         (process_incremental_input): New function.
3283         (queue_middle_tasks): Don't force valid target for incremental
3284         update.
3285         * incremental-dump.cc (find_input_containing_global): Adjust
3286         size of symbol info entry.
3287         (dump_incremental_inputs): Dump argument serial number and
3288         in_system_directory flag; bias shndx by 1; print symbol names
3289         when dumping per-file symbol lists; use new symbol info readers.
3290         * incremental.cc
3291         (Output_section_incremental_inputs:update_data_size): New function.
3292         (Sized_incremental_binary::setup_readers): Setup input readers
3293         for each input file; build maps for files added from libraries
3294         and scripts.
3295         (Sized_incremental_binary::check_input_args): New function.
3296         (Sized_incremental_binary::do_check_inputs): Build map of argument
3297         serial numbers to input arguments.
3298         (Sized_incremental_binary::do_file_has_changed): Rename
3299         do_file_is_unchanged to this; compare file modification times.
3300         (Sized_incremental_binary::do_init_layout): New function.
3301         (Sized_incremental_binary::do_reserve_layout): New function.
3302         (Sized_incremental_binary::do_get_input_reader): Remove.
3303         (Sized_incremental_binary::get_symtab_view): New function.
3304         (Incremental_checker::can_incrementally_link_output_file): Remove.
3305         (Incremental_inputs::report_command_line): Exclude --debug options.
3306         (Incremental_inputs::report_archive_begin): Add parameter; track
3307         argument serial numbers; don't put input file entry for archive
3308         before archive members.
3309         (Incremental_inputs::report_archive_end): Put input file entry
3310         for archive after archive members.
3311         (Incremental_inputs::report_object): Add parameter; track argument
3312         serial numbers and in_system_directory flag.
3313         (Incremental_inputs::report_script): Add parameter; track argument
3314         serial numbers.
3315         (Output_section_incremental_inputs::set_final_data_size): Adjust
3316         size of symbol info entry; check for forwarding symbols.
3317         (Output_section_incremental_inputs::write_input_files): Write
3318         in_system_directory flag and argument serial number.
3319         (Output_section_incremental_inputs::write_info_blocks): Map section
3320         indices between incremental info and original input file; store
3321         input section index for each symbol.
3322         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3323         change operator() to visit().
3324         (class Global_got_offset_visitor): Likewise.
3325         (class Global_symbol_visitor_got_plt):
3326         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3327         classes.
3328         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3329         (Sized_incr_relobj::do_read_symbols): New function.
3330         (Sized_incr_relobj::do_layout): New function.
3331         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3332         (Sized_incr_relobj::do_add_symbols): New function.
3333         (Sized_incr_relobj::do_should_include_member): New function.
3334         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3335         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3336         (Sized_incr_relobj::do_section_size): New function.
3337         (Sized_incr_relobj::do_section_name): New function.
3338         (Sized_incr_relobj::do_section_contents): New function.
3339         (Sized_incr_relobj::do_section_flags): New function.
3340         (Sized_incr_relobj::do_section_entsize): New function.
3341         (Sized_incr_relobj::do_section_address): New function.
3342         (Sized_incr_relobj::do_section_type): New function.
3343         (Sized_incr_relobj::do_section_link): New function.
3344         (Sized_incr_relobj::do_section_info): New function.
3345         (Sized_incr_relobj::do_section_addralign): New function.
3346         (Sized_incr_relobj::do_initialize_xindex): New function.
3347         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3348         (Sized_incr_relobj::do_read_relocs): New function.
3349         (Sized_incr_relobj::do_gc_process_relocs): New function.
3350         (Sized_incr_relobj::do_scan_relocs): New function.
3351         (Sized_incr_relobj::do_count_local_symbols): New function.
3352         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3353         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3354         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3355         (Sized_incr_relobj::do_relocate): New function.
3356         (Sized_incr_relobj::do_set_section_offset): New function.
3357         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3358         (Sized_incr_dynobj::do_read_symbols): New function.
3359         (Sized_incr_dynobj::do_layout): New function.
3360         (Sized_incr_dynobj::do_add_symbols): New function.
3361         (Sized_incr_dynobj::do_should_include_member): New function.
3362         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3363         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3364         (Sized_incr_dynobj::do_section_size): New function.
3365         (Sized_incr_dynobj::do_section_name): New function.
3366         (Sized_incr_dynobj::do_section_contents): New function.
3367         (Sized_incr_dynobj::do_section_flags): New function.
3368         (Sized_incr_dynobj::do_section_entsize): New function.
3369         (Sized_incr_dynobj::do_section_address): New function.
3370         (Sized_incr_dynobj::do_section_type): New function.
3371         (Sized_incr_dynobj::do_section_link): New function.
3372         (Sized_incr_dynobj::do_section_info): New function.
3373         (Sized_incr_dynobj::do_section_addralign): New function.
3374         (Sized_incr_dynobj::do_initialize_xindex): New function.
3375         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3376         (make_sized_incremental_object): New function.
3377         (Incremental_library::copy_unused_symbols): New function.
3378         (Incremental_library::do_for_all_unused_symbols): New function.
3379         * incremental.h (enum Incremental_input_flags): New type.
3380         (class Incremental_checker): Remove.
3381         (Incremental_input_entry::Incremental_input_entry): Add argument
3382         serial number.
3383         (Incremental_input_entry::arg_serial): New function.
3384         (Incremental_input_entry::set_is_in_system_directory): New function.
3385         (Incremental_input_entry::is_in_system_directory): New function.
3386         (Incremental_input_entry::arg_serial_): New data member.
3387         (Incremental_input_entry::is_in_system_directory_): New data member.
3388         (class Script_info): Move here from script.h.
3389         (Script_info::Script_info): Add filename parameter.
3390         (Script_info::filename): New function.
3391         (Script_info::filename_): New data member.
3392         (Incremental_script_entry::Incremental_script_entry): Add argument
3393         serial number.
3394         (Incremental_object_entry::Incremental_object_entry): Likewise.
3395         (Incremental_object_entry::add_input_section): Build list of input
3396         sections with map to original shndx.
3397         (Incremental_object_entry::get_input_section_index): New function.
3398         (Incremental_object_entry::shndx_): New data member.
3399         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3400         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3401         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3402         serial number.
3403         (Incremental_inputs::report_archive_begin): Likewise.
3404         (Incremental_inputs::report_object): Likewise.
3405         (Incremental_inputs::report_script): Likewise.
3406         (class Incremental_global_symbol_reader): New class.
3407         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3408         and store flags and input file type.
3409         (Incremental_input_entry_reader::arg_serial): New function.
3410         (Incremental_input_entry_reader::type): Extract type from flags.
3411         (Incremental_input_entry_reader::is_in_system_directory): New function.
3412         (Incremental_input_entry_reader::get_input_section_count): Call
3413         accessor function for type.
3414         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3415         function for type; adjust size of global symbol entry.
3416         (Incremental_input_entry_reader::get_global_symbol_count): Call
3417         accessor function for type.
3418         (Incremental_input_entry_reader::get_object_count): Likewise.
3419         (Incremental_input_entry_reader::get_object_offset): Likewise.
3420         (Incremental_input_entry_reader::get_member_count): Likewise.
3421         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3422         (Incremental_input_entry_reader::get_member_offset): Likewise.
3423         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3424         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3425         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3426         (Incremental_input_entry_reader::get_global_symbol_reader): New
3427         function.
3428         (Incremental_input_entry_reader::get_output_symbol_index): New
3429         function.
3430         (Incremental_input_entry_reader::type_): Remove.
3431         (Incremental_input_entry_reader::flags_): New data member.
3432         (Incremental_inputs_reader::input_file_offset): New function.
3433         (Incremental_inputs_reader::input_file_index): New function.
3434         (Incremental_inputs_reader::input_file): Call input_file_offset.
3435         (Incremental_inputs_reader::input_file_at_offset): New function.
3436         (Incremental_relocs_reader::get_r_type): Reformat.
3437         (Incremental_relocs_reader::get_r_shndx): Reformat.
3438         (Incremental_relocs_reader::get_r_offset): Reformat.
3439         (Incremental_relocs_reader::data): New function.
3440         (Incremental_binary::Incremental_binary): Initialize new data members.
3441         (Incremental_binary::check_inputs): Add cmdline parameter.
3442         (Incremental_binary::file_is_unchanged): Remove.
3443         (Input_reader::arg_serial): New function.
3444         (Input_reader::get_unused_symbol_count): New function.
3445         (Input_reader::get_unused_symbol): New function.
3446         (Input_reader::do_arg_serial): New function.
3447         (Input_reader::do_get_unused_symbol_count): New function.
3448         (Input_reader::do_get_unused_symbol): New function.
3449         (Incremental_binary::input_file_count): New function.
3450         (Incremental_binary::get_input_reader): Change signature to use
3451         index instead of filename.
3452         (Incremental_binary::file_has_changed): New function.
3453         (Incremental_binary::get_input_argument): New function.
3454         (Incremental_binary::get_library): New function.
3455         (Incremental_binary::get_script_info): New function.
3456         (Incremental_binary::init_layout): New function.
3457         (Incremental_binary::reserve_layout): New function.
3458         (Incremental_binary::output_file): New function.
3459         (Incremental_binary::do_check_inputs): New function.
3460         (Incremental_binary::do_file_is_unchanged): Remove.
3461         (Incremental_binary::do_file_has_changed): New function.
3462         (Incremental_binary::do_init_layout): New function.
3463         (Incremental_binary::do_reserve_layout): New function.
3464         (Incremental_binary::do_input_file_count): New function.
3465         (Incremental_binary::do_get_input_reader): Change signature.
3466         (Incremental_binary::input_args_map_): New data member.
3467         (Incremental_binary::library_map_): New data member.
3468         (Incremental_binary::script_map_): New data member.
3469         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3470         new data members.
3471         (Sized_incremental_binary::output_section): New function.
3472         (Sized_incremental_binary::inputs_reader): Add const.
3473         (Sized_incremental_binary::symtab_reader): Add const.
3474         (Sized_incremental_binary::relocs_reader): Add const.
3475         (Sized_incremental_binary::got_plt_reader): Add const.
3476         (Sized_incremental_binary::get_symtab_view): New function.
3477         (Sized_incremental_binary::Inputs_reader): New typedef.
3478         (Sized_incremental_binary::Input_entry_reader): New typedef.
3479         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3480         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3481         (Sized_incremental_binary::do_file_has_changed): New function.
3482         (Sized_incremental_binary::do_init_layout): New function.
3483         (Sized_incremental_binary::do_reserve_layout): New function.
3484         (Sized_input_reader::Inputs_reader): Remove.
3485         (Sized_input_reader::Input_entry_reader): Remove.
3486         (Sized_input_reader::do_arg_serial): New function.
3487         (Sized_input_reader::do_get_unused_symbol_count): New function.
3488         (Sized_input_reader::do_get_unused_symbol): New function.
3489         (Sized_incremental_binary::do_input_file_count): New function.
3490         (Sized_incremental_binary::do_get_input_reader): Change signature;
3491         use index instead of filename.
3492         (Sized_incremental_binary::section_map_): New data member.
3493         (Sized_incremental_binary::input_entry_readers_): New data member.
3494         (class Sized_incr_relobj): New class.
3495         (class Sized_incr_dynobj): New class.
3496         (make_sized_incremental_object): New function.
3497         (class Incremental_library): New class.
3498         * layout.cc (Free_list::num_lists): New static data member.
3499         (Free_list::num_nodes): New static data member.
3500         (Free_list::num_removes): New static data member.
3501         (Free_list::num_remove_visits): New static data member.
3502         (Free_list::num_allocates): New static data member.
3503         (Free_list::num_allocate_visits): New static data member.
3504         (Free_list::init): New function.
3505         (Free_list::remove): New function.
3506         (Free_list::allocate): New function.
3507         (Free_list::dump): New function.
3508         (Free_list::print_stats): New function.
3509         (Layout_task_runner::run): Resize output file for incremental updates.
3510         (Layout::Layout): Initialize new data members.
3511         (Layout::set_incremental_base): New function.
3512         (Layout::init_fixed_output_section): New function.
3513         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3514         incremental updates.
3515         (Layout::create_gold_note): Do not create gold note section for
3516         incremental updates.
3517         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3518         for incremental updates.
3519         (Layout::set_section_offsets): For incremental updates, allocate space
3520         from free list.
3521         (Layout::create_symtab_sections): Layout with offsets relative to
3522         start of section; for incremental updates, allocate space from free
3523         list.
3524         (Layout::create_shdrs): For incremental updates, allocate space from
3525         free list.
3526         (Layout::finish_dynamic_section): For incremental updates, do not
3527         check --as-needed (fixed in subsequent patch).
3528         * layout.h (class Free_list): New class.
3529         (Layout::set_incremental_base): New function.
3530         (Layout::incremental_base): New function.
3531         (Layout::init_fixed_output_section): New function.
3532         (Layout::allocate): New function.
3533         (Layout::incremental_base_): New data member.
3534         (Layout::free_list_): New data member.
3535         * main.cc (main): Print Free_list statistics.
3536         * object.cc (Relobj::finalize_incremental_relocs): Add
3537         clear_counts parameter; clear counts only when clear_counts is set.
3538         (Sized_relobj::Sized_relobj): Initialize new base class.
3539         (Sized_relobj::do_layout): Don't report special sections.
3540         (Sized_relobj::do_for_all_local_got_entries): New function.
3541         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3542         symtab_off to all symbol table offsets.
3543         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3544         * object.h (class Got_offset_list): Move to top of file.
3545         (Object::Object): Allow case where input_file == NULL.
3546         (Object::~Object): Likewise.
3547         (Object::input_file): Assert that input_file != NULL.
3548         (Object::lock): Allow case where input_file == NULL.
3549         (Object::unlock): Likewise.
3550         (Object::is_locked): Likewise.
3551         (Object::token): Likewise.
3552         (Object::release): Likewise.
3553         (Object::is_incremental): New function.
3554         (Object::get_mtime): New function.
3555         (Object::for_all_local_got_entries): New function.
3556         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3557         (Object::set_is_in_system_directory): New function.
3558         (Object::is_in_system_directory): New function.
3559         (Object::do_is_incremental): New function.
3560         (Object::do_get_mtime): New function.
3561         (Object::do_for_all_local_got_entries): New function.
3562         (Object::is_in_system_directory_): New data member.
3563         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3564         (class Sized_relobj_base): New class.
3565         (class Sized_relobj): Derive from Sized_relobj_base.
3566         (class Sized_relobj::Symbols): Redeclare from base class.
3567         (class Sized_relobj::local_got_offset_list): Remove.
3568         (class Sized_relobj::Output_sections): Redeclare from base class.
3569         (class Sized_relobj::do_for_all_local_got_entries): New function.
3570         (class Sized_relobj::write_local_symbols): Add offset parameter.
3571         (class Sized_relobj::local_symbol_offset_): Update comment.
3572         (class Sized_relobj::local_dynsym_offset_): Update comment.
3573         * options.cc (Input_arguments::add_file): Remove const.
3574         * options.h (Input_file_argument::Input_file_argument):
3575         Initialize arg_serial_ (all constructors).
3576         (Input_file_argument::set_arg_serial): New function.
3577         (Input_file_argument::arg_serial): New function.
3578         (Input_file_argument::arg_serial_): New data member.
3579         (Input_arguments::Input_arguments): Initialize file_count_.
3580         (Input_arguments::add_file): Remove const.
3581         (Input_arguments::number_of_input_files): New function.
3582         (Input_arguments::file_count_): New data member.
3583         (Command_line::number_of_input_files): Call
3584         Input_arguments::number_of_input_files.
3585         * output.cc (Output_segment_headers::Output_segment_headers):
3586         Set current size.
3587         (Output_section::Input_section::current_data_size): New function.
3588         (Output_section::Output_section): Initialize new data members.
3589         (Output_section::add_input_section): Don't do merge sections for
3590         an incremental link; allocate space from free list for an
3591         incremental update.
3592         (Output_section::add_output_section_data): Allocate space from
3593         free list for an incremental update.
3594         (Output_section::update_data_size): New function.
3595         (Output_section::set_fixed_layout): New function.
3596         (Output_section::reserve): New function.
3597         (Output_segment::set_section_addresses): Remove const.
3598         (Output_segment::set_section_list_addresses): Remove const; allocate
3599         space from free list for an incremental update.
3600         (Output_segment::set_offset): Adjust size of RELRO segment for an
3601         incremental update.
3602         * output.h (Output_data::current_data_size): Move here from
3603         child classes.
3604         (Output_data::pre_finalize_data_size): New function.
3605         (Output_data::update_data_size): New function.
3606         (Output_section_headers::update_data_size): new function.
3607         (Output_section_data_build::current_data_size): Move to Output_data.
3608         (Output_data_strtab::update_data_size): New function.
3609         (Output_section::current_data_size): Move to Output_data.
3610         (Output_section::set_fixed_layout): New function.
3611         (Output_section::has_fixed_layout): New function.
3612         (Output_section::reserve): New function.
3613         (Output_section::update_data_size): New function.
3614         (Output_section::has_fixed_layout_): New data member.
3615         (Output_section::free_list_): New data member.
3616         (Output_segment::set_section_addresses): Remove const.
3617         (Output_segment::set_section_list_addresses): Remove const.
3618         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3619         New function.
3620         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3621         New function.
3622         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3623         parameter when calling Add_symbols constructor; store argument
3624         serial number for members of a lib group.
3625         (Add_symbols::locks): Allow case where token == NULL.
3626         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3627         (Read_member::~Read_member): New function.
3628         (Read_member::is_runnable): New function.
3629         (Read_member::locks): New function.
3630         (Read_member::run): New function.
3631         (Check_script::~Check_script): New function.
3632         (Check_script::is_runnable): New function.
3633         (Check_script::locks): New function.
3634         (Check_script::run): New function.
3635         (Check_library::~Check_library): New function.
3636         (Check_library::is_runnable): New function.
3637         (Check_library::locks): New function.
3638         (Check_library::run): New function.
3639         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3640         (Add_symbols::library_): New data member.
3641         (class Read_member): New class.
3642         (class Check_script): New class.
3643         (class Check_library): New class.
3644         * reloc.cc (Read_relocs::is_runnable): Allow case where
3645         token == NULL.
3646         (Read_relocs::locks): Likewise.
3647         (Scan_relocs::locks): Likewise.
3648         (Relocate_task::locks): Likewise.
3649         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3650         to clear counters.
3651         (Sized_relobj::incremental_relocs_scan): Fix comment.
3652         (Sized_relobj::do_relocate): Pass output file offset to
3653         write_local_symbols.
3654         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3655         from class declaration.
3656         * script.cc (read_input_script): Allocate Script_info; pass
3657         argument serial number to report_script.
3658         * script.h (class Script_info): Move to incremental.h.
3659         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3660         * symtab.h (Symbol_table::add_from_incrobj): New function.
3661         (Symbol_table::set_file_offset): New function.
3662
3663 2011-04-05  Cary Coutant  <ccoutant@google.com>
3664
3665         * incremental-dump.cc (dump_incremental_inputs): Change signature
3666         to take a Sized_incremental_binary; change caller.  Use readers
3667         in Sized_incremental_binary.
3668         * incremental.cc
3669         (Sized_incremental_binary::find_incremental_inputs_sections):
3670         Rename do_find_incremental_inputs_sections to this.
3671         (Sized_incremental_binary::setup_readers): New function.
3672         (Sized_incremental_binary::do_check_inputs): Check
3673         has_incremental_info_ flag; move setup code to setup_readers;
3674         use input readers.
3675         (Sized_incremental_binary::do_file_is_unchanged): New function.
3676         (Sized_incremental_binary::do_get_input_reader): New function.
3677         * incremental.h (class Incremental_binary): Move to end of file.
3678         (Incremental_binary::file_is_unchanged): New function.
3679         (Incremental_binary::do_file_is_unchanged): New function.
3680         (Incremental_binary::Input_reader): New class.
3681         (Incremental_binary::get_input_reader): New function.
3682         (class Sized_incremental_binary): Move to end of file.
3683         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3684         input section reader classes.
3685         (Sized_incremental_binary::has_incremental_info): New function.
3686         (Sized_incremental_binary::inputs_reader): New function.
3687         (Sized_incremental_binary::symtab_reader): New function.
3688         (Sized_incremental_binary::relocs_reader): New function.
3689         (Sized_incremental_binary::got_plt_reader): New function.
3690         (Sized_incremental_binary::do_file_is_unchanged): New function.
3691         (Sized_incremental_binary::Sized_input_reader): New class.
3692         (Sized_incremental_binary::get_input_reader): New function.
3693         (Sized_incremental_binary::find_incremental_inputs_sections):
3694         Rename do_find_incremental_inputs_sections to this.
3695         (Sized_incremental_binary::setup_readers): New function.
3696         (Sized_incremental_binary::has_incremental_info_): New data member.
3697         (Sized_incremental_binary::inputs_reader_): New data member.
3698         (Sized_incremental_binary::symtab_reader_): New data member.
3699         (Sized_incremental_binary::relocs_reader_): New data member.
3700         (Sized_incremental_binary::got_plt_reader_): New data member.
3701         (Sized_incremental_binary::current_input_file_): New data member.
3702
3703 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3704
3705         PR gold/12640
3706         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3707         violation.
3708
3709 2011-03-30  Cary Coutant  <ccoutant@google.com>
3710
3711         * archive.cc (Archive::include_member): Adjust call to report_object.
3712         (Add_archive_symbols::run): Add script_info to call to
3713         report_archive_begin.
3714         (Lib_group::include_member): Adjust call to report_object.
3715         (Add_lib_group_symbols::run): Adjust call to report_object.
3716         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3717         blocks.  Add object count for script input files.
3718         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3719         script_info parameter; change all callers.
3720         (Incremental_inputs::report_object): Add script_info parameter;
3721         change all callers.
3722         (Incremental_inputs::report_script): Store backpointer to
3723         incremental info entry.
3724         (Output_section_incremental_inputs::set_final_data_size): Record
3725         additional information for scripts.
3726         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3727         * incremental.h (Incremental_script_entry::add_object): New function.
3728         (Incremental_script_entry::get_object_count): New function.
3729         (Incremental_script_entry::get_object): New function.
3730         (Incremental_script_entry::objects_): New data member; adjust
3731         constructor.
3732         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3733         (Incremental_inputs::report_object): Add script_info parameter.
3734         (Incremental_inputs_reader::get_object_count): New function.
3735         (Incremental_inputs_reader::get_object_offset): New function.
3736         * options.cc (Input_arguments::add_file): Return reference to
3737         new input argument.
3738         * options.h (Input_argument::set_script_info): New function.
3739         (Input_argument::script_info): New function.
3740         (Input_argument::script_info_): New data member; adjust all
3741         constructors.
3742         (Input_file_group::add_file): Return reference to new input argument.
3743         (Input_file_lib::add_file): Likewise.
3744         (Input_arguments::add_file): Likewise.
3745         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3746         * script.cc (Parser_closure::Parser_closure): Add script_info
3747         parameter; adjust all callers.
3748         (Parser_closure::script_info): New function.
3749         (Parser_closure::script_info_): New data member.
3750         (read_input_script): Report scripts earlier to incremental info.
3751         (script_add_file): Set script_info in Input_argument.
3752         (script_add_library): Likewise.
3753         * script.h (Script_options::Script_info): Rewrite class.
3754
3755 2011-03-29  Cary Coutant  <ccoutant@google.com>
3756
3757         * archive.cc (Library_base::should_include_member): Move
3758         method here from class Archive.
3759         (Archive::Archive): Initialize base class.
3760         (Archive::should_include_member): Move to base class.
3761         (Archive::do_for_all_unused_symbols): New function.
3762         (Add_archive_symbols::run): Remove redundant access to
3763         incremental_inputs.
3764         (Lib_group::Lib_group): Initialize base class.
3765         (Lib_group::do_filename): New function.
3766         (Lib_group::include_member): Pass pointer to Lib_group to
3767         report_object.
3768         (Lib_group::do_for_all_unused_symbols): New function.
3769         (Add_lib_group_symbols::run): Report archive information for
3770         incremental links.
3771         * archive.h (class Library_base): New base class.
3772         (class Archive): Derive from Library_base.
3773         (Archive::filename): Move to base class.
3774         (Archive::set_incremental_info): Likewise.
3775         (Archive::incremental_info): Likewise.
3776         (Archive::Should_include): Likewise.
3777         (Archive::should_include_member): Likewise.
3778         (Archive::Armap_entry): Remove.
3779         (Archive::Unused_symbol_iterator): Remove.
3780         (Archive::unused_symbols_begin): Remove.
3781         (Archive::unused_symbols_end): Remove.
3782         (Archive::do_filename): New function.
3783         (Archive::do_get_mtime): New function.
3784         (Archive::do_for_all_unused_symbols): New function.
3785         (Archive::task_): Move to base class.
3786         (Archive::incremental_info_): Likewise.
3787         (class Lib_group): Derive from Library_base.
3788         (Lib_group::do_filename): New function.
3789         (Lib_group::do_get_mtime): New function.
3790         (Lib_group::do_for_all_unused_symbols): New function.
3791         (Lib_group::task_): Move to base class.
3792         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3793         function.
3794         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3795         function.
3796         * incremental.cc (Incremental_inputs::report_archive_begin):
3797         Use Library_base; call library's get_mtime; add incremental inputs
3798         entry before members.
3799         (class Unused_symbol_visitor): New class.
3800         (Incremental_inputs::report_archive_end): Use Library_base; use
3801         visitor class to record unused symbols; don't add incremental inputs
3802         entry after members.
3803         (Incremental_inputs::report_object): Use Library_base.
3804         * incremental.h
3805         (Incremental_archive_entry::Incremental_archive_entry): Remove
3806         unused Archive parameter.
3807         (Incremental_inputs::report_archive_begin): Use Library_base.
3808         (Incremental_inputs::report_archive_end): Likewise.
3809         (Incremental_inputs::report_object): Likewise.
3810         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3811         function.
3812         * object.h (Object::for_all_global_symbols): New function.
3813         (Object::do_for_all_global_symbols): New function.
3814         (Sized_relobj::do_for_all_global_symbols): New function.
3815         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3816         function.
3817         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3818         function.
3819
3820 2011-03-27  Ian Lance Taylor  <iant@google.com>
3821
3822         * archive.cc (Archive::interpret_header): Return -1 if something
3823         goes wrong.  Change callers accordingly.
3824
3825 2011-03-25  Cary Coutant  <ccoutant@google.com>
3826
3827         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3828         * testsuite/Makefile.in: Regenerate.
3829
3830 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3831
3832         * plugin.cc (get_view): New.
3833         (Plugin::load): Pass get_view to the plugin.
3834         (Plugin_manager::get_view): New.
3835
3836 2011-03-21  Ian Lance Taylor  <iant@google.com>
3837
3838         * testsuite/final_layout.sh: Rewrite to not use dc.
3839         * testsuite/relro_test.sh: Fail if dc is not present.
3840
3841 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3842
3843         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3844         Change == to -eq.
3845         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3846         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3847         Change == to -eq.
3848         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3849         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3850
3851 2011-03-14  Ian Lance Taylor  <iant@google.com>
3852
3853         * script-sections.cc (Sort_output_sections::script_compare):
3854         Rename from is_before, change return type.
3855         (Sort_output_sections::operator()): Adjust accordingly.
3856
3857 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3858
3859         PR gold/12572
3860         * testsuite/odr_violation2.cc: Add comment to make all error line
3861         numbers double digits.
3862         * testsuite/debug_msg.sh: Adjust expected errors.
3863
3864 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3865
3866         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3867         but mark earlier ones as non-canonical
3868         (offset_to_iterator): Update search target and example
3869         (do_addr2line): Return extra lines in a vector*
3870         (format_file_lineno): Extract from do_addr2line
3871         (one_addr2line): Add vector* out-param
3872         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3873         when a lineno entry appeared last for its instruction
3874         (Dwarf_line_info): Add vector* out-param
3875         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3876         * symtab.cc (Odr_violation_compare): Include the lineno in the
3877         comparison again.
3878         (linenos_from_loc): New. Combine the canonical line for an
3879         address with its other lines.
3880         (True_if_intersect): New. Helper functor to make
3881         std::set_intersection a query.
3882         (detect_odr_violations): Compare sets of lines instead of just
3883         one line for each function. This became less deterministic, but
3884         has fewer false positives.
3885         * symtab.h: Declarations.
3886         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3887         mix an optimized and non-optimized object in the same binary
3888         (odr_violation2.so): Same.
3889         * testsuite/Makefile.in: Regenerate from Makefile.am.
3890         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3891         * testsuite/debug_msg.sh: Update line numbers and add
3892         assertions.
3893         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3894         non-optimized context.
3895         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3896         isn't inlined, and use OdrDerived in an optimized context.
3897         * testsuite/odr_header1.h: Defines OdrDerived, where
3898         optimization will change the
3899         first-instruction-in-the-destructor's file and line number.
3900         * testsuite/odr_header2.h: Defines OdrBase.
3901
3902 2011-03-09  Ian Lance Taylor  <iant@google.com>
3903
3904         * fileread.cc (File_read::clear_views): Don't delete the whole
3905         file view.
3906
3907 2011-03-08  Ian Lance Taylor  <iant@google.com>
3908
3909         PR gold/12525
3910         * fileread.cc: #include <climits>.
3911         (GOLD_IOV_MAX): Define.
3912         (File_read::read_multiple): Limit number of entries by iov_max.
3913         * fileread.h (class File_read): Always set max_readv_entries to
3914         128.
3915
3916 2011-03-07  Ian Lance Taylor  <iant@google.com>
3917
3918         PR gold/12525
3919         * options.h (class General_options): Add -dy and -dn.
3920
3921 2011-03-02  Cary Coutant  <ccoutant@google.com>
3922
3923         * testsuite/script_test_9.t: Add TLS segment.
3924
3925 2011-03-02  Simon Baldwin  <simonb@google.com>
3926
3927         * configure.ac: Add check for gnu_indirect_function support in
3928         the toolchain building binutils.
3929         * configure: Rebuild.
3930
3931 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3932
3933         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3934         plugin only symbols.
3935         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3936         in plugin files as not needed in the symbol table.
3937
3938 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3939
3940         * output.cc (Output_section::add_input_section): Delay fill
3941         generation for section ordering.
3942
3943 2011-02-09  Ian Lance Taylor  <iant@google.com>
3944
3945         PR gold/12316
3946         * object.h (class Sized_relobj): Remove clear_local_symbols.
3947         * reloc.cc (Sized_relobj::do_relocate): Don't call
3948         clear_local_symbols.
3949
3950 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3951
3952         * plugin.cc (is_visible_from_outside): Return true for symbols
3953         in the -u option.
3954
3955 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3956
3957         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3958         filename.
3959
3960 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3961
3962         * icf.h (is_section_foldable_candidate): Change type of parameter
3963         to std::string.
3964         * icf.cc (Icf::find_identical_sections): Change type of local variable
3965         section_name to be std::string.
3966         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3967
3968 2011-01-25  Ian Lance Taylor  <iant@google.com>
3969
3970         * script.cc (script_add_extern): Rewrite to use
3971         add_symbol_reference.
3972
3973 2011-01-25  Doug Kwan  <dougkwan@google.com>
3974
3975         * icf.cc (get_section_contents): Always lock section's object.
3976
3977 2011-01-24  Ian Lance Taylor  <iant@google.com>
3978
3979         * options.h (class General_options): Accept
3980         --no-detect-odr-violations.
3981
3982 2011-01-24  Ian Lance Taylor  <iant@google.com>
3983
3984         * version.cc (version_string): Bump to 1.11.
3985
3986 2011-01-24  Ian Lance Taylor  <iant@google.com>
3987
3988         * plugin.cc (class Plugin_rescan): Define new class.
3989         (Plugin_manager::claim_file): Set any_claimed_.
3990         (Plugin_manager::save_archive): New function.
3991         (Plugin_manager::save_input_group): New function.
3992         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3993         necessary.
3994         (Plugin_manager::new_undefined_symbol): New function.
3995         (Plugin_manager::rescan): New function.
3996         (Plugin_manager::rescannable_defines): New function.
3997         (Plugin_manager::add_input_file): Set any_added_.
3998         * plugin.h (class Plugin_manager): define new fields rescannable_,
3999         undefined_symbols_, any_claimed_, and any_added_.  Declare
4000         Plugin_rescan as friend.  Declare new functions.
4001         (Plugin_manager::Rescannable): Define type.
4002         (Plugin_manager::Rescannable_list): Define type.
4003         (Plugin_manager::Undefined_symbol_list): Define type.
4004         (Plugin_manager::Plugin_manager): Initialize new fields.
4005         * archive.cc (Archive::defines_symbol): New function.
4006         (Add_archive_symbols::run): Pass archive to plugins if any.
4007         * archive.h (class Archive): Declare defines_symbol.
4008         * readsyms.cc (Input_group::~Input_group): New function.
4009         (Finish_group::run): Pass input_group to plugins if any.
4010         * readsyms.h (class Input_group): Declare destructor.
4011         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4012         any.
4013
4014 2011-01-10  Ian Lance Taylor  <iant@google.com>
4015
4016         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4017         section as relro.
4018         (Layout::set_segment_offsets): Reset increase_relro before calling
4019         set_section_addresses a second time.
4020
4021 2011-01-04  Cary Coutant  <ccoutant@google.com>
4022
4023         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4024         sections before NOBITS sections.
4025
4026 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4027
4028         * version.cc (print_version): Update copyright to 2011.
4029
4030 2010-12-23  Cary Coutant  <ccoutant@google.com>
4031
4032         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4033         of OS to this->add.  Add OD parameter to second form of the function.
4034
4035 2010-12-20  Ian Lance Taylor  <iant@google.com>
4036
4037         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4038         second of two consecutive entries with same offset.
4039
4040 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4041
4042         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4043         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4044         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4045         to avoid unneeded links against $(LDADD).
4046         * testsuite/Makefile.in: Regenerate.
4047
4048 2010-12-15  Ian Lance Taylor  <iant@google.com>
4049
4050         PR gold/12324
4051         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4052         for R_X86_64_32 and R_X86_64_PC32.
4053         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4054         ver_matching_def_pic.o.
4055         (ver_matching_def_pic.o): New target.
4056
4057 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4058
4059         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4060         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4061         Move definition before File_read::View member definitions.
4062         (File_read::View::~View): Initialize and hold lock before
4063         updating current_mapped_bytes.
4064
4065 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4066
4067         * dwarf_reader.cc: Remove outdated comment.
4068         * gold-threads.cc: Fix typo in error message.
4069         * archive.cc: Fix typos in comments.
4070         * archive.h: Likewise.
4071         * arm-reloc-property.cc: Likewise.
4072         * arm-reloc-property.h: Likewise.
4073         * arm-reloc.def: Likewise.
4074         * arm.cc: Likewise.
4075         * attributes.h: Likewise.
4076         * cref.cc: Likewise.
4077         * ehframe.cc: Likewise.
4078         * fileread.h: Likewise.
4079         * gold.h: Likewise.
4080         * i386.cc: Likewise.
4081         * icf.cc: Likewise.
4082         * incremental.h: Likewise.
4083         * int_encoding.cc: Likewise.
4084         * layout.h: Likewise.
4085         * main.cc: Likewise.
4086         * merge.h: Likewise.
4087         * object.cc: Likewise.
4088         * object.h: Likewise.
4089         * options.cc: Likewise.
4090         * readsyms.cc: Likewise.
4091         * reduced_debug_output.cc: Likewise.
4092         * reloc.cc: Likewise.
4093         * script-sections.cc: Likewise.
4094         * sparc.cc: Likewise.
4095         * symtab.h: Likewise.
4096         * target-reloc.h: Likewise.
4097         * target.cc: Likewise.
4098         * target.h: Likewise.
4099         * timer.cc: Likewise.
4100         * timer.h: Likewise.
4101         * x86_64.cc: Likewise.
4102
4103 2010-12-09  Cary Coutant  <ccoutant@google.com>
4104
4105         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4106         stack.
4107         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4108         parameter; change all callers.
4109         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4110         * options.h (warn_execstack): New option.
4111
4112 2010-12-07  Doug Kwan  <dougkwan@google.com>
4113
4114         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4115         like function call relocations.
4116
4117 2010-12-07  Ian Lance Taylor  <iant@google.com>
4118
4119         * archive.cc (Archive::get_elf_object_for_member): Permit
4120         punconfigured to be NULL.
4121         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4122         (Archive::include_member): Pass NULL to get_elf_object_for_member
4123         if we searched for the archive and this is the first included
4124         object.
4125
4126 2010-12-01  Ian Lance Taylor  <iant@google.com>
4127
4128         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4129         track_relocs_type_ field.
4130         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4131         Set track_relocs_type_.
4132         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4133         contents when using RELA relocs.
4134         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4135         reloc_map_.
4136         * reloc.cc (Track_relocs::next_addend): New function.
4137         * reloc.h (class Track_relocs): Declare next_addend.
4138
4139 2010-12-01  Ian Lance Taylor  <iant@google.com>
4140
4141         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4142         virtual destructor.
4143
4144 2010-12-01  Ian Lance Taylor  <iant@google.com>
4145
4146         * README: Update compilers known to work and fail.
4147
4148 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4149
4150         * configure.in: For --enable-gold, handle value `default' instead of
4151         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4152         not the default.
4153         * configure: Regenerate.
4154
4155 2010-11-18  Doug Kwan  <dougkwan@google.com>
4156
4157         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4158         and right_alignment to be zero.  Store result alignment only if it is
4159         greater than existing alignment.
4160
4161 2010-11-16  Cary Coutant  <ccoutant@google.com>
4162
4163         PR gold/12220
4164         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4165         Check for ".zdebug_line".
4166
4167 2010-11-16  Doug Kwan  <dougkwan@google.com>
4168             Cary Coutant  <ccoutant@google.com>
4169
4170         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4171         by reference; adjust all callers.
4172         * output.cc (Output_segment::set_section_addresses): Adjust references
4173         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4174         list is empty.
4175         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4176         end at page boundary.
4177
4178 2010-11-16  Cary Coutant  <ccoutant@google.com>
4179
4180         PR gold/12220
4181         * layout.cc (Layout::choose_output_section): Transform names of
4182         compressed sections even when using a script with a SECTIONS clause.
4183         (Layout::output_section_name): Remove code to transform
4184         compressed debug section names.
4185         * output.cc (Output_section::add_input_section): Use uncompressed
4186         section size when tracking input sections.
4187
4188 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4189
4190         * symtab.h (Symbol::NON_PIC_REF): Remove.
4191         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4192         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4193         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4194         (Symbol::use_plt_offset): Take a flags argument and pass it
4195         directly to needs_dynamic_reloc.  Restrict check for undefined
4196         weak symbols to function calls.
4197         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4198         (Target_arm::Scan::global): Use it.
4199         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4200         (Target_arm::Relocate::relocate): Likewise.
4201         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4202         parameter with an r_type parameter.  Use get_reference_flags
4203         to get the flags.
4204         (Target_arm::Relocate::relocate): Update accordingly.
4205         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4206         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4207         (Target_i386::Scan::global): Likewise.
4208         (Target_i386::Relocate::relocate): Likewise.
4209         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4210         parameter with an r_type parameter.  Use get_reference_flags
4211         to get the flags.
4212         (Target_i386::Relocate::relocate): Update accordingly.
4213         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4214         (Target_powerpc::Scan::global): Use it.
4215         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4216         (Target_powerpc::Relocate::relocate): Likewise.
4217         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4218         (Target_sparc::Scan::global): Use it.
4219         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4220         (Target_sparc::Relocate::relocate): Likewise.
4221         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4222         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4223         (Target_x86_64::Scan::global): Likewise.
4224         (Target_x86_64::Relocate::relocate): Likewise.
4225
4226 2010-11-08  Doug Kwan  <dougkwan@google.com>
4227             Cary Coutant  <ccoutant@google.com>
4228
4229         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4230         (Arm_exidx_merge_section::section_contents_): New data member.
4231         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4232         (Arm_input_section::~Arm_input_section): De-allocate memory.
4233         (Arm_input_section::original_contents_): New data member.
4234         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4235         in parameters instead of calling Object::section_contents without
4236         locking.
4237         (Arm_output_section::group_section): New parameter TASK.  Pass it
4238         to callees that need locking objects.
4239         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4240         to lock EXIDX input sections.  Fix a formatting issue.  Call
4241         Arm_exidx_merged_section::build_contents to create merged section
4242         contents.
4243         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4244         to lock object of stub table owner.
4245         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4246         TEXT_SIZE to initialize data member TEXT_SIZE_.
4247         (Arm_exidx_input_section::addralign): Fix typo in comment.
4248         (Arm_exidx_input_section::text_size): New method.
4249         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4250         that require locking objects.  Lock objects before scanning for stubs
4251         and updating local symbols.
4252         (Arm_input_section<big_endian>::init): Copy contents of original
4253         input section.
4254         (Arm_input_section<big_endian>::do_write): Use saved contents of
4255         original input section instead of calling Object::section_contents
4256         without locking.
4257         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4258         size without calling Object::section_size().
4259         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4260         for size.  Allocate a buffer for merged EXIDX entries.
4261         (Arm_exidx_merged_section::build_contents): New method.
4262         (Arm_exidx_merged_section::do_write): Move merge section contents
4263         building code to Arm_exidx_merged_section::build_contetns.  Write
4264         out contetns in buffer instead of building it on the fly.
4265         (Arm_relobj::make_exidx_input_section): Also pass text section size
4266         to Arm_exidx_input_section constructor.
4267         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4268         (Arm_dynobj::do_read_symbols): Fix memory leak.
4269         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4270         * target.h: (class Task): Add forward declaration.
4271         (Target::relax): Add new parameter TASK and pass it to
4272         Target::do_relax().
4273         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4274
4275 2010-11-05  Cary Coutant  <ccoutant@google.com>
4276
4277         PR gold/10708
4278         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4279         object when reading from the file.
4280         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4281         second layout pass.
4282         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4283         when reading section contents.
4284         (get_section_contents): Likewise.
4285         (icf::find_identical_sections): Likewise.
4286         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4287         object when reading from the file.
4288         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4289         the object when doing deferred section layout.
4290
4291 2010-11-03  Nick Clifton  <nickc@redhat.com>
4292
4293         PR gold/12001
4294         * script.h (class Symbol_assignment: name): New member.  Returns
4295         the name of the symbol.
4296         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4297         Returns true if the given symbol name is on the list of
4298         assignments wating to be processed.
4299         * archive.cc (should_incldue_member): If the symbol is undefined,
4300         check to see if it is on the list of symbols pending assignment.
4301
4302 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4303
4304         * script-sections.cc (Script_sections::find_memory_region): Check
4305         for a NULL output section pointer.
4306
4307 2010-10-29  Doug Kwan  <dougkwan@google.com>
4308
4309         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4310         Output_section::add_relaxed_input_section.
4311         * output.cc (Output_section::add_relaxed_input_section): Add new
4312         arguments LAYOUT and NAME.  Set section order index.
4313         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4314         Copy section order index.
4315         * output.h (Output_section::add_relaxed_input_section): Add new
4316         arguments LAYOUT and NAME.
4317
4318 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4319
4320         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4321         NATIVE_OR_CROSS_LINKER.
4322         * testsuite/Makefile.in: Regenerate.
4323
4324 2010-10-20  Doug Kwan  <dougkwan@google.com>
4325
4326         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4327         without SHF_LINK_ORDER flags.
4328         * layout.cc (Layout::choose_output_section): Do not filter
4329         SHF_LINK_ORDER flag in a relocatable link.
4330
4331 2010-10-17  Cary Coutant  <ccoutant@google.com>
4332
4333         * output.h (Output_segment::set_section_addresses): Change function
4334         signature.  Update all callers.
4335         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4336         sections.
4337         (Output_segment::set_section_addresses): Align after last TLS
4338         section.  Add padding before last relro section instead of after.
4339
4340 2010-10-17  Doug Kwan  <dougkwan@google.com>
4341
4342         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4343         GOT output section to be writable.
4344
4345 2010-10-14  Cary Coutant  <ccoutant@google.com>
4346
4347         * debug.h (DEBUG_INCREMENTAL): New flag.
4348         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4349         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4350         mode.
4351         * incremental.cc (report_command_line): Ignore all forms of
4352         --incremental.
4353         * layout.cc (Layout::Layout): Check parameters for incremental link
4354         mode.
4355         * options.cc (General_options::parse_incremental): New function.
4356         (General_options::parse_no_incremental): New function.
4357         (General_options::parse_incremental_full): New function.
4358         (General_options::parse_incremental_update): New function.
4359         (General_options::incremental_mode_): New data member.
4360         (General_options::finalize): Check incremental_mode_.
4361         * options.h (General_options): Update help text for --incremental.
4362         Add --no-incremental, --incremental-full, --incremental-update.
4363         (General_options::Incremental_mode): New enum type.
4364         (General_options::incremental_mode): New function.
4365         (General_options::incremental_mode_): New data member.
4366         * parameters.cc (Parameters::incremental_mode_): New data member.
4367         (Parameters::set_options): Set incremental_mode_.
4368         (Parameters::set_incremental_full): New function.
4369         (Parameters::incremental): New function.
4370         (Parameters::incremental_update): New function.
4371         (set_parameters_incremental_full): New function.
4372         * parameters.h (Parameters::set_incremental_full): New function.
4373         (Parameters::incremental): New function.
4374         (Parameters::incremental_update): New function.
4375         (Parameters::incremental_mode_): New data member.
4376         (set_parameters_incremental_full): New function.
4377         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4378         incremental link mode.
4379         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4380         (Sized_relobj::do_relocate_sections): Likewise.
4381         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4382         option.
4383         * testsuite/Makefile.in: Regenerate.
4384         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4385
4386 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4387
4388         * script-sections.h (class Script_sections): Make
4389         Sections_elements typedef public.
4390         * script-sections.cc (class Sort_output_sections): Add elements_
4391         field.  Add constructor which sets it; change all callers.
4392         (Sort_output_sections::is_before): New function.
4393         (Sort_output_sections::operator()): Call is_before.
4394         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4395         conditional.
4396         * testsuite/script_test_10.sh: New test. Test script section
4397         order.
4398         * testsuite/script_test_10.t: Likewise.
4399         * testsuite/script_test_10.s: Likewise.
4400         * testsuite/Makefile.am: Wrap the cross linker tests and the
4401         common tests into NATIVE_OR_CROSS_LINKER.
4402         (check_SCRIPTS): Add script_test_10.sh.
4403         (check_DATA): Add script_test_10.stdout.
4404         (script_test_10.o, script_test_10): New targets.
4405         (script_test_10.stdout): New target.
4406         * configure, testsuite/Makefile.in: Regenerate.
4407
4408 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4409
4410         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4411         error for the deprecated relocations.
4412         (Target_arm::Scan::global): Likewise.
4413         (Target_arm::Relocate::relocate): Likewise.
4414
4415 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4416
4417         * fileread.cc (Input_file::find_file): Initialize *found_name
4418         and *namep when using the fallback search for case 4.
4419
4420 2010-10-11  Cary Coutant  <ccoutant@google.com>
4421
4422         * options.h (class General_options): Redefine -z lazy as an alias for
4423         the negation of -z now.
4424
4425 2010-10-11  Ian Lance Taylor  <iant@google.com>
4426
4427         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4428         binding.
4429
4430 2010-10-06  Nick Clifton  <nickc@redhat.com>
4431
4432         * script-sections.cc(class Memory_region): Remove
4433         current_lma_offset_ field.  Rename current_vma_offset_ to
4434         current_offset_.  Add last_section_ field.
4435         (Memory_region::get_current_vma_address): Rename to
4436         get_current_address.
4437         (Memory_region::get_current_lma_address): Delete.
4438         (Memory_region::increment_vma_offset): Rename to
4439         increment_offset.
4440         (Memory_region::increment_lma_offset): Delete.
4441         (Memory_region::attributes_compatible): New method.  Returns
4442         true if the provided section is compatible with the region.
4443         (Memory_region::get_last_section): New method.  Returns the last
4444         section to use the region.
4445         (Memory_region::set_last_section): New method.  Stores the last
4446         section to use the region.
4447         (Script_sections::block_in_region): New method.  Returns true if
4448         a block of memory is contained within a region.
4449         (Script_sections::find_memory_region): New method.  Locates a
4450         memory region to be used to set a VMA or LMA address.
4451         (Output_section_definition::set_section_addresses): Add code to
4452         check for addresses set by memory regions.
4453         (Output_segment::set_section_addresses): Remove memory region
4454         walking code.
4455         (Script_sections::create_segment): Add a warning if a header
4456         segment is created outside of any region.
4457         * script-sections.h (class Script_sections): Add prototypes for
4458         find_memory_region and block_in_region methods.
4459         * testsuite/memory_test.s: Use .long instead of .word.
4460         * testsuite/memory_test.t: Add some more output sections.
4461         * testsuite/memory_test.sh: Update expected output.
4462
4463 2010-10-02  Doug Kwan  <dougkwan@google.com>
4464
4465         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4466         defintion to symtab.h
4467         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4468         declaration to defintion.
4469
4470 2010-10-01  Nick Clifton  <nickc@redhat.com>
4471
4472         * expression.cc (eval): Replace dummy argument with NULL.
4473         (eval_maybe_dot): Check for a NULL result section pointer.
4474         (Symbol_expression::value): Likewise.
4475         (Dot_expression::value): Likewise.
4476         (BINARY_EXPRESSION): Likewise.
4477         (Max_expression::value): Likewise.
4478         (Min_expression::value): Likewise.
4479         (Absolute_expression::value): Likewise.
4480         (Addr_expression::value_from_output_section): Likewise.
4481         (Loaddddr_expression::value_from_output_section): Likewise.
4482         (Segment_start_expression::value): Likewise.
4483         * script-sections.cc
4484         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4485         argument with NULL.
4486         (Sections_elememt_dot_assignment::set_section_addresses):
4487         Likewise.
4488         (Output_data_expression::do_write_to_buffer): Likewise.
4489         (Output_section_definition::finalize_symbols): Likewise.
4490         (Output_section_definition::set_section_addresses): Likewise.
4491
4492 2010-09-30  Doug Kwan  <dougkwan@google.com>
4493
4494         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4495
4496 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4497
4498         * target.h (Target::can_icf_inline_merge_sections): New virtual
4499         function.
4500         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4501         virtual function.
4502         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4503         virtual function.
4504         * icf.cc (get_section_contents): Inline merge sections only when
4505         target allows it.
4506
4507 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4508
4509         * configure: Regenerate.
4510
4511 2010-09-17  Ian Lance Taylor  <iant@google.com>
4512
4513         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4514         * testsuite/Makefile.am (memory_test.o): New target.
4515         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4516         memory_test.t.
4517         * testsuite/Makefile.in: Rebuild.
4518
4519 2010-09-17  Doug Kwan  <dougkwan@google.com>
4520
4521         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4522         defintion if relocation uses GOT entries of the symbol.
4523         * testsuite/icf_safe_test.sh: Fix test.
4524         * testsuite/icf_safe_so_test.sh: Fix test.
4525
4526 2010-09-16  Cary Coutant  <ccoutant@google.com>
4527
4528         * script_sections.cc (class Memory_region): Remove "NULL" from
4529         vector initializations.
4530
4531 2010-09-15  Cary Coutant  <ccoutant@google.com>
4532
4533         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4534         Resolve forwarding symbols.
4535
4536 2010-09-15  Doug Kwan  <dougkwan@google.com>
4537
4538         * gold/testsuite/script_test_3.t: Add ARM special sections.
4539         * gold/testsuite/script_test_4.t: Same.
4540         * gold/testsuite/script_test_5.t: Same.
4541         * gold/testsuite/script_test_6.t: Same.
4542         * gold/testsuite/script_test_7.t: Same.
4543         * gold/testsuite/script_test_7.t: Same.
4544         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4545
4546 2010-09-14  Cary Coutant  <ccoutant@google.com>
4547
4548         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4549         (Target_x86_64::Relocate::relocate_tls): Replace check for
4550         saw_tls_block_reloc_ with test for executable section.
4551
4552 2010-09-12  Cary Coutant  <ccoutant@google.com>
4553
4554         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4555         position-independent executables to shared libraries need dynamic
4556         relocations.
4557         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4558         position-independent executables.
4559         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4560         * testsuite/Makefile.in: Regenerate.
4561
4562 2010-09-10  Nick Clifton  <nickc@redhat.com>
4563
4564         PR gold/11997
4565         * testsuite/memory_test.t: Discard any sections that are not
4566         needed.
4567
4568 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4569
4570         PR gold/11996
4571         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4572         "This::" to work around a bug in gcc 4.2.
4573
4574         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4575
4576 2010-09-09  Rafael Espindola  <espindola@google.com>
4577
4578         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4579         sections with different PF_X flags in the same segment.
4580         (Layout::find_first_load_seg): Search all segments to find the first
4581         one.
4582         * options.h (rosegment): New.
4583
4584 2010-09-08  Rafael Espindola  <espindola@google.com>
4585
4586         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4587
4588 2010-09-08  Doug Kwan  <dougkwan@google.com>
4589
4590         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4591         (Arm_relobj::do_relocate_sections): Add new parameter for output
4592         file to match the parent.
4593         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4594         of local symbols instead of input values.  Update code to track
4595         changes in gold::relocate_section.
4596         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4597         (Sized_relobj::compute_final_local_value_internal): New methods.
4598         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4599         body into private version of Sized_relobj::compute_final_local_value.
4600         Call the inline method.
4601         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4602         merged symbol value if there is one.
4603         (Symbol_value::has_output_value): New method defintiion.
4604         (Sized_relobj::Compute_final_local_value_status): New enum type.
4605         (Sized_relobj::compute_final_local_value): New methods.
4606         (Sized_relobj::compute_final_local_value_internal): New methods.
4607         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4608         and arm_cortex_a8.sh.
4609         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4610         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4611         New tests.
4612         * Makefile.in: Regenerate.
4613         * testsuite/arm_bl_out_of_range.s: Update test.
4614         * testsuite/thumb_bl_out_of_range.s: Ditto.
4615         * testsuite/thumb_blx_out_of_range.s: Ditto.
4616         * testsuite/arm_branch_out_of_range.sh: New file.
4617         * testsuite/arm_cortex_a8.sh: Ditto.
4618         * testsuite/arm_cortex_a8_b.s: Ditto.
4619         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4620         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4621         * testsuite/arm_cortex_a8_bl.s: Ditto.
4622         * testsuite/arm_cortex_a8_blx.s: Ditto.
4623         * testsuite/arm_cortex_a8_local.s: Ditto.
4624         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4625         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4626
4627 2010-09-08  Rafael Espindola  <espindola@google.com>
4628
4629         * Makefile.am (memory_test.stdout): Run readelf with -W.
4630         * Makefile.in: Regenerate.
4631         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4632         64 bit output.
4633
4634 2010-09-08  Rafael Espindola  <espindola@google.com>
4635
4636         * script-sections.cc (Script_sections::add_memory_region): Convert
4637         field precision to int.
4638         * script.cc (script_set_section_region, script_set_section_region):
4639         Convert field precision to int.
4640
4641 2010-09-08  Rafael Espindola  <espindola@google.com>
4642
4643         * arm.cc (do_finalize_sections): Create the __exidx_start and
4644         __exdix_end symbols even when the section is missing.
4645
4646 2010-09-08  Nick Clifton  <nickc@redhat.com>
4647
4648         * README: Remove claim that MEMORY is not supported.
4649         * expression.cc (script_exp_function_origin)
4650         (script_exp_function_length): Move from here to ...
4651         * script.cc: ... here.
4652         (script_set_section_region, script_add_memory)
4653         (script_parse_memory_attr, script_include_directive): New
4654         functions.
4655         * script-sections.cc
4656         (class Memory_region): New class.
4657         (class Output_section_definition): Add set_memory_region,
4658         set_section_vma, set_section_lma and get_section_name methods.
4659         (class Script_Sections): Add add_memory_region,
4660         find_memory_region, find_memory_region_origin,
4661         find_memory_region_length and set_memory_region methods.
4662         Have set_section_addresses method walk the list of set memory
4663         regions.
4664         Extend the print methos to display memory regions.
4665         * script-sections.h: Add prototypes for new methods.
4666         Add enum for MEMORY region attributes.
4667         * yyscript.y: Add support for parsing MEMORY regions.
4668         * script-c.h: Add prototypes for new functions.
4669         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4670         * testsuite/Makefile.in: Regenerate.
4671         * testsuite/memory_test.sh: New script.
4672         * testsuite/memory_test.s: New assembler source file.
4673         * testsuite/memory_test.t: New linker script.
4674
4675 2010-08-27  Doug Kwan  <dougkwan@google.com>
4676
4677         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4678         reference override an existing dynamic weak reference.
4679         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4680         * testsuite/Makefile.in: Regenerate.
4681         * testsuite/dyn_weak_ref.sh: New file.
4682         * testsuite/dyn_weak_ref_1.c: Ditto.
4683         * testsuite/dyn_weak_ref_2.c: Ditto.
4684
4685 2010-08-27  Ian Lance Taylor  <iant@google.com>
4686
4687         * incremental.h (class Incremental_input_entry): Add virtual
4688         destructor.
4689
4690 2010-08-27  Ian Lance Taylor  <iant@google.com>
4691
4692         * testsuite/start_lib_test_3.c: Mark t3 as used.
4693
4694 2010-08-27  Nick Clifton  <nickc@redhat.com>
4695
4696         * options.cc (version_script): Fix small typo in previous
4697         whitespace tidyup.
4698
4699 2010-08-25  Nick Clifton  <nickc@redhat.com>
4700
4701         * archive.cc: Formatting fixes: Remove whitespace between
4702         typename and following asterisk.  Remove whitespace between
4703         function name and opening parenthesis.
4704         * archive.h: Likewise.
4705         * arm.cc: Likewise.
4706         * attributes.cc: Likewise.
4707         * attributes.h: Likewise.
4708         * common.cc: Likewise.
4709         * copy-relocs.cc: Likewise.
4710         * dirsearch.h: Likewise.
4711         * dynobj.cc: Likewise.
4712         * ehframe.cc: Likewise.
4713         * ehframe.h: Likewise.
4714         * expression.cc: Likewise.
4715         * fileread.cc: Likewise.
4716         * fileread.h: Likewise.
4717         * gc.h: Likewise.
4718         * gold-threads.cc: Likewise.
4719         * gold.cc: Likewise.
4720         * i386.cc: Likewise.
4721         * icf.h: Likewise.
4722         * incremental-dump.cc: Likewise.
4723         * incremental.cc: Likewise.
4724         * layout.cc: Likewise.
4725         * layout.h: Likewise.
4726         * main.cc: Likewise.
4727         * merge.cc: Likewise.
4728         * merge.h: Likewise.
4729         * object.cc: Likewise.
4730         * object.h: Likewise.
4731         * options.cc: Likewise.
4732         * options.h: Likewise.
4733         * output.cc: Likewise.
4734         * output.h: Likewise.
4735         * plugin.cc: Likewise.
4736         * plugin.h: Likewise.
4737         * powerpc.cc: Likewise.
4738         * reloc.cc: Likewise.
4739         * script-c.h: Likewise.
4740         * script-sections.cc: Likewise.
4741         * script.cc: Likewise.
4742         * stringpool.cc: Likewise.
4743         * symtab.cc: Likewise.
4744         * symtab.h: Likewise.
4745         * target.cc: Likewise.
4746         * timer.cc: Likewise.
4747         * timer.h: Likewise.
4748         * version.cc: Likewise.
4749         * x86_64.cc: Likewise.
4750
4751 2010-08-24  Nick Clifton  <nickc@redhat.com>
4752
4753         PR 11899
4754         * layout.cc (segment_precedes): Sort segments by their physical
4755         addresses, if they have been set.
4756
4757 2010-08-23  Cary Coutant  <ccoutant@google.com>
4758
4759         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4760         symbols data.
4761         (Lib_group::include_member): Unlock object after deleting its
4762         symbols data.
4763         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4764         the bug fixed here.
4765
4766 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4767             Cary Coutant  <ccoutant@google.com>
4768
4769         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4770         constructor, and set_blocker.
4771         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4772         readsyms_blocker_.
4773         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4774         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4775         * testsuite/Makefile.am (start_lib_test): New test case.
4776         * testsuite/Makefile.in: Regenerate.
4777         * testsuite/start_lib_test_main.c: New file.
4778         * testsuite/start_lib_test_1.c: New file.
4779         * testsuite/start_lib_test_2.c: New file.
4780         * testsuite/start_lib_test_3.c: New file.
4781
4782 2010-08-19  Ian Lance Taylor  <iant@google.com>
4783
4784         * Makefile.in: Rebuild with automake 1.11.1.
4785         * aclocal.m4: Likewise.
4786         * testsuite/Makefile.in: Likewise.
4787
4788 2010-08-19  Ian Lance Taylor  <iant@google.com>
4789
4790         PR 10893
4791         * i386.cc (class Output_data_plt_i386): Update declarations.
4792         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4793         local_ifuncs_ fields.
4794         (Target_i386::do_plt_section_for_global): New function.
4795         (Target_i386::do_plt_section_for_local): New function.
4796         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4797         parameter; change all callers.  Initialize global_ifuncs_ and
4798         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4799         __rel_iplt_end.
4800         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4801         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4802         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4803         symbols.
4804         (Target_i386::make_plt_section): New function, broken out of
4805         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4806         (Target_i386::make_plt_entry): Call make_plt_section.
4807         (Target_i386::make_local_ifunc_plt_entry): New function.
4808         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4809         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4810         R_386_IRELATIVE to switch.
4811         (Target_i386::Scan::global): Likewise.
4812         (Target_i386::Relocate::relocate): Likewise.
4813         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4814         switch.
4815         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4816         (Target_x86_64::do_plt_section_for_global): New function.
4817         (Target_x86_64::do_plt_section_for_local): New function.
4818         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4819         parameter; change all callers.  If doing a static link define
4820         __rela_iplt_start and __rela_iplt_end.
4821         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4822         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4823         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4824         to point to .plt.
4825         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4826         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4827         switch.
4828         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4829         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4830         R_X86_64_IRELATIVE to switch.
4831         (Target_x86_64::Scan::global): Likewise.
4832         (Target_x86_64::Relocate::relocate): Likewise.
4833         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4834         switch.
4835         * target.h (class Target): Add plt_section_for_global and
4836         plt_section_for_local functions.  Add do_plt_section_for_global
4837         and do_plt_section_for_local virtual functions.
4838         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4839         clarifying comments.
4840         (Symbol::use_plt_offset): Handle IFUNC symbol.
4841         * object.cc (Sized_relobj::Sized_relobj): Initialize
4842         local_plt_offsets_.
4843         (Sized_relobj::local_has_plt_offset): New function.
4844         (Sized_relobj::local_plt_offset): New function.
4845         (Sized_relobj::set_local_plt_offset): New function.
4846         (Sized_relobj::do_count): Handle IFUNC symbol.
4847         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4848         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4849         is_ifunc_symbol functions.
4850         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4851         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4852         local_plt_offsets_ field.
4853         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4854         * output.h (class Output_section_data): Add non-const
4855         output_section function.
4856         (class Output_data_got): Update declarations.
4857         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4858         Add use_plt_offset parameter to global and local constructors.
4859         Change all callers.  Change local_sym_index_ field to 31 bits.
4860         Change GSYM_CODE and CONSTANT_CODE accordingly.
4861         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4862         doing a static link don't set sh_link field.
4863         (Output_data_got::Got_entry::write): Use PLT offset if
4864         appropriate.
4865         (Output_data_got::add_global_plt): New function.
4866         (Output_data_got::add_local_plt): New function.
4867         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4868         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4869         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4870         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4871         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4872         IFUNC conditional.
4873         * testsuite/ifunc-sel.h: New file.
4874         * testsuite/ifuncmain1.c: New file.
4875         * testsuite/ifuncmain1vis.c: New file.
4876         * testsuite/ifuncmod1.c: New file.
4877         * testsuite/ifuncdep2.c: New file.
4878         * testsuite/ifuncmain2.c: New file.
4879         * testsuite/ifuncmain3.c: New file.
4880         * testsuite/ifuncmod3.c: New file.
4881         * testsuite/ifuncmain4.c: New file.
4882         * testsuite/ifuncmain5.c: New file.
4883         * testsuite/ifuncmod5.c: New file.
4884         * testsuite/ifuncmain6pie.c: New file.
4885         * testsuite/ifuncmod6.c: New file.
4886         * testsuite/ifuncmain7.c: New file.
4887         * configure, testsuite/Makefile.in: Rebuild.
4888
4889 2010-08-18  Ian Lance Taylor  <iant@google.com>
4890
4891         * incremental.cc
4892         (Output_section_incremental_inputs::write_input_files): Add cast
4893         to avoid signed/unsigned comparison warning.
4894         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4895
4896 2010-08-12  Cary Coutant  <ccoutant@google.com>
4897
4898         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4899
4900 2010-08-13  Ian Lance Taylor  <iant@google.com>
4901
4902         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4903
4904 2010-08-12  Cary Coutant  <ccoutant@google.com>
4905             Doug Kwan  <dougkwan@google.com>
4906
4907         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4908         defintion overrides non-weak undef, remember that the original undef
4909         is not weak.
4910         * symtab.cc (Symbol_table::sized_write_global): For undef without
4911         an original weak binding, set binding to global in output.
4912         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4913         * testsuite/Makefile.in: Regenerate.
4914         * testsuite/strong_ref_weak_def.sh: New file.
4915         * testsuite/strong_ref_weak_def_1.c: Ditto.
4916         * testsuite/strong_ref_weak_def_2.c: Ditto.
4917
4918 2010-08-12  Cary Coutant  <ccoutant@google.com>
4919
4920         * testsuite/incremental_test.sh: Rewrite.
4921         * testsuite/incremental_test_1.c: Rewrite.
4922         * testsuite/incremental_test_2.c: Rewrite.
4923
4924 2010-08-12  Cary Coutant  <ccoutant@google.com>
4925
4926         * arm.cc (Target_arm::got_size): Add const.
4927         (Target_arm::got_entry_count): New function.
4928         (Target_arm::plt_entry_count): New function.
4929         (Target_arm::first_plt_entry_offset): New function.
4930         (Target_arm::plt_entry_size): New function.
4931         (Output_data_plt_arm::entry_count): New function.
4932         (Output_data_plt_arm::first_plt_entry_offset): New function.
4933         (Output_data_plt_arm::get_plt_entry_size): New function.
4934         * i386.cc (Target_i386::got_size): Add const.
4935         (Target_i386::got_entry_count): New function.
4936         (Target_i386::plt_entry_count): New function.
4937         (Target_i386::first_plt_entry_offset): New function.
4938         (Target_i386::plt_entry_size): New function.
4939         (Output_data_plt_i386::entry_count): New function.
4940         (Output_data_plt_i386::first_plt_entry_offset): New function.
4941         (Output_data_plt_i386::get_plt_entry_size): New function.
4942         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4943         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4944         * incremental.cc: Include target.h.
4945         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4946         parameter.  Adjust all callers.  Find incremental_got_plt section.
4947         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4948         section.
4949         (Output_section_incremental_inputs::set_final_data_size): Calculate
4950         size of incremental_got_plt section.
4951         (Output_section_incremental_inputs::do_write): Write the
4952         incremental_got_plt section.
4953         (Got_plt_view_info): New struct.
4954         (Local_got_offset_visitor): New class.
4955         (Global_got_offset_visitor): New class.
4956         (Global_symbol_visitor_got_plt): New class.
4957         (Output_section_incremental_inputs::write_got_plt): New function.
4958         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4959         Add parameter.  Adjust all callers.
4960         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4961         (Incremental_inputs::got_plt_section): New function.
4962         (Incremental_inputs::got_plt_section_): New data member.
4963         (Incremental_got_plt_reader): New class.
4964         * layout.cc (Layout::create_incremental_info_sections): Add the
4965         incremental_got_plt section.
4966         * object.h (Got_offset_list::get_list): New function.
4967         (Got offset_list::for_all_got_offsets): New function.
4968         (Sized_relobj::local_got_offset_list): New function.
4969         * powerpc.cc (Target_powerpc::got_size): Add const.
4970         (Target_powerpc::got_entry_count): New function.
4971         (Target_powerpc::plt_entry_count): New function.
4972         (Target_powerpc::first_plt_entry_offset): New function.
4973         (Target_powerpc::plt_entry_size): New function.
4974         (Output_data_plt_powerpc::entry_count): New function.
4975         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4976         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4977         * sparc.cc (Target_sparc::got_size): Add const.
4978         (Target_sparc::got_entry_count): New function.
4979         (Target_sparc::plt_entry_count): New function.
4980         (Target_sparc::first_plt_entry_offset): New function.
4981         (Target_sparc::plt_entry_size): New function.
4982         (Output_data_plt_sparc::entry_count): New function.
4983         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4984         (Output_data_plt_sparc::get_plt_entry_size): New function.
4985         * symtab.h (Symbol::got_offset_list): New function.
4986         (Symbol_table::for_all_symbols): New function.
4987         * target.h (Sized_target::got_entry_count): New function.
4988         (Sized_target::plt_entry_count): New function.
4989         (Sized_target::plt_entry_size): New function.
4990         * x86_64.cc (Target_x86_64::got_size): Add const.
4991         (Target_x86_64::got_entry_count): New function.
4992         (Target_x86_64::plt_entry_count): New function.
4993         (Target_x86_64::first_plt_entry_offset): New function.
4994         (Target_x86_64::plt_entry_size): New function.
4995         (Output_data_plt_x86_64::entry_count): New function.
4996         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4997         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4998
4999 2010-08-12  Cary Coutant  <ccoutant@google.com>
5000
5001         * archive.cc: Include incremental.h.
5002         (Archive::Archive): Initialize incremental_info_.
5003         (Archive::include_member): Record archive members in incremental info.
5004         (Add_archive_symbols::run): Record begin and end of an archive in
5005         incremental info.
5006         (Lib_group::include_member): Record objects in incremental info.
5007         * archive.h (Incremental_archive_entry): Forward declaration.
5008         (Archive::set_incremental_info): New member function.
5009         (Archive::incremental_info): New member function.
5010         (Archive::Unused_symbol_iterator): New class.
5011         (Archive::unused_symbols_begin): New member function.
5012         (Archive::unused_symbols_end): New member function.
5013         (Archive::incremental_info_): New data member.
5014         * incremental-dump.cc (find_input_containing_global): New function.
5015         (dump_incremental_inputs): Dump new incremental info sections.
5016         * incremental.cc: Include symtab.h.
5017         (Output_section_incremental_inputs): New class.
5018         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5019         new incremental info sections.
5020         (Sized_incremental_binary::do_check_inputs): Likewise.
5021         (Incremental_inputs::report_archive): Remove.
5022         (Incremental_inputs::report_archive_begin): New function.
5023         (Incremental_inputs::report_archive_end): New function.
5024         (Incremental_inputs::report_object): New function.
5025         (Incremental_inputs::finalize_inputs): Remove.
5026         (Incremental_inputs::report_input_section): New function.
5027         (Incremental_inputs::report_script): Rewrite.
5028         (Incremental_inputs::finalize): Do nothing but finalize string table.
5029         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5030         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5031         (Incremental_inputs::create_data_sections): New function.
5032         (Incremental_inputs::relocs_entsize): New function.
5033         (Output_section_incremental_inputs::set_final_data_size): New function.
5034         (Output_section_incremental_inputs::do_write): New function.
5035         (Output_section_incremental_inputs::write_header): New function.
5036         (Output_section_incremental_inputs::write_input_files): New function.
5037         (Output_section_incremental_inputs::write_info_blocks): New function.
5038         (Output_section_incremental_inputs::write_symtab): New function.
5039         * incremental.h (Incremental_script_entry): Forward declaration.
5040         (Incremental_object_entry): Forward declaration.
5041         (Incremental_archive_entry): Forward declaration.
5042         (Incremental_inputs): Forward declaration.
5043         (Incremental_inputs_header_data): Remove.
5044         (Incremental_inputs_header): Remove.
5045         (Incremental_inputs_header_write): Remove.
5046         (Incremental_inputs_entry_data): Remove.
5047         (Incremental_inputs_entry): Remove.
5048         (Incremental_inputs_entry_write): Remove.
5049         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5050         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5051         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5052         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5053         Likewise.
5054         (Incremental_input_entry): New class.
5055         (Incremental_script_entry): New class.
5056         (Incremental_object_entry): New class.
5057         (Incremental_archive_entry): New class.
5058         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5059         (Incremental_inputs::report_inputs): Remove.
5060         (Incremental_inputs::report_archive): Remove.
5061         (Incremental_inputs::report_archive_begin): New function.
5062         (Incremental_inputs::report_archive_end): New function.
5063         (Incremental_inputs::report_object): Change prototype.
5064         (Incremental_inputs::report_input_section): New function.
5065         (Incremental_inputs::report_script): Change prototype.
5066         (Incremental_inputs::get_reloc_count): New function.
5067         (Incremental_inputs::set_reloc_count): New function.
5068         (Incremental_inputs::create_data_sections): New function.
5069         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5070         (Incremental_inputs::inputs_section): New function.
5071         (Incremental_inputs::symtab_section): New function.
5072         (Incremental_inputs::relocs_section): New function.
5073         (Incremental_inputs::get_stringpool): Add const.
5074         (Incremental_inputs::command_line): Add const.
5075         (Incremental_inputs::inputs): Remove.
5076         (Incremental_inputs::command_line_key): New function.
5077         (Incremental_inputs::input_file_count): New function.
5078         (Incremental_inputs::input_files): New function.
5079         (Incremental_inputs::relocs_entsize): New function.
5080         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5081         (Incremental_inputs::finalize_inputs): Remove.
5082         (Incremental_inputs::Input_info): Remove.
5083         (Incremental_inputs::lock_): Remove.
5084         (Incremental_inputs::inputs_): Change type.
5085         (Incremental_inputs::inputs_map_): Remove.
5086         (Incremental_inputs::current_object_entry_): New data member.
5087         (Incremental_inputs::inputs_section_): New data member.
5088         (Incremental_inputs::symtab_section_): New data member.
5089         (Incremental_inputs::relocs_section_): New data member.
5090         (Incremental_inputs::reloc_count_): New data member.
5091         (Incremental_inputs_reader): New class.
5092         (Incremental_symtab_reader): New class.
5093         (Incremental_relocs_reader): New class.
5094         * layout.cc (Layout::finalize): Move finalization of incremental info
5095         and creation of incremental info sections to follow finalization of
5096         symbol table.  Set offsets for postprocessing sections.
5097         (Layout::create_incremental_info_sections): Call
5098         Incremental_inputs::create_data_sections.  Add incremental symtab
5099         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5100         sections to layout after input sections.
5101         * layout.h (struct Timespec): Forward declaration.
5102         (Layout::incremental_inputs): Add const.
5103         (Layout::create_incremental_info_sections): Add parameter.
5104         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5105         * object.cc: Include incremental.h.
5106         (Relobj::finalize_incremental_relocs): New function.
5107         (Sized_relobj::do_layout): Record input sections in incremental info.
5108         * object.h (Object::output_section): New function.
5109         (Object::output_section_offset): Moved from Relobj.
5110         (Object::get_incremental_reloc_base): New function.
5111         (Object::get_incremental_reloc_count): New function.
5112         (Object::do_output_section): New function.
5113         (Object::do_output_section_offset): Moved from Relobj.
5114         (Object::do_get_incremental_reloc_base): New function.
5115         (Object::do_get_incremental_reloc_count): New function.
5116         (Object::Object): Initialize new data members.
5117         (Relobj::output_section): Renamed do_output_section and moved to
5118         protected.
5119         (Relobj::output_section_offset): Moved to Object.
5120         (Relobj::do_get_incremental_reloc_base): New function.
5121         (Relobj::do_get_incremental_reloc_count): New function.
5122         (Relobj::allocate_incremental_reloc_counts): New function.
5123         (Relobj::count_incremental_reloc): New function.
5124         (Relobj::finalize_incremental_relocs): New function.
5125         (Relobj::next_incremental_reloc_index): New function.
5126         (Relobj::reloc_counts_): New data member.
5127         (Relobj::reloc_bases_): New data member.
5128         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5129         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5130         (Sized_relobj::incremental_relocs_scan): New function.
5131         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5132         (Sized_relobj::incremental_relocs_write): New function.
5133         (Sized_relobj::incremental_relocs_write_reltype): New function.
5134         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5135         incremental link.
5136         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5137         archives and object files elsewhere.
5138         (Add_symbols::run): Report object files here.
5139         (Finish_group::run): Report end of archive at end of group.
5140         * reloc.cc: Include layout.h, incremental.h.
5141         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5142         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5143         (Sized_relobj::incremental_relocs_scan): New function.
5144         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5145         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5146         (Sized_relobj::incremental_relocs_write): New function.
5147         (Sized_relobj::incremental_relocs_write_reltype): New function.
5148         * script.cc (read_input_script): Rewrite test for incremental link.
5149         Change call to Incremental_inputs::report_script.
5150         * symtab.h (Symbol_table::first_global_index): New function.
5151         (Symbol_table::output_count): New function.
5152
5153 2010-08-12  Doug Kwan  <dougkwan@google.com>
5154
5155         * arm.cc (Target_arm::merge_object_attributes): Check command line
5156         options --no-wchar-size-warning and --no-enum-size-warning.
5157         * options.h (General_options): Add ld-compatible options
5158         --no-enum-size-warning and --no-wchar-size-warning.
5159
5160 2010-08-04  Ian Lance Taylor  <iant@google.com>
5161
5162         * x86_64.cc (Target_x86_64::Scan::local): Use
5163         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5164         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5165         (Target_x86_64::Scan::global): Likewise.
5166         (Target_x86_64::Relocate::relocate): Likewise.
5167         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5168         Likewise.
5169
5170 2010-08-03  Cary Coutant  <ccoutant@google.com>
5171
5172         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5173         to reserve space in merged_strings vector. Keep total input size
5174         for stats.
5175         (Output_merge_string::do_print_merge_stats): Print total input size.
5176         * merge.h (Output_merge_string): Add input_size_ field.
5177         * stringpool.cc (Stringpool_template::string_length): Move
5178         implementations out of Stringpool_template class and place in
5179         stringpool.h.
5180         * stringpool.h (string_length): Move out of Stringpool_template.
5181
5182 2010-08-03  Ian Lance Taylor  <iant@google.com>
5183
5184         PR 11712
5185         * layout.cc (relaxation_loop_body): If address of load segment is
5186         set, adjust address to include headers if possible.
5187
5188 2010-08-03  Ian Lance Taylor  <iant@google.com>
5189
5190         * version.cc (version_string): Bump to 1.10.
5191
5192 2010-08-03  Ian Lance Taylor  <iant@google.com>
5193
5194         PR 11805
5195         * layout.h (enum Output_section_order): Define.
5196         (class Layout): Update declarations.
5197         * layout.cc (Layout::get_output_section): Add order parameter.
5198         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5199         is_first_non_relro parameters.  Change all callers.
5200         (Layout::choose_output_section): Likewise.
5201         (Layout::add_output_section_data): Likewise.
5202         (Layout::make_output_section): Likewise.  Set order.
5203         (Layout::default_section_order): New function.
5204         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5205         * output.cc (Output_section::Output_section): Initialize order_.
5206         Don't initialize deleted fields.
5207         (Output_segment::Output_segment): Don't initialize deleted
5208         fields.
5209         (Output_segment::add_output_section_to_load): New function
5210         replacing add_output_section.  Change all callers to call this or
5211         add_output_section_to_nonload.
5212         (Output_segment::add_output_section_to_nonload): New function.
5213         (Output_segment::remove_output_section): Rewrite.
5214         (Output_segment::add_initial_output_data): Likewise.
5215         (Output_segment::has_any_data_sections): Likewise.
5216         (Output_segment::is_first_section_relro): Likewise.
5217         (Output_segment::maximum_alignment): Likewise.
5218         (Output_segment::has_dynamic_reloc): New function replacing
5219         dynamic_reloc_count.  Change all callers.
5220         (Output_segment::has_dynamic_reloc_list): New function replacing
5221         dynamic_reloc_count_list.  Change all callers.
5222         (Output_segment::set_section_addresses): Rewrite.
5223         (Output_segment::set_offset): Rewrite.
5224         (Output_segment::find_first_and_last_list): Remove.
5225         (Output_segment::set_tls_offsets): Rewrite.
5226         (Output_segment::first_section_load_address): Likewise.
5227         (Output_segment::output_section_count): Likewise.
5228         (Output_segment::section_with_lowest_load_address): Likewise.
5229         (Output_segment::write_section_headers): Likewise.
5230         (Output_segment::print_sections_to_map): Likewise.
5231         * output.h (class Output_data): Remove dynamic_reloc_count_
5232         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5233         (Output_data::add_dynamic_reloc): Rewrite.
5234         (Output_data::has_dynamic_reloc): New function.
5235         (Output_data::dynamic_reloc_count): Remove.
5236         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5237         is_last_relro_, is_first_non_relro_, is_interp_,
5238         is_dynamic_linker_section_ fields.  Add order and set_order
5239         functions.  Remove is_relro_local, set_is_relro_local,
5240         is_last_relro, set_is_last_relro, is_first_non_relro,
5241         set_is_first_non_relro functions, is_interp, set_is_interp,
5242         is_dynamic_linker_section, and set_is_dynamic_linker_section
5243         functions.
5244         (class Output_segment): Change Output_data_list from std::list to
5245         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5246         output_bss_ fields.  Update declarations.
5247
5248 2010-08-02  Ian Lance Taylor  <iant@google.com>
5249
5250         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5251         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5252         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5253
5254 2010-08-02  Ian Lance Taylor  <iant@google.com>
5255
5256         PR 11855
5257         * script.cc (Script_options::Script_options): Initialize
5258         symbol_definitions_ and symbol_references_.
5259         (Script_options::add_symbol_assignment): Update
5260         symbol_definitions_ and symbol_references_.
5261         (Script_options::add_symbol_reference): New function.
5262         (script_symbol): New function.
5263         * script.h (class Script_options): Add symbol_definitions_ and
5264         symbol_references_ fields.
5265         (Script_options::referenced_const_iterator): New type.
5266         (Script_options::referenced_begin): New function.
5267         (Script_options::referenced_end): New function.
5268         (Script_options::is_referenced): New function.
5269         (Script_options::any_unreferenced): New function.
5270         * script-c.h (script_symbol): Declare.
5271         * yyscript.y (exp): Call script_symbol.
5272         * symtab.cc: Include "script.h".
5273         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5274         Change all callers.  Check symbols referenced by scripts.
5275         (Symbol_table::add_undefined_symbols_from_command_line): Add
5276         layout parameter.  Change all callers.
5277         (Symbol_table::do_add_undefined_symbols_from_command_line):
5278         Likewise.  Break out loop body.  Check symbols referenced by
5279         scripts.
5280         (Symbol_table::add_undefined_symbol_from_command_line): New
5281         function broken out of
5282         do_add_undefined_symbols_from_command_line.
5283         * symtab.h (class Symbol_table): Update declarations.
5284         * archive.cc: Include "layout.h".
5285         (Archive::should_include_member): Add layout parameter.  Change
5286         all callers.  Check for symbol mentioned in expression.
5287         * archive.h (class Archive): Update declaration.
5288         * object.cc (Sized_relobj::do_should_include_member): Add layout
5289         parameter.
5290         * object.h (Object::should_include_member): Add layout parameter.
5291         Change all callers.
5292         (Object::do_should_include_member): Add layout parameter.
5293         (class Sized_relobj): Update declaration.
5294         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5295         parameter.
5296         * dynobj.h (class Sized_dynobj): Update declaration.
5297         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5298         layout parameter.
5299         * plugin.h (class Sized_pluginobj): Update declaration.
5300
5301 2010-08-02  Ian Lance Taylor  <iant@google.com>
5302
5303         PR 11866
5304         * output.cc (Output_segment::set_offset): Search for the first and
5305         last sections rather than assuming that the list is in order.
5306         (Output_segment::find_first_and_last_list): New function.
5307         * output.h (class Output_segment): Update declarations.
5308         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5309         (relro_strip_test_SOURCES): New variable.
5310         (relro_strip_test_DEPENDENCIES): New variable.
5311         (relro_strip_test_LDFLAGS): New variable.
5312         (relro_strip_test_LDADD): New variable.
5313         (relro_strip_test.so): New target.
5314
5315 2010-08-02  Ian Lance Taylor  <iant@google.com>
5316
5317         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5318         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5319         (Target_i386::got_tlsdesc_section): New function.
5320         (Target_i386::got_section): Create space for GOT entries for
5321         TLSDESC relocations.
5322         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5323         R_386_TLS_GOTDESC.
5324         (Target_i386::Scan::global): Likewise.
5325         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5326         using TLSDESC GOT.
5327         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5328         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5329         (Target_x86_64::got_tlsdesc_section): New function.
5330         (Target_x86_64::got_section): Create space for GOT entries for
5331         TLSDESC relocations.
5332         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5333         R_386_TLS_GOTDESC.
5334         (Target_x86_64::Scan::global): Likewise.
5335         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5336         using TLSDESC GOT.
5337
5338 2010-08-02  Ian Lance Taylor  <iant@google.com>
5339
5340         * testsuite/final_layout.sh: Use dc to convert from hex to
5341         decimal.
5342
5343 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5344
5345         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5346         paramter to the call to gold::gc_process_relocs.
5347         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5348         paramter to the call to gold::gc_process_relocs.
5349         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5350         parameter to the call to gold::gc_process_relocs.
5351         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5352         template parameter to the call to gold::gc_process_relocs.
5353         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5354         paramter to the call to gold::gc_process_relocs.
5355         * gc.h (get_embedded_addend_size): New function.
5356         (gc_process_relocs): Save the size of the reloc for use by ICF.
5357         * icf.cc (get_section_contents): Get the addend from the text section
5358         for SHT_REL relocation sections.
5359         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5360         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5361         * int_encoding.h (read_from_pointer): New overloaded function.
5362         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5363         * testsuite/icf_sht_rel_addend_test.sh: New file.
5364         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5365         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5366
5367 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5368
5369         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5370         * Makefile.in: Regenerate.
5371         * testsuite/Makefile.in: Regenerate.
5372
5373 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5374
5375         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5376         * gold/testsuite/debug_msg.cc: Likewise.
5377         * gold/testsuite/odr_violation1.cc
5378         * gold/testsuite/odr_violation2.cc
5379
5380 2010-07-21  Cary Coutant  <ccoutant@google.com>
5381
5382         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5383         string, and length fields.
5384         (Output_merge_string::Merged_strings_list): New type.
5385         (Output_merge_string::Merged_strings_lists): New typedef.
5386         (Output_merge_string): Replace merged_strings_ with
5387         merged_strings_lists_.
5388         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5389         Merged_strings_list per input object and section.  Don't store pointer
5390         to the string.  Don't store length with each merged string entry.
5391         (Output_merge_string::finalize_merged_data): Loop over list of merged
5392         strings lists.  Recompute length of each merged string.
5393
5394 2010-07-15  Cary Coutant  <ccoutant@google.com>
5395
5396         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5397         here.
5398
5399 2010-07-14  Ian Lance Taylor  <iant@google.com>
5400
5401         * descriptors.cc (Descriptors::open): Report correct name in error
5402         message.
5403
5404 2010-07-13  Doug Kwan  <dougkwan@google.com>
5405
5406         * arm.cc (Arm_input_section::Arm_input_section): For a
5407         SHT_ARM_EXIDX section, always keeps the input sections.
5408         (Arm_input_section::set_exidx_section_link): New method.
5409         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5410         has_errors_ to false.
5411         (Arm_exidx_input_section::has_errors,
5412         Arm_exidx_input_section::set_has_errors): New methods.
5413         (Arm_exidx_input_section::has_errors_): New data member.
5414         (Arm_relobj::get_exidx_shndx_list): New method.
5415         (Arm_output_section::append_text_sections_to_list): Do not skip
5416         section without SHF_EXECINSTR.
5417         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5418         errors.
5419         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5420         section header.  Make error messages more verbose.  Check for
5421         a non-executable section linked to an EXIDX section.
5422         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5423         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5424         check that there is no deferred EXIDX section if we exit early.
5425         Instead of not making an EXIDX section in case of an error, make one
5426         and set the has_errors flag of it.
5427         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5428         in a relocatable link.
5429         (Target_arm::do_relax): Look for the EXIDX output section instead of
5430         assuming that it is called .ARM.exidx.
5431         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5432         section list.  Do not check for SHF_EXECINSTR section flags but
5433         skip any input section with errors.
5434         * output.cc (Output_section::Output_section): Initialize
5435         always_keeps_input_sections_ to false.
5436         (Output_section::add_input_section): Check for
5437         always_keeps_input_sections_.
5438         *  output.h (Output_section::always_keeps_input_sections,
5439         Output_section::set_always_keeps_input_sections): New methods.
5440         (Output_section::always_keeps_input_sections): New data member.
5441
5442 2010-07-13  Rafael Espindola  <espindola@google.com>
5443
5444         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5445         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5446
5447 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5448             Ian Lance Taylor  <iant@google.com>
5449
5450         * output.h (Output_section_lookup_maps::add_merge_section):
5451         Correct check of whether value was inserted.
5452         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5453         (Output_section_lookup_maps::add_relaxed_input_section):
5454         Likewise.
5455         * arm.cc (Target_arm::got_section): Remove used local os.
5456         * i386.cc (Target_i386::got_section): Likewise.
5457         * x86_64.cc (Target_x86_64::got_section): Likewise.
5458         * sparc.cc (Target_sparc::got_section): Likewise.
5459         (Target_sparc::relocate): Remove unused local have_got_offset.
5460         * powerpc.cc (Target_powerpc::relocate): Likewise.
5461
5462 2010-07-13  Ian Lance Taylor  <iant@google.com>
5463
5464         * compressed_output.cc (zlib_decompress): Fix signature in
5465         !HAVE_ZLIB_H case.
5466
5467         * archive.cc (Archive::include_member): Unlock an external member
5468         of a thin archive.  Don't bother to delete an object we know is
5469         NULL.
5470
5471 2010-07-12  Cary Coutant  <ccoutant@google.com>
5472
5473         * compressed_output.cc (zlib_decompress): New function.
5474         (get_uncompressed_size): New function.
5475         (decompress_input_section): New function.
5476         * compressed_output.h (get_uncompressed_size): New function.
5477         (decompress_input_section): New function.
5478         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5479         Handle compressed debug sections.
5480         * layout.cc (is_compressed_debug_section): New function.
5481         (Layout::output_section_name): Map compressed section names to
5482         canonical names.
5483         * layout.h (is_compressed_debug_section): New function.
5484         (is_debug_info_section): Recognize compressed debug sections.
5485         * merge.cc: Include compressed_output.h.
5486         (Output_merge_data::do_add_input_section): Handle compressed
5487         debug sections.
5488         (Output_merge_string::do_add_input_section): Handle compressed
5489         debug sections.
5490         * object.cc: Include compressed_output.h.
5491         (Sized_relobj::Sized_relobj): Initialize new data members.
5492         (build_compressed_section_map): New function.
5493         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5494         * object.h (Object::section_is_compressed): New method.
5495         (Object::do_section_is_compressed): New method.
5496         (Sized_relobj::Compressed_section_map): New type.
5497         (Sized_relobj::do_section_is_compressed): New method.
5498         (Sized_relobj::compressed_sections_): New data member.
5499         * output.cc (Output_section::add_input_section): Handle compressed
5500         debug sections.
5501         * reloc.cc: Include compressed_output.h.
5502         (Sized_relobj::write_sections): Handle compressed debug sections.
5503
5504 2010-07-08  Cary Coutant  <ccoutant@google.com>
5505
5506         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5507         weak when resolving to a dynamic def.
5508         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5509         for weak undef/dynamic def cases. Adjust callers.
5510         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5511         undef_binding_weak_.
5512         (Symbol_table::sized_write_globals): Adjust symbol binding.
5513         (Symbol_table::sized_write_symbol): Add binding parameter.
5514         * symtab.h (Symbol::set_undef_binding): New method.
5515         (Symbol::is_undef_binding_weak): New method.
5516         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5517         (Symbol_table::should_override): Add new parameter.
5518         (Symbol_table::sized_write_symbol): Add new parameter.
5519
5520         * testsuite/weak_undef_file1.cc: Add new test case.
5521         * testsuite/weak_undef_file2.cc: Fix header comment.
5522         * testsuite/weak_undef_test.cc: Add new test case.
5523
5524 2010-06-29  Doug Kwan  <dougkwan@google.com>
5525
5526         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5527         Initialize USE_SYMBOL_.
5528         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5529         definition.
5530         (Arm_reloc_property::uses_symbol_): New data member declaration.
5531         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5532         uses symbol value and symbol is undefined but not weakly undefined.
5533
5534 2010-06-28  Rafael Espindola  <espindola@google.com>
5535
5536         * plugin.cc (Plugin::load): Use dlerror.
5537
5538 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5539
5540         * symtab.cc (detect_odr_violations): When reporting an ODR
5541         violation, report an object where the symbol is defined.
5542
5543 2010-06-25  Doug Kwan  <dougkwan@google.com>
5544
5545         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5546         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5547         definition.
5548         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5549         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5550         target hook to detect function points.
5551         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5552         * icf.h (Icf::check_section_for_function_pointers): Change type of
5553         parameter SECTION_NAME to const reference to std::string.  Use
5554         target hook to determine if section may have unsafe pointers.
5555         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5556         method definition.
5557
5558 2010-06-21  Rafael Espindola  <espindola@google.com>
5559
5560         * fileread.cc (Input_file::find_fie): New
5561         (Input_file::open): Use Input_file::find_fie.
5562         * fileread.h (Input_file::find_fie): New
5563         * plugin.cc (set_extra_library_path): New.
5564         (Plugin::load): Add set_extra_library_path to the transfer vector.
5565         (Plugin_manager::set_extra_library_path): New.
5566         (Plugin_manager::add_input_file): Use the extra search path if set.
5567         (set_extra_library_path(): New.
5568         * plugin.h (Plugin_manager): Add set_extra_library_path and
5569         extra_search_path_.
5570
5571 2010-06-19  Cary Coutant  <ccoutant@google.com>
5572
5573         * layout.cc (gdb_sections): Add .debug_types.
5574         (lines_only_debug_sections): Likewise.
5575
5576 2010-06-18  Rafael Espindola  <espindola@google.com>
5577
5578         * plugin.cc (add_input_file,add_input_library)
5579         (Plugin_manager::add_input_file): Make filename arguments const.
5580         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5581         const.
5582
5583 2010-06-16  Doug Kwan  <dougkwan@google.com>
5584
5585         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5586         .ARM.attributes section if we have not merged any input
5587         attributes sections.
5588
5589 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5590
5591         * arm.cc: Allow combining objects with no EABI version
5592         information.
5593
5594 2010-06-15  Rafael Espindola  <espindola@google.com>
5595
5596         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5597
5598 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5599
5600         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5601         (struct iovec): Correct !HAVE_READV definition.
5602
5603 2010-06-10  Cary Coutant  <ccoutant@google.com>
5604
5605         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5606         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5607         reloc sections.
5608         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5609
5610         PR 11683
5611         * symtab.h (Symbol::is_placeholder): New member function.
5612         * target-reloc.h (relocate_section): Check for placeholder symbols.
5613
5614         * testsuite/Makefile.am (plugin_test_8): New test.
5615         (plugin_test_9): New test.
5616         * testsuite/Makefile.in: Regenerate.
5617
5618 2010-06-09  Nick Clifton  <nickc@redhat.com>
5619
5620         * yyscript.y (input_list_element): Allow strings prefixed with
5621         the '-' character.  Treat these as libraries.
5622         * script.cc (script_add_library): New function.  Adds a library
5623         specified by "-l<name>" found in an input script.
5624         * script-c.h: Add prototype for script_add_library.
5625
5626 2010-06-07  Doug Kwan  <dougkwan@google.com>
5627
5628         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5629         Restrict stub-group size to be within long conditional branch
5630         range when working around cortex-A8 erratum.
5631
5632 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5633
5634         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5635         #ifdef typo.
5636
5637 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5638
5639         PR gold/11658
5640         * output.cc
5641         (Output_section::Input_section_sort_entry::compare_section_ordering):
5642         Change to return non-zero correctly.
5643         (Output_section::Input_section_sort_section_order_index_compare
5644         ::operator()): Change to fix ambiguity in comparisons.
5645
5646 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5647
5648         * gold.h (is_wildcard_string): New function.
5649         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5650         (Layout::layout_eh_frame): Ditto.
5651         (Layout::find_section_order_index): New method.
5652         (Layout::read_layout_from_file): New method.
5653         * layout.h (Layout::find_section_order_index): New method.
5654         (Layout::read_layout_from_file): New method.
5655         (Layout::input_section_position_): New private member.
5656         (Layout::input_section_glob_): New private member.
5657         * main.cc (main): Call read_layout_from_file here.
5658         * options.h (--section-ordering-file): New option.
5659         * output.cc (Output_section::input_section_order_specified_): New
5660         member.
5661         (Output_section::Output_section): Initialize new member.
5662         (Output_section::add_input_section): Add new parameter.
5663         Keep input sections when --section-ordering-file is used.
5664         (Output_section::set_final_data_size): Sort input sections when
5665         section ordering file is specified.
5666         (Output_section::Input_section_sort_entry): Add new parameter.
5667         Check sorting type.
5668         (Output_section::Input_section_sort_entry::compare_section_ordering):
5669         New method.
5670         (Output_section::Input_section_sort_compare::operator()): Change to
5671         consider section_order_index.
5672         (Output_section::Input_section_sort_init_fini_compare::operator()):
5673         Change to consider section_order_index.
5674         (Output_section::Input_section_sort_section_order_index_compare
5675         ::operator()): New method.
5676         (Output_section::sort_attached_input_sections): Change to sort
5677         according to section order when specified.
5678         (Output_section::add_input_section<32, true>): Add new parameter.
5679         (Output_section::add_input_section<64, true>): Add new parameter.
5680         (Output_section::add_input_section<32, false>): Add new parameter.
5681         (Output_section::add_input_section<64, false>): Add new parameter.
5682         * output.h (Output_section::add_input_section): Add new parameter.
5683         (Output_section::input_section_order_specified): New
5684         method.
5685         (Output_section::set_input_section_order_specified): New method.
5686         (Input_section::Input_section): Initialize section_order_index_.
5687         (Input_section::section_order_index): New method.
5688         (Input_section::set_section_order_index): New method.
5689         (Input_section::section_order_index_): New member.
5690         (Input_section::Input_section_sort_section_order_index_compare): New
5691         struct.
5692         (Output_section::input_section_order_specified_): New member.
5693         * script-sections.cc (is_wildcard_string): Delete and move modified
5694         method to gold.h.
5695         (Output_section_element_input::Output_section_element_input): Modify
5696         call to is_wildcard_string.
5697         (Output_section_element_input::Input_section_pattern
5698         ::Input_section_pattern): Ditto.
5699         (Output_section_element_input::Output_section_element_input): Ditto.
5700         * testsuite/Makefile.am (final_layout): New test case.
5701         * testsuite/Makefile.in: Regenerate.
5702         * testsuite/final_layout.cc: New file.
5703         * testsuite/final_layout.sh: New file.
5704
5705 2010-06-01  Rafael Espindola  <espindola@google.com>
5706
5707         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5708
5709 2010-06-01  Rafael Espindola  <espindola@google.com>
5710
5711         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5712         visibility of symbols.
5713
5714 2010-05-27  Doug Kwan  <dougkwan@google.com>
5715
5716         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5717         from start of output section instead of address for a local symbol
5718         in a merged or relaxed section when doing a relocatable link.
5719
5720 2010-05-26  Rafael Espindola  <espindola@google.com>
5721
5722         PR 11604
5723         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5724         adding sections the garbage collector removed.
5725         * gold/testsuite/Makefile.am: Add test.
5726         * gold/testsuite/Makefile.in: Regenerate.
5727         * gold/testsuite/plugin_test_7.sh: New.
5728         * gold/testsuite/plugin_test_7_1.c: New.
5729         * gold/testsuite/plugin_test_7_2.c: New.
5730
5731 2010-05-26  Rafael Espindola  <espindola@google.com>
5732
5733         * script-sections.cc (Output_section_definition::set_section_addresses):
5734         Check for --section-start.
5735
5736 2010-05-26  Doug Kwan  <dougkwan@google.com>
5737
5738         * arm.cc (Arm_scan_relocatable_relocs): New class.
5739         (Target_arm::relocate_special_relocatable): New method.
5740         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5741         (Arm_relocate_functions::thumb_branch_common): Same.
5742         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5743         instead of Default_scan_relocatable_relocs.
5744         * target-reloc.h (relocate_for_relocatable): Let target handle
5745         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5746         * target.h (Sized_target::relocate_special_relocatable): New method.
5747
5748 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5749
5750         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5751
5752 2010-05-23  Doug Kwan  <dougkwan@google.com>
5753
5754         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5755         instead of a cast.
5756         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5757         with a direct branch, not a conditional branch, to a stub.
5758         * merge.cc (Output_merge_base::record_input_section): New method
5759         defintion.
5760         (Output_merge_data::do_add_input_section): Record input section if
5761         keeps-input-sections flag is set.
5762         (Output_merge_string::do_add_input_section): Ditto.
5763         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5764         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5765         INPUT_SECTIONS_.
5766         (Output_merge_base::keeps_input_sections,
5767         Output_merge_base::set_keeps_input_sections,
5768         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5769         method definitions.
5770         (Output_merge_base::Input_sections): New type declaration.
5771         (Output_merge_base::input_sections_begin,
5772         Output_merge_base::input_sections_end,
5773         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5774         (Output_merge_base::bool keeps_input_sections_,
5775         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5776         Output_merge_base::input_sections_): New data members.
5777         (Output_merge_data::do_set_keeps_input_sections): New method
5778         defintion.
5779         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5780         * output.cc (Output_section::Input_section::relobj): Move method
5781         defintion from class declaration to here and handle merge sections.
5782         (Output_section::Input_section::shndx): Ditto.
5783         (Output_section::Output_section): Remove initializations of removed
5784         data members and initialize new data member LOOKUP_MAPS_.
5785         (Output_section::add_input_section): Set keeps-input-sections flag
5786         for a newly created merge output section as appropriate.  Adjust code
5787         to use Output_section_lookup_maps class.
5788         (Output_section::add_relaxed_input_section): Adjst code for lookup
5789         maps code refactoring.
5790         (Output_section::add_merge_input_section): Add a new parameter
5791         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5792         class.  If adding input section to a newly created merge output
5793         section fails, remove the new merge section.
5794         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5795         Adjust code for use of the Output_section_lookup_maps class.
5796         (Output_section::find_merge_section): Ditto.
5797         (Output_section::build_lookup_maps): New method defintion.
5798         (Output_section::find_relaxed_input_section): Adjust code to use
5799         Output_section_lookup_maps class.
5800         (Output_section::get_input_sections): Export merge sections.  Adjust
5801         code to use Output_section_lookup_maps class.
5802         (Output_section:::add_script_input_section): Adjust code to use
5803         Output_section_lookup_maps class.  Update lookup maps for merge
5804         sections also.
5805         (Output_section::discard_states): Use Output_section_lookup_maps.
5806         (Output_section::restore_states): Same.
5807         * output.h (Merge_section_properties): Move class defintion out of
5808         Output_section.
5809         (Output_section_lookup_maps): New class.
5810         (Output_section::Input_section::is_merge_section): New method
5811         defintion.
5812         (Output_section::Input_section::relobj): Move defintion out of class
5813         defintion.  Declare method only.
5814         (Output_section::Input_section::shndx): Ditto.
5815         (Output_section::Input_section::output_merge_base): New method defintion.
5816         (Output_section::Input_section::u2_.pomb): New union field.
5817         (Output_section::Merge_section_by_properties_map,
5818         Output_section::Output_section_data_by_input_section_map,
5819         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5820         Remove types.
5821         (Output_section::add_merge_input_section): Add new parameter
5822         KEEPS_INPUT_SECTIONS.
5823         (Output_section::build_lookup_maps): New method declaration.
5824         (Output_section::merge_section_map_,
5825         Output_section::merge_section_by_properties_map_,
5826         Output_section::relaxed_input_section_map_,
5827         Output_section::is_relaxed_input_section_map_valid_): Remove data
5828         members.
5829         (Output_section::lookup_maps_): New data member.
5830
5831 2010-05-21  Doug Kwan  <dougkwan@google.com>
5832
5833         PR gold/11619
5834         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5835         avoid a compilation error.
5836
5837 2010-05-19  Rafael Espindola  <espindola@google.com>
5838
5839         * script-sections.cc (Output_section_definition::allocate_to_segment):
5840         Update the phdrs_list even when the output section is NULL.
5841         * testsuite/Makefile.am: Add test.
5842         * testsuite/Makefile.in: Regenerate.
5843         * testsuite/script_test_9.cc: New.
5844         * testsuite/script_test_9.sh: New.
5845         * testsuite/script_test_9.t: New.
5846
5847 2010-05-19  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm.cc (Arm_input_section::original_size): New method.
5850         (Arm_input_section::do_addralign): Add a cast.
5851         (Arm_input_section::do_output_offset): Remove static cast.
5852         (Arm_input_section::original_addralign,
5853          Arm_input_section::original_size_): Change type to uint32_t.
5854         (Arm_input_section::init): Add safe casts for section alignment
5855         and size.
5856         (Arm_input_section::set_final_data_size): Do not set address and
5857         offset of stub table.
5858         (Arm_output_section::fix_exidx_coverage): Change use of of
5859         Output_section::Simple_input_section to that of
5860         Output_section::Input_section.
5861         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5862         except for the first pass.
5863         * output.cc (Output_section::get_input_sections): Change type of
5864         input_sections to std::list<Input_section>.
5865         (Output_section::add_script_input_section): Rename from
5866         Output_section::add_simple_input_section.  Change type of SIS
5867         parameter from Simple_input_section to Input_section.
5868         * output.h (Output_section::Simple_input_section): Remove class.
5869         (Output_section::Input_section): Change class visibility to public.
5870         (Output_section::Input_section::addralign): Use stored alignments
5871         for special input sections if set.
5872         (Output_section::Input_section::set_addralign): New method.
5873         (Output_section::get_input_sections): Change parameter type from
5874         list of Simple_input_section to list of Input_section.
5875         (Output_section::add_script_input_section): Rename from
5876         Output_section::add_simple_input_section. Change first parameter's
5877         type from Simple_input_section to Input_section and remove the
5878         second and third parameters.
5879         * script-sections.cc (Input_section::Input_section_list): Change
5880         type to list of Output_section::Input_section/
5881         (Input_section_info::Input_section_info): Change parameter type of
5882         INPUT_SECTION to Output_section::Input_section.
5883         (Input_section_info::input_section): Change return type.
5884         (Input_section_info::input_section_): Change type to
5885         Output_section::Input_section.
5886         (Output_section_element_input::set_section_addresses): Adjust code
5887         to use Output_section::Input_section instead of
5888         Output_section::Simple_input_section.  Adjust code for renaming
5889         of Output_section::add_simple_input_section.
5890         (Orphan_output_section::set_section_addresses): Ditto.
5891
5892 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5893
5894         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5895         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5896
5897 2010-05-18  Rafael Espindola  <espindola@google.com>
5898
5899         * options.cc (General_options::finalize): Handle -nostdlib.
5900         * options.h (nostdlib): New option.
5901         * script.cc (script_add_search_dir): Handle -nostdlib.
5902
5903 2010-05-12  Doug Kwan  <dougkwan@google.com>
5904
5905         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5906         attributes section only if there no attributes section after merging.
5907         (Target_arm::merge_object_attributes): Move value of
5908         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5909         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5910         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5911         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5912         and arm_attr_merge_7.stdout.
5913         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5914         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5915         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5916         arm_attr_merge_7b.o): New rules.
5917         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5918         arm_attr_merge_7
5919         * testsuite/Makefile.in: Regenerate.
5920         * testsuite/arm_attr_merge.sh: New file.
5921         * testsuite/arm_attr_merge_[67][ab].s: Same.
5922
5923 2010-05-05  Nick Clifton  <nickc@redhat.com>
5924
5925         * po/es.po: Updated Spanish translation.
5926
5927 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5928
5929         * Makefile.am (install-exec-local): Properly install gold as
5930         default cross linker.
5931         * Makefile.in: Regenerated.
5932
5933 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5934             Nick Clifton  <nickc@redhat.com>
5935
5936         * configure.ac (install_as_default): Define and set to false
5937         unless --enable-gold or --enable-gold=both/gold has been
5938         specified.
5939         * configure: Regenerate.
5940
5941         * Makefile.am (install-exec-local): Install the executable as
5942         'ld.gold'.  If install_as_default is true then also install it as
5943         'ld'.
5944         * Makefile.in: Regenerated.
5945
5946 2010-04-24  Ian Lance Taylor  <iant@google.com>
5947
5948         * layout.cc (Layout::layout_reloc): In relocatable link don't
5949         combine reloc sections for grouped sections.
5950
5951 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5952
5953         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5954         sections that are not ordinary to icf.
5955         * icf.cc (get_section_contents): Handle relocation pointing to section
5956         with no object or shndx information.
5957         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5958         * testsuite/Makefile.in: Regenerate.
5959         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5960         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5961
5962 2010-04-22  Ian Lance Taylor  <iant@google.com>
5963
5964         * expression.cc (Expression::Expression_eval_info): Add
5965         result_alignment_pointer field.
5966         (Expression::eval_with_dot): Add result_alignment_pointer
5967         parameter.  Change all callers.
5968         (Expression::eval_maybe_dot): Likewise.
5969         (class Binary_expression): Add alignment_pointer parameter to
5970         left_value and right_value.  Change all callers.
5971         (BINARY_EXPRESSION): Set result alignment.
5972         (class Trinary_expression): Add alignment_pointer parameter to
5973         arg2_value and arg3_value.  Change all callers.
5974         (Trinary_cond::value): Set result alignment.
5975         (Max_expression::value, Min_expression::value): Likewise.
5976         (Align_expression::value): Likewise.
5977         * script-sections.cc (class Sections_element): Add dot_alignment
5978         parameter to set_section_addresses virtual function.  Update
5979         instantiations.
5980         (class Output_section_element): Likewise.
5981         (Script_sections::create_segments): Add dot_alignment parameter.
5982         Change all callers.
5983         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5984         (Script_sections::set_phdrs_clause_addresses): Likewise.
5985         * script-sections.h: Update declarations.
5986         * script.h: Update declarations.
5987         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5988         min_p_align.
5989         * testsuite/script_test_3.t: Set large alignment.
5990         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5991         segment has expected alignment.
5992
5993 2010-04-22  Nick Clifton  <nickc@redhat.com>
5994
5995         * po/gold.pot: Updated by the Translation project.
5996         * po/vi.po: Updated Vietnamese translation.
5997
5998 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5999
6000         * testsuite/Makefile.am (check_PROGRAMS): Add
6001         icf_virtual_function_folding_test.
6002         * testsuite/Makefile.in: Regenerated.
6003
6004 2010-04-15  Andrew Haley  <aph@redhat.com>
6005
6006         * options.h (merge_exidx_entries): New option.
6007         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6008         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6009         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6010         (Target_arm::merge_exidx_entries): New function.
6011         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6012         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6013         to Arm_exidx_fixup constructor.
6014         Add new arg, merge_exidx_entries.
6015         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6016         Arm_output_section::fix_exidx_coverage.
6017
6018 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6019
6020         * icf.cc (get_section_contents): Check for preemptible functions.
6021         Ignore addend when appropriate.
6022         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6023         section folded.
6024         (add_from_relobj): Check for section folded.
6025         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6026         * symtab.h (should_add_dynsym_entry): Add new parameter.
6027         * target-reloc.h (scan_relocs): Check for section folded.
6028         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6029         Check reloc types for function pointers in shared objects.
6030         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6031         case.
6032         (icf_preemptible_functions_test): New test case.
6033         (icf_string_merge_test): New test case.
6034         * testsuite.Makefile.in: Regenerate.
6035         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6036         bar_glob.  Refactor code.
6037         * testsuite/icf_preemptible_functions_test.cc: New file.
6038         * testsuite/icf_preemptible_functions_test.sh: New file.
6039         * testsuite/icf_string_merge_test.cc: New file.
6040         * testsuite/icf_string_merge_test.sh: New file.
6041         * testsuite/icf_virtual_function_folding_test.cc: New file.
6042         * testsuite/icf_virtual_function_folding_test.sh: New file.
6043
6044 2010-04-14  Doug Kwan  <dougkwan@google.com>
6045
6046         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6047         for local symbol recounting if we remove a section due to ICF.
6048         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6049         there are no regular objects in input.
6050
6051 2010-04-13  Doug Kwan  <dougkwan@google.com>
6052
6053         * arm.cc (Arm_input_section::set_final_data_size): Compute
6054         accurate final data size instead of using current data size.
6055
6056 2010-04-09  Doug Kwan  <dougkwan@google.com>
6057
6058         * layout.cc (Layout::choose_output_section): Handle script section
6059         types.
6060         (Layout::make_output_section_for_script): Add section type parameter.
6061         Handle script section types.
6062         * layout.h (Layout::make_output_section_for_script): Add section
6063         type parameter.
6064         * output.cc (Output_section::Output_section): Initialize data member
6065         is_noload_.
6066         (Output_section::do_reset_address_and_file_offset): Do not set address
6067         to 0 if section is a NOLOAD section.
6068         * output.h (Output_section::is_noload): New method.
6069         (Output_section::set_is_noload): Ditto.
6070         (Output_section::is_noload_): New data member.
6071         * script-c.h (Script_section_type): New enum type.
6072         (struct Parser_output_section_header): Add new file section_type.
6073         * script-sections.cc (Sections_element::output_section_name): Add
6074         parameter for returning script section type.
6075         (Output_section_definition::output_section_name): Ditto.
6076         (Output_section_definition::section_type)P; New method.
6077         (Output_section_definiton::script_section_type_name): Ditto.
6078         (Output_section_definition::script_section_type_): New data member.
6079         (Output_section_definition::Output_section_definition): Initialize
6080         data member Output_section_definition::script_section_type_.
6081         (Output_section_definition::create_sections): Pass script section type
6082         to Layout::make_output_section_for_script.
6083         (Output_section_definition::output_section_name): Return script
6084         section type to caller.
6085         (Output_section_definition::set_section_address): Do not advance
6086         dot value and load address if section type is NOLOAD.  Set address
6087         of NOLOAD sections regardless of section flags.
6088         (Output_section_definition::print): Print section type if it is
6089         not SCRIPT_SECTION_TYPE_NONE.
6090         (Output_section_definition::section_type): New method.
6091         (Output_section_definition::script_section_type_name): Ditto.
6092         (Script_sections::output_section_name): Add new parameter
6093         PSECTION_TYPE for returning script section type.  Pass it to
6094         section elements.  Handle discard sections.
6095         (Sort_output_sections::operator()): Handle NOLOAD sections.
6096         * script-sections.h (Script_sections::Section_type): New enum type.
6097         (Script_sections::output_section_name): Add a new parameter for
6098         returning script section type.
6099         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6100         INFO and NOLOAD.
6101         * yyscript.y (union): Add new field SECTION_TYPE.
6102         (COPY, DSECT, INFO, NOLOAD): New tokens.
6103         (opt_address_and_section_type): Change type to output_section_header.
6104         (section_type): New non-terminal
6105         (section_header): Handle section type.
6106         (opt_address_and_section_type): Return section type value.
6107
6108 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6109
6110         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6111         * testsuite/plugin_common_test_2.c (foo): Likewise.
6112
6113 2010-04-08  Doug Kwan  <dougkwan@google.com>
6114
6115         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6116         Output_merge_data.
6117         * output.cc (Output_section::add_merge_input_section): Simplify
6118         code and return status of Output_merge_base::add_input_section.
6119         Update merge section map only if Output_merge_base::add_input_section
6120         returns true.
6121
6122 2010-04-07  Doug Kwan  <dougkwan@google.com>
6123
6124         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6125         if section is marked as containing instructions but has no mapping
6126         symbols.
6127         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6128         correct section index.
6129         (Arm_relobj::find_linked_text_section): Ditto.
6130
6131 2010-04-07  Cary Coutant  <ccoutant@google.com>
6132
6133         * archive.cc (include_member): Destroy Read_symbols_data object before
6134         releasing file.
6135         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6136         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6137         (Read_symbols_data::~Read_symbols_data) New destructor.
6138         (Section_relocs::Section_relocs) New constructor.
6139         (Section_relocs::~Section_relocs) New destructor.
6140         (Read_relocs_data::Read_relocs_data) New constructor.
6141         (Read_relocs_data::~Read_relocs_data) New destructor.
6142         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6143         pointers to NULL after deleting.
6144
6145 2010-04-07  Doug Kwan  <dougkwan@google.com>
6146
6147         * arm.cc: Replace "endianity" with "endianness" in comments.
6148         (Arm_exidx_cantunwind): Ditto.
6149         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6150         (Arm_relobj::merge_flags_and_attributes): New method.
6151         (Arm_relobj::merge_flags_and_attributes_): New data member.
6152         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6153         (Arm_relobj::scan_sections_for_stubs): Ditto.
6154         (Arm_relobj::do_read_symbols): Check to see if we really want to
6155         merge processor-specific flags and attributes.  Exit early if
6156         an object is empty except for section names and the undefined symbol.
6157         (Target_arm::do_finalize_sections): Move check for ELF format to
6158         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6159         attributes from a regular object only when we have determined that
6160         it is aapropriate.  Do not create an .ARM.attributes section in
6161         output if there is no regular input object.
6162         (Target_arm::merge_processor_specific_flags): Check
6163         --warn-mismatch before printing any error.
6164         (Target_arm::merge_object_attributes): Ditto.
6165         * gold.cc (queue_middle_tasks): Handle the case in which there is
6166         no regular object in input.
6167         * options.cc (General_options::parse_EB): New method.
6168         (General_options::parse_EL): Same.
6169         (General_options::General_options): Initialize endianness_.
6170         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6171         New options.
6172         (General_options::Endianness): New enum.
6173         (General_options::endianness): New method.
6174         (General_options::endianness_): New data member.
6175         * parameters.cc (Parameters::set_options): Check target endianness.
6176         (Parameters::set_target_once): Ditto.
6177         (Parameters::check_target_endianness): New method.
6178         (parameters_force_valid_target): If either -EL or -EB is specified,
6179         use it to define endianness of default target.
6180         * parameters.h (Parameters::check_target_endianness): New method
6181         declaration.
6182         * target.h (class Target): Change "endianity" to "endianness"
6183         in comments.
6184
6185 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6186
6187         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6188         * configure: Regenerate.
6189         * Makefile.in: Regenerate.
6190         * testsuite/Makefile.in: Regenerate.
6191
6192 2010-04-06  Cary Coutant  <ccoutant@google.com>
6193
6194         gcc PR lto/42757
6195         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6196         prevailing definitions of common symbols.
6197         * testsuite/plugin_test_6.sh: New test case.
6198         * testsuite/plugin_common_test_1.c: New test case.
6199         * testsuite/plugin_common_test_2.c: New test case.
6200         * testsuite/Makefile.am (plugin_test_6): New test case.
6201         * testsuite/Makefile.in: Regenerate.
6202
6203 2010-04-06  Nick Clifton  <nickc@redhat.com>
6204
6205         * po/vi.po: New Vietnamese translation.
6206
6207 2010-03-30  Doug Kwan  <dougkwan@google.com>
6208
6209         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6210
6211 2010-03-25  Doug Kwan  <dougkwan@google.com>
6212
6213         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6214         to avoid a conversion warning on a 32-bit host.
6215
6216 2010-03-24  Ian Lance Taylor  <iant@google.com>
6217
6218         * testsuite/script_test_3.t: Add a TLS segment.
6219         * testsuite/Makefile.am (check_PROGRAMS): Add
6220         tls_phdrs_script_test.
6221         (tls_phdrs_script_test_SOURCES): Define.
6222         (tls_phdrs_script_test_DEPENDENCIES): Define.
6223         (tls_phdrs_script_test_LDFLAGS): Define.
6224         (tls_phdrs_script_test_LDADD): Define.
6225         * testsuite/Makefile.in: Rebuild.
6226
6227 2010-03-23  Cary Coutant  <ccoutant@google.com>
6228
6229         * fileread.cc (find_or_make_view): Fix comment.
6230
6231 2010-03-23  Ian Lance Taylor  <iant@google.com>
6232
6233         * script-sections.cc (class Orphan_section_placement): Define
6234         PLACE_TLS and PLACE_TLS_BSS.
6235         (Orphan_section_placement::Orphan_section_placement): Initialize
6236         new places.
6237         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6238         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6239         (tls_script_test_SOURCES): Define.
6240         (tls_script_test_DEPENDENCIES): Define.
6241         (tls_script_test_LDFLAGS): Define.
6242         (tls_script_test_LDADD): Define.
6243         * testsuite/Makefile.in: Rebuild.
6244
6245 2010-03-22  Doug Kwan  <dougkwan@google.com>
6246
6247         * arm.cc (Arm_relocate_functions::abs8,
6248         Arm_relocate_functions::abs16): Use correct check for overflow
6249         specified in the ARM ELF specs.
6250         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6251         target of a BLX instruction specially.
6252         (Reloc_stub::stub_type_for_reloc): Ditto.
6253         (Relocate::relocate): Use symbolic names instead of numeric relocation
6254         codes to report error.
6255         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6256         workaround.
6257         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6258         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6259         thumb2_blx_out_of_range.stdout
6260         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6261         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6262         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6263         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6264         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6265         thumb2_blx_in_range, thumb2_blx_in_range.o,
6266         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6267         thumb2_blx_out_of_range.o): New rules.
6268         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6269         thumb2_blx_in_range and thumb2_blx_out_of_range.
6270         * testsuite/Makefile.in: Regenerate.
6271         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6272         * testsuite/thumb_blx_in_range.s: New file.
6273         * testsuite/thumb_blx_out_of_range.s: New file.
6274
6275 2010-03-22  Rafael Espindola  <espindola@google.com>
6276
6277         * archive.cc (Should_include): Move to archive.h.
6278         (should_include_member): Make it a member of Archive.
6279         (Lib_group): New.
6280         (Add_lib_group_symbols): New.
6281         * archive.h: Include options.h.
6282         (Archive_member): Moved from Archive.
6283         (Should_include): Moved from archive.cc.
6284         (Lib_group): New.
6285         (Add_lib_group_symbols): New.
6286         * dynobj.cc (do_should_include_member): New.
6287         * dynobj.h (do_should_include_member): New.
6288         * gold.cc (queue_initial_tasks): Update call to queue.
6289         * main.cc (main): Print lib group stats.
6290         * object.cc (do_should_include_member): New.
6291         * object.h: Include archive.h.
6292         (Object::should_include_member): New.
6293         (Object::do_should_include_member): New.
6294         (Sized_relobj::do_should_include_member): New.
6295         * options.cc (General_options::parse_start_lib): New.
6296         (General_options::parse_end_lib): New.
6297         (Input_arguments::add_file): Handle lib groups.
6298         (Input_arguments::start_group): Check we are not in a lib.
6299         (Input_arguments::start_lib): New.
6300         (Input_arguments::end_lib): New.
6301         * options.h (General_options): Add start_lib and end_lib.
6302         (Input_argument::lib_): New.
6303         (Input_argument::lib): New.
6304         (Input_argument::is_lib): New.
6305         (Input_file_lib): New.
6306         (Input_arguments::in_lib_): New.
6307         (Input_arguments::in_lib): New.
6308         (Input_arguments::start_lib): New.
6309         (Input_arguments::end_lib_): New.
6310         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6311         in unused members as preempted.
6312         (Sized_pluginobj::do_should_include_member): New.
6313         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6314         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6315         return the blocker.
6316         (Read_symbols::do_whole_lib_group): New.
6317         (Read_symbols::do_lib_group): New.
6318         (Read_symbols::do_read_symbols): Handle lib groups.
6319         (Read_symbols::get_name): Handle lib groups.
6320         * readsyms.h (Read_symbols): Add an archive member pointer.
6321         (Read_symbols::do_whole_lib_group): New.
6322         (Read_symbols::do_lib_group): New.
6323         (Read_symbols::member_): New.
6324         * script.cc (read_input_script): Update call to queue_soon.
6325
6326 2010-03-19  Doug Kwan  <dougkwan@google.com>
6327
6328         * arm.cc (Stub_table::Stub_table): Initialize new data members
6329         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6330         (Stub_table::add_reloc_stub): Assign stub offset and update
6331         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6332         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6333         New data members.
6334         (Stub_table::update_data_size_and_addralign): Use
6335         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6336         instead of going over all reloc stubs.
6337         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6338         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6339         Stringpool_template::offset_ to size of Stringpool_char.
6340         (Stringpool_template::new_key_offset): Remove code to initialize
6341         Stringpool_template::offset_.
6342         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6343         Stringpool_template::offset_ to zero.
6344
6345 2010-03-15  Doug Kwan  <dougkwan@google.com>
6346
6347         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6348         offset_.
6349         (Stringpool_template::new_key_offset): New method.
6350         (Stringpool_template::add_string): Assign offsets when adding new
6351         strings.
6352         (Stringpool_template::set_string_offsets): Do not set string offsets
6353         when not optimizing.
6354         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6355         member size_.
6356         (Chunked_vector::clear): Clear size_.
6357         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6358         (Chunked_vector::size): Return size_.
6359         (Chunked_vector::push_back): Use size_ to find insert position.
6360         (Chunked_vector::size_): New data member.
6361         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6362         (Stringpool_template::new_key_offset): New method declaration.
6363         (Stringpool_template::offset_): New data member.
6364
6365 2010-03-15   Rafael Espindola  <espindola@google.com>
6366
6367         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6368         Add_symbols' constructor.
6369         * readsyms.h (Add_symbols): Remove the input_group member.
6370
6371 2010-03-10  Ian Lance Taylor  <iant@google.com>
6372
6373         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6374         target to ask whether a reference to a symbol requires a stack
6375         split.
6376         * target.h (Target::is_call_to_non_split): New function.
6377         (Target::do_is_call_to_non_split): Declare virtual function.
6378         * target.cc: Include "symtab.h".
6379         (Target::do_is_call_to_non_split): New function.
6380         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6381
6382 2010-03-10  Cary Coutant  <ccoutant@google.com>
6383
6384         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6385         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6386         (File_read::open[2]): Add whole_file_view_ to list of views.
6387         (File_read::make_view): Remove test of whole_file_view_.
6388         (File_read::find_or_make_view): Create whole_file_view_ if
6389         necessary.
6390         (File_read::clear_views): Replace bool parameter with enum;
6391         adjust all callers.  Don't delete views with permanent data;
6392         do delete cached views and views from archives if
6393         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6394         if clearing the corresponding view.
6395         * fileread.h (File_read::Clear_views_mode): New enum.
6396         (File_read::View::is_permanent_view): New method.
6397         (File_read::clear_views): Replace bool parameter
6398         with enum; adjust all callers.
6399         * options.h (General_options): Change keep_files_mapped option;
6400         add map_whole_files.
6401         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6402         releasing the file.
6403         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6404         the file.
6405
6406 2010-03-10  David S. Miller  <davem@davemloft.net>
6407
6408         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6409
6410 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6411
6412         * icf.cc (get_section_contents): Add '@' marker after processing the
6413         merge reloc.
6414
6415 2010-03-08  Doug Kwan  <dougkwan@google.com>
6416
6417         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6418         due to a conversion warning.
6419         (Arm_relobj::update_output_local_symbol_count): Check for local
6420         symbol with unset output index.
6421
6422 2010-03-05  Ian Lance Taylor  <iant@google.com>
6423
6424         * options.h (class General_options): Add --spare-dynamic-tags.
6425         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6426         --spare-dynamic-tags.
6427
6428 2010-03-05  Ian Lance Taylor  <iant@google.com>
6429
6430         * incremental.cc: Include "libiberty.h".
6431
6432 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6433
6434         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6435         function, is_info_ member.
6436         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6437         (Versions::Versions): Update caller.
6438         (Versions::define_base_version): Likewise.
6439         (Versions::add_def): Likewise.
6440
6441 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6442
6443         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6444         (Scan::possible_function_pointer_reloc): New function.
6445         (Scan::local_reloc_may_be_function_pointer): Change to call
6446         possible_function_pointer_reloc.
6447         (Scan::global_reloc_may_be_function_pointer): Ditto.
6448         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6449         relocations in ".data.rel.ro._ZTV" section.
6450         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6451         * testsuite/icf_safe_so_test.cc: Ditto.
6452         * testsuite/icf_safe_test.cc: Ditto.
6453         * testsuite/icf_safe_test.sh: Ditto.
6454
6455 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6456             Ian Lance Taylor  <iant@google.com>
6457
6458         * target-reloc.h (relocate_section): Check the symbol table index
6459         for -1U before setting the local symbol index.
6460         (scan_relocatable_relocs): If copying the relocation, record that
6461         the local symbol is required.
6462         * object.h (Symbol_value::is_output_symtab_index_set): New
6463         function.
6464         (Symbol_value::may_be_discarded_from_output_symtab): New
6465         function.
6466         (Symbol_value::has_output_symtab_entry): New function.
6467         (Symbol_value::needs_output_symtab_entry): Remove.
6468         (Symbol_value::output_symtab_index): Make sure the symbol index is
6469         set.
6470         (Symbol_value::set_output_symtab_index): Make sure the symbol
6471         index is not set.  Make sure the new index is valid.
6472         (Symbol_value::set_must_have_output_symtab_entry): New function.
6473         (Symbol_value::has_output_dynsym_entry): New function.
6474         (Symbol_value::set_output_dynsym_index): Make sure the new index
6475         is valid.
6476         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6477         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6478         local symbol if permitted.
6479         (Sized_relobj::do_finalize_local_symbols): Call
6480         is_output_symtab_index_set rather than needs_output_symtab_entry.
6481         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6482         rather than needs_output_symtab_entry.  Call
6483         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6484         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6485         is_output_symtab_index_set rather than needs_output_symtab_entry.
6486         * testsuite/discard_locals_relocatable_test.c: New file.
6487         * testsuite/discard_locals_test.sh: Test -r.
6488         * testsuite/Makefile.am (check_DATA): Add
6489         discard_locals_relocatable_test1.syms,
6490         discard_local_relocatable_test2.syms.
6491         (MOSTLYCLEANFILES): Likewise.  Also add
6492         discard_locals_relocatable_test1.lout and
6493         discard_locals_relocatable_test2.out.
6494         (discard_locals_relocatable_test1.syms): New target.
6495         (discard_locals_relocatable_test.o): New target.
6496         (discard_locals_relocatable_test1.out): New target.
6497         (discard_locals_relocatable_test2.syms): New target.
6498         (discard_locals_relocatable_test2.out): New target.
6499         (various): Add missing ../ld-new dependencies.
6500         * testsuite/Makefile.in: Rebuild.
6501
6502 2010-03-03  Nick Clifton  <nickc@redhat.com>
6503
6504         * po/fi.po: New Finnish translation.
6505
6506 2010-03-01  Doug Kwan  <dougkwan@google.com>
6507
6508         * layout.cc (Layout::Layout): Force section types of .init_array*,
6509         .preinit_array* and .fini_array* sections.
6510         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6511         Fix check of return value of std::string::find.().
6512         (Output_section::Input_section_sort_compare::operator()): Remove
6513         comment about .init_array.
6514         (Output_section::Input_section_sort_init_fini_compare::operator()):
6515         New method.
6516         (Output_section::sort_attached_input_sections): Handle .init_array
6517         and .fini_array specially.
6518         * output.h (Output_section::Inut_section_sort_compare): Update
6519         comment.
6520         (Output_section::Input_section_sort_init_fini_compare): New struct.
6521
6522 2010-02-26  Doug Kwan  <dougkwan@google.com>
6523
6524         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6525         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6526         * testsuite/debug_msg.sh: Avoid matching source line number for
6527         use of global variable undef_int.
6528
6529 2010-02-26  Doug Kwan  <dougkwan@google.com>
6530
6531         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6532         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6533         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6534         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6535         * options.cc (General_options::General_options): Initialize member
6536         fix_v4bx_.
6537         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6538         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6539         and rm_no_fix_v4bx.stdout
6540         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6541         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6542         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6543         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6544         and arm_no_fix_v4bx.
6545         * Makefile.in: Regenerate.
6546         * testsuite/arm_fix_v4bx.s: New file.
6547         * testsuite/arm_fix_v4bx.sh: Ditto.
6548
6549 2010-02-24  Doug Kwan  <dougkwan@google.com>
6550
6551         * arm.cc (Target_arm::got_section): Make the .got section the first
6552         non RELRO section in the data segment.
6553         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6554         suffixes of section names.
6555
6556 2010-02-24  Doug Kwan  <dougkwan@google.com>
6557
6558         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6559         flags and attributes merging if an input file is a binary file.
6560         * fileread.cc (Input_file::open): Record format of original file.
6561         * fileread.h (Input_file::Format): New enum type.
6562         (Input_file::Input_file): Initialize data member format_.
6563         (Input_file::format): New method definition.
6564         (Input_file::format_):: New data member.
6565
6566 2010-02-24  Doug Kwan  <dougkwan@google.com>
6567
6568         * arm.cc (Arm_output_data_got): New class.
6569         (ARM_TCB_SIZE): New constant
6570         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6571         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6572         If user uses a script with a SECTIONS clause, issue only a warning
6573         for a misplaced EXIDX input section.  Otherwise, issue an error.
6574         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6575         garbage collection.
6576         (Target_arm::got_mode_index_entry): Handle static linking.
6577         (Target_arm::Scan::local): Ditto.
6578         (Target_arm::Scan::global): Ditto.
6579         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6580         all incorrectly implemented relocations.
6581         (Target_arm::fix_exidx_coverage): Pass layout to
6582         Arm_output_section::fix_exidx_coverage.
6583         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6584         from ".ARM.exidx." and ".ARM.extab.".
6585
6586 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6587
6588         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6589         section if it does not already exist.
6590         * attributes.cc (Attributes_section_data::Attributes_section_data):
6591         Don't crash if size is zero.
6592
6593 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6594             Ian Lance Taylor  <iant@google.com>
6595
6596         * gold.cc (queue_middle_tasks): If no input files were opened,
6597         exit.
6598         * workqueue.h (Task_function::Task_function): Assert that there is
6599         a blocker.
6600
6601 2010-02-22  Doug Kwan  <dougkwan@google.com>
6602
6603         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6604         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6605         types to avoid warnings due to different uint64_t implementations
6606         on different hosts.
6607
6608 2010-02-21  Doug Kwan  <dougkwan@google.com>
6609
6610         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6611         handling of the maximum backward branch offset.
6612         (Arm_relocate_functions::thumb_branch_common): Ditto.
6613         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6614         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6615         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6616         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6617         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6618         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6619         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6620         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6621         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6622         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6623         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6624         thumb2_bl_out_of_range.o): New rules.
6625         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6626         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6627         thumb2_bl_out_of_range
6628         * testsuite/Makefile.in: Regenerate.
6629         * testsuite/arm_bl_in_range.s: New file.
6630         * testsuite/arm_bl_out_of_range.s: Ditto.
6631         * testsuite/arm_branch_in_range.sh: Ditto.
6632         * testsuite/arm_branch_range.t: Ditto.
6633         * testsuite/thumb2_branch_range.t: Ditto.
6634         * testsuite/thumb_bl_in_range.s: Ditto.
6635         * testsuite/thumb_bl_out_of_range.s: Ditto.
6636         * testsuite/thumb_branch_range.t: Ditto.
6637
6638 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6639
6640         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6641         Add reloc offset information.
6642         * icf.cc (get_section_contents): Change iterators to point to the new
6643         vectors. Add reloc offset information to the contents.
6644         * icf.h (Icf::Sections_reachable_info): New typedef.
6645         (Icf::Sections_reachable_list): New typedef.
6646         (Icf::Offset_info): New typedef.
6647         (Icf::Reloc_info): New struct typedef.
6648         (Icf::Reloc_info_list): New typedef.
6649         (Icf::symbol_reloc_list): Delete method.
6650         (Icf::addend_reloc_list): Delete method.
6651         (Icf::section_reloc_list): Delete method.
6652         (Icf::reloc_info_list): New method.
6653         (Icf::reloc_info_list_): New member.
6654
6655 2010-02-19  Doug Kwan  <dougkwan@google.com>
6656
6657         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6658         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6659         * arm.cc (Arm_relocation_functions): New forward declaration.
6660         (Target_arm::Target_arm): Initialize new data members
6661         got_mod_index_offset_ and tls_base_symbol_defined_.
6662         (Target_arm::Relocate::relocate_tls): New method.
6663         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6664          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6665         New methods.
6666         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6667         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6668         (Target_arm::got_mod_index_offset_,
6669         Target_arm::tls_base_symbol_defined_): New data members.
6670         (Target_arm::Scan::local, Target::Scan::global,
6671         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6672         relocations.
6673
6674 2010-02-18  Doug Kwan  <dougkwan@google.com>
6675
6676         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6677         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6678         text section as a parameter becuase some broken tools may not set
6679         the link in section header.
6680         (Target_arm::has_got_section): New method.
6681         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6682         without any mapping symbol as data only.  Remove warning.
6683         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6684         link in its section header, try to discover the link by inspecting the
6685         REL31 relocation at the beginning of the section.
6686         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6687         in error message.
6688         (Target_arm::Scan::global): Treat any reference to the symbol
6689         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6690
6691 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6692
6693         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6694         (Scan::global_reloc_may_be_function_pointer): New function.
6695         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6696         (Scan::global_reloc_may_be_function_pointer): New function.
6697         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6698         (Scan::global_reloc_may_be_function_pointer): New function.
6699         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6700         (Scan::global_reloc_may_be_function_pointer): New function.
6701         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6702         (Scan::global_reloc_may_be_function_pointer): New function.
6703         (Scan::possible_function_pointer_reloc): New function.
6704         (Target_x86_64::can_check_for_function_pointers): New function.
6705         * gc.h (gc_process_relocs): Scan relocation types to determine if
6706         function pointers were taken for targets that support it.
6707         * icf.cc (Icf::find_identical_sections): Include functions for
6708         folding in safe ICF whose pointer is not taken.
6709         * icf.h (Secn_fptr_taken_set): New typedef.
6710         (fptr_section_id_): New member.
6711         (section_has_function_pointers): New function.
6712         (set_section_has_function_pointers): New function.
6713         (check_section_for_function_pointers): New function.
6714         * options.h: Fix comment for safe ICF option.
6715         * target.h (can_check_for_function_pointers): New function.
6716         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6717         Modify icf_safe_test for X86-64.
6718         * testsuite/Makefile.in: Regenerate.
6719         * testsuite/icf_safe_so_test.cc: New file.
6720         * testsuite/icf_safe_so_test.sh: New file.
6721         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6722         (main): Change to take pointer to function kept_func_3.
6723         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6724         folding is done correctly for X86-64.
6725
6726 2010-02-12  David S. Miller  <davem@davemloft.net>
6727
6728         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6729         is_symbolless parameter.
6730         (Output_reloc<SHT_REL>::is_symbolless): New.
6731         (Output_reloc<SHT_REL>::is_symbolless_): New.
6732         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6733         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6734         (Output_reloc<SHT_RELA>::is_symbolless): New.
6735         (Output_data_reloc::add_global): Handle is_symbolless.
6736         (Output_data_reloc::add_global_relative): Likewise.
6737         (Output_data_reloc::add_local): Likewise.
6738         (Output_data_reloc::add_local_relative): Likewise.
6739         (Output_data_reloc::add_symbolless_global_addend): New.
6740         (Output_data_reloc::add_symbolless_local_addend): New.
6741         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6742         is_symbolless.
6743         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6744         instead of ->is_relative_
6745         (Output_reloc::write): Likewise.
6746         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6747         (Output_reloc::write_rel): Simplify.
6748
6749         * sparc.cc (Target_sparc::Scan::local): Use
6750         ->add_symbolless_local_addend as needed.
6751         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6752         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6753         based upon relocation offset.
6754
6755 2010-02-11  Doug Kwan  <dougkwan@google.com>
6756
6757         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6758         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6759         beginning of function.
6760         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6761         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6762         parameter is_32bit in calls to should_apply_static_reloc.
6763         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6764         (check_DATA): Add arm_abs_global.stdout.
6765         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6766         arm_abs_global.stdout): New rules.
6767         (MOSTLLYCLEANFILES): Add arm_abs_global
6768         * Makefile.in: Regenerate.
6769         * testsuite/arm_abs_global.s: New file.
6770         * testsuite/arm_abs_global.sh: Ditto.
6771         * testsuite/arm_abs_lib.s: Ditto.
6772
6773 2010-02-11  Ian Lance Taylor  <iant@google.com>
6774
6775         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6776         Read_relocs task.
6777         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6778         Allocate_commons_task first.
6779         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6780         task, rather than symtab_lock_.
6781         (Gc_process_relocs::~Gc_process_relocs): New function.
6782         (Gc_process_relocs::is_runnable): Check this_blocker_.
6783         (Gc_process_relocs::locks): Use next_blocker_ rather than
6784         blocker_.
6785         (Scan_relocs::~Scan_relocs): New function.
6786         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6787         symtab_lock_.
6788         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6789         next_blocker_.
6790         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6791         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6792         constructor accordingly.
6793         (class Gc_process_relocs): Likewise.
6794         (class Scan_relocs): Likewise.
6795         * common.h (class Allocate_commons_task): Remove symtab_lock_
6796         field, and corresponding constructor parameter.
6797         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6798         symtab_lock_.
6799         (Allocate_commons_task::locks): Likewise.
6800
6801 2010-02-11  Ian Lance Taylor  <iant@google.com>
6802
6803         * gold-threads.h (class Once): Define.
6804         (class Initialize_lock): Rewrite as child of Once.
6805         * gold-threads.cc (class Once_initialize): Define.
6806         (once_pointer_control): New static variable.
6807         (once_pointer, once_arg): New static variables.
6808         (c_run_once): New static function.
6809         (Once::Once, Once::run_once, Once::internal_run): New functions.
6810         (class Initialize_lock_once): Remove.
6811         (initialize_lock_control): Remove.
6812         (initialize_lock_pointer): Remove.
6813         (initialize_lock_once): Remove.
6814         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6815         (Initialize_lock::initialize): Rewrite.
6816         (Initialize_lock::do_run_once): New function.
6817         * archive.cc (Archive::interpret_header): Only clear name if it is
6818         not already empty.
6819         * fileread.cc: Include "gold-threads.h"
6820         (file_counts_lock): New static variable.
6821         (file_counts_initialize_lock): Likewise.
6822         (File_read::release): Only increment counts when using --stats.
6823         Use a lock around the increment.
6824         * parameters.cc (class Set_parameters_target_once): Define.
6825         (set_parameters_target_once): New static variable.
6826         (Parameters::Parameters): Move here from parameters.h.
6827         (Parameters::set_target): Rewrite.
6828         (Parameters::set_target_once): New function.
6829         (Parameters::clear_target): Move here and rewrite.
6830         * parameters.h (class Parameters): Update declarations.  Add
6831         set_parameters_target_once_ field.
6832         (Parameters::Parameters): Move to parameters.cc.
6833         (Parameters::clear_target): Likewise.
6834         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6835         task.
6836         (Start_group::~Start_group): New function.
6837         (Start_group::is_runnable): New function.
6838         (Start_group::locks, Start_group::run): New functions.
6839         (Finish_group::run): Change saw_undefined to size_t.
6840         * readsyms.h (class Start_group): Define.
6841         (class Finish_group): Change saw_undefined_ field to size_t.
6842         (Finish_group::Finish_group): Remove saw_undefined and
6843         this_blocker parameters.  Change all callers.
6844         (Finish_group::set_saw_undefined): New function.
6845         (Finish_group::set_blocker): New function.
6846         * symtab.h (class Symbol_table): Change saw_undefined to return
6847         size_t.  Change saw_undefined_ field to size_t.
6848         * target-select.cc (Set_target_once::do_run_once): New function.
6849         (Target_selector::Target_selector): Initialize set_target_once_
6850         field.  Don't initialize lock_ and initialize_lock_ fields.
6851         (Target_selector::instantiate_target): Rewrite.
6852         (Target_selector::set_target): New function.
6853         * target-select.h (class Set_target_once): Define.
6854         (class Target_selector): Update declarations.  Make
6855         Set_target_once a friend.  Remove lock_ and initialize_lock_
6856         fields.  Add set_target_once_ field.
6857
6858 2010-02-10  Ian Lance Taylor  <iant@google.com>
6859
6860         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6861         queueing any tasks.
6862         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6863         (queue_middle_tasks): Add all blockers before queueing any tasks.
6864         (queue_final_tasks): Likewise.
6865         * token.h (Task_token::add_blockers): New function.
6866         * object.h (Input_objects::number_of_relobjs): New function.
6867
6868 2010-02-10  Ian Lance Taylor  <iant@google.com>
6869
6870         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6871         shared, not if not position independent.
6872         * x86_64.cc (Relocate::relocate_tls): Likewise.
6873         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6874         (tls_pie_pic_test): New target.
6875         * testsuite/Makefile.in: Rebuild.
6876
6877         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6878         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6879         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6880         * testsuite/Makefile.in: Rebuild.
6881
6882 2010-02-09  David S. Miller  <davem@davemloft.net>
6883
6884         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6885         R_SPARC_RELATIVE using ->add_local_relative().
6886         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6887
6888         * output.h (Output_data_dynamic::add_section_size): New method
6889         that takes two Output_data objects.
6890         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6891         entry param.  Handle it in initializers.
6892         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6893         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6894         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6895         arg.
6896         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6897         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6898         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6899         for dynrel_includes_plt.
6900         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6901         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6902         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6903         before .rela.plt
6904         (Target_sparc::do_finalize_sections): Update to pass true for
6905         dynrel_includes_plt.
6906         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6907         output before .rela.plt
6908         (Target_powerpc::do_finalize_sections): Update to pass true for
6909         dynrel_includes_plt when 32-bit.
6910
6911 2010-02-08  Doug Kwan  <dougkwan@google.com>
6912
6913         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6914         method.
6915         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6916         Arm_relobj::scan_section_for_cortex_a8_stubs,
6917         Arm_relobj::do_relocation_section): Instead of calling
6918         Output_section::output_address, use faster
6919         Arm_relobj::simple_input_section_output_address.
6920
6921 2010-02-08  David S. Miller  <davem@davemloft.net>
6922
6923         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6924         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6925         relocation helper function.
6926
6927         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6928         just like R_SPARC_GOT{10,13,22}.
6929         (Target_sparc::Scan::local): Likewise.
6930         (Target_sparc::Relocate:relocate): Likewise.
6931
6932 2010-02-06  Ian Lance Taylor  <iant@google.com>
6933
6934         * configure.ac: Rewrite targetobjs duplicate removal code to use
6935         only shell constructs.
6936         * configure: Rebuild.
6937
6938 2010-02-05  Doug Kwan  <dougkwan@google.com>
6939
6940         PR 11247
6941         * arm.cc (Arm_relobj::section_is_scannable): New method.
6942         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6943         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6944
6945 2010-02-04  Doug Kwan  <dougkwan@google.com>
6946
6947         PR 11247
6948         * arm-reloc-property.cc (cstdio): Include.
6949         * configure.ac (targetobjs): Remove duplicates.
6950         * configure: Regenerate.
6951         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6952         big and little endian version for a given address size.
6953
6954 2010-02-03  Doug Kwan  <dougkwan@google.com>
6955
6956         * arm-reloc-property.cc
6957         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6958         definition.
6959         * arm-reloc-property.h
6960         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6961         New method definition.
6962         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6963         declaration.
6964         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6965         overflow to N.
6966         (GOT_PREL): Change implemented to Y.
6967         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6968         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6969         (Arm_relocate_functions::movw_abs_nc): Remove method.
6970         (Arm_relocate_functions::movt_abs): Ditto.
6971         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6972         (Arm_relocate_functions::thm_movt_abs): Ditto.
6973         (Arm_relocate_functions::movw_rel_nc): Ditto.
6974         (Arm_relocate_functions::movw_rel): Ditto.
6975         (Arm_relocate_functions::movt_rel): Ditto.
6976         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6977         (Arm_relocate_functions:thm_movw_rel): Ditto.
6978         (Arm_relocate_functions:thm_movt_rel): Ditto.
6979         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6980         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6981         New method definitions.
6982         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6983         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6984         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6985         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6986         (Target_arm::Relocate::relocate): Check for non-static or
6987         unimplemented relocation code and exit early.  Change calls to
6988         Target_arm::reloc_uses_thumb_bit and
6989         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6990         instead.  Refactor code to handle similar relocations to increase
6991         code sharing.  Remove check for unsupported relocation code in switch
6992         statement.
6993         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6994         relocation property table to find out size.  Change error message to
6995         print out the name of a relocation code instead of the numeric value.
6996         (Target_arm::scan_reloc_for_stub): Use relocation property table
6997         instead of calling Target_arm::reloc_uses_thumb_bit().
6998
6999 2010-02-02  Doug Kwan  <dougkwan@google.com>
7000
7001         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7002         types of relaxed input section.
7003
7004 2010-02-02  Doug Kwan  <dougkwan@google.com>
7005
7006         * Makefile.am (HFILES): Add arm-reloc-property.h.
7007         (DEFFILES): New.
7008         (TARGETSOURCES): Add arm-reloc-property.cc
7009         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7010         (libgold_a_SOURCES): $(DEFFILES)
7011         * Makefile.in: Regenerate.
7012         * arm-reloc-property.cc: New file.
7013         * arm-reloc-property.h: New file.
7014         * arm-reloc.def: New file.
7015         * arm.cc: Update comments.
7016         (arm-reloc-property.h): New included header.
7017         (arm_reloc_property_table): New global variable.
7018         (Target_arm::do_select_as_default_target): New method definition.
7019         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7020         arm-reloc-property to targ_extra_obj.
7021         * parameters.cc (set_parameters_target): Call
7022         Target::select_as_default_target().
7023         * target.h (Target::select_as_default_target): New method definition.
7024         (Target::do_select_as_default_target): Same.
7025
7026 2010-02-01  Doug Kwan  <dougkwan@google.com>
7027
7028         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7029         first_output_text_section_.
7030         (Arm_exidx_fixup::first_output_text_section): New method definition.
7031         (Arm_exidx_fixup::first_output_text_section_): New data member.
7032         (Arm_exidx_fixup::process_exidx_section): Record the first text
7033         output section seen.
7034         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7035         and entsize in output section header.
7036
7037 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7038
7039         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7040         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7041         (Arm_relocate_functions::thm_alu11): New Method.
7042         (Arm_relocate_functions::thm_pc8): New Method.
7043         (Arm_relocate_functions::thm_pc12): New Method.
7044         (Target_arm::Scan::local): Handle the relocations.
7045         (Target_arm::Scan::global): Likewise.
7046         (Target_arm::Relocate::relocate): Likewise.
7047         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7048
7049 2010-01-29  Doug Kwan  <dougkwan@google.com>
7050
7051         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7052         of relocation types as ld.
7053
7054 2010-01-29  Doug Kwan  <dougkwan@google.com>
7055
7056         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7057         to public.
7058         (Arm_relocate_functions::thumb_branch_common): Ditto.
7059         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7060         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7061         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7062         Arm_relocate_functions::jump24): Remove.
7063         (Target_arm::Relocate::relocate): Adjust code to call
7064         Arm_relocation_functions::arm_branch_common and
7065         Arm_relocation_functions::thumb_branch_common instead of their removed
7066         wrappers.  Merge switch-cases together to reduce source code size.
7067
7068 2010-01-29  Doug Kwan  <dougkwan@google.com>
7069
7070         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7071         output_local_symbol_count_needs_update_.
7072         (Arm_relobj::output_local_symbol_count_needs_update,
7073          Arm_relobj::set_output_local_symbol_count_needs_update,
7074          Arm_relobj::update_output_local_symbol_count): New methods.
7075         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7076         member.
7077         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7078         of pointed function as in a R_ARM_PREL31 relocation.
7079         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7080         for output local symbol count updating.
7081         (Target_arm::do_relax): Update output local symbol counts in objects
7082         if necessary.
7083         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7084
7085 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7086
7087         * arm.cc: Added support for the ARM relocations:
7088         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7089         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7090         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7091         movw_prel_nc).
7092         (Arm_relocate_functions::movw_rel): New method.
7093         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7094         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7095         thm_movw_prel_nc).
7096         (Arm_relocate_functions::thm_movw_rel): New method.
7097         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7098         thm_movt_prel).
7099         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7100         relocations.
7101         (Target_arm::Scan::global): Likewise.
7102         (Target_arm::Relocate::relocate): Likewise.
7103         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7104         Likewise.
7105
7106 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7107
7108         * arm.cc: Added support for ARM group relocations.
7109         (Target_arm::reloc_needs_sym_origin): New method.
7110         (Arm_relocate_functions::calc_grp_kn): New method.
7111         (Arm_relocate_functions::calc_grp_residual): New method.
7112         (Arm_relocate_functions::calc_grp_gn): New method.
7113         (Arm_relocate_functions::arm_grp_alu): New Method.
7114         (Arm_relocate_functions::arm_grp_ldr): New Method.
7115         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7116         (Arm_relocate_functions::arm_grp_ldc): New Method.
7117         (Target_arm::Scan::local): Handle the ARM group relocations.
7118         (Target_arm::Scan::global): Likewise.
7119         (Target_arm::Relocate::relocate): Likewise.
7120         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7121         Likewise.
7122
7123 2010-01-26  Doug Kwan  <dougkwan@google.com>
7124
7125         * arm.cc (set): Include.
7126         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7127         pointer type.
7128         (Arm_output_section::Text_section_list): New type.
7129         (Arm_output_section::append_text_sections_to_list): New method.
7130         (Arm_output_section::fix_exidx_coverage): Ditto.
7131         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7132         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7133         Relobj::set_section_offset() instead of
7134         Sized_relobj::invalidate_section_offset().
7135         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7136         parameter for section headers. Ignore relocation sections for
7137         unallocated sections and EXIDX sections.
7138         (Target_arm::fix_exidx_coverage): New method.
7139         (Target_arm::output_section_address_less_than): New type.
7140         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7141         linked text section instead of the EXIDX section.
7142         (Arm_output_section::create_stub_group): Add an assertion to check
7143         that this is not an EXIDX output section.
7144         (Arm_output_section::append_text_sections_to_list): New method.
7145         (Arm_output_section::fix_exidx_coverage): Ditto.
7146         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7147         Arm_relobj::section_needs_reloc_stub_scanning.
7148         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7149         first pass.
7150         (Target_arm::fix_exidx_coverage): New method.
7151         * object.h (Relobj::set_output_section): New method.
7152         (Sized_relobj::invalidate_section_offset): Remove method.
7153         (Sized_relobj::do_invalidate_section_offset): Remove method.
7154         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7155
7156 2010-01-25  Doug Kwan  <dougkwan@google.com>
7157
7158         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7159         Fix warning due to signed and unsigned comparison on a 32-bit host.
7160
7161 2010-01-22  Doug Kwan  <dougkwan@google.com>
7162
7163         * arm.cc (Target_arm::do_relax): Record an output section for section
7164         offset adjustment it contains any stub table that has changed.
7165         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7166         offsets in an output section if necessary.
7167         * output.cc (Output_section::Output_section): Initialize
7168         section_offsets_need_adjustments_.
7169         (Output_section::add_input_section_for_script): Renamed to
7170         Output_section::add_simple_input_section.
7171         (Output_section::save_states): Add a comment.
7172         (Output_section::discard_states): New method defintion.
7173         (Output_section::adjust_section_offsets): Same.
7174         * output.h (Output_section::add_input_section_for_script): Renamed to
7175         Output_section::add_simple_input_section.
7176         (Output_section::discard_states): New method declaration.
7177         (Output_section::adjust_section_offsets): Same.
7178         (Output_section::section_offsets_need_adjustment,
7179         Output_section::set_section_offsets_need_adjustment): New method
7180         definitions.
7181         (Output_section::section_offsets_need_adjustment_): New data member.
7182         * script-sections.cc
7183         (Output_section_element_input::set_section_address): Adjust code for
7184         renaming of Output_section::add_input_section_for_script.
7185         (Orphan_output_section::set_section_address): Same.
7186
7187 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7188
7189         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7190         Fix_v4bx enum values .
7191         * gold/options.h (General_options): New option definitions.
7192         (General_options::fix_v4bx): New method.
7193         (General_options::Fix_v4bx): New enum.
7194         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7195         (General_options::parse_fix_v4bx_interworking): New method.
7196
7197 2010-01-22  Doug Kwan  <dougkwan@google.com>
7198
7199         * arm.cc (Arm_exidx_fixup): New class.
7200
7201 2010-01-21  Doug Kwan  <dougkwan@google.com>
7202
7203         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7204         classes.
7205         (Arm_exidx_section_offset_map): New type.
7206
7207 2010-01-21  Doug Kwan  <dougkwan@google.com>
7208
7209         * arm.cc (Arm_exidx_input_section): New class.
7210         (Arm_relobj::exidx_input_section_by_link,
7211         Arm_relobj::exidx_input_section_by_shndx,
7212         Arm_relobj::make_exidx_input_section): New methods.
7213         (read_arm_attributes_section): Remove.
7214         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7215         information about them.
7216         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7217         to here.
7218
7219 2010-01-20  Doug Kwan  <dougkwan@google.com>
7220
7221         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7222         Input_section_specifier to Section_id.
7223         (Target_arm::new_arm_input_section: Adjust code for change of key
7224         type.
7225         (Target_arm::find_arm_input_section): Ditto.
7226         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7227         (Section_id): Remove.
7228         (Garbage_collection::Section_id_hash): Remove.
7229         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7230         (Section_id): Remove.
7231         (Icf::Section_id_hash): Remove.
7232         * object.h (Section_id, Const_section_id, Section_id_hash,
7233         Const_section_id_hash): New type definitions.
7234         * output.cc (Output_section::add_relaxed_input_section): Change to
7235         use Const_section_id instead of Input_section_specifier as key type.
7236         (Output_section::add_merge_input_section): Ditto.
7237         (Output_section::build_relaxation_map): Change to use Section_id
7238         instead of Input_section_specifier as key type.
7239         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7240         Ditto.
7241         (Output_section::convert_input_sections_to_relaxed_sections): Change
7242         to use Const_section_id instead of Input_section_specifier as key type.
7243         (Output_section::find_merge_section): Ditto.
7244         (Output_section::find_relaxed_input_section): Ditto.
7245         * output.h (Input_section_specifier): Remove class.
7246         (Output_section::Output_section_data_by_input_section_map): Change
7247         key type to Const_section_id.
7248         (Output_section::Output_relaxed_input_section_by_input_section_map):
7249         Ditto.
7250         (Output_section::Relaxation_map): Change key type to Section_id.
7251
7252 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7253
7254         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7255         (class Arm_v4bx_stub): New class.
7256         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7257         (Stub_factory::make_arm_v4bx_stub): New method.
7258         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7259         (Stub_table::empty): Handle v4bx stubs.
7260         (Stub_table::add_arm_v4bx_stub): New method.
7261         (Stub_table::find_arm_v4bx_stub): New method.
7262         (Arm_relocate_functions::v4bx): New method.
7263         (Target_arm::fix_v4bx): New method.
7264         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7265         (Stub_table::relocate_stubs): Likewise.
7266         (Stub_table::do_write): Likewise.
7267         (Stub_table::update_data_size_and_addralign): Likewise.
7268         (Stub_table::finalize_stubs):  Likewise.
7269         (Target_arm::Scan::local): Likewise.
7270         (Target_arm::Scan::global): Likewise.
7271         (Target_arm::do_finalize_sections): Likewise.
7272         (Target_arm::Relocate::relocate): Likewise.
7273         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7274         Likewise.
7275         (Target_arm::scan_reloc_for_stub): Likewise.
7276         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7277
7278 2010-01-19  Ian Lance Taylor  <iant@google.com>
7279
7280         * output.cc (Output_section_headers::do_sized_write): Write large
7281         segment count to sh_info field.
7282         (Output_file_header::do_sized_write): For large segment count,
7283         write PN_XNUM to e_phnum field.
7284
7285 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7286
7287         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7288         (Arm_relocate_functions::thm_jump8): New function.
7289         (Arm_relocate_functions::thm_jump11): New function.
7290         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7291         R_ARM_THM_JUMP11.
7292         (Target_arm::Scan::global): Likewise.
7293         (Target_arm::Relocate::relocate): Likewise.
7294         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7295         Likewise.
7296
7297 2010-01-14  Doug Kwan  <dougkwan@google.com>
7298
7299         * arm.cc (map, utility): Include headers.
7300         (Target_arm::apply_cortex_a8_workaround): New method.
7301         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7302         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7303         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7304         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7305         the --[no-]fix-cortex-a8 command line options.
7306         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7307         (Target_arm::relocate_stub): Use addend in instruction template.
7308         * options.h (DEFINE_bool): Set the user-set flag.
7309         (General_options): Add --[no-]-fix-cortex options.
7310         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7311         : Update fast look-up map after conversion.
7312
7313 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7314
7315         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7316         in the first pass of do_layout.
7317
7318 2010-01-13  Doug Kwan  <dougkwan@google.com>
7319
7320         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7321         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7322         apparent compiler problem of not folding static constant integral
7323         data members of elfcpp::Elf_sizes<32>.
7324
7325 2010-01-13  Doug Kwan  <dougkwan@google.com>
7326
7327         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7328         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7329         Arm_relobj::scan_section_for_cortex_a8_erratum,
7330         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7331         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7332         sections to scan for relocation stubs into a new method
7333         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7334         relocation and Cortex-A8 stub scanning.
7335         (Target_arm::do_relax): Force stubs to be after stubbed sections
7336         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7337         the beginning of a new relaxation pass.  Update a comment.
7338         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7339
7340 2010-01-12  Ian Lance Taylor  <iant@google.com>
7341
7342         * target-reloc.h (visibility_error): New inline function.
7343         (relocate_section): Call visibility_error.
7344         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7345         (MOSTLYCLEANFILES): Likewise.
7346         (protected_4_pic.o, protected_3.err): New targets.
7347         * testsuite/protected_4.cc: New file.
7348
7349 2010-01-12  Doug Kwan  <dougkwan@google.com>
7350
7351         * arm.cc (Cortex_a8_reloc): New class.
7352         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7353         and cortex_a8_relocs_info_.
7354         (Target_arm::fix_cortex_a8): New method definition.
7355         (Target_arm::Cortex_a8_relocs_info): New type.
7356         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7357         New data member declarations.
7358         (Target_arm::scan_reloc_for_stub): Record information about
7359         relocations for THUMB branches that might be exempted from the
7360         Cortex-A8 workaround.
7361         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7362         at the beginning of a relaxation pass.
7363
7364 2010-01-12  Doug Kwan  <dougkwan@google.com>
7365
7366         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7367         (Arm_relobj::Mapping_symbol_position,
7368          Arm_reloj::Mapping_symbol_position_less,
7369          Arm_relobj::Mapping_symbols_info): New types.
7370         (Target_arm::is_mapping_symbol_name): New method definition.
7371         (Arm_relobj::do_count_local_symbols): Save information about mapping
7372         symbols.
7373
7374 2010-01-11  Doug Kwan  <dougkwan@google.com>
7375
7376         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7377         Arm_relocate_functions::thumb32_branch_upper,
7378         Arm_relocate_functions::thumb32_branch_lower,
7379         Arm_relocate_functions::thumb32_cond_branch_offset,
7380         Arm_relocate_functions::thumb32_cond_branch_upper,
7381         Arm_relocate_functions::thumb32_cond_branch_lower,
7382         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7383         branch offset encoding.
7384         (Arm_relocate_functions::thumb_branch_common): Use new branch
7385         offset encoding methods to avoid code duplication.
7386         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7387         (Stub_addend_reader::operator()): Use new branch encoding method
7388         to avoid code duplication.
7389
7390 2010-01-11  Doug Kwan  <dougkwan@google.com>
7391
7392         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7393         (Target_arm::do_finalize_sections): Define special EXIDX section
7394         symbols only if referenced.
7395         * gc.h (Garbage_collection::add_reference): New method.
7396         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7397         code duplication.
7398
7399 2010-01-11  Ian Lance Taylor  <iant@google.com>
7400
7401         * script.cc (Version_script_info::build_expression_list_lookup):
7402         Change complaing about duplicate wildcard match from error to
7403         warning.
7404
7405         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7406         of 2009-12-30.
7407         (Version_script_info::Version_script_info): Initialize globs_,
7408         default_version_, default_is_global_, and exact_.  Don't
7409         initialize globals_ or locals_.
7410         (Version_script_info::build_lookup_tables): Build local symbols
7411         first.
7412         (Version_script_info::unquote): New function.
7413         (Version_script_info::add_exact_match): New function.
7414         (Version_script_info::build_expression_list_lookup): Remove lookup
7415         parameter.  Add is_global parameter.  Change all callers.  Handle
7416         wildcard pattern specially.  Unquote pattern.  Call
7417         add_exact_match.
7418         (Version_script_info::get_name_to_match): New function.
7419         (Version_script_info::get_symbol_version): New function.
7420         (Version_script_info::get_symbol_version_helper): Remove.
7421         (Version_script_info::check_unmatched_names): Call unquote.
7422         * script.h (class Version_script_info): Change get_symbol_version
7423         to be non-inline and add is_global parameter; change all callers.
7424         Rewrite symbol_is_local.  Update declarations.  Define struct
7425         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7426         Remove globals_ and locals_ members.  Add exact_, globs_,
7427         default_version_, is_global_.
7428         (Version_script_info::Glob): Remove pattern, add expression and
7429         is_global.  Update constructor.  Change all callers.
7430         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7431         default version.
7432         (Versions::symbol_section_contents): If a symbol is undefined, or
7433         defined in a dynamic object, set the version index to
7434         VER_NDX_LOCAL.
7435         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7436         symbol_is_local.
7437         (Symbol_table::add_from_pluginobj): Likewise.
7438         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7439
7440 2010-01-11  Doug Kwan  <dougkwan@google.com>
7441
7442         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7443         (incremental_dump_LDADD): Add linking option for libintl.
7444         * Makefile.in: Regenerate.
7445
7446 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7447
7448         PR gold/11144
7449         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7450         instead of -Ds.
7451         * testsuite/Makefile.in: Regenerated.
7452
7453 2010-01-10  Doug Kwan  <dougkwan@google.com>
7454
7455         * options.h (DEFINE_var): Use parentheses around argument varname__
7456         in macro body to avoid any unintended subsequent substitutions.
7457
7458 2010-01-10  Ian Lance Taylor  <iant@google.com>
7459
7460         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7461         candidates before doing symbol resolution.
7462
7463         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7464         ODR candidates if only one is weak.
7465
7466 2010-01-08  Ian Lance Taylor  <iant@google.com>
7467
7468         * script.cc (Version_script_info::build_expression_list_lookup):
7469         Don't warn about ambiguous version, just record the ambiguity.
7470         (Version_script_info::get_symbol_version_helper): Give error if
7471         version is ambiguous.
7472
7473 2010-01-08  Doug Kwan  <dougkwan@google.com>
7474
7475         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7476         prev_data_size_ and prev_addralign_.  Remove initializer for
7477         deleted data member has_been_changed_.
7478         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7479         to determine if the table is empty.
7480         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7481         Remove.
7482         (Stub_table::add_reloc_stub): Define method in class definition
7483         instead of just declaring it there.
7484         (Stub_table::add_cortex_a8_stub): New method definition.
7485         (Stub_table::update_data_size_and_addralign): Ditto.
7486         (Stub_table::finalize_stubs): Ditto.
7487         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7488         (Stub_table::do_addralign_): Return address alignment in the
7489         (Stub_table::do_reset_address_and_file_offset): Define method in
7490         class definition instead of declaring it there.  Set current data
7491         size to be the data size of the previous pass.
7492         (Stub_table::set_final_data_size): Use current data size as the
7493         final data size.
7494         (Stub_table::relocate_stub): Change parameter type of stub from
7495         Reloc_stub pointer to Stub pointer.
7496         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7497         (Stub_table::Cortex_a8_stub_list): New typedef.
7498         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7499          Stub_table::prev_addralign_): New data member.
7500         (Arm_relobj::Arm_relobj): Initialize data member
7501         section_has_cortex_a8_workaround_.
7502         (Arm_relobj::section_has_cortex_a8_workaround,
7503          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7504          definitions.
7505         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7506         declarations.
7507         (Target_arm::relocate_stub): Change parameter type of stub from
7508         Reloc_stub pointer to Stub pointer.
7509         (Insn_template::size, Insn_template::alignment): Handle
7510         THUMB16_SPECIAL_TYPE.
7511         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7512          Stub_table::update_data_size_and_addralign,
7513          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7514         definitions.
7515         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7516         (Stub_table::do_write): Ditto.
7517         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7518
7519 2010-01-08  Ian Lance Taylor  <iant@google.com>
7520
7521         PR 11108
7522         * symtab.h (class Symbol): Remove fields is_target_special_ and
7523         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7524         (Symbol::is_defined_in_discarded_section): New function.
7525         (Symbol::set_is_defined_in_discarded_section): New function.
7526         (Symbol::has_plt_offset): Rewrite.
7527         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7528         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7529         Don't initialize is_target_special_ or has_plt_offset_.
7530         Initialize is_defined_in_discarded_section_.
7531         (Symbol_table::add_from_relobj): If appropriate, set
7532         is_defined_in_discarded_section.
7533         * resolve.cc (Symbol::override_base_with_special): Don't test
7534         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7535         * target-reloc.h (relocate_section): Do special handling for
7536         symbols defined in discarded sections for global symbols as well
7537         as local symbols.
7538
7539 2010-01-08  Ian Lance Taylor  <iant@google.com>
7540
7541         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7542         the SHT_SYMTAB case.
7543
7544 2010-01-08  Ian Lance Taylor  <iant@google.com>
7545
7546         * object.cc (Sized_relobj::do_layout): Don't get confused if
7547         layout_eh_frame returns NULL.
7548
7549 2010-01-08  Ian Lance Taylor  <iant@google.com>
7550
7551         PR 11084
7552         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7553         dynamic symbol table, use the normal symbol table.
7554         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7555         symbol table.
7556
7557 2010-01-08  Ian Lance Taylor  <iant@google.com>
7558
7559         PR 11072
7560         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7561         sections.
7562
7563 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7564
7565         * version.cc (print_version): Change to "Copyright 2010".
7566
7567 2010-01-08  Ian Lance Taylor  <iant@google.com>
7568
7569         PR 10287
7570         PR 11063
7571         * i386.cc (class Target_i386): Change return type of plt_section
7572         to be non-const.
7573         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7574         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7575         tls_desc_rel_ field.
7576         (Output_data_plt_i386::rel_tls_desc): New function.
7577         (Target_i386::rel_tls_desc_section): New function.
7578         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7579         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7580         R_386_TLS_DESC reloc in rel_tls_desc_section.
7581         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7582         Define struct Tlsdesc_info.
7583         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7584         (Target_x86_64::do_reloc_symbol_index): New function.
7585         (Target_x86_64::add_tlsdesc_info): New function.
7586         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7587         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7588         tlsdesc_rel_ field.
7589         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7590         all callers.
7591         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7592         (Target_x86_64::rela_tlsdesc_section): New function.
7593         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7594         handling.
7595         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7596         (Target_x86_64::do_reloc_addend): New function.
7597         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7598         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7599         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7600         (Output_reloc::type): New function.
7601         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7602         (Output_reloc::is_target_specific): New function.
7603         (Output_reloc::target_arg): New function.
7604         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7605         absolute relocs and target specific relocs.
7606         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7607         add_target_specific.
7608         (class Output_data_reloc) [SHT_RELA]: Likewise.
7609         * output.cc (Output_reloc::Output_reloc): Add four new versions
7610         for absolute relocs and target specific relocs.
7611         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7612         (Output_reloc::get_symbol_index): Likewise.
7613         (Output_reloc::local_section_offset): Check that local_sym_index_
7614         is not TARGET_CODE or 0.
7615         (Output_reloc::symbol_value): Likewise.
7616         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7617         reloc.
7618         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7619         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7620         functions.
7621         * layout.cc (add_target_dynamic_tags): Use output section for
7622         DT_PLTRELSZ and DT_JMPREL.
7623
7624 2010-01-07  Ian Lance Taylor  <iant@google.com>
7625
7626         PR 11061
7627         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7628         function.
7629         (class Output_data_reloc_generic): Define.
7630         (class Output_data_reloc_base): Change base class to
7631         Output_data_reloc_generic.  Change add() method to call
7632         bump_relative_reloc_count for a relative reloc.  Remove
7633         sort_relocs_ field.
7634         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7635         to sort_relocs().
7636         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7637         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7638         appropriate.
7639         * layout.h (class Layout): Update declaration.
7640
7641 2010-01-07  Ian Lance Taylor  <iant@google.com>
7642
7643         * output.h (class Output_data): Add const version of
7644         output_section and do_output_section.
7645         (class Output_section_data): Add const version of
7646         do_output_section.
7647         (class Output_section): Likewise.
7648         * layout.cc (Layout::add_target_dynamic_tags): New function.
7649         * layout.h (class Layout): Update declarations.
7650         * arm.cc (Target_arm::do_finalize_sections): Use
7651         add_target_dynamic_tags.
7652         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7653         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7654         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7655         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7656
7657 2010-01-07  Ian Lance Taylor  <iant@google.com>
7658
7659         PR 11042
7660         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7661         object as needed.
7662
7663 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7664             Ian Lance Taylor  <iant@google.com>
7665
7666         PR 11019
7667         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7668         Xindex::read_symtab_xindex.
7669
7670 2010-01-07  Doug Kwan  <dougkwan@google.com>
7671
7672         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7673         (Insn_template::thumb16_bcond_insn): New method declaration.
7674         (Insn_template): Fix spelling.
7675         (Stub::thumb16_special): New method declaration.
7676         (Stub::do_write): Define virtual method which was previously pure
7677         virtual.
7678         (Stub::do_thumb16_special): New method declaration.
7679         (Stub::do_fixed_endian_write): New template member.
7680         (Reloc_stub::do_write): Remove.
7681         (Reloc_stub::do_fixed_endian_write): Remove.
7682         (Cortex_a8_stub): New class definition.
7683         (Stub_factory::make_cortex_a8_stub): New method definition.
7684         (Stub_factory::Stub_factory): Add missing static storage class
7685         qualifier for elf32_arm_stub_a8_veneer_blx.
7686
7687 2010-01-07  Ian Lance Taylor  <iant@google.com>
7688
7689         PR 10980
7690         * options.h (class General_options): Add --warn-unresolved-symbols
7691         and --error-unresolved-symbols.
7692         * errors.cc (Errors::undefined_symbol): Implement
7693         --warn-unresolved-symbols.
7694
7695         * options.h (class General_options): Add -z text and -z textoff.
7696         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7697
7698 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7699
7700         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7701         (Garbage_collection::cident_sections): New function.
7702         (Garbage_collection::add_cident_section): New function.
7703         (Garbage_collection::cident_sections_): New member.
7704         (gc_process_relocs): Add references to sections whose names are C
7705         identifiers.
7706         * gold.h (cident_section_start_prefix): New constant.
7707         (cident_section_stop_prefix): New constant.
7708         (is_cident): New function.
7709         * layout.cc (Layout::define_section_symbols): Replace string constants
7710         with the newly defined constants.
7711         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7712         C identifiers.
7713         * testsuite/Makefile.am: Add gc_orphan_section_test.
7714         * testsuite/Makefile.in: Regenerate.
7715         * testsuite/gc_orphan_section_test.cc: New file.
7716         * testsuite/gc_orphan_section_test.sh: New file.
7717
7718 2010-01-06  Ian Lance Taylor  <iant@google.com>
7719
7720         PR 10980
7721         * options.h (class General_options): Add --warn-shared-textrel.
7722         * layout.cc (Layout::finish_dynamic_section): Implement
7723         --warn-shared-textrel.
7724
7725         PR 10980
7726         * options.h (class General_options): Add --warn-multiple-gp.
7727
7728 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7729
7730         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7731         $(THREADSLIB) and $(LIBDL).
7732         * Makefile.in: Rebuild.
7733
7734 2010-01-06  Ian Lance Taylor  <iant@google.com>
7735
7736         PR 10980
7737         * options.cc (General_options::parse_section_start): New function.
7738         (General_options::section_start): New function.
7739         (General_options::General_options): Initialize all members.
7740         * options.h: Include <map>
7741         (class General_options): Add --section-start.  Add section_starts_
7742         member.
7743         * layout.cc (Layout::attach_allocated_section_to_segment): If
7744         --section-start was used, set the address of the segment.  Remove
7745         local sort_sections.
7746         (Layout::relaxation_loop_body): If the address of the load segment
7747         has been set by --section-start, don't use it.
7748         * output.h (Output_segment::update_flags_for_output_section): New
7749         function.
7750         * output.cc (Output_segment::add_output_section): Call
7751         update_flags_for_output_section.
7752
7753 2010-01-05  Ian Lance Taylor  <iant@google.com>
7754
7755         PR 10980
7756         * options.h (class General_options): Add --undefined-version.
7757         * script.cc (struct Version_expression): Add was_matched_by_symbol
7758         field.
7759         (Version_script_info::matched_symbol): New function.
7760         (Version_script_info::get_symbol_version_helper): Call
7761         matched_symbol.
7762         (Version_script_info::check_unmatched_names): New function.
7763         * script.h (class Version_script_info): Update declarations.
7764         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7765
7766         * options.h (class General_options): Use DEFINE_bool_alias for
7767         allow_multiple_definition.
7768         * resolve.cc (Symbol_table::should_override): Don't test
7769         allow_multiple_definition.
7770
7771         PR 10980
7772         * options.h (class General_options): Add --cref.
7773         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7774         until after printing cref table.
7775         * cref.cc: Include "symtab.h".
7776         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7777         (Cref_table_compare::operator()): New function.
7778         (Cref_inputs::gather_cref): New function.
7779         (filecol): New static const.
7780         (Cref_inputs::print_cref): New function.
7781         (Cref::print_cref): New function.
7782         * cref.h: Include <cstdio>.
7783         (class Cref): Update declarations.
7784         * mapfile.h (Mapfile::file): New function.
7785         * object.h (class Object): Define Symbols.  Declare virtual
7786         do_get_global_symbols.
7787         (Object::get_global_symbols): New function.
7788         * object.cc (Input_objects::add_object): Pass object to cref_ if
7789         --cref.
7790         (Input_objects::archive_start): Likewise.
7791         (Input_objects::archive_stop): Likewise.
7792         (Input_objects::print_cref): New function.
7793         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7794         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7795         --cref.
7796         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7797         function.
7798         * plugin.h (class Sized_pluginobj): Update declarations.
7799
7800 2010-01-05  Ian Lance Taylor  <iant@google.com>
7801
7802         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7803         to is_default_version.  Rename insdef to insdefault.
7804         (Symbol_table::add_from_relobj): Rename def to is_default_version
7805         and local to is_forced_local.
7806         (Symbol_table::add_from_pluginobj): Likewise.
7807         (Symbol_table::add_from_dynobj): Likewise.
7808         (Symbol_table::define_special_symbol): Rename insdef to
7809         insdefault.
7810
7811 2010-01-04  Ian Lance Taylor  <iant@google.com>
7812
7813         PR 10980
7814         * options.h (class General_options): Add
7815         --allow-multiple-definition and -z muldefs.
7816         * resolve.cc (Symbol_table::should_override): Don't warn about a
7817         multiple symbol definition if --allow-multiple-definition or -z
7818         muldefs.
7819
7820         PR 10980
7821         * options.h (class General_options): Add --add-needed and
7822         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7823         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7824         error if --copy-dt-needed-entries aka --add-needed is used and
7825         would cause a change in behaviour.
7826
7827         PR 10980
7828         * options.h (class General_options): Add -G as a short version of
7829         --shared.  Add no-op options -assert, -g, and -i.
7830
7831 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7832
7833         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7834         check for .text or .gnu.linkonce.t sections.
7835         * icf.cc (Icf::find_identical_sections): Ditto.
7836         Change the detection for mangled function name within the section
7837         name.
7838         * icf.h (is_section_foldable_candidate): New function.
7839
7840 2009-12-30  Ian Lance Taylor  <iant@google.com>
7841
7842         PR 10980
7843         * options.h (class General_options): Permit two dashes with
7844         --retain-symbols-file.
7845
7846 2009-12-30  Ian Lance Taylor  <iant@google.com>
7847
7848         PR 10979
7849         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7850         don't put the file header and segment headers in the text
7851         segment.
7852
7853         PR 10979
7854         * common.cc (Sort_commons::operator()): Stabilize sort when both
7855         entries are NULL.
7856         (Symbol_table::do_allocate_commons_list): When allocating common
7857         symbols, skip a symbol which is no longer common.
7858         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7859         an object before checking its type.
7860         * testsuite/common_test_2.c: New file.
7861         * testsuite/common_test_3.c: New file.
7862         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7863         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7864         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7865         (common_test_2_pic.o, common_test_2.so): New targets.
7866         (common_test_3_pic.o, common_test_3.so): New targets.
7867         * testsuite/Makefile.in: Rebuild.
7868
7869         PR 10979
7870         * script.cc (read_input_script): If we see a new SECTIONS clause,
7871         and we have added an input section, give an error.
7872         * layout.h (class Layout): Add have_added_input_section function.
7873         Add have_added_input_section_ field.
7874         * layout.cc (Layout::Layout): Initialize
7875         have_added_input_section_.
7876         (Layout::layout): Set have_added_input_section_.
7877         (Layout::layout_eh_frame): Likewise.
7878
7879 2009-12-30  Ian Lance Taylor  <iant@google.com>
7880
7881         PR 10931
7882         * options.h (class General_options): Add --sort-common option.
7883         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7884         * common.cc (Sort_common): Add sort_order parameter to
7885         constructor.  Add sort_order_ field.
7886         (Sort_commons::operator): Check sort_order_.
7887         (Symbol_table::allocate_commons): Determine the sort order.
7888         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7889         Change all callers.
7890         (Symbol_table::do_allocate_commons_list): Likewise.
7891
7892 2009-12-30  Ian Lance Taylor  <iant@google.com>
7893
7894         PR 10916
7895         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7896         symbols from this object, don't change the visibility of an
7897         undefined symbol.
7898         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7899
7900 2009-12-30  Ian Lance Taylor  <iant@google.com>
7901
7902         PR 10861
7903         * script.h (class Version_script_info): Define Language enum.
7904         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7905         new fields globals_, locals_, and is_finalized_.
7906         * script.cc: Various formatting fixes.
7907         (class Parser_closure): Change language_stack_ from a vector of
7908         std::string to one of Version_script_info::Language.  Adjust all
7909         uses accordingly.
7910         (class Lazy_demangler): Remove.
7911         (struct Version_expression): Change language from std::string to
7912         Version_script_info::Language.
7913         (Version_script_info::Version_script_info): New function.
7914         (Version_script_info::~Version_script_info): Don't call clear.
7915         (Version_script_info::finalize): New function.
7916         (Version_script_info::build_lookup_tables): New function.
7917         (Version_script_info::build_expression_list_lookup): New
7918         function.
7919         (Version_script_info::get_symbol_version_helper): Rewrite to use
7920         lookup tables.
7921         (Version_script_info::print_expression_list): Adjust to use
7922         Version_script_info::Language.
7923         (script_push_lex_into_version_mode): Check that the version script
7924         has not been finalized.
7925         (version_script_push_lang): Change language string to
7926         Version_script_info::Language.
7927         * options.cc (Command_line::version_script): New function.
7928         * options.h (class General_options): Add finalize_dynamic_list
7929         function.  Change version_script from declaration to definition.
7930         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7931         * testsuite/version_script.map: Remove duplicate def of foo.
7932         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7933         version_script.map.
7934         * testsuite/Makefile.in: Rebuild.
7935
7936 2009-12-30  Ian Lance Taylor  <iant@google.com>
7937
7938         PR 10843
7939         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7940         if the input symbol index is 0, make the output symbol index 0.
7941
7942 2009-12-30  Ian Lance Taylor  <iant@google.com>
7943
7944         PR 10670
7945         * options.h (class General_options): Add -x/--discard-all.
7946         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7947         --discard-all.  If the local symbol needs a dynamic entry, check
7948         that before handling --discard-locals.
7949
7950 2009-12-30  Ian Lance Taylor  <iant@google.com>
7951
7952         PR 10450
7953         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7954         flags to PF_R.
7955         (Output_segment::add_output_section): Don't change the flags if
7956         the type is PT_TLS.
7957
7958         PR 10450
7959         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7960         GNU hash table if they need a dynamic value.  Otherwise, don't add
7961         them if they are defined in a dynamic object or are forced local.
7962
7963 2009-12-29  Ian Lance Taylor  <iant@google.com>
7964
7965         PR 10450
7966         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7967         .gnu.hash table for a 32-bit target.
7968
7969         PR 10450
7970         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7971         regular and a dynamic object only needs a dynamic symbol table
7972         entry if it is externally visible.
7973
7974         PR 10450
7975         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7976         constructor.  Add global_offset_table_ field.
7977         (Target_i386::got_section): Set global_offset_table_.
7978         (Target_i386::do_finalize_sections): Set global_offset_table_
7979         size.
7980         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7981         in constructor.  Add global_offset_table_ field.
7982         (Target_x86_64::got_section): Set global_offset_table_.
7983         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7984         size.
7985
7986         * layout.cc (Layout::Layout): Initialize increase_relro_.
7987         (Layout::get_output_section): Add is_relro, is_last_relro, and
7988         is_first_non_relro parameters.  Change all callers.
7989         (Layout::choose_output_section): Likewise.
7990         (Layout::add_output_section_data): Likewise.
7991         (Layout::make_output_section): Likewise.
7992         (Layout::set_segment_offsets): Clear increase_relro when using a
7993         linker script.
7994         * layout.h (class Layout): Add increase_relro method.  Add
7995         increase_relro_ field.  Update declarations.
7996         * output.cc (Output_section::Output_section): Initialize
7997         is_last_relro_ and is_first_non_relro_.
7998         (Output_segment::add_output_section): Group relro sections is
7999         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8000         (Output_segment::maximum_alignment): Remove relro handling.
8001         (Output_segment::set_section_addresses): Add increase_relro
8002         parameter.  Change all callers.  Add initial alignment to align
8003         relro sections on separate page.  Remove old relro handling.
8004         (Output_segment::set_section_list_addresses): Remove in_relro
8005         parameter.  Change all callers.
8006         (Output_segment::set_offset): Add increase parameter.  Change all
8007         callers.  Remove old relro handling.
8008         * output.h (class Output_section): Add new methods: is_last_relro,
8009         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8010         Add is_last_relro_ and is_first_non_relro_ fields.
8011         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8012         Create separate .got.plt section.  Call increase_relro.
8013         * x86_64.cc (Target_x86_64::got_section): Likewise.
8014         * testsuite/relro_script_test.t: Add .got.plt.
8015
8016         PR 10450
8017         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8018         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8019         (Layout::finalize): Call set_dynamic_symbol_size.
8020         (Layout::set_dynamic_symbol_size): New function.
8021         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8022         set_dynamic_symbol_size.
8023
8024         PR 10450
8025         * output.h (class Output_section): Add is_entsize_zero_ field.
8026         * output.cc (Output_section::Output_section): Initialize
8027         is_entsize_zero_.
8028         (Output_section::set_entsize): If two different entsizes are
8029         requested, force it to zero.
8030         (Output_section::add_input_section): Set flags for .debug_str
8031         before updating section flags.  Set entsize.
8032         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8033         and SHF_STRING if all input sections have those flags.
8034
8035 2009-12-29   Rafael Espindola  <espindola@google.com>
8036
8037         * main.cc (main): Fix the sys time reporting.
8038         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8039         reporting.
8040
8041 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8042
8043         * options.cc (General_options::parse_version): Allow -v to exit
8044         without an error if there is nothing to link.
8045
8046 2009-12-29  Ian Lance Taylor  <iant@google.com>
8047
8048         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8049         using a version of gcc before 4.1.
8050         * configure: Rebuild.
8051
8052 2009-12-28  Chris Demetriou  <cgd@google.com>
8053
8054         * attributes.cc (Output_attributes_section_data::do_write): Use
8055         std::vector::front rather than std::vector::data.
8056
8057 2009-12-28  Ian Lance Taylor  <iant@google.com>
8058
8059         * symtab.h (class Symbol_table): Add enum Defined.
8060         * resolve.cc (Symbol_table::should_override): Add defined
8061         parameter.  Change all callers.  Test whether object is NULL
8062         before calling a method on it.
8063         (Symbol_table::report_resolve_problem): Add defined parameter.
8064         Change all callers.
8065         (Symbol_table::should_override_with_special): Likewise.
8066         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8067         parameter.  Change all callers.
8068         (Symbol_table::do_define_in_output_data): Likewise.
8069         (Symbol_table::define_in_output_segment): Likewise.
8070         (Symbol_table::do_define_in_output_segment): Likewise.
8071         (Symbol_table::define_as_constant): Likewise.
8072         (Symbol_table::do_define_as_constant): Likewise.
8073         * script.h (class Symbol_assignment): Add is_defsym parameter to
8074         constructor; change all callers.
8075         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8076         parameter.  Change all callers.  Add is_defsym_ field.
8077         (class Parser_closure): Add parsing_defsym parameter to
8078         constructor; change all callers.  Add parsing_defsym accessor
8079         function.  Add parsing_defsym_ field.
8080
8081 2009-12-28  Ian Lance Taylor  <iant@google.com>
8082
8083         * gold.cc (queue_middle_tasks): Fix formatting.
8084         * object.cc (Relobj::is_section_name_included): Likewise.
8085
8086 2009-12-23  Ian Lance Taylor  <iant@google.com>
8087
8088         * i386.cc (Target_i386::do_calls_non_split): Recognize
8089         -fsplit-stack prologue for a function with a static chain.
8090         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8091         -fsplit-stack prologue when using %r11.
8092
8093 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8094
8095         * options.cc (General_options::parse_version): Make -v continue and do
8096         the link like GNU ld does.
8097
8098 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8099
8100         * Makefile.am (CCFILES): Add timer.cc.
8101         (HFILES): Add timer.h.
8102         * configure.ac: Check for sysconf and times.
8103         * main.cc: include timer.h.
8104         (main): Use Timer instead of get_run_time.
8105         * timer.cc: New.
8106         * timer.h: New.
8107         * workqueue.cc: include timer.h.
8108         (Workqueue::find_and_run_task):
8109         Report user, sys and wall time.
8110         * Makefile.in: Regenerate.
8111         * config.in: Regenerate.
8112         * configure: Regenerate.
8113
8114 2009-12-16  Doug Kwan  <dougkwan@google.com>
8115
8116         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8117         sections.
8118         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8119         relaxed input sections.
8120         * output.cc (Output_section::find_relaxed_input_section): Change
8121         return type to Output_relaxed_input_section pointer.  Adjust code
8122         for new type of relaxed_input_section_map_.
8123         * output.h (Output_section::find_relaxed_input_section): Change
8124         return type to Output_relaxed_input_section pointer.
8125         (Output_section::Output_relaxed_input_section_by_input_section_map):
8126         New type.
8127         (Output_section::relaxed_input_section_map_): Change type to
8128         Output_section::Output_relaxed_input_section_by_input_section_map.
8129         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8130         input section.
8131
8132 2009-12-15  Ian Lance Taylor  <iant@google.com>
8133
8134         * layout.cc (Layout::create_shstrtab): Only write out after input
8135         sections if we are compressing debug sections.
8136
8137 2009-12-15  Ian Lance Taylor  <iant@google.com>
8138
8139         * archive.cc (Archive::add_symbols): Only look up a symbol without
8140         a version if there is, in fact, a version.
8141
8142 2009-12-14  Ian Lance Taylor  <iant@google.com>
8143
8144         Revert -Wshadow changes, all changes from:
8145         2009-12-11  Doug Kwan  <dougkwan@google.com>
8146         2009-12-11  Nick Clifton  <nickc@redhat.com>
8147         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8148
8149 2009-12-11  Doug Kwan  <dougkwan@google.com>
8150
8151         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8152         due to -Wshadow.
8153         * attributes.cc (Object_attribute::size): Ditto.
8154         (Attributes_section_data::size): Ditto.
8155         (Attributes_section_data::Attributes_section_data): Ditto.
8156         (Output_attributes_section_data::do_write): Ditto.
8157         * attributes.h (Object_attribute::set_type): Ditto.
8158         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8159
8160 2009-12-11  Nick Clifton  <nickc@redhat.com>
8161
8162         * archive.cc: Fix shadowed variable warnings.
8163         * arm.cc: Likewise.
8164         * compressed_output.cc: Likewise.
8165         * compressed_output.h: Likewise.
8166         * configure: Likewise.
8167         * dwarf_reader.cc: Likewise.
8168         * dynobj.cc: Likewise.
8169         * dynobj.h: Likewise.
8170         * ehframe.cc: Likewise.
8171         * ehframe.h: Likewise.
8172         * errors.cc: Likewise.
8173         * expression.cc: Likewise.
8174         * fileread.cc: Likewise.
8175         * fileread.h: Likewise.
8176         * freebsd.h: Likewise.
8177         * i386.cc: Likewise.
8178         * icf.cc: Likewise.
8179         * incremental.h: Likewise.
8180         * layout.cc: Likewise.
8181         * layout.h: Likewise.
8182         * mapfile.cc: Likewise.
8183         * merge.cc: Likewise.
8184         * merge.h: Likewise.
8185         * object.cc: Likewise.
8186         * object.h: Likewise.
8187         * options.h: Likewise.
8188         * output.cc: Likewise.
8189         * output.h: Likewise.
8190         * parameters.cc: Likewise.
8191         * plugin.cc: Likewise.
8192         * powerpc.cc: Likewise.
8193         * reduced_debug_output.cc: Likewise.
8194         * reduced_debug_output.h: Likewise.
8195         * reloc.cc: Likewise.
8196         * reloc.h: Likewise.
8197         * resolve.cc: Likewise.
8198         * script-sections.cc: Likewise.
8199         * script.cc: Likewise.
8200         * script.h: Likewise.
8201         * sparc.cc: Likewise.
8202         * symtab.cc: Likewise.
8203         * symtab.h: Likewise.
8204         * target-select.cc: Likewise.
8205         * target-select.h: Likewise.
8206         * token.h: Likewise.
8207         * workqueue.cc: Likewise.
8208         * workqueue.h: Likewise.
8209         * x86_64.cc: Likewise.
8210
8211 2009-12-10  Doug Kwan  <dougkwan@google.com>
8212
8213         * arm.cc (attributes.h): New include.
8214         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8215         (Arm_relobj::~Arm_relobj): Delete object pointed by
8216         attributes_section_data_.
8217         (Arm_relobj::attributes_section_data): New method definition.
8218         (Arm_relobj::attributes_section_data_): New data member declaration.
8219         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8220         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8221         attributes_section_data_.
8222         (Arm_dynobj::attributes_section_data): New method definition.
8223         (Arm_dynobj::attributes_section_data_): New data member declaration.
8224         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8225         initialization value of may_use_blx_ to false.
8226         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8227         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8228         object attributes to compute results instead of hard-coding.
8229         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8230         Target_arm::get_secondary_compatible_arch,
8231         Target_arm::set_secondary_compatible_arch
8232         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8233         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8234         New method declarations.
8235         (Target_arm::get_aeabi_object_attribute): New method definition.
8236         (Target_arm::attributes_section_data_): New data member declaration.
8237         (read_arm_attributes_section): New template definition.
8238         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8239         (Arm_dynobj::do_read_symbols): Ditto.
8240         (Target_arm::do_finalize_sections): Merge attributes sections from
8241         input.  Check for BLX use after attributes section merging.
8242         Fix __exidx_start and __exidx_end visibility.  Create an
8243         .ARM.attributes section if necessary.
8244         (Target_arm::get_secondary_compatible_arch,
8245         Target_arm::set_secondary_compatible_arch,
8246         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8247         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8248         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8249         New method definitions.
8250
8251 2009-12-09  Ian Lance Taylor  <iant@google.com>
8252
8253         * plugin.cc (Plugin::load): Don't cast from void* to a function
8254         pointer.
8255
8256 2009-12-09  Ian Lance Taylor  <iant@google.com>
8257
8258         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8259         information fields.
8260
8261 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8262
8263         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8264         Replace two_file_shared_1.so with two_file_shared_2.so.
8265         * testsuite/Makefile.in: Regenerated.
8266
8267 2009-12-08  Doug Kwan  <dougkwan@google.com>
8268
8269         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8270         (HFILES): Add attributes.h and int_encoding.h.
8271         * Makefile.in: Regenerate.
8272         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8273         function definitions to int_encoding.cc
8274         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8275         prototypes to int_encoding.h
8276         * reduced_debug_output.cc (int_encoding.h): New include.
8277         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8278         function definitions to int_encoding.cc
8279         (insert_into_vector, read_from_pointer): Move template definitions to
8280         int_encoding.h
8281         * attributes.cc: New file.
8282         * attributes.h: New file.
8283         * int_encoding.cc: New file.
8284         * int_encoding.h: New file.
8285
8286 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8287
8288         PR gold/11055
8289         * incremental-dump.cc (dump_incremental_inputs): New.
8290         (main): Use dump_incremental_inputs.
8291
8292 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8293
8294         PR gold/10893
8295         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8296         checking elfcpp::STT_FUNC.
8297         (Target_i386::Relocate::relocate): Likewise.
8298         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8299
8300         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8301         symbols from shared libraries into normal FUNC symbols.
8302
8303         * symtab.h (Symbol): Add is_func and use it.
8304
8305 2009-12-05  Doug Kwan  <dougkwan@google.com>
8306
8307         * arm.cc (Target_arm::arm_info): Initialize new fields
8308         attributes_section and attributes_vendor.
8309         * i386.cc (Target_i386::i386_info): Same.
8310         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8311         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8312         fields attributes_section and attributes_vendor.
8313         * sparc.cc (Target_sparc::sparc_info): Same.
8314         * target.h (Target::attributes_section, Target::attributes_vendor,
8315         Target::is_attributes_section, Target::attribute_arg_type,
8316         Target::attributes_order): New method definitions.
8317         (Target::Target_info::attributes_section,
8318         Target::Target_info::attributes_vendor): New fields.
8319         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8320         virtual method definitions.
8321         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8322         attributes_section and attributes_vendor.
8323         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8324
8325 2009-12-05  Doug Kwan  <dougkwan@google.com>
8326
8327         * arm.cc: Update comments about interworking and stub generation.
8328         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8329         considered as non-PIC.
8330         (Arm_relocate_functions::base_abs): Fix formatting.
8331         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8332         of function to use GOT entry address instead of offset.
8333         (Target_arm::Scan::global): Issue an error if a symbol would need a
8334         PLT does not get one because it is untyped.  Remove code to create
8335         dynamic symbols for relative branches.
8336         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8337         takes unsigned integer instead of boolean.
8338
8339 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8340
8341         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8342         (two_file_test_LDADD): Likewise.
8343         (common_test_1_LDADD): Likewise.
8344         (exception_test_LDADD) Likewise.
8345         (weak_test_LDADD): Likewise.
8346         (many_sections_test_LDADD): Likewise.
8347         (initpri1_LDADD): Likewise.
8348         (script_test_1_LDADD): Likewise.
8349         (script_test_2_LDADD): Likewise.
8350         (justsyms_LDADD): Likewise.
8351         (binary_test_LDADD): Likewise.
8352         (large_LDADD): Likewise.
8353         * testsuite/Makefile.in: Regenerated.
8354
8355 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8356
8357         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8358         (Symbol_table::override_with_special): Likewise.
8359         (Symbol_table::add_from_object): Likewise.
8360
8361 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8362
8363         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8364         Don't set the data_offset twice.
8365
8366 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8367
8368         * testsuite/Makefile.in: Regenerate.
8369
8370 2009-12-03  Doug Kwan  <dougkwan@google.com>
8371
8372         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8373         (Target_arm::do_finalize_sections): Add parameter for symbol table
8374         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8375         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8376         parameter for symbol table pointer.
8377         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8378         an additional parameter for a pointer to symbol table.
8379         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8380         parameter for a symbol table pointer.
8381         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8382         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8383         Ditto.
8384         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8385         parameter for a symbol table pointer.
8386
8387 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8388
8389         * incremental.cc (Incremental_inputs_header)
8390         (Incremental_inputs_header_write, Incremental_inputs_entry)
8391         (Incremental_inputs_entry_write): Move ...
8392         * incremental.h (Incremental_inputs_header)
8393         (Incremental_inputs_header_write, Incremental_inputs_entry)
8394         (Incremental_inputs_entry_write): here.
8395
8396 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8397
8398         * incremental.cc (make_sized_incremental_binary): Set the target.
8399         Error if it is incompatible.
8400         * output.h (Output_file): Add filename method.
8401
8402 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8403
8404         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8405         from the get_* methods.
8406
8407 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8408
8409         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8410         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8411         Write 0 for the data_offset of scripts.
8412
8413 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8414
8415         * testsuite/Makefile.am: Add the incremental_test.sh test.
8416         * testsuite/incremental_test.sh: New.
8417         * testsuite/incremental_test_1.c: New.
8418         * testsuite/incremental_test_2.c: New.
8419
8420 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8421
8422         * incremental-dump.cc (main): Fix typos.
8423
8424 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8425
8426         PR gold/11025
8427         * incremental-dump.cc (main): Use llu to print 64 bit values.
8428
8429 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8430             H.J. Lu  <hongjiu.lu@intel.com>
8431
8432         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8433         $(LIBDL).
8434         (incremental_dump_LDADD): Likewise.
8435         * Makefile.in: Regenerated.
8436
8437 2009-11-25  Doug Kwan  <dougkwan@google.com>
8438
8439         Revert:
8440
8441         2009-11-25  Doug Kwan  <dougkwan@google.com>
8442
8443                 * arm.cc (Target_arm::Target_arm): Move method definition
8444                 outside of class definition.  Add code to handle
8445                 --target1-rel, --target1-abs and --target2= options.
8446                 (Target_arm::get_reloc_reloc_type): Change method to be
8447                 non-static and const.
8448                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8449                 New data member declaration.
8450                 (Target_arm::Scan::local, Target_arm::Scan::global,
8451                 Target_arm::Relocate::relocate,
8452                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8453                 Adjust call to Target_arm::get_real_reloc_type.
8454                 (Target_arm::get_real_reloc_type): Use command line options
8455                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8456                 * options.h (--target1-rel, --target1-abs, --target2): New
8457                 ARM-only options.
8458
8459 2009-11-25  Doug Kwan  <dougkwan@google.com>
8460
8461         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8462         class definition.  Add code to handle --target1-rel, --target1-abs
8463         and --target2= options.
8464         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8465         and const.
8466         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8467         member declaration.
8468         (Target_arm::Scan::local, Target_arm::Scan::global,
8469         Target_arm::Relocate::relocate,
8470         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8471         call to Target_arm::get_real_reloc_type.
8472         (Target_arm::get_real_reloc_type): Use command line options to
8473         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8474         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8475         options.
8476
8477 2009-11-25  Doug Kwan  <dougkwan@google.com>
8478
8479         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8480         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8481         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8482         formatting.
8483         (Arm_relocate_functions::thm_call): Replace body with a call to
8484         Arm_relocate_functions::thumb_branch_common.
8485         (Arm_relocate_functions::thm_jump24,
8486         Arm_relocate_functions::thm_xpc22): New method definitions.
8487         (Arm_relocate_functions::thumb_branch_common): New method definition.
8488         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8489         operator.
8490         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8491         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8492
8493 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8494
8495         * Makefile.am: Build incremental-dump
8496         * Makefile.in: Regenerate.
8497         * incremental-dump.cc: New.
8498         * incremental.cc (Incremental_inputs_header_data,
8499         Incremental_inputs_entry_data): Move to incremental.h
8500         * incremental.h: (Incremental_inputs_header_data,
8501         Incremental_inputs_entry_data): Move from incremental.cc
8502
8503 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8504
8505         * incremental.cc (Incremental_inputs_header,
8506         Incremental_inputs_header_write, Incremental_inputs_entry,
8507         Incremental_inputs_entry_write): Add a typedef with the data type.
8508
8509 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8510
8511         * incremental.cc (Incremental_inputs_header,
8512         Incremental_inputs_header_write, Incremental_inputs_entry,
8513         Incremental_inputs_entry_write): Update comment about which
8514         type has the filed descriptions.
8515
8516 2009-11-15  Doug Kwan  <dougkwan@google.com>
8517
8518         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8519         (Arm_relocate_functions::arm_branch_common): Change method defintion
8520         in class definition to a method declaration and update list of formal
8521         parameters.
8522         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8523         Arm_relocation_functions::jump24): Adjust call to
8524         Arm_relocate_functions::arm_branch_common.  Update list of formal
8525         parameters.
8526         (Arm_relocate_functions::xpc25): New method definition.
8527         (Arm_relocate_functions::arm_branch_common): Move method defintion
8528         out from class definition.  Use stubs for mode-switching and extending
8529         branch ranges.
8530         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8531         specially.  Change code to enable use of stubs in ARM branches.
8532
8533 2009-11-10  Doug Kwan  <dougkwan@google.com>
8534
8535         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8536         in method declaration.
8537         (Target_arm::relocate_stub): New method declaration.
8538         (Target_arm::default_target): Change to return a pointer instead of
8539         a const reference.
8540         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8541         Target_arm::default_target.
8542         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8543         method definition.
8544         (Target_arm::relocate_section): Adjust view.
8545         (Target_arm::relocate_stub): New method definition.
8546
8547 2009-11-10  Doug Kwan  <dougkwan@google.com>
8548
8549         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8550         a format warning.
8551         * incremental.cc (open_incremental_binary): Initialized local
8552         variables to avoid warnings.
8553         * object.cc (make_elf_object): Ditto.
8554         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8555         a format warning.
8556
8557 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8558
8559         PR gold/10930
8560         * testsuite/plugin_test.c: Include "config.h".
8561
8562 2009-11-09  Doug Kwan  <dougkwan@google.com>
8563
8564         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8565         (arm_symbol_value): Remove.
8566         (Arm_relocate_functions::arm_branch_common,
8567         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8568         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8569         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8570         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8571         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8572         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8573         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8574         Arm_relocate_functions::thm_mobw_abs_nc,
8575         Arm_relocate_functions::thm_mov_abs,
8576         Arm_relocate_functions::movw_prel_nc,
8577         Arm_relocate_functions::thm_movt_abs,
8578         Arm_relocate_functions::movt_prel,
8579         Arm_relocate_functions::thm_movw_prel_nc,
8580         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8581         (Target_arm::Relocate::relocate): Only decompose address into two
8582         parts if relocation type uses the thumb-bit and pass the actual
8583         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8584         calls to methods in Arm_relocate_functions for this change.
8585
8586 2009-11-08  Ian Lance Taylor  <iant@google.com>
8587
8588         PR 10925
8589         * reloc.cc: Instantiate
8590         Sized_relobj::initialize_input_to_output_maps and
8591         Sized_relobj:free_input_to_output_maps.
8592
8593 2009-11-06  Ian Lance Taylor  <iant@google.com>
8594
8595         PR 10876
8596         * defstd.cc (in_segment): Set only_if_ref true for "end".
8597
8598 2009-11-06  Doug Kwan  <dougkwan@google.com>
8599
8600         * arm.cc (class Reloc_stub): Correct a comment.
8601         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8602         (Target_arm::scan_section_for_stubs): New method declaration.
8603         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8604         Change methods from private to protected.
8605         (Target_arm::do_may_relax): New method definition.
8606         (Target_arm::do_relax, Target_arm::group_sections,
8607         Target_arm::scan_reloc_for_stub,
8608         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8609         (Target_arm::arm_input_section_map_): New data member declaration.
8610         (Target_arm::scan_reloc_for_stub,
8611         Target_arm::scan_reloc_section_for_stubs,
8612         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8613         Target_arm::do_relax): New method definitions.
8614
8615 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8616
8617         * configure.ac: Check for (struct stat)::st_mtim
8618         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8619         * config.in: Regenerate.
8620         * configure: Regenerate.
8621
8622 2009-11-05  Ian Lance Taylor  <iant@google.com>
8623
8624         PR 10910
8625         * output.cc (Output_segment::add_output_section): Add missing
8626         return statement.
8627
8628 2009-11-04  Ian Lance Taylor  <iant@google.com>
8629
8630         PR 10880
8631         * object.h (class Object): Add is_needed and set_is_needed
8632         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8633         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8634         defined in a dynamic object and referenced by a regular object,
8635         set is_needed for the dynamic object.
8636         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8637         if the file is marked with as_needed and it is not needed.
8638
8639 2009-11-04  Ian Lance Taylor  <iant@google.com>
8640
8641         PR 10887
8642         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8643         tags if data is discarded by linker script.
8644         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8645         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8646         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8647         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8648
8649 2009-11-04  Ian Lance Taylor  <iant@google.com>
8650
8651         * layout.cc (Layout::get_output_section): Add is_interp and
8652         is_dynamic_linker_section parameters.  Change all callers.
8653         (Layout::choose_output_section): Likewise.
8654         (Layout::make_output_section): Likewise.
8655         (Layout::add_output_section_data): Add is_dynamic_linker_section
8656         parameter.  Change all callers.
8657         * layout.h (class Layout): Update declarations.
8658         * output.h (class Output_section): Add is_interp, set_is_interp,
8659         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8660         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8661         generate_code_fills_at_write_ to a bitfield.
8662         * output.cc (Output_section::Output_sections): Initialize new
8663         fields.
8664         (Output_segment::add_output_section): Add do_sort parameter.
8665         Change all callers.
8666
8667 2009-11-03  Ian Lance Taylor  <iant@google.com>
8668
8669         PR 10860
8670         * options.h (class General_options): Add --warn-common.
8671         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8672         merging two common symbols.
8673         (Symbol_table::should_override): Handle --warn-common when merging
8674         a common symbol with a defined symbol.  Use report_resolve_problem
8675         for multiple definitions.
8676         (Symbol_table::report_resolve_problem): New function.
8677         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8678
8679 2009-11-03  Doug Kwan  <dougkwan@google.com>
8680
8681         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8682         stub_factory_.
8683         (Target_arm::stub_factory): New method definition.
8684         (Target_arm::new_arm_input_section,
8685         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8686         Target_arm::reloc_uses_thumb_bit): New method declarations.
8687         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8688         New type definitions.
8689         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8690         member declarations.
8691         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8692         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8693         New method definitions.
8694
8695 2009-11-03  Ian Lance Taylor  <iant@google.com>
8696
8697         * options.h (class General_options): Add --warn_constructors.
8698
8699 2009-11-03  Ian Lance Taylor  <iant@google.com>
8700
8701         PR 10893
8702         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8703         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8704
8705 2009-11-03  Ian Lance Taylor  <iant@google.com>
8706
8707         PR 10895
8708         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8709         --msgid-bugs-address.
8710         (install-pdf): New target.
8711         (install-data_yes): Look up one directory to find mkinstalldirs.
8712
8713 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8714
8715         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8716         tree.
8717
8718 2009-10-30  Doug Kwan  <dougkwan@google.com>
8719
8720         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8721
8722 2009-10-30  Doug Kwan  <dougkwan@google.com>
8723
8724         * arm.cc (Stub_addend_reader): New struct template definition
8725         and partial specializations.
8726         (Stub_addend_reader::operator()): New method definition for a
8727         partially specialized template.
8728
8729 2009-10-30  Doug Kwan  <dougkwan@google.com>
8730
8731         * arm.cc (Arm_relobj::processor_specific_flags): New method
8732         definition.
8733         (Arm_relobj::do_read_symbols): New method declaration.
8734         (Arm_relobj::processor_specific_flags_): New data member declaration.
8735         (Arm_dynobj): New class definition.
8736         (Target_arm::do_finalize_sections): Add input_objects parameter.
8737         (Target_arm::do_adjust_elf_header): New method declaration.
8738         (Target_arm::are_eabi_versions_compatible,
8739         (Target_arm::merge_processor_specific_flags): New method declaration.
8740         (Target_arm::do_make_elf_object): New overloaded method definitions
8741         and declaration.
8742         (Arm_relobj::do_read_symbols): New method definition.
8743         (Arm_dynobj::do_read_symbols): Ditto.
8744         (Target_arm::do_finalize_sections): Add input_objects parameters.
8745         Merge processor-specific flags from all input objects.
8746         (Target_arm::are_eabi_versions_compatible,
8747         Target_arm::merge_processor_specific_flags,
8748         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8749         New method definitions.
8750         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8751         Input_objects pointer type parameter.
8752         * layout.cc (Layout::finalize): Pass input objects to target's.
8753         finalize_sections function.
8754         * output.cc (Output_file_header::do_sized_write): Set ELF file
8755         header's processor-specific flags.
8756         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8757         Input_objects pointer type parameter.
8758         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8759         * target.h (Input_objects): New forward class declaration.
8760         (Target::processor_specific_flags,
8761         Target::are_processor_specific_flags_sect): New method definitions.
8762         (Target::finalize_sections): Add input_objects parameter.
8763         (Target::Target): Initialize processor_specific_flags_ and
8764         are_processor_specific_flags_set_.
8765         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8766         parameter.
8767         (Target::set_processor_specific_flags): New method definition.
8768         (Target::processor_specific_flags_,
8769         Target::are_processor_specific_flags_set_): New data member
8770         declarations.
8771         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8772         Input_objects pointer type parameter.
8773
8774 2009-10-30  Doug Kwan  <dougkwan@google.com>
8775
8776         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8777
8778 2009-10-28  Ian Lance Taylor  <iant@google.com>
8779
8780         * object.h (class Relobj): Drop options parameter from
8781         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8782         do_scan_relocs, do_relocate.  Change all callers.
8783         (class Sized_relobj): Drop options parameters from
8784         do_gc_process_relocs, do_scan_relocs, do_relocate,
8785         do_relocate_sections, relocate_sections, emit_relocs_scan,
8786         emit_relocs_scan_reltype.  Change all callers.
8787         (struct Relocate_info): Remove options field and all references to
8788         it.
8789         * reloc.h (class Read_relocs): Remove options constructor
8790         parameter and options_ field.  Change all callers.
8791         (class Gc_process_relocs, class Scan_relocs): Likewise.
8792         (class Relocate_task): Likewise.
8793         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8794         all callers.
8795         (scan_relocatable_relocs): Likewise.
8796         * target.h (class Sized_target): Remove options parameter from
8797         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8798         all callers.
8799         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8800         callers.
8801         * arm.cc: Update functions to remove options parameters.
8802         * i386.cc: Likewise.
8803         * powerpc.cc: Likewise.
8804         * sparc.cc: Likewise.
8805         * x86_64.cc: Likewise.
8806         * testsuite/testfile.cc: Likewise.
8807
8808 2009-10-28  Doug Kwan  <dougkwan@google.com>
8809
8810         * arm.cc (Arm_relobj): New class definition.
8811         (Arm_relobj::scan_sections_for_stubs,
8812         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8813         New method definitions.
8814
8815 2009-10-28  Cary Coutant  <ccoutant@google.com>
8816
8817         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8818         (Plugin::cleanup_done_): New member.
8819         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8820         (Plugin_manager::cleanup_done_): Remove.
8821         (Plugin_manager::add_input_file): Edit error message.
8822         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8823         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8824
8825 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8826
8827         * fileread.cc: (File_read::View::~View): Use the new
8828         data_ownership_ filed.
8829         (File_read::~File_read): Dispose the new whole_file_view_.
8830         (File_read::open): Mmap the whole file if needed.
8831         (File_read::open): Use whole_file_view_ instead of contents_.
8832         (File_read::find_view): Use whole_file_view_ if applicable.
8833         (File_read::do_read): Use whole_file_view_ instead of contents_.
8834         (File_read::make_view): Use whole_file_view_ instead of contents_,
8835         update File_read::View::View call.
8836         (File_read::find_or_make_view): Update File_read::View::View
8837         call.
8838         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8839         remove contents_
8840         (File_read::View::Data_ownership): New enum.
8841         (File_read::View::View): Replace bool mapped_ with Data_ownership
8842         argument.
8843         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8844         (File_read::View::data_ownership_): New field.
8845         (File_read::contents_): Remove (replaced by whole_file_view_).
8846         (File_read::whole_file_view_): New field.
8847         * options.h (class General_options): Add --keep-files-mapped.
8848
8849 2009-10-27  Cary Coutant  <ccoutant@google.com>
8850
8851         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8852         * testsuite/Makefile.am (plugin_test_5): New test case.
8853         * testsuite/Makefile.in: Regenerate.
8854
8855 2009-10-25  Doug Kwan  <dougkwan@google.com>
8856
8857         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8858         from private to protected to allow access by child class.
8859         (Sized_relobj::do_relocate_sections): New method declaration.
8860         (Sized_relobj::relocate_sections): Virtualize.
8861         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8862         Sized_relobj::relocate_sections.  Instantiate template explicitly
8863         for different target sizes and endianity.
8864
8865 2009-10-24  Doug Kwan  <dougkwan@google.com>
8866
8867         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8868         (Arm_input_section::as_arm_input_section): New method.
8869         (Arm_output_section): New class definition.
8870         (Arm_output_section::create_stub_group,
8871         Arm_output_section::group_sections): New method definitions.
8872
8873 2009-10-22  Doug Kwan  <dougkwan@google.com>
8874
8875         * arm.cc (Arm_input_section): New class definition.
8876         (Arm_input_section::init, Arm_input_section:do_write,
8877         Arm_input_section::set_final_data_size,
8878         Arm_input_section::do_reset_address_and_file_offset): New method
8879         definitions.
8880
8881 2009-10-21  Doug Kwan  <dougkwan@google.com>
8882
8883         * arm.cc (Stub_table, Arm_input_section): New forward class
8884         declarations.
8885         (Stub_table): New class defintion.
8886         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8887         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8888         New method definition.
8889
8890 2009-10-21  Doug Kwan  <dougkwan@google.com>
8891
8892         * arm.cc: Update copyright comments.
8893         (Target_arm): New forward class template declaration.
8894         (Arm_address): New type.
8895         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8896         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8897         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8898         constants.
8899         (Insn_template): Same.
8900         (DEF_STUBS): New macro.
8901         (Stub_type): New enum type.
8902         (Stub_template): New class definition.
8903         (Stub): Same.
8904         (Reloc_stub): Same.
8905         (Stub_factory): Same.
8906         (Target_arm::Target_arm): Initialize may_use_blx_ and
8907         should_force_pic_veneer_.
8908         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8909         Target_arm::should_force_pic_veneer,
8910         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8911         Target_arm::using_thumb_only, Target_arm:;default_target): New
8912         method defintions.
8913         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8914         New data member declarations.
8915         (Insn_template::size, Insn_template::alignment): New method defintions.
8916         (Stub_template::Stub_template): New method definition.
8917         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8918         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8919         (Stub_factory::Stub_factory): New method definition.
8920         * gold.h (string_hash): New template.
8921         * output.h (Input_section_specifier::hash_value): Use
8922         gold::string_hash.
8923         (Input_section_specifier::string_hash): Remove.
8924         * stringpool.cc (Stringpool_template::string_hash): Use
8925         gold::string_hash.
8926
8927 2009-10-20  Doug Kwan  <dougkwan@google.com>
8928
8929         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8930         symbols of relaxed input sections.
8931         * output.h (Output_section::find_relaxed_input_section): Make
8932         method public.
8933
8934 2009-10-16  Doug Kwan  <dougkwan@google.com>
8935
8936         * dynobj.cc (Versions::Versions): Initialize version_script_.
8937         Only insert base version symbol definition for a shared object
8938         if version script defines any version versions.
8939         (Versions::define_base_version): New method definition.
8940         (Versions::add_def): Check that base version is not needed.
8941         (Versions::add_need): Define base version lazily.
8942         * dynobj.h (Versions::define_base_version): New method declaration.
8943         (Versions::needs_base_version_): New data member declaration.
8944         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8945         (check_DATA): Add no_version_test.stdout.
8946         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8947         New make rules.
8948         * testsuite/Makefile.in: Regenerate.
8949         * testsuite/no_version_test.c: New file.
8950         * testsuite/no_version_test.sh: Ditto.
8951
8952 2009-10-16  Doug Kwan  <dougkwan@google.com>
8953
8954         * expression.cc (class Segment_start_expression): New class definition.
8955         (Segment_start_expression::value): New method definition.
8956         (script_exp_function_segment_start): Return a new
8957         Segment_start_expression.
8958         * gold/script-c.h (script_saw_segment_start_expression): New function
8959         prototype.
8960         * script-sections.cc (Script_sections::Script_sections): Initialize
8961         SAW_SEGMENT_START_EXPRESSION_ to false.
8962         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8963         and -Tbbs options to specify section addresses if given in
8964         command line and no SEGMENT_START expression is seen in a script.
8965         * script-sections.h (Script_sections::saw_segment_start_expression,
8966         Script_sections::set_saw_segment_start_expression): New method
8967         definition.
8968         (Script_sections::saw_segment_start_expression_): New data member
8969         declaration.
8970         * script.cc (script_saw_segment_start_expression): New function.
8971         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8972         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8973         script_test_7.sh and script_test_8.sh.
8974         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8975         script_test_8.stdout.
8976         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8977         (script_test_6, script_test_6.stdout, script_test_7,
8978         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8979         * Makefile.in: Regenerate.
8980         * testsuite/script_test_6.sh: New file.
8981         * testsuite/script_test_6.t: Same.
8982         * testsuite/script_test_7.sh: Same.
8983         * testsuite/script_test_7.t: Same.
8984         * testsuite/script_test_8.sh: Same.
8985
8986 2009-10-16  Doug Kwan  <dougkwan@google.com>
8987
8988         * output.cc (Output_segment::set_section_list_address): Cast
8989         expressions to unsigned long long type to avoid format warnings.
8990
8991 2009-10-15  Ian Lance Taylor  <iant@google.com>
8992
8993         * script.cc (Script_options::add_symbol_assignment): Always add a
8994         dot assignment to script_sections_.
8995         * script-sections.cc (Script_sections::add_dot_assignment):
8996         Initialize if necessary.
8997
8998         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8999         program headers with no load segment if there is a linker script.
9000
9001         * layout.cc (Layout::set_segment_offsets): Align the file offset
9002         to the segment aligment for -N or -n with no load segment.
9003         * output.cc (Output_segment::add_output_section): Don't crash if
9004         the first section is a TLS section.
9005         (Output_segment::set_section_list_addresses): Print an error
9006         message if the address moves backward in a linker script.
9007         * script-sections.cc
9008         (Output_section_element_input::set_section_addresses): Don't
9009         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9010         (Orphan_output_section::set_section_addresses): Likewise.
9011
9012 2009-10-15  Doug Kwan  <dougkwan@google.com>
9013
9014         * layout.cc (Layout::finish_dynamic_section): Generate tags
9015         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9016         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9017         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9018
9019 2009-10-14  Ian Lance Taylor  <iant@google.com>
9020
9021         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9022         fields.
9023         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9024         data_shdr fields of relinfo.
9025         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9026         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9027         R_386_TLS_LDO_32, adjust based on section flags.
9028         (Target_i386::Relocate::fix_up_ldo): Remove.
9029
9030 2009-10-13  Ian Lance Taylor  <iant@google.com>
9031
9032         Add support for -pie.
9033         * options.h (class General_options): Add -pie and
9034         --pic-executable.
9035         (General_options::output_is_position_independent): Test -pie.
9036         (General_options::output_is_executable): Return true if not shared
9037         and not relocatable.
9038         (General_options::output_is_pie): Remove.
9039         * options.cc (General_options::finalize): Reject incompatible uses
9040         of -pie.
9041         * gold.cc (queue_middle_tasks): A -pie link is not static.
9042         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9043         * symtab.cc (Symbol::final_value_is_known): Return false if
9044         output_is_position_independent.
9045         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9046         output_is_position_independent.
9047         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9048         output_is_position_independent.
9049         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9050         output_is_position_independent.
9051         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9052         two_file_pie_test.
9053         (basic_pie_test.o, basic_pie_test): New targets.
9054         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9055         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9056         (two_file_pie_test): New target.
9057         * testsuite/Makefile.in: Rebuild.
9058         * README: Remove note saying that -pie is not supported.
9059
9060 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9061
9062         * options.h (class General_options): Add -init and -fini.
9063         * layout.cc (Layout::finish_dynamic_section): Emit
9064         given init and fini functions.
9065
9066 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9067
9068         * gc.h (gc_process_relocs): Check if icf is enabled using new
9069         function.
9070         * gold.cc (queue_initial_tasks): Likewise.
9071         (queue_middle_tasks): Likewise.
9072         * object.cc (do_layout): Likewise.
9073         * symtab.cc (is_section_folded): Likewise.
9074         * main.cc (main): Likewise.
9075         * reloc.cc (Read_relocs::run): Likewise.
9076         (Sized_relobj::do_scan_relocs): Likewise.
9077         * icf.cc (is_function_ctor_or_dtor): New function.
9078         (Icf::find_identical_sections): Check if function is ctor or dtor when
9079         safe icf is chosen.
9080         * options.h (General_options::icf): Change option to be an enum.
9081         (Icf_status): New enum.
9082         (icf_enabled): New method.
9083         (icf_safe_folding): New method.
9084         (set_icf_status): New method.
9085         (icf_status_): New variable.
9086         * (options.cc) (General_options::finalize): Set icf_status_.
9087         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9088         icf_test and icf_keep_unique_test to use the --icf enum flag.
9089         * testsuite/icf_safe_test.sh: New file.
9090         * testsuite/icf_safe_test.cc: New file.
9091
9092 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9093
9094         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9095         includes to gc.h and icf.h.
9096         * arm.cc: Include gc.h.
9097         * gold.cc: Likewise.
9098         * i386.cc: Likewise.
9099         * powerpc.cc: Likewise.
9100         * sparc.cc: Likewise.
9101         * x86_64.cc: Likewise.
9102         * gc.h: Include icf.h.
9103
9104 2009-10-11  Ian Lance Taylor  <iant@google.com>
9105
9106         * plugin.cc: Include "gold.h" before other header files.
9107
9108 2009-10-10  Chris Demetriou  <cgd@google.com>
9109
9110         * options.h (Input_file_argument::Input_file_type): New enum.
9111         (Input_file_argument::is_lib_): Replace with...
9112         (Input_file_argument::type_): New member.
9113         (Input_file_argument::Input_file_argument): Take Input_file_type
9114         'type' rather than boolean 'is_lib' as second argument.
9115         (Input_file_argument::is_lib): Use type_.
9116         (Input_file_argument::is_searched_file): New function.
9117         (Input_file_argument::may_need_search): Handle is_searched_file.
9118         * options.cc (General_options::parse_library): Support -l:filename.
9119         (General_options::parse_just_symbols): Update for Input_file_argument
9120         changes.
9121         (Command_line::process): Likewise.
9122         * archive.cc (Archive::get_file_and_offset): Likewise.
9123         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9124         * script.cc (read_script_file, script_add_file): Likewise.
9125         * fileread.cc (Input_file::Input_file): Likewise.
9126         (Input_file::will_search_for): Handle is_searched_file.
9127         (Input_file::open): Likewise.
9128         * readsyms.cc (Read_symbols::get_name): Likewise.
9129         * testsuite/Makefile.am (searched_file_test): New test.
9130         * testsuite/Makefile.in: Regenerate.
9131         * testsuite/searched_file_test.cc: New file.
9132         * testsuite/searched_file_test_lib.cc: New file.
9133
9134 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9135             Ian Lance Taylor  <iant@google.com>
9136
9137         * descriptor.cc: Include <cstdio> and "binary-io.h".
9138         (Descriptors::open): Open the files in binary mode always.
9139         * script.cc (Lex::get_token): Treat \r as whitespace.
9140
9141 2009-10-09  Ian Lance Taylor  <iant@google.com>
9142
9143         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9144
9145 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9146             Ian Lance Taylor  <iant@google.com>
9147
9148         * configure.ac: Check for readv function also.
9149         * fileread.cc (readv): Define if not HAVE_READV.
9150         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9151         does not exist.
9152         * config.in: Regenerate.
9153         * configure: Regenerate.
9154
9155 2009-10-09  Doug Kwan  <dougkwan@google.com>
9156
9157         * layout.cc (Layout::make_output_section): Call target hook to make
9158         ordinary output section.
9159         (Layout::finalize): Adjust parameter list of call the
9160         Target::may_relax().
9161         * layout.h (class Layout::section_list): New method.
9162         * merge.h (Output_merge_base::entsize): Change visibility to public.
9163         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9164         New methods.
9165         (Output_merge_string::do_is_string): New method.
9166         * object.cc (Sized_relobj::do_setup): renamed from
9167         Sized_relobj::set_up.
9168         * object.h (Sized_relobj::adjust_shndx,
9169         Sized_relobj::initializ_input_to_output_maps,
9170         Sized_relobj::free_input_to_output_maps): Change visibilities to
9171         protected.
9172         (Sized_relobj::setup): Virtualize.
9173         (Sized_relobj::do_setup): New method declaration.
9174         (Sized_relobj::invalidate_section_offset,
9175         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9176         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9177         * options.cc (parse_int): New function.
9178         * options.h (parse_int): New declaration.
9179         (DEFINE_int): New macro.
9180         (stub_group_size): New option.
9181         * output.cc (Output_section::Output_section): Initialize memebers
9182         merge_section_map_, merge_section_by_properties_map_,
9183         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9184         (Output_section::add_input_section): Handled deferred code-fill
9185         generation and remove an old comment.
9186         (Output_section::add_relaxed_input_section): New method definition.
9187         (Output_section::add_merge_input_section): Use merge section by
9188         properties map to speed to search.  Update merge section maps
9189         as appropriate.
9190         (Output_section::build_relaxation_map): New method definition.
9191         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9192         Same.
9193         (Output_section::relax_input_section): Renamed to
9194         Output_section::convert_input_sections_to_relaxed_sections and change
9195         interface to take a vector of pointers to relaxed sections.
9196         (Output_section::find_merge_section,
9197         Output_section::find_relaxed_input_section): New method definitions.
9198         (Output_section::is_input_address_mapped,
9199         Output_section::output_offset, Output_section::output_address):
9200         Use output section data maps to speed up searching.
9201         (Output_section::find_starting_output_address): Add comments.
9202         (Output_section::do_write,
9203         Output_section::write_to_postprocessing_buffer): Do code-fill
9204         generation as appropriate.
9205         (Output_section::get_input_sections): Invalidate relaxed input section
9206         map.
9207         (Output_section::restore_states): Adjust type of checkpoint .
9208         Invalidate relaxed input section map.
9209         * output.h (Output_merge_base): New class declaration.
9210         (Input_section_specifier): New class defintion.
9211         (class Output_relaxed_input_section) Change base class to
9212         Output_section_data_build.
9213         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9214         base class initializer.
9215         (Output_section::add_relaxed_input_section): New method declaration.
9216         (Output_section::Input_section): Change visibility to protected.
9217         (Output_section::Input_section::relobj,
9218         Output_section::Input_section::shndx): Handle relaxed input sections.
9219         Output_section::input_sections) Change visibility to protected.  Also
9220         define overload to return a non-const pointer.
9221         (Output_section::Merge_section_properties): New class defintion.
9222         (Output_section::Merge_section_by_properties_map,
9223         Output_section::Output_section_data_by_input_section_map,
9224         Output_section::Relaxation_map): New types.
9225         (Output_section::relax_input_section): Rename method to
9226         Output_section::convert_input_sections_to_relaxed_sections and change
9227         interface to take a vector of relaxed section pointers.
9228         (Output_section::find_merge_section,
9229         Output_section::find_relaxed_input_section,
9230         Output_section::build_relaxation_map,
9231         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9232         New method declarations.
9233         (Output_section::merge_section_map_
9234         Output_section::merge_section_by_properties_map_,
9235         Output_section::relaxed_input_section_map_,
9236         Output_section::is_relaxed_input_section_map_valid_,
9237         Output_section::generate_code_fills_at_write_): New data members.
9238         * script-sections.cc
9239         (Output_section_element_input::set_section_addresses): Call
9240         current_data_size and addralign methods of relaxed input sections.
9241         (Orphan_output_section::set_section_addresses): Call current_data_size
9242         and addralign methods of relaxed input sections.
9243         * symtab.cc (Symbol_table::compute_final_value): Extract template
9244         from the body of Symbol_table::sized_finalize_symbol.
9245         (Symbol_table::sized_finalized_symbol): Call
9246         Symbol_table::compute_final_value.
9247         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9248         (Symbol_table::compute_final_value): New templated method declaration.
9249         * target.cc (Target::do_make_output_section): New method defintion.
9250         * target.h (Target::make_output_section): New method declaration.
9251         (Target::relax): Add more parameters for input objects, symbol table
9252         and layout.  Adjust call to do_relax.
9253         (Target::do_make_output_section): New method declaration.
9254         (Target::do_relax): Add parameters for input objects, symbol table
9255         and layout.
9256
9257 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9258
9259         * pread.c: Include stdio.h.
9260
9261 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9262
9263         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9264         defined.
9265
9266 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9267
9268         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9269         Change read_shndx type to unsigned int.
9270         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9271         int.
9272         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9273         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9274         Change read_shndx type to unsigned int.
9275         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9276         int.
9277         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9278         * layout.cc (Layout::create_symtab_sections): Cast the result of
9279         local_symcount * symsize to off_t in the gold_assert.
9280
9281 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9282
9283         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9284         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9285         R_ARM_BASE_ABS.
9286         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9287         (Arm_relocate_functions::thm_abs5): New function.
9288         (Arm_relocate_functions::abs12): New function.
9289         (Arm_relocate_functions::abs16): New function.
9290         (Arm_relocate_functions::base_abs): New function.
9291         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9292         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9293         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9294         R_ARM_BASE_ABS.
9295         (Scan::global): Likewise.
9296         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9297         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9298         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9299         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9300         R_ARM_BASE_ABS.
9301
9302 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9303
9304         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9305         (Arm_relocate_functions::movt_prel): New function.
9306         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9307         (Arm_relocate_functions::thm_movt_prel): New function.
9308         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9309         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9310         (Scan::global, Relocate::relocate): Likewise.
9311         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9312
9313 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9314
9315         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9316         Incremental_checker.
9317         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9318         unsigned int.
9319         (class Incremental_inputs_header): New class.
9320         (Incremental_inputs_header_writer): Edit comment.
9321         (Incremental_inputs_entry): New class.
9322         (Incremental_inputs_entry_writer): Edit comment.
9323         (Sized_incremental_binary::do_find_incremental_inputs_section):
9324         Add *strtab_shndx parameter, fill it.
9325         (Sized_incremental_binary::do_check_inputs): New method.
9326         (Incremental_checker::can_incrementally_link_output_file): Use
9327         Sized_incremental_binary::check_inputs.
9328         (Incremental_inputs::report_command_line): Save command line in
9329         command_line_.
9330         * incremental.h:
9331         (Incremental_binary::find_incremental_inputs_section): New
9332         method.
9333         (Incremental_binary::do_find_incremental_inputs_section): Add
9334         strtab_shndx parameter.
9335         (Incremental_binary::do_check_inputs): New pure virtual method.
9336         (Sized_incremental_binary::do_check_inputs): Declare.
9337         (Incremental_checker::Incremental_checker): Add incremental_inputs
9338         parameter, use it to initialize incremental_inputs_.
9339         (Incremental_checker::incremental_inputs_): New field.
9340         (Incremental_checker::command_line): New method.
9341         (Incremental_checker::inputs): New method.
9342         (Incremental_checker::command_line_): New field.
9343
9344 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9345
9346         * incremental.cc: Include <cstdarg> and "target-select.h".
9347         (vexplain_no_incremental): New function.
9348         (explain_no_incremental): New function.
9349         (Incremental_binary::error): New method.
9350         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9351         method.
9352         (make_sized_incremental_binary): New function.
9353         (open_incremental_binary): New function.
9354         (can_incrementally_link_file): Add checks if output is ELF and has
9355         inputs section.
9356         * incremental.h: Include "elfcpp_file.h" and "output.h".
9357         (Incremental_binary): New class.
9358         (Sized_incremental_binary): New class.
9359         (open_incremental_binary): Declare.
9360         * object.cc (is_elf_object): Use
9361         elfcpp::Elf_recognizer::is_elf_file.
9362         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9363         * output.h (Output_file::filesize): New method.
9364
9365 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9366
9367         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9368         New function.
9369         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9370         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9371         function.
9372         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9373         function.
9374         (Arm_relocate_functions::movw_abs_nc): New function.
9375         (Arm_relocate_functions::movt_abs): New function.
9376         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9377         (Arm_relocate_functions::thm_movt_abs): New function.
9378         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9379         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9380         (Scan::global): Likewise.
9381         (Relocate::relocate): Likewise.
9382         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9383
9384 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9385
9386         * arm.cc (Arm_relocate_functions::got_prel) New function.
9387         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9388         (Relocate::relocate): Likewise.
9389         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9390
9391 2009-10-06  Ian Lance Taylor  <iant@google.com>
9392
9393         * options.h (class General_options): Define
9394         split_stack_adjust_size parameter.
9395         * object.h (class Object): Add uses_split_stack_ and
9396         has_no_split_stack_ fields.  Add uses_split_stack and
9397         has_no_split_stack accessor functions.  Declare
9398         handle_split_stack_section.
9399         (class Reloc_symbol_changes): Define.
9400         (class Sized_relobj): Define Function_offsets.  Declare
9401         split_stack_adjust, split_stack_adjust_reltype, and
9402         find_functions.
9403         * object.cc (Object::handle_split_stack_section): New function.
9404         (Sized_relobj::do_layout): Call handle_split_stack_section.
9405         * dynobj.cc (Sized_dynobj::do_layout): Call
9406         handle_split_stack_section.
9407         * reloc.cc (Sized_relobj::relocate_sections): Call
9408         split_stack_adjust for executable sections in split_stack
9409         objects.  Pass reloc_map to relocate_section.
9410         (Sized_relobj::split_stack_adjust): New function.
9411         (Sized_relobj::split_stack_adjust_reltype): New function.
9412         (Sized_relobj::find_functions): New function.
9413         * target-reloc.h: Include "object.h".
9414         (relocate_section): Add reloc_symbol_changes parameter.  Change
9415         all callers.
9416         * target.h (class Target): Add calls_non_split method.  Declare
9417         do_calls_non_split virtual method.  Declare match_view and
9418         set_view_to_nop.
9419         * target.cc: Include "elfcpp.h".
9420         (Target::do_calls_non_split): New function.
9421         (Target::match_view): New function.
9422         (Target::set_view_to_nop): New function.
9423         * gold.cc (queue_middle_tasks): Give an error if mixing
9424         split-stack and non-split-stack objects with -r.
9425         * i386.cc (Target_i386::relocate_section): Add
9426         reloc_symbol_changes parameter.
9427         (Target_i386::do_calls_non_split): New function.
9428         * x86_64.cc (Target_x86_64::relocate_section): Add
9429         reloc_symbol_changes parameter.
9430         (Target_x86_64::do_calls_non_split): New function.
9431         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9432         parameter.
9433         * powerpc.cc (Target_powerpc::relocate_section): Add
9434         reloc_symbol_changes parameter.
9435         * sparc.cc (Target_sparc::relocate_section): Add
9436         reloc_symbol_changes parameter.
9437         * configure.ac: Call AM_CONDITIONAL for the default target.
9438         * configure: Rebuild.
9439         * testsuite/Makefile.am (TEST_AS): New variable.
9440         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9441         (check_DATA): Add split_i386 and split_x86_64 files.
9442         (SPLIT_DEFSYMS): Define.
9443         (split_i386_[1234n].o): New targets.
9444         (split_i386_[124]): New targets.
9445         (split_i386_[1234r].stdout): New targets.
9446         (split_x86_64_[1234n].o): New targets.
9447         (split_x86_64_[124]): New targets.
9448         (split_x86_64_[1234r].stdout): New targets.
9449         (MOSTLYCLEANFILES): Add new executables.
9450         * testsuite/split_i386.sh: New file.
9451         * testsuite/split_x86_64.sh: New file.
9452         * testsuite/split_i386_1.s: New file.
9453         * testsuite/split_i386_2.s: New file.
9454         * testsuite/split_i386_3.s: New file.
9455         * testsuite/split_i386_4.s: New file.
9456         * testsuite/split_i386_n.s: New file.
9457         * testsuite/split_x86_64_1.s: New file.
9458         * testsuite/split_x86_64_2.s: New file.
9459         * testsuite/split_x86_64_3.s: New file.
9460         * testsuite/split_x86_64_4.s: New file.
9461         * testsuite/split_x86_64_n.s: New file.
9462         * testsuite/testfile.cc (Target_test): Update relocation_section
9463         function.
9464         * testsuite/Makefile.in: Rebuild.
9465
9466 2009-10-06  Ian Lance Taylor  <iant@google.com>
9467
9468         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9469         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9470         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9471         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9472         the address on ldo_addrs_.
9473         (Target_i386::Relocate::fix_up_ldo): New function.
9474
9475 2009-10-06   Rafael Espindola  <espindola@google.com>
9476
9477         * plugin.cc (add_input_library): New.
9478         (Plugin::load): Add add_input_library to tv.
9479         (Plugin_manager::add_input_file): Add the is_lib argument.
9480         (add_input_file): Update call to Plugin_manager::add_input_file.
9481         (add_input_library): New.
9482         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9483
9484 2009-09-30  Doug Kwan  <dougkwan@google.com>
9485
9486         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9487         symbol and call Symbol::may_need_copy_reloc to determine if
9488         a copy reloc is needed.
9489         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9490         nocopyreloc is given in command line.
9491         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9492         given in command line.
9493         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9494         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9495         of the removed Target_i386::may_need_copy_reloc.
9496         * options.h (copyreloc): New option with default value false.
9497         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9498         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9499         instead of the removed Target_powerpc::may_need_copy_reloc.
9500         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9501         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9502         instead of the removed Target_sparc::may_need_copy_reloc.
9503         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9504         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9505         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9506         instead of the removed Target_x86_64::may_need_copy_reloc.
9507
9508 2009-09-30  Ian Lance Taylor  <iant@google.com>
9509
9510         * object.h (class Object): Remove target_ field, and target,
9511         sized_target, and set_target methods.
9512         (Object::sized_target): Remove.
9513         (class Sized_relobj): Update declarations.  Remove sized_target.
9514         * object.cc (Sized_relobj::setup): Remove target parameter.
9515         Change all callers.
9516         (Input_objects::add_object): Don't do anything with the target.
9517         (make_elf_sized_object): Add punconfigured parameter.  Change all
9518         callers.  Set or test parameter target.
9519         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9520         Change all callers.
9521         * parameters.cc (Parameters::set_target): Change parameter type to
9522         be non-const.
9523         (Parameters::default_target): Remove.
9524         (set_parameters_target): Change parameter type to be non-const.
9525         (parameters_force_valid_target): New function.
9526         (parameters_clear_target): New function.
9527         * parameters.h (class Parameters): Update declarations.  Remove
9528         default_target method.  Add sized_target and clear_target
9529         methods.  Change target_ to be non-const.
9530         (set_parameters_target): Update declaration.
9531         (parameters_force_valid_target): Declare.
9532         (parameters_clear_target): Declare.
9533         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9534         as NULL if we aren't searching.
9535         (Add_symbols::run): Don't check for compatible target.
9536         * fileread.cc (Input_file::open_binary): Call
9537         parameters_force_valid_target.
9538         * gold.cc (queue_middle_tasks): Likewise.
9539         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9540         set_target on object.
9541         * dynobj.h (class Sized_dynobj): Update declarations.
9542         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9543         make_elf_object returns NULL.
9544         (Archive::include_member): Don't check whether object target is
9545         compatible.
9546         * output.cc (Output_section::add_input_section): Get target from
9547         parameters.
9548         (Output_section::relax_input_section): Likewise.
9549         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9550         parameters.
9551         (Sized_relobj::do_scan_relocs): Likewise.
9552         (Sized_relobj::relocate_sections): Likewise.
9553         * resolve.cc (Symbol_table::resolve): Likewise.
9554         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9555         parameter.  Change all callers.
9556         (Symbol_table::add_from_object): Get target from parameters.
9557         (Symbol_table::add_from_relobj): Don't check object target.
9558         (Symbol_table::add_from_dynobj): Likewise.
9559         (Symbol_table::define_special_symbol): Get target from
9560         parameters.
9561         * symtab.h (class Symbol_table): Update declaration.
9562         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9563         parameter.  Change all callers.  Clear parameter target.
9564         (Binary_test): Test target here.
9565         * testsuite/object_unittest.cc (gold_testsuite): Remove
9566         target_test_pointer parameter.  Change all callers.
9567         (Object_test): Test target here.
9568
9569 2009-09-26  Ian Lance Taylor  <iant@google.com>
9570
9571         * testsuite/initpri1.c: Don't try to use constructor priorities if
9572         compiling with gcc before 4.3.
9573
9574 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9575
9576         * testsuite/retain_symbols_file_test.sh (check_present): Change
9577         output file name to retain_symbols_file_test.stdout.
9578         (check_absent): Likewise.
9579
9580 2009-09-18  Craig Silverstein  <csilvers@google.com>
9581
9582         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9583         * options.cc: Include <cerrno> and <fstream>.
9584         (General_options::finalize): Parse -retain-symbols-file tag.
9585         * options.h: New flag.
9586         (General_options): New method should_retain_symbol, new
9587         variable symbols_to_retain.
9588         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9589         should_retain_symbol map.
9590         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9591         * testsuite/Makefile.in: Regenerate.
9592         * testsuite/retain_symbols_file_test.sh: New file.
9593
9594 2009-09-18  Nick Clifton  <nickc@redhat.com>
9595
9596         * po/es.po: Updated Spanish translation.
9597
9598 2009-09-17  Doug Kwan  <dougkwan@google.com>
9599
9600         * debug.h (DEBUG_RELAXATION): New constant.
9601         (DEBUG_ALL): Add DEBUG_RELAXATION.
9602         (debug_string_to_enum): Add relaxation debug option.
9603         * layout.cc
9604         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9605         Layout::Relaxation_debug_check::read_sections,
9606         Layout::Relaxation_debug_check::read_sections): New method definitions.
9607         (Layout::Layout): Initialize data members
9608         record_output_section_data_from_scrips_,
9609         script_output_section_data_list_ and relaxation_debug_check_.
9610         (Layout::save_segments, Layout::restore_segments,
9611         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9612         Layout::relaxation_loop_body): New method definitions.
9613         (Layout::finalize): Support relaxation.  Move section layout code to
9614         Layout::relaxation_loop_body.
9615         (Layout::set_asection_address_from_script): Move code for orphan
9616         section placement out.
9617         (Layout::place_orphan_sections_in_script): New method definition.
9618         * layout.h (Output_segment_headers, Output_file_header):
9619         New forward class declarations.
9620         (Layout::~Layout): Define.
9621         (Layout::new_output_section_data_from_script): New method definition.
9622         (Layout::place_orphan_sections_in_script): New method declaration.
9623         (Layout::Segment_states): New type declaration.
9624         (Layout::save_segments, Layout::restore_segments,
9625         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9626         Layout::relaxation_loop_body): New method declarations.
9627         (Layout::Output_section_data_list): New type declaration.
9628         (Layout::Relaxation_debug_check): New class definition.
9629         (Layout::record_output_section_data_from_script_,
9630         Layout::script_output_section_data_list_, Layout::segment_states_,
9631         Layout::relaxation_debug_check_): New data members.
9632         * output.cc: (Output_section_headers::do_size): New method definition.
9633         (Output_section_headers::Output_section_headers): Move size
9634         computation to Output_section_headers::do_size.
9635         (Output_segment_headers::do_size): New method definition.
9636         (Output_file_header::Output_file_header): Move size computation to
9637         Output_file_header::do_size and call it.
9638         (Output_file_header::do_size): New method definition.
9639         (Output_data_group::Output_data_group): Adjust call to
9640         Output_section_data.
9641         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9642         (Output_symtab_xindex::do_write): Add array bound check.
9643         (Output_section::Input_section::print_to_mapfile): Handle
9644         RELAXED_INPUT_SECTION_CODE.
9645         (Output_section::Output_section): Initialize data member checkpoint_.
9646         (Output_section::~Output_section): Delete checkpoint object pointed
9647         by checkpoint_.
9648         (Output_section::add_input_section): Always add an Input_section if
9649         relaxing.
9650         (Output_section::add_merge_input_section): Add assert.
9651         (Output_section::relax_input_section): New method definition.
9652         (Output_section::set_final_data_size): Set load address to zero for
9653         an unallocated section.
9654         (Output_section::do_address_and_file_offset_have_reset_values):
9655         New method definition.
9656         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9657         Handle relaxed input section.
9658         (Output_section::sort_attached_input_sections): Checkpoint input
9659         section list lazily.
9660         (Output_section::get_input_sections): Change type of input_sections to
9661         list of Simple_input_section pointers.  Checkpoint input section list
9662         lazily.  Also handle relaxed input sections.
9663         (Output_section::add_input_section_for_script): Take a reference to
9664         a Simple_input_section object instead of Relobj pointer and section
9665         index as parameter.  Handle relaxed input sections.
9666         (Output_section::save_states, Output_section::restore_states): New
9667         method definitions.
9668         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9669         (Output_data::is_data_size_fixed): New method definition.
9670         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9671         if it is fixed.
9672         (Output_data::address_and_file_offset_have_reset_values): New method
9673         definition.
9674         (Output_data::do_address_and_file_offset_have_reset_values): New method
9675         definition.
9676         (Output_data::set_data_size): Check that data size is not fixed.
9677         (Output_data::fix_data_size): New method definition.
9678         (Output_data::is_data_size_fixed_): New data member.
9679         (Output_section_headers::set_final_data_size): New method definition.
9680         (Output_section_headers::do_size): New method declaration.
9681         (Output_segment_headers::set_final_data_size): New method definition.
9682         (Output_segment_headers::do_size): New method declaration.
9683         (Output_file_header::set_final_data_size)::New method definition.
9684         (Output_file_header::do_size)::New method declaration.
9685         (Output_section_data::Output_section_data): Add new parameter
9686         is_data_size_fixed and use it to fix data size.
9687         (Output_data_const::Output_data_const): Adjust call to base class
9688         constructor and fix data size.
9689         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9690         base class constructor and fix data size.
9691         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9692         base class constructor and fix data size.
9693         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9694         class constructor and fix data size.
9695         (Output_data_group::set_final_data_size): New method definition.
9696         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9697         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9698         class constructor and fix data size.
9699         (Output_relaxed_input_section): New class definition.
9700         (Output_section::Simple_input_section): New class definition.
9701         (Output_section::get_input_sections): Adjust parameter list.
9702         (Output_section::add_input_section_for_script): Same.
9703         (Output_section::save_states, Output_section::restore_states,
9704         Output_section::do_address_and_file_offset_have_reset_values,
9705         (Output_section::Input_section::Input_section): Handle
9706         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9707         Output_relaxed_input_section.
9708         (Output_section::Input_section::is_input_section,
9709         Output_section::Input_section::set_output_section): Handle relaxed
9710         input section.
9711         (Output_section::Input_section::is_relaxed_input_section,
9712         Output_section::Input_section::output_section_data,
9713         Output_section::Input_section::relaxed_input_section): New method
9714         definitions.
9715         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9716         value.
9717         (Output_section::Input_section::u1_): Update comments.
9718         (Output_section::Input_section::u2_): Add new union member poris.
9719         (Output_section::Checkpoint_output_section): New classs definition.
9720         (Output_section::relax_input_section): New method declaration.
9721         (Output_section::checkpoint_): New data member.
9722         (Output_segment): Update comments.
9723         (Output_segment::Output_segment): Un-privatize copy constructor.
9724         (Output_segment::operator=): Un-privatize.
9725         * script-sections.cc (Output_section_element::Input_section_list):
9726         Change element type to Output_section::Simple_input_section.
9727         (Output_section_element_dot_assignment::set_section_addresses):
9728         Register output section data for relaxation clean up.
9729         (Output_data_exression::Output_data_expression): Adjust call to base
9730         constructor to fix data size.
9731         (Output_section_element_data::set_section_addresses): Register
9732         Output_data_expression object for relaxation clean up.
9733         (struct Input_section_info): Replace Relobj pointer and section index
9734         pair with Output_section::Simple_input_section and Convert struct to a
9735         class.
9736         (Input_section_sorter::operator()): Adjust access to
9737         Input_section_info data member to use accessors.
9738         (Output_section_element_input::set_section_addresses): Use layout
9739         parameter.  Adjust code to use Output_section::Simple_input_section
9740         and Input_secction_info classes.  Register filler for relaxation
9741         clean up.
9742         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9743         and section index pair with Output_section::Simple_input_section
9744         class.  Adjust code accordingly.
9745         (Phdrs_element::release_segment): New method definition.
9746         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9747         segment list.
9748         (Script_sections::release_segments): New method definition.
9749         * gold/script-sections.h (Script_sections::release_segments): New
9750         method declaration.
9751         * gold/target.h (Target::may_relax, Target::relax,
9752         Target::do_may_relax, Target::do_relax): New method definitions.
9753
9754 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9755
9756         * arm.cc (has_signed_unsigned_overflow): New function.
9757         (Arm_relocate_functions::abs8): New function.
9758         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9759         (Target_arm::Scan::global): Likewise.
9760         (Target_arm::relocate::relocate): Likewise.
9761         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9762         Likewise.
9763
9764 2009-09-16  Cary Coutant  <ccoutant@google.com>
9765
9766         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9767         * testsuite/Makefile.in: Regenerate.
9768
9769 2009-09-11  Nick Clifton  <nickc@redhat.com>
9770
9771         * po/gold.pot: Updated by the Translation project.
9772
9773 2009-09-08  Cary Coutant  <ccoutant@google.com>
9774
9775         * output.cc (Output_file::open): Add execute permission to empty file.
9776         * testsuite/Makefile.am (permission_test): New test.
9777         * testsuite/Makefile.in: Regenerate.
9778
9779 2009-09-02  Ian Lance Taylor  <iant@google.com>
9780
9781         * output.cc (Output_file::resize): Call map_no_anonymous rather
9782         than map.
9783
9784 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9785
9786         * gold.cc: Include "incremental.h".
9787         (queue_initial_tasks): Call Incremental_checker methods.
9788         * incremental.cc: Include "output.h".
9789         (Incremental_checker::can_incrementally_link_output_file): New
9790         method.
9791         * incremental.h (Incremental_checker): New class.
9792
9793         * output.cc (Output_file::open_for_modification): New method.
9794         (Output_file::map_anonymous): Changed return type to bool.  Record
9795         map in base_ field.
9796         (Output_file::map_no_anonymous): New method, broken out of map.
9797         (Output_file::map): Use map_no_anonymous and map_anonymous.
9798         * output.h (class Output_file): Update declarations.
9799
9800 2009-08-24  Cary Coutant  <ccoutant@google.com>
9801
9802         * options.h (Command_line::Pre_options): New class.
9803         (Command_line::pre_options): New member.
9804         * options.cc (gold::options::ready_to_register): New variable.
9805         (One_option::register_option): Do nothing if not registering options.
9806         Assert if same short option registered twice.
9807         (General_options::General_options): Turn off option registration when
9808         done constructing.
9809         (Command_line::Pre_options::Pre_options): New constructor.
9810
9811 2009-08-24  Cary Coutant  <ccoutant@google.com>
9812
9813         * options.h (General_options::no_keep_memory): Remove incorrect
9814         short option.
9815
9816 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9817
9818         * Makefile.am (am__skiplex, am__skipyacc): New.
9819         * Makefile.in: Regenerate.
9820
9821 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9822
9823         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9824         (INCLUDES): ... this.
9825         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9826         (AM_CPPFLAGS): Renamed from ...
9827         (INCLUDE): ... this.
9828         * Makefile.in, testsuite/Makefile.in: Regenerate.
9829
9830         * Makefile.in: Regenerate.
9831         * aclocal.m4: Likewise.
9832         * config.in: Likewise.
9833         * configure: Likewise.
9834         * testsuite/Makefile.in: Likewise.
9835
9836         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9837         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9838         * Makefile.in: Regenerate.
9839         * testsuite/Makefile.in: Regenerate.
9840
9841 2009-08-19  Cary Coutant  <ccoutant@google.com>
9842
9843         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9844         symbols in shared libraries overridden by hidden or internal symbols
9845         in the main program.
9846
9847 2009-08-19  Chris Demetriou  <cgd@google.com>
9848
9849         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9850         checking source file names in error messages.
9851
9852 2009-08-18  Doug Kwan  <dougkwan@google.com>
9853
9854         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9855         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9856         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9857         an elfcpp::Ehdr as parameter.
9858         * object.cc (Object::set_target): Remove the version that looks up
9859         a target and sets it.
9860         (Sized_relobj::setup): Take a Target object instead of
9861         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9862         (make_elf_sized_object): Find target and ask target to
9863         make an ELF object.
9864         * object.h: (Object::set_target): Remove the version that looks up
9865         a target and sets it.
9866         (Sized_relobj::setup): Take a Target object instead of
9867         an elfcpp:Ehdr as parameter.
9868         * target.cc: Include dynobj.h.
9869         (Target::do_make_elf_object_implementation): New.
9870         (Target::do_make_elf_object): New.
9871         * target.h (Target::make_elf_object): New template declaration.
9872         (Target::do_make_elf_object): New method declarations.
9873         (Target::do_make_elf_object_implementation): New template declaration.
9874
9875 2009-08-14  Ian Lance Taylor  <iant@google.com>
9876
9877         * gold.h (FUNCTION_NAME): Define.
9878         (gold_unreachable): Use FUNCTION_NAME.
9879
9880 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9881
9882         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9883         symbol in the --keep-unique list is not found.
9884
9885 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9886
9887         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9888         been maked as --keep-unique.
9889         (Icf::unfold_section): New function.
9890         * icf.h (Icf::unfold_section): New function.
9891         * options.h (General_options::keep_unique): New option.
9892         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9893         * testsuite/Makefile.in: Regenerate.
9894         * testsuite/icf_keep_unique_test.sh: New file.
9895         * testsuite/icf_keep_unique_test.cc: New file.
9896
9897 2009-08-12  Cary Coutant  <ccoutant@google.com>
9898
9899         PR 10471
9900         * resolve.cc (Symbol_table::resolve): Check for references from
9901         dynamic objects to hidden and internal symbols.
9902         * testsuite/Makefile.am (hidden_test.sh): New test.
9903         * testsuite/Makefile.in: Regenerate.
9904         * testsuite/hidden_test.sh: New script.
9905         * testsuite/hidden_test_1.c: New test source.
9906         * testsuite/hidden_test_main.c: New test source.
9907
9908 2009-08-11  Doug Kwan  <dougkwan@google.com>
9909
9910         * arm.cc: Update comments.
9911         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9912         segment to locate the .ARM.exidx section if present.
9913
9914 2009-08-09  Doug Kwan  <dougkwan@google.com>
9915
9916         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9917         patch.
9918
9919 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9920         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9921         compiler warnings.
9922
9923 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9924
9925         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9926         valid tls_segment only for non-debug-section relocations.
9927         * testsuite/Makefile.am: Add gc_tls_test.
9928         * testsuite/Makefile.in: Regenerate.
9929         * testsuite/gc_tls_test.cc: New file.
9930         * testsuite/gc_tls_test.sh: New file.
9931
9932 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9933
9934         * icf.cc: New file.
9935         * icf.h: New file.
9936         * Makefile.am (CCFILES): Add icf.cc.
9937         (HFILES): Add icf.h
9938         * Makefile.in: Regenerate.
9939         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9940         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9941         section, symbol and addend information for the relocs.
9942         * gold.cc (queue_middle_tasks): Call identical code folding.
9943         * gold.h: Add defines for multimap.
9944         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9945         to the call of finalize_local_symbols.
9946         * main.cc (main): Create object of class Icf.
9947         * object.cc (Sized_relobj::do_layout): Allow this function to be
9948         called twice during icf.
9949         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9950         to sections marked as identical by icf.
9951         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9952         when available.
9953         (Sized_relobj::do_section_entsize): New function.
9954         * object.h (Object::section_entsize): New function.
9955         (Object::do_section_entsize): New pure virtual function.
9956         (Relobj::finalize_local_symbols): Add new parameter.
9957         (Relobj::do_section_entsize): New function.
9958         * options.h (General_options::icf): New option.
9959         (General_options::icf_iterations): New option.
9960         (General_options::print_icf_sections): New option.
9961         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9962         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9963         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9964         icf.
9965         * symtab.cc (Symbol_table::is_section_folded): New function.
9966         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9967         to sections marked as identical by icf.
9968         * symtab.h (Symbol_table::set_icf): New function.
9969         (Symbol_table::icf): New function.
9970         (Symbol_table::is_section_folded): New function.
9971         (Symbol_table::icf_): New data member.
9972         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9973         * testsuite/Makefile.am: Add commands to build icf_test.
9974         * testsuite/Makefile.in: Regenerate.
9975         * testsuite/icf_test.sh: New file.
9976         * testsuite/icf_test.cc: New file.
9977
9978 2009-07-24  Chris Demetriou  <cgd@google.com>
9979
9980         * layout.cc (is_compressible_debug_section): Fix incorrect
9981         comment about compressed section names.
9982
9983 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9984
9985         PR 10419
9986         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9987
9988 2009-07-16  Ian Lance Taylor  <iant@google.com>
9989
9990         PR 10400
9991         * layout.h: #include <map>.
9992         (class Kept_section): Change from struct to class.  Add accessors
9993         and setters.  Add section size to Comdat_group mapping.  Change
9994         Comdat_group to std::map.  Add is_comdat_ field.  Add
9995         linkonce_size field in union.
9996         (class Layout): Update declaration of find_or_add_kept_section.
9997         Don't declare find_kept_object.
9998         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9999         parameter.  Add object, shndx, is_comdat, and is_group_name
10000         parameters.  Change all callers.  Adjust for new Kept_section.
10001         (Layout::find_kept_object): Remove.
10002         * object.cc (Sized_relobj::include_section_group): Update use of
10003         Kept_section.  Rename secnum to shndx.  Only record
10004         Kept_comdat_section if sections are the same size.
10005         (Sized_relobj::include_linkonce_section): Update use of
10006         Kept_section.  Only record Kept_comdat_section if sections are the
10007         same size.  Set size of linkonce section.
10008         (Sized_relobj::map_to_kept_section): Update call to
10009         get_kept_comdat_section.
10010         * object.h (class Sized_relobj): Rename fields in
10011         Kept_comdat_section to drop trailing underscores; change object
10012         field to Relobj*.  Change Kept_comdat_section_table to store
10013         struct rather than pointer.
10014         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10015         Add kept_object and kept_shndx parameters.  Change all callers.
10016         (Sized_relobj::get_kept_comdat_section): Change return type to
10017         bool.  Add kept_object and kept_shndx parameters.  Change all
10018         callers.
10019         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10020         Layout::find_or_add_kept_section.
10021
10022 2009-07-09  Ian Lance Taylor  <iant@google.com>
10023
10024         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10025         Reserve space in the hash table.
10026
10027 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10028
10029         * fileread.cc (File_read::get_mtime): New method.
10030         * fileread.h (Timespec): New structure.
10031         (File_read::get_mtime): New method.
10032         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10033         Renamed from timestamp_nsec.
10034         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10035         Elf_Xword.
10036         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10037         timestamp_nsec.
10038         (Incremental_inputs::report_archive): Save mtime; style fix.
10039         (Incremental_inputs::report_obejct): Save mtime; style fix.
10040         (Incremental_inputs::report_script): Save mtime; style fix.
10041         (Incremental_inputs::finalize_inputs): Style fix.
10042         (Incremental_inputs::finalize): Style fix.
10043         (Incremental_inputs::create_input_section_data): Store inputs
10044         mtime.
10045         * incremental.h (Incremental_inputs::report_script): Add mtime
10046         argument.
10047         (Incremental_inputs::Input_info::Input_info): Intialize only one
10048         union member.
10049         (Incremental_inputs::Input_info::archive): Move to nameless
10050         union.
10051         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10052         (Incremental_inputs::Input_info::script): Move to nameless union.
10053         (Incremental_inputs::mtime): New field.
10054         * script.cc (read_input_script): Pass file mtime to
10055         Incremental_input.
10056         * script.h (Script_info::inputs): Style fix.
10057
10058 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10059
10060         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10061         instead of 32.
10062
10063 2009-06-24  Ian Lance Taylor  <iant@google.com>
10064
10065         PR 10156
10066         * layout.cc (Layout::choose_output_section): If we find an
10067         existing section, update the flags.
10068         (Layout::create_notes): New function, broken out of
10069         Layout::finalize.
10070         (Layout::finalize): Don't create note sections.
10071         (Layout::create_note): Don't crash if linker script discards
10072         section.
10073         (Layout::create_gold_note): Likewise.
10074         (Layout::create_build_id): Likewise.  Don't set
10075         after_input_sections on the section.
10076         (Layout::create_executable_stack_info): Remove target parameter.
10077         Change caller.
10078         * layout.h (class Layout): Declare create_notes.  Update
10079         declaration of create_executable_stack_info.
10080         * gold.cc (queue_middle_tasks): Call create_notes.
10081         * output.cc (Output_section::update_flags_for_input_section): Move
10082         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10083         invalid.
10084         * output.h (Output_data::mark_address_invalid): New function.
10085         (class Output_section): Only declare, not define,
10086         update_flags_for_input_section.  Remove set_flags.
10087
10088 2009-06-24  Ian Lance Taylor  <iant@google.com>
10089
10090         * script-sections.cc (Output_section_definition::
10091         set_section_addresses): Rename shadowing local load_address to
10092         laddr.
10093
10094 2009-06-24  Ian Lance Taylor  <iant@google.com>
10095
10096         PR 10244
10097         * reloc.cc (relocate_sections): Skip empty relocation sections.
10098
10099 2009-06-23  Ian Lance Taylor  <iant@google.com>
10100
10101         PR 10156
10102         * layout.cc (Layout::create_note): Use choose_output_section
10103         rather than make_output_section.
10104
10105 2009-06-23  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 10237
10108         * options.cc (General_options::parse_V): Set printed_version_.
10109         (General_options::General_options): Initialize printed_version_.
10110         * options.h (class General_options): Add printed_version_ field.
10111         * gold.cc (queue_initial_tasks): If there are no input files,
10112         don't give a fatal error if we printed the version information.
10113         (queue_middle_tasks): If using -r with a shared object, give a
10114         fatal error rather than an ordinary error.
10115
10116 2009-06-23  Ian Lance Taylor  <iant@google.com>
10117
10118         PR 10219
10119         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10120         (Layout::make_output_section): Set have_stabstr_section_ if we see
10121         a .stab*str section.
10122         (Layout::finalize): Call link_stabs_sections.
10123         (Layout::link_stabs_sections): New file.
10124         * layout.h (class Layout): Add have_stabstr_section_ field.
10125         Declare link_stabs_sections.
10126
10127 2009-06-23  Doug Kwan  <dougkwan@google.com>
10128
10129         * Makefile.am (libgold_a_LIBADD): New.
10130         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10131         * Makefile.in: Regenerate.
10132         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10133         * configure: Regenerate.
10134         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10135         * fileread.cc: Include sys/state.h
10136         * gold.h: Declare memmem and strndup if found missing.
10137         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10138
10139 2009-06-23  Ian Lance Taylor  <iant@google.com>
10140
10141         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10142         * configure: Rebuild.
10143
10144 2009-06-23  Ian Lance Taylor  <iant@google.com>
10145
10146         PR 10147
10147         * object.cc (Object::section_contents): Don't try to get a view if
10148         the section has length zero.
10149         (Object::handle_gnu_warning_section): If the section is empty, use
10150         the name of the section as the warning.
10151
10152 2009-06-23  Ian Lance Taylor  <iant@google.com>
10153
10154         PR 10133
10155         * stringpool.h (class Stringpool_template): Add optimize_ field.
10156         (Stringpool_template::set_optimize): New function.
10157         * stringpool.cc (Stringpool_template::Stringpool_template):
10158         Initialize optimize_ field.
10159         (Stringpool_template::set_string_offsets): Test local optimize
10160         fild rather than parameter.
10161         * layout.cc (Layout::Layout): Call set_optimize on the section
10162         name stringpool.
10163
10164 2009-06-22  Ian Lance Taylor  <iant@google.com>
10165
10166         PR 10030
10167         * yyscript.y: Parse TARGET.
10168         * script.cc (script_set_target): New function.
10169         * script-c.h (script_set_target): Declare.
10170         * options.cc (General_options::string_to_object_format): Rename
10171         from string_to_object_format in anonymous namespace.  Change
10172         callers.
10173         * options.h (class General_options): Declare
10174         string_to_object_format.
10175
10176 2009-06-22  Ian Lance Taylor  <iant@google.com>
10177
10178         * script-sections.cc (Script_sections::create_segments): Don't put
10179         program headers in a PT_LOAD segment if -n or -N.
10180
10181 2009-06-22  Ian Lance Taylor  <iant@google.com>
10182
10183         PR 10141
10184         * options.h (class General_options): Add -z lazy and -z now.  Sort
10185         -z options into alphabetical order.
10186         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10187
10188 2009-06-21  Ian Lance Taylor  <iant@google.com>
10189
10190         * layout.cc (Layout::make_output_section): Call
10191         Target::new_output_section.
10192         (Layout::attach_allocated_section_to_segment): Put large section
10193         sections in a separate load segment with the large segment flag
10194         set.
10195         (Layout::segment_precedes): Sort large data segments after other
10196         load segments.
10197         (align_file_offset): New static function.
10198         (Layout::set_segment_offsets): Use align_file_offset.
10199         * output.h (class Output_section): Add is_small_section_ and
10200         is_large_section_ fields.
10201         (Output_section::is_small_section): New function.
10202         (Output_section::set_is_small_section):  New function.
10203         (Output_section::is_large_section): New function.
10204         (Output_section::set_is_large_section): New function.
10205         (Output_section::is_large_data_section): New function.
10206         (class Output_segment): Add is_large_data_segment_ field.
10207         (Output_segment::is_large_data_segment): New function.
10208         (Output_segment::set_is_large_data_segment): New function.
10209         * output.cc (Output_section::Output_section): Initialize new
10210         fields.
10211         (Output_segment::Output_segment): Likewise.
10212         (Output_segment::add_output_section): Add assertion that large
10213         data sections always go in large data segments.  Force small data
10214         sections to the end of the list of data sections.  Force small BSS
10215         sections to the start of the list of BSS sections.  For large BSS
10216         sections to the end of the list of BSS sections.
10217         * symtab.h (class Symbol): Declare is_common_shndx.
10218         (Symbol::is_defined): Check Symbol::is_common_shndx.
10219         (Symbol::is_common): Likewise.
10220         (class Symbol_table): Define enum Commons_section_type.  Update
10221         declarations.  Add small_commons_ and large_commons_ fields.
10222         * symtab.cc (Symbol::is_common_shndx): New function.
10223         (Symbol_table::Symbol_table): Initialize new fields.
10224         (Symbol_table::add_from_object): Put small and large common
10225         symbols in the right list.
10226         (Symbol_table::sized_finalized_symbol): Check
10227         Symbol::is_common_shndx.
10228         (Symbol_table::sized_write_globals): Likewise.
10229         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10230         common symbol lists.  Don't call do_allocate_commons_list if the
10231         list is empty.
10232         (Symbol_table::do_allocate_commons_list): Remove is_tls
10233         parameter.  Add comons_section_type parameter.  Change all
10234         callers.  Handle small and large common symbols.
10235         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10236         Symbol::is_common_shndx.
10237         * resolve.cc (symbol_to_bits): Likewise.
10238         * target.h (Target::small_common_shndx): New function.
10239         (Target::small_common_section_flags): New function.
10240         (Target::large_common_shndx): New function.
10241         (Target::large_common_section_flags): New function.
10242         (Target::new_output_section): New function.
10243         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10244         small_common_section_flags, and large_common_section_flags
10245         fields.
10246         (Target::do_new_output_section): New virtual function.
10247         * arm.cc (Target_arm::arm_info): Initialize new fields.
10248         * i386.cc (Target_i386::i386_info): Likewise.
10249         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10250         Likewise.
10251         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10252         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10253         (Target_x86_64::do_new_output_section): New function.
10254         * configure.ac: Define conditional MCMODEL_MEDIUM.
10255         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10256         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10257         (large_LDFLAGS): Define.
10258         * testsuite/large.c: New file.
10259         * testsuite/testfile.cc (Target_test::test_target_info):
10260         Initialize new fields.
10261         * configure, testsuite/Makefile.in: Rebuild.
10262
10263 2009-06-05  Doug Kwan  <dougkwan@google.com>
10264
10265         * Makefile.am (CCFILES): Add target.cc.
10266         * Makefile.in: Regenerate.
10267         * i386.cc (class Target_i386): Define new virtual method to
10268         override do_is_local_label_name in parent.
10269         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10270         local symbols if --discard-locals or -X is given.
10271         * options.h (class General_options): Declare new options
10272         '--discard-locals' and '-X' for discarding locals.
10273         * target.h (class Target): Define new methods is_local_label_name.
10274         Declare new virtual method do_is_local_label_name.
10275         * target.cc: New file.
10276         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10277         (check_SCRIPTS): Add discard_locals_test.sh.
10278         (check_DATA): Add discard_local_tests.syms.
10279         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10280         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10281         * testsuite/Makefile.in: Regenerate.
10282         * testsuite/discard_locals_test.c: New file.
10283         * testsuite/discard_locals_test.sh: Same.
10284
10285 2009-06-05  Doug Kwan  <dougkwan@google.com>
10286
10287         * object.cc (Sized_relobj::Sized_relobj): Initialize
10288         discarded_eh_frame_shndx_ to -1U.
10289         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10290         section.
10291         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10292         a discarded .eh_frame section.
10293         (Sized_relobj::do_finalize_local_symbols): Ditto.
10294         * object.h (class Sized_relobj): Declare new member
10295         discarded_eh_frame_shndx_.
10296         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10297         (local_labels_test.o, local_labels_test): New rules.
10298         * testsuite/Makefile.in: Regenerate.
10299
10300 2009-06-04  Doug Kwan  <dougkwan@google.com>
10301
10302         * layout.cc (Layout::section_name_mapping): Add mapping for
10303         special ARM sections.
10304
10305 2009-06-03  Doug Kwan  <dougkwan@google.com>
10306
10307         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10308         (utils::has_overflow): Same.
10309
10310 2009-06-03  Ian Lance Taylor  <iant@google.com>
10311
10312         * layout.cc (Layout::section_name_mapping): New array, replacing
10313         Layout::linkonce_mapping.
10314         (Layout::section_name_mapping_count): New variable, replacing
10315         Layout::linkonce_mapping_count.
10316         (Layout::linkonce_output_name): Remove.
10317         (Layout::output_section_name): Rewrite.
10318         * layout.h (class Layout): Rename Linkonce_mapping to
10319         Section_name_mapping, linkonce_mapping to section_name_mapping,
10320         linkonce_mapping_count to section_name_mapping_count.  Don't
10321         declare linkonce_output_name.
10322
10323 2009-06-03  Doug Kwan  <dougkwan@google.com>
10324
10325         * gold/arm.cc (namespace utils): New.
10326         (Target_arm::reloc_is_non_pic): Define new method.
10327         (class Arm_relocate_functions): New.
10328         (Target_arm::Relocate::relocate): Handle relocation types used by
10329         Android.
10330
10331 2009-06-03  Ian Lance Taylor  <iant@google.com>
10332
10333         * arm.cc (Target_arm::scan::global): Use || instead of |.
10334
10335 2009-06-02  Doug Kwan  <dougkwan@google.com>
10336
10337         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10338         issued_non_pic_error_.
10339         (class Target_arm::Scan): Declare new method check_non_pic.
10340         Define new method symbol_needs_plt_entry.
10341         Declare new data member issued_non_pic_error_.
10342         (class Target_arm::Relocate): Declare new method
10343         should_apply_static_reloc.
10344         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10345         (Target_arm::Scan::check_non_pic): Define new method.
10346         (Target_arm::Scan::local): Handle a small subset of reloc types used
10347         by Android.
10348         (Target_arm::Scan::local): Same.
10349         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10350
10351 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10352
10353         * incremental.cc (Incremental_inputs::report_command_line): Filter
10354         out --incremental-* options.
10355
10356 2009-05-29  Doug Kwan  <dougkwan@google.com>
10357
10358         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10359         template class.
10360         (class Target_arm): Update comment.
10361         (Target_arm::Target_arm): Initialize new data members GOT_,
10362         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10363         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10364         and Target_arm::rel_dyn_section.
10365         Declare new_enum Target_arm::Got_type.
10366         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10367         and DYNBSS_.
10368         Update commments for member do_dynsym_value.
10369         (Target_arm::got_size, Target_arm::plt_section,
10370         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10371         new methods inside class defintion.
10372         (Target_arm::got_section): Define new method.
10373         (Target_arm::rel_dyn_section): Same.
10374         (Output_data_plt_arm): New template class.
10375         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10376         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10377         (Output_data_plt_arm::add_entry): Same.
10378         (Output_data_plt_arm::first_plt_entry): Define new
10379         static data member for PLT instruction template.
10380         (Output_data_plt_arm::plt_entry): Same.
10381         (Output_data_plt_arm::do_write): Define new method.
10382         (Target_arm::make_plt_entry): Same.
10383         (Target_arm::do_finalize_sections): Same.
10384         (Target_arm::do_dynsym_value): Same.
10385
10386 2009-05-28  Doug Kwan  <dougkwan@google.com>
10387
10388         * Makefile.am (TARGETSOURCES): Add arm.cc.
10389         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10390         * Makefile.in: Regenerate.
10391         * arm.cc: New file.
10392         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10393
10394 2009-05-26  Doug Kwan  <dougkwan@google.com>
10395
10396         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10397         (General_options::check_excluded_libs): Strip off directories in
10398         archive name before matching like GNU ld does.
10399         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10400         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10401         (exclude_libs_test_LDFLAGS): Add linker option
10402         -Wl,--exclude-libs,libexclude_libs_test_3
10403         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10404         an explicit archive without using -l.
10405         (alt/libexclude_libs_test_3.a): New make rule.
10406         * testsuite/Makefile.in: Regenerate.
10407         * testsuite/exclude_libs_test.c : Declare lib3_default().
10408         (main): Call it.
10409         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10410         * exclude_libs_test_3.c: New file.
10411
10412 2009-05-26  Nick Clifton  <nickc@redhat.com>
10413
10414         * po/id.po: New Indonesian translation.
10415         * po/gold.pot: Updated template file.
10416
10417 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10418
10419         * testsuite/Makefile.am: Add -ffunction-sections to compile
10420         gc_comdat_test files.  Add -Wl,--gc-sections to build
10421         gc_comdat_test.
10422         * testsuite/Makefile.in: Regenerate.
10423         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10424
10425 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10426
10427         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10428         kept comdat section was garbage collected.
10429         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10430         * testsuite/Makefile.in: Regenerate.
10431         * testsuite/gc_comdat_test.sh: New file.
10432         * testsuite/gc_comdat_test_1.cc: New file.
10433         * testsuite/gc_comdat_test_2.cc: New file.
10434
10435 2009-05-19  Doug Kwan  <dougkwan@google.com>
10436
10437         * archive.cc (Archive::Archive): Move constructor from archive.h
10438         to here.  Initialize no_export_.
10439         (Archive::get_elf_object_for_member): Set no_export flag of object.
10440         * archive.h (Archive::Archive): Move constructor body to
10441         archive.cc.
10442         (Archive::no_export): New method.
10443         (Archive::no_export_): New field.
10444         * object.h (Object::Object): Initialize no_export_ to false.
10445         (Object::no_export, Object::set_no_export): New methods.
10446         (Object::no_export_): New field.
10447         * options.cc (General_options::parse_exclude_libs): New method.
10448         (General_options::check_excluded_libs) Same.
10449         * options.h (exclude_libs): New option.
10450         (General_options::check_excluded_libs): New method declaration.
10451         (General_options::excluded_libs_): New field.
10452         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10453         default or protected visibility if an object has no-export flag set.
10454         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10455         (check_SCRIPTS): Add exclude_libs_test.sh.
10456         (check_DATA): Add exclude_libs_test.syms.
10457         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10458         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10459         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10460         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10461         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10462         libexclude_libs_test_2.a): New rules.
10463         * testsuite/Makefile.in: Regenerate.
10464         * testsuite/exclude_libs_test.c: New file.
10465         * testsuite/exclude_libs_test.sh: Ditto.
10466         * testsuite/exclude_libs_test_1.c: Ditto.
10467         * testsuite/exclude_libs_test_2.c: Ditto.
10468
10469 2009-05-15  Ian Lance Taylor  <iant@google.com>
10470
10471         * configure.ac: Check for declarations for cases where libiberty.h
10472         checks HAVE_DECL_xxx.
10473         * configure, config.in: Rebuild.
10474
10475 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10476
10477         * gold.h (Incremental_argument_list): Remove (invalid) forward
10478         declaration.
10479         * incremental.cc (Incremental_inputs::report_achive): New method.
10480         (Incremental_inputs::report_object): New method.
10481         (Incremental_inputs::report_script): New method.
10482         (Incremental_inputs::finalize_inputs): New method.
10483         (Incremental_inputs::finalize): Call finalize_inputs().
10484         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10485         Create inputs entries.
10486         * incremental.h (Incremental_input_type): New enum.
10487         (Incremental_inputs::Incremental_input): Initialize new fields.
10488         (Incremental_inputs::report_inputs): New method.
10489         (Incremental_inputs::report_achive): New method.
10490         (Incremental_inputs::report_object): New method.
10491         (Incremental_inputs::report_script): New method.
10492         (Incremental_inputs::finalize_inputs): New method.
10493         (Incremental_inputs::Input_info): New struct.
10494         (Incremental_inputs::Input_info_map): New typedef.
10495         (Incremental_inputs::lock_): New field.
10496         (Incremental_inputs::Inputs_): New field.
10497         (Incremental_inputs::Inputs_map): New field.
10498         * main.cc (main): Call Incremental_input::report_inputs.
10499         * options.h (Input_argument_list): Typedef moved from
10500         Input_arguments.
10501         (Input_file_group::Files): Remove, use ::Input_argument_list.
10502         (Input_file_group::Input_argument_list): Remove, use
10503         ::Input_argument_list.
10504         * plugin.cc (Plugin_manager::add_input_file): Add error in
10505         incremental build.
10506         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10507         functions.
10508         * script.cc (read_input_script): Call
10509         Incremental_input::report_script.
10510         * script.h (Script_info): New class.
10511
10512 2009-04-27  Ian Lance Taylor  <iant@google.com>
10513
10514         * x86_64.cc (do_adjust_output_section): Set entsize to
10515         plt_entry_size.
10516
10517 2009-04-23  Elliott Hughes  <enh@google.com>
10518
10519         * output.cc (Output_file::close): After short writes, continue
10520         writing from the correct offset in the buffer being written.
10521
10522 2009-04-23  Chris Demetriou  <cgd@google.com>
10523
10524         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10525         * configure: Regenerate.
10526         * config.in: Regenerate.
10527         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10528         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10529
10530 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10531
10532         * incremental.cc (Incremental_inputs_header_data): Renamed from
10533         Incremental_input_header_data.
10534         (Incremental_inputs_header_data::data_size): New field.
10535         (Incremental_inputs_header_data::put_input_file_count): Renamed
10536         from input_file_count.
10537         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10538         from command_line_offset.
10539         (Incremental_inputs_header_data::put_reserved): Renamed from
10540         put_reserved.
10541         (Incremental_inputs_entry_data): Renamed from
10542         Incremental_input_entry_data.
10543         (Incremental_inputs_entry_data::data_size): New field.
10544         (Incremental_inputs::report_command_line): New method.
10545         (Incremental_inputs::finalize): New method.
10546         (Incremental_inputs::create_incremental_inputs_data): New method.
10547         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10548         * incremental.h: New file.
10549         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10550         (Layout::finalize): Create incremental inputs section in
10551         incremental builds.
10552         (Layout::create_incremental_info_sections): New method.
10553         * layout.h (Layout::incremental_inputs): New method.
10554         (Layout::create_incremental_info_sections): New method.
10555         (Layout::incremental_inputs_): New field.
10556         * main.cc (main): Notify Incremental_input of the command line.
10557
10558 2009-04-01  Ian Lance Taylor  <iant@google.com>
10559             Mikolaj Zalewski  <mikolajz@google.com>
10560
10561         * gold.h (reserve_unordered_map): Define, three versions, one for
10562         each version of Unordered_map.
10563         * layout.cc (Layout::Layout): Remove options parameter.  Add
10564         number_of_input_files parameter.  Don't initialize options_.
10565         Initialize number_of_input_files_ and resized_signatures_.  Move
10566         sections_are_attached_.
10567         (Layout::layout_group): Reserve space for group_signatures_.
10568         (Layout::find_or_add_kept_section): Change name parameter to be a
10569         reference.  Resize signatures_ map when it gets large enough.
10570         (Layout::layout_eh_frame): Use parameters->options() instead of
10571         this->options_.
10572         (Layout::make_output_section): Likewise.
10573         (Layout::attach_allocated_section_to_segment): Likewise.
10574         (Layout::finalize, Layout::create_executable_stack): Likewise.
10575         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10576         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10577         * layout.h (class Layout): Update declarations.  Remove options_
10578         field.  Add number_of_input_files_ and resized_signatures_
10579         fields.  Move sections_are_attached_ field.
10580         * main.cc (main): Pass number of input files to Layout
10581         constructor.  Don't pass options.
10582
10583 2009-03-30  Ian Lance Taylor  <iant@google.com>
10584
10585         * ffsll.c (ffsll): Correct implementation.
10586
10587 2009-03-27  Ian Lance Taylor  <iant@google.com>
10588
10589         * ffsll.c: New file.
10590         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10591         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10592         * ftruncate.c (ftruncate): Declare before definition.
10593         * mremap.c (mremap): Likewise.
10594         * pread.c (pread): Likewise.
10595         * configure, Makefile.in, config.in: Rebuild.
10596
10597         * mremap.c: New file.
10598         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10599         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10600         (mremap): Declare if HAVE_MREMAP is not defined.
10601         * configure, Makefile.in, config.in: Rebuild.
10602
10603 2009-03-27  Cary Coutant  <ccoutant@google.com>
10604
10605         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10606         position independent.
10607         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10608         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10609
10610 2009-03-24  Cary Coutant  <ccoutant@google.com>
10611
10612         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10613         an executable.
10614         (needs_dynamic_reloc): Likewise.
10615
10616 2009-03-24  Ian Lance Taylor  <iant@google.com>
10617
10618         * yyscript.y (file_cmd): Recognize EXTERN.
10619         (extern_name_list, extern_name_list_body): New nonterminals.
10620         * script.cc (script_add_extern): Define.
10621         * script-c.h (script_add_extern): Declare.
10622
10623 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10624
10625         * object.cc (is_elf_object): Define.
10626         * object.h (is_elf_object): Declare.
10627         * archive.cc (Archive::get_elf_object_for_member): Call
10628         is_elf_object.
10629         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10630
10631 2009-03-24  Elliott Hughes  <enh@google.com>
10632
10633         * output.cc (Output_file::map_anonymous): Define.
10634         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10635         try an anonymous one.  Report the size if the mmap fails.
10636         * output.h (class Output_file): Declare map_anonymous.
10637
10638 2009-03-24  Ian Lance Taylor  <iant@google.com>
10639
10640         * target-select.cc (instantiate_target): Don't acquire the lock if
10641         the instantiated_target_ field has already been set.
10642
10643 2009-03-23  Ian Lance Taylor  <iant@google.com>
10644
10645         * gold-threads.h (class Initialize_lock): Define.
10646         * gold-threads.cc (class Initialize_lock_once): Define.
10647         (initialize_lock_control): New static variable.
10648         (initialize_lock_pointer): New static variable.
10649         (initialize_lock_once): New static function.
10650         (Initialize_lock::Initialize_lock): Define.
10651         (Initialize_lock::initialize): Define.
10652         * target-select.h: Include "gold-threads.h".
10653         (class Target_selector): Add lock_ and initialize_lock_ fields.
10654         Don't define instantiate_target, just declare it.
10655         * target-select.cc (Target_selector::Target_selector): Initialize
10656         new fields.
10657         (Target_selector::instantiate_target): Define.
10658         * descriptors.h: Include "gold-threads.h".
10659         (class Descriptors): Add initialize_lock_ field.
10660         * descriptors.cc (Descriptors::Descriptors): Initialize new
10661         field.
10662         (Descriptors::open): Use initialize_lock_ field
10663         * errors.h (class Errors): Add initialize_lock_ field.
10664         * errors.cc (Errors::Errors): Initialize new field.
10665         (Errors::initialize_lock): Use initialize_lock_ field.
10666         * powerpc.cc (class Target_selector_powerpc): Remove
10667         instantiated_target_ field.  In do_recognize call
10668         instantiate_target rather than do_instantiate_target.  In
10669         do_instantiate_target just allocate a new target.
10670         * sparc.cc (class Target_selector_sparc): Likewise.
10671
10672         * freebsd.h: New file.
10673         * i386.cc: Include "freebsd.h".
10674         (Target_i386): Derive from Target_freebsd rather than
10675         Sized_target.
10676         (Target_selector_i386): Derive from Target_selector_freebsd rather
10677         than Target_selector.
10678         * x86_64.cc: Include "freebsd.h".
10679         (Target_x86_64): Derive from Target_freebsd rather than
10680         Sized_target.
10681         (Target_selector_x86_64): Derive from Target_selector_freebsd
10682         rather than Target_selector.
10683         * target.h (class Target): Add adjust_elf_header and
10684         do_adjust_elf_header.
10685         * output.cc (Output_file_header:: do_sized_write): Call target
10686         adjust_elf_header routine.
10687         * configure.tgt: Set targ_osabi.
10688         * configure.ac: Define GOLD_DEFAULT_OSABI.
10689         * parameters.cc (Parameters::default_target): Pass
10690         GOLD_DEFAULT_OSABI to select_target.
10691         * target-select.h (class Target_selector): Make instantiate_target
10692         protected rather than private.
10693         * Makefile.am (HFILES): Add freebsd.h.
10694         * configure, Makefile.in, config.in: Rebuild.
10695
10696         * merge.cc (do_add_input_section): Correct pend value.  Change
10697         message about last entry not being null terminated from error to
10698         warning.
10699
10700 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10701
10702         * incremental.cc: New file.
10703         * Makefile.am (CCFILES): Add incremental.cc.
10704         * Makefile.in: Rebuild.
10705
10706 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10707
10708         * layout.cc (Layout::output_section_name): Preserve names
10709         of '.note.' sections.
10710
10711 2009-03-19  Ian Lance Taylor  <iant@google.com>
10712
10713         * descriptors.cc (Descriptors::open): Check that the options are
10714         valid before using them.
10715
10716 2009-03-18  Ian Lance Taylor  <iant@google.com>
10717
10718         * script-sections.h: Include <list>.
10719         (class Script_sections): Change Sections_elements from std::vector
10720         to std::list.  Typedef public Elements_iterator.  Add
10721         orphan_section_placement_, data_segment_align_start_, and
10722         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10723         field.
10724         * script-sections.cc (class Orphan_section_placement): New class.
10725         (class Sections_element): Add virtual functions is_relro and
10726         orphan_section_init.  Remove virtual function place_orphan_here.
10727         (class Output_section_definition): Add is_relro and
10728         orphan_section_init.  Remove place_orphan_here.
10729         (class Orphan_output_section): Likewise.
10730         (Script_sections::Script_sections): Update for field changes.
10731         (Script_sections::data_segment_align): Set saw_data_segment_align_
10732         and data_segment_align_start_, not data_segment_align_index.
10733         (Script_sections::data_segment_relro_end): Check
10734         saw_data_segment_align_.  Use data_segment_align_start_ rather
10735         than data_segment_align_index_.
10736         (Script_sections::place_orphan): Rewrite to use
10737         Orphan_section_placement.
10738
10739 2009-03-17  Ian Lance Taylor  <iant@google.com>
10740
10741         * archive.cc (Archive::add_symbols): Check for a version attached
10742         to the symbol name in the archive map.
10743         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10744         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10745         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10746         (ver_test_11.a): New target.
10747         * testsuite/Makefile.in: Rebuild.
10748
10749         * configure.ac: Check for chsize and posix_fallocate.  Replace
10750         ftruncate.
10751         * ftruncate.c: New file, from gnulib.
10752         * output.cc (posix_fallocate): Define dummy version if not
10753         HAVE_POSIX_FALLOCATE.
10754         (Output_file::map): Call posix_fallocate rather than lseek and
10755         write.
10756         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10757         * configure, Makefile.in, config.in: Rebuild.
10758
10759 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10760
10761         * layout.h (Layout::create_note): Add section_name parameter.
10762         * layout.cc (Layout::create_note): Likewise.
10763         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10764
10765 2009-03-17  Ian Lance Taylor  <iant@google.com>
10766
10767         * descriptors.cc: Include "options.h".
10768         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10769         (Descriptors::open): Always use O_CLOEXEC when opening a new
10770         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10771         then set FD_CLOEXEC.
10772
10773         * sparc.cc (class Target_sparc): Add has_got_section.
10774         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10775         make sure we have a GOT section.
10776
10777         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10778         (Target_sparc::Scan::local): Likewise.
10779         (Target_sparc::Scan::global): Likewise.
10780         (Target_sparc::Relocate::relocate): Likewise.
10781         (Target_sparc::Relocate::relocate_tls): Likewise.
10782
10783         * symtab.cc (Symbol_table::define_default_version): New function,
10784         broken out of add_from_object.
10785         (Symbol_table::add_from_object): Call define_default_version.
10786         (Symbol_table::define_special_symbol): Add resolve_oldsym
10787         parameter.  Change all callers.  If the version for a symbol comes
10788         from a version script, resolve it with the symbol with the same
10789         name with no version.  Also add the symbol without a version if
10790         appropriate.
10791         (do_define_in_output_data): If resolving with oldsym, don't delete
10792         sym.
10793         (do_define_in_output_segment): Likewise.
10794         (do_define_as_constant): Likewise.
10795         * symtab.h (class Symbol_table): Update declarations.
10796
10797 2009-03-13  Ian Lance Taylor  <iant@google.com>
10798
10799         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10800         (Read_symbols::requeue): New function.
10801         (Read_symbols::do_read_symbols): If make_elf_object fails because
10802         the target type is not configured, and the file was searched for,
10803         issue a warning and retry with the next directory.
10804         (Add_symbols::run): If the file has an incompatible format, and
10805         it was searched for, requeue the Read_symbols task.  On error,
10806         release the object.
10807         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10808         dirindex parameter to constructor.  Change all callers.  Declare
10809         incompatible_warning and requeue.
10810         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10811         input_argument_ and input_group_ fields.  Add them to
10812         constructor.  Change all callers.
10813         (class Read_script): Add dirindex_ field.  Add it to constructor.
10814         Change all callers.
10815         * archive.cc (Archive::setup): Remove input_objects parameter.
10816         Change all callers.
10817         (Archive::get_file_and_offset): Likewise.
10818         (Archive::read_all_symbols): Likewise.
10819         (Archive::read_symbols): Likewise.
10820         (Archive::get_elf_object_for_member): Remove input_objects
10821         parameter.  Add punconfigured parameter.  Change all callers.
10822         (Archive::add_symbols): Change return type to bool.  Check return
10823         value of include_member.
10824         (Archive::include_all_members): Likewise.
10825         (Archive::include_member): Change return type to bool.  Return
10826         false if first included object has incompatible target.  Set
10827         included_member_ field.
10828         (Add_archive_symbols::run): If add_symbols returns false, requeue
10829         Read_symbols task.
10830         * archive.h (class Archive): Add included_member_ field.
10831         Initialize it in constructor.  Add input_file and searched_for
10832         methods.  Update declarations.
10833         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10834         input_argument_ fields.  Add them to constructor.  Change all
10835         callers.
10836         * script.cc: Include "target-select.h".
10837         (class Parser_closure): Add skip_on_incompatible_target_ and
10838         found_incompatible_target_ fields.  Add
10839         skip_on_incompatible_target parameter to constructor.  Change all
10840         callers.  Add methods skip_on_incompatible_target,
10841         clear_skip_on_incompatible_target, found_incompatible_target, and
10842         set_found_incompatible_target.
10843         (read_input_script): Add dirindex parameter.  Change all callers.
10844         If parser finds an incompatible target, requeue Read_symbols
10845         task.
10846         (script_set_symbol): Clear skip_on_incompatible_target in
10847         closure.
10848         (script_add_assertion, script_parse_option): Likewise.
10849         (script_start_sections, script_add_phdr): Likewise.
10850         (script_check_output_format): New function.
10851         * script.h (read_input_script): Update declaration.
10852         * script-c.h (script_check_output_format): Declare.
10853         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10854         (ignore_cmd): Remove OUTPUT_FORMAT.
10855         * fileread.cc (Input_file::Input_file): Add explicit this.
10856         (Input_file::will_search_for): New function.
10857         (Input_file::open): Add pindex parameter.  Change all callers.
10858         * fileread.h (class Input_file): Add input_file_argument method.
10859         Declare will_search_for.  Update declarations.
10860         * object.cc (make_elf_object): Add punconfigured parameter.
10861         Change all callers.
10862         * object.h (class Object): Make input_file public.  Add
10863         searched_for method.
10864         (make_elf_object): Update declaration.
10865         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10866         restart search.
10867         * dirsearch.h (class Dirsearch): Update declaration.
10868         * options.h (class General_options): Add --warn-search-mismatch.
10869         * parameters.cc (Parameters::is_compatible_target): New function.
10870         * parameters.h (class Parameters): Declare is_compatible_target.
10871         * workqueue.cc (Workqueue::add_blocker): New function.
10872         * workqueue.h (class Workqueue): Declare add_blocker.
10873
10874         * fileread.cc (Input_file::open): Remove options parameter.
10875         Change all callers.
10876         (Input_file::open_binary): Likewise.
10877         * script.cc (read_input_script): Likewise.
10878         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10879         options parameter from constructor.  Change all callers.
10880         (class Read_script): Likewise.
10881         * fileread.h (class Input_file): Update declarations.
10882         * script.h (read_input_script): Update declaration.
10883
10884 2009-03-10  Nick Clifton  <nickc@redhat.com>
10885
10886         * po/es.po: New Spanish translation.
10887
10888 2009-03-06  Cary Coutant  <ccoutant@google.com>
10889
10890         * options.cc (parse_short_option): Keep dash_z from registering itself.
10891
10892 2009-03-03  Ian Lance Taylor  <iant@google.com>
10893
10894         PR 9918
10895         * target-reloc.h (relocate_section): Pass output_section to
10896         relocate.
10897         * i386.cc (Target_i386::should_apply_static_reloc): Add
10898         output_section parameter.  Change all callers.
10899         (Target_i386::Relocate::relocate): Add output_section parameter.
10900         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10901         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10902         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10903         * testsuite/two_file_shared.sh: New script.
10904         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10905         (check_DATA): Add two_file_shared.dbg.
10906         (two_file_shared.dbg): New target.
10907         * testsuite/Makefile.in: Rebuild.
10908
10909 2009-03-01  Ian Lance Taylor  <iant@google.com>
10910
10911         * configure.ac: Check for byteswap.h.
10912         * configure: Rebuild.
10913         * config.in: Rebuild.
10914
10915 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10916
10917         * layout.cc (Layout::find_or_add_kept_section): New function.
10918         (Layout::add_comdat): Removed.
10919         * layout.h (struct Kept_section): Move out of class Layout.
10920         Remove trailing underscores from field names.  Add group_sections
10921         field.  Rename group_ field to is_group.  Change all uses.
10922         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10923         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10924         comdat_groups_ field.
10925         (Sized_relobj::include_section_group): Use
10926         find_or_add_kept_section and Kept_section::group_sections.
10927         (Sized_relobj::include_linkonce_section): Likewise.
10928         * object.cc (class Sized_relobj): Don't define Comdat_group or
10929         Comdat_group_table.  Remove find_comdat_group and
10930         add_comdat_group.  Remove comdat_groups_ field.
10931         * plugin.cc (include_comdat_group): Use
10932         Layout::find_or_add_kept_section.
10933
10934 2009-02-28  Ian Lance Taylor  <iant@google.com>
10935
10936         * README: --gc-sections and map files are now supported.  Document
10937         some build requirements.
10938
10939         PR 6992
10940         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10941         relocatable link set the value of the section symbol to zero.
10942         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10943         relocatable link don't include the section address in the local
10944         symbol value.
10945
10946 2009-02-27  Ian Lance Taylor  <iant@google.com>
10947
10948         PR 6811
10949         * options.h (class Search_directory): Add is_system_directory.
10950         (class General_options): Declare is_in_system_directory.
10951         * options.cc (get_relative_sysroot): Make static.
10952         (get_default_sysroot): Make static.
10953         (General_optoins::is_in_system_directory): New function.
10954         * fileread.cc (Input_file::is_in_system_directory): New function.
10955         * fileread.h (class Input_file): Declare is_in_system_directory.
10956         * object.h (class Object): Add is_in_system_directory.
10957         (class Input_objects): Remove system_library_directory_ field.
10958         * object.cc (Input_objects::add_object): Don't set
10959         system_library_directory_.
10960         (input_objects::found_in_system_library_directory): Remove.
10961         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10962         parameter.  Change all callers.
10963         (Symbol_table::sized_write_globals): Likewise.
10964         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10965         Call Object::is_in_system_directory.
10966         * symtab.h (class Symbol_table): Update declarations.
10967
10968         PR 5990
10969         * descriptors.h (Open_descriptor): Add is_on_stack field.
10970         * descriptors.cc (Descriptors::open): If the descriptor is on the
10971         top of the stack, remove it.  Initialize is_on_stack field.
10972         (Descriptors::release): Only add pod to stack if it is not on the
10973         stack already.
10974         (Descriptors::close_some_descriptor): Clear stack_next and
10975         is_on_stack fields.
10976
10977         PR 7091
10978         * output.cc (Output_section::find_starting_output_address): Rename
10979         from starting_output_address; add PADDR parameter; change return
10980         type.
10981         * output.h (class Output_section): Declare
10982         find_starting_output_address instead of starting_output_address.
10983         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10984         section symbol for which we can't find a merge section.
10985
10986         PR 9836
10987         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10988         hidden or internal, force the symbol to be local.
10989         * resolve.cc (Symbol::override_visibility): Define.
10990         (Symbol::override_base): Use override_visibility.
10991         (Symbol_table::resolve): Likewise.
10992         (Symbol::override_base_with_special): Likewise.
10993         (Symbol_table::override_with_special): If the visibility is hidden
10994         or internal, force the symbol to be local.
10995         * symtab.h (class Symbol): Add set_visibility and
10996         override_visibility.
10997         * testsuite/ver_test_1.sh: New file.
10998         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10999         (check_DATA): Add ver_test_1.syms.
11000         (ver_test_1.syms): New target.
11001         * testsuite/Makefile.in: Rebuild.
11002
11003 2009-02-25  Cary Coutant  <ccoutant@google.com>
11004
11005         * layout.cc (Layout::choose_output_section): Don't rename sections
11006         when using a linker script that has a SECTIONS clause.
11007         * Makefile.in: Regenerate.
11008
11009         * testsuite/Makefile.am (script_test_5.sh): New test case.
11010         * testsuite/Makefile.in: Regenerate.
11011         * testsuite/script_test_5.cc: New file.
11012         * testsuite/script_test_5.sh: New file.
11013         * testsuite/script_test_5.t: New file.
11014
11015 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11016
11017         * archive.cc (Archive::include_member): Update calls to add_symbols.
11018         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11019         the Layout argument.
11020         * dynobj.h (do_add_symbols): Add the Layout argument.
11021         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11022         Layout argument.
11023         * object.h (Object::add_symbols): Add the Layout argument.
11024         (Object::do_add_symbols): Add the Layout argument.
11025         (Sized_relobj::do_add_symbols): Add the Layout argument.
11026         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11027         Unify the two versions.
11028         (Add_plugin_symbols): Remove.
11029         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11030         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11031         (Add_plugin_symbols): Remove.
11032         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11033         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11034         (Add_symbols::run): Make it work with Pulginobj.
11035
11036 2009-02-06  Ian Lance Taylor  <iant@google.com>
11037
11038         * object.cc (Sized_relobj::do_layout): Make info message start
11039         with lower case letter.
11040
11041 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11042
11043         * binary.cc: Fix file comment.
11044
11045         * options.h (enum Incremental_disposition): Define.
11046         (class General_options): Add new options: --incremental,
11047         --incremental_changed, --incremental_unchanged,
11048         --incremental_unknown.  Add incremental_disposition_ and
11049         implicit_incremental_ fields.
11050         (General_options::incremental_disposition): New function.
11051         (class Position_dependent_options): Add incremental_disposition
11052         option.
11053         (Position_dependent_options::copy_from_options): Set incremental
11054         dispositions.
11055         * options.cc (General_options::parse_incremental_changed): New
11056         function.
11057         (General_options::parse_incremental_unchanged): New function.
11058         (General_options::parse_incremental_unknown): New function.
11059         (General_options::General_options): Initialize new fields
11060         incremental_disposition_ and implicit_incremental_.
11061         (General_options::finalize): Check for uasge of --incremental-*
11062         without --incremental.
11063
11064 2009-02-06  Chris Demetriou  <cgd@google.com>
11065
11066         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11067         pointer and to report location as the file name associated with
11068         the symbol.
11069         (gold_undefined_symbol_at_location): New function to replace the
11070         old gold_undefined_symbol functionality.
11071         * target-reloc.h (relocate_section): Update to use
11072         gold_undefined_symbol_at_location.
11073         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11074         Call gold_undefined_symbol function rather than gold_error.
11075         * errors.h (Errors::undefined_symbol): Take location as a
11076         string, rather than calculating it from a relocation.
11077         * errors.cc (Errors::fatal): Print "fatal error:" before the
11078         formatted message.
11079         (Errors::error, Errors::error_at_location): Print "error: "
11080         before the formatted message.
11081         (Errors::undefined_symbol): Take location as a string, rather
11082         than calculating it from a relocation.
11083         (gold_undefined_symbol_at_location): New function akin to
11084         old gold_undefined_symbol, calculates location from relocation.
11085         (gold_undefined_symbol): Change to take only a Symbol pointer
11086         and to report location as the file name associated with the symbol.
11087         * testsuite/debug_msg.sh: Update for changed error messages.
11088         * testsuite/undef_symbol.sh: Likewise.
11089
11090 2009-02-04  Duncan Sands  <baldrick@free.fr>
11091
11092         PR 9812
11093         * reduced_debug_output.h
11094         (Output_reduced_debug_abbrev_section::failed): Use format for
11095         gold_warning.
11096         (Output_reduced_debug_info_section::faild): Likewise.
11097
11098 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11099
11100         * script.cc (Lazy_demangler): New class.
11101         (Version_script_info::get_symbol_version_helper): Demangle a
11102         symbol only once.
11103
11104 2009-01-29  Cary Coutant  <ccoutant@google.com>
11105
11106         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11107         to __tls_get_addr.
11108         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11109
11110 2009-01-28  Ian Lance Taylor  <iant@google.com>
11111
11112         * version.cc (version_string): Bump to 1.9.
11113
11114         * gold.h: Include <cstring> and <stdint.h>.
11115         * version.cc: Include <cstdio>.
11116         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11117         warning.
11118         * reduced_debug_output.cc (insert_into_vector): Rename from
11119         Insert_into_vector; change all callers.  Use Swap_unaligned to
11120         avoid aliasing issue; remove union since it is unnecessary.
11121
11122 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11123
11124         * Makefile.am (CCFILES): Add gc.cc.
11125         (HFILES): Add gc.h.
11126         * Makefile.in: Regenerate.
11127         * gold.cc (Gc_runner): New class.
11128         (queue_initial_tasks): Call garbage collection related tasks
11129         when corresponding options are invoked.
11130         (queue_middle_gc_tasks): New function.
11131         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11132         processed early before laying out sections during garbage collection.
11133         * gold.h (queue_middle_gc_tasks): New function.
11134         (is_prefix_of): Move from "layout.cc".
11135         * i386.cc (Target_i386::gc_process_relocs): New function.
11136         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11137         * main.cc (main): Create object of class "Garbage_collection".
11138         * object.cc (Relobj::copy_symbols_data): New function.
11139         (Relobj::is_section_name_included): New function.
11140         (Sized_relobj::do_layout): Allow this function to be called twice
11141         during garbage collection and defer layout of section during the
11142         first call.
11143         * object.h (Relobj::get_symbols_data): New function.
11144         (Relobj::is_section_name_included): New function.
11145         (Relobj::copy_symbols_data): New function.
11146         (Relobj::set_symbols_data): New function.
11147         (Relobj::get_relocs_data): New function.
11148         (Relobj::set_relocs_data): New function.
11149         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11150         (Relobj::gc_process_relocs): New function.
11151         (Relobj::do_gc_process_relocs): New pure virtual function.
11152         (Relobj::sd_): New data member.
11153         (Sized_relobj::is_output_section_offset_invalid): New function.
11154         (Sized_relobj::do_gc_process_relocs): New function.
11155         * options.h (General_options::gc_sections): Modify to not be a no-op.
11156         (General_options::print_gc_sections): New option.
11157         * plugin.cc (Plugin_finish::run): Remove function call to
11158         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11159         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11160         * reloc.cc (Read_relocs::run): Add task to process relocs and
11161         determine unreferenced sections when doing garbage collection.
11162         (Gc_process_relocs): New class.
11163         (Sized_relobj::do_gc_process_relocs): New function.
11164         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11165         sections that are garbage collected.
11166         * reloc.h (Gc_process_relocs): New class.
11167         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11168         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11169         symbols whose corresponding sections are garbage collected.
11170         (Symbol_table::Symbol_table): Add new parameter for the garbage
11171         collection object.
11172         (Symbol_table::gc_mark_undef_symbols): New function.
11173         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11174         (Symbol_table::gc_mark_dyn_syms): New function.
11175         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11176         as garbage.
11177         (Symbol_table::add_from_object): Likewise.
11178         (Symbol_table::add_from_relobj): When building shared objects, do not
11179         treat externally visible symbols as garbage.
11180         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11181         table information for static and relocatable links.
11182         * symtab.h (Symbol_table::set_gc): New function.
11183         (Symbol_table::gc): New function.
11184         (Symbol_table::gc_mark_undef_symbols): New function.
11185         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11186         (Symbol_table::gc_mark_dyn_syms): New function.
11187         (Symbol_table::gc_): New data member.
11188         * target.h (Sized_target::gc_process_relocs): New pure virtual
11189         function.
11190         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11191         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11192
11193 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11194
11195         * options.h (General_options::gc_sections): Define as a no-op for now.
11196         (General_options::no_keep_memory): Ditto.
11197         (General_options::Bshareable): Define.
11198         * options.cc (General_options::finalize): Honor -Bshareable.
11199
11200 2009-01-20  Andreas Schwab  <schwab@suse.de>
11201
11202         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11203         read the value in the contents, since we don't use it.  Use the
11204         template endianness when writing.
11205         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11206
11207 2009-01-19  Andreas Schwab  <schwab@suse.de>
11208
11209         * configure.tgt (powerpc64-*): Fix targ_obj.
11210
11211 2009-01-15  Ian Lance Taylor  <iant@google.com>
11212
11213         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11214         local symbols when stripping all symbols.
11215
11216 2009-01-14  Cary Coutant  <ccoutant@google.com>
11217
11218         * output.cc (Output_reloc): Add explicit instantiations.
11219
11220 2009-01-14  Cary Coutant  <ccoutant@google.com>
11221
11222         * archive.cc (Archive::get_elf_object_for_member): Remove call
11223         to File_read::claim_for_plugin.
11224         * descriptors.cc (Descriptors::open): Remove reference to
11225         is_claimed.
11226         (Descriptors::claim_for_plugin): Remove.
11227         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11228         (Descriptors::is_claimed): Remove.
11229         (claim_descriptor_for_plugin): Remove.
11230         * fileread.cc (File_read::claim_for_plugin): Remove.
11231         * fileread.h (File_read::claim_for_plugin): Remove.
11232         (File_read::descriptor): Reopen descriptor if necessary.
11233         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11234         (Plugin_manager::all_symbols_read): Add task parameter. Change
11235         all callers.
11236         (Plugin_manager::get_input_file): New function.
11237         (Plugin_manager::release_input_file): New function.
11238         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11239         corresponding data member.
11240         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11241         and pass to base constructor. Change all callers.
11242         (get_input_file, release_input_file): New functions.
11243         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11244         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11245         (Plugin_manager::all_symbols_read): Add task parameter.
11246         (Plugin_manager::get_input_file): New function.
11247         (Plugin_manager::release_input_file): New function.
11248         (Plugin_manager::task_): New data member.
11249         (Pluginobj::Pluginobj): Add filesize parameter.
11250         (Pluginobj::filename): New function.
11251         (Pluginobj::descriptor): New function.
11252         (Pluginobj::filesize): New function.
11253         (Pluginobj::filesize_): New data member.
11254         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11255         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11256         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11257
11258         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11259         with archive libraries.
11260         * testsuite/Makefile.in: Regenerate.
11261         * testsuite/plugin_test.c (struct sym_info): New type.
11262         (get_input_file, release_input_file): New static variables.
11263         (onload): Capture new transfer vector entries.
11264         (claim_file_hook): Stop reading at end of file according to filesize.
11265         Factor out parsing of readelf output into separate function.
11266         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11267         APIs and get the source file name from the symbol table.  Convert
11268         source file name to corresponding object file name.  Print info
11269         message when adding new input files.
11270         (parse_readelf_line): New function.
11271         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11272         * testsuite/plugin_test_2.sh: Likewise.
11273         * testsuite/plugin_test_3.sh: Likewise.
11274         * testsuite/plugin_test_4.sh: New test case.
11275
11276 2009-01-07  Ian Lance Taylor  <iant@google.com>
11277
11278         * version.cc (version_string): Bump to 1.8.
11279
11280 2008-12-23  Cary Coutant  <ccoutant@google.com>
11281
11282         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11283         * plugin.cc (Plugin_manager::finish): Rename as
11284         layout_deferred_objects.  Move cleanup to separate function.
11285         (Plugin_manager::cleanup): New function.
11286         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11287         separately.
11288         * plugin.h (Plugin_manager::finish): Rename as
11289         layout_deferred_objects.
11290         (Plugin_manager::cleanup): New function.
11291         (Plugin_manager::cleanup_done): New field.
11292
11293 2008-12-23  Cary Coutant  <ccoutant@google.com>
11294
11295         * plugin.cc (is_visible_from_outside): New function.
11296         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11297         so we don't return "IR only" status for exported symbols or -r links.
11298
11299         * testsuite/Makefile.am (plugin_test_3): New test case.
11300         * testsuite/Makefile.in: Regenerate.
11301         * testsuite/plugin_test_3.sh: New file.
11302
11303 2008-12-22  Cary Coutant  <ccoutant@google.com>
11304
11305         * object.cc (Sized_relobj::layout_section): New function.
11306         (Sized_relobj::do_layout): Defer layout of input sections until after
11307         plugin has provided replacement files.
11308         (Sized_relobj::do_layout_deferred_sections): New function.
11309         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11310         (Relobj::layout_deferred_sections): New function.
11311         (Relobj::do_layout_deferred_sections): New function.
11312         (Sized_relobj::do_layout_deferred_sections): New function.
11313         (Sized_relobj::layout_section): New function.
11314         (Sized_relobj::Deferred_layout): New structure.
11315         (Sized_relobj::deferred_layout_): New field.
11316         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11317         Change all callers.  Layout deferred sections.
11318         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11319         references.
11320         (Plugin_hook::run): Move code from do_plugin_hook inline.
11321         (Plugin_hook::do_plugin_hook): Remove.
11322         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11323         (Plugin_manager::finish): Renamed, was cleanup.
11324         (Plugin_manager::should_defer_layout): New function.
11325         (Plugin_manager::add_deferred_layout_object): New function.
11326         (Plugin_manager::Deferred_layout_list): New type.
11327         (Plugin_manager::deferred_layout_objects_): New field.
11328         (Plugin_hook::do_plugin_hook): Remove.
11329
11330 2008-12-17  Ian Lance Taylor  <iant@google.com>
11331
11332         * options.h (class General_options): Add --no case for
11333         --export-dynamic.
11334
11335 2008-12-16  Cary Coutant  <ccoutant@google.com>
11336
11337         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11338         vector.
11339         (Plugin_manager::claim_file): Create plugin object even if
11340         plugin did not call the add_symbols callback.
11341         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11342         asking for more symbols than were added.
11343         * testsuite/Makefile.am (plugin_test_1): Add test case with
11344         no global symbols.
11345         (empty.syms): New target.
11346         * testsuite/Makefile.in: Regenerate.
11347         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11348         message. Don't call add_symbols if no globals.
11349         (all_symbols_read_hook): Don't provide replacement for empty
11350         claimed file.
11351
11352 2008-12-12  Ian Lance Taylor  <iant@google.com>
11353
11354         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11355         r_type == 0 for a local symbol with r_sym == 0.
11356         (scan_relocatable_relocs): Pass r_sym to
11357         local_non_section_strategy.
11358         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11359         r_sym parameter.
11360
11361         * configure.ac: Update test for TLS descriptors: they are
11362         supported as of glibc 2.9.
11363         * configure: Rebuild.
11364
11365 2008-12-11  Ian Lance Taylor  <iant@google.com>
11366
11367         PR 7091
11368         * target-reloc.h (Default_scan_relocatable_relocs): For each
11369         function, map r_type == 0 to RELOC_DISCARD.
11370
11371 2008-12-10  Cary Coutant  <ccoutant@google.com>
11372
11373         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11374         object to override a kept COMDAT group from a plugin object.
11375
11376 2008-12-09  Ian Lance Taylor  <iant@google.com>
11377
11378         PR 7088
11379         * yyscript.y (file_cmd): Handle INPUT.
11380
11381         * testsuite/initpri1.c: Change all declarations to be full
11382         prototypes by adding void, to avoid compiler warnings.
11383
11384 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11385
11386         * options.cc (General_options::parse_plugin_opt): New.
11387         (General_options::add_plugin): The argument now is just the filename.
11388         (General_options::add_plugin_option): New.
11389         * options.h (plugin_opt): New.
11390         (add_plugin): Change argument name.
11391         (add_plugin_option): New.
11392         * plugin.cc (Plugin::load): Don't parse the plugin option.
11393         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11394         (Plugin::add_option): New.
11395         (Plugin::args_): Change type.
11396         (Plugin::filename_): New.
11397         (Plugin_manager::add_plugin_option): New.
11398         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11399         * testsuite/Makefile.in: Regenerate.
11400
11401 2008-12-05  Cary Coutant  <ccoutant@google.com>
11402
11403         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11404         Handle --strip-lto-sections option.
11405         * options.h (strip_lto_sections): New option.
11406
11407 2008-12-01  Cary Coutant  <ccoutant@google.com>
11408
11409         * plugin.cc (ld_plugin_message): Change format parameter to const.
11410         Fix mismatch between new[] and delete.
11411
11412 2008-11-14  Cary Coutant  <ccoutant@google.com>
11413
11414         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11415         instead of -1U.
11416
11417 2008-11-05  Craig Silverstein  <csilvers@google.com>
11418
11419         * options.cc (General_options::parse_dynamic_list): New function.
11420         * options.h (General_options): New flags dynamic_list,
11421         dynamic_list_data, dynamic_list_cpp_new, and
11422         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11423         (General_options::in_dynamic_list): New function.
11424         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11425         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11426         (Lex::can_continue_name): Likewise.
11427         (yylex): Likewise.
11428         (read_script_file): New parameter script_options.
11429         (read_dynamic_list): New function.
11430         (Script_options::define_dynamic_list): New function.
11431         (dynamic_list_keyword_parsecodes): New variable.
11432         (dynamic_list_keywords): New variable.
11433         * script.h (Script_options::define_dynamic_list): New function
11434         prototype.
11435         (read_dynamic_list): New function prototype.
11436         * symtab.cc (strprefix): New macro.
11437         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11438         dynamic_list_data, dynamic_list_cpp_new, and
11439         dynamic_list_cpp_typeinfo.
11440         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11441         (dynamic_list_expr): New rule.
11442         (dynamic_list_nodes): Likewise.
11443         (dynamic_list_node): Likewise.
11444         * testsuite/Makefile.am (dynamic_list): New test.
11445         * testsuite/Makefile.in: Regenerated.
11446         * testsuite/dynamic_list.t: New file.
11447         * testsuite/dynamic_list.sh: New file.
11448
11449 2008-11-05  Craig Silverstein  <csilvers@google.com>
11450
11451         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11452         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11453         (t11_last): Likewise.
11454         * testsuite/ver_test_6.c (main): Likewise.
11455
11456 2008-10-07  Cary Coutant  <ccoutant@google.com>
11457
11458         * options.c (General_options::finalize): Add check for -static and
11459         -shared.
11460         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11461         is not empty.
11462
11463 2008-10-02  Cary Coutant  <ccoutant@google.com>
11464
11465         * plugin.cc (make_sized_plugin_object): Fix conditional
11466         compilation to work when not all targets are enabled.
11467
11468 2008-09-29  Cary Coutant  <ccoutant@google.com>
11469
11470         * archive.cc (Archive::get_file_and_offset): Use filename instead
11471         of name to get library path.
11472         (Archive::include_member): Unlock external member of a thin archive.
11473
11474         * testsuite/Makefile.am (TEST_AR): New variable.
11475         (thin_archive_test_1): New test.
11476         (thin_archive_test_2): New test.
11477         * testsuite/Makefile.in: Regenerate.
11478         * testsuite/thin_archive_main.cc: New file.
11479         * testsuite/thin_archive_test_1.cc: New file.
11480         * testsuite/thin_archive_test_2.cc: New file.
11481         * testsuite/thin_archive_test_3.cc: New file.
11482         * testsuite/thin_archive_test_4.cc: New file.
11483
11484 2008-09-29  Cary Coutant  <ccoutant@google.com>
11485
11486         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11487         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11488         instead of -1U.
11489         (Sized_relobj::do_finalize_local_symbols): Likewise.
11490         (Sized_relobj::map_to_kept_section): Likewise.
11491         * object.h (Sized_relobj::invalid_address): New constant.
11492         (Sized_relobj::do_output_section_offset): Check for invalid_address
11493         and return -1ULL.
11494         * output.cc (Output_reloc::local_section_offset): Use constant
11495         invalid_address instead of -1U.
11496         (Output_reloc::get_address): Likewise.
11497         (Output_section::output_address): Change -1U to -1ULL.
11498         * output.h (Output_reloc::invalid_address): New constant.
11499         * reloc.cc (Sized_relobj::write_sections): Use constant
11500         invalid_address instead of -1U.
11501         (Sized_relobj::relocate_sections): Likewise.
11502         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11503         values for merge sections.
11504         * target-reloc.h (relocate_for_relocatable): Use constant
11505         invalid_address instead of -1U.
11506
11507 2008-09-19  Cary Coutant  <ccoutant@google.com>
11508
11509         Add plugin functionality for link-time optimization (LTO).
11510         * configure.ac (plugins): Add --enable-plugins option.
11511         * configure: Regenerate.
11512         * config.in: Regenerate.
11513         * Makefile.am (LIBDL): New variable.
11514         (CCFILES): Add plugin.cc.
11515         (HFILES): Add plugin.h.
11516         (ldadd_var): Add LIBDL.
11517         * Makefile.in: Regenerate.
11518
11519         * archive.cc: Include "plugin.h".
11520         (Archive::setup): Don't preread archive symbols when using a plugin.
11521         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11522         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11523         files.
11524         (Archive::include_member): Add symbols from plugin objects.
11525         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11526         * descriptors.cc (Descriptors::open): Check for file descriptors
11527         abandoned by plugins.
11528         (Descriptors::claim_for_plugin): New function.
11529         * descriptors.h (Descriptors::claim_for_plugin): New function.
11530         (Open_descriptor::is_claimed): New field.
11531         (claim_descriptor_for_plugin): New function.
11532         * fileread.cc (File_read::claim_for_plugin): New function.
11533         * fileread.h (File_read::claim_for_plugin): New function.
11534         (File_read::descriptor): New function.
11535         * gold.cc: Include "plugin.h".
11536         (queue_initial_tasks): Add task to call plugin hooks for generating
11537         new object files.
11538         * main.cc: Include "plugin.h".
11539         (main): Load plugin libraries.
11540         * object.h (Pluginobj): Declare.
11541         (Object::pluginobj): New function.
11542         (Object::do_pluginobj): New function.
11543         (Object::set_target): New function.
11544         * options.cc: Include "plugin.h".
11545         (General_options::parse_plugin): New function.
11546         (General_options::General_options): Initialize plugins_ field.
11547         (General_options::add_plugin): New function.
11548         * options.h (Plugin_manager): Declare.
11549         (General_options): Add --plugin option.
11550         (General_options::has_plugins): New function.
11551         (General_options::plugins): New function.
11552         (General_options::add_plugin): New function.
11553         (General_options::plugins_): New field.
11554         * plugin.cc: New file.
11555         * plugin.h: New file.
11556         * readsyms.cc: Include "plugin.h".
11557         (Read_symbols::do_read_symbols): Check for archive before checking
11558         for ELF file.  Call plugin hooks to claim files.
11559         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11560         from a real object file; force override when processing replacement
11561         files.
11562         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11563         (Symbol::init_base_object): Likewise.
11564         (Symbol::init_base_output_data): Likewise.
11565         (Symbol::init_base_output_segment): Likewise.
11566         (Symbol::init_base_constant): Likewise.
11567         (Symbol::init_base_undefined): Likewise.
11568         (Symbol::output_section): Assert that object is not a plugin.
11569         (Symbol_table::add_from_pluginobj): New function.
11570         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11571         undefined.
11572         (Symbol_table::sized_write_globals): Likewise.
11573         (Symbol_table::add_from_pluginobj): Instantiate template.
11574         * symtab.h (Sized_pluginobj): Declare.
11575         (Symbol::in_real_elf): New function.
11576         (Symbol::set_in_real_elf): New function.
11577         (Symbol::in_real_elf_): New field.
11578         (Symbol_table::add_from_pluginobj): New function.
11579
11580         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11581         (LIBDL): New variable.
11582         (LDADD): Add LIBDL.
11583         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11584         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11585         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11586         (MOSTLYCLEANFILES): Likewise.
11587         * testsuite/Makefile.in: Regenerate.
11588         * testsuite/plugin_test.c: New file.
11589         * testsuite/plugin_test_1.sh: New file.
11590         * testsuite/plugin_test_2.sh: New file.
11591
11592 2008-09-16  Ian Lance Taylor  <iant@google.com>
11593
11594         * target-reloc.h (relocate_section): Check whether a symbol is
11595         defined by the ABI before reporting an undefined symbol error.
11596         * target.h (Target::is_defined_by_abi): Make parameter const.
11597         (Target::do_is_defined_by_abi): Likewise.
11598         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11599         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11600         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11601         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11602         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11603         * testsuite/Makefile.in: Rebuild.
11604
11605         * fileread.cc (make_view): Add casts to avoid warning.
11606
11607 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11608
11609         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11610         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11611
11612 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11613
11614         * options.h (General_options::output_is_executable): New.
11615         (General_options::output_is_pie): New.
11616         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11617         for shared libraries.
11618         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11619
11620 2008-09-11  Chris Demetriou  <cgd@google.com>
11621
11622         * options.h (origin): New -z option.
11623         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11624         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11625         in DT_FLAGS_1.
11626
11627 2008-09-05  Cary Coutant  <ccoutant@google.com>
11628
11629         * fileread.cc (File_read::make_view): Add check for attempt to map
11630         beyond end of file.
11631
11632 2008-09-05  Cary Coutant  <ccoutant@google.com>
11633
11634         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11635         explicit instantiations.
11636
11637 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11638
11639         PR gold/6858
11640         * options.cc (General_options::finalize): Allow undefined symbols
11641         in shlibs if linking -shared.
11642
11643         PR gold/6859
11644         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11645         symbols as not needing a dynsym entry.
11646
11647 2008-08-20  Craig Silverstein  <csilvers@google.com>
11648
11649         * fileread.cc (File_read::open): Do not lock the file unless it
11650         was successfully opened.
11651
11652 2008-08-14  Cary Coutant  <ccoutant@google.com>
11653
11654         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11655         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11656         * testsuite/tls_test.cc (struct int128): 128-bit struct
11657         for testing TLS relocs with non-zero addend.
11658         (v12): New TLS variable.
11659         (t12): New test.
11660         (t_last): Add check for v12.
11661         * testsuite/tls_test.h (t12): New function.
11662         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11663
11664 2008-08-13  Ian Lance Taylor  <iant@google.com>
11665
11666         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11667         set tls_segment_ or relro_segment_.
11668         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11669         when appropriate.
11670         * output.h (Output_section::clear_is_relro): New function.
11671         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11672         sections specially even when output_data_ is empty.
11673         (Output_segment::maximum_alignment): When first section is relro,
11674         only force alignment for PT_LOAD segments.
11675         * script.cc (script_data_segment_align): New function.
11676         (script_data_segment_relro_end): New function.
11677         * script-c.h (script_data_segment_align): Declare.
11678         (script_data_segment_relro_end): Declare.
11679         * script-sections.h (class Script_sections): Declare
11680         data_segment_align and data_segment_relro_end.  Add fields
11681         segment_align_index_ and saw_relro_end_.
11682         * script-sections.cc (class Sections_element): Add set_is_relro
11683         virtual function.  Add new bool* parameter to place_orphan_here.
11684         Add get_output_section virtual function.
11685         (class Output_section_definition): Add set_is_relro.  Add new
11686         bool* parameter to place_orphan_here.  Add get_output_section.
11687         Add is_relro_ field.
11688         (Output_section_definition::Output_section_definition): Initialize
11689         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11690         and is_relro_ fields.
11691         (Output_section_definition::place_orphan_here): Add is_relro
11692         parameter.
11693         (Output_section_definition::set_section_addresses): Set relro for
11694         output section.
11695         (Output_section_definition::alternate_constraint): Likewise.
11696         (class Orphan_output_section): Add new bool* parameter to
11697         place_orphan_here.  Add get_output_section.
11698         (Orphan_output_section::place_orphan_here): Add is_relro
11699         parameter.
11700         (Script_sections::Script_sections): Initialize
11701         data_segment_align_index_ and saw_relro_end_.
11702         (Script_sections::data_segment_align): New function.
11703         (Script_sections::data_segment_relro_end): New function.
11704         (Script_sections::place_orphan): Set or clear is_relro.
11705         (Script_sections::set_section_addresses): Force alignment of first
11706         TLS section.
11707         * yyscript.y (exp): Call script_data_segment_align and
11708         script_data_segment_relro_end.
11709         * testsuite/relro_script_test.t: New file.
11710         * testsuite/relro_test.cc (using_script): Declare.
11711         (t1, t2): Test using_script.
11712         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11713         (relro_script_test_SOURCES): Define.
11714         (relro_script_test_DEPENDENCIES): Define.
11715         (relro_script_test_LDFLAGS): Define.
11716         (relro_script_test_LDADD): Define.
11717         (relro_script_test.so): New target.
11718         * testsuite/Makefile.in: Rebuild.
11719
11720 2008-08-06  Cary Coutant <ccoutant@google.com>
11721
11722         * archive.cc (Archive::total_archives, Archive::total_members)
11723         (Archive::total_members_loaded): New variables.
11724         (Archive::setup): Add parameter.  Add option to preread
11725         archive symbols.
11726         (Archive::read_armap): Add counter.
11727         (Archive::get_file_and_offset): New function.
11728         (Archive::get_elf_object_for_member): New function.
11729         (Archive::read_all_symbols): New function.
11730         (Archive::read_symbols): New function.
11731         (Archive::add_symbols): Add counters.
11732         (Archive::include_all_members): Use armap to find members if it's
11733         already built.
11734         (Archive::include_member): Skip reading symbols if already read.
11735         Factored code into Archive::get_file_and_offset and
11736         Archive::get_elf_object_for_member.  Changed call to
11737         Mapfile::report_include_archive_member.
11738         (Archive::print_stats): New function.
11739         * archive.h: Declare Object and Read_symbols_data classes.
11740         (Archive::Archive): Add initializers for new members.
11741         (Archive::setup): Add parameter.
11742         (Archive::print_stats): New function.
11743         (Archive::total_archives, Archive::total_members)
11744         (Archive::total_members_loaded): New variables.
11745         (Archive::get_file_and_offset): New function.
11746         (Archive::get_elf_object_for_member): New function.
11747         (Archive::read_all_symbols): New function.
11748         (Archive::read_symbols): New function.
11749         (Archive::Archive_member): New class.
11750         (Archive::members_): New member.
11751         (Archive::num_members_): New member.
11752         * main.cc: Include archive.h.
11753         (main): Call Archive::print_stats.
11754         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11755         archive parameter; member_name is now the fully-decorated name.
11756         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11757         * options.h: (General_options): Add --preread-archive-symbols option.
11758         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11759         Archive::setup.
11760
11761 2008-08-04  Ian Lance Taylor  <iant@google.com>
11762
11763         * symtab.h (Symbol::use_plt_offset): New function.
11764         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11765         * powerpc.cc (Relocate::relocate): Likewise.
11766         * sparc.cc (Relocate::relocate): Likewise.
11767         * x86_64.cc (Relocate::relocate): Likewise.
11768         * testsuite/weak_plt.sh: New test.
11769         * testsuite/weak_plt_main.cc: New test.
11770         * testsuite/weak_plt_shared.cc: New test.
11771         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11772         (check_PROGRAMS): Add weak_plt.
11773         (check_DATA): Add weak_plt_shared.so.
11774         (weak_plt_main_pic.o, weak_plt): New targets.
11775         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11776         * testsuite/Makefile.in: Rebuild.
11777
11778         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11779         gcctestdir/ld.
11780         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11781         * testsuite/Makefile.in: Rebuild.
11782
11783 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11784
11785         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11786         * Makefile.in: Regenerate.
11787         * po/POTFILES.in: Regenerate.
11788
11789 2008-07-29  Ian Lance Taylor  <iant@google.com>
11790
11791         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11792         symbols before other symbols.
11793         * testsuite/script_test_2.cc (test_addr): Declare.
11794         (test_addr_alias): Declare.
11795         (main): Check that test_addr and test_addr_alias have the right
11796         values.
11797         * testsuite/script_test_2.t: Define test_addr_alias and
11798         test_addr.
11799
11800 2008-07-24  Ian Lance Taylor  <iant@google.com>
11801
11802         PR 5990
11803         * descriptors.cc: New file.
11804         * descriptors.h: New file.
11805         * gold-threads.h (class Hold_optional_lock): New class.
11806         * fileread.cc: Include "descriptors.h".
11807         (File_read::~File_read): Release descriptor rather than closing
11808         it.
11809         (File_read::open) [file]: Call open_descriptor rather than open.
11810         Set is_descriptor_opened_.
11811         (File_read::open) [memory]: Assert that descriptor is not open.
11812         (File_read::reopen_descriptor): New function.
11813         (File_read::release): Release descriptor.
11814         (File_read::do_read): Make non-const.  Reopen descriptor.
11815         (File_read::read): Make non-const.
11816         (File_read::make_view): Reopen descriptor.
11817         (File_read::do_readv): Likewise.
11818         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11819         Update declarations.
11820         * layout.cc: Include "descriptors.h".
11821         (Layout::create_build_id): Use open_descriptor rather than open.
11822         * output.cc: Include "descriptors.h".
11823         (Output_file::open): Use open_descriptor rather than open.
11824         * archive.cc (Archive::const_iterator): Change Archive to be
11825         non-const.
11826         (Archive::begin, Archive::end): Make non-const.
11827         (Archive::count_members): Likewise.
11828         * archive.h (class Archive): Update declarations.
11829         * object.h (Object::read): Make non-const.
11830         * Makefile.am (CCFILES): Add descriptors.cc.
11831         (HFILES): Add descriptors.h.
11832         * Makefile.in: Rebuild.
11833
11834         PR 6716
11835         * gold.h: Always include <clocale>.  Add Solaris workarounds
11836         following code in binutils/sysdep.h.
11837
11838         PR 6048
11839         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11840         this->eh_frame_hdr_ is NULL before using it.
11841
11842         * dynobj.cc (Versions::Versions): Update comment.
11843
11844         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11845         the base version name.
11846
11847         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11848         array size plus one.
11849         (Stringpool_template::set_string_offsets): Subtract one from key
11850         before using it as an array index.
11851         (Stringpool_template::get_offset_with_length): Likewise.
11852         (Stringpool_template::write_to_buffer): Likewise.
11853         * stringpool.h (Stringpool_template::get_offset_from_key):
11854         Likewise.
11855
11856 2008-07-23  Ian Lance Taylor  <iant@google.com>
11857
11858         PR 6658
11859         * object.h (Merged_symbol_value::value): Do our best to handle a
11860         negative addend.
11861
11862         PR 6647
11863         * script.cc (Version_script_info::get_versions): Don't add empty
11864         version tag to return value.
11865         (Version_script_info::get_symbol_version_helper): Change return
11866         type to bool.  Add pversion parameter.  Change all callers.
11867         (script_register_vers_node): Don't require a non-NULL tag.
11868         * script.h (class Version_script_info): Update declarations.
11869         (Version_script_info::get_symbol_version): Change return type to
11870         bool.  Add version parameter.  Change all callers.
11871         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11872         handling.  Handle an empty version from a version script.
11873         (Symbol_table::define_special_symbol): Likewise.
11874         * testsuite/ver_test_10.script: New file.
11875         * testsuite/ver_test_10.sh: New file.
11876         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11877         (check_DATA): Add ver_test_10.syms.
11878         (ver_test_10.syms, ver_test_10.so): New target.
11879         * testsuite/Makefile.in: Rebuild.
11880
11881 2008-07-23  Simon Baldwin  <simonb@google.com>
11882
11883         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11884         to zero for undefined symbols from dynamic libraries.
11885
11886 2008-07-23  Ian Lance Taylor  <iant@google.com>
11887
11888         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11889         Change all callers.
11890         * symtab.h (class Symbol_table): Update declaration.
11891         * testsuite/ver_test_9.cc: New file.
11892         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11893         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11894         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11895         (ver_test_9.so, ver_test_9.o): New targets.
11896         * testsuite/Makefile.in: Rebuild.
11897
11898 2008-07-22  Ian Lance Taylor  <iant@google.com>
11899
11900         * options.h (class General_options): Define --check-sections.
11901         * layout.cc (Layout::set_segment_offsets): Handle
11902         --check-sections.
11903
11904         * options.h (class General_options): Define -n/--nmagic and
11905         -N/--omagic.
11906         * options.cc (General_options::finalize): For -n/--nmagic or
11907         -N/--omagic, set -static.
11908         * layout.cc (Layout::attach_allocated_section_to_segment): If
11909         -N/--omagic, don't put read-only and read-write sections in
11910         different segments.
11911         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11912         finding a read-only segment.
11913         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11914         don't set the minimum segment alignment to the common page size,
11915         and don't set the file offset to the address modulo the page size.
11916         * script-sections.cc (Script_sections::create_segments): If
11917         -n/--omagic, don't put read-only and read-write sections in
11918         different segments.
11919
11920         * cref.cc: New file.
11921         * cref.h: New file.
11922         * options.h (class General_options): Add --print-symbol-counts.
11923         * main.cc (main): Issue defined symbol report if requested.
11924         * archive.cc (Archive::interpret_header): Make into a const member
11925         function.
11926         (Archive::add_symbols): Call Input_objects::archive_start and
11927         archive_stop.
11928         (Archive::const_iterator): Define new class.
11929         (Archive::begin, Archive::end): New functions.
11930         (Archive::include_all_members): Rewrite to use iterator.
11931         (Archive::count_members): New function.
11932         * archive.h (class Archive): Update declarations.
11933         (Archive::filename): New function.
11934         * object.cc: Include "cref.h".
11935         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11936         (Sized_relobj::do_get_global_symbol_counts): New function.
11937         (Input_objects::add_object): Add object to cross-referencer.
11938         (Input_objects::archive_start): New function.
11939         (Input_objects::archive_stop): New function.
11940         (Input_objects::print_symbol_counts): New function.
11941         * object.h: Declare Cref and Archive.
11942         (Object::get_global_symbol_counts): New function.
11943         (Object::do_get_global_symbol_counts): New pure virtual function.
11944         (class Sized_relobj): Add defined_count_ field.  Update
11945         declarations.
11946         (class Input_objects): Add cref_ field.  Update constructor.
11947         Update declarations.
11948         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11949         defined_count_.
11950         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11951         symbol counts.
11952         (Sized_dynobj::do_get_global_symbol_counts): New function.
11953         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11954         defined_count_.  Update declarations.  Define Symbols typedef.
11955         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11956         parameter.  Change all callers.
11957         (Symbol_table::add_from_dynobj): Add sympointers and defined
11958         parameters.  Change all callers.
11959         * symtab.h (class Symbol_table): Update declarations.
11960         * Makefile.am (CCFILES): Add cref.cc.
11961         (HFILES): Add cref.h.
11962         * Makefile.in: Rebuild.
11963
11964 2008-07-22  Simon Baldwin  <simonb@google.com>
11965
11966         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11967         to zero when writing undefined symbols.
11968
11969 2008-07-22  Ian Lance Taylor  <iant@google.com>
11970
11971         * output.cc (Output_section::add_input_section): Don't try to
11972         merge empty merge sections.
11973
11974 2008-07-21  Craig Silverstein  <csilvers@google.com>
11975
11976         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11977         Include symbol version in error message.
11978
11979 2008-07-20  Chris Demetriou  <cgd@google.com>
11980
11981         * configure.ac (gold_cv_c_random_seed): New configured variable.
11982         (RANDOM_SEED_CFLAGS): New substituted variable.
11983         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11984         * configure: Rebuild.
11985         * Makefile.in: Likewise.
11986         * testsuite/Makefile.in: Likewise.
11987
11988 2008-07-18  Ian Lance Taylor  <iant@google.com>
11989
11990         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11991         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11992         * testsuite/ver_test_main.cc (main): Call t4.
11993         (t4, t4_2a): Define.
11994         * testsuite/ver_test_2.cc (t4_2): Define.
11995         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11996         * testsuite/ver_test_4.cc (t4_2a): Define.
11997         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11998         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11999
12000 2008-07-17  Ian Lance Taylor  <iant@google.com>
12001
12002         * dynobj.cc (Versions::add_def): If we give an error about a
12003         missing version, go ahead and create the version anyhow.
12004
12005 2008-07-10  Ian Lance Taylor  <iant@google.com>
12006
12007         Handle output sections with more than 0x7fffffff bytes.
12008         * object.h (class Relobj): Change map_to_output_ to
12009         output_sections_, and just keep a section pointer.  Change all
12010         uses.  Move comdat group support to Sized_relobj.
12011         (Relobj::is_section_specially_mapped): Remove.
12012         (Relobj::output_section): Remove poff parameter.  Change all
12013         callers.
12014         (Relobj::output_section_offset): New function.
12015         (Relobj::set_section_offset): Rewrite.
12016         (Relobj::map_to_output): Remove.
12017         (Relobj::output_sections): New function.
12018         (Relobj::do_output_section_offset): New pure virtual function.
12019         (Relobj::do_set_section_offset): Likewise.
12020         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12021         group support from Relobj.  Update declarations.
12022         (Sized_relobj::get_output_section_offset): New function.
12023         (Sized_relobj::do_output_section_offset): New function.
12024         (Sized_relobj::do_set_section_offset): New function.
12025         * object.cc (Relobj::output_section_address): Remove.
12026         (Sized_relobj::Sized_relobj): Initialize new fields.
12027         (Sized_relobj::include_section_group): Cast find_kept_object to
12028         Sized_relobj.
12029         (Sized_relobj::include_linkonce_section): Likewise.
12030         (Sized_relobj::do_layout): Use separate arrays for output section
12031         and output offset.
12032         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12033         output_sections.
12034         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12035         output_sections and section_offsets.
12036         (Sized_relobj::write_local_symbols): Likewise.
12037         (map_to_kept_section): Compute output address directly.
12038         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12039         output_sections and section_offsets.
12040         (Sized_relobj::write_sections): Likewise.
12041         (Sized_relobj::relocate_sections): Likewise.
12042         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12043         * output.h (class Output_reloc): Update declarations.  Change
12044         u2_.relobj to Sized_relobj*.
12045         (class Output_data_reloc): Change add functions to use
12046         Sized_relobj*.
12047         * output.cc (Output_reloc::Output_reloc): Change relobj to
12048         Sized_relobj*.
12049         (Output_reloc::local_section_offset): Change return type to
12050         Elf_Addr.  Use get_output_section_offset.
12051         (Output_reloc::get_address): Likewise.
12052         (Output_section::is_input_address_mapped): Don't call
12053         is_section_specially_mapped.
12054         (Output_section::output_offset): Likewise.
12055         (Output_section::output_address): Likewise.
12056         (Output_section::starting_output_address): Likewise.
12057         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12058         parameter to Sized_relobj*.
12059         (Copy_relocs::need_copy_reloc): Likewise.
12060         (Copy_relocs::save): Likewise.
12061         * copy-relocs.h (class Copy_relocs): Update declarations.
12062         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12063         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12064         * target-reloc.h (relocate_for_relocatable): Change
12065         offset_in_output_section type to Elf_Addr.  Change code that uses
12066         it as well.
12067         * layout.cc (Layout::layout): Always set *off.
12068         * mapfile.cc (Mapfile::print_input_section): Use
12069         output_section_offset.
12070         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12071         Sized_relobj*.
12072         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12073         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12074         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12075
12076 2008-07-03  Ian Lance Taylor  <iant@google.com>
12077
12078         * layout.cc (Layout::include_section): Do not discard unrecognized
12079         SHT_STRTAB sections.
12080
12081 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12082
12083         * script.cc (Lex::can_continue_name): Make '?' allowable in
12084         version-script names.
12085         * testsuite/version_script.map: Change glob pattern to use '?'
12086
12087 2008-06-30  Manish Singh  <yosh@gimp.org>
12088
12089         PR 6585
12090         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12091         Correct typo.
12092
12093 2008-06-30  Ian Lance Taylor  <iant@google.com>
12094
12095         PR 6660
12096         PR 6682
12097         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12098         versions]: Don't try to read the value in the contents, since we
12099         don't use it.  Use the template endianness when writing.
12100
12101 2008-06-25  Cary Coutant  <ccoutant@google.com>
12102
12103         * fileread.cc (File_read::make_view): Assert on zero-length view.
12104         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12105         symbol table when there are no symbols to read.
12106
12107 2008-06-23  Craig Silverstein  <csilvers@google.com>
12108
12109         * version.cc (version_string): Bump to 1.7
12110
12111 2008-06-18  Craig Silverstein  <csilvers@google.com>
12112
12113         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12114         constant 0xFFFF to type Valtype.
12115         (Powerpc_relocate_functions::rel16_ha): Likewise.
12116
12117 2008-06-17  Ian Lance Taylor  <iant@google.com>
12118
12119         * output.h (Output_section::Input_section): Initialize p2align_ to
12120         zero for Output_section_data constructors.
12121         (Output_section::Input_section::addralign): If not an input
12122         section, return the alignment of the Output_section_data.
12123         * testsuite/copy_test.cc: New file.
12124         * testsuite/copy_test_1.cc: New file.
12125         * testsuite/copy_test_2.cc: New file.
12126         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12127         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12128         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12129         (copy_test_1_pic.o, copy_test_1.so): New targets.
12130         (copy_test_2_pic.o, copy_test_2.so): New targets.
12131         * testsuite/Makefile.in: Rebuild.
12132
12133         * script-sections.cc (Script_sections::place_orphan): Initialize
12134         local variable exact.
12135
12136 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12137
12138         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12139
12140 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12141             David S. Miller  <davem@davemloft.net>
12142
12143         * powerpc.cc: New file.
12144         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12145         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12146         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12147         * Makefile.in: Rebuild.
12148
12149 2008-06-09  Ian Lance Taylor  <iant@google.com>
12150
12151         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12152         <exception>.
12153         (throwing, orig_terminate): New static variables.
12154         (terminate_handler): New static function.
12155         (t2): Set terminate handler.
12156
12157 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12158
12159         PR 6584
12160         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12161         alignment.
12162
12163 2008-05-30  Cary Coutant  <ccoutant@google.com>
12164
12165         * archive.cc (Archive::include_all_members) Correct to step
12166         over symbol table and extended name table in thin archives.
12167
12168 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12169
12170         PR 6407
12171         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12172         calculation.
12173
12174 2008-05-28  Caleb Howe  <cshowe@google.com>
12175
12176         * reduced_debug_output.cc: New file.
12177         * reduced_debug_output.h: New file.
12178         * options.h (class General_options): Add --strip-debug-non-line.
12179         * options.cc (General_options::finalize): Add strip_debug_non_line
12180         to the strip heirarchy.
12181         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12182         fields.
12183         * layout.cc: Include "reduced_debug_output.h".
12184         (Layout::Layout): Initialize new fields.
12185         (line_only_debug_sections): New static array.
12186         (is_lines_only_debug_sections): New static inline function.
12187         (Layout::include_section): Handle --strip-debug-non-line.
12188         (Layout::make_output_section): If --strip-debug-non-line, build
12189         new output sections for .debug_abbrev and .debug_info.
12190         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12191         gold.  Warn about possible overflow.
12192         (read_signed_LEB_128): Likewise.
12193         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12194         (read_signed_LEB_128): Declare.
12195         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12196         (HFILES): Add reduced_debug_output.h.
12197         * Makefile.in: Rebuild.
12198
12199 2008-05-21  Ian Lance Taylor  <iant@google.com>
12200
12201         * mapfile.cc: New file.
12202         * mapfile.h: New file.
12203         * options.h (class General_options): Add -M/--print-map and -Map.
12204         * options.cc (General_options::finalize): Make -M equivalent to
12205         -Map -.
12206         * main.cc: Include <cstdio> and "mapfile.h".
12207         (main): Open mapfile if requested.
12208         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12209         constructor.  Change caller.
12210         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12211         (queue_middle_tasks): Likewise.
12212         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12213         declarations.
12214         * archive.cc: Include "mapfile.h".
12215         (Archive::add_symbols): Add mapfile parameter.  Change all
12216         callers.  Pass mapfile, symbol, and reason to include_member.
12217         (Archive::include_all_members): Add mapfile parameter.  Change all
12218         callers.
12219         (Archive::include_member): Add mapfile, sym, and why parameters.
12220         Change all callers.  Report inclusion to map file.
12221         * archive.h: Include "fileread.h".
12222         (class Archive): Update declarations.
12223         (Archive::file): New const method.
12224         (class Add_archive_symbols): Add mapfile_ field.  Update
12225         constructor.  Change all callers.
12226         * readsyms.h (class Read_symbols): Likewise.
12227         (class Finish_group): Likewise.
12228         (class Read_script): Likewise.
12229         * common.cc: Include "mapfile.h".
12230         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12231         all callers.
12232         (Symbol_table::do_allocate_commons): Likewise.
12233         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12234         symbol allocation to mapfile.
12235         * common.h (class Allocate_commons_task): Add mapfile_ field.
12236         Update constructor.  Change all callers.
12237         * symtab.h (class Symbol_table): Update declarations.
12238         * layout.cc: Include "mapfile.h".
12239         (Layout_task_runner::run): Print information to mapfile.
12240         (Layout::create_gold_note): Change Output_data_fixed_space to
12241         Output_data_zero_fill.
12242         (Layout::create_build_id): Likewise.
12243         (Layout::print_to_mapfile): New function.
12244         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12245         constructor.  Change caller.
12246         (class Layout): Declare print_to_mapfile.
12247         * output.cc (Output_section::Input_section::print_to_mapfile): New
12248         function.
12249         (Output_section::add_input_section): If producing a map, always
12250         add to input_sections_ list.
12251         (Output_section::do_print_to_mapfile): New function.
12252         (Output_segment::print_sections_to_mapfile): New function.
12253         (Output_segment::print_section_list_to_mapfile): New function.
12254         * output.h: Include "mapfile.h".
12255         (Output_data::print_to_mapfile): New function.
12256         (Output_data::do_print_to_mapfile): New virtual function.
12257         (Output_segment_headers::do_print_to_mapfile): New function.
12258         (Output_file_header::do_print_to_mapfile): New function.
12259         (Output_data_const::do_print_to_mapfile): New function.
12260         (class Output_data_const_buffer): Add map_name_ field.  Update
12261         constructor.  Change all callers.  Add do_print_to_mapfile
12262         function.
12263         (class Output_data_fixed_space): Likewise.
12264         (class Output_data_space): Likewise.
12265         (class Output_data_zero_fill): New class.
12266         (Output_data_strtab::do_print_to_mapfile): New function.
12267         (Output_data_reloc_base::do_print_to_mapfile): New function.
12268         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12269         (Output_data_group::do_print_to_mapfile): New function.
12270         (Output_data_got::do_print_to_mapfile): New function.
12271         (Output_data_dynamic::do_print_to_mapfile): New function.
12272         (Output_symtab_xindex::do_print_to_mapfile): New function.
12273         (class Output_section): Declare do_print_to_mapflie.  Declare
12274         print_to_mapfile in Input_section.
12275         (class Output_segment): Declare new functions.
12276         * object.h (Sized_relobj::symbol_count): New function.
12277         * script-sections.cc
12278         (Output_section_element_dot_assignment::set_section_addresses):
12279         Change Output_data_fixed_space to Output_data_zero_fill.
12280         (Output_data_expression::do_print_to_mapfile): New function.
12281         * script.cc (read_input_script): Add mapfile parameter.  Change
12282         all callers.
12283         * script.h (read_input_script): Update declaration.
12284         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12285         (Eh_frame::do_print_to_mapfile): New function.
12286         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12287         (Output_merge_string::do_print_to_mapfile): New function.
12288         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12289         function.
12290         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12291         function.
12292         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12293         function.
12294         * Makefile.am (CCFILES): Add mapfile.cc.
12295         (HFILES): Add mapfile.h.
12296         * Makefile.in: Rebuild.
12297
12298 2008-05-19  Ian Lance Taylor  <iant@google.com>
12299
12300         * options.h (class General_options): Add -z relro.
12301         * layout.cc (Layout::Layout): Initialize relro_segment_.
12302         (Layout::add_output_section_data): Return the output section.
12303         (Layout::make_output_section): Rcognize relro sections and mark
12304         them appropriately.
12305         (Layout::attach_allocated_section_to_segment): Put relro sections
12306         in a PT_GNU_RELRO segment.
12307         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12308         section as relro.
12309         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12310         PT_TLS segments.
12311         (Layout::linkonce_mapping): Map d.rel.ro.local to
12312         .data.rel.ro.local.
12313         (Layout::output_section_name): Us .data.rel.ro.local for any
12314         section which begins with that.
12315         * layout.h (class Layout): Update add_output_section_data
12316         declaration.  Add relro_segment_ field.
12317         * output.cc (Output_section::Output_section): Initialize is_relro_
12318         and is_relro_local_ fields.
12319         (Output_segment::add_output_section): Group relro sections.
12320         (Output_segment::is_first_section_relro): New function.
12321         (Output_segment::maximum_alignment): If there is a relro section,
12322         align the segment to the common page size.
12323         (Output_segment::set_section_addresses): Track whether we are
12324         looking at relro sections.  If the last section is a relro
12325         section, align to the common page size.
12326         (Output_segment::set_section_list_addresses): Add in_relro
12327         parameter.  Change all callers.  Align to the page size when
12328         moving from relro to non-relro section.
12329         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12330         segment.
12331         * output.h (class Output_section): Add is_relro_ and
12332         is_relro_local_ fields.
12333         (Output_section::is_relro): New function.
12334         (Output_section::set_is_relro): New function.
12335         (Output_section::is_relro_local): New function.
12336         (Output_section::set_is_relro_local): New function.
12337         (class Output_segment): Update declarations.
12338         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12339         * sparc.cc (Target_sparc::got_section): Likewise.
12340         * x86_64.cc (Target_x86_64::got_section): Likewise.
12341         * testsuite/relro_test_main.cc: New file.
12342         * testsuite/relro_test.cc: New file.
12343         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12344         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12345         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12346         (relro_test.so, relro_test_pic.o): New targets.
12347         * testsuite/Makefile.in: Rebuild.
12348
12349 2008-05-16  Ian Lance Taylor  <iant@google.com>
12350
12351         * output.cc (Output_segment::add_output_section): Remove front
12352         parameter.
12353         * output.h (class Output_segment): Remove
12354         add_initial_output_section and overloaded add_output_section.
12355         Update declaration of remaining add_output_section.
12356         * layout.cc (Layout::create_interp): Call add_output_section
12357         rather than add_initial_output_section.
12358         (Layout::finish_dynamic_section): Likewise.
12359
12360         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12361         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12362         know the dynamic type.
12363         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12364         field.  Initialize it in constructor.
12365         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12366         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12367         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12368         reloc.
12369
12370         * output.cc (Output_reloc::get_address): Change return type to
12371         Elf_Addr.
12372         * output.h (class Output_reloc): Update get_address declaration.
12373         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12374         for section addresses.
12375
12376 2008-05-09  Ian Lance Taylor  <iant@google.com>
12377
12378         PR 6493
12379         * gold.cc (gold_nomem): Use return value of write.
12380
12381 2008-05-08  Ian Lance Taylor  <iant@google.com>
12382
12383         * symtab.c (Symbol::init_base_output_data): Add version
12384         parameter.  Change all callers.
12385         (Symbol::init_base_output_segment): Likewise.
12386         (Symbol::init_base_constant): Likewise.
12387         (Symbol::init_base_undefined): Likewise.
12388         (Sized_symbol::init_output_data): Likewise.
12389         (Sized_symbol::init_output_segment): Likewise.
12390         (Sized_symbol::init_constant): Likewise.
12391         (Sized_symbol::init_undefined): Likewise.
12392         (Symbol_table::do_define_in_output_data): If the new symbol has a
12393         version, mark it as the default.
12394         (Symbol_table::do_define_in_output_segment): Likewise.
12395         (Symbol_table::do_define_as_constant): Likewise.
12396         * symtab.h (class Symbol): Update declarations.
12397         (class Sized_symbol): Likewise.
12398         * resolve.cc (Symbol::override_version): New function.
12399         (Symbol::override_base): Call override_version.
12400         (Symbol::override_base_with_special): Likewise.
12401         * testsuite/ver_script_8.script: New file.
12402         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12403         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12404         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12405         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12406
12407 2008-05-06  Ian Lance Taylor  <iant@google.com>
12408
12409         PR 6049
12410         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12411         functions.
12412         (class General_options): Remove existing --undefined, and add
12413         --no-undefined instead.  Add new --undefined as synonym for -u.
12414         * archive.cc (Archive::add_symbols): Check whether symbol was
12415         named with -u.
12416         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12417         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12418         all uses.  Add IS_UNDEFINED.  Update declarations to split
12419         different versions of init_base.  Declare init_base_undefined.
12420         (Symbol::is_defined): Handle IS_UNDEFINED.
12421         (Symbol::is_undefined): Likewise.
12422         (Symbol::is_weak_undefined): Call is_undefined.
12423         (Symbol::is_absolute): Handle IS_CONSTANT.
12424         (class Sized_symbol): Update declarations to split different
12425         versions of init.  Declare init_undefined.
12426         (class Symbol_table): Declare new functions.
12427         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12428         Change all callers.
12429         (Symbol::init_base_output_data): Likewise.
12430         (Symbol::init_base_output_segment): Likewise.
12431         (Symbol::init_base_constant): Likewise.
12432         (Symbol::init_base_undefined): New function.
12433         (Sized_symbol::init_object): Rename from init.  Change all
12434         callers.
12435         (Sized_symbol::init_output_data): Likewise.
12436         (Sized_symbol::init_output_segment): Likewise.
12437         (Sized_symbol::init_constant): Likewise.
12438         (Sized_symbol::init_undefined): New function.
12439         (Symbol_table::add_undefined_symbols_from_command_line): New
12440         function.
12441         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12442         function.
12443         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12444         (Symbol::output_section): Likewise.
12445         (Symbol::set_output_section): Likewise.
12446         (Symbol_table::sized_finalize_symbol): Likewise.
12447         (Symbol_table::sized_write_globals): Likewise.
12448         * resolve.cc (Symbol_table::should_override): Likewise.
12449         (Symbol::override_base_with_special): Likewise.
12450
12451         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12452         symbol, change it to have default visibility.
12453         * testsuite/protected_1.cc: New file.
12454         * testsuite/protected_2.cc: New file.
12455         * testsuite/protected_3.cc: New file.
12456         * testsuite/protected_main_1.cc: New file.
12457         * testsuite/protected_main_2.cc: New file.
12458         * testsuite/protected_main_3.cc: New file.
12459         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12460         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12461         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12462         (protected_1.so): New target.
12463         (protected_1_pic.o, protected_2_pic.o): New targets.
12464         (protected_3_pic.o): New target.
12465         (check_PROGRAMS): Add protected_2.
12466         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12467         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12468         * testsuite/Makefile.in: Rebuild.
12469
12470         * options.h (DEFINE_var): Add set_user_set_##varname__.
12471         (DEFINE_bool_alias): New macro.
12472         (class General_options): Define -Bstatic using DEFINE_bool_alias
12473         rather than DEFINE_special.  Add --undefined as an alias for -z
12474         defs.
12475         * options.cc (General_options::parse_Bstatic): Remove.
12476
12477         * options.h (class General_options): Add --fatal-warnings.
12478         * main.cc (main): Implement --fatal-warnings.
12479         * errors.h (Errors::warning_count): New function.
12480
12481         * options.h (class General_options): Add -Bsymbolic-functions.
12482         * symtab.h (Symbol::is_preemptible): Check for
12483         -Bsymbolic-functions.
12484
12485 2008-05-05  Ian Lance Taylor  <iant@google.com>
12486
12487         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12488         as noVARNAME rather than no-VARNAME.
12489         (class General_options): Add option -z combreloc.
12490         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12491         get_address.
12492         (Output_reloc::sort_before) [SHT_REL]: New function.
12493         (Output_reloc::sort_before) [SHT_RELA]: New function.
12494         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12495         Sort_relocs_comparison.
12496         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12497         parameter.  Change all callers.
12498         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12499         sort_relocs parameter.  Change all callers.
12500         * output.cc (Output_reloc::get_address): New function, broken out
12501         of write_rel.
12502         (Output_reloc::write_rel): Call it.
12503         (Output_reloc::compare): New function.
12504         (Output_data_reloc_base::do_write): Optionally sort relocs.
12505
12506         * configure.ac: If targ_extra_obj is set, link it in.
12507         * configure.tgt: Initialize all variables.
12508         (x86_64*): Set targ_extra_obj and targ_extra_size.
12509         * configure: Rebuild.
12510
12511         * object.cc (Sized_relobj::include_section_group): Adjust section
12512         indexes read from group data.  Build vector to pass to
12513         layout_group.
12514         * layout.cc (Layout::layout_group): Add flags and shndxes
12515         parameters.  Remove contents parameter.  Change caller.  Update
12516         explicit instantiations.
12517         * layout.h (class Layout): Update layout_group declaration.
12518         * output.cc (Output_data_group::Output_data_group): Add flags and
12519         input_shndxes parameters.  Remove contents parameter.  Change
12520         caller.
12521         (Output_data_group::do_write): Change input_sections_ to
12522         input_shndxes_.
12523         * output.h (class Output_data_group): Update constructor
12524         declaration.  Rename input_sections_ to input_shndxes_.
12525         * testsuite/many_sections_test.cc: Add template.
12526
12527 2008-04-30  Cary Coutant  <ccoutant@google.com>
12528
12529         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12530
12531         * layout.cc (Layout::include_section): Refactored check for debug
12532         info section.
12533         (Layout::add_comdat): Add new parameters.  Change type
12534         of signature parameter.  Add object and shndx to signatures table.
12535         (Layout::find_kept_object): New function.
12536         * layout.h: Include <cstring>.
12537         (Layout::is_debug_info_section): New function.
12538         (Layout::add_comdat): Add new parameters.
12539         (Layout::find_kept_object): New function.
12540         (Layout::Kept_section): New struct.
12541         (Layout::Signatures): Change type of map range.
12542         * object.cc (Relobj::output_section_address): New function.
12543         (Sized_relobj::include_section_group): Add new parameters.  Change
12544         calls to Layout::add_comdat.  Change to build table of kept comdat
12545         groups and table mapping discarded sections to kept sections.
12546         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12547         (Sized_relobj::do_layout): Change calls to include_section_group and
12548         include_linkonce_section.
12549         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12550         value to zero when section is discarded.
12551         (Sized_relobj::map_to_kept_section): New function.
12552         * object.h (Relobj::output_section_address): New function.
12553         (Relobj::Comdat_group): New type.
12554         (Relobj::find_comdat_group): New function.
12555         (Relobj::Comdat_group_table): New type.
12556         (Relobj::Kept_comdat_section): New type.
12557         (Relobj::Kept_comdat_section_table): New type.
12558         (Relobj::add_comdat_group): New function.
12559         (Relobj::set_kept_comdat_section): New function.
12560         (Relobj::get_kept_comdat_section): New function.
12561         (Relobj::comdat_groups_): New field.
12562         (Relobj::kept_comdat_sections_): New field.
12563         (Symbol_value::input_value): Update comment.
12564         (Sized_relobj::map_to_kept_section) New function.
12565         (Sized_relobj::include_linkonce_section): Add new parameter.
12566         * target-reloc.h (Comdat_behavior): New type.
12567         (get_comdat_behavior): New function.
12568         (relocate_section): Add code to map a discarded section to the
12569         corresponding kept section when applying a relocation.
12570
12571 2008-04-30  Craig Silverstein  <csilvers@google.com>
12572
12573         * dwarf_reader.cc (next_generation_count): New static var.
12574         (Addr2line_cache_entry): New struct.
12575         (addr2line_cache): New static var.
12576         (Dwarf_line_info::one_addr2line): Added caching.
12577         (Dwarf_line_info::clear_addr2line_cache): New function.
12578         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12579         cache-size parameter.
12580         (Dwarf_line_info::one_addr2line_cache): New function.
12581         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12582         new cache-size argument to one_addr2line(), and clear cache.
12583
12584 2008-04-28  Cary Coutant  <ccoutant@google.com>
12585
12586         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12587         R_386_PC8 relocations.
12588
12589 2008-04-23  Ian Lance Taylor  <iant@google.com>
12590
12591         * object.cc (Sized_relobj::include_section_group): Check for
12592         invalid section group.
12593
12594         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12595         header size.
12596
12597         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12598         than read for file header.
12599         * archive.cc (Archive::include_member): Likewise.
12600
12601 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12602
12603         * aclocal.m4: Regenerate.
12604         * configure: Regenerate.
12605
12606 2008-04-19  Ian Lance Taylor  <iant@google.com>
12607
12608         * version.cc (version_string): Bump to 1.6.
12609
12610         * testsuite/Makefile.am (many_sections_r_test): New target.
12611         (many_sections_r_test_SOURCES): Remove.
12612         (many_sections_r_test_DEPENDENCIES): Remove.
12613         (many_sections_r_test_LDFLAGS): Remove.
12614         (many_sections_r_test_LDADD): Remove.
12615
12616         * object.cc (Sized_relobj::do_add_symbols): Always pass
12617         local_symbol_count_ to add_from_relobj.
12618
12619         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12620         every thousand variables.
12621         * testsuite/Makefile.in: Rebuild.
12622
12623         * object.cc (Xindex::initialize_symtab_xindex): New function.
12624         (Xindex::read_symtab_xindex): New function.
12625         (Xindex::sym_xindex_to_shndx): New function.
12626         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12627         available.
12628         (Sized_relobj::do_initialize_xindex): New function.
12629         (Sized_relobj::do_read_symbols): Adjust section links.
12630         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12631         parameter.  Change all callers.
12632         (Sized_relobj::include_section_group): Adjust section links and
12633         symbol section indexes.
12634         (Sized_relobj::do_layout): Adjust section links.
12635         (Sized_relobj::do_count_local_symbols): Adjust section links and
12636         symbol section indexes.
12637         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12638         ordinary and special symbols.
12639         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12640         dynsym_xindex parameters.  Change all callers.  Adjust section
12641         links.  Use SHN_XINDEX when needed.
12642         (Sized_relobj::get_symbol_location_info): Adjust section links.
12643         Don't get fooled by special symbols.
12644         * object.h (class Xindex): Define.
12645         (class Object): Add xindex_ parameter.  Declare virtual functoin
12646         do_initialize_xindex.
12647         (Object::adjust_sym_shndx): New function.
12648         (Object::set_xindex): New protected function.
12649         (class Symbol_value): Add is_ordinary_shndx_ field.
12650         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12651         (Symbol_value::value): Assert ordinary section.
12652         (Symbol_value::initialize_input_to_output_map): Likewise.
12653         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12654         Change all callers.
12655         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12656         all callers.
12657         (class Sized_relobj): Update declarations.
12658         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12659         parameter.  Change all callers.
12660         (Sized_relobj::adjust_shndx): New function.
12661         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12662         field.
12663         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12664         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12665         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12666         (Sized_dynobj::read_dynsym_section): Adjust section links.
12667         (Sized_dynobj::read_dynamic): Likewise.
12668         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12669         section links.
12670         (Sized_dynobj::do_initialize_xindex): New function.
12671         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12672         do_initialize_xindex.
12673         (Sized_dynobj::adjust_shndx): New function.
12674         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12675         dynsym_xindex_ fields.
12676         (Layout::finalize): Add a call to set_section_indexes before
12677         creating the symtab sections.
12678         (Layout::set_section_indexes): Don't do anything if the section
12679         already has a section index.
12680         (Layout::create_symtab_sections): Add shnum parameter.  Change
12681         caller.  Create .symtab_shndx section if needed.
12682         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12683         caller.
12684         (Layout::allocated_output_section_count): New function.
12685         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12686         needed.
12687         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12688         fields.  Update declarations.
12689         (Layout::symtab_xindex): New function.
12690         (Layout::dynsym_xindex): New function.
12691         (class Write_symbols_task): Add layout_ field.
12692         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12693         Change caller.
12694         * output.cc (Output_section_headers::Output_section_headers): Add
12695         shstrtab_section parameter.  Change all callers.
12696         (Output_section_headers::do_sized_write): Store overflow values
12697         for section count and section string table section index in
12698         section header zero.
12699         (Output_file_header::do_sized_write): Check for overflow of
12700         section count and section string table section index.
12701         (Output_symtab_xindex::do_write): New function.
12702         (Output_symtab_xindex::endian_do_write): New function.
12703         * output.h (class Output_section_headers): Add shstrtab_section_.
12704         Update declarations.
12705         (class Output_symtab_xindex): Define.
12706         (Output_section::has_out_shndx): New function.
12707         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12708         field.
12709         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12710         Change all callers.
12711         (Sized_symbol::init): Likewise.
12712         (Symbol::output_section): Check for ordinary symbol.
12713         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12714         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12715         callers.
12716         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12717         Change all callers.  Simplify handling of symbols from sections
12718         not included in the link.
12719         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12720         distinction.
12721         (Weak_alias_sorter::operator()): Assert that symbols are
12722         ordinary.
12723         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12724         distinction.
12725         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12726         parameters.  Change all callers.
12727         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12728         symbol distinction.  Use SHN_XINDEX when needed.
12729         (Symbol_table::write_section_symbol): Add symtab_xindex
12730         parameter.  Change all callers.
12731         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12732         SHN_XINDEX when needed.
12733         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12734         declarations.
12735         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12736         (Symbol::is_defined): Check is_ordinary.
12737         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12738         (Symbol::is_absolute, Symbol::is_common): Likewise.
12739         (class Sized_symbol): Update declarations.
12740         (class Symbol_table): Update declarations.
12741         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12742         parameters.  Change all callers.
12743         (Sized_symbol::override): Likewise.
12744         (Symbol_table::override): Likewise.
12745         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12746         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12747         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12748         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12749         to be in an ordinary section.
12750         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12751         object and is_ordinary parameters.  Change all callers.
12752         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12753         Change all callers.  Don't add undefined or non-ordinary symbols
12754         to reloc_map_.
12755         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12756         Change all callers.
12757         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12758         declarations.
12759         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12760         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12761         (Sized_relobj::relocate_sections): Likewise.
12762         * target-reloc.h (scan_relocs): Adjust section symbol index.
12763         (scan_relocatable_relocs): Likewise.
12764         * i386.cc (Scan::local): Check for ordinary symbols.
12765         * sparc.cc (Scan::local): Likewise.
12766         * x86_64.cc (Scan::local): Likewise.
12767         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12768         to symbol_section_and_value.
12769         * testsuite/many_sections_test.cc: New file.
12770         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12771         (check_PROGRAMS): Add many_sections_test.
12772         (many_sections_test_SOURCES): Define.
12773         (many_sections_test_DEPENDENCIES): Define.
12774         (many_sections_test_LDFLAGS): Define.
12775         (BUILT_SOURCES): Add many_sections_define.h.
12776         (many_sections_define.h): New target.
12777         (BUILT_SOURCES): Add many_sections_check.h.
12778         (many_sections_check.h): New target.
12779         (check_PROGRAMS): Add many_sections_r_test.
12780         (many_sections_r_test_SOURCES): Define.
12781         (many_sections_r_test_DEPENDENCIES): Define.
12782         (many_sections_r_test_LDFLAGS): Define.
12783         (many_sections_r_test_LDADD): Define.
12784         (many_sections_r_test.o): New target.
12785         * testsuite/Makefile.in: Rebuild.
12786
12787 2008-04-17  Cary Coutant  <ccoutant@google.com>
12788
12789         * errors.cc (Errors::info): New function.
12790         (gold_info): New function.
12791         * errors.h (Errors::info): New function.
12792         * gold.h (gold_info): New function.
12793         * object.cc (Input_objects::add_object): Print trace output.
12794         * options.cc (options::parse_set): New function.
12795         (General_options::parse_wrap): Deleted.
12796         (General_options::General_options): Deleted initializer.
12797         * options.h (options::String_set): New typedef.
12798         (options::parse_set): New function.
12799         (DEFINE_set): New macro.
12800         (General_options::wrap): Changed to use DEFINE_set. Changed
12801         callers of any_wrap_symbols and is_wrap_symbol.
12802         (General_options::trace, General_options::trace_symbol):
12803         New options.
12804         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12805         (General_options::wrap_symbols_): Deleted.
12806         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12807
12808 2008-04-17  David S. Miller  <davem@davemloft.net>
12809
12810         * options.cc (General_options::parse_V): New function.
12811         * options.h: Add entries for -V and -Qy.
12812
12813 2008-04-17  Ian Lance Taylor  <iant@google.com>
12814
12815         * common.cc (Symbol_table::allocate_commons): Remove options
12816         parameter.  Change caller.
12817         (Symbol_table::do_allocate_commons): Remove options parameter.
12818         Change caller.  Just call do_allocate_commons_list twice.
12819         (Symbol_table::do_allocate_commons_list): New function, broken out
12820         of do_allocate_commons.
12821         * common.h (class Allocate_commons_task): Remove options_ field.
12822         Update constructor.
12823         * symtab.cc (Symbol_table::Symbol_table): Initialize
12824         tls_commons_.
12825         (Symbol_table::add_from_object): Put TLS common symbols on
12826         tls_commons_ list.
12827         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12828         which are IN_OUTPUT_DATA.
12829         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12830         allocate_commons and do_allocate_commons declarations.  Declare
12831         do_allocate_commons_list.
12832         * gold.cc (queue_middle_tasks): Update creation of
12833         Allocate_commons_task to not pass options.
12834         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12835         (TLS_TEST_C_FLAGS): New variable.
12836         (tls_test_c_pic.o): New target.
12837         (tls_test_shared.so): Link in tls_test_c_pic.o.
12838         (tls_test_c_pic_ie.o): New target.
12839         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12840         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12841         (tls_test_c.o): New target.
12842         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12843         (tls_pic_test_LDADD): Likewise.
12844         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12845         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12846         (tls_test_c_gnu2.o): New target.
12847         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12848         tls_test_c_gnu2.o.
12849         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12850         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12851         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12852         * testsuite/tls_test.cc: Include "config.h".
12853         (t_last): Call t11_last.
12854         * testsuite/tls_test.h (t11, t11_last): Declare.
12855         * testsuite/tls_test_c.c: New file.
12856         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12857         * configure.ac: Check for OpenMP support.
12858         * configure, config.in, Makefile.in: Rebuild.
12859         * testsuite/Makefile.in: Rebuild.
12860
12861 2008-04-16  Cary Coutant  <ccoutant@google.com>
12862
12863         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12864         (Target_i386::tls_base_symbol_defined_): New field.
12865         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12866         (Target_i386::Scan::global): Likewise.
12867         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12868         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12869         (Target_x86_64::tls_base_symbol_defined_): New field.
12870         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12871         (Target_x86_64::Scan::global): Likewise.
12872
12873 2008-04-16  Cary Coutant  <ccoutant@google.com>
12874
12875         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12876         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12877         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12878         building shared libraries.
12879         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12880         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12881         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12882         * testsuite/Makefile.in: Rebuild.
12883         * testsuite/weak_undef.h: New file.
12884         * testsuite/weak_undef_file1.cc: Add extra test cases.
12885         * testsuite/weak_undef_file2.cc: Likewise.
12886         * testsuite/weak_undef_test.cc: Likewise.
12887
12888 2008-04-16  David S. Miller  <davem@davemloft.net>
12889
12890         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12891         Add issued_non_pic_error_ field.  Declare check_non_pic.
12892         (Target_sparc::Scan::check_non_pic): New function.
12893         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12894         (Target_sparc::Scan::global): Likewise.
12895
12896         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12897         * configure: Rebuild.
12898
12899         * options.h (DEFINE_enable): New macro.
12900         (new_dtags): New enable option.
12901         (initfirst, interpose, loadfltr, nodefaultlib,
12902         nodelete, nodlopen, nodump): New -z options.
12903         * layout.cc (Layout:finish_dynamic_section): If new
12904         dtags enabled, emit DT_RUNPATH.  Also, emit a
12905         DT_FLAGS_1 containing any specified -z flags.
12906
12907 2008-04-16  Ian Lance Taylor  <iant@google.com>
12908
12909         * copy-relocs.cc: New file.
12910         * copy-relocs.h: New file.
12911         * reloc.cc: Remove Copy_relocs code.
12912         * reloc.h: Likewise.
12913         * reloc-types.h (struct Reloc_types) [both versions]: Add
12914         get_reloc_addend_noerror.
12915         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12916         variants of add_global which take an addend which must be zero.
12917         * i386.cc: Include "copy-relocs.h".
12918         (class Target_i386): Change type of copy_relocs_ to variable,
12919         update initializer.
12920         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12921         Change all callers.
12922         (Target_i386::do_finalize_sections): Change handling of
12923         copy_relocs_.
12924         * sparc.cc: Include "copy-relocs.h".
12925         (class Target_sparc): Change type of copy_relocs_ to variable,
12926         update initializer.
12927         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12928         Change all callers.
12929         (Target_sparc::do_finalize_sections): Change handling of
12930         copy_relocs_.
12931         * x86_64.cc: Include "copy-relocs.h".
12932         (class Target_x86_64): Change type of copy_relocs_ to variable,
12933         update initializer.
12934         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12935         class.  Change all callers.
12936         (Target_x86_64::do_finalize_sections): Change handling of
12937         copy_relocs_.
12938         * Makefile.am (CCFILES): Add copy-relocs.cc.
12939         (HFILES): Add copy-relocs.h.
12940
12941         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12942
12943         * testsuite/script_test_4.sh: Permit leading zeroes.
12944
12945 2008-04-15  Ian Lance Taylor  <iant@google.com>
12946
12947         * script-sections.cc (Script_sections::create_segments): Use
12948         header_size_adjustment even when there is enough room for the
12949         headers.
12950         * testsuite/script_test_4.sh: New file.
12951         * testsuite/script_test_4.t: New file.
12952         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12953         (check_DATA): Add script_test_4.stdout.
12954         (MOSTLYCLEANFILES): Likewise.
12955         (script_test_4): New target.
12956         (script_test_4.stdout): New target.
12957         * testsuite/Makefile.in: Rebuild.
12958
12959         * sparc.cc: Add definitions for Output_data_plt_sparc class
12960         constants.
12961
12962 2008-04-14  David S. Miller  <davem@davemloft.net>
12963
12964         * sparc.cc: New file.
12965         * Makefile.am (TARGETSOURCES): Add sparc.cc
12966         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12967         * configure.tgt: Document targ_extra_size and
12968         targ_extra_big_endian.  Add entries for sparc-* and
12969         sparc64-*.
12970         * configure.ac: Handle targ_extra_size and
12971         targ_extra_big_endian.
12972         * Makefile.in: Rebuild.
12973         * configure: Likewise.
12974         * po/POTFILES.in: Likewise.
12975         * po/gold.pot: Likewise.
12976
12977 2008-04-14  Ian Lance Taylor  <iant@google.com>
12978
12979         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12980         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12981         in the name/type/flags to section mapping.  Don't call
12982         allocate_output_section.
12983         (Layout::choose_output_section): Change parameter from adjust_name
12984         to is_input_section.  Don't permit input sections after sections
12985         are attached to segments.  Don't call allocate_output_section.
12986         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12987         not write_enable_output_section.
12988         (Layout::make_output_section): Don't push to
12989         unattached_section_list_ nor call attach_to_segment.  Call
12990         attach_section_to_segment if sections are attached.
12991         (Layout::attach_sections_to_segments): New function.
12992         (Layout::attach_section_to_segment): New function.
12993         (Layout::attach_allocated_section_to_segment): Rename from
12994         attach_to_segment.  Remove flags parameter.
12995         (Layout::allocate_output_section): Remove function.
12996         (Layout::write_enable_output_section): Remove function.
12997         * layout.h (class Layout): Update for above changes.  Add new
12998         field sections_are_attached_.
12999         * output.h (Output_section::update_flags_for_input_section): New
13000         function.
13001         * output.cc (Output_section::add_input_section): Call
13002         update_flags_for_input_section.
13003         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13004
13005 2008-04-11  Cary Coutant  <ccoutant@google.com>
13006
13007         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13008         thought unnecessary.
13009         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13010
13011 2008-04-11  Ian Lance Taylor  <iant@google.com>
13012
13013         * output.h (class Output_section_data): Remove inline definition
13014         of set_addralign.
13015         * output.cc (Output_section_data::set_addralign): New function.
13016
13017 2008-04-11  Cary Coutant  <ccoutant@google.com>
13018
13019         Add support for TLS descriptors for i386 and x86_64.
13020         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13021         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13022         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13023         GOT_TYPE_TLS_DESC.
13024         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13025         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13026         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13027         relocations.
13028         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13029         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13030         Fix problem with initial-exec relocations.
13031         (Target_i386::Relocate::relocate_tls): Likewise.
13032         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13033         relaxation.
13034         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13035         support for section-plus-offset dynamic table entries.
13036         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13037         (Output_data_dynamic::Dynamic_entry): Add support for
13038         section-plus-offset dynamic table entries.
13039         (Output_data_dynamic::Classification): Likewise.
13040         (Output_data_dynamic::classification_): Renamed offset_.
13041         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13042         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13043         (Target_x86_64::make_plt_section): New function.
13044         (Target_x86_64::reserve_tlsdesc_entries): New function.
13045         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13046         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13047         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13048         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13049         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13050         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13051         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13052         add extra PLT entry for TLS descriptors.
13053         (Output_data_plt_x86_64::got_): New field.
13054         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13055         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13056         fields.
13057         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13058         descriptors.
13059         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13060         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13061         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13062         R_386_TLS_DESC_CALL relocations.
13063         (Target_x86_64::Scan::global): Likewise.
13064         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13065         for TLS descriptors.
13066         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13067         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13068         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13069         GD-to-IE relaxation.
13070         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13071         and TLS_DESCRIPTORS.
13072         * Makefile.in: Rebuild.
13073         * configure: Rebuild.
13074         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13075         (tls_test_shared2.so): New target.
13076         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13077         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13078         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13079         (tls_shared_gd_to_ie_test_LDADD): New variable.
13080         (tls_shared_gnu2_gd_to_ie_test): New target.
13081         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13082         New targets.
13083         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13084         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13085         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13086         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13087         (tls_shared_gnu2_test): New target.
13088         (tls_test_gnu2_shared.so): New target.
13089         (tls_shared_gnu2_test_SOURCES): New variable.
13090         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13091         (tls_shared_gnu2_test_LDFLAGS): New variable.
13092         (tls_shared_gnu2_test_LDADD): New variable.
13093         * testsuite/Makefile.in: Rebuild.
13094         * testsuite/Makefile.
13095
13096 2008-04-11  Ian Lance Taylor  <iant@google.com>
13097
13098         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13099         justsyms.t.
13100         * testsuite/Makefile.in: Rebuild.
13101
13102         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13103         long.
13104         * testsuite/script_test_2.cc (main): Adjust test.
13105
13106 2008-04-11  David S. Miller  <davem@davemloft.net>
13107             Ian Lance Taylor  <iant@google.com>
13108
13109         * options.h (General_options): Add entries for '-Y' and
13110         '-relax'.
13111         * options.cc (General_options:finalize): If -Y was used, add those
13112         entries to the library path instead of the default "/lib" and
13113         "/usr/lib".
13114
13115 2008-04-11  David S. Miller  <davem@davemloft.net>
13116
13117         * testsuite/justsyms.t: Start at 0x100.
13118         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13119         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13120         long.
13121         * testsuite/script_test_2.cc: Adjust string and section length
13122         checks.
13123
13124 2008-04-09  Ian Lance Taylor  <iant@google.com>
13125
13126         PR gold/5996
13127         * script-sections.cc (Sections_element::allocate_to_segment): Add
13128         orphan parameter.
13129         (Output_section_definition::allocate_to_segment): Likewise.
13130         (Orphan_output_section::allocate_to_segment): Likewise.
13131         (Script_sections::attach_sections_using_phdrs_clause): Don't
13132         propagate non-PT_LOAD segments to orphan sections.
13133         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13134         readelf rather than objdump.
13135         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13136         .interp section and PT_INTERP segment are the same size.
13137         * testsuite/Makefile.in: Rebuild.
13138
13139         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13140         aliases for symbols defined in the same object.
13141         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13142         (weak_alias_test_SOURCES): New variable.
13143         (weak_alias_test_DEPENDENCIES): New variable.
13144         (weak_alias_test_LDFLAGS): New variable.
13145         (weak_alias_test_LDADD): New variable.
13146         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13147         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13148         (weak_alias_test_3.o): New target.
13149         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13150         * testsuite/weak_alias_test_main.cc: New file.
13151         * testsuite/weak_alias_test_1.cc: New file.
13152         * testsuite/weak_alias_test_2.cc: New file.
13153         * testsuite/weak_alias_test_3.cc: New file.
13154
13155 2008-04-08  Ian Lance Taylor  <iant@google.com>
13156
13157         * options.h (class General_options): Add --noinhibit-exec option.
13158         * main.cc (main): Check --noinhibit-exec.
13159
13160         * options.h (class General_options): Define --wrap as a special
13161         option.  Add wrap_symbols_ field.
13162         (General_options::any_wrap_symbols): New function.
13163         (General_options::is_wrap_symbol): New function.
13164         * options.cc (General_options::parse_wrap): New function.
13165         (General_options::General_options): Initialize wrap_symbols_.
13166         * symtab.cc (Symbol_table::wrap_symbol): New function.
13167         (Symbol_table::add_from_object): Handle --wrap.
13168         * symtab.h (class Symbol_table): Declare wrap_symbol.
13169         * target.h (Target::wrap_char): New function.
13170         (Target::Target_info): Add wrap_char field.
13171         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13172         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13173         * testsuite/testfile.cc (Target_test::test_target_info):
13174         Likewise.
13175
13176         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13177         there is one.
13178
13179         * layout.h (class Layout): Add added_eh_frame_data_ field.
13180         * layout.cc (Layout::Layout): Initialize new field.
13181         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13182         output section until we find a section we merged successfully.
13183         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13184         that the size be non-zero.
13185
13186         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13187         qualifier.
13188
13189 2008-04-08  Craig Silverstein  <csilvers@google.com>
13190
13191         * configure.ac: Export new conditional variable HAVE_ZLIB.
13192         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13193         on HAVE_ZLIB.
13194         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13195         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13196
13197 2008-04-07  Ian Lance Taylor  <iant@google.com>
13198
13199         * version.cc (version_string): Set to "1.5".
13200
13201         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13202         Add issued_non_pic_error_ field.  Declare check_non_pic.
13203         (Target_x86_64::Scan::check_non_pic): New function.
13204         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13205         (Target_x86_64::Scan::global): Likewise.
13206
13207         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13208         addend parameter.  Change caller.  Handle merge sections.
13209         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13210         Address to Addend.  Don't add in the result of
13211         local_section_offset, pass down the addend and use the returned
13212         value.
13213         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13214         Update declarations of local_section_offset and symbol_value.
13215         * testsuite/two_file_test_1.cc (t18): New function.
13216         * testsuite/two_file_test_2.cc (f18): New function.
13217         * testsuite/two_file_test_main.cc (main): Call t18.
13218         * testsuite/two_file_test.h (t18, f18): Declare.
13219
13220         * configure.ac: Don't test for objdump, c++filt, or readelf.
13221         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13222         conditionals.
13223         (TEST_READELF): New variable.
13224         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13225         (check_PROGRAMS): Add two_file_strip_test.
13226         (two_file_strip_test): New target.
13227         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13228         (two_file_same_shared_strip_test_SOURCES): New variable.
13229         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13230         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13231         (two_file_same_shared_strip_test_LDADD): New variable.
13232         (two_file_shared_strip.so): New target.
13233         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13234         (ver_test_5.syms, ver_test_7.syms): Likewise.
13235         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13236         (strip_test_3.stdout): Use TEST_OBJDUMP.
13237         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13238
13239 2008-04-04  Cary Coutant  <ccoutant@google.com>
13240
13241         * symtab.h (Symbol::is_weak_undefined): New function.
13242         (Symbol::is_strong_undefined): New function.
13243         (Symbol::is_absolute): New function.
13244         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13245         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13246         absolute symbols.
13247         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13248         (weak_undef_test): New target.
13249         * testsuite/Makefile.in: Rebuild.
13250         * testsuite/weak_undef_file1.cc: New file.
13251         * testsuite/weak_undef_file2.cc: New file.
13252         * testsuite/weak_undef_test.cc: New file.
13253
13254 2008-04-03  Craig Silverstein  <csilvers@google.com>
13255
13256         * compressed_output.h (class Output_compressed_section): Use
13257         unsigned buffer.
13258         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13259         add zlib header.
13260         (zlib_compressed_suffix): Removed.
13261         (Output_compressed_section::set_final_data_size): Use unsigned
13262         buffers.
13263         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13264         Fix linker invocation.
13265         (flagstest_o_specialfile_and_compress_debug_sections):
13266         Likewise.
13267         * testsuite/Makefile.in: Regenerated.
13268
13269 2008-04-02  David S. Miller  <davem@davemloft.net>
13270
13271         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13272         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13273
13274 2008-04-02  Craig Silverstein  <csilvers@google.com>
13275
13276         * TODO: New file.
13277
13278 2008-04-02  Ian Lance Taylor  <iant@google.com>
13279
13280         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13281         parameters.  Update for new key type to views_.  Change all
13282         callers.
13283         (File_read::read): Adjust for byteshift in returned view.
13284         (File_read::add_view): New function, broken out of
13285         find_and_make_view.
13286         (File_read::make_view): New function, broken out of
13287         find_and_make_view.
13288         (File_read::find_or_make_view): Add offset and aligned
13289         parameters.  Rewrite accordingly.  Change all callers.
13290         (File_read::get_view): Add offset and aligned parameters.  Adjust
13291         for byteshift in return value.
13292         (File_read::get_lasting_view): Likewise.
13293         * fileread.h (class File_read): Update declarations.
13294         (class File_read::View): Add byteshift_ field.  Add byteshift to
13295         constructor.  Add byteshift method.
13296         * archive.h (Archive::clear_uncached_views): New function.
13297         (Archive::get_view): Add aligned parameter.  Change all callers.
13298         * object.h (Object::get_view): Add aligned parameter.  Change all
13299         callers.
13300         (Object::get_lasting_view): Likewise.
13301
13302         * fileread.cc (File_read::release): Don't call clear_views if
13303         there are multiple objects.
13304         * fileread.h (File_read::clear_uncached_views): New function.
13305         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13306         on the archive.
13307
13308 2008-03-31  Cary Coutant  <ccoutant@google.com>
13309
13310         Add thin archive support.
13311         * archive.cc (Archive::armagt): New const.
13312         (Archive::setup): Remove task parameter and calls to unlock.
13313         (Archive::unlock_nested_archives): New function.
13314         (Archive::read_header): Add nested_off parameter. Change
13315         all callers.
13316         (Archive::interpret_header): Likewise.
13317         (Archive::include_all_members): Change to handle thin
13318         archives.
13319         (Archive::include_member): Likewise.
13320         * archive.h (Archive::Archive): Add new parameters and
13321         initializers.
13322         (Archive::armagt): New const.
13323         (Archive::setup): Remove task parameter.
13324         (Archive::unlock_nested_archives): New function.
13325         (Archive::read_header): Add nested_off parameter.
13326         (Archive::interpret_header): Likewise.
13327         (Archive::Nested_archive_table): New typedef.
13328         (Archive::is_thin_archive_): New field.
13329         (Archive::nested_archives_): New field.
13330         (Archive::options_): New field.
13331         (Archive::dirpath_): New field.
13332         (Archive::task_): New field.
13333         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13334         for thin archives.  Pass additional parameters to
13335         Archive::Archive.  Unlock the archive file after calling
13336         Archive::setup.
13337
13338 2008-03-29  Ian Lance Taylor  <iant@google.com>
13339
13340         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13341         version symbol to be local.
13342         * testsuite/ver_test_4.sh: New file.
13343         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13344         (check_DATA): Add ver_test_4.syms.
13345         (ver_test_4.syms): New target.
13346         * testsuite/Makefile.in: Rebuild.
13347
13348         * output.cc
13349         (Output_section::Input_section_sort_entry::has_priority): New
13350         function.
13351         (Output_section::Input_section_sort_entry::match_file_name): New
13352         function.
13353         (Output_section::Input_section_sort_entry::match_section_name):
13354         Remove.
13355         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13356         Remove.
13357         (Output_section::Input_section_sort_entry::match_section_file):
13358         Remove.
13359         (Output_section::Input_section_sort_compare::operator()): Rewrite
13360         using new Input_section_sort_entry functions.  Sort crtbegin and
13361         crtend first.  Sort sections with no priority before sections with
13362         a priority.
13363         * testsuite/initpri1.c (d3): Check j != 4.
13364         (cd5): New constructor/destructor function.
13365         (main): Check j != 2.
13366
13367         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13368         new symbol when resolving, don't call set_is_default.
13369         * testsuite/ver_test_7.cc: New file.
13370         * testsuite/ver_test_7.sh: New file.
13371         * testsuite/Makefile.am (ver_test_7.so): New target.
13372         (ver_test_7.o): New target.
13373         (check_SCRIPTS): Add ver_test_7.sh.
13374         (check_DATA): Add ver_test_7.syms.
13375         (ver_test_7.syms): New target.
13376
13377 2008-03-28  Ian Lance Taylor  <iant@google.com>
13378
13379         * layout.cc (Layout::layout): If we see an input section with a
13380         name that needs sorting, set the must_sort flag for the output
13381         section.
13382         (Layout::make_output_section): If the name of the output section
13383         indicates that it might require sorting, set the may_sort flag.
13384         * output.h (Output_section::may_sort_attached_input_sections): New
13385         function.
13386         (Output_section::set_may_sort_attached_input_sections): New
13387         function.
13388         (Output_section::must_sort_attached_input_sections): New
13389         function.
13390         (Output_section::set_must_sort_attached_input_sections): New
13391         function.
13392         (class Output_section): Declare Input_section_sort_entry.  Define
13393         Input_section_sort_compare.  Declare
13394         sort_attached_input_sections.  Add new fields:
13395         may_sort_attached_input_sections_,
13396         must_sort_attached_input_sections_,
13397         attached_input_sections_are_sorted_.
13398         * output.cc (Output_section::Output_section): Initialize new
13399         fields.
13400         (Output_section::add_input_section): Add an entry to
13401         input_sections_ if may_sort or must_sort are true.
13402         (Output_section::set_final_data_size): Call
13403         sort_attached_input_sections if necessary.
13404         (Output_section::Input_section_sort_entry): Define new class.
13405         (Output_section::Input_section_sort_compare::operator()): New
13406         function.
13407         (Output_section::sort_attached_input_sections): New function.
13408         * configure.ac: Check whether the compiler supports constructor
13409         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13410         * testsuite/initpri1.c: New file.
13411         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13412         CONSTRUCTOR_PRIORITY.
13413         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13414         (initpri1_LDFLAGS): New variable.
13415         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13416
13417 2008-03-27  Ian Lance Taylor  <iant@google.com>
13418
13419         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13420         * testsuite/common_test_1.c: New file.
13421         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13422         (common_test_1_SOURCES): New variable.
13423         (common_test_1_DEPENDENCIES): New variable.
13424         (common_test_1_LDFLAGS): New variable.
13425
13426         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13427         and commons_ correctly when NAME/VERSION does not override
13428         NAME/NULL.
13429         * testsuite/ver_test_6.c: New file.
13430         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13431         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13432         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13433
13434 2008-03-26  Ian Lance Taylor  <iant@google.com>
13435
13436         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13437         of an undefined symbol from a version script.
13438         * testsuite/Makefile.am (ver_test_5.so): New target.
13439         (ver_test_5.o): New target.
13440         (check_SCRIPTS): Add ver_test_5.sh.
13441         (check_DATA): Add ver_test_5.syms.
13442         (ver_test_5.syms): New target.
13443         * testsuite/ver_test_5.cc: New file.
13444         * testsuite/ver_test_5.script: New file.
13445         * testsuite/ver_test_5.sh: New file.
13446         * Makefile.in, testsuite/Makefile.in: Rebuild.
13447
13448         PR gold/5986
13449         Fix problems building gold with gcc 4.3.0.
13450         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13451         (gold_error_at_location, gold_warning_at_location): Use it.
13452         * configure.ac: Check whether we can compile and use a template
13453         function with a printf attribute.
13454         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13455         when jumping over bytes.
13456         * object.cc: Instantiate Object::read_section_data.
13457         * debug.h: Include <cstring>
13458         * dwarf_reader.cc: Include <algorithm>
13459         * main.cc: Include <cstring>.
13460         * options.cc: Include <cstring>.
13461         * output.cc: Include <cstring>.
13462         * script.cc: Include <cstring>.
13463         * script.h: Include <string>.
13464         * symtab.cc: Include <cstring> and <algorithm>.
13465         * target-select.cc: Include <cstring>.
13466         * version.cc: Include <string>.
13467         * testsuite/testmain.cc: Include <cstdlib>.
13468         * configure, config.in: Rebuild.
13469
13470 2008-03-25  Ian Lance Taylor  <iant@google.com>
13471
13472         * options.cc: Include "../bfd/bfdver.h".
13473         (options::help): Print bug reporting address.
13474
13475         * version.cc (print_version): Adjust output for current value of
13476         BFD_VERSION_STRING.
13477
13478         * NEWS: New file.
13479
13480         * options.cc (options::help): Print list of supported targets.
13481         * target-select.h: Include <vector>.
13482         (class Target_selector): Make machine_, size_, and is_big_endian_
13483         fields const.  Add bfd_name_ and instantiated_target_ fields.
13484         (Target_selector::Target_selector): Add bfd_name parameter.
13485         (Target_selector::recognize): Make non-virtual, call
13486         do_recognize.
13487         (Target_selector::recognize_by_name): Make non-virtual, call
13488         do_recognize_by_name.
13489         (Target_selector::supported_names): New function.
13490         (Target_selector::bfd_name): New function.
13491         (Target_selector::do_instantiate_target): New pure virtual
13492         function.
13493         (Target_selector::do_recognize): New virtual function.
13494         (Target_selector::do_recognize_by_name): New virtual function.
13495         (Target_selector::instantiate_target): New private function.
13496         (supported_target_names): Declare.
13497         * target-select.cc (Target_selector::Target_selector): Update for
13498         new parameter and fields.
13499         (select_target_by_name): Check that the name matches before
13500         calling recognize_by_name.
13501         (supported_target_names): New function.
13502         * i386.cc (class Target_selector_i386): Update Target_selector
13503         constructor call.  Remove recognize and recognize_by_name.  Add
13504         do_instantiate_target.
13505         * x86_64.cc (class Target_selector_x86_64): Likewise.
13506         * testsuite/testfile.cc (class Target_selector_test): Update for
13507         changes to Target_selector.
13508
13509         * README: Rewrite, with some notes on unsupported features.
13510
13511 2008-03-24  Cary Coutant  <ccoutant@google.com>
13512
13513         * i386.cc (Target_i386::Got_type): New enum declaration.
13514         (Target_i386::Scan::local): Updated callers of Output_data_got
13515         member functions.
13516         (Target_i386::Scan::global): Likewise.
13517         (Target_i386::Relocate::relocate): Likewise.
13518         (Target_i386::Relocate::relocate_tls): Likewise.
13519         * object.h (Got_offset_list): New class.
13520         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13521         (Sized_relobj::local_got_offset): Likewise.
13522         (Sized_relobj::set_local_got_offset): Likewise.
13523         (Sized_relobj::local_has_tls_got_offset): Removed.
13524         (Sized_relobj::local_tls_got_offset): Removed.
13525         (Sized_relobj::set_local_tls_got_offset): Removed.
13526         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13527         * output.cc (Output_data_got::add_global): Added got_type parameter.
13528         (Output_data_got::add_global_with_rel): Likewise.
13529         (Output_data_got::add_global_with_rela): Likewise.
13530         (Output_data_got::add_global_pair_with_rel): New function.
13531         (Output_data_got::add_global_pair_with_rela): New function.
13532         (Output_data_got::add_local): Added got_type parameter.
13533         (Output_data_got::add_local_with_rel): Likewise.
13534         (Output_data_got::add_local_with_rela): Likewise.
13535         (Output_data_got::add_local_pair_with_rel): New function.
13536         (Output_data_got::add_local_pair_with_rela): New function.
13537         (Output_data_got::add_global_tls): Removed.
13538         (Output_data_got::add_global_tls_with_rel): Removed.
13539         (Output_data_got::add_global_tls_with_rela): Removed.
13540         (Output_data_got::add_local_tls): Removed.
13541         (Output_data_got::add_local_tls_with_rel): Removed.
13542         (Output_data_got::add_local_tls_with_rela): Removed.
13543         * output.h (Output_data_got::add_global): Added got_type parameter.
13544         (Output_data_got::add_global_with_rel): Likewise.
13545         (Output_data_got::add_global_with_rela): Likewise.
13546         (Output_data_got::add_global_pair_with_rel): New function.
13547         (Output_data_got::add_global_pair_with_rela): New function.
13548         (Output_data_got::add_local): Added got_type parameter.
13549         (Output_data_got::add_local_with_rel): Likewise.
13550         (Output_data_got::add_local_with_rela): Likewise.
13551         (Output_data_got::add_local_pair_with_rel): New function.
13552         (Output_data_got::add_local_pair_with_rela): New function.
13553         (Output_data_got::add_global_tls): Removed.
13554         (Output_data_got::add_global_tls_with_rel): Removed.
13555         (Output_data_got::add_global_tls_with_rela): Removed.
13556         (Output_data_got::add_local_tls): Removed.
13557         (Output_data_got::add_local_tls_with_rel): Removed.
13558         (Output_data_got::add_local_tls_with_rela): Removed.
13559         * resolve.cc (Symbol::override_base_with_special): Removed
13560         reference to has_got_offset_ field.
13561         * symtab.cc (Symbol::init_fields): Replaced initialization
13562         of got_offset_ with got_offsets_.  Removed initialization
13563         of has_got_offset_
13564         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13565         (Symbol::got_offset): Likewise.
13566         (Symbol::set_got_offset): Likewise.
13567         (Symbol::has_tls_got_offset): Removed.
13568         (Symbol::tls_got_offset): Removed.
13569         (Symbol::set_tls_got_offset): Removed.
13570         (Symbol::got_offset_): Removed.
13571         (Symbol::tls_mod_got_offset_): Removed.
13572         (Symbol::tls_pair_got_offset_): Removed.
13573         (Symbol::got_offsets_): New field.
13574         (Symbol::has_got_offset): Removed.
13575         (Symbol::has_tls_mod_got_offset): Removed.
13576         (Symbol::has_tls_pair_got_offset): Removed.
13577         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13578         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13579         member functions.
13580         (Target_x86_64::Scan::global): Likewise.
13581         (Target_x86_64::Relocate::relocate): Likewise.
13582         (Target_x86_64::Relocate::relocate_tls): Likewise.
13583
13584 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13585
13586         * yyscript.y: Fix spelling error in comment.
13587
13588 2008-03-24  Ian Lance Taylor  <iant@google.com>
13589
13590         * options.h (class General_options): Define build_id option.
13591         * layout.h (class Layout): Declare write_build_id, create_note,
13592         create_build_id.  Add build_id_note_ member.
13593         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13594         "libiberty.h", "md5.h", "sha1.h".
13595         (Layout::Layout): Initialize eh_frame_data_,
13596         eh_frame_hdr_section_, and build_id_note_.
13597         (Layout::finalize): Call create_build_id.
13598         (Layout::create_note): New function, broken out of
13599         Layout::create_gold_note.
13600         (Layout::create_gold_note): Call create_note.
13601         (Layout::create_build_id): New function.
13602         (Layout::write_build_id): New function.
13603         (Close_task_runner::run): Call write_build_id.
13604
13605         * x86_64.cc: Correct license to GPLv3.
13606
13607 2008-03-23  Ian Lance Taylor  <iant@google.com>
13608
13609         * options.cc: Include "demangle.h".
13610         (parse_optional_string): New function.
13611         (parse_long_option): Handle takes_optional_argument.
13612         (parse_short_option): Update dash_z initializer.  Handle
13613         takes_optional_argument.
13614         (General_options::General_options): Initialize do_demangle_.
13615         (General_options::finalize): Set do_demangle_.  Handle demangling
13616         style.
13617         * options.h (parse_optional_string): Declare.
13618         (struct One_option): Add optional_arg field.  Update constructor.
13619         Update call constructor calls.  Add takes_optional_argument
13620         function.
13621         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13622         (DEFINE_optional_string): Define.
13623         (General_options::demangle): Change from DEFINE_bool to
13624         DEFINE_optional_string.
13625         (General_options::no_demangle): New function.
13626         (General_options::do_demangle): New function.
13627         (General_options::set_do_demangle): New function.
13628         (General_options::execstack_status_): Move definition to end of
13629         class definition.
13630         (General_options::static_): Likewise.
13631         (General_options::do_demangle_): New field.
13632         * object.cc (big_endian>::get_symbol_location_info): Call
13633         Options::do_demangle, not Options::demangle.
13634         * symtab.cc (demangle): Likewise.
13635
13636 2008-03-22  Ian Lance Taylor  <iant@google.com>
13637
13638         * gold.h: Include <cstddef> and <sys/types.h>
13639         * options.h: Include <cstring>.
13640
13641 2008-03-21  Ian Lance Taylor  <iant@google.com>
13642
13643         * Added source code to GNU binutils.