gold/
[external/binutils.git] / gold / ChangeLog
1 2013-07-23  Cary Coutant  <ccoutant@google.com>
2
3         * parameters.cc (Parameters::entry): Return target-specific entry
4         symbol name.
5         * target.h (Target::entry_symbol_name): New function.
6         (Target_info::entry_symbol_name): New data member.
7
8         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
9         * i386.cc (Target_i386::i386_info): Likewise.
10         (Target_i386_nacl::i386_nacl_info): Likewise.
11         * sparc.cc (Target_sparc::sparc_info): Likewise.
12         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
13         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
14         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
15         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
16
17 2013-07-22  Sterling Augustine  <saugustine@google.com>
18
19         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
20         Convert parameter shndx to local variable. Add parameters symtab
21         and symtab_size.  Scan over section names.  Find relocation
22         section corresponding to current section.  Create and initialize
23         reloc_mapper_ and reloc_type_.
24         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
25         unit_length to off_t.  Initialize member unit_length_.  Fill in field
26         cu_offset_.
27         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
28         Initialize new fields unit_length_ and cu_offset_.
29         (Dwarf_pubnames_table::read_section): Update prototype.
30         (Dwarf_pubnames_table::cu_offset): New member function.
31         (Dwarf_pubnames_table::subsection_size): Likewise.
32         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
33         New fields.
34         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
35         member functions public.
36         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
37         Update comment.  Rework logic.  Move repeated parts to...
38         (Gdb_index_info_reader::read_pubtable): ...here. New function.
39         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
40         pubtypes_table_, and stmt_list_offset.
41         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
42         Gdb_index::find_pubtype_offset,
43         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
44         (Gdb_index::pubnames_read): Update prototype and rework logic.
45         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
46         Forward declare.
47         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
48         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
49         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
50         Gdb_index::map_pubtable_to_dies):
51         Declare functions.
52         (Gdb_index::pubnames_read): Update declaration.
53         (Gdb_index::Pubname_offset_map): New type.
54         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
55         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
56         Gdb_index::stmt_list_offset): Declare.
57         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
58         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
59         Gdb_index::pubtypes_offset_): Remove.
60
61 2013-07-19  Roland McGrath  <mcgrathr@google.com>
62
63         * options.h (General_options): Add -Trodata-segment option.
64         * parameters.cc (Parameters::check_rodata_segment): New function.
65         (Parameters::set_target_once): Call it.
66         * parameters.h (Parameters): Declare it (private member function).
67         * layout.cc (load_seg_unusable_for_headers): New function, broken
68         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
69         then validate rodata segment rather than text segment.
70         (relaxation_loop_body): Call that.
71         (is_text_segment): New function.  Don't admit a non-executable
72         segment if TARGET->isolate_execinstr().
73         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
74
75 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
76
77         PR gold/15070
78         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
79         * nacl.h (Sniff_file::View::View): Request aligned view.
80
81 2013-07-11  Cary Coutant  <ccoutant@google.com>
82
83         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
84         correct BRLT entry size.
85
86 2013-07-03  Alan Modra  <amodra@gmail.com>
87
88         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
89         comment.
90
91 2013-07-01  Cary Coutant  <ccoutant@google.com>
92
93         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
94         reloc_type_.
95         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
96         (Dwarf_ranges_table::lookup_reloc): New function.
97         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
98         reloc_type_.
99         (Dwarf_ranges_table::lookup_reloc): New function.
100         (Dwarf_ranges_table::reloc_type_): New data member.
101
102 2013-06-27  Jing Yu  <jingyu@google.com>
103
104         PR gold/15662
105         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
106         function.
107         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
108         (Target_powerpc::do_relax): Call the above.
109
110 2013-06-27  Cary Coutant  <ccoutant@google.com>
111
112         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
113         on garbage collected .opd section.
114
115 2013-06-27  Alan Modra  <amodra@gmail.com>
116
117         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
118         is non-zero.
119         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
120         (Target_powerpc::do_function_location): Likewise for loc->shndx.
121
122 2013-06-14  Cary Coutant  <ccoutant@google.com>
123
124         * resolve.cc (Symbol::override_base): Don't override st_type
125         from plugin placeholder symbols.
126         (Symbol_table::resolve): Likewise.
127         (Symbol_table::should_override): Don't complain about TLS mismatch
128         if the TO symbol is a plugin placeholder.
129         * testsuite/Makefile.am (plugin_test_tls): New test.
130         * testsuite/Makefile.in: Regenerate.
131         * testsuite/plugin_test_tls.sh: New test script.
132         * testsuite/two_file_test_2_tls.cc: New test source.
133         * testsuite/two_file_test_tls.cc: New test source.
134
135 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
136
137         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
138         the maximum segment alignment is larger than the page size.
139         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
140         correctly aligns the symbols with large alignemnt.
141         * testsuite/Makefile.in: Regenerate.
142         * testsuite/large_symbol_alignment.cc: New file.
143
144 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
145             Sriraman Tallam  <tmsriram@google.com>
146
147         * options.h (sort_section): New option.
148         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
149         Rename from Input_section_sort_section_name_special_ordering_compare.
150         (Input_section_sort_section_name_compare): New struct.
151         * output.cc (Output_section::Input_section_sort_section_name_compare::
152         operator()): New function.
153         (Output_section::sort_attached_input_sections): Use new sort function
154         for .text if --sort-section=name is specified.
155         * layout.cc (Layout::make_output_section):
156         Add sorting by name when --sort-section=name is specified.
157         * testsuite/Makefile.am (text_section_grouping): Test option
158         --sort-section=name.
159         * testsuite/Makefile.in: Regenerate.
160         * testsuite/section_sorting_name.cc: New file.
161         * testsuite/section_sorting_name.sh: New file.
162
163 2013-05-21  Cary Coutant  <ccoutant@google.com>
164
165         * symtab.h (Symbol::is_cxx_vtable): New function.
166         * target-reloc.h (relocate_section): Check for vtable symbol.
167         * testsuite/Makefile.am (missing_key_func.sh): New test case.
168         * testsuite/Makefile.in: Regenerate.
169         * testsuite/missing_key_func.cc: New test source.
170         * testsuite/missing_key_func.sh: New test script.
171
172 2013-05-21  Cary Coutant  <ccoutant@google.com>
173
174         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
175         type of enclosing symbol.
176         (Relocate_info::location): Check symbol type when describing symbol.
177         * object.h (Symbol_location_info): Remove unused line_number;
178         add enclosing_symbol_type.
179         * testsuite/debug_msg.sh: Adjust expected output.
180
181 2013-05-13  Cary Coutant  <ccoutant@google.com>
182
183         * configure.ac: Export DEFAULT_TARGET.
184         * configure: Regenerate.
185         * Makefile.in: Regenerate.
186         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
187         * testsuite/Makefile.in: Regenerate.
188         * testsuite/debug_msg.sh: Delete duplicate tests.
189         Don't check undef_int error message match for powerpc where the
190         source file and line number aren't available.
191
192 2013-05-10  Roland McGrath  <mcgrathr@google.com>
193
194         * options.h (General_options): Add --rosegment-gap option.
195         * options.cc (finalize): --rosegment-gap implies --rosegment.
196         * layout.cc (set_segment_offsets): Let user option override
197         target->rosegment_gap().
198
199 2013-05-10  Roland McGrath  <mcgrathr@google.com>
200
201         * options.h (General_options): Remove leading space from help
202         messages for -nostdlib and --rosegment.
203
204 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
205
206         PR ld/15365
207         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
208
209 2013-05-03  Alan Modra  <amodra@gmail.com>
210
211         * merge.cc (Output_merge_string::do_add_input_section): Correct
212         scan for number of strings.  Rename vars to avoid shadowing.
213         Include missing terminator in input_size_.
214
215 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
216
217         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
218         Restore empty string handling.
219
220 2013-05-01  Cary Coutant  <ccoutant@google.com>
221
222         * stringpool.cc (Stringpool_template::new_key_offset): Fix
223         uninitialized warning.
224
225 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
226
227         * output.cc (Output_section::add_merge_input_section): Allow
228         to merge sections if the alignment is more than character size.
229         * merge.h (Output_merge_string::Output_merge_string): Remove
230         assert.
231         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
232         only not-null strings. Check the alignment of strings.
233         * stringpool.h
234         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
235         alignment as the argument.
236         (Stringpool_template<Stringpool_char>::addralign_): New class member.
237         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
238         Align non-zero length strings according to the addralign_.
239         (Stringpool_template<Stringpool_char>::set_string_offsets):
240         Updating offsets according to the given alignment.
241         * testsuite/Makefile.am (text_section_grouping): Test if string
242         literals are getting merged.
243         * testsuite/Makefile.in: Regenerate.
244         * testsuite/merge_string_literals_1.c: New file.
245         * testsuite/merge_string_literals_2.c: Ditto.
246         * testsuite/merge_string_literals.sh: Ditto.
247
248 2013-04-26  Ian Lance Taylor  <iant@google.com>
249
250         * target-reloc.h (relocate_section): If the reloc offset is out of
251         range, pass VIEW as NULL to relocate.relocate.
252         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
253         * i386.cc (Target_i386::Relocate::relocate): Likewise.
254         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
255         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
256         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
257         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
258
259 2013-04-26  Geoff Pike  <gpike@chromium.org>
260
261         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
262         * layout.cc (Hash_task): New class.
263         (Layout::queue_build_id_tasks): New function.
264         (Layout::write_build_id): Handle single-thread portion of build ID
265         computation.  (In some cases, all of it is single-threaded.)  Replace
266         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
267         functionality in fewer lines of code.
268         * layout.h (Layout::queue_build_id_tasks): New function declaration.
269         * options.h (General_options): make "--build-id" default to tree
270         rather than sha1.  Add two new options related to --build-id=tree:
271         --build-id-chunk-size-for-treehash and
272         --build-id-min-file-size-for-treehash.
273         * Makefile.am: add testing of --build-id=tree and related new options
274         (these tests will be invoked by "make check").
275         * Makefile.in: Regenerate.
276
277 2013-04-25  Alan Modra  <amodra@gmail.com>
278
279         * configure.tgt: Add powerpcle and powerpc64le.
280
281 2013-04-22  Alan Modra  <amodra@gmail.com>
282
283         PR gold/15355
284         * layout.cc (Layout::segment_precedes): Allow more than one
285         segment with the same type and flags.
286
287 2013-04-15  Cary Coutant  <ccoutant@google.com>
288
289         * layout.cc (Layout::set_relocatable_section_offsets): Don't
290         allocate space in file for BSS sections.
291
292 2013-04-15  Cary Coutant  <ccoutant@google.com>
293
294         * script-sections.cc (Orphan_output_section): Reset address
295         to zero after each orphaned section for relocatable links.
296
297 2013-04-15  Cary Coutant  <ccoutant@google.com>
298
299         * symtab.cc (Symbol_table::sized_write_globals): Subtract
300         section starting address for relocatable link.
301         * testsuite/Makefile.am (script_test_11): New test.
302         * testsuite/Makefile.in: Regenerate.
303         * testsuite/script_test_11.c: New source file.
304         * testsuite/script_test_11.t: New linker script.
305
306 2013-04-13  Alan Modra  <amodra@gmail.com>
307
308         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
309         owner when sections are not adjacent and exceed group size.
310         (Target_powerpc::group_sections): Handle corner case.
311         (Target_powerpc::Branch_info::make_stub): Handle case where
312         stub table doesn't exist due to branches in non-exec sections.
313         (Target_powerpc::Relocate::relocate): Likewise.
314
315 2013-04-11  Alan Modra  <amodra@gmail.com>
316
317         PR gold/15354
318         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
319         .branch_lt to match bfd ld.  Adjust comments throughout file.
320
321 2013-04-04  Ian Lance Taylor  <iant@google.com>
322
323         GCC PR c++/56840
324         * object.cc (do_layout_deferred_sections): Handle .eh_frame
325         sections before checking whether they are included in the link.
326
327 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
328
329         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
330         object before calling the plugin claim_file handler.  Pass the elf
331         object of the archive to the plugin. Delete the elf object if the
332         plugin claims the file.
333
334 2013-03-21  Alan Modra  <amodra@gmail.com>
335
336         * layout.cc (Layout::set_segment_offsets): Accept writable .text
337         segment when omagic.
338
339 2013-03-21  Alan Modra  <amodra@gmail.com>
340
341         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
342         comparison warning.
343         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
344         uninitialized" warning.
345
346 2013-03-20  Alan Modra  <amodra@gmail.com>
347
348         * symtab.h (Symbol::clear_version): New function.
349         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
350         is_needed by weak references.  Clear version for symbols defined
351         in as-needed objects that are not needed.
352
353 2013-03-15  Alan Modra  <amodra@gmail.com>
354
355         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
356         static and public.  Add report_err param.  Return false for data refs.
357         (Target_powerpc::rela_dyn_section): New overloaded function.
358         (Target_powerpc::plt_, iplt_): Elucidate.
359         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
360         (Output_data_plt_powerpc::do_write): Don't write .iplt.
361         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
362         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
363         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
364         push_branch and make_plt_entry for ifunc syms when
365         reloc_needs_plt_for_ifunc.
366         (Target_powerpc::Relocate::relocate): Don't use plt entry value
367         for ifunc unless reloc_needs_plt_for_ifunc.
368
369 2013-03-15  Alan Modra  <amodra@gmail.com>
370
371         * gc.h (gc_process_relocs): Don't look through function descriptors.
372         * icf.cc (get_section_contents): Do so here instead.
373
374 2013-03-13  Alan Modra  <amodra@gmail.com>
375
376         * powerpc.cc (is_branch_reloc): Forward declare.
377         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
378         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
379         false for 64-bit, true for 32-bit non-branch relocs.
380         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
381         * testsuite/Makefile.am (icf_test): Use linker map file instead of
382         nm output.
383         (icf_safe_test): Generate linker map file as well as nm output.
384         (icf_safe_so_test): Likewise.
385         * testsuite/Makefile.in: Regenerate.
386         * testsuite/icf_test.sh: Parse linker map file to determine
387         section folding.
388         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
389         * testsuite/icf_safe_so_test.sh: Likewise.
390         (X86_32_or_ARM_specific_safe_fold): Merge into..
391         (arch_specific_safe_fold): ..this.
392         (X86_64_specific_safe_fold): Delete unused function.
393
394 2013-03-12  Alan Modra  <amodra@gmail.com>
395
396         * gc.h (gc_process_relocs): Look through function descriptors
397         to determine shndx, symvalue and addend used by ICF.  Tidy
398         variable duplication.
399
400 2013-03-11  Alan Modra  <amodra@gmail.com>
401
402         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
403         * layout.cc (Layout_task_runner::run): ..to here.
404         * symtab.h (struct Symbol_location): Extract from..
405         (class Symbol_table): ..here.
406         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
407         * target.h (class Target): Add function_location and
408         do_function_location functions.
409         (class Sized_target): Add do_function_location.
410         * object.h (class Sized_relobj_file): Move find_shdr..
411         (class Object): ..to here.
412         * object.cc: Likewise.  Update to suit.  Instantiate.
413         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
414         * powerpc.cc (class Powerpc_dynobj): New.
415         (Target_powerpc::do_function_location): New function.
416         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
417         (Powerpc_dynobj::do_read_symbols): New function.
418         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
419
420 2013-03-08  Ian Lance Taylor  <iant@google.com>
421
422         * options.cc (General_options::string_to_object_format): Accept
423         "default".
424
425 2013-03-08  Alan Modra  <amodra@gmail.com>
426
427         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
428         pointer to Post_fde.
429         (struct Post_fde): Move definition to here..
430         * ehframe.cc (struct Post_fde): ..from here.
431         (Cie::write): Don't alloc Post_fde.
432         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
433
434 2013-03-07  Alan Modra  <amodra@gmail.com>
435
436         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
437         relocation referencing .LC0.
438         * testsuite/discard_locals_test.sh: Remove FIXMEs.
439
440 2013-03-07  Alan Modra  <amodra@gmail.com>
441
442         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
443         always_inline.  Add assembly for powerpc to avoid GOT.
444
445 2013-03-07  Alan Modra  <amodra@gmail.com>
446
447         * testsuite/script_test_10.sh: Don't test .bss section
448         header number.
449
450 2013-03-06  Alan Modra  <amodra@gmail.com>
451
452         * powerpc.cc (class Powerpc_relobj): Move some member functions.
453         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
454         all callers.  Handle folded sections.
455         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
456         to Powerpc_relobj.
457         (Global_symbol_visitor_opd::operator()): Likewise.
458
459 2013-03-04  Alan Modra  <amodra@gmail.com>
460
461         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
462         * testsuite/Makefile.in: Regenerate.
463
464 2013-03-01  Cary Coutant  <ccoutant@google.com>
465
466         Add dwp support for v2 DWARF package file format.
467         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
468         tu_length parameter.  Adjust all callers.
469         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
470         * dwp.cc: Include dwarf.h.
471         (Section_bounds): New struct type.
472         (Unit_set): New struct type.
473         (Dwo_file::Dwo_file): Initialize new data member.
474         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
475         Combine and rename to...
476         (Dwo_file::read_unit_index): ...this.
477         (Dwo_file::sized_read_compunit_index)
478         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
479         (Dwo_file::sized_read_unit_index): ...this.
480         (Dwo_file::copy_section): Remove section_name, is_str_offsets
481         parameters; add section_id parameter.
482         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
483         (Dwo_file::add_unit_set): ...this.
484         (Dwo_file::shndx_map_): Remove.
485         (Dwo_file::sect_offsets_): New data member.
486         (Dwp_output_file::Dwp_output_file): Initialize new data members.
487         (Dwp_output_file::add_section): Rename to...
488         (Dwp_output_file::add_contribution): ...this.
489         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
490         (Dwp_output_file::add_tu_set): Likewise.
491         (Dwp_output_file::Contribution): New type.
492         (Dwp_output_file::Section::contributions): New data member.
493         (Dwp_output_file::Cu_or_tu_set): Remove.
494         (Dwp_output_file::Section::Section): New ctor.
495         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
496         (Dwp_output_file::Dwp_index::Section_table): New type.
497         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
498         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
499         parameter.
500         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
501         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
502         (Dwp_output_file::Dwp_index::section_table): New member function.
503         (Dwp_output_file::Dwp_index::section_table_end): New member function.
504         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
505         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
506         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
507         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
508         (Dwp_output_file::Dwp_index::section_table_): New data member.
509         (Dwp_output_file::Dwp_index::section_mask_): New data member.
510         (Dwp_output_file::add_output_section): New member function.
511         (Dwp_output_file::write_new_section): New member function.
512         (Dwp_output_file::write_contributions): New member function.
513         (Dwp_output_file::section_id_map_): New data member.
514         (class Dwo_id_info_reader): Remove.
515         (class Unit_reader): New class.
516         (get_dwarf_section_name): New function.
517         (Dwo_file::read_executable): Adjust initializations of class data.
518         (Dwo_file::read): Add support for v2 package file format.
519         (Dwo_file::read_unit_index): Likewise.
520         (Dwo_file::sized_read_unit_index): Likewise.
521         (Dwo_file::copy_section): Likewise.
522         (Dwo_file::add_unit_set): Likewise.
523         (Dwp_output_file::add_output_section): Likewise.
524         (Dwp_output_file::add_contribution): Likewise.
525         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
526         for empty slot.
527         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
528         file format.
529         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
530         slot.
531         (Dwp_output_file::initialize): Remove unused function.
532         (Dwp_output_file::finalize): Add support for v2 package file format.
533         (Dwp_output_file::write_index): Likewise.
534         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
535         function prototype.
536
537 2013-03-01  Cary Coutant  <ccoutant@google.com>
538
539         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
540         function into class definition in header file.
541         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
542         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
543         New function.
544         (Dwarf_info_reader::check_buffer): Move here from .cc file.
545
546 2013-02-28  Alan Modra  <amodra@gmail.com>
547
548         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
549         * target.cc (Target::do_plt_fde_location): New function.
550         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
551         accessor function, and constructor param.
552         (struct Post_fde, Post_fdes): Declare.
553         (Cie::write): Add post_fdes param.
554         * ehframe.cc (Fde::write): Use plt_fde_location.
555         (struct Post_fde): Define.
556         (Cie::write): Stash FDEs added post merge mapping.
557         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
558         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
559         (Eh_frame::do_sized_write): Arrange to write post map FDES after
560         other FDEs.
561         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
562         (Target_powerpc::has_glink): New function.
563         (Target_powerpc::do_relax): Add eh_frame info for stubs.
564         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
565         glink_eh_frame_fde_32, default_fde): New data.
566         (Stub_table::eh_frame_added_): New var.
567         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
568         Make const.
569         (Stub_table::add_eh_frame): New function.
570         (Output_data_glink::add_eh_frame): New function.
571         (Target_powerpc::make_glink_section): Call add_eh_frame.
572
573 2013-02-15  Ian Lance Taylor  <iant@google.com>
574
575         * options.h (DEFINE_uint64_alias): Define.
576         (class General_options): Add -Ttext-segment as an alias for
577         -Ttext.
578
579 2013-02-15  Alan Modra  <amodra@gmail.com>
580
581         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
582         (Stub_table::do_write): ..here, two places.
583         (Stub_table::plt_call_size): Use it here too.
584
585 2013-02-11  Ian Lance Taylor  <iant@google.com>
586
587         * descriptors.cc (Descriptors::close_all): New function.
588         * descriptors.h (class Descriptors): Declare close_all.
589         (close_all_descriptors): New inline function.
590         * plugin.cc: Include "descriptors.h".
591         (Plugin_manager::cleanup): Call close_all_descriptors.
592
593 2013-02-06  Alan Modra  <amodra@gmail.com>
594
595         * README: Update coding style link.
596
597 2013-01-28  Cary Coutant  <ccoutant@google.com>
598
599         * dwp.cc (File_list): New typedef.
600         (Dwo_name_info_reader): New class.
601         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
602         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
603         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
604         (Dwo_file::read_executable): New function.
605         (Dwo_file::read): Move common setup code to ...
606         (Dwo_file::make_object): ... here.
607         (dwp_options): Add --exec/-e.
608         (usage): Likewise.
609         (main): Likewise.
610
611 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
612
613         * layout.cc (Layout::layout): Check for option text_reorder.
614         (Layout::make_output_section): Ditto.
615         * options.h (text_reorder): New option.
616         * output.cc (Input_section_sort_compare): Remove special ordering
617         of section names.
618         (Output_section::
619          Input_section_sort_section_name_special_ordering_compare::
620          operator()): New function.
621         (Output_section::sort_attached_input_sections): Use new sort function
622         for .text.
623         * output.h (Input_section_sort_section_name_special_ordering_compare):
624         New struct.
625         * testsuite/Makefile.am (text_section_grouping): Test option
626         --no-text-reorder
627         * testsuite/Makefile.in: Regenerate.
628         * testsuite/text_section_grouping.sh: Check order of functions without
629         default text reordering.
630
631 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
632
633         * options.h (General_options): Change default to true for new_dtags.
634
635 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
636
637         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
638         when enable_new_dtags is false.  Only add DT_RUNPATH when
639         enable_new_dtags is true.
640
641 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
642
643         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
644         used in declaration and definition consistent.
645         (Target_powerpc::symval_for_branch): Ditto.
646
647 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
648
649         * testsuite/plugin_final_layout.cc: Fix comment.
650
651 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
652
653         * layout.cc (Layout::layout): Do not do default sorting for
654         text sections when section ordering is specified.
655         (make_output_section): Ditto.
656         * testsuite/plugin_final_layout.cc: Name the function sections
657         to catch reordering issues.
658
659 2013-01-15  Alan Modra  <amodra@gmail.com>
660
661         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
662         plt-thread-safe.
663
664 2013-01-15  Alan Modra  <amodra@gmail.com>
665
666         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
667         * testsuite/Makefile.in: Regenerate.
668
669 2013-01-14  Alan Modra  <amodra@gmail.com>
670
671         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
672         * testsuite/Makefile.in: Regenerate.
673
674 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
675
676         PR bfd/14430
677         Fix mingw gold build with plugins enabled
678         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
679         * configure.ac: Export DLOPEN_LIBS and add headers check.
680         * plugin.cc: Handle non-dlfcn case.
681         * Makefile.in: Regenerate.
682         * config.in: Regenerate.
683         * configure: Regenerate.
684         * testsuite/Makefile.in: Regenerate.
685
686 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
687
688         * output.h (sort_attached_input_sections): Change to be public.
689         * script-sections.cc
690         (Output_section_definition::set_section_addresses): Sort
691         attached input sections according to section order before linker
692         script assigns section addresses.
693         (Orphan_output_section::set_section_addresses): Sort
694         attached input sections according to section order before linker
695         script assigns section addresses.
696         * Makefile.am (final_layout.sh): Use a simple linker script to
697         check if section ordering still works.
698         * Makefile.in: Regenerate.
699
700 2013-01-09  Ben Cheng  <bccheng@google.com>
701
702         * arm.cc (Target_arm::attributes_accept_div): New function.
703         (Target_arm::attributes_forbid_div): New function.
704         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
705         attribute using the same new functions as what bfd/elf32_arm.c
706         does.
707
708 2013-01-07  Cary Coutant  <ccoutant@google.com>
709
710         PR gold/14993
711         * output.cc (Output_section::add_input_section): For incremental
712         updates, don't track input sections that are allocated from patch
713         space.
714
715 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
716             Ian Lance Taylor  <iant@google.com>
717
718         PR gold/14897
719         * configure.ac (--enable-ld): Removed.
720         (install_as_default): Set to yes only for --enable-gold=default
721         or --disable-ld.
722         * configure: Regenerated.
723
724 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
725
726         * options.h (General_options): Add -fuse-ld= for GCC linker
727         option compatibility.
728
729 2013-01-04  Cary Coutant  <ccoutant@google.com>
730
731         * configure.ac: Fix typo restoring CXXFLAGS.
732         * configure: Regenerate.
733
734 2013-01-04  Cary Coutant  <ccoutant@google.com>
735
736         * testsuite/Makefile.am (CXXLINK_S): New macro.
737         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
738         * testsuite/Makefile.in: Regenerate.
739
740 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
741
742         * version.cc (print_version): Update copyright year to 2013.
743
744 2012-12-20  Ian Lance Taylor  <iant@google.com>
745
746         * layout.cc (Layout::special_ordering_of_input_section): New
747         function.
748         (Layout::layout): If input section requires special ordering, must
749         sort input sections.
750         (Layout::make_output_section): May sort .text input sections.
751         (Layout::is_section_name_prefix_grouped): Remove.
752         * layout.h (class Layout): Declare
753         special_ordering_of_input_section.  Don't declare
754         is_section_name_prefix_grouped.
755         * output.cc (Output_section::add_input_section): Revert last
756         change.
757         (Output_section::Input_section_sort::match_file_name): Don't crash
758         if called on output section data.
759         (Output_section::Input_section_sort_compare): Sort based on
760         special ordering.
761         (Output_section::Input_section_sort_section_order_index_compare):
762         Revert last patch.
763         (Output_section::sort_attached_input_sections): Likewise.
764
765 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
766
767         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
768         * layout.h (Layout::is_section_name_prefix_grouped): New function.
769         * output.cc (Output_section::add_input_section): Check if section
770         name contains special prefix.  Keep input sections to sort such
771         sections.
772         (Output_section::Input_section_sort_section_order_index_compare
773          ::operator()): Group sections according to prefixes.
774         (Output_section::sort_attached_input_sections): Add condition to
775         Input_section_entry constructor call.
776         * testsuite/Makefile.am (text_section_grouping): New test.
777         * testsuite/Makefile.in: Regenerate.
778         * testsuite/text_section_grouping.cc: New file.
779         * testsuite/text_section_grouping.sh: New file.
780
781 2012-12-17  Nick Clifton  <nickc@redhat.com>
782
783         * Makefile.am: Add copyright notice.
784         * NEWS: Likewise.
785         * README: Likewise.
786         * configure.ac: Likewise.
787         * ftruncate.c: Likewise.
788         * Makefile.in: Regenerate.
789
790 2012-12-14  Cary Coutant  <ccoutant@google.com>
791
792         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
793         --no-as-needed flag.
794         (exception_separate_shared_12_test): Likewise.
795         (incremental_copy_test): Likewise.
796         * testsuite/Makefile.in: Regenerate.
797
798 2012-12-14  Cary Coutant  <ccoutant@google.com>
799
800         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
801         (Dwp_output_file::Dwp_index::enter_set): Add assert.
802
803 2012-12-12  Alan Modra  <amodra@gmail.com>
804
805         * powerpc.cc (class Track_tls): New.
806         (class Relocate, class Scan): Inherit Track_tls.
807         (Target_powerpc::Scan::local, global): Track tls optimization
808         and avoid creating plt entry for __tls_get_addr if all uses
809         are optimized away.
810         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
811
812 2012-12-12  Alan Modra  <amodra@gmail.com>
813
814         * options.h (General_options): Add --toc-sort/--no-toc-sort.
815         Replace no_toc_optimize with toc_optimize.
816         * output.h (Output_section::input_sections): Provide non-const variant.
817         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
818         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
819         accessors.
820         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
821         (class Sort_toc_sections): New.
822         (Target_powerpc::do_finalize_sections): Sort toc sections.
823         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
824
825 2012-12-10  Roland McGrath  <mcgrathr@google.com>
826
827         * testsuite/binary_unittest.cc (read_all): New function.
828         (Sized_binary_test): Use it instead of ::read.
829         * fileread.cc (do_read): Don't assume pread always reads the whole
830         amount in a single call.
831
832 2012-12-10  Alan Modra  <amodra@gmail.com>
833
834         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
835         Set EM_PPC64 or EM_PPC here.
836         (Target_selector_powerpc::do_recognize): Delete.
837
838 2012-12-10  Alan Modra  <amodra@gmail.com>
839
840         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
841         stub_table_.
842         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
843
844 2012-12-07  Roland McGrath  <mcgrathr@google.com>
845
846         * testsuite/binary_unittest.cc (Sized_binary_test):
847         Use open_descriptor rather than ::open.
848
849 2012-12-07  Alan Modra  <amodra@gmail.com>
850
851         * powerpc.cc (Stub_table::do_write): Delete redundant Address
852         typedef and invalid_address constant.
853         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
854         instantiate constants.
855
856 2012-12-06  Roland McGrath  <mcgrathr@google.com>
857
858         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
859         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
860         * aclocal.m4: Regenerate.
861         * configure: Regenerate.
862         * Makefile.in: Regenerate.
863         * testsuite/Makefile.in: Regenerate.
864
865 2012-12-07  Alan Modra  <amodra@gmail.com>
866
867         * options.h (General_options): Add no_toc_optimize.
868         * powerpc.cc (ok_lo_toc_insn): New function.
869         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
870
871 2012-12-06  Alan Modra  <amodra@gmail.com>
872
873         * options.h (General_options): Add plt_align, plt_static_chain,
874         plt_thread_safe.  Update stub_group_size help text.
875         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
876         for new plt_thread_safe_ var.
877         (use_plt_offset): Correct comments.
878         (Target_powerpc::do_relax): Look for thread creation symbols to
879         determine default plt_thread_safe value.  Clear plt call stubs
880         as well as branch stubs each iteration.
881         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
882         insn constants.
883         (l, hi, ha, write_insn): Move earlier.
884         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
885         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
886         plt stubs too.
887         (Stub_table::update_size): Adjust.
888         (Stub_table::prev_size, set_prev_size): Delete.
889         (Stub_table::stub_align): Let --plt-align affect result.
890         (Stub_table::plt_call_size): Calculate sizes for various stubs.
891         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
892         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
893         (Stub_table::do_write): Support more stub variants.
894
895 2012-12-04  Alan Modra  <amodra@gmail.com>
896
897         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
898         (Target_powerpc::do_define_standard_symbols): New function.
899
900 2012-12-03  Alan Modra  <amodra@gmail.com>
901
902         * output.h: Formatting, whitespace.
903
904 2012-12-03  Alan Modra  <amodra@gmail.com>
905
906         * layout.h (Layout::get_executable_sections): Declare.
907         * layout.cc (Layout::get_executable_sections): New function.
908         * arm.cc (Target_arm::group_sections): Use it.
909         (Arm_output_section::group_sections): Delete now redundant test.
910         * output.cc (Output_reloc::Output_reloc): Add is_relative.
911         param to handle relative relocs.
912         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
913         (Output_data_reloc::add_absolute): Adjust.
914         (Output_data_reloc::add_relative): New function.
915         (Output_data::reset_data_size): New function.
916         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
917         (Output_section::set_addralign): New function.
918         (Output_section::checkpoint_set_addralign): New function.
919         (Output_section::clear_section_offsets_need_adjustment): New function.
920         (Output_section::input_sections): Make public.
921         * powerpc.cc (class Output_data_brlt_powerpc): New.
922         (class Stub_table, class Stub_control): New.
923         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
924         stub_table_, set_stub_table, stub_table): New vectors and accessor
925         functions.
926         (Target_powerpc::do_may_relax, do_relax, push_branch,
927         new_stub_table, stub_tables, brlt_section, group_sections,
928         add_branch_lookup_table, find_branch_lookup_table,
929         write_branch_lookup_table, make_brlt_section): New functions.
930         (Target_powerpc::struct Sort_sections, class Branch_info): New.
931         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
932         branch_info_): New vars.
933         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
934         make call stubs here.
935         (Output_data_glink): Remove all call stub handling from this class.
936         (Target_powerpc::Scan::local, global): Save interesting branch
937         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
938         (Target_powerpc::do_finalize_sections): Only make reg save/restore
939         functions on final link.
940         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
941         Handle long branch destinations too.
942         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
943         do_plt_address_for_local): Adjust lookup of plt call stubs.
944
945 2012-11-30  Alan Modra  <amodra@gmail.com>
946
947         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
948         relocs against protected symbols when building 32-bit shared libs.
949
950 2012-11-30  Alan Modra  <amodra@gmail.com>
951
952         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
953         param.  Call got_section() to make .got.  Update all callers
954         and their callers and so on.
955
956 2012-11-30  Alan Modra  <amodra@gmail.com>
957
958         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
959         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
960         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
961         value if it already exists.
962
963 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
964
965         PR gold/14858
966         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
967
968 2012-11-14  Roland McGrath  <mcgrathr@google.com>
969
970         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
971         than bfc instruction for data sandboxing.
972
973 2012-11-08  Alan Modra  <amodra@gmail.com>
974
975         * po/POTFILES.in: Regenerate.
976
977 2012-11-05  Alan Modra  <amodra@gmail.com>
978
979         * configure.ac: Apply 2012-09-10 change to config.in here.
980         * configure: Regenerate.
981
982 2012-11-05  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
985         (struct Opd_ent): Use "Address" rather than "Offset".
986         (Output_data_got_powerpc::got_base_offset): Return Valtype.
987         (Target_powerpc::got_section): Make public.
988         (Target_powerpc::scan_relocs): Move code setting symbols..
989         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
990         Create _SDA_BASE_ only when referenced.
991
992 2012-11-02  Roland McGrath  <mcgrathr@google.com>
993
994         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
995         from last change.
996
997 2012-11-01  Roland McGrath  <mcgrathr@google.com>
998
999         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1000         for offset_in_output_section parameter.
1001         (Sized_target::relocate_special_relocatable): Likewise.
1002         * arm.cc (Target_arm::relocate_relocs): Likewise.
1003         (Target_arm::relocate_special_relocatable): Likewise.
1004         * i386.cc (Target_i386::relocate_relocs): Likewise.
1005         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1006         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1007         * target-reloc.h (relocate_relocs): Likewise.
1008         * testsuite/testfile.cc (Target_test): Likewise.
1009         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1010         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1011
1012         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1013         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1014
1015         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1016         parameter, which is unused in the [!F_SETFD] case.
1017
1018         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1019         SYMNDX to off_t before comparing it to this->data_size().
1020         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1021         * incremental.cc (Output_section_incremental_inputs::do_write):
1022         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1023
1024         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1025
1026 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1027
1028         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1029         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1030         in EABI_VER5.
1031
1032 2012-10-29  Cary Coutant  <ccoutant@google.com>
1033
1034         * dwp.cc (usage): Add file and exit status parameters;
1035         add --help and --version options.
1036         (print_version): New function.
1037         (main): Add --help and --version options.
1038
1039 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1040
1041         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1042         final_layout_sequence.txt.
1043         * testsuite/Makefile.in: Regenerated.
1044
1045 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1046
1047         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1048         COMPILE generated by automake.
1049         (LINK1): Likewise.
1050         (CXXCOMPILE1): Likewise.
1051         (CXXLINK1): Likewise.
1052         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1053         (LINK): Likewise.
1054         (CXXCOMPILE): Likewise.
1055         (CXXLINK): Likewise.
1056         * testsuite/Makefile.in: Regenerated.
1057
1058 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1059
1060         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1061         on bad fwrite return.
1062
1063 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1064
1065         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1066         on val.
1067
1068 2012-10-23  Cary Coutant  <ccoutant@google.com>
1069
1070         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1071         * testsuite/Makefile.in: Regenerate.
1072         * testsuite/dwp_test.h: New source file.
1073         * testsuite/dwp_test_1.cc: New source file.
1074         * testsuite/dwp_test_1.s: New source file.
1075         * testsuite/dwp_test_1.sh: New source file.
1076         * testsuite/dwp_test_1b.cc: New source file.
1077         * testsuite/dwp_test_1b.s: New source file.
1078         * testsuite/dwp_test_2.cc: New source file.
1079         * testsuite/dwp_test_2.s: New source file.
1080         * testsuite/dwp_test_2.sh: New source file.
1081         * testsuite/dwp_test_main.cc: New source file.
1082         * testsuite/dwp_test_main.s: New source file.
1083
1084 2012-10-23  Cary Coutant  <ccoutant@google.com>
1085
1086         * dwp.h: New header file.
1087         * dwp.cc: New source file.
1088         * gold.h: Move shared declarations to system.h.
1089         * system.h: New header file.
1090         * Makefile.am: Add dwp.
1091         * Makefile.in: Regenerate.
1092
1093 2012-10-23  Cary Coutant  <ccoutant@google.com>
1094
1095         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1096         Dwarf_info_reader::read_from_pointer.
1097         (Dwarf_pubnames_table::read_header): Likewise.
1098         (Dwarf_pubnames_table::next_name): Likewise.
1099         (Dwarf_die::read_attributes): Likewise.
1100         (Dwarf_die::skip_attributes): Likewise.
1101         (Dwarf_info_reader::read_from_pointer): New function template.
1102         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1103         (Dwarf_pubnames_table): Likewise.
1104         (Dwarf_info_reader::read_from_pointer): New function template.
1105         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1106         Dwarf_pubnames_table ctor.
1107
1108 2012-10-23  Cary Coutant  <ccoutant@google.com>
1109
1110         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1111         abbrev_shndx.
1112         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1113         abbrev_shndx_.
1114         (Dwarf_info_reader::set_abbrev_shndx): New method.
1115         (Dwarf_info_reader::abbrev_shndx_): New data member.
1116
1117 2012-10-23  Cary Coutant  <ccoutant@google.com>
1118
1119         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1120         from object, not parameters.
1121         (Dwarf_info_reader::parse): Likewise.
1122         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1123         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1124         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1125         methods.
1126
1127 2012-10-23  Cary Coutant  <ccoutant@google.com>
1128
1129         * fileread.cc (Input_file::Input_file): New constructor.
1130         * fileread.h (class Input_file): Add new constructor.
1131
1132 2012-10-18  Alan Modra  <amodra@gmail.com>
1133
1134         PR gold/14727
1135         * object.cc (Relobj::is_section_name_included): Also match
1136         .sdata personality section.
1137
1138 2012-10-18  Alan Modra  <amodra@gmail.com>
1139
1140         * target-reloc.h (class Default_comdat_behavior): New, package up..
1141         (get_comdat_behaviour): ..this.
1142         (relocate_section): Add Relocate_comdat_behavior template arg,
1143         adjust code to suit.
1144         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1145         (Target_arm::scan_reloc_section): Likewise.
1146         * i386.cc (Target_i386::relocate_section): Likewise.
1147         * sparc.cc (Target_sparc::relocate_section): Likewise.
1148         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1149         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1150         * powerpc.cc (class Relocate_comdat_behavior): New.
1151         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1152         gold::relocate_section with new template arg.
1153
1154 2012-10-18  Alan Modra  <amodra@gmail.com>
1155
1156         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1157         dynamic relocs for GOT_TPREL got entries, without symbol if
1158         resolving locally.
1159         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1160         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1161         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1162
1163 2012-10-17  Alan Modra  <amodra@gmail.com>
1164
1165         PR gold/14726
1166         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1167
1168 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1169
1170         * layout.cc (Layout::include_section): Keep sections marked
1171         SHF_EXCLUDE when doing relocatable links.
1172
1173 2012-10-16  Alan Modra  <amodra@gmail.com>
1174
1175         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1176         (Target_powerpc::do_finalize_sections): Call it.
1177         (Output_data_save_res): New class and supporting functions.
1178         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1179         normal symbols defined in object files.
1180
1181 2012-10-12  Alan Modra  <amodra@gmail.com>
1182
1183         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1184         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1185         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1186         section if scan_opd_relocs not yet called.
1187         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1188
1189 2012-10-12  Alan Modra  <amodra@gmail.com>
1190
1191         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1192         add_local_ifunc_entry): Revert last change.
1193         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1194
1195 2012-10-05  Alan Modra  <amodra@gmail.com>
1196
1197         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1198         do_plt_address_for_global): New functions.
1199         (Output_data_got_powerpc::do_write): Don't segfault when linking
1200         statically.
1201         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1202         add_local_ifunc_entry): Return true on adding entry..
1203         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1204         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1205         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1206         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1207         set up symbols here.
1208         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1209         syms here.  Do so even when no .iplt.  Don't segfault when linking
1210         statically.
1211         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1212         new variants without reloc param.
1213         (Glink_sym_ent::Glink_sym_ent): Likewise.
1214         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1215         reloc when refs will resolve to plt call stub.
1216         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1217         R_PPC_PLTREL24 to resolve locally.
1218         (Target_powerpc::Scan::global): Correct ifunc handling.
1219         (Target_powerpc::Relocate::relocate): Correct local sym glink
1220         lookup.  Don't destroy "value" when we have a plt call stub,
1221         and when checking plt call validity.
1222         (Target_powerpc::do_dynsym_value): Simplify.
1223
1224 2012-10-05  Alan Modra  <amodra@gmail.com>
1225
1226         * i386.cc (Output_data_plt_i386::address_for_global,
1227         address_for_local): Add plt offset to returned value.  Adjust uses.
1228         * sparc.cc (Output_data_plt_sparc::address_for_global,
1229         address_for_local): Likewise.
1230         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1231         address_for_local): Likewise.
1232         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1233         address_for_local): Likewise.
1234         * target.h (Target::plt_address_for_global, plt_address_for_local):
1235         Update comment.
1236         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1237         (Output_data_got::Got_entry::write): Nor here.
1238         * output.h: Comment fix.
1239
1240 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1241
1242         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1243         global_offset_table_ value for larget got.
1244         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1245
1246 2012-09-29  Alan Modra  <amodra@gmail.com>
1247
1248         * powerpc.cc (Target_powerpc::iplt_): New output section.
1249         (Target_powerpc::iplt_section, make_iplt_section,
1250         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1251         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1252         Target_powerpc::plt_entry_count): Count iplt entries too.
1253         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1254         reloc section in constructor.  New params.
1255         (Target_powerpc::make_plt_section): Create reloc section here instead.
1256         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1257         functions.
1258         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1259         (Output_data_glink::add_entry, find_entry): New functions to
1260         deal with local syms.
1261         (Glink_sym_ent): Add support for local syms.
1262         (Output_data_glink::do_write): Handle ifunc plt entries.
1263         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1264         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1265         (Target_powerpc::Relocate::relocate): Likewise.
1266         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1267
1268 2012-09-25  Alan Modra  <amodra@gmail.com>
1269
1270         * object.h (Sized_relobj_file::adjust_local_symbol,
1271         do_adjust_local_symbol): New functions.
1272         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1273         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1274         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1275         and irregular opd entry spacing.
1276         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1277         (Global_symbol_visitor_opd): New functor.
1278         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1279         on deleted opd entries.
1280
1281 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1282
1283         * tilegx.cc: New file.
1284         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1285         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1286         * configure.tgt: Add entries for tilegx*.
1287         * configure.ac: Likewise.
1288         * Makefile.in: Rebuild.
1289         * configure: Likewise.
1290         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1291         tilegx.
1292
1293 2012-09-13  Alan Modra  <amodra@gmail.com>
1294
1295         * target-reloc.h (scan_relocs): Call scan.local for relocs
1296         against symbols in discarded sections.  Pass is_discarded
1297         param.
1298         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1299         Add is_discarded param.
1300         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1301         is_discarded to flag opd entry as discarded.  Don't emit dyn
1302         relocs on such entries.
1303         (Target_powerpc::Scan::global): Similarly detect and handle
1304         such opd entries.
1305         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1306         opd_ent_.  Update all uses.
1307         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1308         (Target_powerpc::relocate_section): Zero out discarded opd
1309         entry relocs.
1310
1311 2012-09-12  Ian Lance Taylor  <iant@google.com>
1312
1313         PR gold/14570
1314         * output.cc: Rename Output_data_got template parameter from size
1315         to got_size for all functions.  Compile all variants of
1316         Output_data_got.
1317         (Output_data_got::Got_entry::write): Correct use of size for
1318         symbol value.  Use local_is_tls rather than casting to
1319         Sized_relobj_file.
1320         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1321         (class Sized_relobj_file): Add do_local_is_tls.
1322         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1323
1324 2012-09-11  Alan Modra  <amodra@gmail.com>
1325
1326         PR gold/14566
1327         * layout.cc (Layout::set_segment_offsets): When using
1328         common-page-size alignment, ensure we are on a new max-page-size
1329         page.
1330         * output.cc (Output_segment::set_section_addresses): Use
1331         abi_pagesize, not common_pagesize for relro boundary.
1332         (Output_segment::set_offset): Likewise.
1333
1334 2012-09-11  Alan Modra  <amodra@gmail.com>
1335
1336         * output.h (Output_data_got::add_global_tls, add_local_tls,
1337         add_local_tls_pair): New functions.
1338         (Output_data_got::add_local_pair_with_rel): Remove second
1339         reloc param.  Expand comment.
1340         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1341         use_plt_or_tls_offset_, similarly for constructor param.
1342         (Output_data_got::Got_entry::write): Add got_index param.
1343         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1344         add_local_tls_pair): New functions.
1345         (Output_data_got::Got_entry::write): Handle tls symbols
1346         with use_plt_or_tls_offset_ set specially.
1347         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1348         (Output_data_got::do_write): Replace iterator with index, pass
1349         index to entry write function.
1350         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1351         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1352         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1353         call.
1354         * i386.cc (Target_i386::Scan::local): Likewise.
1355         * sparc.cc (Target_sparc::Scan::local): Likewise.
1356         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1357         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1358         do_tls_offset_for_global): New functions.
1359         (Target_powerpc::Scan::local): Correct TLS relocations and got
1360         entry values.
1361         (Target_powerpc::Scan::global): Don't emit unnecessary
1362         dynamic relocations on TLS GOT entries.
1363
1364 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1365
1366         * config.in: Disable sanity check for kfreebsd.
1367
1368 2012-09-10  Sterling Augustine  <saugustine@google.com>
1369
1370         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1371         (Gdb_index::pubtypes_read): New parameter.
1372         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1373         to calls.
1374         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1375         pubtypes_object_.
1376
1377 2012-09-09  Alan Modra  <amodra@gmail.com>
1378
1379         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1380         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1381         * gc.h (gc_process_relocs): Call target gc_add_reference.
1382         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1383         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1384         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1385         unnecessary cast.
1386         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1387         to cater for when we don't need code offset.  Update use.
1388         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1389         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1390         set_opd_valid): New functions.
1391         (Target_powerpc::do_gc_add_reference): New function.
1392         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1393         stashed refs.
1394         (Target_powerpc::do_gc_mark_symbol): New function.
1395
1396 2012-09-06  Cary Coutant  <ccoutant@google.com>
1397
1398         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1399         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1400         (Dwarf_die::skip_attributes): Likewise.
1401         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1402         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1403         (main): Call it.
1404         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1405
1406 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1407
1408         * testsuite/script_test_3.t: Add .got.plt output section
1409         statement.
1410         * testsuite/script_test_4.t: Likewise.
1411
1412 2012-09-05  Alan Modra  <amodra@gmail.com>
1413
1414         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1415         update all uses and lose "enum" when using type.
1416
1417 2012-09-05  Alan Modra  <amodra@gmail.com>
1418
1419         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1420         * configure: Regenerate.
1421         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1422         (plugin_final_layout.stdout): Likewise.
1423         (memory_test): Set page sizes to 0x1000.
1424         * testsuite/Makefile.in: Regenerate.
1425         * testsuite/discard_locals_test.sh: Add FIXME comment.
1426         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1427         * testsuite/pr14265.t: Add .got output section statement.
1428         * testsuite/script_test_2.t: Likewise.
1429         * testsuite/script_test_3.t: Likewise.
1430         * testsuite/script_test_4.t: Likewise.
1431         * testsuite/script_test_5.t: Likewise.
1432         * testsuite/script_test_6.t: Likewise.
1433         * testsuite/script_test_7.t: Likewise.
1434         * testsuite/script_test_9.t: Likewise.
1435
1436 2012-09-05  Alan Modra  <amodra@gmail.com>
1437
1438         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1439         (Powerpc_relocate_functions::Status): New typedef.
1440         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1441         (Target_powerpc::Scan::local): Handle REL64.
1442         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1443         for REL32 and REL64.
1444         (Target_powerpc::symval_for_branch): New function, extracted from..
1445         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1446         checks.  Report overflow errors.
1447
1448 2012-09-05  Alan Modra  <amodra@gmail.com>
1449
1450         * object.h (Sized_relobj_file::emit_relocs): Delete.
1451         (Sized_relobj_file::emit_relocs_reltype): Delete.
1452         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1453         relocate_relocs for --emit-relocs.
1454         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1455         * output.h: Update comment.
1456         (Output_segment::first_section): New function.
1457         (Output_segment::first_section_load_address): Use first_section.
1458         * output.cc (Output_segment::first_section): New function extracted..
1459         (Output_segment::first_section_load_address): ..from here.  Delete.
1460         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1461         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1462         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1463         adjust call to target.h function.
1464         * i386.cc (Target_i386): Likewise.
1465         * sparc.cc (Target_sparc): Likewise.
1466         * x86_64.cc (Target_x86_64): Likewise.
1467         * powerpc.cc (Target_powerpc): Likewise.
1468         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1469         first tls section has section symbol for optimised local dynamic
1470         output relocs.
1471         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1472         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1473         optimised tls code.
1474         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1475         Rename to relocate_relocs.  Update error message.
1476
1477 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1478
1479         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1480         --just-symbols.
1481
1482 2012-08-31  Alan Modra  <amodra@gmail.com>
1483
1484         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1485         (Powerpc_relobj::toc_base_offset): New stub function.
1486         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1487         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1488         (Target_powerpc::Relocate::enum skip_tls): New.
1489         (Target_powerpc::call_tls_get_addr_): New var.
1490         (Target_powerpc::is_branch_reloc): Move to file scope.
1491         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1492         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1493         New functions.
1494         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1495         (powerpc_info): Correct common_pagesize for ppc64.
1496         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1497         (Powerpc_relocate_functions): Add overflow check enums and functions.
1498         Add non-shift version of rela, rela_ua.  Delete all rel public
1499         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1500         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1501         addr16_ha3, addr14 functions.
1502         (Output_data_got_powerpc::add_constant_pair): New function.
1503         (Output_data_got_powerpc::got_base_offset): Likewise.
1504         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1505         (instruction constants): Sort, add some more.
1506         (Output_data_glink::do_write): Add and use Address typedef.  Use
1507         object->toc_base_offset() stub for 64-bit.
1508         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1509         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1510         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1511         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1512         Always treat .opd relocs as against locally defined symbol.
1513         Correct condition for RELATIVE relocs.
1514         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1515         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1516         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1517         calculations.  Handle TLS relocs, and more.  Add overflow
1518         checking and adjust for Powerpc_relocate_functions changes.
1519         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1520         Reinstate --emit-relocs code with FIXME.
1521
1522 2012-08-30  Alan Modra  <amodra@gmail.com>
1523
1524         * layout.cc (Layout::set_segment_offsets): Set p_align to
1525         abi_pagesize, not common_pagesize.
1526         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1527         to determine whether file header can go in segment.
1528
1529 2012-08-30  Alan Modra  <amodra@gmail.com>
1530
1531         * output.h (Output_reloc::Output_reloc <output section>): Add
1532         is_relative param.  Adjust calls.
1533         (Output_reloc::add_output_section_relative): New functions.
1534         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1535         is_relative.
1536         (Output_reloc::symbol_value): Handle SECTION_CODE.
1537
1538 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1539
1540         * gold.cc (queue_middle_tasks): Call layout again when unique
1541         segments for sections is desired.
1542         * layout.cc (Layout::Layout): Initialize new members.
1543         (Layout::get_output_section_flags): New function.
1544         (Layout::choose_output_section): Call get_output_section_flags.
1545         (Layout::layout): Make output section for mapping to a unique segment.
1546         (Layout::insert_section_segment_map): New function.
1547         (Layout::attach_allocated_section_to_segment): Make unique segment for
1548         output sections marked so.
1549         (Layout::segment_precedes): Check for unique segments when sorting.
1550         * layout.h (Layout::Unique_segment_info): New struct.
1551         (Layout::Section_segment_map): New typedef.
1552         (Layout::insert_section_segment_map): New function.
1553         (Layout::get_output_section_flags): New function.
1554         (Layout::is_unique_segment_for_sections_specified): New function.
1555         (Layout::set_unique_segment_for_sections_specified): New function.
1556         (Layout::unique_segment_for_sections_specified_): New member.
1557         (Layout::section_segment_map_): New member.
1558         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1559         Rename is_gc_pass_one to is_pass_one.
1560         Rename is_gc_pass_two to is_pass_two.
1561         Rename is_gc_or_icf to is_two_pass.
1562         Check for which pass based on whether symbols data is present.
1563         Make it two pass when unique segments for sections is desired.
1564         * output.cc (Output_section::Output_section): Initialize new
1565         members.
1566         * output.h (Output_section::is_unique_segment): New function.
1567         (Output_section::set_is_unique_segment): New function.
1568         (Output_section::is_unique_segment_): New member.
1569         (Output_section::extra_segment_flags): New function.
1570         (Output_section::set_extra_segment_flags): New function.
1571         (Output_section::extra_segment_flags_): New member.
1572         (Output_section::segment_alignment): New function.
1573         (Output_section::set_segment_alignment): New function.
1574         (Output_section::segment_alignment_): New member.
1575         (Output_segment::Output_segment): Initialize is_unique_segment_.
1576         (Output_segment::is_unique_segment): New function.
1577         (Output_segment::set_is_unique_segment): New function.
1578         (Output_segment::is_unique_segment_): New member.
1579         * plugin.cc (allow_unique_segment_for_sections): New function.
1580         (unique_segment_for_sections): New function.
1581         (Plugin::load): Add new functions to transfer vector.
1582         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1583         * Makefile.in: Regenerate.
1584         * testsuite/plugin_final_layout.sh: Check if unique segment
1585         functionality works.
1586         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1587         are available.
1588         (allow_unique_segment_for_sections): New global.
1589         (unique_segment_for_sections): New global.
1590         (claim_file_hook): Call allow_unique_segment_for_sections.
1591         (all_symbols_read_hook): Call unique_segment_for_sections.
1592
1593 2012-08-22  Cary Coutant  <ccoutant@google.com>
1594
1595         * layout.cc (Layout::include_section): Don't assert on GROUP
1596         sections with --emit-relocs.
1597
1598 2012-08-21  Cary Coutant  <ccoutant@google.com>
1599
1600         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1601         if --export-dynamic-symbol names an undef symbol.
1602
1603 2012-08-18  Alan Modra  <amodra@gmail.com>
1604
1605         * powerpc.cc: Formatting and white space.
1606         (Powerpc_relobj): Rename got2_section_ to special_.
1607         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1608         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1609         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1610         (Target_powerpc): Add Address typedef and invalid_address.  Use
1611         throughout.
1612         (Target_powerpc::is_branch_reloc): New function.
1613         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1614         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1615         for dst_mask, value and addend.
1616         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1617         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1618         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1619         uint16_t for 24-bit offset.  Use get_output_section_offset and
1620         check return.
1621         (Target_powerpc::Scan::local): Handle more relocs.
1622         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1623         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1624         Plug in toc restoring insn after plt calls.  Translate branches
1625         to function descriptor symbols to corresponding entry point.
1626         (Target_powerpc::relocate_for_relocatable): Check return from
1627         get_output_section_offset.
1628         * symtab.h: Comment typo.
1629
1630 2012-08-14  Ian Lance Taylor  <iant@google.com>
1631
1632         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1633         unsupported_relocal_local to call unsupported_reloc_global.
1634
1635 2012-08-14  Nick Clifton  <nickc@redhat.com>
1636
1637         PR ld/14265
1638         * script-sections.cc (Sections_element::output_section_name): Add
1639         keep return parameter.
1640         (Output_section_element::match_name): Add keep return parameter.
1641         Return the value of the keep_ member.
1642         * script-sections.h (class Output_section): Update
1643         output_section_name prototype.
1644         * layout.cc (Layout::keep_input_section): New public member
1645         function.
1646         (Layout::choose_output_section): Pass keep parameter to
1647         output_section_name.
1648         * layout.h (class Layout): Add keep_input_section.
1649         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1650         sections.
1651         * testsuite/Makefile.am: Add a test.
1652         * testsuite/Makefile.in: Regenerate.
1653         * testsuite/pr14265.c: Source file for the test.
1654         * testsuite/pr14265.t: Linker script for the test.
1655         * testsuite/pr14265.sh: Shell script for the test.
1656
1657 2012-08-14  Alan Modra  <amodra@gmail.com>
1658
1659         * target.h (Target::output_section_name): New function.
1660         (Target::do_output_section_name): New function.
1661         * layout.cc (Layout::choose_output_section): Call the above.
1662         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1663
1664 2012-08-14  Alan Modra  <amodra@gmail.com>
1665
1666         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1667         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1668         for replace_constant call.
1669         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1670         (Output_data_glink::do_print_to_mapfile): New function.
1671         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1672         (Target_powerpc::Relocate::relocate): Likewise.
1673
1674 2012-08-14  Alan Modra  <amodra@gmail.com>
1675
1676         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1677         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1678         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1679         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1680         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1681         here.
1682         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1683         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1684         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1685         here.
1686         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1687         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1688
1689 2012-08-12  Alan Modra  <amodra@gmail.com>
1690
1691         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1692         (glink insn constants): Use uint32_t.
1693         (Output_data_glink::add_entry): Use insert, not [] operator.
1694
1695 2012-08-11  Alan Modra  <amodra@gmail.com>
1696
1697         * object.h (Sized_relobj_file::find_shdr): New function.
1698         (Sized_relobj_file::find_special_sections): New function.
1699         * object.cc (Sized_relobj_file::find_shdr): New function.
1700         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1701         (Sized_relobj_file::find_special_sections): New function, split out..
1702         (Sized_relobj_file::do_read_symbols): ..from here.
1703         * output.h (Output_data_got::replace_constant): New function.
1704         (Output_data_got::num_entries): New function.
1705         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1706         (Output_data_got::got_offset): Protected rather than private.
1707         (Output_data_got::replace_got_entry): New function.
1708         * output.cc (Output_data_got::replace_got_entry): New function.
1709         * powerpc.cc (class Powerpc_relobj): New.
1710         (class Powerpc_relocate_functions): Delete all psymval variants or
1711         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1712         Implement _ha functions using corresponding _hi function.
1713         (Powerpc_relobj::find_special_sections): New function.
1714         (Target_powerpc::do_make_elf_object): New function.
1715         (class Output_data_got_powerpc): New.
1716         (class Output_data_glink): New.
1717         (class Powerpc_scan_relocatable_reloc): New.
1718         Many more changes througout file.
1719
1720 2012-08-09  Nick Clifton  <nickc@redhat.com>
1721
1722         * po/vi.po: Updated Vietnamese translation.
1723
1724 2012-08-07  Ian Lance Taylor  <iant@google.com>
1725
1726         * layout.cc (Layout::add_target_dynamic_tags): If
1727         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1728         plt_rel.
1729
1730 2012-07-30  Nick Clifton  <nickc@redhat.com>
1731
1732         * po/gold.pot: Updated template.
1733         * po/es.po: Updated Spanish translation.
1734
1735 2012-07-18  Cary Coutant  <ccoutant@google.com>
1736
1737         PR gold/14344
1738         * configure.ac: Add check for -gpubnames support.
1739         * configure: Regenerate.
1740         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1741         support; force -gno-pubnames.
1742         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1743         support.
1744         (gdb_index_test_4): New test.
1745         * testsuite/Makefile.in: Regenerate.
1746         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1747         * testsuite/gdb_index_test_2.sh: Likewise.
1748         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1749         * testsuite/gdb_index_test_4.sh: New script.
1750         * testsuite/gdb_index_test_comm.sh: New script with common code;
1751         don't look for space after colon.
1752
1753 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1754
1755         * gold.cc (queue_middle_tasks): Update function order only after
1756         deferred objects due to plugins are processed.
1757
1758 2012-07-11  Ian Lance Taylor  <iant@google.com>
1759
1760         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1761         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1762         (Target_arm::scan_reloc_for_stub): Likewise.
1763         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1764         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1765         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1766         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1767         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1768
1769 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1770             Ian Lance Taylor  <iant@google.com>
1771
1772         PR gold/14309
1773         * configure.ac: Test whether std::tr1::hash<off_t> works.
1774         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1775         needed.
1776         * output.h (class Output_fill): Add virtual destructor.
1777         * configure, config.in: Rebuild.
1778
1779 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1780
1781         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1782
1783 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1784
1785         * plugin.cc (Plugin::load): Handle position independent executables.
1786
1787 2012-06-06  Cary Coutant  <ccoutant@google.com>
1788
1789         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1790         add .debug_macro.
1791         (lines_only_debug_sections): Likewise.
1792         (gdb_fast_lookup_sections): New static array.
1793         (is_gdb_debug_section): Rename formal parameter.
1794         (is_lines_only_debug_section): Likewise.
1795         (is_gdb_fast_lookup_section): New function.
1796         (Layout::include_section): Check for ".zdebug_" prefix; pass
1797         section name suffix to is_gdb_debug_section, et al.; check for
1798         fast-lookup sections when building .gdb_index.
1799         * options.h (--strip-debug-gdb): Update GDB version number.
1800
1801 2012-06-06  Cary Coutant  <ccoutant@google.com>
1802
1803         * configure.ac: Add check for fallocate.
1804         * configure: Regenerate.
1805         * config.in: Regenerate.
1806
1807         * options.h (class General_options): Add --mmap-output-file and
1808         --posix-fallocate options.
1809         * output.cc: (posix_fallocate): Remove; replace with...
1810         (gold_fallocate): New function.
1811         (Output_file::map_no_anonymous): Call gold_fallocate.
1812         (Output_file::map): Check --mmap-output-file option.
1813
1814 2012-06-05  Jing Yu  <jingyu@google.com>
1815
1816         * gold.h (textdomain): Add do {} to empty while(0).
1817         (bindtextdomain): Likewise.
1818
1819 2012-06-04  Cary Coutant  <ccoutant@google.com>
1820
1821         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1822         has_dynsym_index.
1823
1824 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1825
1826         * symtab.cc (Symbol_table::define_special_symbol):
1827         Initialize *poldsym to prevent uninitialized variable errors.
1828
1829 2012-05-23  Cary Coutant  <ccoutant@google.com>
1830
1831         * layout.cc (Layout::section_name_mapping): Add rules to handle
1832         exact match on .data.rel.ro.local or .data.rel.ro.
1833         (Layout::output_section_name): Check for exact matches.
1834
1835 2012-05-23  Cary Coutant  <ccoutant@google.com>
1836
1837         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1838         more carefully.
1839
1840 2012-05-22  Cary Coutant  <ccoutant@google.com>
1841
1842         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1843         object before exporting symbol.
1844
1845 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1846
1847         * testsuite/tls_test.cc: Include "config.h" first.
1848         * testsuite/tls_test_c.c: Likewise.
1849
1850 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1851             Nick Clifton  <nickc@redhat.com>
1852
1853         PR 14072
1854         * configure.in: Add check that sysdep.h has been included before
1855         any system header files.
1856         * configure: Regenerate.
1857         * config.in: Regenerate.
1858
1859 2012-05-14  Cary Coutant  <ccoutant@google.com>
1860
1861         * layout.cc (Layout::make_output_section): Mark .tdata section
1862         as RELRO.
1863         * testsuite/relro_test.cc: Add a TLS variable.
1864
1865 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1866
1867         PR gold/14091
1868         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1869         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1870         R_X86_64_64.
1871
1872 2012-05-08  Cary Coutant  <ccoutant@google.com>
1873
1874         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1875         (lines_only_debug_sections): Likewise.
1876
1877 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1878
1879         * nacl.cc: New file.
1880         * nacl.h: New file.
1881         * Makefile.am (CCFILES, HFILES): Add them.
1882         * Makefile.in: Regenerate.
1883         * i386.cc (Output_data_plt_i386_nacl): New class.
1884         (Output_data_plt_i386_nacl_exec): New class.
1885         (Output_data_plt_i386_nacl_dyn): New class.
1886         (Target_i386_nacl): New class.
1887         (Target_selector_i386_nacl): New class.
1888         (target_selector_i386): Use it instead of Target_selector_i386.
1889         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1890         (Target_x86_64_nacl): New class.
1891         (Target_selector_x86_64_nacl): New class.
1892         (target_selector_x86_64, target_selector_x32): Use it instead of
1893         Target_selector_x86_64.
1894         * arm.cc (Output_data_plt_arm_nacl): New class.
1895         (Target_arm_nacl): New class.
1896         (Target_selector_arm_nacl): New class.
1897         (target_selector_arm, target_selector_armbe): Use it instead of
1898         Target_selector_arm.
1899
1900         * target-select.cc (select_target): Take new Input_file* and off_t
1901         arguments, pass them on to recognize method of selector.
1902         * object.cc (make_elf_sized_object): Update caller.
1903         * parameters.cc (parameters_force_valid_target): Likewise.
1904         * incremental.cc (make_sized_incremental_binary): Likewise.
1905         * target-select.h: Update decl.
1906         (Target_selector::recognize): Take new Input_file* argument,
1907         pass it on to do_recognize.
1908         (Target_selector::do_recognize): Take new Input_file* argument.
1909         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1910         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1911         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1912         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1913
1914         * target.h (Target::Target_info): New members isolate_execinstr
1915         and rosegment_gap.
1916         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1917         * arm.cc (Target_arm::arm_info): Update initializer.
1918         * i386.cc (Target_i386::i386_info): Likewise.
1919         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1920         * sparc.cc (Target_sparc::sparc_info): Likewise.
1921         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1922         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1923         * layout.cc (Layout::attach_allocated_section_to_segment):
1924         Take new const Target* argument.  If target->isolate_execinstr(), act
1925         like --rosegment.
1926         (Layout::find_first_load_seg): Take new const Target* argument;
1927         if target->isolate_execinstr(), reject PF_X segments.
1928         (Layout::relaxation_loop_body): Update caller.
1929         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1930         reset file offset to zero when we hit LOAD_SEG, and then do a second
1931         loop over the segments before LOAD_SEG to reassign offsets after
1932         addresses have been determined.  Handle target->rosegment_gap().
1933         (Layout::attach_section_to_segment): Take new const Target* argument;
1934         pass it to attach_allocated_section_to_segment.
1935         (Layout::make_output_section): Update caller.
1936         (Layout::attach_sections_to_segments): Take new const Target* argument;
1937         pass it to attach_section_to_segment.
1938         * gold.cc (queue_middle_tasks): Update caller.
1939         * layout.h (Layout): Update method decls with new arguments.
1940
1941         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1942         Target_info pointer to use.
1943         (Target_arm::do_make_data_plt): New virtual method.
1944         (Target_arm::make_data_plt): New method that calls it.
1945         (Target_arm::make_plt_entry): Use it.
1946         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1947         for the section alignment.
1948         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1949         method.
1950         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1951         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1952         method.
1953         (Output_data_plt_arm::get_plt_entry_size): Call it.
1954         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1955         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1956         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1957         method.
1958         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1959         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1960         method instead of sizeof(plt_entry).
1961         (Output_data_plt_arm::add_entry): Likewise.
1962         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1963         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1964         than static method.
1965         (Target_arm::plt_entry_size): Likewise.
1966         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1967         Move to ...
1968         (Output_data_plt_arm_standard): ... here, new class.
1969         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1970         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1971         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1972
1973         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1974         Take additional argument for the PLT entry size.
1975         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1976         Use get_plt_entry_size method rather than plt_entry_size variable.
1977         (Output_data_plt_x86_64::reserve_slot): Likewise.
1978         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1979         (Output_data_plt_x86_64::add_entry): Likewise.
1980         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1981         (Output_data_plt_x86_64::address_for_global): Likewise.
1982         (Output_data_plt_x86_64::address_for_local): Likewise.
1983         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1984         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1985         Make method non-static.
1986         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1987         method.
1988         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1989         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1990         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1991         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1992         virtual method.
1993         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1994         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1995         virtual method.
1996         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1997         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1998         virtual method.
1999         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2000         (Output_data_plt_x86_64::plt_entry_size)
2001         (Output_data_plt_x86_64::first_plt_entry)
2002         (Output_data_plt_x86_64::plt_entry)
2003         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2004         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2005         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2006         (Output_data_plt_x86_64_standard): ... here, new class.
2007         (Target_x86_64::Target_x86_64): Take optional argument for the
2008         Target_info pointer to use.
2009         (Target_x86_64::do_make_data_plt): New virtual method.
2010         (Target_x86_64::make_data_plt): New method to call it.
2011         (Target_x86_64::init_got_plt_for_update): Use that.
2012         Call this->plt_->add_eh_frame method here.
2013         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2014         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2015         rather than static method.
2016         (Target_x86_64::plt_entry_size): Likewise.
2017         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2018         rather than plt_entry_size variable.  Move guts of PLT filling to...
2019         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2020         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2021         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2022
2023         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2024         additional argument for the section alignment.
2025         Don't do add_eh_frame_for_plt here.
2026         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2027         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2028         variable.
2029         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2030         method.
2031         (Output_data_plt_i386::get_plt_entry_size): Call it.
2032         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2033         (Output_data_plt_i386::add_eh_frame): New method to call it.
2034         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2035         method.
2036         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2037         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2038         method.
2039         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2040         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2041         method instead of plt_entry_size.
2042         (Output_data_plt_i386::plt_entry_size)
2043         (Output_data_plt_i386::plt_eh_frame_fde_size)
2044         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2045         (Output_data_plt_i386_standard): ... here, new class.
2046         (Output_data_plt_i386_exec): New class.
2047         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2048         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2049         (Output_data_plt_i386::exec_plt_entry): Move to ...
2050         (Output_data_plt_i386_exec::plt_entry): ... here.
2051         (Output_data_plt_i386_dyn): New class.
2052         (Output_data_plt_i386::first_plt_entry): Move to ...
2053         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2054         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2055         (Output_data_plt_i386_dyn::plt_entry): ... here.
2056         (Target_i386::Target_i386): Take optional argument for the Target_info
2057         pointer to use.
2058         (Target_i386::do_make_data_plt): New virtual method.
2059         (Target_i386::make_data_plt): New method to call it.
2060         (Target_i386::make_plt_section): Use that.
2061         Call this->plt_->add_eh_frame method here.
2062         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2063         rather than plt_entry_size variable.
2064         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2065         (Output_data_plt_i386::address_for_local): Likewise.
2066         (Output_data_plt_i386::do_write): Likewise.
2067         Move guts of PLT filling to...
2068         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2069         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2070         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2071         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2072
2073 2012-05-01  Cary Coutant  <ccoutant@google.com>
2074
2075         * dwarf_reader.cc (Dwarf_die::read_attributes)
2076         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2077         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2078         * reduced_debug_output.cc
2079         (Output_reduced_debug_info_section::get_die_end): Remove
2080         DW_FORM_GNU_ref_index.  Add default case.
2081
2082 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2083
2084         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2085         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2086         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2087         DW_AT_high_pc as offset from DW_AT_low_pc.
2088
2089         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2090         * testsuite/Makefile.in: Regenerate.
2091         * testsuite/gdb_index_test_3.c: New test source file.
2092         * testsuite/gdb_index_test_3.sh: New test source file.
2093
2094 2012-04-25  Ian Lance Taylor  <iant@google.com>
2095
2096         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2097         pointer.
2098         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2099         as a class, not a struct.
2100         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2101         (Target_arm::apply_cortex_a8_workaround): Likewise.
2102         * gc.h: Declare Reloc_types as a struct, not a class.
2103         * object.h: Declare Symbols_data as a struct.
2104         * reloc.h: Declare Read_relocs_data as a struct.
2105         * target.h: Declare Relocate_info as a struct.
2106
2107 2012-04-24  David S. Miller  <davem@davemloft.net>
2108
2109         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2110         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2111         and R_SPARC_WPLT30.
2112
2113 2012-04-24  Cary Coutant  <ccoutant@google.com>
2114
2115         * incremental-dump.cc (find_input_containing_global): Replace
2116         magic number with symbolic constant.
2117         (dump_incremental_inputs): Update version number.
2118         * incremental.cc (Output_section_incremental_inputs): Update version
2119         number; import symbolic constants from Incremental_inputs_reader.
2120         (Incremental_inputs::create_data_sections): Align relocations
2121         section correctly for 64-bit targets.
2122         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2123         constants; add padding.
2124         (Output_section_incremental_inputs::write_header): Add assert for
2125         header_size.
2126         (Output_section_incremental_inputs::write_input_files): Add assert
2127         for input_entry_size.
2128         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2129         add assert for object_info_size, input_section_entry_size,
2130         global_sym_entry_size.
2131         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2132         for data structure sizes; use them.
2133         (Incremental_input_entry_reader): Import symbolic constants from
2134         Incremental_inputs_reader; use them.
2135
2136 2012-04-23  David S. Miller  <davem@davemloft.net>
2137
2138         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2139         and elf_flags_set_.
2140         (Target_sparc::Target_sparc): Initialize new fields.
2141         (Target_sparc::do_make_elf_object): New function.
2142         (Target_sparc::do_adjust_elf_header): New function.
2143
2144 2012-04-23  Cary Coutant  <ccoutant@google.com>
2145
2146         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2147         CU range table of gdb index.
2148
2149 2012-04-20  David S. Miller  <davem@davemloft.net>
2150
2151         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2152         instead of false.
2153
2154 2012-04-16  David S. Miller  <davem@davemloft.net>
2155
2156         * sparc.cc (Target_sparc::got_address): New function.
2157         (Sparc_relocate_functions::gdop_hix22): New function.
2158         (Sparc_relocate_functions::gdop_lox10): New function.
2159         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2160         relocs.
2161         (Target_sparc::Scan::local): Likewise if the global symbol is not
2162         preemptible and is not IFUNC.
2163         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2164         transformations for local and non-preemptible non-IFUNC global
2165         symbols.
2166
2167         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2168         writing out 64-bit part of ranges.
2169
2170         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2171         -fpic and -fpie respectively.
2172         * Makefile.in: Regenerate.
2173
2174         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2175         (Target_sparc::Target_sparc): Initialize new field.
2176         (Target_sparc::do_plt_section_for_global): New function.
2177         (Target_sparc::do_plt_section_for_local): New function.
2178         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2179         (Target_sparc::make_plt_section): New function, broken out of
2180         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2181         (Target_sparc::make_plt_entry): Call make_plt_section.
2182         (Target_sparc::make_local_ifunc_plt_entry): New function.
2183         (Target_sparc::rela_ifunc_section): New function.
2184         (Target_sparc::plt_section): Remove const.
2185         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2186         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2187         and ifunc_count_ fields.
2188         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2189         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2190         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2191         (Output_data_plt_sparc::rela_ifunc): New function.
2192         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2193         (Output_data_plt_sparc::has_ifunc_section): New function.
2194         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2195         (Output_data_plt_sparc::address_for_global): New function.
2196         (Output_data_plt_sparc::address_for_local): New function.
2197         (Output_data_plt_sparc::plt_index_to_offset): New function.
2198         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2199         and entry_count.
2200         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2201         entry_count.
2202         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2203         R_SPARC_JMP_IREL to switch.
2204         (Target_sparc::Scan::check_non_pic): Likewise.
2205         (Target_sparc::Scan::local): Handle IFUNC symbols.
2206         (Target_sparc::Scan::local): Likewise.
2207         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2208         and plt_address_for_local.
2209         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2210         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2211
2212         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2213         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2214         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2215         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2216         global relocs too.
2217         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2218         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2219         calls.
2220         * sparc.cc (Target_sparc::Scan::global): Likewise.
2221         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2222
2223 2012-04-16  Cary Coutant  <ccoutant@google.com>
2224
2225         * archive.cc (Library_base::should_include_member): Check for
2226         --export-dynamic-symbol.
2227         * options.h (class General_options): Add --export-dynamic-symbol.
2228         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2229         --export-dynamic-symbol.
2230         (Symbol_table::gc_mark_undef_symbols): Likewise.
2231         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2232
2233 2012-04-12  David S. Miller  <davem@davemloft.net>
2234
2235         * sparc.cc (Reloc::wdisp10): New relocation method.
2236         (Reloc::h34): Likewise.
2237         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2238         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2239         R_SPARC_WDISP10.
2240         (Target_sparc::Scan::local): Likewise.
2241         (Target_sparc::Scan::global): Likewise.
2242         (Target_sparc::Relocate::relocate): Likewise.
2243
2244 2012-04-09  Cary Coutant  <ccoutant@google.com>
2245
2246         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2247         low_pc == 0.
2248
2249 2012-04-06  Ian Lance Taylor  <iant@google.com>
2250
2251         * timer.cc: #include <unistd.h>.
2252
2253 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2254
2255         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2256         * config.in: Regenerate.
2257         * configure: Regenerate.
2258
2259 2012-04-05  Nick Clifton  <nickc@redhat.com>
2260
2261         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2262         (AM_LC_MESSAGES): Add.
2263         * aclocal.m4: Regenerate.
2264         * config.in: Regenerate.
2265         * configure: Regenerate.
2266
2267 2012-03-21  Cary Coutant  <ccoutant@google.com>
2268
2269         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2270         * Makefile.in: Regenerate.
2271         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2272         (Sized_elf_reloc_mapper::symbol_section): New function.
2273         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2274         (make_elf_reloc_mapper): New function.
2275         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2276         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2277         (Dwarf_abbrev_table::do_get_abbrev): New function.
2278         (Dwarf_ranges_table::read_ranges_table): New function.
2279         (Dwarf_ranges_table::read_range_list): New function.
2280         (Dwarf_pubnames_table::read_section): New function.
2281         (Dwarf_pubnames_table::read_header): New function.
2282         (Dwarf_pubnames_table::next_name): New function.
2283         (Dwarf_die::Dwarf_die): New function.
2284         (Dwarf_die::read_attributes): New function.
2285         (Dwarf_die::skip_attributes): New function.
2286         (Dwarf_die::set_name): New function.
2287         (Dwarf_die::set_linkage_name): New function.
2288         (Dwarf_die::attribute): New function.
2289         (Dwarf_die::string_attribute): New function.
2290         (Dwarf_die::int_attribute): New function.
2291         (Dwarf_die::uint_attribute): New function.
2292         (Dwarf_die::ref_attribute): New function.
2293         (Dwarf_die::child_offset): New function.
2294         (Dwarf_die::sibling_offset): New function.
2295         (Dwarf_info_reader::check_buffer): New function.
2296         (Dwarf_info_reader::parse): New function.
2297         (Dwarf_info_reader::do_parse): New function.
2298         (Dwarf_info_reader::do_read_string_table): New function.
2299         (Dwarf_info_reader::lookup_reloc): New function.
2300         (Dwarf_info_reader::get_string): New function.
2301         (Dwarf_info_reader::visit_compilation_unit): New function.
2302         (Dwarf_info_reader::visit_type_unit): New function.
2303         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2304         Sized_elf_reloc_mapper.
2305         (Sized_dwarf_line_info::symbol_section): Remove function.
2306         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2307         (Sized_dwarf_line_info::read_line_mappings): Remove object
2308         parameter, adjust callers.
2309         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2310         * dwarf_reader.h: Include <sys/types.h>.
2311         (class Track_relocs): Remove forward declaration.
2312         (class Elf_reloc_mapper): New class.
2313         (class Sized_elf_reloc_mapper): New class.
2314         (class Dwarf_abbrev_table): New class.
2315         (class Dwarf_range_list): New class.
2316         (class Dwarf_ranges_table): New class.
2317         (class Dwarf_pubnames_table): New class.
2318         (class Dwarf_die): New class.
2319         (class Dwarf_info_reader): New class.
2320         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2321         (Sized_dwarf_line_info::symbol_section): Remove member function.
2322         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2323         base class.
2324         * gdb-index.cc: New source file.
2325         * gdb-index.h: New source file.
2326         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2327         and .debug_types sections, call Layout::add_to_gdb_index.
2328         (Sized_relobj_incr::do_section_name): Implement.
2329         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2330         return type; Implement.
2331         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2332         return type.
2333         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2334         parameter list and return type.
2335         (Sized_incr_dynobj::do_section_contents): Likewise.
2336         * layout.cc: Include gdb-index.h.
2337         (Layout::Layout): Initialize gdb_index_data_.
2338         (Layout::init_fixed_output_section): Check for .gdb_index section.
2339         (Layout::add_to_gdb_index): New function. Instantiate.
2340         * layout.h: Add forward declaration for class Gdb_index.
2341         (Layout::add_to_gdb_index): New member function.
2342         (Layout::gdb_index_data_): New data member.
2343         * main.cc: Include gdb-index.h.
2344         (main): Print statistics for gdb index.
2345         * object.cc (Object::section_contents): Move code into
2346         do_section_contents.
2347         (need_decompressed_section): Check for sections needed when building
2348         gdb index.
2349         (build_compressed_section_map): Likewise.
2350         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2351         gdb index.
2352         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2353         sections; call Layout::add_to_gdb_index.
2354         (Sized_relobj_file::do_decompressed_section_contents): Call
2355         do_section_contents directly.
2356         * object.h (Object::do_section_contents): Adjust parameter list and
2357         return type.
2358         (Object::do_decompressed_section_contents): Call do_section_contents
2359         directly.
2360         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2361         return type.
2362         * options.h (class General_options): Add --gdb-index option.
2363         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2364         list and return type.
2365         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2366         * reloc.h (Track_relocs::checkpoint): New function.
2367         (Track_relocs::reset): New function.
2368
2369         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2370         New test cases.
2371         * testsuite/Makefile.in: Regenerate.
2372         * testsuite/gdb_index_test.cc: New test source file.
2373         * testsuite/gdb_index_test_1.sh: New test source file.
2374         * testsuite/gdb_index_test_2.sh: New test source file.
2375
2376 2012-03-19  Doug Kwan  <dougkwan@google.com>
2377
2378         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2379         (Target_arm::do_finalize_sections): Remove code which defines
2380         __exidx_start and __exidx_end.  Make symbol table parameter
2381         anonymous as it is not used.
2382         * gold.cc (queue_middle_tasks): Call target hook to define any
2383         target-specific symbols.
2384         * target.h (Target::define_standard_symbols): New method.
2385         (Target::do_define_standard_symbols): Same.
2386         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2387         * testsuite/Makefile.in: Regenerate.
2388         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2389         and __exidx_end.
2390         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2391         relocations are generated for __exidx_start and __exidx_end.
2392
2393 2012-03-16  Doug Kwan  <dougkwan@google.com>
2394
2395         * testsuite/Makefile.am: Disable test initpri3b.
2396         * testsuite/Makefile.in: Regenerate.
2397
2398 2012-03-15  Doug Kwan  <dougkwan@google.com>
2399
2400         * arm.cc (Target_arm::got_section): Make .got section read-only
2401         if -z now is given.
2402
2403 2012-03-15  Ian Lance Taylor  <iant@google.com>
2404
2405         PR gold/13850
2406         * layout.cc (Layout::make_output_section): Correctly mark
2407         SHT_INIT_ARRAY, et. al., as relro.
2408
2409 2012-03-14  Doug Kwan  <dougkwan@google.com>
2410
2411         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2412         dynamic relocations for protected symbols in shared objects.
2413
2414 2012-03-13  Ian Lance Taylor  <iant@google.com>
2415
2416         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2417         keep the larger alignment.
2418
2419 2012-03-12  Cary Coutant  <ccoutant@google.com>
2420
2421         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2422         handling of DW_LNE_define_file.
2423
2424 2012-03-12  Cary Coutant  <ccoutant@google.com>
2425
2426         * reduced_debug_output.cc
2427         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2428         codes to switch.
2429
2430 2012-02-29  Cary Coutant  <ccoutant@google.com>
2431
2432         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2433
2434 2012-02-29  Cary Coutant  <ccoutant@google.com>
2435
2436         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2437         Call Object::decompressed_section_contents.
2438         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2439         New dtor.
2440         (Sized_dwarf_line_info::buffer_start_): New data member.
2441         * merge.cc (Output_merge_data::do_add_input_section): Call
2442         Object::decompressed_section_contents.
2443         (Output_merge_string::do_add_input_section): Likewise.
2444         * object.cc (need_decompressed_section): New function.
2445         (build_compressed_section_map): Decompress sections needed later.
2446         (Sized_relobj_file::do_decompressed_section_contents): New function.
2447         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2448         * object.h (Object::decompressed_section_contents): New function.
2449         (Object::discard_decompressed_sections): New function.
2450         (Object::do_decompressed_section_contents): New function.
2451         (Object::do_discard_decompressed_sections): New function.
2452         (Compressed_section_info): New type.
2453         (Compressed_section_map): Include decompressed section contents.
2454         (Sized_relobj_file::do_decompressed_section_contents): New function.
2455         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2456
2457 2012-02-16  Cary Coutant  <ccoutant@google.com>
2458
2459         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2460         * testsuite/Makefile.in: Regenerate.
2461
2462 2012-02-14  Cary Coutant  <ccoutant@google.com>
2463
2464         * options.cc (General_options::finalize): Disallow -pie and -static.
2465
2466 2012-02-03  Doug Kwan  <dougkwan@google.com>
2467
2468         * arm.cc (Arm_relocate_functions::abs8,
2469         Arm_relocate_functions::abs16): Use
2470         Bits::has_signed_unsigned_overflow32.
2471         (Arm_relocate_functions::thm_abs8): Correct range of
2472         overflow check.
2473         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2474         in assertions.
2475
2476 2012-02-02  Doug Kwan  <dougkwan@google.com>
2477
2478         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2479         position independent outputs, not just shared objects.
2480
2481 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2482
2483         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2484         * configure: Regenerated.
2485
2486 2012-01-27  Ian Lance Taylor  <iant@google.com>
2487
2488         * reloc.h (Bits): New class with static functions, copied from
2489         namespace utils in arm.cc.
2490         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2491         instead.
2492
2493 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2494
2495         * incremental.cc (write_info_blocks): Correct relocation offset.
2496
2497 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2498
2499         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2500         (Relocate::tls_gd_to_le): Likewise.
2501
2502 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2503
2504         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2505
2506 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2507
2508         * configure.ac: Check if -mcmodel=medium works.
2509         * configure: Regenerated.
2510
2511 2012-01-24  Cary Coutant  <ccoutant@google.com>
2512
2513         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2514         definition and ...
2515         (read_unsigned_LEB_128_x): ... this new function.
2516         (read_signed_LEB_128): Replaced with inline definition and ...
2517         (read_signed_LEB_128_x): ... this new function.
2518         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2519         (read_unsigned_LEB_128): Add inline definition.
2520         (read_signed_LEB_128_x): New function.
2521         (read_signed_LEB_128): Add inline definition.
2522         * testsuite/Makefile.am (leb128_unittest): New unit test.
2523         * testsuite/Makefile.in: Regenerate.
2524         * testsuite/leb128_unittest.cc: New unit test.
2525
2526 2012-01-23  Ian Lance Taylor  <iant@google.com>
2527
2528         PR gold/13617
2529         * i386.cc (Target_i386::do_code_fill): When using a jmp
2530         instruction, pad with nop instructions.
2531         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2532
2533 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2534
2535         * x86_64.cc (gc_process_relocs): Add typename on types used in
2536         template.
2537         (scan_relocs): Likewise.
2538         (relocate_section): Likewise.
2539         (apply_relocation): Likewise.
2540
2541 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2542
2543         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2544         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2545         under x32.
2546
2547 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2548
2549         * x86_64.cc: Initial support for x32.
2550
2551 2012-01-03  Cary Coutant  <ccoutant@google.com>
2552
2553         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2554         Use abstract base class for GOT.
2555         * gold/output.h (class Output_data_got_base): New abstract base class.
2556         (class Output_data_got): Derive from new base class, adjust ctors.
2557         (Output_data_got::reserve_slot): Make virtual; rename to
2558         do_reserve_slot; Adjust callers.
2559         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2560         pointer to abstract base class.
2561         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2562
2563 2011-12-18  Ian Lance Taylor  <iant@google.com>
2564
2565         * object.h (Relobj::local_symbol_value): New function.
2566         (Relobj::local_plt_offset): New function.
2567         (Relobj::local_has_got_offset): New function.
2568         (Relobj::local_got_offset): New function.
2569         (Relobj::set_local_got_offset): New function.
2570         (Relobj::do_local_symbol_value): New pure virtual function.
2571         (Relobj::do_local_plt_offset): Likewise.
2572         (Relobj::do_local_has_got_offset): Likewise.
2573         (Relobj::do_local_got_offset): Likewise.
2574         (Relobj::do_set_local_got_offset): Likewise.
2575         (Sized_relobj::do_local_has_got_offset): Rename from
2576         local_has_got_offset.
2577         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2578         (Sized_relobj::do_set_local_got_offset): Rename from
2579         set_local_got_offset.
2580         (Sized_relobj_file::do_local_plt_offset): Rename from
2581         local_plt_offset.
2582         (Sized_relobj_file::do_local_symbol_value): New function.
2583         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2584         local_plt_offset.
2585         * output.cc (Output_data_got::Got_entry::write): Change object to
2586         Relobj.  Use local_symbol_value.
2587         (Output_data_got::add_global_with_rel): Change rel_dyn to
2588         Output_data_reloc_generic*.  Use add_global_generic.
2589         (Output_data_got::add_global_with_rela): Remove.  Change all
2590         callers to use add_global_with_rel.
2591         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2592         Output_data_reloc_generic*.  Use add_global_generic.
2593         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2594         callers to use add_global_pair_with_rel.
2595         (Output_data_got::add_local): Change object to Relobj*.
2596         (Output_data_got::add_local_plt): Likewise.
2597         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2598         change rel_dyn to Output_data_reloc_generic*.  Use
2599         add_local_generic.
2600         (Output_data_got::add_local_with_rela): Remove.  Change all
2601         callers to use all_local_with_rel.
2602         (Output_data_got::add_local_pair_with_rel): Change object to
2603         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2604         add_output_section_generic.
2605         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2606         callers to use add_local_pair_with_rel.
2607         (Output_data_got::reserve_local): Change object to Relobj*.
2608         * output.h: (class Output_data_reloc_generic): Add pure virtual
2609         declarations for add_global_generic, add_local_generic,
2610         add_output_section_generic.
2611         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2612         functions for Output_data_reloc_generic.  Update declarations for
2613         changes listed in output.cc.
2614         (class Output_data_got): Change template parameter to got_size.
2615         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2616         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2617         function.
2618         (Sized_relobj_incr::do_local_plt_offset): New function.
2619         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2620         add_global_generic.
2621
2622 2011-12-17  Cary Coutant  <ccoutant@google.com>
2623
2624         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2625         * resolve.cc (Symbol_table::resolve): Likewise.
2626         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2627         arrays.
2628         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2629
2630 2011-12-16  Ian Lance Taylor  <iant@google.com>
2631
2632         * output.h (Output_data_reloc_generic::add): Only call
2633         add_dynamic_reloc if this is a dynamic reloc section.
2634
2635 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2636
2637         PR gold/13505
2638         * target-reloc.h (apply_relocation): Replace <64, false> with
2639         <size, big_endian>.
2640
2641 2011-11-25  Nick Clifton  <nickc@redhat.com>
2642
2643         * po/it.po: New Italian translation.
2644
2645 2011-11-17  Sterling Augustine  <saugustine@google.com>
2646
2647         * script.cc (script_include_directive): Implement.
2648         (read_script_file): New local variables name and search_path. Update
2649         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2650         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2651         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2652
2653 2011-11-11  Sterling Augustine  <saugustine@google.com>
2654
2655         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2656         (file_or_sections_cmd): Likewise.
2657
2658 2011-11-11  Doug Kwan  <dougkwan@google.com>
2659
2660         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2661         if --just-symbols is given.
2662
2663 2011-11-10  Doug Kwan  <dougkwan@google.com>
2664
2665         PR gold/13362
2666         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2667         when processing data relocs.
2668         * reloc.h (Relocate_functions::rel_unaligned): New method.
2669         (Relocate_functions::pcrel_unaligned): Ditto.
2670         (Relocate_functions::rel32_unaligned): Ditto.
2671         (Relocate_functions::pcrel32_unaligned): Ditto.
2672
2673 2011-11-09  Doug Kwan  <dougkwan@google.com>
2674
2675         PR gold/13362
2676         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2677         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2678         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2679         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2680         (Relocate_functions::rel_unaligned): New.
2681         (Relocate_functions::rel32_unaligned): New.
2682         * target-reloc.h (relocate_for_relocatable): Add code to handle
2683         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2684         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2685         arm_unaligned_reloc_r): New targets.
2686         * testsuite/Makefile.in: Regenerate.
2687         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2688         linking.
2689
2690 2011-11-02  Ian Lance Taylor  <iant@google.com>
2691
2692         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2693         NATIVE_LINKER.
2694         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2695         * options.cc (General_options::finalize): Use library search path
2696         from configure script if specified.  If not native and no sysroot,
2697         only search TOOLLIBDIR.
2698         * options.h (Search_directory::Search_directory): Change name to
2699         const std::string&.
2700         (General_options::add_to_library_path_with_sysroot): Change arg to
2701         const std::string&.
2702         * configure, Makefile.in, config.in: Rebuild.
2703
2704 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2705
2706         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2707         we are working around the ARM1176 Erratum.
2708         * options.h (General_options::fix_arm1176): Add option.
2709         * testsuite/Makefile.am: Add testcases, and keep current ones
2710         working.
2711         * testsuite/Makefile.in: Regenerate.
2712         * testsuite/arm_fix_1176.s: New file.
2713         * testsuite/arm_fix_1176.sh: Likewise.
2714
2715 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2716
2717         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2718         may_use_blx_.
2719         (Target_arm::may_use_blx): Remove method.
2720         (Target_arm::set_may_use_blx): Likewise.
2721         (Target_arm::may_use_v4t_interworking): New method.
2722         (Target_arm::may_use_v5t_interworking): Likewise.
2723         (Target_arm::may_use_blx_): Remove member variable.
2724         (Arm_relocate_functions::arm_branch_common): Check for v5T
2725         interworking.
2726         (Arm_relocate_functions::thumb_branch_common): Likewise.
2727         (Reloc_stub::stub_type_for_reloc): Likewise.
2728         (Target_arm::do_finalize_sections): Correct interworking checks.
2729         * testsuite/Makefile.am: Add new tests.
2730         * testsuite/Makefile.in: Regenerate.
2731         * testsuite/arm_farcall_arm_arm.s: New test.
2732         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2733         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2734         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2735         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2736         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2737         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2738         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2739
2740 2011-10-31  Cary Coutant  <ccoutant@google.com>
2741
2742         PR gold/13023
2743         * expression.cc (Expression::eval_with_dot): Add
2744         is_section_dot_assignment parameter.
2745         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2746         absolute and assigning to dot within a section.
2747         * script-sections.cc
2748         (Output_section_element_assignment::set_section_addresses): Pass
2749         dot_section to set_if_absolute.
2750         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2751         as is_section_dot_assignment flag to eval_with_dot.
2752         (Output_section_element_dot_assignment::set_section_addresses):
2753         Likewise.
2754         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2755         parameter.  Also set value if relative to dot_section; set the
2756         symbol's output_section.
2757         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2758         parameter.  Adjust all callers.
2759         (Expression::eval_maybe_dot): Likewise.
2760         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2761         Adjust all callers.
2762         * testsuite/script_test_2.t: Test assignment of an absolute value
2763         to dot within an output section element.
2764
2765 2011-10-31  Cary Coutant  <ccoutant@google.com>
2766
2767         * options.h (class General_options): Add --[no-]gnu-unique options.
2768         * symtab.cc (Symbol_table::sized_write_globals): Convert
2769         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2770
2771 2011-10-31  Cary Coutant  <ccoutant@google.com>
2772
2773         PR gold/13359
2774         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2775         unnecessary assertion.
2776         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2777
2778 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2779
2780         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2781         gc_mark_symbol.
2782         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2783         gc_mark_symbol.
2784         Change to just keep the section associated with symbol.
2785         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2786         they are externally visible and --export-dynamic is turned on.
2787         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2788
2789 2011-10-19  Ian Lance Taylor  <iant@google.com>
2790
2791         PR gold/13163
2792         * script-sections.cc
2793         (Output_section_element_dot_assignment::needs_output_section): New
2794         function.
2795
2796 2011-10-19  Ian Lance Taylor  <iant@google.com>
2797
2798         PR gold/13204
2799         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2800         --section-start option was seen.
2801         * options.h (General_options::any_section_start): New function.
2802
2803 2011-10-18  David S. Miller  <davem@davemloft.net>
2804
2805         PR binutils/13301
2806         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2807         member to track relocation locations that have moved during TLS
2808         reloc optimizations.
2809         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2810         (Target_sparc::Relocate::relocate): Adjust view down by 4
2811         bytes if it matches reloc_adjust_addr_.
2812         (Target_sparc::Relocate::relocate_tls): Always move the
2813         __tls_get_addr call delay slot instruction forward 4 bytes when
2814         performing relaxation.
2815
2816 2011-10-18  Cary Coutant  <ccoutant@google.com>
2817
2818         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2819         (Output_file::map_no_anonymous): Check for non-zero
2820         return code from posix_fallocate.
2821
2822 2011-10-17  Cary Coutant  <ccoutant@google.com>
2823
2824         PR gold/13245
2825         * plugin.cc (is_visible_from_outside): Check for symbols
2826         referenced from dynamic objects.
2827         * resolve.cc (Symbol_table::resolve): Don't count references
2828         from dynamic objects as references from real ELF files.
2829         * testsuite/plugin_test_2.sh: Adjust expected result.
2830
2831 2011-10-17  Cary Coutant  <ccoutant@google.com>
2832
2833         * gold.cc: Include timer.h.
2834         (queue_middle_tasks): Stamp time.
2835         (queue_final_tasks): Likewise.
2836         * main.cc (main): Store timer in parameters.  Print timers
2837         for each pass.
2838         * parameters.cc (Parameters::Parameters): Initialize timer_.
2839         (Parameters::set_timer): New function.
2840         (set_parameters_timer): New function.
2841         * parameters.h (Parameters::set_timer): New function.
2842         (Parameters::timer): New function.
2843         (Parameters::timer_): New data member.
2844         (set_parameters_timer): New function.
2845         * timer.cc (Timer::stamp): New function.
2846         (Timer::get_pass_time): New function.
2847         * timer.h (Timer::stamp): New function.
2848         (Timer::get_pass_time): New function.
2849         (Timer::pass_times_): New data member.
2850
2851 2011-10-17  Cary Coutant  <ccoutant@google.com>
2852
2853         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2854         task for members of lib groups.
2855
2856 2011-10-17  Cary Coutant  <ccoutant@google.com>
2857
2858         PR gold/13288
2859         * fileread.cc (File_read::find_view): Add assert.
2860         (File_read::make_view): Move bounds check (replace with assert)...
2861         (File_read::find_or_make_view): ... to here.
2862
2863 2011-10-12  Cary Coutant  <ccoutant@google.com>
2864
2865         * output.cc (Output_file::open_base_file): Handle case where
2866         ::read returns less than requested size.
2867
2868 2011-10-10  Cary Coutant  <ccoutant@google.com>
2869
2870         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2871         Initialize defined_count_.
2872         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2873         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2874         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2875         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2876         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2877         * incremental.h (Sized_relobj_incr::defined_count_): New data
2878         member.
2879         (Sized_incr_dynobj::defined_count_): New data member.
2880         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2881         Return zeroes instead of internal error.
2882
2883 2011-10-10  Cary Coutant  <ccoutant@google.com>
2884
2885         PR gold/13249
2886         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2887         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2888         * output.h (class Output_reloc): Add use_plt_offset flag.
2889         (Output_reloc::type_): Adjust size of bit field.
2890         (Output_reloc::use_plt_offset_): New bit field.
2891         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2892         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2893         flag.  Adjust all callers.
2894         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2895         creating RELATIVE relocations.
2896
2897 2011-10-10  Nick Clifton  <nickc@redhat.com>
2898
2899         * po/es.po: Updated Spanish translation.
2900         * po/fi.po: Updated Finnish translation.
2901
2902 2011-10-03   Diego Novillo  <dnovillo@google.com>
2903
2904         * options.cc (parse_uint): Fix dereference of RETVAL.
2905
2906 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2907
2908         * layout.h (section_order_map_): New member.
2909         (get_section_order_map): New member function.
2910         * output.cc (Output_section::add_input_section): Check for patterns
2911         only when --section-ordering-file is specified.
2912         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2913         output_sections have been formed.
2914         * layout.cc (Layout_Layout): Initialize section_order_map_.
2915         * plugin.cc (update_section_order): Store order in order_map. Do not
2916         update the order.
2917         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2918         * testsuite/Makefile.in: Regenerate.
2919         * testsuite/plugin_section_order.c: New file.
2920         * testsuite/plugin_final_layout.cc: New file.
2921         * testsuite/plugin_final_layout.sh: New file.
2922
2923 2011-09-29  Cary Coutant  <ccoutant@google.com>
2924
2925         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2926         Check for NULL.
2927         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2928         symbols during incremental update.
2929         (Symbol_table::add_from_dynobj): Likewise.
2930
2931 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2932             Ian Lance Taylor  <iant@google.com>
2933
2934         * symtab.cc (Symbol_table::define_special_symbol): Always
2935         canonicalize version string.
2936
2937 2011-09-26  Cary Coutant  <ccoutant@google.com>
2938
2939         * gold.cc (queue_initial_tasks): Move option checks ...
2940         * options.cc (General_options::finalize): ... to here. Disable
2941         some options; make others fatal.
2942
2943 2011-09-26  Cary Coutant  <ccoutant@google.com>
2944
2945         gcc PR lto/47247
2946         * plugin.cc (get_symbols_v2): New function.
2947         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2948         (is_referenced_from_outside): New function.
2949         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2950         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2951         (get_symbols): Pass version parameter.
2952         (get_symbols_v2): New function.
2953         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2954         parameter.
2955         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2956         (onload): Add LDPT_GET_SYMBOLS_V2.
2957         (all_symbols_read_hook): Use get_symbols_v2; check for
2958         LDPR_PREVAILING_DEF_IRONLY_EXP.
2959         * testsuite/plugin_test_3.sh: Update expected results.
2960
2961 2011-09-23  Simon Baldwin  <simonb@google.com>
2962
2963         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2964         configuration options.
2965         * configure: Regenerate.
2966         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2967         * Makefile.in: Regenerate.
2968         * testsuite/Makefile.in: Regenerate.
2969
2970 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2971
2972         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2973
2974 2011-09-19  Cary Coutant  <ccoutant@google.com>
2975
2976         * incremental.cc (can_incremental_update): Fix typo in comment.
2977         * incremental.h (can_incremental_update): Likewise.
2978
2979 2011-09-18  Cary Coutant  <ccoutant@google.com>
2980
2981         * incremental.cc (can_incremental_update): New function.
2982         * incremental.h (can_incremental_update): New function.
2983         * layout.cc (Layout::init_fixed_output_section): Call it.
2984         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2985         * object.cc (Sized_relobj_file::do_layout): Call
2986         can_incremental_update.
2987
2988 2011-09-13  Cary Coutant  <ccoutant@google.com>
2989
2990         * configure.ac: Check for glibc support for gnu_indirect_function
2991         support with static linking, setting automake conditional
2992         IFUNC_STATIC.
2993         * Makefile.in: Regenerate.
2994         * configure: Regenerate.
2995
2996         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2997         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2998         for IFUNC_STATIC.
2999         * testsuite/Makefile.in: Regenerate.
3000
3001 2011-09-13  Cary Coutant  <ccoutant@google.com>
3002
3003         * incremental.cc (Sized_relobj_incr::do_layout): Call
3004         report_comdat_group for kept comdat sections.
3005         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3006         * testsuite/Makefile.in: Regenerate.
3007         * testsuite/incr_comdat_test_1.cc: New source file.
3008         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3009         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3010         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3011
3012 2011-09-13  Ian Lance Taylor  <iant@google.com>
3013
3014         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3015         variable external_symbols_offset.
3016
3017 2011-09-12  Ian Lance Taylor  <iant@google.com>
3018
3019         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3020         triggered if object has no symbols.
3021
3022 2011-09-09  David S. Miller  <davem@davemloft.net>
3023
3024         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3025         (Output_fill_debug_line::do_write): Likewise.
3026
3027 2011-08-29  Cary Coutant  <ccoutant@google.com>
3028
3029         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3030         casts to match formatting specs.
3031         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3032
3033 2011-08-26  Cary Coutant  <ccoutant@google.com>
3034
3035         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3036         remaining hole size when allocating.
3037         (Layout::make_output_section): Set fill methods for debug sections.
3038         * layout.h (Free_list::Free_list_node): Move from private to
3039         public.
3040         (Free_list::set_min_hole_size): New function.
3041         (Free_list::begin, Free_list::end): New functions.
3042         (Free_list::min_hole_): New data member.
3043         * output.cc: Include dwarf.h.
3044         (Output_fill_debug_info::do_minimum_hole_size): New function.
3045         (Output_fill_debug_info::do_write): New function.
3046         (Output_fill_debug_line::do_minimum_hole_size): New function.
3047         (Output_fill_debug_line::do_write): New function.
3048         (Output_section::Output_section): Initialize new data member.
3049         (Output_section::set_final_data_size): Ensure patch space is larger
3050         than minimum hole size.
3051         (Output_section::do_write): Fill holes in debug sections.
3052         * output.h (Output_fill): New class.
3053         (Output_fill_debug_info): New class.
3054         (Output_fill_debug_line): New class.
3055         (Output_section::set_free_space_fill): New function.
3056         (Output_section::free_space_fill_): New data member.
3057         * testsuite/Makefile.am (incremental_test_3): Add
3058         --incremental-patch option.
3059         (incremental_test_4): Likewise.
3060         (incremental_test_5): Likewise.
3061         (incremental_test_6): Likewise.
3062         (incremental_copy_test): Likewise.
3063         (incremental_common_test_1): Likewise.
3064         * testsuite/Makefile.in: Regenerate.
3065
3066 2011-08-26  Nick Clifton  <nickc@redhat.com>
3067
3068         * po/es.po: Updated Spanish translation.
3069
3070 2011-08-01  Cary Coutant  <ccoutant@google.com>
3071
3072         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3073         * gold/testsuite/Makefile.in: Regenerate.
3074         * gold/testsuite/justsyms_exec.c: New source file.
3075         * gold/testsuite/justsyms_lib.c: New source file.
3076
3077 2011-08-01  Cary Coutant  <ccoutant@google.com>
3078
3079         * layout.cc (Layout::set_segment_offsets): Don't realign text
3080         segment if -Ttext was specified.
3081         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3082         file type.
3083         * object.h (Sized_relobj_file::e_type): New function.
3084         (Sized_relobj_file::e_type_): New data member.
3085         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3086         base address for ET_EXEC files.
3087         * target.cc (Target::do_make_elf_object_implementation): Allow
3088         ET_EXEC files with --just-symbols option.
3089
3090 2011-07-28  Cary Coutant  <ccoutant@google.com>
3091
3092         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3093         Add thread_number parameter.
3094         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3095         * workqueue-threads.cc
3096         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3097         current thread if its thread number is greater than desired thread
3098         count.
3099         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3100         Add thread_number parameter.
3101         (Workqueue::should_cancel_thread): Likewise.
3102         (Workqueue::find_runnable_or_wait): Pass thread_number to
3103         should_cancel_thread.
3104         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3105         parameter.
3106
3107 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3108
3109         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3110         only after checking if it cannot be forced local.
3111         * symtab.h (is_externally_visible): Check if the symbol is not forced
3112         local.
3113
3114 2011-07-15  Ian Lance Taylor  <iant@google.com>
3115
3116         * options.h (class General_options): Add --print-output-format.
3117         Move -EL next to -EB, for  better --help output.
3118         * target-select.cc: Include <cstdio>, "options.h", and
3119         "parameters.h".
3120         (Target_selector::do_target_bfd_name): New function.
3121         (print_output_format): New function.
3122         * target-select.h (class Target_selector): Update declarations.
3123         (Target_selector::target_bfd_name): New function.
3124         (print_output_format): Declare.
3125         * main.cc: Include "target-select.h".
3126         (main): Handle --print-output-format.
3127         * gold.cc: Include "target-select.h".
3128         (queue_initial_tasks): Handle --print-output-format when there are
3129         no input files.
3130         * parameters.cc (parameters_force_valid_target): Give a better
3131         error message if -EB/-EL does not match target.
3132         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3133         function.
3134
3135 2011-07-15  Ian Lance Taylor  <iant@google.com>
3136
3137         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3138         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3139         (Output_data_plt_i386::do_write): Write address of .dynamic
3140         section to first entry in .got.plt section.
3141         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3142         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3143         Initialize layout_.
3144         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3145         section to first entry in .got.plt section.
3146         * layout.h (Layout::dynamic_section): New function.
3147
3148 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3149
3150         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3151         to claim_file call.
3152         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3153         input_section_position_, and input_section_glob_.
3154         (read_layout_from_file): Call function section_ordering_specified.
3155         * layout.h (is_section_ordering_specified): New function.
3156         (section_ordering_specified): New function.
3157         (section_ordering_specified_): New boolean member.
3158         * main.cc(main): Call load_plugins after layout object is defined.
3159         * output.cc (Output_section::add_input_section): Use
3160         function section_ordering_specified to check if section ordering is
3161         needed.
3162         * output.cc (Output_section::add_relaxed_input_section): Use
3163         function section_ordering_specified to check if section ordering is
3164         needed.
3165         (Output_section::update_section_layout): New function.
3166         (Output_section::sort_attached_input_sections): Check if input section
3167         must be reordered.
3168         * output.h (Output_section::update_section_layout): New function.
3169         * plugin.cc (get_section_count): New function.
3170         (get_section_type): New function.
3171         (get_section_name): New function.
3172         (get_section_contents): New function.
3173         (update_section_order): New function.
3174         (allow_section_ordering): New function.
3175         (Plugin::load): Add the new interfaces to the transfer vector.
3176         (Plugin_manager::load_plugins): New parameter.
3177         (Plugin_manager::all_symbols_read): New parameter.
3178         (Plugin_manager::claim_file): New parameter. Save the elf object for
3179         unclaimed objects.
3180         (Plugin_manager::get_elf_object): New function.
3181         (Plugin_manager::get_view): Change to directly use the bool to check
3182         if get_view is called from claim_file_hook.
3183         * plugin.h (input_objects): New function
3184         (Plugin__manager::load_plugins): New parameter.
3185         (Plugin_manager::claim_file): New parameter.
3186         (Plugin_manager::get_elf_object): New function.
3187         (Plugin_manager::in_claim_file_handler): New function.
3188         (Plugin_manager::in_claim_file_handler_): New member.
3189         (layout): New function.
3190         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3191         handler with an extra parameter. Make the elf object before calling
3192         claim_file handler.
3193         * testsuite/plugin_test.c (get_section_count): New function pointer.
3194         (get_section_type): New function pointer.
3195         (get_section_name): New function pointer.
3196         (get_section_contents): New function pointer.
3197         (update_section_order): New function pointer.
3198         (allow_section_ordering): New function pointer.
3199         (onload): Check if the new interfaces exist.
3200
3201 2011-07-13  Ian Lance Taylor  <iant@google.com>
3202
3203         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3204         relro section.
3205         * x86_64.cc (Target_x86_64::got_section): Likewise.
3206         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3207         (relro_now_test_SOURCES): New variable.
3208         (relro_now_test_DEPENDENCIES): New variable.
3209         (relro_now_test_LDFLAGS): New variable.
3210         (relro_now_test_LDADD): New variable.
3211         (relro_now_test.so): New target.
3212         * testsuite/Makefile.in: Rebuild.
3213
3214 2011-07-12  Ian Lance Taylor  <iant@google.com>
3215
3216         PR gold/12980
3217         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3218         GLOB_DAT relocation rather than a RELATIVE relocation for a
3219         protected symbol when creating a shared library.
3220         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3221         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3222         * testsuite/protected_main_1.cc (main): Test that protected
3223         function has same address.
3224
3225 2011-07-11  Ian Lance Taylor  <iant@google.com>
3226
3227         PR gold/12979
3228         * options.h (class General_options): Add -Bgroup.
3229         * options.cc (General_options::finalize): If -Bgroup is set,
3230         default to --unresolved-symbols=report-all.
3231         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3232         * target-reloc.h (issue_undefined_symbol_error): Handle
3233         --unresolved-symbols=report-all.
3234
3235 2011-07-08  Ian Lance Taylor  <iant@google.com>
3236
3237         PR gold/11985
3238         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3239         if linker script discards key sections.
3240         (Layout::create_dynamic_symtab): Likewise.
3241         (Layout::assign_local_dynsym_offsets): Likewise.
3242         (Layout::sized_create_version_sections): Likewise.
3243         (Layout::create_interp): Likewise.
3244         (Layout::finish_dynamic_section): Likewise.
3245         (Layout::set_dynamic_symbol_size): Likewise.
3246
3247 2011-07-08  Ian Lance Taylor  <iant@google.com>
3248
3249         PR gold/12386
3250         * options.h (class General_options): Add --unresolved-symbols.
3251         * target-reloc.h (issue_undefined_symbol_error): Check
3252         --unresolved-symbols.  Add comments.
3253
3254 2011-07-08  Ian Lance Taylor  <iant@google.com>
3255
3256         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3257         expression more complex.
3258
3259 2011-07-08  Ian Lance Taylor  <iant@google.com>
3260
3261         PR gold/11317
3262         * target-reloc.h (issue_undefined_symbol_error): New inline
3263         function, broken out of relocate_section.
3264         (relocate_section): Call issue_undefined_symbol_error.
3265         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3266         there is no TLS segment if we are about to issue an undefined
3267         symbol error.
3268         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3269
3270 2011-07-08  Ian Lance Taylor  <iant@google.com>
3271
3272         PR gold/12279
3273         * resolve.cc (Symbol_table::should_override): Add fromtype
3274         parameter.  Change all callers.  Give error when linking together
3275         TLS and non-TLS symbol.
3276         (Symbol_table::should_override_with_special): Add fromtype
3277         parameter.  Change all callers.
3278         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3279         there is no TLS segment if we have reported some errors.
3280         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3281
3282 2011-07-08  Ian Lance Taylor  <iant@google.com>
3283
3284         PR gold/12372
3285         * target.h (Target::plt_address_for_global): New function.
3286         (Target::plt_address_for_local): New function.
3287         (Target::plt_section_for_global): Remove.
3288         (Target::plt_section_for_local): Remove.
3289         (Target::do_plt_address_for_global): New virtual function.
3290         (Target::do_plt_address_for_local): New virtual function.
3291         (Target::do_plt_section_for_global): Remove.
3292         (Target::do_plt_section_for_local): Remove.
3293         (Target::register_global_plt_entry): Add Symbol_table and Layout
3294         parameters.
3295         * output.cc (Output_data_got::Got_entry::write): Use
3296         plt_address_for_global and plt_address_for_local.
3297         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3298         address of output section.
3299         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3300         got_irelative_, and irelative_count_ fields.  Update
3301         declarations.
3302         (Output_data_plt_i386::has_irelative_section): New function.
3303         (Output_data_plt_i386::entry_count): Add irelative_count_.
3304         (Output_data_plt_i386::set_final_data_size): Likewise.
3305         (class Target_i386): Add got_irelative_ and rel_irelative_
3306         fields.  Update declarations.
3307         (Target_i386::Target_i386): Initialize new fields.
3308         (Target_i386::do_plt_address_for_global): New function replacing
3309         do_plt_section_for_global.
3310         (Target_i386::do_plt_address_for_local): New function replacing
3311         do_plt_section_for_local.
3312         (Target_i386::got_section): Create got_irelative_.
3313         (Target_i386::rel_irelative_section): New function.
3314         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3315         fields.  Don't define __rel_iplt_{start,end}.
3316         (Output_data_plt_i386::add_entry): Add symtab and layout
3317         parameters.  Change all callers.  Use different PLT and GOT for
3318         IFUNC symbols.
3319         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3320         layout parameters.  Change all callers.  Use different PLT and
3321         GOT.
3322         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3323         (Output_data_plt_i386::rel_irelative): New function.
3324         (Output_data_plt_i386::address_for_global): New function.
3325         (Output_data_plt_i386::address_for_local): New function.
3326         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3327         IRELATIVE GOT when changing IFUNC GOT entries.
3328         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3329         reloc.
3330         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3331         if we didn't create an IRELATIVE GOT.
3332         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3333         plt_address_for_local.
3334         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3335         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3336         got_irelative_, and irelative_count_ fields.  Update
3337         declarations.
3338         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3339         Initialize new fields.  Remove symtab parameter.  Change all
3340         callers.
3341         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3342         irelative_count_.
3343         (Output_data_plt_x86_64::has_irelative_section): New function.
3344         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3345         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3346         fields.  Update declarations.
3347         (Target_x86_64::Target_x86_64): Initialize new fields.
3348         (Target_x86_64::do_plt_address_for_global): New function replacing
3349         do_plt_section_for_global.
3350         (Target_x86_64::do_plt_address_for_local): New function replacing
3351         do_plt_section_for_local.
3352         (Target_x86_64::got_section): Create got_irelative_.
3353         (Target_x86_64::rela_irelative_section): New function.
3354         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3355         all callers.  Don't create __rel_iplt_{start,end}.
3356         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3357         parameters.  Change all callers.  Use different PLT and GOT for
3358         IFUNC symbols.
3359         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3360         layout parameters.  Change all callers.  Use different PLT and
3361         GOT.
3362         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3363         parameters.  Change all callers.  Use different PLT and GOT for
3364         IFUNC symbols.
3365         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3366         (Output_data_plt_x86_64::rela_irelative): New function.
3367         (Output_data_plt_x86_64::address_for_global): New function.
3368         (Output_data_plt_x86_64::address_for_local): New function.
3369         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3370         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3371         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3372         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3373         parameters.
3374         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3375         reloc.
3376         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3377         symbols if we didn't create an IRELATIVE GOT.
3378         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3379         plt_address_for_local.
3380         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3381         * testsuite/ifuncvar1.c: New test file.
3382         * testsuite/ifuncvar2.c: New test file.
3383         * testsuite/ifuncvar3.c: New test file.
3384         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3385         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3386         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3387         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3388         * testsuite/Makefile.in: Rebuild.
3389
3390 2011-07-07  Cary Coutant  <ccoutant@google.com>
3391
3392         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3393         (two_file_test_1_ndebug.o): Likewise.
3394         (two_file_test_1b_ndebug.o): Likewise.
3395         (two_file_test_2_ndebug.o): Likewise.
3396         (two_file_test_main_ndebug.o): Likewise.
3397         (incremental_test_2): Link with no-debug versions.
3398
3399 2011-07-06  Cary Coutant  <ccoutant@google.com>
3400
3401         * gold/incremental.cc
3402         (Output_section_incremental_inputs::write_info_blocks): Check for
3403         hidden and internal symbols.
3404
3405 2011-07-06  Cary Coutant  <ccoutant@google.com>
3406
3407         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3408         Check disposition for startup file.
3409         (Incremental_inputs::report_command_line): Ignore
3410         --incremental-startup-unchanged option.
3411         * options.cc (General_options::parse_incremental_startup_unchanged):
3412         New function.
3413         (General_options::General_options): Initialize new data member.
3414         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3415         (General_options): Add --incremental-startup-unchanged option.
3416         (General_options::incremental_startup_disposition): New function.
3417         (General_options::incremental_startup_disposition_): New data member.
3418
3419 2011-07-06  Cary Coutant  <ccoutant@google.com>
3420
3421         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3422         input file index to Script_info ctor.
3423         (Sized_incremental_binary::do_file_has_changed): Find the
3424         command-line argument for files named in scripts.
3425         * incremental.h (Script_info::Script_info): New ctor
3426         with input file index.
3427         (Script_info::input_file_index): New function.
3428         (Script_info::input_file_index_): New data member.
3429         (Incremental_binary::get_library): Add const.
3430         (Incremental_binary::get_script_info): Add const.
3431         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3432         * testsuite/Makefile.am (incremental_test_5): New test case.
3433         (incremental_test_6): New test case.
3434         * testsuite/Makefile.in: Regenerate.
3435
3436 2011-07-06  Cary Coutant  <ccoutant@google.com>
3437
3438         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3439         debug output when command lines differ.
3440
3441 2011-07-06  Cary Coutant  <ccoutant@google.com>
3442
3443         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3444         --incremental-patch option.
3445         * layout.cc (Free_list::allocate): Extend allocation beyond original
3446         end if enabled.
3447         (Layout::make_output_section): Mark sections that should get
3448         patch space.
3449         * options.cc (parse_percent): New function.
3450         * options.h (parse_percent): New function.
3451         (DEFINE_percent): New macro.
3452         (General_options): Add --incremental-patch option.
3453         * output.cc (Output_section::Output_section): Initialize new data
3454         members.
3455         (Output_section::add_input_section): Print section name when out
3456         of patch space.
3457         (Output_section::add_output_section_data): Likewise.
3458         (Output_section::set_final_data_size): Add patch space when
3459         doing --incremental-full.
3460         (Output_section::do_reset_address_and_file_offset): Remove patch
3461         space.
3462         (Output_segment::set_section_list_addresses): Print debug output
3463         only if --incremental-update.
3464         * output.h (Output_section::set_is_patch_space_allowed): New function.
3465         (Output_section::is_patch_space_allowed_): New data member.
3466         (Output_section::patch_space_): New data member.
3467         * parameters.cc (Parameters::incremental_full): New function.
3468         * parameters.h (Parameters::incremental_full): New function
3469         * testsuite/Makefile.am (incremental_test_2): Add test for
3470         --incremental-patch option.
3471         * testsuite/Makefile.in: Regenerate.
3472         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3473         (t18): Remove function body.
3474
3475 2011-07-05  Doug Kwan  <dougkwan@google.com>
3476
3477         PR gold/12771
3478         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3479         Arm_Address type for relocation result.
3480         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3481         overflow check.
3482         (Arm_relocate_functions::abs32): Use unaligned access.
3483         (Arm_relocate_functions::rel32): Ditto.
3484         (Arm_relocate_functions::prel31): Ditto.
3485         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3486         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3487         static data relocations.
3488         * testsuite/Makefile.in: Regnerate.
3489         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3490
3491 2011-07-05  Ian Lance Taylor  <iant@google.com>
3492
3493         PR gold/12392
3494         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3495         symbols if necessary.
3496         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3497
3498 2011-07-05  Ian Lance Taylor  <iant@google.com>
3499
3500         PR gold/12952
3501         * resolve.cc (Symbol::override_base_with_special): Simply override
3502         version with special symbol version, ignoring previous version.
3503
3504 2011-07-05  Ian Lance Taylor  <iant@google.com>
3505
3506         * object.cc (Sized_relobj_file::include_section_group): Add
3507         information to comment about signature location.
3508
3509 2011-07-02  Ian Lance Taylor  <iant@google.com>
3510
3511         PR gold/12957
3512         * options.h (class General_options): Add -f and -F.
3513         * options.cc (General_options::finalize): Fatal error if -f/-F
3514         are used without -shared.
3515         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3516
3517 2011-07-02  Ian Lance Taylor  <iant@google.com>
3518
3519         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3520
3521 2011-07-01  Ian Lance Taylor  <iant@google.com>
3522
3523         PR gold/12525
3524         PR gold/12952
3525         * resolve.cc (Symbol::override_base_with_special): Don't override
3526         the version if the overriding symbol has a different name.
3527         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3528         all callers.  If we give an error about an undefined version,
3529         define the base version if necessary.
3530         * dynobj.h (class Versions): Update declaration.
3531         * testsuite/weak_alias_test_5.cc: New file.
3532         * testsuite/weak_alias_test.script: New file.
3533         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3534         and versioned_alias have the right value, and call t2.
3535         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3536         weak_alias_test_5.so.
3537         (weak_alias_test_LDADD): Likewise.
3538         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3539         * testsuite/Makefile.in: Rebuild.
3540
3541 2011-07-01  Ian Lance Taylor  <iant@google.com>
3542
3543         PR gold/12525
3544         * options.h (class General_options): Support -z notext.
3545         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3546         -Wl,-z,notext.
3547         (two_file_shared_nonpic.so): Likewise.
3548         (two_file_shared_mixed.so): Likewise.
3549         (two_file_shared_mixed_1.so): Likewise.
3550         (weak_undef_lib_nonpic.so): Likewise.
3551         (alt/weak_undef_lib_nonpic.so): Likewise.
3552         (tls_test_shared_nonpic.so): Likewise.
3553         * testsuite/Makefile.in: Rebuild.
3554
3555 2011-07-01  Ian Lance Taylor  <iant@google.com>
3556
3557         PR gold/12525
3558         * configure.ac: Test whether static linking works, setting
3559         the automake conditional HAVE_STATIC.
3560         * testsuite/Makefile.am: Disable tests using -static if
3561         HAVE_STATIC is not true.
3562         * configure, testsuite/Makefile.in: Rebuild.
3563
3564 2011-07-01  Ian Lance Taylor  <iant@google.com>
3565
3566         PR gold/12525
3567         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3568         Assert if we see DW_EH_PE_indirect.
3569         * target.h (Target::ehframe_datarel_base): New function.
3570         (Target::do_ehframe_datarel_base): New target function.
3571         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3572         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3573         function.
3574
3575 2011-07-01  Ian Lance Taylor  <iant@google.com>
3576
3577         PR gold/12571
3578         * options.h (class General_options): Add
3579         --ld-generated-unwind-info.
3580         * ehframe.cc (Fde::write): Add address parameter.  Change all
3581         callers.  If associated with PLT, fill in address and size.
3582         (Cie::set_output_offset): Only add merge mapping if there is an
3583         object.
3584         (Cie::write): Add address parameter.  Change all callers.
3585         (Eh_frame::add_ehframe_for_plt): New function.
3586         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3587         input_offset_ fields into union u_, with new plt field.
3588         (Fde::Fde): Adjust for new union field.
3589         (Fde::Fde) [Output_data version]: New constructor.
3590         (Fde::add_mapping): Only add merge mapping if there is an object.
3591         (class Cie): Update declarations.
3592         (class Eh_frame): Declare add_ehframe_for_plt.
3593         * layout.cc (Layout::layout_eh_frame): Break out code into
3594         make_eh_frame_section, and call it.
3595         (Layout::make_eh_frame_section): New function.
3596         (Layout::add_eh_frame_for_plt): New function.
3597         * layout.h (class Layout): Update declarations.
3598         * merge.cc (Merge_map::add_mapping): Add assertion.
3599         * i386.cc: Include "dwarf.h".
3600         (class Output_data_plt_i386): Make first_plt_entry,
3601         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3602         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3603         and plt_eh_frame_fde.
3604         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3605         boundary.  Call add_eh_frame_for_plt if appropriate.
3606         * x86_64.cc: Include "dwarf.h".
3607         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3608         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3609         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3610         and plt_eh_frame_fde.
3611         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3612         appropriate.
3613
3614 2011-06-29  Ian Lance Taylor  <iant@google.com>
3615
3616         PR gold/12629
3617         * object.cc (Sized_relobj_file::layout_section): Change shdr
3618         parameter to be const.
3619         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3620         out of do_layout.
3621         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3622         appropriate.  Call layout_eh_frame_section.
3623         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3624         sections.
3625         * object.h (class Sized_relobj_file): Update declarations.
3626
3627 2011-06-29  Ian Lance Taylor  <iant@google.com>
3628
3629         PR gold/12652
3630         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3631         modifier.
3632         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3633
3634 2011-06-29  Ian Lance Taylor  <iant@google.com>
3635
3636         PR gold/12675
3637         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3638         SHT_X86_64_UNWIND.
3639         * layout.cc (Layout::layout_eh_frame): Likewise.
3640
3641 2011-06-29  Ian Lance Taylor  <iant@google.com>
3642
3643         PR gold/12695
3644         * layout.cc (Layout::symtab_section_shndx): New function.
3645         * layout.h (class Layout): Declare symtab_section_shndx.
3646         * output.cc (Output_section::write_header): Call it.
3647
3648 2011-06-29  Ian Lance Taylor  <iant@google.com>
3649
3650         PR gold/12818
3651         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3652         symbols which are not used in a relocation.
3653
3654 2011-06-28  Ian Lance Taylor  <iant@google.com>
3655
3656         PR gold/12898
3657         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3658         script create indistinguishable segments.
3659         (Layout::set_segment_offsets): Use stable_sort when sorting
3660         segments.  Pass this to Compare_segments constructor.
3661         * layout.h (class Layout): Make segment_precedes non-static.
3662         (class Compare_segments): Change from struct to class.  Add
3663         layout_ field.  Add constructor.
3664         * script-sections.cc
3665         (Script_sections::attach_sections_using_phdrs_clause): Rename
3666         local orphan to is_orphan.  Don't report failure to put empty
3667         section in segment.  On attachment failure, report name of
3668         section, and attach to first PT_LOAD segment.
3669
3670 2011-06-28  Ian Lance Taylor  <iant@google.com>
3671
3672         PR gold/12934
3673         * target-select.cc (Target_selector::Target_selector): Add
3674         emulation parameter.  Change all callers.
3675         (select_target_by_bfd_name): Rename from select_target_by_name.
3676         Change all callers.
3677         (select_target_by_emulation): New function.
3678         (supported_emulation_names): New function.
3679         * target-select.h (class Target_selector): Add emulation_ field.
3680         Update declarations.
3681         (Target_selector::recognize_by_bfd_name): Rename from
3682         recognize_by_name.  Change all callers.
3683         (Target_selector::supported_bfd_names): Rename from
3684         supported_names.  Change all callers.
3685         (Target_selector::recognize_by_emulation): New function.
3686         (Target_selector::supported_emulations): New function.
3687         (Target_selector::emulation): New function.
3688         (Target_selector::do_recognize_by_bfd_name): Rename from
3689         do_recognize_by_name.  Change all callers.
3690         (Target_selector::do_supported_bfd_names): Rename from
3691         do_supported_names.  Change all callers.
3692         (Target_selector::do_recognize_by_emulation): New function.
3693         (Target_selector::do_supported_emulations): New function.
3694         (select_target_by_bfd_name): Change name in declaration.
3695         (select_target_by_emulation): Declare.
3696         (supported_emulation_names): Declare.
3697         * parameters.cc (parameters_force_valid_target): Try to find
3698         target based on emulation from -m option.
3699         * options.h (class General_options): Change doc string for -m.
3700         * options.cc (help): Print emulations.
3701         (General_options::parse_V): Likewise.
3702         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3703         Add emulation parameter.  Change all callers.
3704
3705 2011-06-28  Ian Lance Taylor  <iant@google.com>
3706
3707         * target.h (class Target): Add osabi_ field.
3708         (Target::osabi): New function.
3709         (Target::set_osabi): New function.
3710         (Target::Target): Initialize osabi_.
3711         (Target::do_adjust_elf_header): Make pure virtual.
3712         (Sized_target::do_adjust_elf_header): Declare.
3713         * target.cc (Sized_target::do_adjust_elf_header): New function.
3714         (class Sized_target): Instantiate all versions.
3715         * freebsd.h (class Target_freebsd): Remove.
3716         (Target_selector_freebsd::do_recognize): Call set_osabi on
3717         Target.
3718         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3719         (Target_selector_freebsd::set_osabi): Remove.
3720         * i386.cc (class Target_i386): Inherit from Sized_target rather
3721         than Target_freebsd.
3722         * x86_64.cc (class Target_x86_64): Likewise.
3723
3724 2011-06-28  Ian Lance Taylor  <iant@google.com>
3725
3726         * target.h (Target::can_check_for_function_pointers): Rewrite.
3727         Make non-virtual.
3728         (Target::can_icf_inline_merge_sections): Likewise.
3729         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3730         (Target::Target_info): Add can_icf_inline_merge_sections field.
3731         (Target::do_can_check_for_function_pointers): New virtual
3732         function.
3733         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3734         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3735         from can_check_for_function_pointers, move in file.
3736         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3737         section_may_have_icf_unsafe_poineters, move in file.
3738         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3739         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3740         Rename from can_check_for_function_pointers, move in file.
3741         (Target_i386::can_icf_inline_merge_sections): Remove.
3742         (Target_i386::i386_info): Initialize
3743         can_icf_inline_merge_sections.
3744         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3745         Initialize can_icf_inline_merge_sections.
3746         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3747         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3748         Rename from can_check_for_function_pointers, move in file.
3749         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3750         (Target_x86_64::x86_64_info): Initialize
3751         can_icf_inline_merge_sections.
3752         * testsuite/testfile.cc (Target_test::test_target_info):
3753         Likewise.
3754         * icf.cc (get_section_contents): Correct formatting.
3755
3756 2011-06-27  Ian Lance Taylor  <iant@google.com>
3757
3758         * symtab.cc (Symbol::versioned_name): New function.
3759         (Symbol_table::add_to_final_symtab): Use versioned_name when
3760         appropriate.
3761         (Symbol_table::sized_write_symbol): Likewise.
3762         * symtab.h (class Symbol): Declare versioned_name.
3763         * stringpool.h (class Stringpool_template): Add variant of add
3764         which takes a std::basic_string.
3765         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3766         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3767         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3768         (ver_test_12.o): New target.
3769         * testsuite/Makefile.in: Rebuild.
3770
3771 2011-06-27  Doug Kwan  <dougkwan@google.com>
3772
3773         * arm.cc (Arm_relocate_functions::thm_jump8,
3774         Arm_relocate_functions::thm_jump11): Use a wider signed
3775         type to compute offset.
3776         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3777         arm_thm_jump8.
3778         * testsuite/Makefile.in: Regenerate.
3779         * testsuite/arm_branch_in_range.sh: Check test results of
3780         arm_thm_jump11 and arm_thm_jump8.
3781         * testsuite/arm_thm_jump11.s: New test source file.
3782         * testsuite/arm_thm_jump11.t: New linker script.
3783         * testsuite/arm_thm_jump8.s: New test source file.
3784         * testsuite/arm_thm_jump8.t: New linker script.
3785
3786 2011-06-24  Ian Lance Taylor  <iant@google.com>
3787
3788         * layout.cc: Include "object.h".
3789         (ctors_sections_in_init_array): New static variable.
3790         (Layout::is_ctors_in_init_array): New function.
3791         (Layout::layout): Add entry to ctors_sections_in_init_array if
3792         appropriate.
3793         * layout.h (class Layout): Declare is_ctors_in_init_array.
3794         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3795         is_ctors_reverse_view is set.
3796         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3797         all callers.  Set is_ctors_reverse_view field of View_size.
3798         (Sized_relobj_file::reverse_words): New function.
3799         * object.h (Sized_relobj_file::View_size): Add
3800         is_ctors_reverse_view field.
3801         (class Sized_relobj_file): Update declarations.
3802         * testsuite/initpri3.c: New test.
3803         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3804         initpri3b.
3805         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3806         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3807         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3808         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3809         * testsuite/Makefile.in: Rebuild.
3810
3811 2011-06-24  Cary Coutant  <ccoutant@google.com>
3812
3813         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3814         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3815         (debug_msg_cdebug.err): New targets.
3816         * testsuite/Makefile.in: Regenerate.
3817         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3818         Fix checks for link with shared library.
3819
3820 2011-06-24  Doug Kwan  <dougkwan@google.com>
3821
3822         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3823         skip empty text sections.
3824         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3825
3826 2011-06-22  Ian Lance Taylor  <iant@google.com>
3827
3828         PR gold/12910
3829         * options.h (class General_options): Add --ctors-in-init-array.
3830         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3831         friends as SHT_PROGBITS for merging sections.
3832         (Layout::layout): Remove special handling of .init_array and
3833         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3834         and .dtors if ctors_in_init_array.
3835         (Layout::make_output_section): Force correct section types for
3836         .init_array and friends.  Don't sort if doing relocatable link,
3837         Don't sort .ctors and .dtors if ctors_in_init_array.
3838         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3839         (Layout::output_section_name): Add relobj parameter.  Change all
3840         callers.  Handle .ctors. and .dtors. in code rather than table.
3841         Handle .ctors and .dtors if ctors_in_init_array.
3842         (Layout::match_file_name): New function, moved from output.cc.
3843         * layout.h (class Layout): Update declarations.
3844         * output.cc: Include "layout.h".
3845         (Input_section_sort_entry::get_priority): New function.
3846         (Input_section_sort_entry::match_file_name): Just call
3847         Layout::match_file_name.
3848         (Output_section::Input_section_sort_init_fini_compare::operator()):
3849         Handle .ctors and .dtors.  Sort by explicit priority rather than
3850         by name.
3851         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3852         * testsuite/initpri2.c: New test.
3853         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3854         (check_PROGRAMS): Add initpri2.
3855         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3856         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3857         * configure, testsuite/Makefile.in: Rebuild.
3858
3859 2011-06-19  Ian Lance Taylor  <iant@google.com>
3860
3861         PR gold/12880
3862         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3863         .interp section to a PT_INTERP segment even if we have seen a
3864         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3865         clause in a linker script.
3866         (Layout::finalize): Don't create a .interp section if we've
3867         already create a PT_INTERP segment.
3868         (Layout::create_interp): Always call choose_output_section (revert
3869         patch of 2011-06-17).  Don't create PT_INTERP segment.
3870         * script-sections.cc
3871         (Script_sections::create_note_and_tls_segments): Add a .interp
3872         section to a PT_INTERP segment even if we have seen a
3873         --dynamic-linker option.
3874
3875 2011-06-18  Ian Lance Taylor  <iant@google.com>
3876
3877         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3878         merely because a non-PT_LOAD segment has a dynamic reloc.
3879
3880 2011-06-18  Ian Lance Taylor  <iant@google.com>
3881
3882         * layout.cc (Layout::finish_dynamic_section): Don't create
3883         DT_FLAGS entry if not needed.
3884
3885 2011-06-18  Ian Lance Taylor  <iant@google.com>
3886
3887         PR gold/12745
3888         * layout.cc (Layout::layout_eh_frame): Correct handling of
3889         writable .eh_frame section.
3890
3891 2011-06-17  Ian Lance Taylor  <iant@google.com>
3892
3893         PR gold/12893
3894         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3895         symbol is redefined with the exact same object and value.
3896
3897 2011-06-17  Ian Lance Taylor  <iant@google.com>
3898
3899         PR gold/12880
3900         * layout.h (class Layout): Add interp_segment_ field.
3901         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3902         (Layout::attach_allocated_section_to_segment): If making shared
3903         library, put .interp section in PT_INTERP segment.
3904         (Layout::finalize): Also call create_interp if -dynamic-linker
3905         option was used.
3906         (Layout::create_interp): Assert that there is no PT_INTERP
3907         segment.  If not using a SECTIONS clause, use make_output_section.
3908         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3909         * script-sections.cc
3910         (Script_sections::create_note_and_tls_segments): If making shared
3911         library, put .interp section in PT_INTERP segment.
3912
3913 2011-06-17  Ian Lance Taylor  <iant@google.com>
3914
3915         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3916         when making a shared library.
3917
3918 2011-06-17  Ian Lance Taylor  <iant@google.com>
3919
3920         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3921         parameter.  Change all callers.  Don't issue warning about PC32
3922         against locally defined symbol.
3923
3924 2011-06-16  Ian Lance Taylor  <iant@google.com>
3925
3926         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3927         occurs in same object.
3928
3929 2011-06-14  Alan Modra  <amodra@gmail.com>
3930
3931         * po/POTFILES.in: Regenerate.
3932
3933 2011-06-09  Ian Lance Taylor  <iant@google.com>
3934
3935         * script-sections.cc
3936         (Orphan_output_section::set_section_addresses): For a relocatable
3937         link set address to 0.
3938
3939 2011-06-09  Cary Coutant  <ccoutant@google.com>
3940
3941         PR gold/12804
3942         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3943         used with --compress-debug-sections.
3944         * gold/object.cc (Sized_relobj_file::do_layout): Report
3945         uncompressed size of compressed input sections.
3946
3947 2011-06-08  Cary Coutant  <ccoutant@google.com>
3948
3949         PR gold/12804
3950         * testsuite/two_file_test_2_v1.cc: Change initialization of
3951         v2 to keep it in .data.
3952
3953 2011-06-07  Cary Coutant  <ccoutant@google.com>
3954
3955         * common.cc (Symbol_table::do_allocate_commons_list): Call
3956         gold_fallback.
3957         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3958         (Errors::fallback): New function.
3959         (gold_fallback): New function.
3960         * errors.h (Errors::fallback): New function.
3961         * gold.cc (gold_exit): Change status parameter to enum; adjust
3962         all callers.
3963         (queue_initial_tasks): Call gold_fallback.
3964         * gold.h: Include cstdlib.
3965         (Exit_status): New enum type.
3966         (gold_exit): Change status parameter to enum.
3967         (gold_fallback): New function.
3968         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3969         (Layout::create_symtab_sections): Likewise.
3970         (Layout::create_shdrs): Likewise.
3971         * main.cc (main): Adjust call to gold_exit.
3972         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3973         (Output_data_got::add_got_entry_pair): Likewise.
3974         (Output_section::add_input_section): Likewise.
3975         (Output_section::add_output_section_data): Likewise.
3976         (Output_segment::set_section_list_addresses): Likewise.
3977         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3978
3979 2011-06-07  Cary Coutant  <ccoutant@google.com>
3980
3981         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3982         for incremental links.
3983         * output.cc (Output_segment::set_section_list_addresses): Remove
3984         FIXME and test for TLS or BSS.
3985
3986 2011-06-07  Cary Coutant  <ccoutant@google.com>
3987
3988         * testsuite/Makefile.am: Add incremental_copy_test,
3989         incremental_common_test_1.
3990         * testsuite/Makefile.in: Regenerate.
3991         * testsuite/common_test_1_v1.c: New source file.
3992         * testsuite/common_test_1_v2.c: New source file.
3993         * testsuite/copy_test_v1.cc: New source file.
3994
3995 2011-06-07  Cary Coutant  <ccoutant@google.com>
3996
3997         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3998         update, allocate common from bss section's free list.
3999         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4000         linker-defined symbols.
4001         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4002         Skip GOT and PLT entries that are no longer referenced.
4003         (Output_section_incremental_inputs::write_info_blocks): Mark
4004         linker-defined symbols.
4005         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4006         * output.cc (Output_section::allocate): New function.
4007         * output.h (Output_section::allocate): New function.
4008         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4009         linker-defined symbols.
4010         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4011         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4012         (Symbol::init_base_output_data): Likewise.
4013         (Symbol::init_base_output_segment): Likewise.
4014         (Symbol::init_base_constant): Likewise.
4015         (Sized_symbol::init_output_data): Likewise.
4016         (Sized_symbol::init_output_segment): Likewise.
4017         (Sized_symbol::init_constant): Likewise.
4018         (Symbol_table::do_define_in_output_data): Likewise.
4019         (Symbol_table::do_define_in_output_segment): Likewise.
4020         (Symbol_table::do_define_as_constant): Likewise.
4021         * symtab.h (Symbol::is_predefined): New function.
4022         (Symbol::init_base_output_data): Add is_predefined parameter.
4023         (Symbol::init_base_output_segment): Likewise.
4024         (Symbol::init_base_constant): Likewise.
4025         (Symbol::is_predefined_): New data member.
4026         (Sized_symbol::init_output_data): Add is_predefined parameter.
4027         (Sized_symbol::init_output_segment): Likewise.
4028         (Sized_symbol::init_constant): Likewise.
4029         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4030
4031 2011-06-07  Cary Coutant  <ccoutant@google.com>
4032
4033         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4034         instead of emit_copy_reloc.
4035         (Copy_relocs::emit_copy_reloc): Refactor.
4036         (Copy_relocs::make_copy_reloc): New function.
4037         (Copy_relocs::add_copy_reloc): Remove.
4038         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4039         section.
4040         (Copy_relocs::make_copy_reloc): New function.
4041         (Copy_relocs::add_copy_reloc): Remove.
4042         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4043         unchanged input files.
4044         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4045         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4046         Reserve BSS space for COPY relocations.
4047         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4048         (Output_section_incremental_inputs::write_info_blocks): Record
4049         whether a symbol is copied from a shared object.
4050         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4051         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4052         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4053         (Incremental_input_entry_reader::get_output_symbol_index): Add
4054         is_copy parameter.
4055         (Incremental_binary::emit_copy_relocs): New function.
4056         (Incremental_binary::do_emit_copy_relocs): New function.
4057         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4058         new data member.
4059         (Sized_incremental_binary::add_copy_reloc): New function.
4060         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4061         (Sized_incremental_binary::Copy_reloc): New struct.
4062         (Sized_incremental_binary::Copy_relocs): New typedef.
4063         (Sized_incremental_binary::copy_relocs_): New data member.
4064         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4065         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4066         * target.h (Sized_target::emit_copy_reloc): New function.
4067         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4068
4069 2011-06-02  Cary Coutant  <ccoutant@google.com>
4070
4071         PR gold/12163
4072         * gold/archive.cc (Archive::Archive): Initialize new data member.
4073         (Archive::include_all_members): Return if archive has already been
4074         included.
4075         * gold/archive.h (Archive::include_all_members_): New data member.
4076
4077 2011-06-02  Nick Clifton  <nickc@redhat.com>
4078
4079         * dynobj.h: Fix spelling mistake in comment.
4080         * output.cc: Likewise.
4081
4082 2011-05-31  Doug Kwan  <dougkwan@google.com>
4083             Asier Llano
4084
4085         PR gold/12826
4086         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4087         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4088         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4089         redundant arm_exidx_test.so.
4090         * testsuite/Makefile.in: Regenerate.
4091         (check_SCRIPTS): Add pr12826.sh
4092         (check_DATA): Add pr12826.stdout
4093         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4094         * testsuite/pr12826.sh: New file.
4095         * testsuite/pr12826_1.s: Ditto.
4096         * testsuite/pr12826_1.s: Ditto.
4097
4098 2011-05-30  Ian Lance Taylor  <iant@google.com>
4099
4100         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4101         sections.
4102
4103 2011-05-29  Ian Lance Taylor  <iant@google.com>
4104
4105         PR gold/12804
4106         * testsuite/Makefile.am: Use different file name for two_file_test
4107         temporary file for each incremental test.
4108         * testsuite/Makefile.in: Rebuild.
4109
4110 2011-05-29  Ian Lance Taylor  <iant@google.com>
4111
4112         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4113         binary input file is empty.
4114
4115 2011-05-27  Ian Lance Taylor  <iant@google.com>
4116
4117         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4118         (ver_test_9.so): Likewise.
4119         * testsuite/Makefile.in: Rebuild.
4120
4121 2011-05-26 Cary Coutant  <ccoutant@google.com>
4122
4123         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4124         * incremental.cc (Incremental_inputs::report_input_section): Fix
4125         comment, indentation.
4126         (Incremental_inputs::report_comdat_group): New function.
4127         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4128         of data for incremental input file entry.
4129         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4130         group count, COMDAT group signatures.
4131         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4132         an unchanged input file.
4133         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4134         Initialize new data member.
4135         (Incremental_object_entry::add_comdat_group): New function.
4136         (Incremental_object_entry::get_comdat_group_count): New function.
4137         (Incremental_object_entry::get_comdat_signature_key): New function.
4138         (Incremental_object_entry::groups_): New data member.
4139         (Incremental_inputs::report_comdat_group): New function.
4140         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4141         data for incremental input file entry.
4142         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4143         (Incremental_input_entry_reader::get_input_section): Adjust size of
4144         data for incremental input file entry.
4145         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4146         (Incremental_input_entry_reader::get_comdat_group_signature): New
4147         function.
4148         * object.cc (Sized_relobj::include_section_group): Report kept
4149         COMDAT groups for incremental links.
4150
4151 2011-05-24  David Meyer  <pdox@google.com>
4152
4153         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4154         with name parameter.  Add found_name parameter.
4155         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4156         * dirsearch.h (class Dirsearch): Update declaration.
4157
4158 2011-05-24  Ian Lance Taylor  <iant@google.com>
4159
4160         * archive.cc (Library_base::should_include_member): Pull in object
4161         from archive if it defines the entry symbol.
4162         * parameters.cc (Parameters::entry): New function.
4163         * parameters.h (class Parameters): Declare entry.
4164         * output.h (class Output_file_header): Remove entry_ field.
4165         * output.cc (Output_file_header::Output_file_header): Remove entry
4166         parameter.  Change all callers.
4167         (Output_file_header::entry): Use parameters->entry.
4168         * gold.cc (queue_middle_tasks): Likewise.
4169         * plugin.cc (Plugin_hook::run): Likewise.
4170
4171 2011-05-24 Cary Coutant  <ccoutant@google.com>
4172
4173         * gold.cc (queue_initial_tasks): Pass incremental base filename
4174         to Output_file::open_base_file; don't print error message.
4175         * incremental-dump.cc (main): Adjust call to
4176         Output_file::open_for_modification.
4177         * incremental-dump.cc (main): Likewise.
4178         * incremental.cc (Incremental_inputs::report_command_line):
4179         Ignore --incremental-base option when comparing command lines.
4180         Ignore parameter when given as separate argument.
4181         * options.h (class General_options): Add --incremental-base.
4182         * output.cc (Output_file::Output_file):
4183         (Output_file::open_base_file): Add base_name and writable parameters;
4184         read base file into new file; print error message here.
4185         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4186         callers.
4187         * output.h (Output_file::open_for_modification): Rename to...
4188         (Output_file::open_base_file): ...this; add base_name and
4189         writable parameters; adjust all callers.
4190         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4191         callers.
4192         * testsuite/Makefile.am (incremental_test_4): Test
4193         --incremental-base.
4194         * testsuite/Makefile.in: Regenerate.
4195
4196 2011-05-24 Cary Coutant  <ccoutant@google.com>
4197
4198         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4199         incremental_test_4.
4200         * testsuite/Makefile.in: Regenerate.
4201         * testsuite/two_file_test_1_v1.cc: New test source file.
4202         * testsuite/two_file_test_1b_v1.cc: New test source file.
4203         * testsuite/two_file_test_2_v1.cc: New test source file.
4204
4205 2011-05-24 Cary Coutant  <ccoutant@google.com>
4206
4207         * dynobj.h (Dynobj::do_dynobj): New function.
4208         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4209         flag and soname for shared objects.
4210         * incremental.cc (Incremental_inputs::report_object): Make
4211         either Incremental_object_entry or Incremental_dynobj_entry; add
4212         soname to string table.
4213         (Incremental_inputs::report_input_section): Add assertion.
4214         (Output_section_incremental_inputs::set_final_data_size): Adjust
4215         type of input file entry for shared libraries; adjust size of
4216         shared library info entry.
4217         (Output_section_incremental_inputs::write_input_files): Write
4218         as_needed flag for shared libraries.
4219         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4220         of input file entry for shared libraries; write soname.
4221         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4222         soname from incremental info.
4223         * incremental.h (enum Incremental_input_flags): Add
4224         INCREMENTAL_INPUT_AS_NEEDED.
4225         (Incremental_input_entry::Incremental_input_entry): Initialize new
4226         data member.
4227         (Incremental_input_entry::set_as_needed): New function.
4228         (Incremental_input_entry::as_needed): New function.
4229         (Incremental_input_entry::do_dynobj_entry): New function.
4230         (Incremental_input_entry::as_needed_): New data member.
4231         (Incremental_object_entry::Incremental_object_entry): Don't check
4232         for shared library.
4233         (Incremental_object_entry::do_type): Likewise.
4234         (class Incremental_dynobj_entry): New class.
4235         (Incremental_input_entry_reader::as_needed): New function.
4236         (Incremental_input_entry_reader::get_soname): New function.
4237         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4238         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4239         size of shared library info entry.
4240         * layout.cc (Layout::finish_dynamic_section): Don't test for
4241         incremental link when adding DT_NEEDED entries.
4242         * object.h (Object::Object): Initialize new data member.
4243         (Object::dynobj): New function.
4244         (Object::set_as_needed): New function.
4245         (Object::as_needed): New function.
4246         (Object::do_dynobj): New function.
4247         (Object::as_needed_): New data member.
4248
4249 2011-05-24 Cary Coutant  <ccoutant@google.com>
4250
4251         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4252         info; adjust display of GOT entries.
4253         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4254         vector of input objects; remove file_status_.
4255         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4256         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4257         got_plt reader; call target hooks to reserve GOT entries.
4258         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4259         of input file info header and GOT info entry.
4260         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4261         relocation info.
4262         (Got_plt_view_info::got_descriptor): Remove.
4263         (Got_plt_view_info::sym_index): New data member.
4264         (Got_plt_view_info::input_index): New data member.
4265         (Local_got_offset_visitor::visit): Write input file index.
4266         (Global_got_offset_visitor::visit): Write 0 for input file index.
4267         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4268         with sym_index and input_index.
4269         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4270         incremental info GOT entry; replace got_descriptor with input_index.
4271         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4272         map from input file index to object.
4273         (Sized_relobj_incr::do_layout): Replace direct data member reference
4274         with accessor function.
4275         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4276         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4277         Adjust size of input file info header.
4278         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4279         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4280         (Incremental_input_entry_reader::get_input_section): Adjust size of
4281         input file info header.
4282         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4283         of incremental info GOT entry.
4284         (Incremental_got_plt_reader::get_got_desc): Remove.
4285         (Incremental_got_plt_reader::get_got_symndx): New function.
4286         (Incremental_got_plt_reader::get_got_input_index): New function.
4287         (Sized_incremental_binary::Sized_incremental_binary): Remove
4288         file_status_; add input_objects_.
4289         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4290         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4291         (Sized_incremental_binary::file_is_unchanged): Remove.
4292         (Sized_incremental_binary::set_input_object): New function.
4293         (Sized_incremental_binary::input_object): New function.
4294         (Sized_incremental_binary::file_status_): Remove.
4295         (Sized_incremental_binary::input_objects_): New data member.
4296         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4297         references.
4298         (Sized_relobj_incr::invalid_address): Move to base class.
4299         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4300         class.
4301         (Sized_relobj_incr::do_output_section_offset): Likewise.
4302         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4303         (Sized_relobj_incr::section_offsets_): Likewise.
4304         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4305         function.
4306         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4307         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4308         with accessor function.
4309         (Sized_relobj_file::do_layout): Likewise.
4310         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4311         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4312         (Sized_relobj_file::compute_final_local_value): Replace refs to
4313         section_offsets_ with accessor function.
4314         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4315         * object.h (Relobj::Relobj): Initialize new data members.
4316         (Relobj::add_dyn_reloc): New function.
4317         (Relobj::first_dyn_reloc): New function.
4318         (Relobj::dyn_reloc_count): New function.
4319         (Relobj::first_dyn_reloc_): New data member.
4320         (Relobj::dyn_reloc_count_): New data member.
4321         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4322         references.
4323         (Sized_relobj::Address): New typedef.
4324         (Sized_relobj::invalid_address): Move here from child class.
4325         (Sized_relobj::Sized_relobj): Initialize new data members.
4326         (Sized_relobj::sized_relobj): New function.
4327         (Sized_relobj::is_output_section_offset_invalid): Move here from
4328         child class.
4329         (Sized_relobj::get_output_section_offset): Likewise.
4330         (Sized_relobj::local_has_got_offset): Likewise.
4331         (Sized_relobj::local_got_offset): Likewise.
4332         (Sized_relobj::set_local_got_offset): Likewise.
4333         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4334         (Sized_relobj::clear_got_offsets): New function.
4335         (Sized_relobj::section_offsets): Move here from child class.
4336         (Sized_relobj::do_output_section_offset): Likewise.
4337         (Sized_relobj::do_set_section_offset): Likewise.
4338         (Sized_relobj::Local_got_offsets): Likewise.
4339         (Sized_relobj::local_got_offsets_): Likewise.
4340         (Sized_relobj::section_offsets_): Likewise.
4341         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4342         references.
4343         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4344         class.
4345         (Sized_relobj_file::sized_relobj): New function
4346         (Sized_relobj_file::local_has_got_offset): Move to base class.
4347         (Sized_relobj_file::local_got_offset): Likewise.
4348         (Sized_relobj_file::set_local_got_offset): Likewise.
4349         (Sized_relobj_file::get_output_section_offset): Likewise.
4350         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4351         (Sized_relobj_file::do_output_section_offset): Likewise.
4352         (Sized_relobj_file::do_set_section_offset): Likewise.
4353         (Sized_relobj_file::Local_got_offsets): Likewise.
4354         (Sized_relobj_file::local_got_offsets_): Likewise.
4355         (Sized_relobj_file::section_offsets_): Likewise.
4356         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4357         (all constructors).
4358         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4359         (Output_reloc::get_symbol_index): Likewise.
4360         (Output_reloc::local_section_offset): Likewise.
4361         (Output_reloc::get_address): Likewise.
4362         (Output_reloc::symbol_value): Likewise.
4363         (Output_data_got::reserve_slot): Move to class definition.
4364         (Output_data_got::reserve_local): New function.
4365         (Output_data_got::reserve_slot_for_global): Remove.
4366         (Output_data_got::reserve_global): New function.
4367         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4368         (all constructors, two instantiations).
4369         (Output_reloc::get_relobj): New function (two instantiations).
4370         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4371         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4372         (Output_data_reloc::add_global): Adjust type of relobj.
4373         (Output_data_reloc::add_global_relative): Likewise.
4374         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4375         (Output_data_reloc::add_local): Likewise.
4376         (Output_data_reloc::add_local_relative): Likewise.
4377         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4378         (Output_data_reloc::add_local_section): Likewise.
4379         (Output_data_reloc::add_output_section): Likewise.
4380         (Output_data_reloc::add_absolute): Likewise.
4381         (Output_data_reloc::add_target_specific): Likewise.
4382         (Output_data_got::reserve_slot): Move definition here.
4383         (Output_data_got::reserve_local): New function.
4384         (Output_data_got::reserve_global): New function.
4385         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4386         section_offsets_ with accessor function.
4387         (Sized_relobj_file::write_sections): Likewise.
4388         (Sized_relobj_file::do_relocate_sections): Likewise.
4389         * target.h (Sized_target::reserve_local_got_entry): New function.
4390         (Sized_target::reserve_global_got_entry): New function.
4391         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4392         (Target_x86_64::reserve_global_got_entry): New function.
4393         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4394
4395 2011-05-23 Cary Coutant  <ccoutant@google.com>
4396
4397         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4398         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4399         bit when checking got_type.
4400         * incremental.cc (Sized_incremental_binary::setup_readers):
4401         Store symbol table and string table locations; initialize bit vector
4402         of file status flags.
4403         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4404         unchanged files.
4405         (Sized_incremental_binary::do_process_got_plt): New function.
4406         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4407         (Output_section_incremental_inputs::set_final_data_size): Record
4408         file index for each input file.
4409         (Output_section_incremental_inputs::write_got_plt): Store file index
4410         instead of input entry offset for each GOT entry.
4411         * incremental.h
4412         (Incremental_input_entry::Incremental_input_entry): Initialize new
4413         data member.
4414         (Incremental_input_entry::set_offset): Store file index.
4415         (Incremental_input_entry::get_file_index): New function.
4416         (Incremental_input_entry::file_index_): New data member.
4417         (Incremental_binary::process_got_plt): New function.
4418         (Incremental_binary::do_process_got_plt): New function.
4419         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4420         data members.
4421         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4422         (Sized_incremental_binary::set_file_is_unchanged): New function.
4423         (Sized_incremental_binary::file_is_unchanged): New function.
4424         (Sized_incremental_binary::do_process_got_plt): New function.
4425         (Sized_incremental_binary::file_status_): New data member.
4426         (Sized_incremental_binary::main_symtab_loc_): New data member.
4427         (Sized_incremental_binary::main_strtab_loc_): New data member.
4428         * output.cc (Output_data_got::Got_entry::write): Add case
4429         RESERVED_CODE.
4430         (Output_data_got::add_global): Call add_got_entry.
4431         (Output_data_got::add_global_plt): Likewise.
4432         (Output_data_got::add_global_with_rel): Likewise.
4433         (Output_data_got::add_global_with_rela): Likewise.
4434         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4435         (Output_data_got::add_global_pair_with_rela): Likewise.
4436         (Output_data_got::add_local): Call add_got_entry.
4437         (Output_data_got::add_local_plt): Likewise.
4438         (Output_data_got::add_local_with_rel): Likewise.
4439         (Output_data_got::add_local_with_rela): Likewise.
4440         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4441         (Output_data_got::add_local_pair_with_rela): Likewise.
4442         (Output_data_got::reserve_slot): New function.
4443         (Output_data_got::reserve_slot_for_global): New function.
4444         (Output_data_got::add_got_entry): New function.
4445         (Output_data_got::add_got_entry_pair): New function.
4446         (Output_section::add_output_section_data): Edit FIXME.
4447         * output.h
4448         (Output_section_data_build::Output_section_data_build): New
4449         constructor with size parameter.
4450         (Output_data_space::Output_data_space): Likewise.
4451         (Output_data_got::Output_data_got): Initialize new data member; new
4452         constructor with size parameter.
4453         (Output_data_got::add_constant): Call add_got_entry.
4454         (Output_data_got::reserve_slot): New function.
4455         (Output_data_got::reserve_slot_for_global): New function.
4456         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4457         (Output_data_got::add_got_entry): New function.
4458         (Output_data_got::add_got_entry_pair): New function.
4459         (Output_data_got::free_list_): New data member.
4460         * target.h (Sized_target::init_got_plt_for_update): New function.
4461         (Sized_target::register_global_plt_entry): New function.
4462         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4463         Initialize new data member; call init; add constructor with PLT count.
4464         (Output_data_plt_x86_64::init): New function.
4465         (Output_data_plt_x86_64::add_relocation): New function.
4466         (Output_data_plt_x86_64::reserve_slot): New function.
4467         (Output_data_plt_x86_64::free_list_): New data member.
4468         (Target_x86_64::init_got_plt_for_update): New function.
4469         (Target_x86_64::register_global_plt_entry): New function.
4470         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4471         incremental updates.
4472         (Output_data_plt_x86_64::add_relocation): New function.
4473         * testsuite/object_unittest.cc (Object_test): Set default options.
4474
4475 2011-05-16  Ian Lance Taylor  <iant@google.com>
4476
4477         * options.h (class General_options): Make -i a synonym for -r.
4478
4479 2011-05-16  Ian Lance Taylor  <iant@google.com>
4480
4481         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4482
4483 2011-05-10 Cary Coutant  <ccoutant@google.com>
4484
4485         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4486         strip_all (-s).
4487
4488 2011-05-06  Ian Lance Taylor  <iant@google.com>
4489
4490         * layout.cc (Layout::layout): If the output section flags change,
4491         update the ordering.
4492
4493 2011-04-25 Cary Coutant  <ccoutant@google.com>
4494
4495         * incremental-dump.cc (dump_incremental_inputs): Print local
4496         symbol info for each input file.
4497         * incremental.cc
4498         (Output_section_incremental_inputs::set_final_data_size): Add local
4499         symbol info to input file entries in incremental info.
4500         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4501         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4502         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4503         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4504         implementation.
4505         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4506         (Sized_incr_relobj::do_relocate): Write the local symbols.
4507         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4508         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4509         Adjust size of input file header.
4510         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4511         (Incremental_inputs_reader::get_local_symbol_count): New function.
4512         (Incremental_inputs_reader::get_input_section): Adjust size of input
4513         file header.
4514         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4515         (Sized_incr_relobj::This): New typedef.
4516         (Sized_incr_relobj::sym_size): New const data member.
4517         (Sized_incr_relobj::Local_symbol): New struct.
4518         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4519         (Sized_incr_relobj::do_local_symbol_offset): New function.
4520         (Sized_incr_relobj::local_symbol_count_): New data member.
4521         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4522         (Sized_incr_relobj::local_symbol_index_): New data member.
4523         (Sized_incr_relobj::local_symbol_offset_): New data member.
4524         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4525         (Sized_incr_relobj::local_symbols_): New data member.
4526         * object.h (Relobj::output_local_symbol_count): New function.
4527         (Relobj::local_symbol_offset): New function.
4528         (Relobj::do_output_local_symbol_count): New function.
4529         (Relobj::do_local_symbol_offset): New function.
4530         (Sized_relobj::do_output_local_symbol_count): New function.
4531         (Sized_relobj::do_local_symbol_offset): New function.
4532
4533 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4534
4535         * descriptors.cc (set_close_on_exec): New function.
4536         (Descriptors::open): Use set_close_on_exec.
4537         * output.cc (S_ISLNK): Define if not defined.
4538
4539 2011-04-22 Cary Coutant  <ccoutant@google.com>
4540
4541         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4542         global symbol map.
4543         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4544         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4545         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4546         relocations.
4547         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4548         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4549         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4550         * incremental.h
4551         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4552         function.
4553         (Incremental_binary::apply_incremental_relocs): New function.
4554         (Incremental_binary::do_apply_incremental_relocs): New function.
4555         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4556         data member.
4557         (Sized_incremental_binary::add_global_symbol): New function.
4558         (Sized_incremental_binary::global_symbol): New function.
4559         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4560         (Sized_incremental_binary::symbol_map_): New data member.
4561         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4562         * target.h (Sized_target::apply_relocation): New function.
4563         * target-reloc.h (apply_relocation): New function.
4564         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4565
4566 2011-04-22  Doug Kwan  <dougkwan@google.com>
4567
4568         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4569         flag of a SHT_ARM_EXIDX section.
4570         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4571         * testsuite/Makefile.in: Regenerate.
4572         * testsuite/arm_exidx_test.s: New file.
4573         * testsuite/arm_exidx_test.sh: Same.
4574
4575 2011-04-20 Cary Coutant  <ccoutant@google.com>
4576
4577         PR gold/12689
4578         * archive.h (Incremental_archive_entry::Archive_member):
4579         Initialize arg_serial_ (second constructor).
4580
4581 2011-04-17  Ian Lance Taylor  <iant@google.com>
4582
4583         * object.cc (Relocate_info::location): Simplify location string.
4584         * errors.cc (Errors::error_at_location): Don't print program
4585         name.
4586         (Errors::warning_at_location): Likewise.
4587         (Errors::undefined_symbol): Likewise.
4588         * testsuite/debug_msg.sh: Update accordingly.
4589
4590 2011-04-14 Cary Coutant  <ccoutant@google.com>
4591
4592         * gold/layout.cc (Layout::symtab_section_offset): New function.
4593         * gold/layout.h (Layout::symtab_section_offset): New function.
4594         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4595
4596 2011-04-12  Ian Lance Taylor  <iant@google.com>
4597
4598         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4599         with MREMAP_MAYMOVE.
4600         * output.h (class Output_file): Add map_is_allocated_ field.
4601         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4602         not available, provide stubs.  If mremap is not available, #define
4603         it to gold_mremap.
4604         (MREMAP_MAYMOVE): Define if not defined.
4605         (Output_file::Output_file): Initialize map_is_allocated_.
4606         (Output_file::resize): Check map_is_allocated_.
4607         (Output_file::map_anonymous): If mmap fails, use malloc.
4608         (Output_file::unmap): Don't do anything for an anonymous map.
4609         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4610         is not available, provide stubs.
4611         (File_read::View::~View): Use free rather than delete[].
4612         (File_read::make_view): Use malloc rather than new[].  If mmap
4613         fails, use malloc.
4614         (File_read::find_or_make_view): Use malloc rather than new[].
4615         * gold.h: Remove HAVE_REMAP code.
4616         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4617         exists.  Rename mremap to gold_mremap.  If mmap is not available
4618         don't do anything.
4619         * configure, config.in: Rebuild.
4620
4621 2011-04-11  Ian Lance Taylor  <iant@google.com>
4622
4623         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4624         initialize local variable v.
4625
4626 2011-04-11  Cary Coutant  <ccoutant@google.com>
4627
4628         * archive.cc (Archive::include_member): Adjust call to
4629         report_object.
4630         (Add_archive_symbols::run): Track argument serial numbers.
4631         (Lib_group::include_member): Likewise.
4632         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4633         * archive.h (Incremental_archive_entry::Archive_member):
4634         Initialize arg_serial_.
4635         (Archive_member::arg_serial_): New data member.
4636         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4637         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4638         incremental link.
4639         (Sized_dynobj::do_for_all_local_got_entries): New function.
4640         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4641         function.
4642         * fileread.cc (get_mtime): New function.
4643         * fileread.h (get_mtime): New function.
4644         * gold.cc (queue_initial_tasks): Check for incremental update.
4645         (process_incremental_input): New function.
4646         (queue_middle_tasks): Don't force valid target for incremental
4647         update.
4648         * incremental-dump.cc (find_input_containing_global): Adjust
4649         size of symbol info entry.
4650         (dump_incremental_inputs): Dump argument serial number and
4651         in_system_directory flag; bias shndx by 1; print symbol names
4652         when dumping per-file symbol lists; use new symbol info readers.
4653         * incremental.cc
4654         (Output_section_incremental_inputs:update_data_size): New function.
4655         (Sized_incremental_binary::setup_readers): Setup input readers
4656         for each input file; build maps for files added from libraries
4657         and scripts.
4658         (Sized_incremental_binary::check_input_args): New function.
4659         (Sized_incremental_binary::do_check_inputs): Build map of argument
4660         serial numbers to input arguments.
4661         (Sized_incremental_binary::do_file_has_changed): Rename
4662         do_file_is_unchanged to this; compare file modification times.
4663         (Sized_incremental_binary::do_init_layout): New function.
4664         (Sized_incremental_binary::do_reserve_layout): New function.
4665         (Sized_incremental_binary::do_get_input_reader): Remove.
4666         (Sized_incremental_binary::get_symtab_view): New function.
4667         (Incremental_checker::can_incrementally_link_output_file): Remove.
4668         (Incremental_inputs::report_command_line): Exclude --debug options.
4669         (Incremental_inputs::report_archive_begin): Add parameter; track
4670         argument serial numbers; don't put input file entry for archive
4671         before archive members.
4672         (Incremental_inputs::report_archive_end): Put input file entry
4673         for archive after archive members.
4674         (Incremental_inputs::report_object): Add parameter; track argument
4675         serial numbers and in_system_directory flag.
4676         (Incremental_inputs::report_script): Add parameter; track argument
4677         serial numbers.
4678         (Output_section_incremental_inputs::set_final_data_size): Adjust
4679         size of symbol info entry; check for forwarding symbols.
4680         (Output_section_incremental_inputs::write_input_files): Write
4681         in_system_directory flag and argument serial number.
4682         (Output_section_incremental_inputs::write_info_blocks): Map section
4683         indices between incremental info and original input file; store
4684         input section index for each symbol.
4685         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4686         change operator() to visit().
4687         (class Global_got_offset_visitor): Likewise.
4688         (class Global_symbol_visitor_got_plt):
4689         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4690         classes.
4691         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4692         (Sized_incr_relobj::do_read_symbols): New function.
4693         (Sized_incr_relobj::do_layout): New function.
4694         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4695         (Sized_incr_relobj::do_add_symbols): New function.
4696         (Sized_incr_relobj::do_should_include_member): New function.
4697         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4698         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4699         (Sized_incr_relobj::do_section_size): New function.
4700         (Sized_incr_relobj::do_section_name): New function.
4701         (Sized_incr_relobj::do_section_contents): New function.
4702         (Sized_incr_relobj::do_section_flags): New function.
4703         (Sized_incr_relobj::do_section_entsize): New function.
4704         (Sized_incr_relobj::do_section_address): New function.
4705         (Sized_incr_relobj::do_section_type): New function.
4706         (Sized_incr_relobj::do_section_link): New function.
4707         (Sized_incr_relobj::do_section_info): New function.
4708         (Sized_incr_relobj::do_section_addralign): New function.
4709         (Sized_incr_relobj::do_initialize_xindex): New function.
4710         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4711         (Sized_incr_relobj::do_read_relocs): New function.
4712         (Sized_incr_relobj::do_gc_process_relocs): New function.
4713         (Sized_incr_relobj::do_scan_relocs): New function.
4714         (Sized_incr_relobj::do_count_local_symbols): New function.
4715         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4716         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4717         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4718         (Sized_incr_relobj::do_relocate): New function.
4719         (Sized_incr_relobj::do_set_section_offset): New function.
4720         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4721         (Sized_incr_dynobj::do_read_symbols): New function.
4722         (Sized_incr_dynobj::do_layout): New function.
4723         (Sized_incr_dynobj::do_add_symbols): New function.
4724         (Sized_incr_dynobj::do_should_include_member): New function.
4725         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4726         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4727         (Sized_incr_dynobj::do_section_size): New function.
4728         (Sized_incr_dynobj::do_section_name): New function.
4729         (Sized_incr_dynobj::do_section_contents): New function.
4730         (Sized_incr_dynobj::do_section_flags): New function.
4731         (Sized_incr_dynobj::do_section_entsize): New function.
4732         (Sized_incr_dynobj::do_section_address): New function.
4733         (Sized_incr_dynobj::do_section_type): New function.
4734         (Sized_incr_dynobj::do_section_link): New function.
4735         (Sized_incr_dynobj::do_section_info): New function.
4736         (Sized_incr_dynobj::do_section_addralign): New function.
4737         (Sized_incr_dynobj::do_initialize_xindex): New function.
4738         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4739         (make_sized_incremental_object): New function.
4740         (Incremental_library::copy_unused_symbols): New function.
4741         (Incremental_library::do_for_all_unused_symbols): New function.
4742         * incremental.h (enum Incremental_input_flags): New type.
4743         (class Incremental_checker): Remove.
4744         (Incremental_input_entry::Incremental_input_entry): Add argument
4745         serial number.
4746         (Incremental_input_entry::arg_serial): New function.
4747         (Incremental_input_entry::set_is_in_system_directory): New function.
4748         (Incremental_input_entry::is_in_system_directory): New function.
4749         (Incremental_input_entry::arg_serial_): New data member.
4750         (Incremental_input_entry::is_in_system_directory_): New data member.
4751         (class Script_info): Move here from script.h.
4752         (Script_info::Script_info): Add filename parameter.
4753         (Script_info::filename): New function.
4754         (Script_info::filename_): New data member.
4755         (Incremental_script_entry::Incremental_script_entry): Add argument
4756         serial number.
4757         (Incremental_object_entry::Incremental_object_entry): Likewise.
4758         (Incremental_object_entry::add_input_section): Build list of input
4759         sections with map to original shndx.
4760         (Incremental_object_entry::get_input_section_index): New function.
4761         (Incremental_object_entry::shndx_): New data member.
4762         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4763         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4764         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4765         serial number.
4766         (Incremental_inputs::report_archive_begin): Likewise.
4767         (Incremental_inputs::report_object): Likewise.
4768         (Incremental_inputs::report_script): Likewise.
4769         (class Incremental_global_symbol_reader): New class.
4770         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4771         and store flags and input file type.
4772         (Incremental_input_entry_reader::arg_serial): New function.
4773         (Incremental_input_entry_reader::type): Extract type from flags.
4774         (Incremental_input_entry_reader::is_in_system_directory): New function.
4775         (Incremental_input_entry_reader::get_input_section_count): Call
4776         accessor function for type.
4777         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4778         function for type; adjust size of global symbol entry.
4779         (Incremental_input_entry_reader::get_global_symbol_count): Call
4780         accessor function for type.
4781         (Incremental_input_entry_reader::get_object_count): Likewise.
4782         (Incremental_input_entry_reader::get_object_offset): Likewise.
4783         (Incremental_input_entry_reader::get_member_count): Likewise.
4784         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4785         (Incremental_input_entry_reader::get_member_offset): Likewise.
4786         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4787         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4788         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4789         (Incremental_input_entry_reader::get_global_symbol_reader): New
4790         function.
4791         (Incremental_input_entry_reader::get_output_symbol_index): New
4792         function.
4793         (Incremental_input_entry_reader::type_): Remove.
4794         (Incremental_input_entry_reader::flags_): New data member.
4795         (Incremental_inputs_reader::input_file_offset): New function.
4796         (Incremental_inputs_reader::input_file_index): New function.
4797         (Incremental_inputs_reader::input_file): Call input_file_offset.
4798         (Incremental_inputs_reader::input_file_at_offset): New function.
4799         (Incremental_relocs_reader::get_r_type): Reformat.
4800         (Incremental_relocs_reader::get_r_shndx): Reformat.
4801         (Incremental_relocs_reader::get_r_offset): Reformat.
4802         (Incremental_relocs_reader::data): New function.
4803         (Incremental_binary::Incremental_binary): Initialize new data members.
4804         (Incremental_binary::check_inputs): Add cmdline parameter.
4805         (Incremental_binary::file_is_unchanged): Remove.
4806         (Input_reader::arg_serial): New function.
4807         (Input_reader::get_unused_symbol_count): New function.
4808         (Input_reader::get_unused_symbol): New function.
4809         (Input_reader::do_arg_serial): New function.
4810         (Input_reader::do_get_unused_symbol_count): New function.
4811         (Input_reader::do_get_unused_symbol): New function.
4812         (Incremental_binary::input_file_count): New function.
4813         (Incremental_binary::get_input_reader): Change signature to use
4814         index instead of filename.
4815         (Incremental_binary::file_has_changed): New function.
4816         (Incremental_binary::get_input_argument): New function.
4817         (Incremental_binary::get_library): New function.
4818         (Incremental_binary::get_script_info): New function.
4819         (Incremental_binary::init_layout): New function.
4820         (Incremental_binary::reserve_layout): New function.
4821         (Incremental_binary::output_file): New function.
4822         (Incremental_binary::do_check_inputs): New function.
4823         (Incremental_binary::do_file_is_unchanged): Remove.
4824         (Incremental_binary::do_file_has_changed): New function.
4825         (Incremental_binary::do_init_layout): New function.
4826         (Incremental_binary::do_reserve_layout): New function.
4827         (Incremental_binary::do_input_file_count): New function.
4828         (Incremental_binary::do_get_input_reader): Change signature.
4829         (Incremental_binary::input_args_map_): New data member.
4830         (Incremental_binary::library_map_): New data member.
4831         (Incremental_binary::script_map_): New data member.
4832         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4833         new data members.
4834         (Sized_incremental_binary::output_section): New function.
4835         (Sized_incremental_binary::inputs_reader): Add const.
4836         (Sized_incremental_binary::symtab_reader): Add const.
4837         (Sized_incremental_binary::relocs_reader): Add const.
4838         (Sized_incremental_binary::got_plt_reader): Add const.
4839         (Sized_incremental_binary::get_symtab_view): New function.
4840         (Sized_incremental_binary::Inputs_reader): New typedef.
4841         (Sized_incremental_binary::Input_entry_reader): New typedef.
4842         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4843         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4844         (Sized_incremental_binary::do_file_has_changed): New function.
4845         (Sized_incremental_binary::do_init_layout): New function.
4846         (Sized_incremental_binary::do_reserve_layout): New function.
4847         (Sized_input_reader::Inputs_reader): Remove.
4848         (Sized_input_reader::Input_entry_reader): Remove.
4849         (Sized_input_reader::do_arg_serial): New function.
4850         (Sized_input_reader::do_get_unused_symbol_count): New function.
4851         (Sized_input_reader::do_get_unused_symbol): New function.
4852         (Sized_incremental_binary::do_input_file_count): New function.
4853         (Sized_incremental_binary::do_get_input_reader): Change signature;
4854         use index instead of filename.
4855         (Sized_incremental_binary::section_map_): New data member.
4856         (Sized_incremental_binary::input_entry_readers_): New data member.
4857         (class Sized_incr_relobj): New class.
4858         (class Sized_incr_dynobj): New class.
4859         (make_sized_incremental_object): New function.
4860         (class Incremental_library): New class.
4861         * layout.cc (Free_list::num_lists): New static data member.
4862         (Free_list::num_nodes): New static data member.
4863         (Free_list::num_removes): New static data member.
4864         (Free_list::num_remove_visits): New static data member.
4865         (Free_list::num_allocates): New static data member.
4866         (Free_list::num_allocate_visits): New static data member.
4867         (Free_list::init): New function.
4868         (Free_list::remove): New function.
4869         (Free_list::allocate): New function.
4870         (Free_list::dump): New function.
4871         (Free_list::print_stats): New function.
4872         (Layout_task_runner::run): Resize output file for incremental updates.
4873         (Layout::Layout): Initialize new data members.
4874         (Layout::set_incremental_base): New function.
4875         (Layout::init_fixed_output_section): New function.
4876         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4877         incremental updates.
4878         (Layout::create_gold_note): Do not create gold note section for
4879         incremental updates.
4880         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4881         for incremental updates.
4882         (Layout::set_section_offsets): For incremental updates, allocate space
4883         from free list.
4884         (Layout::create_symtab_sections): Layout with offsets relative to
4885         start of section; for incremental updates, allocate space from free
4886         list.
4887         (Layout::create_shdrs): For incremental updates, allocate space from
4888         free list.
4889         (Layout::finish_dynamic_section): For incremental updates, do not
4890         check --as-needed (fixed in subsequent patch).
4891         * layout.h (class Free_list): New class.
4892         (Layout::set_incremental_base): New function.
4893         (Layout::incremental_base): New function.
4894         (Layout::init_fixed_output_section): New function.
4895         (Layout::allocate): New function.
4896         (Layout::incremental_base_): New data member.
4897         (Layout::free_list_): New data member.
4898         * main.cc (main): Print Free_list statistics.
4899         * object.cc (Relobj::finalize_incremental_relocs): Add
4900         clear_counts parameter; clear counts only when clear_counts is set.
4901         (Sized_relobj::Sized_relobj): Initialize new base class.
4902         (Sized_relobj::do_layout): Don't report special sections.
4903         (Sized_relobj::do_for_all_local_got_entries): New function.
4904         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4905         symtab_off to all symbol table offsets.
4906         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4907         * object.h (class Got_offset_list): Move to top of file.
4908         (Object::Object): Allow case where input_file == NULL.
4909         (Object::~Object): Likewise.
4910         (Object::input_file): Assert that input_file != NULL.
4911         (Object::lock): Allow case where input_file == NULL.
4912         (Object::unlock): Likewise.
4913         (Object::is_locked): Likewise.
4914         (Object::token): Likewise.
4915         (Object::release): Likewise.
4916         (Object::is_incremental): New function.
4917         (Object::get_mtime): New function.
4918         (Object::for_all_local_got_entries): New function.
4919         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4920         (Object::set_is_in_system_directory): New function.
4921         (Object::is_in_system_directory): New function.
4922         (Object::do_is_incremental): New function.
4923         (Object::do_get_mtime): New function.
4924         (Object::do_for_all_local_got_entries): New function.
4925         (Object::is_in_system_directory_): New data member.
4926         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4927         (class Sized_relobj_base): New class.
4928         (class Sized_relobj): Derive from Sized_relobj_base.
4929         (class Sized_relobj::Symbols): Redeclare from base class.
4930         (class Sized_relobj::local_got_offset_list): Remove.
4931         (class Sized_relobj::Output_sections): Redeclare from base class.
4932         (class Sized_relobj::do_for_all_local_got_entries): New function.
4933         (class Sized_relobj::write_local_symbols): Add offset parameter.
4934         (class Sized_relobj::local_symbol_offset_): Update comment.
4935         (class Sized_relobj::local_dynsym_offset_): Update comment.
4936         * options.cc (Input_arguments::add_file): Remove const.
4937         * options.h (Input_file_argument::Input_file_argument):
4938         Initialize arg_serial_ (all constructors).
4939         (Input_file_argument::set_arg_serial): New function.
4940         (Input_file_argument::arg_serial): New function.
4941         (Input_file_argument::arg_serial_): New data member.
4942         (Input_arguments::Input_arguments): Initialize file_count_.
4943         (Input_arguments::add_file): Remove const.
4944         (Input_arguments::number_of_input_files): New function.
4945         (Input_arguments::file_count_): New data member.
4946         (Command_line::number_of_input_files): Call
4947         Input_arguments::number_of_input_files.
4948         * output.cc (Output_segment_headers::Output_segment_headers):
4949         Set current size.
4950         (Output_section::Input_section::current_data_size): New function.
4951         (Output_section::Output_section): Initialize new data members.
4952         (Output_section::add_input_section): Don't do merge sections for
4953         an incremental link; allocate space from free list for an
4954         incremental update.
4955         (Output_section::add_output_section_data): Allocate space from
4956         free list for an incremental update.
4957         (Output_section::update_data_size): New function.
4958         (Output_section::set_fixed_layout): New function.
4959         (Output_section::reserve): New function.
4960         (Output_segment::set_section_addresses): Remove const.
4961         (Output_segment::set_section_list_addresses): Remove const; allocate
4962         space from free list for an incremental update.
4963         (Output_segment::set_offset): Adjust size of RELRO segment for an
4964         incremental update.
4965         * output.h (Output_data::current_data_size): Move here from
4966         child classes.
4967         (Output_data::pre_finalize_data_size): New function.
4968         (Output_data::update_data_size): New function.
4969         (Output_section_headers::update_data_size): new function.
4970         (Output_section_data_build::current_data_size): Move to Output_data.
4971         (Output_data_strtab::update_data_size): New function.
4972         (Output_section::current_data_size): Move to Output_data.
4973         (Output_section::set_fixed_layout): New function.
4974         (Output_section::has_fixed_layout): New function.
4975         (Output_section::reserve): New function.
4976         (Output_section::update_data_size): New function.
4977         (Output_section::has_fixed_layout_): New data member.
4978         (Output_section::free_list_): New data member.
4979         (Output_segment::set_section_addresses): Remove const.
4980         (Output_segment::set_section_list_addresses): Remove const.
4981         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4982         New function.
4983         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4984         New function.
4985         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4986         parameter when calling Add_symbols constructor; store argument
4987         serial number for members of a lib group.
4988         (Add_symbols::locks): Allow case where token == NULL.
4989         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4990         (Read_member::~Read_member): New function.
4991         (Read_member::is_runnable): New function.
4992         (Read_member::locks): New function.
4993         (Read_member::run): New function.
4994         (Check_script::~Check_script): New function.
4995         (Check_script::is_runnable): New function.
4996         (Check_script::locks): New function.
4997         (Check_script::run): New function.
4998         (Check_library::~Check_library): New function.
4999         (Check_library::is_runnable): New function.
5000         (Check_library::locks): New function.
5001         (Check_library::run): New function.
5002         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5003         (Add_symbols::library_): New data member.
5004         (class Read_member): New class.
5005         (class Check_script): New class.
5006         (class Check_library): New class.
5007         * reloc.cc (Read_relocs::is_runnable): Allow case where
5008         token == NULL.
5009         (Read_relocs::locks): Likewise.
5010         (Scan_relocs::locks): Likewise.
5011         (Relocate_task::locks): Likewise.
5012         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5013         to clear counters.
5014         (Sized_relobj::incremental_relocs_scan): Fix comment.
5015         (Sized_relobj::do_relocate): Pass output file offset to
5016         write_local_symbols.
5017         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5018         from class declaration.
5019         * script.cc (read_input_script): Allocate Script_info; pass
5020         argument serial number to report_script.
5021         * script.h (class Script_info): Move to incremental.h.
5022         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5023         * symtab.h (Symbol_table::add_from_incrobj): New function.
5024         (Symbol_table::set_file_offset): New function.
5025
5026 2011-04-05  Cary Coutant  <ccoutant@google.com>
5027
5028         * incremental-dump.cc (dump_incremental_inputs): Change signature
5029         to take a Sized_incremental_binary; change caller.  Use readers
5030         in Sized_incremental_binary.
5031         * incremental.cc
5032         (Sized_incremental_binary::find_incremental_inputs_sections):
5033         Rename do_find_incremental_inputs_sections to this.
5034         (Sized_incremental_binary::setup_readers): New function.
5035         (Sized_incremental_binary::do_check_inputs): Check
5036         has_incremental_info_ flag; move setup code to setup_readers;
5037         use input readers.
5038         (Sized_incremental_binary::do_file_is_unchanged): New function.
5039         (Sized_incremental_binary::do_get_input_reader): New function.
5040         * incremental.h (class Incremental_binary): Move to end of file.
5041         (Incremental_binary::file_is_unchanged): New function.
5042         (Incremental_binary::do_file_is_unchanged): New function.
5043         (Incremental_binary::Input_reader): New class.
5044         (Incremental_binary::get_input_reader): New function.
5045         (class Sized_incremental_binary): Move to end of file.
5046         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5047         input section reader classes.
5048         (Sized_incremental_binary::has_incremental_info): New function.
5049         (Sized_incremental_binary::inputs_reader): New function.
5050         (Sized_incremental_binary::symtab_reader): New function.
5051         (Sized_incremental_binary::relocs_reader): New function.
5052         (Sized_incremental_binary::got_plt_reader): New function.
5053         (Sized_incremental_binary::do_file_is_unchanged): New function.
5054         (Sized_incremental_binary::Sized_input_reader): New class.
5055         (Sized_incremental_binary::get_input_reader): New function.
5056         (Sized_incremental_binary::find_incremental_inputs_sections):
5057         Rename do_find_incremental_inputs_sections to this.
5058         (Sized_incremental_binary::setup_readers): New function.
5059         (Sized_incremental_binary::has_incremental_info_): New data member.
5060         (Sized_incremental_binary::inputs_reader_): New data member.
5061         (Sized_incremental_binary::symtab_reader_): New data member.
5062         (Sized_incremental_binary::relocs_reader_): New data member.
5063         (Sized_incremental_binary::got_plt_reader_): New data member.
5064         (Sized_incremental_binary::current_input_file_): New data member.
5065
5066 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5067
5068         PR gold/12640
5069         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5070         violation.
5071
5072 2011-03-30  Cary Coutant  <ccoutant@google.com>
5073
5074         * archive.cc (Archive::include_member): Adjust call to report_object.
5075         (Add_archive_symbols::run): Add script_info to call to
5076         report_archive_begin.
5077         (Lib_group::include_member): Adjust call to report_object.
5078         (Add_lib_group_symbols::run): Adjust call to report_object.
5079         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5080         blocks.  Add object count for script input files.
5081         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5082         script_info parameter; change all callers.
5083         (Incremental_inputs::report_object): Add script_info parameter;
5084         change all callers.
5085         (Incremental_inputs::report_script): Store backpointer to
5086         incremental info entry.
5087         (Output_section_incremental_inputs::set_final_data_size): Record
5088         additional information for scripts.
5089         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5090         * incremental.h (Incremental_script_entry::add_object): New function.
5091         (Incremental_script_entry::get_object_count): New function.
5092         (Incremental_script_entry::get_object): New function.
5093         (Incremental_script_entry::objects_): New data member; adjust
5094         constructor.
5095         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5096         (Incremental_inputs::report_object): Add script_info parameter.
5097         (Incremental_inputs_reader::get_object_count): New function.
5098         (Incremental_inputs_reader::get_object_offset): New function.
5099         * options.cc (Input_arguments::add_file): Return reference to
5100         new input argument.
5101         * options.h (Input_argument::set_script_info): New function.
5102         (Input_argument::script_info): New function.
5103         (Input_argument::script_info_): New data member; adjust all
5104         constructors.
5105         (Input_file_group::add_file): Return reference to new input argument.
5106         (Input_file_lib::add_file): Likewise.
5107         (Input_arguments::add_file): Likewise.
5108         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5109         * script.cc (Parser_closure::Parser_closure): Add script_info
5110         parameter; adjust all callers.
5111         (Parser_closure::script_info): New function.
5112         (Parser_closure::script_info_): New data member.
5113         (read_input_script): Report scripts earlier to incremental info.
5114         (script_add_file): Set script_info in Input_argument.
5115         (script_add_library): Likewise.
5116         * script.h (Script_options::Script_info): Rewrite class.
5117
5118 2011-03-29  Cary Coutant  <ccoutant@google.com>
5119
5120         * archive.cc (Library_base::should_include_member): Move
5121         method here from class Archive.
5122         (Archive::Archive): Initialize base class.
5123         (Archive::should_include_member): Move to base class.
5124         (Archive::do_for_all_unused_symbols): New function.
5125         (Add_archive_symbols::run): Remove redundant access to
5126         incremental_inputs.
5127         (Lib_group::Lib_group): Initialize base class.
5128         (Lib_group::do_filename): New function.
5129         (Lib_group::include_member): Pass pointer to Lib_group to
5130         report_object.
5131         (Lib_group::do_for_all_unused_symbols): New function.
5132         (Add_lib_group_symbols::run): Report archive information for
5133         incremental links.
5134         * archive.h (class Library_base): New base class.
5135         (class Archive): Derive from Library_base.
5136         (Archive::filename): Move to base class.
5137         (Archive::set_incremental_info): Likewise.
5138         (Archive::incremental_info): Likewise.
5139         (Archive::Should_include): Likewise.
5140         (Archive::should_include_member): Likewise.
5141         (Archive::Armap_entry): Remove.
5142         (Archive::Unused_symbol_iterator): Remove.
5143         (Archive::unused_symbols_begin): Remove.
5144         (Archive::unused_symbols_end): Remove.
5145         (Archive::do_filename): New function.
5146         (Archive::do_get_mtime): New function.
5147         (Archive::do_for_all_unused_symbols): New function.
5148         (Archive::task_): Move to base class.
5149         (Archive::incremental_info_): Likewise.
5150         (class Lib_group): Derive from Library_base.
5151         (Lib_group::do_filename): New function.
5152         (Lib_group::do_get_mtime): New function.
5153         (Lib_group::do_for_all_unused_symbols): New function.
5154         (Lib_group::task_): Move to base class.
5155         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5156         function.
5157         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5158         function.
5159         * incremental.cc (Incremental_inputs::report_archive_begin):
5160         Use Library_base; call library's get_mtime; add incremental inputs
5161         entry before members.
5162         (class Unused_symbol_visitor): New class.
5163         (Incremental_inputs::report_archive_end): Use Library_base; use
5164         visitor class to record unused symbols; don't add incremental inputs
5165         entry after members.
5166         (Incremental_inputs::report_object): Use Library_base.
5167         * incremental.h
5168         (Incremental_archive_entry::Incremental_archive_entry): Remove
5169         unused Archive parameter.
5170         (Incremental_inputs::report_archive_begin): Use Library_base.
5171         (Incremental_inputs::report_archive_end): Likewise.
5172         (Incremental_inputs::report_object): Likewise.
5173         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5174         function.
5175         * object.h (Object::for_all_global_symbols): New function.
5176         (Object::do_for_all_global_symbols): New function.
5177         (Sized_relobj::do_for_all_global_symbols): New function.
5178         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5179         function.
5180         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5181         function.
5182
5183 2011-03-27  Ian Lance Taylor  <iant@google.com>
5184
5185         * archive.cc (Archive::interpret_header): Return -1 if something
5186         goes wrong.  Change callers accordingly.
5187
5188 2011-03-25  Cary Coutant  <ccoutant@google.com>
5189
5190         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5191         * testsuite/Makefile.in: Regenerate.
5192
5193 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5194
5195         * plugin.cc (get_view): New.
5196         (Plugin::load): Pass get_view to the plugin.
5197         (Plugin_manager::get_view): New.
5198
5199 2011-03-21  Ian Lance Taylor  <iant@google.com>
5200
5201         * testsuite/final_layout.sh: Rewrite to not use dc.
5202         * testsuite/relro_test.sh: Fail if dc is not present.
5203
5204 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5205
5206         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5207         Change == to -eq.
5208         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5209         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5210         Change == to -eq.
5211         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5212         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5213
5214 2011-03-14  Ian Lance Taylor  <iant@google.com>
5215
5216         * script-sections.cc (Sort_output_sections::script_compare):
5217         Rename from is_before, change return type.
5218         (Sort_output_sections::operator()): Adjust accordingly.
5219
5220 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5221
5222         PR gold/12572
5223         * testsuite/odr_violation2.cc: Add comment to make all error line
5224         numbers double digits.
5225         * testsuite/debug_msg.sh: Adjust expected errors.
5226
5227 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5228
5229         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5230         but mark earlier ones as non-canonical
5231         (offset_to_iterator): Update search target and example
5232         (do_addr2line): Return extra lines in a vector*
5233         (format_file_lineno): Extract from do_addr2line
5234         (one_addr2line): Add vector* out-param
5235         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5236         when a lineno entry appeared last for its instruction
5237         (Dwarf_line_info): Add vector* out-param
5238         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5239         * symtab.cc (Odr_violation_compare): Include the lineno in the
5240         comparison again.
5241         (linenos_from_loc): New. Combine the canonical line for an
5242         address with its other lines.
5243         (True_if_intersect): New. Helper functor to make
5244         std::set_intersection a query.
5245         (detect_odr_violations): Compare sets of lines instead of just
5246         one line for each function. This became less deterministic, but
5247         has fewer false positives.
5248         * symtab.h: Declarations.
5249         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5250         mix an optimized and non-optimized object in the same binary
5251         (odr_violation2.so): Same.
5252         * testsuite/Makefile.in: Regenerate from Makefile.am.
5253         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5254         * testsuite/debug_msg.sh: Update line numbers and add
5255         assertions.
5256         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5257         non-optimized context.
5258         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5259         isn't inlined, and use OdrDerived in an optimized context.
5260         * testsuite/odr_header1.h: Defines OdrDerived, where
5261         optimization will change the
5262         first-instruction-in-the-destructor's file and line number.
5263         * testsuite/odr_header2.h: Defines OdrBase.
5264
5265 2011-03-09  Ian Lance Taylor  <iant@google.com>
5266
5267         * fileread.cc (File_read::clear_views): Don't delete the whole
5268         file view.
5269
5270 2011-03-08  Ian Lance Taylor  <iant@google.com>
5271
5272         PR gold/12525
5273         * fileread.cc: #include <climits>.
5274         (GOLD_IOV_MAX): Define.
5275         (File_read::read_multiple): Limit number of entries by iov_max.
5276         * fileread.h (class File_read): Always set max_readv_entries to
5277         128.
5278
5279 2011-03-07  Ian Lance Taylor  <iant@google.com>
5280
5281         PR gold/12525
5282         * options.h (class General_options): Add -dy and -dn.
5283
5284 2011-03-02  Cary Coutant  <ccoutant@google.com>
5285
5286         * testsuite/script_test_9.t: Add TLS segment.
5287
5288 2011-03-02  Simon Baldwin  <simonb@google.com>
5289
5290         * configure.ac: Add check for gnu_indirect_function support in
5291         the toolchain building binutils.
5292         * configure: Rebuild.
5293
5294 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5295
5296         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5297         plugin only symbols.
5298         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5299         in plugin files as not needed in the symbol table.
5300
5301 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5302
5303         * output.cc (Output_section::add_input_section): Delay fill
5304         generation for section ordering.
5305
5306 2011-02-09  Ian Lance Taylor  <iant@google.com>
5307
5308         PR gold/12316
5309         * object.h (class Sized_relobj): Remove clear_local_symbols.
5310         * reloc.cc (Sized_relobj::do_relocate): Don't call
5311         clear_local_symbols.
5312
5313 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5314
5315         * plugin.cc (is_visible_from_outside): Return true for symbols
5316         in the -u option.
5317
5318 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5319
5320         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5321         filename.
5322
5323 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5324
5325         * icf.h (is_section_foldable_candidate): Change type of parameter
5326         to std::string.
5327         * icf.cc (Icf::find_identical_sections): Change type of local variable
5328         section_name to be std::string.
5329         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5330
5331 2011-01-25  Ian Lance Taylor  <iant@google.com>
5332
5333         * script.cc (script_add_extern): Rewrite to use
5334         add_symbol_reference.
5335
5336 2011-01-25  Doug Kwan  <dougkwan@google.com>
5337
5338         * icf.cc (get_section_contents): Always lock section's object.
5339
5340 2011-01-24  Ian Lance Taylor  <iant@google.com>
5341
5342         * options.h (class General_options): Accept
5343         --no-detect-odr-violations.
5344
5345 2011-01-24  Ian Lance Taylor  <iant@google.com>
5346
5347         * version.cc (version_string): Bump to 1.11.
5348
5349 2011-01-24  Ian Lance Taylor  <iant@google.com>
5350
5351         * plugin.cc (class Plugin_rescan): Define new class.
5352         (Plugin_manager::claim_file): Set any_claimed_.
5353         (Plugin_manager::save_archive): New function.
5354         (Plugin_manager::save_input_group): New function.
5355         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5356         necessary.
5357         (Plugin_manager::new_undefined_symbol): New function.
5358         (Plugin_manager::rescan): New function.
5359         (Plugin_manager::rescannable_defines): New function.
5360         (Plugin_manager::add_input_file): Set any_added_.
5361         * plugin.h (class Plugin_manager): define new fields rescannable_,
5362         undefined_symbols_, any_claimed_, and any_added_.  Declare
5363         Plugin_rescan as friend.  Declare new functions.
5364         (Plugin_manager::Rescannable): Define type.
5365         (Plugin_manager::Rescannable_list): Define type.
5366         (Plugin_manager::Undefined_symbol_list): Define type.
5367         (Plugin_manager::Plugin_manager): Initialize new fields.
5368         * archive.cc (Archive::defines_symbol): New function.
5369         (Add_archive_symbols::run): Pass archive to plugins if any.
5370         * archive.h (class Archive): Declare defines_symbol.
5371         * readsyms.cc (Input_group::~Input_group): New function.
5372         (Finish_group::run): Pass input_group to plugins if any.
5373         * readsyms.h (class Input_group): Declare destructor.
5374         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5375         any.
5376
5377 2011-01-10  Ian Lance Taylor  <iant@google.com>
5378
5379         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5380         section as relro.
5381         (Layout::set_segment_offsets): Reset increase_relro before calling
5382         set_section_addresses a second time.
5383
5384 2011-01-04  Cary Coutant  <ccoutant@google.com>
5385
5386         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5387         sections before NOBITS sections.
5388
5389 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5390
5391         * version.cc (print_version): Update copyright to 2011.
5392
5393 2010-12-23  Cary Coutant  <ccoutant@google.com>
5394
5395         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5396         of OS to this->add.  Add OD parameter to second form of the function.
5397
5398 2010-12-20  Ian Lance Taylor  <iant@google.com>
5399
5400         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5401         second of two consecutive entries with same offset.
5402
5403 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5404
5405         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5406         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5407         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5408         to avoid unneeded links against $(LDADD).
5409         * testsuite/Makefile.in: Regenerate.
5410
5411 2010-12-15  Ian Lance Taylor  <iant@google.com>
5412
5413         PR gold/12324
5414         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5415         for R_X86_64_32 and R_X86_64_PC32.
5416         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5417         ver_matching_def_pic.o.
5418         (ver_matching_def_pic.o): New target.
5419
5420 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5421
5422         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5423         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5424         Move definition before File_read::View member definitions.
5425         (File_read::View::~View): Initialize and hold lock before
5426         updating current_mapped_bytes.
5427
5428 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5429
5430         * dwarf_reader.cc: Remove outdated comment.
5431         * gold-threads.cc: Fix typo in error message.
5432         * archive.cc: Fix typos in comments.
5433         * archive.h: Likewise.
5434         * arm-reloc-property.cc: Likewise.
5435         * arm-reloc-property.h: Likewise.
5436         * arm-reloc.def: Likewise.
5437         * arm.cc: Likewise.
5438         * attributes.h: Likewise.
5439         * cref.cc: Likewise.
5440         * ehframe.cc: Likewise.
5441         * fileread.h: Likewise.
5442         * gold.h: Likewise.
5443         * i386.cc: Likewise.
5444         * icf.cc: Likewise.
5445         * incremental.h: Likewise.
5446         * int_encoding.cc: Likewise.
5447         * layout.h: Likewise.
5448         * main.cc: Likewise.
5449         * merge.h: Likewise.
5450         * object.cc: Likewise.
5451         * object.h: Likewise.
5452         * options.cc: Likewise.
5453         * readsyms.cc: Likewise.
5454         * reduced_debug_output.cc: Likewise.
5455         * reloc.cc: Likewise.
5456         * script-sections.cc: Likewise.
5457         * sparc.cc: Likewise.
5458         * symtab.h: Likewise.
5459         * target-reloc.h: Likewise.
5460         * target.cc: Likewise.
5461         * target.h: Likewise.
5462         * timer.cc: Likewise.
5463         * timer.h: Likewise.
5464         * x86_64.cc: Likewise.
5465
5466 2010-12-09  Cary Coutant  <ccoutant@google.com>
5467
5468         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5469         stack.
5470         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5471         parameter; change all callers.
5472         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5473         * options.h (warn_execstack): New option.
5474
5475 2010-12-07  Doug Kwan  <dougkwan@google.com>
5476
5477         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5478         like function call relocations.
5479
5480 2010-12-07  Ian Lance Taylor  <iant@google.com>
5481
5482         * archive.cc (Archive::get_elf_object_for_member): Permit
5483         punconfigured to be NULL.
5484         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5485         (Archive::include_member): Pass NULL to get_elf_object_for_member
5486         if we searched for the archive and this is the first included
5487         object.
5488
5489 2010-12-01  Ian Lance Taylor  <iant@google.com>
5490
5491         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5492         track_relocs_type_ field.
5493         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5494         Set track_relocs_type_.
5495         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5496         contents when using RELA relocs.
5497         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5498         reloc_map_.
5499         * reloc.cc (Track_relocs::next_addend): New function.
5500         * reloc.h (class Track_relocs): Declare next_addend.
5501
5502 2010-12-01  Ian Lance Taylor  <iant@google.com>
5503
5504         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5505         virtual destructor.
5506
5507 2010-12-01  Ian Lance Taylor  <iant@google.com>
5508
5509         * README: Update compilers known to work and fail.
5510
5511 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5512
5513         * configure.in: For --enable-gold, handle value `default' instead of
5514         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5515         not the default.
5516         * configure: Regenerate.
5517
5518 2010-11-18  Doug Kwan  <dougkwan@google.com>
5519
5520         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5521         and right_alignment to be zero.  Store result alignment only if it is
5522         greater than existing alignment.
5523
5524 2010-11-16  Cary Coutant  <ccoutant@google.com>
5525
5526         PR gold/12220
5527         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5528         Check for ".zdebug_line".
5529
5530 2010-11-16  Doug Kwan  <dougkwan@google.com>
5531             Cary Coutant  <ccoutant@google.com>
5532
5533         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5534         by reference; adjust all callers.
5535         * output.cc (Output_segment::set_section_addresses): Adjust references
5536         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5537         list is empty.
5538         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5539         end at page boundary.
5540
5541 2010-11-16  Cary Coutant  <ccoutant@google.com>
5542
5543         PR gold/12220
5544         * layout.cc (Layout::choose_output_section): Transform names of
5545         compressed sections even when using a script with a SECTIONS clause.
5546         (Layout::output_section_name): Remove code to transform
5547         compressed debug section names.
5548         * output.cc (Output_section::add_input_section): Use uncompressed
5549         section size when tracking input sections.
5550
5551 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5552
5553         * symtab.h (Symbol::NON_PIC_REF): Remove.
5554         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5555         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5556         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5557         (Symbol::use_plt_offset): Take a flags argument and pass it
5558         directly to needs_dynamic_reloc.  Restrict check for undefined
5559         weak symbols to function calls.
5560         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5561         (Target_arm::Scan::global): Use it.
5562         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5563         (Target_arm::Relocate::relocate): Likewise.
5564         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5565         parameter with an r_type parameter.  Use get_reference_flags
5566         to get the flags.
5567         (Target_arm::Relocate::relocate): Update accordingly.
5568         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5569         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5570         (Target_i386::Scan::global): Likewise.
5571         (Target_i386::Relocate::relocate): Likewise.
5572         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5573         parameter with an r_type parameter.  Use get_reference_flags
5574         to get the flags.
5575         (Target_i386::Relocate::relocate): Update accordingly.
5576         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5577         (Target_powerpc::Scan::global): Use it.
5578         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5579         (Target_powerpc::Relocate::relocate): Likewise.
5580         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5581         (Target_sparc::Scan::global): Use it.
5582         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5583         (Target_sparc::Relocate::relocate): Likewise.
5584         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5585         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5586         (Target_x86_64::Scan::global): Likewise.
5587         (Target_x86_64::Relocate::relocate): Likewise.
5588
5589 2010-11-08  Doug Kwan  <dougkwan@google.com>
5590             Cary Coutant  <ccoutant@google.com>
5591
5592         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5593         (Arm_exidx_merge_section::section_contents_): New data member.
5594         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5595         (Arm_input_section::~Arm_input_section): De-allocate memory.
5596         (Arm_input_section::original_contents_): New data member.
5597         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5598         in parameters instead of calling Object::section_contents without
5599         locking.
5600         (Arm_output_section::group_section): New parameter TASK.  Pass it
5601         to callees that need locking objects.
5602         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5603         to lock EXIDX input sections.  Fix a formatting issue.  Call
5604         Arm_exidx_merged_section::build_contents to create merged section
5605         contents.
5606         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5607         to lock object of stub table owner.
5608         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5609         TEXT_SIZE to initialize data member TEXT_SIZE_.
5610         (Arm_exidx_input_section::addralign): Fix typo in comment.
5611         (Arm_exidx_input_section::text_size): New method.
5612         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5613         that require locking objects.  Lock objects before scanning for stubs
5614         and updating local symbols.
5615         (Arm_input_section<big_endian>::init): Copy contents of original
5616         input section.
5617         (Arm_input_section<big_endian>::do_write): Use saved contents of
5618         original input section instead of calling Object::section_contents
5619         without locking.
5620         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5621         size without calling Object::section_size().
5622         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5623         for size.  Allocate a buffer for merged EXIDX entries.
5624         (Arm_exidx_merged_section::build_contents): New method.
5625         (Arm_exidx_merged_section::do_write): Move merge section contents
5626         building code to Arm_exidx_merged_section::build_contetns.  Write
5627         out contetns in buffer instead of building it on the fly.
5628         (Arm_relobj::make_exidx_input_section): Also pass text section size
5629         to Arm_exidx_input_section constructor.
5630         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5631         (Arm_dynobj::do_read_symbols): Fix memory leak.
5632         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5633         * target.h: (class Task): Add forward declaration.
5634         (Target::relax): Add new parameter TASK and pass it to
5635         Target::do_relax().
5636         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5637
5638 2010-11-05  Cary Coutant  <ccoutant@google.com>
5639
5640         PR gold/10708
5641         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5642         object when reading from the file.
5643         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5644         second layout pass.
5645         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5646         when reading section contents.
5647         (get_section_contents): Likewise.
5648         (icf::find_identical_sections): Likewise.
5649         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5650         object when reading from the file.
5651         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5652         the object when doing deferred section layout.
5653
5654 2010-11-03  Nick Clifton  <nickc@redhat.com>
5655
5656         PR gold/12001
5657         * script.h (class Symbol_assignment: name): New member.  Returns
5658         the name of the symbol.
5659         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5660         Returns true if the given symbol name is on the list of
5661         assignments wating to be processed.
5662         * archive.cc (should_incldue_member): If the symbol is undefined,
5663         check to see if it is on the list of symbols pending assignment.
5664
5665 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5666
5667         * script-sections.cc (Script_sections::find_memory_region): Check
5668         for a NULL output section pointer.
5669
5670 2010-10-29  Doug Kwan  <dougkwan@google.com>
5671
5672         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5673         Output_section::add_relaxed_input_section.
5674         * output.cc (Output_section::add_relaxed_input_section): Add new
5675         arguments LAYOUT and NAME.  Set section order index.
5676         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5677         Copy section order index.
5678         * output.h (Output_section::add_relaxed_input_section): Add new
5679         arguments LAYOUT and NAME.
5680
5681 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5682
5683         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5684         NATIVE_OR_CROSS_LINKER.
5685         * testsuite/Makefile.in: Regenerate.
5686
5687 2010-10-20  Doug Kwan  <dougkwan@google.com>
5688
5689         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5690         without SHF_LINK_ORDER flags.
5691         * layout.cc (Layout::choose_output_section): Do not filter
5692         SHF_LINK_ORDER flag in a relocatable link.
5693
5694 2010-10-17  Cary Coutant  <ccoutant@google.com>
5695
5696         * output.h (Output_segment::set_section_addresses): Change function
5697         signature.  Update all callers.
5698         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5699         sections.
5700         (Output_segment::set_section_addresses): Align after last TLS
5701         section.  Add padding before last relro section instead of after.
5702
5703 2010-10-17  Doug Kwan  <dougkwan@google.com>
5704
5705         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5706         GOT output section to be writable.
5707
5708 2010-10-14  Cary Coutant  <ccoutant@google.com>
5709
5710         * debug.h (DEBUG_INCREMENTAL): New flag.
5711         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5712         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5713         mode.
5714         * incremental.cc (report_command_line): Ignore all forms of
5715         --incremental.
5716         * layout.cc (Layout::Layout): Check parameters for incremental link
5717         mode.
5718         * options.cc (General_options::parse_incremental): New function.
5719         (General_options::parse_no_incremental): New function.
5720         (General_options::parse_incremental_full): New function.
5721         (General_options::parse_incremental_update): New function.
5722         (General_options::incremental_mode_): New data member.
5723         (General_options::finalize): Check incremental_mode_.
5724         * options.h (General_options): Update help text for --incremental.
5725         Add --no-incremental, --incremental-full, --incremental-update.
5726         (General_options::Incremental_mode): New enum type.
5727         (General_options::incremental_mode): New function.
5728         (General_options::incremental_mode_): New data member.
5729         * parameters.cc (Parameters::incremental_mode_): New data member.
5730         (Parameters::set_options): Set incremental_mode_.
5731         (Parameters::set_incremental_full): New function.
5732         (Parameters::incremental): New function.
5733         (Parameters::incremental_update): New function.
5734         (set_parameters_incremental_full): New function.
5735         * parameters.h (Parameters::set_incremental_full): New function.
5736         (Parameters::incremental): New function.
5737         (Parameters::incremental_update): New function.
5738         (Parameters::incremental_mode_): New data member.
5739         (set_parameters_incremental_full): New function.
5740         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5741         incremental link mode.
5742         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5743         (Sized_relobj::do_relocate_sections): Likewise.
5744         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5745         option.
5746         * testsuite/Makefile.in: Regenerate.
5747         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5748
5749 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5750
5751         * script-sections.h (class Script_sections): Make
5752         Sections_elements typedef public.
5753         * script-sections.cc (class Sort_output_sections): Add elements_
5754         field.  Add constructor which sets it; change all callers.
5755         (Sort_output_sections::is_before): New function.
5756         (Sort_output_sections::operator()): Call is_before.
5757         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5758         conditional.
5759         * testsuite/script_test_10.sh: New test. Test script section
5760         order.
5761         * testsuite/script_test_10.t: Likewise.
5762         * testsuite/script_test_10.s: Likewise.
5763         * testsuite/Makefile.am: Wrap the cross linker tests and the
5764         common tests into NATIVE_OR_CROSS_LINKER.
5765         (check_SCRIPTS): Add script_test_10.sh.
5766         (check_DATA): Add script_test_10.stdout.
5767         (script_test_10.o, script_test_10): New targets.
5768         (script_test_10.stdout): New target.
5769         * configure, testsuite/Makefile.in: Regenerate.
5770
5771 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5772
5773         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5774         error for the deprecated relocations.
5775         (Target_arm::Scan::global): Likewise.
5776         (Target_arm::Relocate::relocate): Likewise.
5777
5778 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5779
5780         * fileread.cc (Input_file::find_file): Initialize *found_name
5781         and *namep when using the fallback search for case 4.
5782
5783 2010-10-11  Cary Coutant  <ccoutant@google.com>
5784
5785         * options.h (class General_options): Redefine -z lazy as an alias for
5786         the negation of -z now.
5787
5788 2010-10-11  Ian Lance Taylor  <iant@google.com>
5789
5790         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5791         binding.
5792
5793 2010-10-06  Nick Clifton  <nickc@redhat.com>
5794
5795         * script-sections.cc(class Memory_region): Remove
5796         current_lma_offset_ field.  Rename current_vma_offset_ to
5797         current_offset_.  Add last_section_ field.
5798         (Memory_region::get_current_vma_address): Rename to
5799         get_current_address.
5800         (Memory_region::get_current_lma_address): Delete.
5801         (Memory_region::increment_vma_offset): Rename to
5802         increment_offset.
5803         (Memory_region::increment_lma_offset): Delete.
5804         (Memory_region::attributes_compatible): New method.  Returns
5805         true if the provided section is compatible with the region.
5806         (Memory_region::get_last_section): New method.  Returns the last
5807         section to use the region.
5808         (Memory_region::set_last_section): New method.  Stores the last
5809         section to use the region.
5810         (Script_sections::block_in_region): New method.  Returns true if
5811         a block of memory is contained within a region.
5812         (Script_sections::find_memory_region): New method.  Locates a
5813         memory region to be used to set a VMA or LMA address.
5814         (Output_section_definition::set_section_addresses): Add code to
5815         check for addresses set by memory regions.
5816         (Output_segment::set_section_addresses): Remove memory region
5817         walking code.
5818         (Script_sections::create_segment): Add a warning if a header
5819         segment is created outside of any region.
5820         * script-sections.h (class Script_sections): Add prototypes for
5821         find_memory_region and block_in_region methods.
5822         * testsuite/memory_test.s: Use .long instead of .word.
5823         * testsuite/memory_test.t: Add some more output sections.
5824         * testsuite/memory_test.sh: Update expected output.
5825
5826 2010-10-02  Doug Kwan  <dougkwan@google.com>
5827
5828         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5829         defintion to symtab.h
5830         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5831         declaration to defintion.
5832
5833 2010-10-01  Nick Clifton  <nickc@redhat.com>
5834
5835         * expression.cc (eval): Replace dummy argument with NULL.
5836         (eval_maybe_dot): Check for a NULL result section pointer.
5837         (Symbol_expression::value): Likewise.
5838         (Dot_expression::value): Likewise.
5839         (BINARY_EXPRESSION): Likewise.
5840         (Max_expression::value): Likewise.
5841         (Min_expression::value): Likewise.
5842         (Absolute_expression::value): Likewise.
5843         (Addr_expression::value_from_output_section): Likewise.
5844         (Loaddddr_expression::value_from_output_section): Likewise.
5845         (Segment_start_expression::value): Likewise.
5846         * script-sections.cc
5847         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5848         argument with NULL.
5849         (Sections_elememt_dot_assignment::set_section_addresses):
5850         Likewise.
5851         (Output_data_expression::do_write_to_buffer): Likewise.
5852         (Output_section_definition::finalize_symbols): Likewise.
5853         (Output_section_definition::set_section_addresses): Likewise.
5854
5855 2010-09-30  Doug Kwan  <dougkwan@google.com>
5856
5857         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5858
5859 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5860
5861         * target.h (Target::can_icf_inline_merge_sections): New virtual
5862         function.
5863         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5864         virtual function.
5865         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5866         virtual function.
5867         * icf.cc (get_section_contents): Inline merge sections only when
5868         target allows it.
5869
5870 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5871
5872         * configure: Regenerate.
5873
5874 2010-09-17  Ian Lance Taylor  <iant@google.com>
5875
5876         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5877         * testsuite/Makefile.am (memory_test.o): New target.
5878         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5879         memory_test.t.
5880         * testsuite/Makefile.in: Rebuild.
5881
5882 2010-09-17  Doug Kwan  <dougkwan@google.com>
5883
5884         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5885         defintion if relocation uses GOT entries of the symbol.
5886         * testsuite/icf_safe_test.sh: Fix test.
5887         * testsuite/icf_safe_so_test.sh: Fix test.
5888
5889 2010-09-16  Cary Coutant  <ccoutant@google.com>
5890
5891         * script_sections.cc (class Memory_region): Remove "NULL" from
5892         vector initializations.
5893
5894 2010-09-15  Cary Coutant  <ccoutant@google.com>
5895
5896         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5897         Resolve forwarding symbols.
5898
5899 2010-09-15  Doug Kwan  <dougkwan@google.com>
5900
5901         * gold/testsuite/script_test_3.t: Add ARM special sections.
5902         * gold/testsuite/script_test_4.t: Same.
5903         * gold/testsuite/script_test_5.t: Same.
5904         * gold/testsuite/script_test_6.t: Same.
5905         * gold/testsuite/script_test_7.t: Same.
5906         * gold/testsuite/script_test_7.t: Same.
5907         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5908
5909 2010-09-14  Cary Coutant  <ccoutant@google.com>
5910
5911         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5912         (Target_x86_64::Relocate::relocate_tls): Replace check for
5913         saw_tls_block_reloc_ with test for executable section.
5914
5915 2010-09-12  Cary Coutant  <ccoutant@google.com>
5916
5917         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5918         position-independent executables to shared libraries need dynamic
5919         relocations.
5920         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5921         position-independent executables.
5922         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5923         * testsuite/Makefile.in: Regenerate.
5924
5925 2010-09-10  Nick Clifton  <nickc@redhat.com>
5926
5927         PR gold/11997
5928         * testsuite/memory_test.t: Discard any sections that are not
5929         needed.
5930
5931 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5932
5933         PR gold/11996
5934         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5935         "This::" to work around a bug in gcc 4.2.
5936
5937         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5938
5939 2010-09-09  Rafael Espindola  <espindola@google.com>
5940
5941         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5942         sections with different PF_X flags in the same segment.
5943         (Layout::find_first_load_seg): Search all segments to find the first
5944         one.
5945         * options.h (rosegment): New.
5946
5947 2010-09-08  Rafael Espindola  <espindola@google.com>
5948
5949         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5950
5951 2010-09-08  Doug Kwan  <dougkwan@google.com>
5952
5953         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5954         (Arm_relobj::do_relocate_sections): Add new parameter for output
5955         file to match the parent.
5956         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5957         of local symbols instead of input values.  Update code to track
5958         changes in gold::relocate_section.
5959         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5960         (Sized_relobj::compute_final_local_value_internal): New methods.
5961         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5962         body into private version of Sized_relobj::compute_final_local_value.
5963         Call the inline method.
5964         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5965         merged symbol value if there is one.
5966         (Symbol_value::has_output_value): New method defintiion.
5967         (Sized_relobj::Compute_final_local_value_status): New enum type.
5968         (Sized_relobj::compute_final_local_value): New methods.
5969         (Sized_relobj::compute_final_local_value_internal): New methods.
5970         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5971         and arm_cortex_a8.sh.
5972         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5973         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5974         New tests.
5975         * Makefile.in: Regenerate.
5976         * testsuite/arm_bl_out_of_range.s: Update test.
5977         * testsuite/thumb_bl_out_of_range.s: Ditto.
5978         * testsuite/thumb_blx_out_of_range.s: Ditto.
5979         * testsuite/arm_branch_out_of_range.sh: New file.
5980         * testsuite/arm_cortex_a8.sh: Ditto.
5981         * testsuite/arm_cortex_a8_b.s: Ditto.
5982         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5983         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5984         * testsuite/arm_cortex_a8_bl.s: Ditto.
5985         * testsuite/arm_cortex_a8_blx.s: Ditto.
5986         * testsuite/arm_cortex_a8_local.s: Ditto.
5987         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5988         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5989
5990 2010-09-08  Rafael Espindola  <espindola@google.com>
5991
5992         * Makefile.am (memory_test.stdout): Run readelf with -W.
5993         * Makefile.in: Regenerate.
5994         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5995         64 bit output.
5996
5997 2010-09-08  Rafael Espindola  <espindola@google.com>
5998
5999         * script-sections.cc (Script_sections::add_memory_region): Convert
6000         field precision to int.
6001         * script.cc (script_set_section_region, script_set_section_region):
6002         Convert field precision to int.
6003
6004 2010-09-08  Rafael Espindola  <espindola@google.com>
6005
6006         * arm.cc (do_finalize_sections): Create the __exidx_start and
6007         __exdix_end symbols even when the section is missing.
6008
6009 2010-09-08  Nick Clifton  <nickc@redhat.com>
6010
6011         * README: Remove claim that MEMORY is not supported.
6012         * expression.cc (script_exp_function_origin)
6013         (script_exp_function_length): Move from here to ...
6014         * script.cc: ... here.
6015         (script_set_section_region, script_add_memory)
6016         (script_parse_memory_attr, script_include_directive): New
6017         functions.
6018         * script-sections.cc
6019         (class Memory_region): New class.
6020         (class Output_section_definition): Add set_memory_region,
6021         set_section_vma, set_section_lma and get_section_name methods.
6022         (class Script_Sections): Add add_memory_region,
6023         find_memory_region, find_memory_region_origin,
6024         find_memory_region_length and set_memory_region methods.
6025         Have set_section_addresses method walk the list of set memory
6026         regions.
6027         Extend the print methos to display memory regions.
6028         * script-sections.h: Add prototypes for new methods.
6029         Add enum for MEMORY region attributes.
6030         * yyscript.y: Add support for parsing MEMORY regions.
6031         * script-c.h: Add prototypes for new functions.
6032         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6033         * testsuite/Makefile.in: Regenerate.
6034         * testsuite/memory_test.sh: New script.
6035         * testsuite/memory_test.s: New assembler source file.
6036         * testsuite/memory_test.t: New linker script.
6037
6038 2010-08-27  Doug Kwan  <dougkwan@google.com>
6039
6040         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6041         reference override an existing dynamic weak reference.
6042         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6043         * testsuite/Makefile.in: Regenerate.
6044         * testsuite/dyn_weak_ref.sh: New file.
6045         * testsuite/dyn_weak_ref_1.c: Ditto.
6046         * testsuite/dyn_weak_ref_2.c: Ditto.
6047
6048 2010-08-27  Ian Lance Taylor  <iant@google.com>
6049
6050         * incremental.h (class Incremental_input_entry): Add virtual
6051         destructor.
6052
6053 2010-08-27  Ian Lance Taylor  <iant@google.com>
6054
6055         * testsuite/start_lib_test_3.c: Mark t3 as used.
6056
6057 2010-08-27  Nick Clifton  <nickc@redhat.com>
6058
6059         * options.cc (version_script): Fix small typo in previous
6060         whitespace tidyup.
6061
6062 2010-08-25  Nick Clifton  <nickc@redhat.com>
6063
6064         * archive.cc: Formatting fixes: Remove whitespace between
6065         typename and following asterisk.  Remove whitespace between
6066         function name and opening parenthesis.
6067         * archive.h: Likewise.
6068         * arm.cc: Likewise.
6069         * attributes.cc: Likewise.
6070         * attributes.h: Likewise.
6071         * common.cc: Likewise.
6072         * copy-relocs.cc: Likewise.
6073         * dirsearch.h: Likewise.
6074         * dynobj.cc: Likewise.
6075         * ehframe.cc: Likewise.
6076         * ehframe.h: Likewise.
6077         * expression.cc: Likewise.
6078         * fileread.cc: Likewise.
6079         * fileread.h: Likewise.
6080         * gc.h: Likewise.
6081         * gold-threads.cc: Likewise.
6082         * gold.cc: Likewise.
6083         * i386.cc: Likewise.
6084         * icf.h: Likewise.
6085         * incremental-dump.cc: Likewise.
6086         * incremental.cc: Likewise.
6087         * layout.cc: Likewise.
6088         * layout.h: Likewise.
6089         * main.cc: Likewise.
6090         * merge.cc: Likewise.
6091         * merge.h: Likewise.
6092         * object.cc: Likewise.
6093         * object.h: Likewise.
6094         * options.cc: Likewise.
6095         * options.h: Likewise.
6096         * output.cc: Likewise.
6097         * output.h: Likewise.
6098         * plugin.cc: Likewise.
6099         * plugin.h: Likewise.
6100         * powerpc.cc: Likewise.
6101         * reloc.cc: Likewise.
6102         * script-c.h: Likewise.
6103         * script-sections.cc: Likewise.
6104         * script.cc: Likewise.
6105         * stringpool.cc: Likewise.
6106         * symtab.cc: Likewise.
6107         * symtab.h: Likewise.
6108         * target.cc: Likewise.
6109         * timer.cc: Likewise.
6110         * timer.h: Likewise.
6111         * version.cc: Likewise.
6112         * x86_64.cc: Likewise.
6113
6114 2010-08-24  Nick Clifton  <nickc@redhat.com>
6115
6116         PR 11899
6117         * layout.cc (segment_precedes): Sort segments by their physical
6118         addresses, if they have been set.
6119
6120 2010-08-23  Cary Coutant  <ccoutant@google.com>
6121
6122         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6123         symbols data.
6124         (Lib_group::include_member): Unlock object after deleting its
6125         symbols data.
6126         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6127         the bug fixed here.
6128
6129 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6130             Cary Coutant  <ccoutant@google.com>
6131
6132         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6133         constructor, and set_blocker.
6134         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6135         readsyms_blocker_.
6136         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6137         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6138         * testsuite/Makefile.am (start_lib_test): New test case.
6139         * testsuite/Makefile.in: Regenerate.
6140         * testsuite/start_lib_test_main.c: New file.
6141         * testsuite/start_lib_test_1.c: New file.
6142         * testsuite/start_lib_test_2.c: New file.
6143         * testsuite/start_lib_test_3.c: New file.
6144
6145 2010-08-19  Ian Lance Taylor  <iant@google.com>
6146
6147         * Makefile.in: Rebuild with automake 1.11.1.
6148         * aclocal.m4: Likewise.
6149         * testsuite/Makefile.in: Likewise.
6150
6151 2010-08-19  Ian Lance Taylor  <iant@google.com>
6152
6153         PR 10893
6154         * i386.cc (class Output_data_plt_i386): Update declarations.
6155         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6156         local_ifuncs_ fields.
6157         (Target_i386::do_plt_section_for_global): New function.
6158         (Target_i386::do_plt_section_for_local): New function.
6159         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6160         parameter; change all callers.  Initialize global_ifuncs_ and
6161         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6162         __rel_iplt_end.
6163         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6164         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6165         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6166         symbols.
6167         (Target_i386::make_plt_section): New function, broken out of
6168         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6169         (Target_i386::make_plt_entry): Call make_plt_section.
6170         (Target_i386::make_local_ifunc_plt_entry): New function.
6171         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6172         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6173         R_386_IRELATIVE to switch.
6174         (Target_i386::Scan::global): Likewise.
6175         (Target_i386::Relocate::relocate): Likewise.
6176         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6177         switch.
6178         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6179         (Target_x86_64::do_plt_section_for_global): New function.
6180         (Target_x86_64::do_plt_section_for_local): New function.
6181         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6182         parameter; change all callers.  If doing a static link define
6183         __rela_iplt_start and __rela_iplt_end.
6184         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6185         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6186         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6187         to point to .plt.
6188         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6189         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6190         switch.
6191         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6192         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6193         R_X86_64_IRELATIVE to switch.
6194         (Target_x86_64::Scan::global): Likewise.
6195         (Target_x86_64::Relocate::relocate): Likewise.
6196         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6197         switch.
6198         * target.h (class Target): Add plt_section_for_global and
6199         plt_section_for_local functions.  Add do_plt_section_for_global
6200         and do_plt_section_for_local virtual functions.
6201         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6202         clarifying comments.
6203         (Symbol::use_plt_offset): Handle IFUNC symbol.
6204         * object.cc (Sized_relobj::Sized_relobj): Initialize
6205         local_plt_offsets_.
6206         (Sized_relobj::local_has_plt_offset): New function.
6207         (Sized_relobj::local_plt_offset): New function.
6208         (Sized_relobj::set_local_plt_offset): New function.
6209         (Sized_relobj::do_count): Handle IFUNC symbol.
6210         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6211         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6212         is_ifunc_symbol functions.
6213         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6214         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6215         local_plt_offsets_ field.
6216         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6217         * output.h (class Output_section_data): Add non-const
6218         output_section function.
6219         (class Output_data_got): Update declarations.
6220         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6221         Add use_plt_offset parameter to global and local constructors.
6222         Change all callers.  Change local_sym_index_ field to 31 bits.
6223         Change GSYM_CODE and CONSTANT_CODE accordingly.
6224         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6225         doing a static link don't set sh_link field.
6226         (Output_data_got::Got_entry::write): Use PLT offset if
6227         appropriate.
6228         (Output_data_got::add_global_plt): New function.
6229         (Output_data_got::add_local_plt): New function.
6230         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6231         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6232         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6233         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6234         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6235         IFUNC conditional.
6236         * testsuite/ifunc-sel.h: New file.
6237         * testsuite/ifuncmain1.c: New file.
6238         * testsuite/ifuncmain1vis.c: New file.
6239         * testsuite/ifuncmod1.c: New file.
6240         * testsuite/ifuncdep2.c: New file.
6241         * testsuite/ifuncmain2.c: New file.
6242         * testsuite/ifuncmain3.c: New file.
6243         * testsuite/ifuncmod3.c: New file.
6244         * testsuite/ifuncmain4.c: New file.
6245         * testsuite/ifuncmain5.c: New file.
6246         * testsuite/ifuncmod5.c: New file.
6247         * testsuite/ifuncmain6pie.c: New file.
6248         * testsuite/ifuncmod6.c: New file.
6249         * testsuite/ifuncmain7.c: New file.
6250         * configure, testsuite/Makefile.in: Rebuild.
6251
6252 2010-08-18  Ian Lance Taylor  <iant@google.com>
6253
6254         * incremental.cc
6255         (Output_section_incremental_inputs::write_input_files): Add cast
6256         to avoid signed/unsigned comparison warning.
6257         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6258
6259 2010-08-12  Cary Coutant  <ccoutant@google.com>
6260
6261         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6262
6263 2010-08-13  Ian Lance Taylor  <iant@google.com>
6264
6265         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6266
6267 2010-08-12  Cary Coutant  <ccoutant@google.com>
6268             Doug Kwan  <dougkwan@google.com>
6269
6270         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6271         defintion overrides non-weak undef, remember that the original undef
6272         is not weak.
6273         * symtab.cc (Symbol_table::sized_write_global): For undef without
6274         an original weak binding, set binding to global in output.
6275         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6276         * testsuite/Makefile.in: Regenerate.
6277         * testsuite/strong_ref_weak_def.sh: New file.
6278         * testsuite/strong_ref_weak_def_1.c: Ditto.
6279         * testsuite/strong_ref_weak_def_2.c: Ditto.
6280
6281 2010-08-12  Cary Coutant  <ccoutant@google.com>
6282
6283         * testsuite/incremental_test.sh: Rewrite.
6284         * testsuite/incremental_test_1.c: Rewrite.
6285         * testsuite/incremental_test_2.c: Rewrite.
6286
6287 2010-08-12  Cary Coutant  <ccoutant@google.com>
6288
6289         * arm.cc (Target_arm::got_size): Add const.
6290         (Target_arm::got_entry_count): New function.
6291         (Target_arm::plt_entry_count): New function.
6292         (Target_arm::first_plt_entry_offset): New function.
6293         (Target_arm::plt_entry_size): New function.
6294         (Output_data_plt_arm::entry_count): New function.
6295         (Output_data_plt_arm::first_plt_entry_offset): New function.
6296         (Output_data_plt_arm::get_plt_entry_size): New function.
6297         * i386.cc (Target_i386::got_size): Add const.
6298         (Target_i386::got_entry_count): New function.
6299         (Target_i386::plt_entry_count): New function.
6300         (Target_i386::first_plt_entry_offset): New function.
6301         (Target_i386::plt_entry_size): New function.
6302         (Output_data_plt_i386::entry_count): New function.
6303         (Output_data_plt_i386::first_plt_entry_offset): New function.
6304         (Output_data_plt_i386::get_plt_entry_size): New function.
6305         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6306         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6307         * incremental.cc: Include target.h.
6308         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6309         parameter.  Adjust all callers.  Find incremental_got_plt section.
6310         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6311         section.
6312         (Output_section_incremental_inputs::set_final_data_size): Calculate
6313         size of incremental_got_plt section.
6314         (Output_section_incremental_inputs::do_write): Write the
6315         incremental_got_plt section.
6316         (Got_plt_view_info): New struct.
6317         (Local_got_offset_visitor): New class.
6318         (Global_got_offset_visitor): New class.
6319         (Global_symbol_visitor_got_plt): New class.
6320         (Output_section_incremental_inputs::write_got_plt): New function.
6321         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6322         Add parameter.  Adjust all callers.
6323         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6324         (Incremental_inputs::got_plt_section): New function.
6325         (Incremental_inputs::got_plt_section_): New data member.
6326         (Incremental_got_plt_reader): New class.
6327         * layout.cc (Layout::create_incremental_info_sections): Add the
6328         incremental_got_plt section.
6329         * object.h (Got_offset_list::get_list): New function.
6330         (Got offset_list::for_all_got_offsets): New function.
6331         (Sized_relobj::local_got_offset_list): New function.
6332         * powerpc.cc (Target_powerpc::got_size): Add const.
6333         (Target_powerpc::got_entry_count): New function.
6334         (Target_powerpc::plt_entry_count): New function.
6335         (Target_powerpc::first_plt_entry_offset): New function.
6336         (Target_powerpc::plt_entry_size): New function.
6337         (Output_data_plt_powerpc::entry_count): New function.
6338         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6339         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6340         * sparc.cc (Target_sparc::got_size): Add const.
6341         (Target_sparc::got_entry_count): New function.
6342         (Target_sparc::plt_entry_count): New function.
6343         (Target_sparc::first_plt_entry_offset): New function.
6344         (Target_sparc::plt_entry_size): New function.
6345         (Output_data_plt_sparc::entry_count): New function.
6346         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6347         (Output_data_plt_sparc::get_plt_entry_size): New function.
6348         * symtab.h (Symbol::got_offset_list): New function.
6349         (Symbol_table::for_all_symbols): New function.
6350         * target.h (Sized_target::got_entry_count): New function.
6351         (Sized_target::plt_entry_count): New function.
6352         (Sized_target::plt_entry_size): New function.
6353         * x86_64.cc (Target_x86_64::got_size): Add const.
6354         (Target_x86_64::got_entry_count): New function.
6355         (Target_x86_64::plt_entry_count): New function.
6356         (Target_x86_64::first_plt_entry_offset): New function.
6357         (Target_x86_64::plt_entry_size): New function.
6358         (Output_data_plt_x86_64::entry_count): New function.
6359         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6360         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6361
6362 2010-08-12  Cary Coutant  <ccoutant@google.com>
6363
6364         * archive.cc: Include incremental.h.
6365         (Archive::Archive): Initialize incremental_info_.
6366         (Archive::include_member): Record archive members in incremental info.
6367         (Add_archive_symbols::run): Record begin and end of an archive in
6368         incremental info.
6369         (Lib_group::include_member): Record objects in incremental info.
6370         * archive.h (Incremental_archive_entry): Forward declaration.
6371         (Archive::set_incremental_info): New member function.
6372         (Archive::incremental_info): New member function.
6373         (Archive::Unused_symbol_iterator): New class.
6374         (Archive::unused_symbols_begin): New member function.
6375         (Archive::unused_symbols_end): New member function.
6376         (Archive::incremental_info_): New data member.
6377         * incremental-dump.cc (find_input_containing_global): New function.
6378         (dump_incremental_inputs): Dump new incremental info sections.
6379         * incremental.cc: Include symtab.h.
6380         (Output_section_incremental_inputs): New class.
6381         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6382         new incremental info sections.
6383         (Sized_incremental_binary::do_check_inputs): Likewise.
6384         (Incremental_inputs::report_archive): Remove.
6385         (Incremental_inputs::report_archive_begin): New function.
6386         (Incremental_inputs::report_archive_end): New function.
6387         (Incremental_inputs::report_object): New function.
6388         (Incremental_inputs::finalize_inputs): Remove.
6389         (Incremental_inputs::report_input_section): New function.
6390         (Incremental_inputs::report_script): Rewrite.
6391         (Incremental_inputs::finalize): Do nothing but finalize string table.
6392         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6393         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6394         (Incremental_inputs::create_data_sections): New function.
6395         (Incremental_inputs::relocs_entsize): New function.
6396         (Output_section_incremental_inputs::set_final_data_size): New function.
6397         (Output_section_incremental_inputs::do_write): New function.
6398         (Output_section_incremental_inputs::write_header): New function.
6399         (Output_section_incremental_inputs::write_input_files): New function.
6400         (Output_section_incremental_inputs::write_info_blocks): New function.
6401         (Output_section_incremental_inputs::write_symtab): New function.
6402         * incremental.h (Incremental_script_entry): Forward declaration.
6403         (Incremental_object_entry): Forward declaration.
6404         (Incremental_archive_entry): Forward declaration.
6405         (Incremental_inputs): Forward declaration.
6406         (Incremental_inputs_header_data): Remove.
6407         (Incremental_inputs_header): Remove.
6408         (Incremental_inputs_header_write): Remove.
6409         (Incremental_inputs_entry_data): Remove.
6410         (Incremental_inputs_entry): Remove.
6411         (Incremental_inputs_entry_write): Remove.
6412         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6413         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6414         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6415         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6416         Likewise.
6417         (Incremental_input_entry): New class.
6418         (Incremental_script_entry): New class.
6419         (Incremental_object_entry): New class.
6420         (Incremental_archive_entry): New class.
6421         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6422         (Incremental_inputs::report_inputs): Remove.
6423         (Incremental_inputs::report_archive): Remove.
6424         (Incremental_inputs::report_archive_begin): New function.
6425         (Incremental_inputs::report_archive_end): New function.
6426         (Incremental_inputs::report_object): Change prototype.
6427         (Incremental_inputs::report_input_section): New function.
6428         (Incremental_inputs::report_script): Change prototype.
6429         (Incremental_inputs::get_reloc_count): New function.
6430         (Incremental_inputs::set_reloc_count): New function.
6431         (Incremental_inputs::create_data_sections): New function.
6432         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6433         (Incremental_inputs::inputs_section): New function.
6434         (Incremental_inputs::symtab_section): New function.
6435         (Incremental_inputs::relocs_section): New function.
6436         (Incremental_inputs::get_stringpool): Add const.
6437         (Incremental_inputs::command_line): Add const.
6438         (Incremental_inputs::inputs): Remove.
6439         (Incremental_inputs::command_line_key): New function.
6440         (Incremental_inputs::input_file_count): New function.
6441         (Incremental_inputs::input_files): New function.
6442         (Incremental_inputs::relocs_entsize): New function.
6443         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6444         (Incremental_inputs::finalize_inputs): Remove.
6445         (Incremental_inputs::Input_info): Remove.
6446         (Incremental_inputs::lock_): Remove.
6447         (Incremental_inputs::inputs_): Change type.
6448         (Incremental_inputs::inputs_map_): Remove.
6449         (Incremental_inputs::current_object_entry_): New data member.
6450         (Incremental_inputs::inputs_section_): New data member.
6451         (Incremental_inputs::symtab_section_): New data member.
6452         (Incremental_inputs::relocs_section_): New data member.
6453         (Incremental_inputs::reloc_count_): New data member.
6454         (Incremental_inputs_reader): New class.
6455         (Incremental_symtab_reader): New class.
6456         (Incremental_relocs_reader): New class.
6457         * layout.cc (Layout::finalize): Move finalization of incremental info
6458         and creation of incremental info sections to follow finalization of
6459         symbol table.  Set offsets for postprocessing sections.
6460         (Layout::create_incremental_info_sections): Call
6461         Incremental_inputs::create_data_sections.  Add incremental symtab
6462         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6463         sections to layout after input sections.
6464         * layout.h (struct Timespec): Forward declaration.
6465         (Layout::incremental_inputs): Add const.
6466         (Layout::create_incremental_info_sections): Add parameter.
6467         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6468         * object.cc: Include incremental.h.
6469         (Relobj::finalize_incremental_relocs): New function.
6470         (Sized_relobj::do_layout): Record input sections in incremental info.
6471         * object.h (Object::output_section): New function.
6472         (Object::output_section_offset): Moved from Relobj.
6473         (Object::get_incremental_reloc_base): New function.
6474         (Object::get_incremental_reloc_count): New function.
6475         (Object::do_output_section): New function.
6476         (Object::do_output_section_offset): Moved from Relobj.
6477         (Object::do_get_incremental_reloc_base): New function.
6478         (Object::do_get_incremental_reloc_count): New function.
6479         (Object::Object): Initialize new data members.
6480         (Relobj::output_section): Renamed do_output_section and moved to
6481         protected.
6482         (Relobj::output_section_offset): Moved to Object.
6483         (Relobj::do_get_incremental_reloc_base): New function.
6484         (Relobj::do_get_incremental_reloc_count): New function.
6485         (Relobj::allocate_incremental_reloc_counts): New function.
6486         (Relobj::count_incremental_reloc): New function.
6487         (Relobj::finalize_incremental_relocs): New function.
6488         (Relobj::next_incremental_reloc_index): New function.
6489         (Relobj::reloc_counts_): New data member.
6490         (Relobj::reloc_bases_): New data member.
6491         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6492         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6493         (Sized_relobj::incremental_relocs_scan): New function.
6494         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6495         (Sized_relobj::incremental_relocs_write): New function.
6496         (Sized_relobj::incremental_relocs_write_reltype): New function.
6497         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6498         incremental link.
6499         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6500         archives and object files elsewhere.
6501         (Add_symbols::run): Report object files here.
6502         (Finish_group::run): Report end of archive at end of group.
6503         * reloc.cc: Include layout.h, incremental.h.
6504         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6505         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6506         (Sized_relobj::incremental_relocs_scan): New function.
6507         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6508         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6509         (Sized_relobj::incremental_relocs_write): New function.
6510         (Sized_relobj::incremental_relocs_write_reltype): New function.
6511         * script.cc (read_input_script): Rewrite test for incremental link.
6512         Change call to Incremental_inputs::report_script.
6513         * symtab.h (Symbol_table::first_global_index): New function.
6514         (Symbol_table::output_count): New function.
6515
6516 2010-08-12  Doug Kwan  <dougkwan@google.com>
6517
6518         * arm.cc (Target_arm::merge_object_attributes): Check command line
6519         options --no-wchar-size-warning and --no-enum-size-warning.
6520         * options.h (General_options): Add ld-compatible options
6521         --no-enum-size-warning and --no-wchar-size-warning.
6522
6523 2010-08-04  Ian Lance Taylor  <iant@google.com>
6524
6525         * x86_64.cc (Target_x86_64::Scan::local): Use
6526         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6527         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6528         (Target_x86_64::Scan::global): Likewise.
6529         (Target_x86_64::Relocate::relocate): Likewise.
6530         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6531         Likewise.
6532
6533 2010-08-03  Cary Coutant  <ccoutant@google.com>
6534
6535         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6536         to reserve space in merged_strings vector. Keep total input size
6537         for stats.
6538         (Output_merge_string::do_print_merge_stats): Print total input size.
6539         * merge.h (Output_merge_string): Add input_size_ field.
6540         * stringpool.cc (Stringpool_template::string_length): Move
6541         implementations out of Stringpool_template class and place in
6542         stringpool.h.
6543         * stringpool.h (string_length): Move out of Stringpool_template.
6544
6545 2010-08-03  Ian Lance Taylor  <iant@google.com>
6546
6547         PR 11712
6548         * layout.cc (relaxation_loop_body): If address of load segment is
6549         set, adjust address to include headers if possible.
6550
6551 2010-08-03  Ian Lance Taylor  <iant@google.com>
6552
6553         * version.cc (version_string): Bump to 1.10.
6554
6555 2010-08-03  Ian Lance Taylor  <iant@google.com>
6556
6557         PR 11805
6558         * layout.h (enum Output_section_order): Define.
6559         (class Layout): Update declarations.
6560         * layout.cc (Layout::get_output_section): Add order parameter.
6561         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6562         is_first_non_relro parameters.  Change all callers.
6563         (Layout::choose_output_section): Likewise.
6564         (Layout::add_output_section_data): Likewise.
6565         (Layout::make_output_section): Likewise.  Set order.
6566         (Layout::default_section_order): New function.
6567         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6568         * output.cc (Output_section::Output_section): Initialize order_.
6569         Don't initialize deleted fields.
6570         (Output_segment::Output_segment): Don't initialize deleted
6571         fields.
6572         (Output_segment::add_output_section_to_load): New function
6573         replacing add_output_section.  Change all callers to call this or
6574         add_output_section_to_nonload.
6575         (Output_segment::add_output_section_to_nonload): New function.
6576         (Output_segment::remove_output_section): Rewrite.
6577         (Output_segment::add_initial_output_data): Likewise.
6578         (Output_segment::has_any_data_sections): Likewise.
6579         (Output_segment::is_first_section_relro): Likewise.
6580         (Output_segment::maximum_alignment): Likewise.
6581         (Output_segment::has_dynamic_reloc): New function replacing
6582         dynamic_reloc_count.  Change all callers.
6583         (Output_segment::has_dynamic_reloc_list): New function replacing
6584         dynamic_reloc_count_list.  Change all callers.
6585         (Output_segment::set_section_addresses): Rewrite.
6586         (Output_segment::set_offset): Rewrite.
6587         (Output_segment::find_first_and_last_list): Remove.
6588         (Output_segment::set_tls_offsets): Rewrite.
6589         (Output_segment::first_section_load_address): Likewise.
6590         (Output_segment::output_section_count): Likewise.
6591         (Output_segment::section_with_lowest_load_address): Likewise.
6592         (Output_segment::write_section_headers): Likewise.
6593         (Output_segment::print_sections_to_map): Likewise.
6594         * output.h (class Output_data): Remove dynamic_reloc_count_
6595         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6596         (Output_data::add_dynamic_reloc): Rewrite.
6597         (Output_data::has_dynamic_reloc): New function.
6598         (Output_data::dynamic_reloc_count): Remove.
6599         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6600         is_last_relro_, is_first_non_relro_, is_interp_,
6601         is_dynamic_linker_section_ fields.  Add order and set_order
6602         functions.  Remove is_relro_local, set_is_relro_local,
6603         is_last_relro, set_is_last_relro, is_first_non_relro,
6604         set_is_first_non_relro functions, is_interp, set_is_interp,
6605         is_dynamic_linker_section, and set_is_dynamic_linker_section
6606         functions.
6607         (class Output_segment): Change Output_data_list from std::list to
6608         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6609         output_bss_ fields.  Update declarations.
6610
6611 2010-08-02  Ian Lance Taylor  <iant@google.com>
6612
6613         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6614         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6615         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6616
6617 2010-08-02  Ian Lance Taylor  <iant@google.com>
6618
6619         PR 11855
6620         * script.cc (Script_options::Script_options): Initialize
6621         symbol_definitions_ and symbol_references_.
6622         (Script_options::add_symbol_assignment): Update
6623         symbol_definitions_ and symbol_references_.
6624         (Script_options::add_symbol_reference): New function.
6625         (script_symbol): New function.
6626         * script.h (class Script_options): Add symbol_definitions_ and
6627         symbol_references_ fields.
6628         (Script_options::referenced_const_iterator): New type.
6629         (Script_options::referenced_begin): New function.
6630         (Script_options::referenced_end): New function.
6631         (Script_options::is_referenced): New function.
6632         (Script_options::any_unreferenced): New function.
6633         * script-c.h (script_symbol): Declare.
6634         * yyscript.y (exp): Call script_symbol.
6635         * symtab.cc: Include "script.h".
6636         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6637         Change all callers.  Check symbols referenced by scripts.
6638         (Symbol_table::add_undefined_symbols_from_command_line): Add
6639         layout parameter.  Change all callers.
6640         (Symbol_table::do_add_undefined_symbols_from_command_line):
6641         Likewise.  Break out loop body.  Check symbols referenced by
6642         scripts.
6643         (Symbol_table::add_undefined_symbol_from_command_line): New
6644         function broken out of
6645         do_add_undefined_symbols_from_command_line.
6646         * symtab.h (class Symbol_table): Update declarations.
6647         * archive.cc: Include "layout.h".
6648         (Archive::should_include_member): Add layout parameter.  Change
6649         all callers.  Check for symbol mentioned in expression.
6650         * archive.h (class Archive): Update declaration.
6651         * object.cc (Sized_relobj::do_should_include_member): Add layout
6652         parameter.
6653         * object.h (Object::should_include_member): Add layout parameter.
6654         Change all callers.
6655         (Object::do_should_include_member): Add layout parameter.
6656         (class Sized_relobj): Update declaration.
6657         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6658         parameter.
6659         * dynobj.h (class Sized_dynobj): Update declaration.
6660         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6661         layout parameter.
6662         * plugin.h (class Sized_pluginobj): Update declaration.
6663
6664 2010-08-02  Ian Lance Taylor  <iant@google.com>
6665
6666         PR 11866
6667         * output.cc (Output_segment::set_offset): Search for the first and
6668         last sections rather than assuming that the list is in order.
6669         (Output_segment::find_first_and_last_list): New function.
6670         * output.h (class Output_segment): Update declarations.
6671         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6672         (relro_strip_test_SOURCES): New variable.
6673         (relro_strip_test_DEPENDENCIES): New variable.
6674         (relro_strip_test_LDFLAGS): New variable.
6675         (relro_strip_test_LDADD): New variable.
6676         (relro_strip_test.so): New target.
6677
6678 2010-08-02  Ian Lance Taylor  <iant@google.com>
6679
6680         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6681         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6682         (Target_i386::got_tlsdesc_section): New function.
6683         (Target_i386::got_section): Create space for GOT entries for
6684         TLSDESC relocations.
6685         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6686         R_386_TLS_GOTDESC.
6687         (Target_i386::Scan::global): Likewise.
6688         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6689         using TLSDESC GOT.
6690         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6691         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6692         (Target_x86_64::got_tlsdesc_section): New function.
6693         (Target_x86_64::got_section): Create space for GOT entries for
6694         TLSDESC relocations.
6695         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6696         R_386_TLS_GOTDESC.
6697         (Target_x86_64::Scan::global): Likewise.
6698         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6699         using TLSDESC GOT.
6700
6701 2010-08-02  Ian Lance Taylor  <iant@google.com>
6702
6703         * testsuite/final_layout.sh: Use dc to convert from hex to
6704         decimal.
6705
6706 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6707
6708         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6709         paramter to the call to gold::gc_process_relocs.
6710         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6711         paramter to the call to gold::gc_process_relocs.
6712         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6713         parameter to the call to gold::gc_process_relocs.
6714         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6715         template parameter to the call to gold::gc_process_relocs.
6716         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6717         paramter to the call to gold::gc_process_relocs.
6718         * gc.h (get_embedded_addend_size): New function.
6719         (gc_process_relocs): Save the size of the reloc for use by ICF.
6720         * icf.cc (get_section_contents): Get the addend from the text section
6721         for SHT_REL relocation sections.
6722         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6723         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6724         * int_encoding.h (read_from_pointer): New overloaded function.
6725         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6726         * testsuite/icf_sht_rel_addend_test.sh: New file.
6727         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6728         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6729
6730 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6731
6732         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6733         * Makefile.in: Regenerate.
6734         * testsuite/Makefile.in: Regenerate.
6735
6736 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6737
6738         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6739         * gold/testsuite/debug_msg.cc: Likewise.
6740         * gold/testsuite/odr_violation1.cc
6741         * gold/testsuite/odr_violation2.cc
6742
6743 2010-07-21  Cary Coutant  <ccoutant@google.com>
6744
6745         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6746         string, and length fields.
6747         (Output_merge_string::Merged_strings_list): New type.
6748         (Output_merge_string::Merged_strings_lists): New typedef.
6749         (Output_merge_string): Replace merged_strings_ with
6750         merged_strings_lists_.
6751         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6752         Merged_strings_list per input object and section.  Don't store pointer
6753         to the string.  Don't store length with each merged string entry.
6754         (Output_merge_string::finalize_merged_data): Loop over list of merged
6755         strings lists.  Recompute length of each merged string.
6756
6757 2010-07-15  Cary Coutant  <ccoutant@google.com>
6758
6759         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6760         here.
6761
6762 2010-07-14  Ian Lance Taylor  <iant@google.com>
6763
6764         * descriptors.cc (Descriptors::open): Report correct name in error
6765         message.
6766
6767 2010-07-13  Doug Kwan  <dougkwan@google.com>
6768
6769         * arm.cc (Arm_input_section::Arm_input_section): For a
6770         SHT_ARM_EXIDX section, always keeps the input sections.
6771         (Arm_input_section::set_exidx_section_link): New method.
6772         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6773         has_errors_ to false.
6774         (Arm_exidx_input_section::has_errors,
6775         Arm_exidx_input_section::set_has_errors): New methods.
6776         (Arm_exidx_input_section::has_errors_): New data member.
6777         (Arm_relobj::get_exidx_shndx_list): New method.
6778         (Arm_output_section::append_text_sections_to_list): Do not skip
6779         section without SHF_EXECINSTR.
6780         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6781         errors.
6782         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6783         section header.  Make error messages more verbose.  Check for
6784         a non-executable section linked to an EXIDX section.
6785         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6786         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6787         check that there is no deferred EXIDX section if we exit early.
6788         Instead of not making an EXIDX section in case of an error, make one
6789         and set the has_errors flag of it.
6790         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6791         in a relocatable link.
6792         (Target_arm::do_relax): Look for the EXIDX output section instead of
6793         assuming that it is called .ARM.exidx.
6794         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6795         section list.  Do not check for SHF_EXECINSTR section flags but
6796         skip any input section with errors.
6797         * output.cc (Output_section::Output_section): Initialize
6798         always_keeps_input_sections_ to false.
6799         (Output_section::add_input_section): Check for
6800         always_keeps_input_sections_.
6801         *  output.h (Output_section::always_keeps_input_sections,
6802         Output_section::set_always_keeps_input_sections): New methods.
6803         (Output_section::always_keeps_input_sections): New data member.
6804
6805 2010-07-13  Rafael Espindola  <espindola@google.com>
6806
6807         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6808         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6809
6810 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6811             Ian Lance Taylor  <iant@google.com>
6812
6813         * output.h (Output_section_lookup_maps::add_merge_section):
6814         Correct check of whether value was inserted.
6815         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6816         (Output_section_lookup_maps::add_relaxed_input_section):
6817         Likewise.
6818         * arm.cc (Target_arm::got_section): Remove used local os.
6819         * i386.cc (Target_i386::got_section): Likewise.
6820         * x86_64.cc (Target_x86_64::got_section): Likewise.
6821         * sparc.cc (Target_sparc::got_section): Likewise.
6822         (Target_sparc::relocate): Remove unused local have_got_offset.
6823         * powerpc.cc (Target_powerpc::relocate): Likewise.
6824
6825 2010-07-13  Ian Lance Taylor  <iant@google.com>
6826
6827         * compressed_output.cc (zlib_decompress): Fix signature in
6828         !HAVE_ZLIB_H case.
6829
6830         * archive.cc (Archive::include_member): Unlock an external member
6831         of a thin archive.  Don't bother to delete an object we know is
6832         NULL.
6833
6834 2010-07-12  Cary Coutant  <ccoutant@google.com>
6835
6836         * compressed_output.cc (zlib_decompress): New function.
6837         (get_uncompressed_size): New function.
6838         (decompress_input_section): New function.
6839         * compressed_output.h (get_uncompressed_size): New function.
6840         (decompress_input_section): New function.
6841         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6842         Handle compressed debug sections.
6843         * layout.cc (is_compressed_debug_section): New function.
6844         (Layout::output_section_name): Map compressed section names to
6845         canonical names.
6846         * layout.h (is_compressed_debug_section): New function.
6847         (is_debug_info_section): Recognize compressed debug sections.
6848         * merge.cc: Include compressed_output.h.
6849         (Output_merge_data::do_add_input_section): Handle compressed
6850         debug sections.
6851         (Output_merge_string::do_add_input_section): Handle compressed
6852         debug sections.
6853         * object.cc: Include compressed_output.h.
6854         (Sized_relobj::Sized_relobj): Initialize new data members.
6855         (build_compressed_section_map): New function.
6856         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6857         * object.h (Object::section_is_compressed): New method.
6858         (Object::do_section_is_compressed): New method.
6859         (Sized_relobj::Compressed_section_map): New type.
6860         (Sized_relobj::do_section_is_compressed): New method.
6861         (Sized_relobj::compressed_sections_): New data member.
6862         * output.cc (Output_section::add_input_section): Handle compressed
6863         debug sections.
6864         * reloc.cc: Include compressed_output.h.
6865         (Sized_relobj::write_sections): Handle compressed debug sections.
6866
6867 2010-07-08  Cary Coutant  <ccoutant@google.com>
6868
6869         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6870         weak when resolving to a dynamic def.
6871         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6872         for weak undef/dynamic def cases. Adjust callers.
6873         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6874         undef_binding_weak_.
6875         (Symbol_table::sized_write_globals): Adjust symbol binding.
6876         (Symbol_table::sized_write_symbol): Add binding parameter.
6877         * symtab.h (Symbol::set_undef_binding): New method.
6878         (Symbol::is_undef_binding_weak): New method.
6879         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6880         (Symbol_table::should_override): Add new parameter.
6881         (Symbol_table::sized_write_symbol): Add new parameter.
6882
6883         * testsuite/weak_undef_file1.cc: Add new test case.
6884         * testsuite/weak_undef_file2.cc: Fix header comment.
6885         * testsuite/weak_undef_test.cc: Add new test case.
6886
6887 2010-06-29  Doug Kwan  <dougkwan@google.com>
6888
6889         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6890         Initialize USE_SYMBOL_.
6891         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6892         definition.
6893         (Arm_reloc_property::uses_symbol_): New data member declaration.
6894         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6895         uses symbol value and symbol is undefined but not weakly undefined.
6896
6897 2010-06-28  Rafael Espindola  <espindola@google.com>
6898
6899         * plugin.cc (Plugin::load): Use dlerror.
6900
6901 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6902
6903         * symtab.cc (detect_odr_violations): When reporting an ODR
6904         violation, report an object where the symbol is defined.
6905
6906 2010-06-25  Doug Kwan  <dougkwan@google.com>
6907
6908         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6909         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6910         definition.
6911         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6912         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6913         target hook to detect function points.
6914         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6915         * icf.h (Icf::check_section_for_function_pointers): Change type of
6916         parameter SECTION_NAME to const reference to std::string.  Use
6917         target hook to determine if section may have unsafe pointers.
6918         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6919         method definition.
6920
6921 2010-06-21  Rafael Espindola  <espindola@google.com>
6922
6923         * fileread.cc (Input_file::find_fie): New
6924         (Input_file::open): Use Input_file::find_fie.
6925         * fileread.h (Input_file::find_fie): New
6926         * plugin.cc (set_extra_library_path): New.
6927         (Plugin::load): Add set_extra_library_path to the transfer vector.
6928         (Plugin_manager::set_extra_library_path): New.
6929         (Plugin_manager::add_input_file): Use the extra search path if set.
6930         (set_extra_library_path(): New.
6931         * plugin.h (Plugin_manager): Add set_extra_library_path and
6932         extra_search_path_.
6933
6934 2010-06-19  Cary Coutant  <ccoutant@google.com>
6935
6936         * layout.cc (gdb_sections): Add .debug_types.
6937         (lines_only_debug_sections): Likewise.
6938
6939 2010-06-18  Rafael Espindola  <espindola@google.com>
6940
6941         * plugin.cc (add_input_file,add_input_library)
6942         (Plugin_manager::add_input_file): Make filename arguments const.
6943         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6944         const.
6945
6946 2010-06-16  Doug Kwan  <dougkwan@google.com>
6947
6948         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6949         .ARM.attributes section if we have not merged any input
6950         attributes sections.
6951
6952 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6953
6954         * arm.cc: Allow combining objects with no EABI version
6955         information.
6956
6957 2010-06-15  Rafael Espindola  <espindola@google.com>
6958
6959         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6960
6961 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6962
6963         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6964         (struct iovec): Correct !HAVE_READV definition.
6965
6966 2010-06-10  Cary Coutant  <ccoutant@google.com>
6967
6968         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6969         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6970         reloc sections.
6971         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6972
6973         PR 11683
6974         * symtab.h (Symbol::is_placeholder): New member function.
6975         * target-reloc.h (relocate_section): Check for placeholder symbols.
6976
6977         * testsuite/Makefile.am (plugin_test_8): New test.
6978         (plugin_test_9): New test.
6979         * testsuite/Makefile.in: Regenerate.
6980
6981 2010-06-09  Nick Clifton  <nickc@redhat.com>
6982
6983         * yyscript.y (input_list_element): Allow strings prefixed with
6984         the '-' character.  Treat these as libraries.
6985         * script.cc (script_add_library): New function.  Adds a library
6986         specified by "-l<name>" found in an input script.
6987         * script-c.h: Add prototype for script_add_library.
6988
6989 2010-06-07  Doug Kwan  <dougkwan@google.com>
6990
6991         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6992         Restrict stub-group size to be within long conditional branch
6993         range when working around cortex-A8 erratum.
6994
6995 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6996
6997         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6998         #ifdef typo.
6999
7000 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7001
7002         PR gold/11658
7003         * output.cc
7004         (Output_section::Input_section_sort_entry::compare_section_ordering):
7005         Change to return non-zero correctly.
7006         (Output_section::Input_section_sort_section_order_index_compare
7007         ::operator()): Change to fix ambiguity in comparisons.
7008
7009 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7010
7011         * gold.h (is_wildcard_string): New function.
7012         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7013         (Layout::layout_eh_frame): Ditto.
7014         (Layout::find_section_order_index): New method.
7015         (Layout::read_layout_from_file): New method.
7016         * layout.h (Layout::find_section_order_index): New method.
7017         (Layout::read_layout_from_file): New method.
7018         (Layout::input_section_position_): New private member.
7019         (Layout::input_section_glob_): New private member.
7020         * main.cc (main): Call read_layout_from_file here.
7021         * options.h (--section-ordering-file): New option.
7022         * output.cc (Output_section::input_section_order_specified_): New
7023         member.
7024         (Output_section::Output_section): Initialize new member.
7025         (Output_section::add_input_section): Add new parameter.
7026         Keep input sections when --section-ordering-file is used.
7027         (Output_section::set_final_data_size): Sort input sections when
7028         section ordering file is specified.
7029         (Output_section::Input_section_sort_entry): Add new parameter.
7030         Check sorting type.
7031         (Output_section::Input_section_sort_entry::compare_section_ordering):
7032         New method.
7033         (Output_section::Input_section_sort_compare::operator()): Change to
7034         consider section_order_index.
7035         (Output_section::Input_section_sort_init_fini_compare::operator()):
7036         Change to consider section_order_index.
7037         (Output_section::Input_section_sort_section_order_index_compare
7038         ::operator()): New method.
7039         (Output_section::sort_attached_input_sections): Change to sort
7040         according to section order when specified.
7041         (Output_section::add_input_section<32, true>): Add new parameter.
7042         (Output_section::add_input_section<64, true>): Add new parameter.
7043         (Output_section::add_input_section<32, false>): Add new parameter.
7044         (Output_section::add_input_section<64, false>): Add new parameter.
7045         * output.h (Output_section::add_input_section): Add new parameter.
7046         (Output_section::input_section_order_specified): New
7047         method.
7048         (Output_section::set_input_section_order_specified): New method.
7049         (Input_section::Input_section): Initialize section_order_index_.
7050         (Input_section::section_order_index): New method.
7051         (Input_section::set_section_order_index): New method.
7052         (Input_section::section_order_index_): New member.
7053         (Input_section::Input_section_sort_section_order_index_compare): New
7054         struct.
7055         (Output_section::input_section_order_specified_): New member.
7056         * script-sections.cc (is_wildcard_string): Delete and move modified
7057         method to gold.h.
7058         (Output_section_element_input::Output_section_element_input): Modify
7059         call to is_wildcard_string.
7060         (Output_section_element_input::Input_section_pattern
7061         ::Input_section_pattern): Ditto.
7062         (Output_section_element_input::Output_section_element_input): Ditto.
7063         * testsuite/Makefile.am (final_layout): New test case.
7064         * testsuite/Makefile.in: Regenerate.
7065         * testsuite/final_layout.cc: New file.
7066         * testsuite/final_layout.sh: New file.
7067
7068 2010-06-01  Rafael Espindola  <espindola@google.com>
7069
7070         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7071
7072 2010-06-01  Rafael Espindola  <espindola@google.com>
7073
7074         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7075         visibility of symbols.
7076
7077 2010-05-27  Doug Kwan  <dougkwan@google.com>
7078
7079         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7080         from start of output section instead of address for a local symbol
7081         in a merged or relaxed section when doing a relocatable link.
7082
7083 2010-05-26  Rafael Espindola  <espindola@google.com>
7084
7085         PR 11604
7086         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7087         adding sections the garbage collector removed.
7088         * gold/testsuite/Makefile.am: Add test.
7089         * gold/testsuite/Makefile.in: Regenerate.
7090         * gold/testsuite/plugin_test_7.sh: New.
7091         * gold/testsuite/plugin_test_7_1.c: New.
7092         * gold/testsuite/plugin_test_7_2.c: New.
7093
7094 2010-05-26  Rafael Espindola  <espindola@google.com>
7095
7096         * script-sections.cc (Output_section_definition::set_section_addresses):
7097         Check for --section-start.
7098
7099 2010-05-26  Doug Kwan  <dougkwan@google.com>
7100
7101         * arm.cc (Arm_scan_relocatable_relocs): New class.
7102         (Target_arm::relocate_special_relocatable): New method.
7103         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7104         (Arm_relocate_functions::thumb_branch_common): Same.
7105         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7106         instead of Default_scan_relocatable_relocs.
7107         * target-reloc.h (relocate_for_relocatable): Let target handle
7108         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7109         * target.h (Sized_target::relocate_special_relocatable): New method.
7110
7111 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7112
7113         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7114
7115 2010-05-23  Doug Kwan  <dougkwan@google.com>
7116
7117         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7118         instead of a cast.
7119         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7120         with a direct branch, not a conditional branch, to a stub.
7121         * merge.cc (Output_merge_base::record_input_section): New method
7122         defintion.
7123         (Output_merge_data::do_add_input_section): Record input section if
7124         keeps-input-sections flag is set.
7125         (Output_merge_string::do_add_input_section): Ditto.
7126         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7127         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7128         INPUT_SECTIONS_.
7129         (Output_merge_base::keeps_input_sections,
7130         Output_merge_base::set_keeps_input_sections,
7131         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7132         method definitions.
7133         (Output_merge_base::Input_sections): New type declaration.
7134         (Output_merge_base::input_sections_begin,
7135         Output_merge_base::input_sections_end,
7136         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7137         (Output_merge_base::bool keeps_input_sections_,
7138         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7139         Output_merge_base::input_sections_): New data members.
7140         (Output_merge_data::do_set_keeps_input_sections): New method
7141         defintion.
7142         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7143         * output.cc (Output_section::Input_section::relobj): Move method
7144         defintion from class declaration to here and handle merge sections.
7145         (Output_section::Input_section::shndx): Ditto.
7146         (Output_section::Output_section): Remove initializations of removed
7147         data members and initialize new data member LOOKUP_MAPS_.
7148         (Output_section::add_input_section): Set keeps-input-sections flag
7149         for a newly created merge output section as appropriate.  Adjust code
7150         to use Output_section_lookup_maps class.
7151         (Output_section::add_relaxed_input_section): Adjst code for lookup
7152         maps code refactoring.
7153         (Output_section::add_merge_input_section): Add a new parameter
7154         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7155         class.  If adding input section to a newly created merge output
7156         section fails, remove the new merge section.
7157         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7158         Adjust code for use of the Output_section_lookup_maps class.
7159         (Output_section::find_merge_section): Ditto.
7160         (Output_section::build_lookup_maps): New method defintion.
7161         (Output_section::find_relaxed_input_section): Adjust code to use
7162         Output_section_lookup_maps class.
7163         (Output_section::get_input_sections): Export merge sections.  Adjust
7164         code to use Output_section_lookup_maps class.
7165         (Output_section:::add_script_input_section): Adjust code to use
7166         Output_section_lookup_maps class.  Update lookup maps for merge
7167         sections also.
7168         (Output_section::discard_states): Use Output_section_lookup_maps.
7169         (Output_section::restore_states): Same.
7170         * output.h (Merge_section_properties): Move class defintion out of
7171         Output_section.
7172         (Output_section_lookup_maps): New class.
7173         (Output_section::Input_section::is_merge_section): New method
7174         defintion.
7175         (Output_section::Input_section::relobj): Move defintion out of class
7176         defintion.  Declare method only.
7177         (Output_section::Input_section::shndx): Ditto.
7178         (Output_section::Input_section::output_merge_base): New method defintion.
7179         (Output_section::Input_section::u2_.pomb): New union field.
7180         (Output_section::Merge_section_by_properties_map,
7181         Output_section::Output_section_data_by_input_section_map,
7182         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7183         Remove types.
7184         (Output_section::add_merge_input_section): Add new parameter
7185         KEEPS_INPUT_SECTIONS.
7186         (Output_section::build_lookup_maps): New method declaration.
7187         (Output_section::merge_section_map_,
7188         Output_section::merge_section_by_properties_map_,
7189         Output_section::relaxed_input_section_map_,
7190         Output_section::is_relaxed_input_section_map_valid_): Remove data
7191         members.
7192         (Output_section::lookup_maps_): New data member.
7193
7194 2010-05-21  Doug Kwan  <dougkwan@google.com>
7195
7196         PR gold/11619
7197         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7198         avoid a compilation error.
7199
7200 2010-05-19  Rafael Espindola  <espindola@google.com>
7201
7202         * script-sections.cc (Output_section_definition::allocate_to_segment):
7203         Update the phdrs_list even when the output section is NULL.
7204         * testsuite/Makefile.am: Add test.
7205         * testsuite/Makefile.in: Regenerate.
7206         * testsuite/script_test_9.cc: New.
7207         * testsuite/script_test_9.sh: New.
7208         * testsuite/script_test_9.t: New.
7209
7210 2010-05-19  Doug Kwan  <dougkwan@google.com>
7211
7212         * arm.cc (Arm_input_section::original_size): New method.
7213         (Arm_input_section::do_addralign): Add a cast.
7214         (Arm_input_section::do_output_offset): Remove static cast.
7215         (Arm_input_section::original_addralign,
7216          Arm_input_section::original_size_): Change type to uint32_t.
7217         (Arm_input_section::init): Add safe casts for section alignment
7218         and size.
7219         (Arm_input_section::set_final_data_size): Do not set address and
7220         offset of stub table.
7221         (Arm_output_section::fix_exidx_coverage): Change use of of
7222         Output_section::Simple_input_section to that of
7223         Output_section::Input_section.
7224         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7225         except for the first pass.
7226         * output.cc (Output_section::get_input_sections): Change type of
7227         input_sections to std::list<Input_section>.
7228         (Output_section::add_script_input_section): Rename from
7229         Output_section::add_simple_input_section.  Change type of SIS
7230         parameter from Simple_input_section to Input_section.
7231         * output.h (Output_section::Simple_input_section): Remove class.
7232         (Output_section::Input_section): Change class visibility to public.
7233         (Output_section::Input_section::addralign): Use stored alignments
7234         for special input sections if set.
7235         (Output_section::Input_section::set_addralign): New method.
7236         (Output_section::get_input_sections): Change parameter type from
7237         list of Simple_input_section to list of Input_section.
7238         (Output_section::add_script_input_section): Rename from
7239         Output_section::add_simple_input_section. Change first parameter's
7240         type from Simple_input_section to Input_section and remove the
7241         second and third parameters.
7242         * script-sections.cc (Input_section::Input_section_list): Change
7243         type to list of Output_section::Input_section/
7244         (Input_section_info::Input_section_info): Change parameter type of
7245         INPUT_SECTION to Output_section::Input_section.
7246         (Input_section_info::input_section): Change return type.
7247         (Input_section_info::input_section_): Change type to
7248         Output_section::Input_section.
7249         (Output_section_element_input::set_section_addresses): Adjust code
7250         to use Output_section::Input_section instead of
7251         Output_section::Simple_input_section.  Adjust code for renaming
7252         of Output_section::add_simple_input_section.
7253         (Orphan_output_section::set_section_addresses): Ditto.
7254
7255 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7256
7257         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7258         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7259
7260 2010-05-18  Rafael Espindola  <espindola@google.com>
7261
7262         * options.cc (General_options::finalize): Handle -nostdlib.
7263         * options.h (nostdlib): New option.
7264         * script.cc (script_add_search_dir): Handle -nostdlib.
7265
7266 2010-05-12  Doug Kwan  <dougkwan@google.com>
7267
7268         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7269         attributes section only if there no attributes section after merging.
7270         (Target_arm::merge_object_attributes): Move value of
7271         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7272         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7273         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7274         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7275         and arm_attr_merge_7.stdout.
7276         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7277         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7278         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7279         arm_attr_merge_7b.o): New rules.
7280         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7281         arm_attr_merge_7
7282         * testsuite/Makefile.in: Regenerate.
7283         * testsuite/arm_attr_merge.sh: New file.
7284         * testsuite/arm_attr_merge_[67][ab].s: Same.
7285
7286 2010-05-05  Nick Clifton  <nickc@redhat.com>
7287
7288         * po/es.po: Updated Spanish translation.
7289
7290 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7291
7292         * Makefile.am (install-exec-local): Properly install gold as
7293         default cross linker.
7294         * Makefile.in: Regenerated.
7295
7296 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7297             Nick Clifton  <nickc@redhat.com>
7298
7299         * configure.ac (install_as_default): Define and set to false
7300         unless --enable-gold or --enable-gold=both/gold has been
7301         specified.
7302         * configure: Regenerate.
7303
7304         * Makefile.am (install-exec-local): Install the executable as
7305         'ld.gold'.  If install_as_default is true then also install it as
7306         'ld'.
7307         * Makefile.in: Regenerated.
7308
7309 2010-04-24  Ian Lance Taylor  <iant@google.com>
7310
7311         * layout.cc (Layout::layout_reloc): In relocatable link don't
7312         combine reloc sections for grouped sections.
7313
7314 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7315
7316         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7317         sections that are not ordinary to icf.
7318         * icf.cc (get_section_contents): Handle relocation pointing to section
7319         with no object or shndx information.
7320         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7321         * testsuite/Makefile.in: Regenerate.
7322         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7323         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7324
7325 2010-04-22  Ian Lance Taylor  <iant@google.com>
7326
7327         * expression.cc (Expression::Expression_eval_info): Add
7328         result_alignment_pointer field.
7329         (Expression::eval_with_dot): Add result_alignment_pointer
7330         parameter.  Change all callers.
7331         (Expression::eval_maybe_dot): Likewise.
7332         (class Binary_expression): Add alignment_pointer parameter to
7333         left_value and right_value.  Change all callers.
7334         (BINARY_EXPRESSION): Set result alignment.
7335         (class Trinary_expression): Add alignment_pointer parameter to
7336         arg2_value and arg3_value.  Change all callers.
7337         (Trinary_cond::value): Set result alignment.
7338         (Max_expression::value, Min_expression::value): Likewise.
7339         (Align_expression::value): Likewise.
7340         * script-sections.cc (class Sections_element): Add dot_alignment
7341         parameter to set_section_addresses virtual function.  Update
7342         instantiations.
7343         (class Output_section_element): Likewise.
7344         (Script_sections::create_segments): Add dot_alignment parameter.
7345         Change all callers.
7346         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7347         (Script_sections::set_phdrs_clause_addresses): Likewise.
7348         * script-sections.h: Update declarations.
7349         * script.h: Update declarations.
7350         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7351         min_p_align.
7352         * testsuite/script_test_3.t: Set large alignment.
7353         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7354         segment has expected alignment.
7355
7356 2010-04-22  Nick Clifton  <nickc@redhat.com>
7357
7358         * po/gold.pot: Updated by the Translation project.
7359         * po/vi.po: Updated Vietnamese translation.
7360
7361 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7362
7363         * testsuite/Makefile.am (check_PROGRAMS): Add
7364         icf_virtual_function_folding_test.
7365         * testsuite/Makefile.in: Regenerated.
7366
7367 2010-04-15  Andrew Haley  <aph@redhat.com>
7368
7369         * options.h (merge_exidx_entries): New option.
7370         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7371         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7372         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7373         (Target_arm::merge_exidx_entries): New function.
7374         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7375         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7376         to Arm_exidx_fixup constructor.
7377         Add new arg, merge_exidx_entries.
7378         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7379         Arm_output_section::fix_exidx_coverage.
7380
7381 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7382
7383         * icf.cc (get_section_contents): Check for preemptible functions.
7384         Ignore addend when appropriate.
7385         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7386         section folded.
7387         (add_from_relobj): Check for section folded.
7388         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7389         * symtab.h (should_add_dynsym_entry): Add new parameter.
7390         * target-reloc.h (scan_relocs): Check for section folded.
7391         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7392         Check reloc types for function pointers in shared objects.
7393         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7394         case.
7395         (icf_preemptible_functions_test): New test case.
7396         (icf_string_merge_test): New test case.
7397         * testsuite.Makefile.in: Regenerate.
7398         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7399         bar_glob.  Refactor code.
7400         * testsuite/icf_preemptible_functions_test.cc: New file.
7401         * testsuite/icf_preemptible_functions_test.sh: New file.
7402         * testsuite/icf_string_merge_test.cc: New file.
7403         * testsuite/icf_string_merge_test.sh: New file.
7404         * testsuite/icf_virtual_function_folding_test.cc: New file.
7405         * testsuite/icf_virtual_function_folding_test.sh: New file.
7406
7407 2010-04-14  Doug Kwan  <dougkwan@google.com>
7408
7409         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7410         for local symbol recounting if we remove a section due to ICF.
7411         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7412         there are no regular objects in input.
7413
7414 2010-04-13  Doug Kwan  <dougkwan@google.com>
7415
7416         * arm.cc (Arm_input_section::set_final_data_size): Compute
7417         accurate final data size instead of using current data size.
7418
7419 2010-04-09  Doug Kwan  <dougkwan@google.com>
7420
7421         * layout.cc (Layout::choose_output_section): Handle script section
7422         types.
7423         (Layout::make_output_section_for_script): Add section type parameter.
7424         Handle script section types.
7425         * layout.h (Layout::make_output_section_for_script): Add section
7426         type parameter.
7427         * output.cc (Output_section::Output_section): Initialize data member
7428         is_noload_.
7429         (Output_section::do_reset_address_and_file_offset): Do not set address
7430         to 0 if section is a NOLOAD section.
7431         * output.h (Output_section::is_noload): New method.
7432         (Output_section::set_is_noload): Ditto.
7433         (Output_section::is_noload_): New data member.
7434         * script-c.h (Script_section_type): New enum type.
7435         (struct Parser_output_section_header): Add new file section_type.
7436         * script-sections.cc (Sections_element::output_section_name): Add
7437         parameter for returning script section type.
7438         (Output_section_definition::output_section_name): Ditto.
7439         (Output_section_definition::section_type)P; New method.
7440         (Output_section_definiton::script_section_type_name): Ditto.
7441         (Output_section_definition::script_section_type_): New data member.
7442         (Output_section_definition::Output_section_definition): Initialize
7443         data member Output_section_definition::script_section_type_.
7444         (Output_section_definition::create_sections): Pass script section type
7445         to Layout::make_output_section_for_script.
7446         (Output_section_definition::output_section_name): Return script
7447         section type to caller.
7448         (Output_section_definition::set_section_address): Do not advance
7449         dot value and load address if section type is NOLOAD.  Set address
7450         of NOLOAD sections regardless of section flags.
7451         (Output_section_definition::print): Print section type if it is
7452         not SCRIPT_SECTION_TYPE_NONE.
7453         (Output_section_definition::section_type): New method.
7454         (Output_section_definition::script_section_type_name): Ditto.
7455         (Script_sections::output_section_name): Add new parameter
7456         PSECTION_TYPE for returning script section type.  Pass it to
7457         section elements.  Handle discard sections.
7458         (Sort_output_sections::operator()): Handle NOLOAD sections.
7459         * script-sections.h (Script_sections::Section_type): New enum type.
7460         (Script_sections::output_section_name): Add a new parameter for
7461         returning script section type.
7462         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7463         INFO and NOLOAD.
7464         * yyscript.y (union): Add new field SECTION_TYPE.
7465         (COPY, DSECT, INFO, NOLOAD): New tokens.
7466         (opt_address_and_section_type): Change type to output_section_header.
7467         (section_type): New non-terminal
7468         (section_header): Handle section type.
7469         (opt_address_and_section_type): Return section type value.
7470
7471 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7472
7473         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7474         * testsuite/plugin_common_test_2.c (foo): Likewise.
7475
7476 2010-04-08  Doug Kwan  <dougkwan@google.com>
7477
7478         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7479         Output_merge_data.
7480         * output.cc (Output_section::add_merge_input_section): Simplify
7481         code and return status of Output_merge_base::add_input_section.
7482         Update merge section map only if Output_merge_base::add_input_section
7483         returns true.
7484
7485 2010-04-07  Doug Kwan  <dougkwan@google.com>
7486
7487         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7488         if section is marked as containing instructions but has no mapping
7489         symbols.
7490         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7491         correct section index.
7492         (Arm_relobj::find_linked_text_section): Ditto.
7493
7494 2010-04-07  Cary Coutant  <ccoutant@google.com>
7495
7496         * archive.cc (include_member): Destroy Read_symbols_data object before
7497         releasing file.
7498         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7499         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7500         (Read_symbols_data::~Read_symbols_data) New destructor.
7501         (Section_relocs::Section_relocs) New constructor.
7502         (Section_relocs::~Section_relocs) New destructor.
7503         (Read_relocs_data::Read_relocs_data) New constructor.
7504         (Read_relocs_data::~Read_relocs_data) New destructor.
7505         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7506         pointers to NULL after deleting.
7507
7508 2010-04-07  Doug Kwan  <dougkwan@google.com>
7509
7510         * arm.cc: Replace "endianity" with "endianness" in comments.
7511         (Arm_exidx_cantunwind): Ditto.
7512         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7513         (Arm_relobj::merge_flags_and_attributes): New method.
7514         (Arm_relobj::merge_flags_and_attributes_): New data member.
7515         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7516         (Arm_relobj::scan_sections_for_stubs): Ditto.
7517         (Arm_relobj::do_read_symbols): Check to see if we really want to
7518         merge processor-specific flags and attributes.  Exit early if
7519         an object is empty except for section names and the undefined symbol.
7520         (Target_arm::do_finalize_sections): Move check for ELF format to
7521         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7522         attributes from a regular object only when we have determined that
7523         it is aapropriate.  Do not create an .ARM.attributes section in
7524         output if there is no regular input object.
7525         (Target_arm::merge_processor_specific_flags): Check
7526         --warn-mismatch before printing any error.
7527         (Target_arm::merge_object_attributes): Ditto.
7528         * gold.cc (queue_middle_tasks): Handle the case in which there is
7529         no regular object in input.
7530         * options.cc (General_options::parse_EB): New method.
7531         (General_options::parse_EL): Same.
7532         (General_options::General_options): Initialize endianness_.
7533         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7534         New options.
7535         (General_options::Endianness): New enum.
7536         (General_options::endianness): New method.
7537         (General_options::endianness_): New data member.
7538         * parameters.cc (Parameters::set_options): Check target endianness.
7539         (Parameters::set_target_once): Ditto.
7540         (Parameters::check_target_endianness): New method.
7541         (parameters_force_valid_target): If either -EL or -EB is specified,
7542         use it to define endianness of default target.
7543         * parameters.h (Parameters::check_target_endianness): New method
7544         declaration.
7545         * target.h (class Target): Change "endianity" to "endianness"
7546         in comments.
7547
7548 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7549
7550         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7551         * configure: Regenerate.
7552         * Makefile.in: Regenerate.
7553         * testsuite/Makefile.in: Regenerate.
7554
7555 2010-04-06  Cary Coutant  <ccoutant@google.com>
7556
7557         gcc PR lto/42757
7558         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7559         prevailing definitions of common symbols.
7560         * testsuite/plugin_test_6.sh: New test case.
7561         * testsuite/plugin_common_test_1.c: New test case.
7562         * testsuite/plugin_common_test_2.c: New test case.
7563         * testsuite/Makefile.am (plugin_test_6): New test case.
7564         * testsuite/Makefile.in: Regenerate.
7565
7566 2010-04-06  Nick Clifton  <nickc@redhat.com>
7567
7568         * po/vi.po: New Vietnamese translation.
7569
7570 2010-03-30  Doug Kwan  <dougkwan@google.com>
7571
7572         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7573
7574 2010-03-25  Doug Kwan  <dougkwan@google.com>
7575
7576         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7577         to avoid a conversion warning on a 32-bit host.
7578
7579 2010-03-24  Ian Lance Taylor  <iant@google.com>
7580
7581         * testsuite/script_test_3.t: Add a TLS segment.
7582         * testsuite/Makefile.am (check_PROGRAMS): Add
7583         tls_phdrs_script_test.
7584         (tls_phdrs_script_test_SOURCES): Define.
7585         (tls_phdrs_script_test_DEPENDENCIES): Define.
7586         (tls_phdrs_script_test_LDFLAGS): Define.
7587         (tls_phdrs_script_test_LDADD): Define.
7588         * testsuite/Makefile.in: Rebuild.
7589
7590 2010-03-23  Cary Coutant  <ccoutant@google.com>
7591
7592         * fileread.cc (find_or_make_view): Fix comment.
7593
7594 2010-03-23  Ian Lance Taylor  <iant@google.com>
7595
7596         * script-sections.cc (class Orphan_section_placement): Define
7597         PLACE_TLS and PLACE_TLS_BSS.
7598         (Orphan_section_placement::Orphan_section_placement): Initialize
7599         new places.
7600         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7601         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7602         (tls_script_test_SOURCES): Define.
7603         (tls_script_test_DEPENDENCIES): Define.
7604         (tls_script_test_LDFLAGS): Define.
7605         (tls_script_test_LDADD): Define.
7606         * testsuite/Makefile.in: Rebuild.
7607
7608 2010-03-22  Doug Kwan  <dougkwan@google.com>
7609
7610         * arm.cc (Arm_relocate_functions::abs8,
7611         Arm_relocate_functions::abs16): Use correct check for overflow
7612         specified in the ARM ELF specs.
7613         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7614         target of a BLX instruction specially.
7615         (Reloc_stub::stub_type_for_reloc): Ditto.
7616         (Relocate::relocate): Use symbolic names instead of numeric relocation
7617         codes to report error.
7618         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7619         workaround.
7620         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7621         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7622         thumb2_blx_out_of_range.stdout
7623         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7624         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7625         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7626         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7627         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7628         thumb2_blx_in_range, thumb2_blx_in_range.o,
7629         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7630         thumb2_blx_out_of_range.o): New rules.
7631         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7632         thumb2_blx_in_range and thumb2_blx_out_of_range.
7633         * testsuite/Makefile.in: Regenerate.
7634         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7635         * testsuite/thumb_blx_in_range.s: New file.
7636         * testsuite/thumb_blx_out_of_range.s: New file.
7637
7638 2010-03-22  Rafael Espindola  <espindola@google.com>
7639
7640         * archive.cc (Should_include): Move to archive.h.
7641         (should_include_member): Make it a member of Archive.
7642         (Lib_group): New.
7643         (Add_lib_group_symbols): New.
7644         * archive.h: Include options.h.
7645         (Archive_member): Moved from Archive.
7646         (Should_include): Moved from archive.cc.
7647         (Lib_group): New.
7648         (Add_lib_group_symbols): New.
7649         * dynobj.cc (do_should_include_member): New.
7650         * dynobj.h (do_should_include_member): New.
7651         * gold.cc (queue_initial_tasks): Update call to queue.
7652         * main.cc (main): Print lib group stats.
7653         * object.cc (do_should_include_member): New.
7654         * object.h: Include archive.h.
7655         (Object::should_include_member): New.
7656         (Object::do_should_include_member): New.
7657         (Sized_relobj::do_should_include_member): New.
7658         * options.cc (General_options::parse_start_lib): New.
7659         (General_options::parse_end_lib): New.
7660         (Input_arguments::add_file): Handle lib groups.
7661         (Input_arguments::start_group): Check we are not in a lib.
7662         (Input_arguments::start_lib): New.
7663         (Input_arguments::end_lib): New.
7664         * options.h (General_options): Add start_lib and end_lib.
7665         (Input_argument::lib_): New.
7666         (Input_argument::lib): New.
7667         (Input_argument::is_lib): New.
7668         (Input_file_lib): New.
7669         (Input_arguments::in_lib_): New.
7670         (Input_arguments::in_lib): New.
7671         (Input_arguments::start_lib): New.
7672         (Input_arguments::end_lib_): New.
7673         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7674         in unused members as preempted.
7675         (Sized_pluginobj::do_should_include_member): New.
7676         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7677         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7678         return the blocker.
7679         (Read_symbols::do_whole_lib_group): New.
7680         (Read_symbols::do_lib_group): New.
7681         (Read_symbols::do_read_symbols): Handle lib groups.
7682         (Read_symbols::get_name): Handle lib groups.
7683         * readsyms.h (Read_symbols): Add an archive member pointer.
7684         (Read_symbols::do_whole_lib_group): New.
7685         (Read_symbols::do_lib_group): New.
7686         (Read_symbols::member_): New.
7687         * script.cc (read_input_script): Update call to queue_soon.
7688
7689 2010-03-19  Doug Kwan  <dougkwan@google.com>
7690
7691         * arm.cc (Stub_table::Stub_table): Initialize new data members
7692         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7693         (Stub_table::add_reloc_stub): Assign stub offset and update
7694         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7695         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7696         New data members.
7697         (Stub_table::update_data_size_and_addralign): Use
7698         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7699         instead of going over all reloc stubs.
7700         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7701         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7702         Stringpool_template::offset_ to size of Stringpool_char.
7703         (Stringpool_template::new_key_offset): Remove code to initialize
7704         Stringpool_template::offset_.
7705         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7706         Stringpool_template::offset_ to zero.
7707
7708 2010-03-15  Doug Kwan  <dougkwan@google.com>
7709
7710         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7711         offset_.
7712         (Stringpool_template::new_key_offset): New method.
7713         (Stringpool_template::add_string): Assign offsets when adding new
7714         strings.
7715         (Stringpool_template::set_string_offsets): Do not set string offsets
7716         when not optimizing.
7717         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7718         member size_.
7719         (Chunked_vector::clear): Clear size_.
7720         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7721         (Chunked_vector::size): Return size_.
7722         (Chunked_vector::push_back): Use size_ to find insert position.
7723         (Chunked_vector::size_): New data member.
7724         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7725         (Stringpool_template::new_key_offset): New method declaration.
7726         (Stringpool_template::offset_): New data member.
7727
7728 2010-03-15   Rafael Espindola  <espindola@google.com>
7729
7730         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7731         Add_symbols' constructor.
7732         * readsyms.h (Add_symbols): Remove the input_group member.
7733
7734 2010-03-10  Ian Lance Taylor  <iant@google.com>
7735
7736         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7737         target to ask whether a reference to a symbol requires a stack
7738         split.
7739         * target.h (Target::is_call_to_non_split): New function.
7740         (Target::do_is_call_to_non_split): Declare virtual function.
7741         * target.cc: Include "symtab.h".
7742         (Target::do_is_call_to_non_split): New function.
7743         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7744
7745 2010-03-10  Cary Coutant  <ccoutant@google.com>
7746
7747         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7748         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7749         (File_read::open[2]): Add whole_file_view_ to list of views.
7750         (File_read::make_view): Remove test of whole_file_view_.
7751         (File_read::find_or_make_view): Create whole_file_view_ if
7752         necessary.
7753         (File_read::clear_views): Replace bool parameter with enum;
7754         adjust all callers.  Don't delete views with permanent data;
7755         do delete cached views and views from archives if
7756         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7757         if clearing the corresponding view.
7758         * fileread.h (File_read::Clear_views_mode): New enum.
7759         (File_read::View::is_permanent_view): New method.
7760         (File_read::clear_views): Replace bool parameter
7761         with enum; adjust all callers.
7762         * options.h (General_options): Change keep_files_mapped option;
7763         add map_whole_files.
7764         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7765         releasing the file.
7766         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7767         the file.
7768
7769 2010-03-10  David S. Miller  <davem@davemloft.net>
7770
7771         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7772
7773 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7774
7775         * icf.cc (get_section_contents): Add '@' marker after processing the
7776         merge reloc.
7777
7778 2010-03-08  Doug Kwan  <dougkwan@google.com>
7779
7780         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7781         due to a conversion warning.
7782         (Arm_relobj::update_output_local_symbol_count): Check for local
7783         symbol with unset output index.
7784
7785 2010-03-05  Ian Lance Taylor  <iant@google.com>
7786
7787         * options.h (class General_options): Add --spare-dynamic-tags.
7788         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7789         --spare-dynamic-tags.
7790
7791 2010-03-05  Ian Lance Taylor  <iant@google.com>
7792
7793         * incremental.cc: Include "libiberty.h".
7794
7795 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7796
7797         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7798         function, is_info_ member.
7799         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7800         (Versions::Versions): Update caller.
7801         (Versions::define_base_version): Likewise.
7802         (Versions::add_def): Likewise.
7803
7804 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7805
7806         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7807         (Scan::possible_function_pointer_reloc): New function.
7808         (Scan::local_reloc_may_be_function_pointer): Change to call
7809         possible_function_pointer_reloc.
7810         (Scan::global_reloc_may_be_function_pointer): Ditto.
7811         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7812         relocations in ".data.rel.ro._ZTV" section.
7813         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7814         * testsuite/icf_safe_so_test.cc: Ditto.
7815         * testsuite/icf_safe_test.cc: Ditto.
7816         * testsuite/icf_safe_test.sh: Ditto.
7817
7818 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7819             Ian Lance Taylor  <iant@google.com>
7820
7821         * target-reloc.h (relocate_section): Check the symbol table index
7822         for -1U before setting the local symbol index.
7823         (scan_relocatable_relocs): If copying the relocation, record that
7824         the local symbol is required.
7825         * object.h (Symbol_value::is_output_symtab_index_set): New
7826         function.
7827         (Symbol_value::may_be_discarded_from_output_symtab): New
7828         function.
7829         (Symbol_value::has_output_symtab_entry): New function.
7830         (Symbol_value::needs_output_symtab_entry): Remove.
7831         (Symbol_value::output_symtab_index): Make sure the symbol index is
7832         set.
7833         (Symbol_value::set_output_symtab_index): Make sure the symbol
7834         index is not set.  Make sure the new index is valid.
7835         (Symbol_value::set_must_have_output_symtab_entry): New function.
7836         (Symbol_value::has_output_dynsym_entry): New function.
7837         (Symbol_value::set_output_dynsym_index): Make sure the new index
7838         is valid.
7839         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7840         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7841         local symbol if permitted.
7842         (Sized_relobj::do_finalize_local_symbols): Call
7843         is_output_symtab_index_set rather than needs_output_symtab_entry.
7844         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7845         rather than needs_output_symtab_entry.  Call
7846         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7847         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7848         is_output_symtab_index_set rather than needs_output_symtab_entry.
7849         * testsuite/discard_locals_relocatable_test.c: New file.
7850         * testsuite/discard_locals_test.sh: Test -r.
7851         * testsuite/Makefile.am (check_DATA): Add
7852         discard_locals_relocatable_test1.syms,
7853         discard_local_relocatable_test2.syms.
7854         (MOSTLYCLEANFILES): Likewise.  Also add
7855         discard_locals_relocatable_test1.lout and
7856         discard_locals_relocatable_test2.out.
7857         (discard_locals_relocatable_test1.syms): New target.
7858         (discard_locals_relocatable_test.o): New target.
7859         (discard_locals_relocatable_test1.out): New target.
7860         (discard_locals_relocatable_test2.syms): New target.
7861         (discard_locals_relocatable_test2.out): New target.
7862         (various): Add missing ../ld-new dependencies.
7863         * testsuite/Makefile.in: Rebuild.
7864
7865 2010-03-03  Nick Clifton  <nickc@redhat.com>
7866
7867         * po/fi.po: New Finnish translation.
7868
7869 2010-03-01  Doug Kwan  <dougkwan@google.com>
7870
7871         * layout.cc (Layout::Layout): Force section types of .init_array*,
7872         .preinit_array* and .fini_array* sections.
7873         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7874         Fix check of return value of std::string::find.().
7875         (Output_section::Input_section_sort_compare::operator()): Remove
7876         comment about .init_array.
7877         (Output_section::Input_section_sort_init_fini_compare::operator()):
7878         New method.
7879         (Output_section::sort_attached_input_sections): Handle .init_array
7880         and .fini_array specially.
7881         * output.h (Output_section::Inut_section_sort_compare): Update
7882         comment.
7883         (Output_section::Input_section_sort_init_fini_compare): New struct.
7884
7885 2010-02-26  Doug Kwan  <dougkwan@google.com>
7886
7887         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7888         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7889         * testsuite/debug_msg.sh: Avoid matching source line number for
7890         use of global variable undef_int.
7891
7892 2010-02-26  Doug Kwan  <dougkwan@google.com>
7893
7894         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7895         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7896         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7897         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7898         * options.cc (General_options::General_options): Initialize member
7899         fix_v4bx_.
7900         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7901         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7902         and rm_no_fix_v4bx.stdout
7903         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7904         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7905         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7906         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7907         and arm_no_fix_v4bx.
7908         * Makefile.in: Regenerate.
7909         * testsuite/arm_fix_v4bx.s: New file.
7910         * testsuite/arm_fix_v4bx.sh: Ditto.
7911
7912 2010-02-24  Doug Kwan  <dougkwan@google.com>
7913
7914         * arm.cc (Target_arm::got_section): Make the .got section the first
7915         non RELRO section in the data segment.
7916         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7917         suffixes of section names.
7918
7919 2010-02-24  Doug Kwan  <dougkwan@google.com>
7920
7921         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7922         flags and attributes merging if an input file is a binary file.
7923         * fileread.cc (Input_file::open): Record format of original file.
7924         * fileread.h (Input_file::Format): New enum type.
7925         (Input_file::Input_file): Initialize data member format_.
7926         (Input_file::format): New method definition.
7927         (Input_file::format_):: New data member.
7928
7929 2010-02-24  Doug Kwan  <dougkwan@google.com>
7930
7931         * arm.cc (Arm_output_data_got): New class.
7932         (ARM_TCB_SIZE): New constant
7933         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7934         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7935         If user uses a script with a SECTIONS clause, issue only a warning
7936         for a misplaced EXIDX input section.  Otherwise, issue an error.
7937         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7938         garbage collection.
7939         (Target_arm::got_mode_index_entry): Handle static linking.
7940         (Target_arm::Scan::local): Ditto.
7941         (Target_arm::Scan::global): Ditto.
7942         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7943         all incorrectly implemented relocations.
7944         (Target_arm::fix_exidx_coverage): Pass layout to
7945         Arm_output_section::fix_exidx_coverage.
7946         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7947         from ".ARM.exidx." and ".ARM.extab.".
7948
7949 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7950
7951         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7952         section if it does not already exist.
7953         * attributes.cc (Attributes_section_data::Attributes_section_data):
7954         Don't crash if size is zero.
7955
7956 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7957             Ian Lance Taylor  <iant@google.com>
7958
7959         * gold.cc (queue_middle_tasks): If no input files were opened,
7960         exit.
7961         * workqueue.h (Task_function::Task_function): Assert that there is
7962         a blocker.
7963
7964 2010-02-22  Doug Kwan  <dougkwan@google.com>
7965
7966         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7967         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7968         types to avoid warnings due to different uint64_t implementations
7969         on different hosts.
7970
7971 2010-02-21  Doug Kwan  <dougkwan@google.com>
7972
7973         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7974         handling of the maximum backward branch offset.
7975         (Arm_relocate_functions::thumb_branch_common): Ditto.
7976         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7977         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7978         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7979         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7980         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7981         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7982         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7983         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7984         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7985         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7986         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7987         thumb2_bl_out_of_range.o): New rules.
7988         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7989         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7990         thumb2_bl_out_of_range
7991         * testsuite/Makefile.in: Regenerate.
7992         * testsuite/arm_bl_in_range.s: New file.
7993         * testsuite/arm_bl_out_of_range.s: Ditto.
7994         * testsuite/arm_branch_in_range.sh: Ditto.
7995         * testsuite/arm_branch_range.t: Ditto.
7996         * testsuite/thumb2_branch_range.t: Ditto.
7997         * testsuite/thumb_bl_in_range.s: Ditto.
7998         * testsuite/thumb_bl_out_of_range.s: Ditto.
7999         * testsuite/thumb_branch_range.t: Ditto.
8000
8001 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8002
8003         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8004         Add reloc offset information.
8005         * icf.cc (get_section_contents): Change iterators to point to the new
8006         vectors. Add reloc offset information to the contents.
8007         * icf.h (Icf::Sections_reachable_info): New typedef.
8008         (Icf::Sections_reachable_list): New typedef.
8009         (Icf::Offset_info): New typedef.
8010         (Icf::Reloc_info): New struct typedef.
8011         (Icf::Reloc_info_list): New typedef.
8012         (Icf::symbol_reloc_list): Delete method.
8013         (Icf::addend_reloc_list): Delete method.
8014         (Icf::section_reloc_list): Delete method.
8015         (Icf::reloc_info_list): New method.
8016         (Icf::reloc_info_list_): New member.
8017
8018 2010-02-19  Doug Kwan  <dougkwan@google.com>
8019
8020         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8021         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8022         * arm.cc (Arm_relocation_functions): New forward declaration.
8023         (Target_arm::Target_arm): Initialize new data members
8024         got_mod_index_offset_ and tls_base_symbol_defined_.
8025         (Target_arm::Relocate::relocate_tls): New method.
8026         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8027          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8028         New methods.
8029         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8030         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8031         (Target_arm::got_mod_index_offset_,
8032         Target_arm::tls_base_symbol_defined_): New data members.
8033         (Target_arm::Scan::local, Target::Scan::global,
8034         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8035         relocations.
8036
8037 2010-02-18  Doug Kwan  <dougkwan@google.com>
8038
8039         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8040         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8041         text section as a parameter becuase some broken tools may not set
8042         the link in section header.
8043         (Target_arm::has_got_section): New method.
8044         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8045         without any mapping symbol as data only.  Remove warning.
8046         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8047         link in its section header, try to discover the link by inspecting the
8048         REL31 relocation at the beginning of the section.
8049         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8050         in error message.
8051         (Target_arm::Scan::global): Treat any reference to the symbol
8052         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8053
8054 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8055
8056         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8057         (Scan::global_reloc_may_be_function_pointer): New function.
8058         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8059         (Scan::global_reloc_may_be_function_pointer): New function.
8060         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8061         (Scan::global_reloc_may_be_function_pointer): New function.
8062         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8063         (Scan::global_reloc_may_be_function_pointer): New function.
8064         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8065         (Scan::global_reloc_may_be_function_pointer): New function.
8066         (Scan::possible_function_pointer_reloc): New function.
8067         (Target_x86_64::can_check_for_function_pointers): New function.
8068         * gc.h (gc_process_relocs): Scan relocation types to determine if
8069         function pointers were taken for targets that support it.
8070         * icf.cc (Icf::find_identical_sections): Include functions for
8071         folding in safe ICF whose pointer is not taken.
8072         * icf.h (Secn_fptr_taken_set): New typedef.
8073         (fptr_section_id_): New member.
8074         (section_has_function_pointers): New function.
8075         (set_section_has_function_pointers): New function.
8076         (check_section_for_function_pointers): New function.
8077         * options.h: Fix comment for safe ICF option.
8078         * target.h (can_check_for_function_pointers): New function.
8079         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8080         Modify icf_safe_test for X86-64.
8081         * testsuite/Makefile.in: Regenerate.
8082         * testsuite/icf_safe_so_test.cc: New file.
8083         * testsuite/icf_safe_so_test.sh: New file.
8084         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8085         (main): Change to take pointer to function kept_func_3.
8086         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8087         folding is done correctly for X86-64.
8088
8089 2010-02-12  David S. Miller  <davem@davemloft.net>
8090
8091         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8092         is_symbolless parameter.
8093         (Output_reloc<SHT_REL>::is_symbolless): New.
8094         (Output_reloc<SHT_REL>::is_symbolless_): New.
8095         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8096         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8097         (Output_reloc<SHT_RELA>::is_symbolless): New.
8098         (Output_data_reloc::add_global): Handle is_symbolless.
8099         (Output_data_reloc::add_global_relative): Likewise.
8100         (Output_data_reloc::add_local): Likewise.
8101         (Output_data_reloc::add_local_relative): Likewise.
8102         (Output_data_reloc::add_symbolless_global_addend): New.
8103         (Output_data_reloc::add_symbolless_local_addend): New.
8104         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8105         is_symbolless.
8106         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8107         instead of ->is_relative_
8108         (Output_reloc::write): Likewise.
8109         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8110         (Output_reloc::write_rel): Simplify.
8111
8112         * sparc.cc (Target_sparc::Scan::local): Use
8113         ->add_symbolless_local_addend as needed.
8114         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8115         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8116         based upon relocation offset.
8117
8118 2010-02-11  Doug Kwan  <dougkwan@google.com>
8119
8120         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8121         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8122         beginning of function.
8123         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8124         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8125         parameter is_32bit in calls to should_apply_static_reloc.
8126         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8127         (check_DATA): Add arm_abs_global.stdout.
8128         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8129         arm_abs_global.stdout): New rules.
8130         (MOSTLLYCLEANFILES): Add arm_abs_global
8131         * Makefile.in: Regenerate.
8132         * testsuite/arm_abs_global.s: New file.
8133         * testsuite/arm_abs_global.sh: Ditto.
8134         * testsuite/arm_abs_lib.s: Ditto.
8135
8136 2010-02-11  Ian Lance Taylor  <iant@google.com>
8137
8138         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8139         Read_relocs task.
8140         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8141         Allocate_commons_task first.
8142         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8143         task, rather than symtab_lock_.
8144         (Gc_process_relocs::~Gc_process_relocs): New function.
8145         (Gc_process_relocs::is_runnable): Check this_blocker_.
8146         (Gc_process_relocs::locks): Use next_blocker_ rather than
8147         blocker_.
8148         (Scan_relocs::~Scan_relocs): New function.
8149         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8150         symtab_lock_.
8151         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8152         next_blocker_.
8153         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8154         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8155         constructor accordingly.
8156         (class Gc_process_relocs): Likewise.
8157         (class Scan_relocs): Likewise.
8158         * common.h (class Allocate_commons_task): Remove symtab_lock_
8159         field, and corresponding constructor parameter.
8160         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8161         symtab_lock_.
8162         (Allocate_commons_task::locks): Likewise.
8163
8164 2010-02-11  Ian Lance Taylor  <iant@google.com>
8165
8166         * gold-threads.h (class Once): Define.
8167         (class Initialize_lock): Rewrite as child of Once.
8168         * gold-threads.cc (class Once_initialize): Define.
8169         (once_pointer_control): New static variable.
8170         (once_pointer, once_arg): New static variables.
8171         (c_run_once): New static function.
8172         (Once::Once, Once::run_once, Once::internal_run): New functions.
8173         (class Initialize_lock_once): Remove.
8174         (initialize_lock_control): Remove.
8175         (initialize_lock_pointer): Remove.
8176         (initialize_lock_once): Remove.
8177         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8178         (Initialize_lock::initialize): Rewrite.
8179         (Initialize_lock::do_run_once): New function.
8180         * archive.cc (Archive::interpret_header): Only clear name if it is
8181         not already empty.
8182         * fileread.cc: Include "gold-threads.h"
8183         (file_counts_lock): New static variable.
8184         (file_counts_initialize_lock): Likewise.
8185         (File_read::release): Only increment counts when using --stats.
8186         Use a lock around the increment.
8187         * parameters.cc (class Set_parameters_target_once): Define.
8188         (set_parameters_target_once): New static variable.
8189         (Parameters::Parameters): Move here from parameters.h.
8190         (Parameters::set_target): Rewrite.
8191         (Parameters::set_target_once): New function.
8192         (Parameters::clear_target): Move here and rewrite.
8193         * parameters.h (class Parameters): Update declarations.  Add
8194         set_parameters_target_once_ field.
8195         (Parameters::Parameters): Move to parameters.cc.
8196         (Parameters::clear_target): Likewise.
8197         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8198         task.
8199         (Start_group::~Start_group): New function.
8200         (Start_group::is_runnable): New function.
8201         (Start_group::locks, Start_group::run): New functions.
8202         (Finish_group::run): Change saw_undefined to size_t.
8203         * readsyms.h (class Start_group): Define.
8204         (class Finish_group): Change saw_undefined_ field to size_t.
8205         (Finish_group::Finish_group): Remove saw_undefined and
8206         this_blocker parameters.  Change all callers.
8207         (Finish_group::set_saw_undefined): New function.
8208         (Finish_group::set_blocker): New function.
8209         * symtab.h (class Symbol_table): Change saw_undefined to return
8210         size_t.  Change saw_undefined_ field to size_t.
8211         * target-select.cc (Set_target_once::do_run_once): New function.
8212         (Target_selector::Target_selector): Initialize set_target_once_
8213         field.  Don't initialize lock_ and initialize_lock_ fields.
8214         (Target_selector::instantiate_target): Rewrite.
8215         (Target_selector::set_target): New function.
8216         * target-select.h (class Set_target_once): Define.
8217         (class Target_selector): Update declarations.  Make
8218         Set_target_once a friend.  Remove lock_ and initialize_lock_
8219         fields.  Add set_target_once_ field.
8220
8221 2010-02-10  Ian Lance Taylor  <iant@google.com>
8222
8223         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8224         queueing any tasks.
8225         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8226         (queue_middle_tasks): Add all blockers before queueing any tasks.
8227         (queue_final_tasks): Likewise.
8228         * token.h (Task_token::add_blockers): New function.
8229         * object.h (Input_objects::number_of_relobjs): New function.
8230
8231 2010-02-10  Ian Lance Taylor  <iant@google.com>
8232
8233         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8234         shared, not if not position independent.
8235         * x86_64.cc (Relocate::relocate_tls): Likewise.
8236         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8237         (tls_pie_pic_test): New target.
8238         * testsuite/Makefile.in: Rebuild.
8239
8240         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8241         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8242         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8243         * testsuite/Makefile.in: Rebuild.
8244
8245 2010-02-09  David S. Miller  <davem@davemloft.net>
8246
8247         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8248         R_SPARC_RELATIVE using ->add_local_relative().
8249         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8250
8251         * output.h (Output_data_dynamic::add_section_size): New method
8252         that takes two Output_data objects.
8253         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8254         entry param.  Handle it in initializers.
8255         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8256         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8257         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8258         arg.
8259         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8260         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8261         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8262         for dynrel_includes_plt.
8263         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8264         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8265         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8266         before .rela.plt
8267         (Target_sparc::do_finalize_sections): Update to pass true for
8268         dynrel_includes_plt.
8269         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8270         output before .rela.plt
8271         (Target_powerpc::do_finalize_sections): Update to pass true for
8272         dynrel_includes_plt when 32-bit.
8273
8274 2010-02-08  Doug Kwan  <dougkwan@google.com>
8275
8276         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8277         method.
8278         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8279         Arm_relobj::scan_section_for_cortex_a8_stubs,
8280         Arm_relobj::do_relocation_section): Instead of calling
8281         Output_section::output_address, use faster
8282         Arm_relobj::simple_input_section_output_address.
8283
8284 2010-02-08  David S. Miller  <davem@davemloft.net>
8285
8286         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8287         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8288         relocation helper function.
8289
8290         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8291         just like R_SPARC_GOT{10,13,22}.
8292         (Target_sparc::Scan::local): Likewise.
8293         (Target_sparc::Relocate:relocate): Likewise.
8294
8295 2010-02-06  Ian Lance Taylor  <iant@google.com>
8296
8297         * configure.ac: Rewrite targetobjs duplicate removal code to use
8298         only shell constructs.
8299         * configure: Rebuild.
8300
8301 2010-02-05  Doug Kwan  <dougkwan@google.com>
8302
8303         PR 11247
8304         * arm.cc (Arm_relobj::section_is_scannable): New method.
8305         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8306         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8307
8308 2010-02-04  Doug Kwan  <dougkwan@google.com>
8309
8310         PR 11247
8311         * arm-reloc-property.cc (cstdio): Include.
8312         * configure.ac (targetobjs): Remove duplicates.
8313         * configure: Regenerate.
8314         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8315         big and little endian version for a given address size.
8316
8317 2010-02-03  Doug Kwan  <dougkwan@google.com>
8318
8319         * arm-reloc-property.cc
8320         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8321         definition.
8322         * arm-reloc-property.h
8323         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8324         New method definition.
8325         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8326         declaration.
8327         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8328         overflow to N.
8329         (GOT_PREL): Change implemented to Y.
8330         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8331         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8332         (Arm_relocate_functions::movw_abs_nc): Remove method.
8333         (Arm_relocate_functions::movt_abs): Ditto.
8334         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8335         (Arm_relocate_functions::thm_movt_abs): Ditto.
8336         (Arm_relocate_functions::movw_rel_nc): Ditto.
8337         (Arm_relocate_functions::movw_rel): Ditto.
8338         (Arm_relocate_functions::movt_rel): Ditto.
8339         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8340         (Arm_relocate_functions:thm_movw_rel): Ditto.
8341         (Arm_relocate_functions:thm_movt_rel): Ditto.
8342         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8343         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8344         New method definitions.
8345         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8346         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8347         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8348         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8349         (Target_arm::Relocate::relocate): Check for non-static or
8350         unimplemented relocation code and exit early.  Change calls to
8351         Target_arm::reloc_uses_thumb_bit and
8352         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8353         instead.  Refactor code to handle similar relocations to increase
8354         code sharing.  Remove check for unsupported relocation code in switch
8355         statement.
8356         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8357         relocation property table to find out size.  Change error message to
8358         print out the name of a relocation code instead of the numeric value.
8359         (Target_arm::scan_reloc_for_stub): Use relocation property table
8360         instead of calling Target_arm::reloc_uses_thumb_bit().
8361
8362 2010-02-02  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8365         types of relaxed input section.
8366
8367 2010-02-02  Doug Kwan  <dougkwan@google.com>
8368
8369         * Makefile.am (HFILES): Add arm-reloc-property.h.
8370         (DEFFILES): New.
8371         (TARGETSOURCES): Add arm-reloc-property.cc
8372         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8373         (libgold_a_SOURCES): $(DEFFILES)
8374         * Makefile.in: Regenerate.
8375         * arm-reloc-property.cc: New file.
8376         * arm-reloc-property.h: New file.
8377         * arm-reloc.def: New file.
8378         * arm.cc: Update comments.
8379         (arm-reloc-property.h): New included header.
8380         (arm_reloc_property_table): New global variable.
8381         (Target_arm::do_select_as_default_target): New method definition.
8382         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8383         arm-reloc-property to targ_extra_obj.
8384         * parameters.cc (set_parameters_target): Call
8385         Target::select_as_default_target().
8386         * target.h (Target::select_as_default_target): New method definition.
8387         (Target::do_select_as_default_target): Same.
8388
8389 2010-02-01  Doug Kwan  <dougkwan@google.com>
8390
8391         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8392         first_output_text_section_.
8393         (Arm_exidx_fixup::first_output_text_section): New method definition.
8394         (Arm_exidx_fixup::first_output_text_section_): New data member.
8395         (Arm_exidx_fixup::process_exidx_section): Record the first text
8396         output section seen.
8397         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8398         and entsize in output section header.
8399
8400 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8401
8402         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8403         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8404         (Arm_relocate_functions::thm_alu11): New Method.
8405         (Arm_relocate_functions::thm_pc8): New Method.
8406         (Arm_relocate_functions::thm_pc12): New Method.
8407         (Target_arm::Scan::local): Handle the relocations.
8408         (Target_arm::Scan::global): Likewise.
8409         (Target_arm::Relocate::relocate): Likewise.
8410         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8411
8412 2010-01-29  Doug Kwan  <dougkwan@google.com>
8413
8414         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8415         of relocation types as ld.
8416
8417 2010-01-29  Doug Kwan  <dougkwan@google.com>
8418
8419         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8420         to public.
8421         (Arm_relocate_functions::thumb_branch_common): Ditto.
8422         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8423         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8424         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8425         Arm_relocate_functions::jump24): Remove.
8426         (Target_arm::Relocate::relocate): Adjust code to call
8427         Arm_relocation_functions::arm_branch_common and
8428         Arm_relocation_functions::thumb_branch_common instead of their removed
8429         wrappers.  Merge switch-cases together to reduce source code size.
8430
8431 2010-01-29  Doug Kwan  <dougkwan@google.com>
8432
8433         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8434         output_local_symbol_count_needs_update_.
8435         (Arm_relobj::output_local_symbol_count_needs_update,
8436          Arm_relobj::set_output_local_symbol_count_needs_update,
8437          Arm_relobj::update_output_local_symbol_count): New methods.
8438         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8439         member.
8440         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8441         of pointed function as in a R_ARM_PREL31 relocation.
8442         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8443         for output local symbol count updating.
8444         (Target_arm::do_relax): Update output local symbol counts in objects
8445         if necessary.
8446         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8447
8448 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8449
8450         * arm.cc: Added support for the ARM relocations:
8451         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8452         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8453         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8454         movw_prel_nc).
8455         (Arm_relocate_functions::movw_rel): New method.
8456         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8457         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8458         thm_movw_prel_nc).
8459         (Arm_relocate_functions::thm_movw_rel): New method.
8460         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8461         thm_movt_prel).
8462         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8463         relocations.
8464         (Target_arm::Scan::global): Likewise.
8465         (Target_arm::Relocate::relocate): Likewise.
8466         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8467         Likewise.
8468
8469 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8470
8471         * arm.cc: Added support for ARM group relocations.
8472         (Target_arm::reloc_needs_sym_origin): New method.
8473         (Arm_relocate_functions::calc_grp_kn): New method.
8474         (Arm_relocate_functions::calc_grp_residual): New method.
8475         (Arm_relocate_functions::calc_grp_gn): New method.
8476         (Arm_relocate_functions::arm_grp_alu): New Method.
8477         (Arm_relocate_functions::arm_grp_ldr): New Method.
8478         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8479         (Arm_relocate_functions::arm_grp_ldc): New Method.
8480         (Target_arm::Scan::local): Handle the ARM group relocations.
8481         (Target_arm::Scan::global): Likewise.
8482         (Target_arm::Relocate::relocate): Likewise.
8483         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8484         Likewise.
8485
8486 2010-01-26  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm.cc (set): Include.
8489         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8490         pointer type.
8491         (Arm_output_section::Text_section_list): New type.
8492         (Arm_output_section::append_text_sections_to_list): New method.
8493         (Arm_output_section::fix_exidx_coverage): Ditto.
8494         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8495         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8496         Relobj::set_section_offset() instead of
8497         Sized_relobj::invalidate_section_offset().
8498         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8499         parameter for section headers. Ignore relocation sections for
8500         unallocated sections and EXIDX sections.
8501         (Target_arm::fix_exidx_coverage): New method.
8502         (Target_arm::output_section_address_less_than): New type.
8503         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8504         linked text section instead of the EXIDX section.
8505         (Arm_output_section::create_stub_group): Add an assertion to check
8506         that this is not an EXIDX output section.
8507         (Arm_output_section::append_text_sections_to_list): New method.
8508         (Arm_output_section::fix_exidx_coverage): Ditto.
8509         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8510         Arm_relobj::section_needs_reloc_stub_scanning.
8511         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8512         first pass.
8513         (Target_arm::fix_exidx_coverage): New method.
8514         * object.h (Relobj::set_output_section): New method.
8515         (Sized_relobj::invalidate_section_offset): Remove method.
8516         (Sized_relobj::do_invalidate_section_offset): Remove method.
8517         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8518
8519 2010-01-25  Doug Kwan  <dougkwan@google.com>
8520
8521         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8522         Fix warning due to signed and unsigned comparison on a 32-bit host.
8523
8524 2010-01-22  Doug Kwan  <dougkwan@google.com>
8525
8526         * arm.cc (Target_arm::do_relax): Record an output section for section
8527         offset adjustment it contains any stub table that has changed.
8528         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8529         offsets in an output section if necessary.
8530         * output.cc (Output_section::Output_section): Initialize
8531         section_offsets_need_adjustments_.
8532         (Output_section::add_input_section_for_script): Renamed to
8533         Output_section::add_simple_input_section.
8534         (Output_section::save_states): Add a comment.
8535         (Output_section::discard_states): New method defintion.
8536         (Output_section::adjust_section_offsets): Same.
8537         * output.h (Output_section::add_input_section_for_script): Renamed to
8538         Output_section::add_simple_input_section.
8539         (Output_section::discard_states): New method declaration.
8540         (Output_section::adjust_section_offsets): Same.
8541         (Output_section::section_offsets_need_adjustment,
8542         Output_section::set_section_offsets_need_adjustment): New method
8543         definitions.
8544         (Output_section::section_offsets_need_adjustment_): New data member.
8545         * script-sections.cc
8546         (Output_section_element_input::set_section_address): Adjust code for
8547         renaming of Output_section::add_input_section_for_script.
8548         (Orphan_output_section::set_section_address): Same.
8549
8550 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8551
8552         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8553         Fix_v4bx enum values .
8554         * gold/options.h (General_options): New option definitions.
8555         (General_options::fix_v4bx): New method.
8556         (General_options::Fix_v4bx): New enum.
8557         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8558         (General_options::parse_fix_v4bx_interworking): New method.
8559
8560 2010-01-22  Doug Kwan  <dougkwan@google.com>
8561
8562         * arm.cc (Arm_exidx_fixup): New class.
8563
8564 2010-01-21  Doug Kwan  <dougkwan@google.com>
8565
8566         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8567         classes.
8568         (Arm_exidx_section_offset_map): New type.
8569
8570 2010-01-21  Doug Kwan  <dougkwan@google.com>
8571
8572         * arm.cc (Arm_exidx_input_section): New class.
8573         (Arm_relobj::exidx_input_section_by_link,
8574         Arm_relobj::exidx_input_section_by_shndx,
8575         Arm_relobj::make_exidx_input_section): New methods.
8576         (read_arm_attributes_section): Remove.
8577         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8578         information about them.
8579         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8580         to here.
8581
8582 2010-01-20  Doug Kwan  <dougkwan@google.com>
8583
8584         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8585         Input_section_specifier to Section_id.
8586         (Target_arm::new_arm_input_section: Adjust code for change of key
8587         type.
8588         (Target_arm::find_arm_input_section): Ditto.
8589         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8590         (Section_id): Remove.
8591         (Garbage_collection::Section_id_hash): Remove.
8592         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8593         (Section_id): Remove.
8594         (Icf::Section_id_hash): Remove.
8595         * object.h (Section_id, Const_section_id, Section_id_hash,
8596         Const_section_id_hash): New type definitions.
8597         * output.cc (Output_section::add_relaxed_input_section): Change to
8598         use Const_section_id instead of Input_section_specifier as key type.
8599         (Output_section::add_merge_input_section): Ditto.
8600         (Output_section::build_relaxation_map): Change to use Section_id
8601         instead of Input_section_specifier as key type.
8602         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8603         Ditto.
8604         (Output_section::convert_input_sections_to_relaxed_sections): Change
8605         to use Const_section_id instead of Input_section_specifier as key type.
8606         (Output_section::find_merge_section): Ditto.
8607         (Output_section::find_relaxed_input_section): Ditto.
8608         * output.h (Input_section_specifier): Remove class.
8609         (Output_section::Output_section_data_by_input_section_map): Change
8610         key type to Const_section_id.
8611         (Output_section::Output_relaxed_input_section_by_input_section_map):
8612         Ditto.
8613         (Output_section::Relaxation_map): Change key type to Section_id.
8614
8615 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8616
8617         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8618         (class Arm_v4bx_stub): New class.
8619         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8620         (Stub_factory::make_arm_v4bx_stub): New method.
8621         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8622         (Stub_table::empty): Handle v4bx stubs.
8623         (Stub_table::add_arm_v4bx_stub): New method.
8624         (Stub_table::find_arm_v4bx_stub): New method.
8625         (Arm_relocate_functions::v4bx): New method.
8626         (Target_arm::fix_v4bx): New method.
8627         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8628         (Stub_table::relocate_stubs): Likewise.
8629         (Stub_table::do_write): Likewise.
8630         (Stub_table::update_data_size_and_addralign): Likewise.
8631         (Stub_table::finalize_stubs):  Likewise.
8632         (Target_arm::Scan::local): Likewise.
8633         (Target_arm::Scan::global): Likewise.
8634         (Target_arm::do_finalize_sections): Likewise.
8635         (Target_arm::Relocate::relocate): Likewise.
8636         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8637         Likewise.
8638         (Target_arm::scan_reloc_for_stub): Likewise.
8639         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8640
8641 2010-01-19  Ian Lance Taylor  <iant@google.com>
8642
8643         * output.cc (Output_section_headers::do_sized_write): Write large
8644         segment count to sh_info field.
8645         (Output_file_header::do_sized_write): For large segment count,
8646         write PN_XNUM to e_phnum field.
8647
8648 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8649
8650         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8651         (Arm_relocate_functions::thm_jump8): New function.
8652         (Arm_relocate_functions::thm_jump11): New function.
8653         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8654         R_ARM_THM_JUMP11.
8655         (Target_arm::Scan::global): Likewise.
8656         (Target_arm::Relocate::relocate): Likewise.
8657         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8658         Likewise.
8659
8660 2010-01-14  Doug Kwan  <dougkwan@google.com>
8661
8662         * arm.cc (map, utility): Include headers.
8663         (Target_arm::apply_cortex_a8_workaround): New method.
8664         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8665         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8666         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8667         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8668         the --[no-]fix-cortex-a8 command line options.
8669         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8670         (Target_arm::relocate_stub): Use addend in instruction template.
8671         * options.h (DEFINE_bool): Set the user-set flag.
8672         (General_options): Add --[no-]-fix-cortex options.
8673         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8674         : Update fast look-up map after conversion.
8675
8676 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8677
8678         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8679         in the first pass of do_layout.
8680
8681 2010-01-13  Doug Kwan  <dougkwan@google.com>
8682
8683         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8684         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8685         apparent compiler problem of not folding static constant integral
8686         data members of elfcpp::Elf_sizes<32>.
8687
8688 2010-01-13  Doug Kwan  <dougkwan@google.com>
8689
8690         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8691         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8692         Arm_relobj::scan_section_for_cortex_a8_erratum,
8693         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8694         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8695         sections to scan for relocation stubs into a new method
8696         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8697         relocation and Cortex-A8 stub scanning.
8698         (Target_arm::do_relax): Force stubs to be after stubbed sections
8699         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8700         the beginning of a new relaxation pass.  Update a comment.
8701         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8702
8703 2010-01-12  Ian Lance Taylor  <iant@google.com>
8704
8705         * target-reloc.h (visibility_error): New inline function.
8706         (relocate_section): Call visibility_error.
8707         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8708         (MOSTLYCLEANFILES): Likewise.
8709         (protected_4_pic.o, protected_3.err): New targets.
8710         * testsuite/protected_4.cc: New file.
8711
8712 2010-01-12  Doug Kwan  <dougkwan@google.com>
8713
8714         * arm.cc (Cortex_a8_reloc): New class.
8715         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8716         and cortex_a8_relocs_info_.
8717         (Target_arm::fix_cortex_a8): New method definition.
8718         (Target_arm::Cortex_a8_relocs_info): New type.
8719         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8720         New data member declarations.
8721         (Target_arm::scan_reloc_for_stub): Record information about
8722         relocations for THUMB branches that might be exempted from the
8723         Cortex-A8 workaround.
8724         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8725         at the beginning of a relaxation pass.
8726
8727 2010-01-12  Doug Kwan  <dougkwan@google.com>
8728
8729         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8730         (Arm_relobj::Mapping_symbol_position,
8731          Arm_reloj::Mapping_symbol_position_less,
8732          Arm_relobj::Mapping_symbols_info): New types.
8733         (Target_arm::is_mapping_symbol_name): New method definition.
8734         (Arm_relobj::do_count_local_symbols): Save information about mapping
8735         symbols.
8736
8737 2010-01-11  Doug Kwan  <dougkwan@google.com>
8738
8739         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8740         Arm_relocate_functions::thumb32_branch_upper,
8741         Arm_relocate_functions::thumb32_branch_lower,
8742         Arm_relocate_functions::thumb32_cond_branch_offset,
8743         Arm_relocate_functions::thumb32_cond_branch_upper,
8744         Arm_relocate_functions::thumb32_cond_branch_lower,
8745         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8746         branch offset encoding.
8747         (Arm_relocate_functions::thumb_branch_common): Use new branch
8748         offset encoding methods to avoid code duplication.
8749         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8750         (Stub_addend_reader::operator()): Use new branch encoding method
8751         to avoid code duplication.
8752
8753 2010-01-11  Doug Kwan  <dougkwan@google.com>
8754
8755         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8756         (Target_arm::do_finalize_sections): Define special EXIDX section
8757         symbols only if referenced.
8758         * gc.h (Garbage_collection::add_reference): New method.
8759         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8760         code duplication.
8761
8762 2010-01-11  Ian Lance Taylor  <iant@google.com>
8763
8764         * script.cc (Version_script_info::build_expression_list_lookup):
8765         Change complaing about duplicate wildcard match from error to
8766         warning.
8767
8768         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8769         of 2009-12-30.
8770         (Version_script_info::Version_script_info): Initialize globs_,
8771         default_version_, default_is_global_, and exact_.  Don't
8772         initialize globals_ or locals_.
8773         (Version_script_info::build_lookup_tables): Build local symbols
8774         first.
8775         (Version_script_info::unquote): New function.
8776         (Version_script_info::add_exact_match): New function.
8777         (Version_script_info::build_expression_list_lookup): Remove lookup
8778         parameter.  Add is_global parameter.  Change all callers.  Handle
8779         wildcard pattern specially.  Unquote pattern.  Call
8780         add_exact_match.
8781         (Version_script_info::get_name_to_match): New function.
8782         (Version_script_info::get_symbol_version): New function.
8783         (Version_script_info::get_symbol_version_helper): Remove.
8784         (Version_script_info::check_unmatched_names): Call unquote.
8785         * script.h (class Version_script_info): Change get_symbol_version
8786         to be non-inline and add is_global parameter; change all callers.
8787         Rewrite symbol_is_local.  Update declarations.  Define struct
8788         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8789         Remove globals_ and locals_ members.  Add exact_, globs_,
8790         default_version_, is_global_.
8791         (Version_script_info::Glob): Remove pattern, add expression and
8792         is_global.  Update constructor.  Change all callers.
8793         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8794         default version.
8795         (Versions::symbol_section_contents): If a symbol is undefined, or
8796         defined in a dynamic object, set the version index to
8797         VER_NDX_LOCAL.
8798         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8799         symbol_is_local.
8800         (Symbol_table::add_from_pluginobj): Likewise.
8801         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8802
8803 2010-01-11  Doug Kwan  <dougkwan@google.com>
8804
8805         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8806         (incremental_dump_LDADD): Add linking option for libintl.
8807         * Makefile.in: Regenerate.
8808
8809 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8810
8811         PR gold/11144
8812         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8813         instead of -Ds.
8814         * testsuite/Makefile.in: Regenerated.
8815
8816 2010-01-10  Doug Kwan  <dougkwan@google.com>
8817
8818         * options.h (DEFINE_var): Use parentheses around argument varname__
8819         in macro body to avoid any unintended subsequent substitutions.
8820
8821 2010-01-10  Ian Lance Taylor  <iant@google.com>
8822
8823         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8824         candidates before doing symbol resolution.
8825
8826         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8827         ODR candidates if only one is weak.
8828
8829 2010-01-08  Ian Lance Taylor  <iant@google.com>
8830
8831         * script.cc (Version_script_info::build_expression_list_lookup):
8832         Don't warn about ambiguous version, just record the ambiguity.
8833         (Version_script_info::get_symbol_version_helper): Give error if
8834         version is ambiguous.
8835
8836 2010-01-08  Doug Kwan  <dougkwan@google.com>
8837
8838         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8839         prev_data_size_ and prev_addralign_.  Remove initializer for
8840         deleted data member has_been_changed_.
8841         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8842         to determine if the table is empty.
8843         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8844         Remove.
8845         (Stub_table::add_reloc_stub): Define method in class definition
8846         instead of just declaring it there.
8847         (Stub_table::add_cortex_a8_stub): New method definition.
8848         (Stub_table::update_data_size_and_addralign): Ditto.
8849         (Stub_table::finalize_stubs): Ditto.
8850         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8851         (Stub_table::do_addralign_): Return address alignment in the
8852         (Stub_table::do_reset_address_and_file_offset): Define method in
8853         class definition instead of declaring it there.  Set current data
8854         size to be the data size of the previous pass.
8855         (Stub_table::set_final_data_size): Use current data size as the
8856         final data size.
8857         (Stub_table::relocate_stub): Change parameter type of stub from
8858         Reloc_stub pointer to Stub pointer.
8859         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8860         (Stub_table::Cortex_a8_stub_list): New typedef.
8861         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8862          Stub_table::prev_addralign_): New data member.
8863         (Arm_relobj::Arm_relobj): Initialize data member
8864         section_has_cortex_a8_workaround_.
8865         (Arm_relobj::section_has_cortex_a8_workaround,
8866          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8867          definitions.
8868         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8869         declarations.
8870         (Target_arm::relocate_stub): Change parameter type of stub from
8871         Reloc_stub pointer to Stub pointer.
8872         (Insn_template::size, Insn_template::alignment): Handle
8873         THUMB16_SPECIAL_TYPE.
8874         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8875          Stub_table::update_data_size_and_addralign,
8876          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8877         definitions.
8878         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8879         (Stub_table::do_write): Ditto.
8880         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8881
8882 2010-01-08  Ian Lance Taylor  <iant@google.com>
8883
8884         PR 11108
8885         * symtab.h (class Symbol): Remove fields is_target_special_ and
8886         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8887         (Symbol::is_defined_in_discarded_section): New function.
8888         (Symbol::set_is_defined_in_discarded_section): New function.
8889         (Symbol::has_plt_offset): Rewrite.
8890         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8891         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8892         Don't initialize is_target_special_ or has_plt_offset_.
8893         Initialize is_defined_in_discarded_section_.
8894         (Symbol_table::add_from_relobj): If appropriate, set
8895         is_defined_in_discarded_section.
8896         * resolve.cc (Symbol::override_base_with_special): Don't test
8897         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8898         * target-reloc.h (relocate_section): Do special handling for
8899         symbols defined in discarded sections for global symbols as well
8900         as local symbols.
8901
8902 2010-01-08  Ian Lance Taylor  <iant@google.com>
8903
8904         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8905         the SHT_SYMTAB case.
8906
8907 2010-01-08  Ian Lance Taylor  <iant@google.com>
8908
8909         * object.cc (Sized_relobj::do_layout): Don't get confused if
8910         layout_eh_frame returns NULL.
8911
8912 2010-01-08  Ian Lance Taylor  <iant@google.com>
8913
8914         PR 11084
8915         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8916         dynamic symbol table, use the normal symbol table.
8917         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8918         symbol table.
8919
8920 2010-01-08  Ian Lance Taylor  <iant@google.com>
8921
8922         PR 11072
8923         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8924         sections.
8925
8926 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8927
8928         * version.cc (print_version): Change to "Copyright 2010".
8929
8930 2010-01-08  Ian Lance Taylor  <iant@google.com>
8931
8932         PR 10287
8933         PR 11063
8934         * i386.cc (class Target_i386): Change return type of plt_section
8935         to be non-const.
8936         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8937         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8938         tls_desc_rel_ field.
8939         (Output_data_plt_i386::rel_tls_desc): New function.
8940         (Target_i386::rel_tls_desc_section): New function.
8941         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8942         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8943         R_386_TLS_DESC reloc in rel_tls_desc_section.
8944         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8945         Define struct Tlsdesc_info.
8946         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8947         (Target_x86_64::do_reloc_symbol_index): New function.
8948         (Target_x86_64::add_tlsdesc_info): New function.
8949         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8950         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8951         tlsdesc_rel_ field.
8952         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8953         all callers.
8954         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8955         (Target_x86_64::rela_tlsdesc_section): New function.
8956         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8957         handling.
8958         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8959         (Target_x86_64::do_reloc_addend): New function.
8960         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8961         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8962         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8963         (Output_reloc::type): New function.
8964         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8965         (Output_reloc::is_target_specific): New function.
8966         (Output_reloc::target_arg): New function.
8967         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8968         absolute relocs and target specific relocs.
8969         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8970         add_target_specific.
8971         (class Output_data_reloc) [SHT_RELA]: Likewise.
8972         * output.cc (Output_reloc::Output_reloc): Add four new versions
8973         for absolute relocs and target specific relocs.
8974         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8975         (Output_reloc::get_symbol_index): Likewise.
8976         (Output_reloc::local_section_offset): Check that local_sym_index_
8977         is not TARGET_CODE or 0.
8978         (Output_reloc::symbol_value): Likewise.
8979         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8980         reloc.
8981         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8982         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8983         functions.
8984         * layout.cc (add_target_dynamic_tags): Use output section for
8985         DT_PLTRELSZ and DT_JMPREL.
8986
8987 2010-01-07  Ian Lance Taylor  <iant@google.com>
8988
8989         PR 11061
8990         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8991         function.
8992         (class Output_data_reloc_generic): Define.
8993         (class Output_data_reloc_base): Change base class to
8994         Output_data_reloc_generic.  Change add() method to call
8995         bump_relative_reloc_count for a relative reloc.  Remove
8996         sort_relocs_ field.
8997         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8998         to sort_relocs().
8999         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9000         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9001         appropriate.
9002         * layout.h (class Layout): Update declaration.
9003
9004 2010-01-07  Ian Lance Taylor  <iant@google.com>
9005
9006         * output.h (class Output_data): Add const version of
9007         output_section and do_output_section.
9008         (class Output_section_data): Add const version of
9009         do_output_section.
9010         (class Output_section): Likewise.
9011         * layout.cc (Layout::add_target_dynamic_tags): New function.
9012         * layout.h (class Layout): Update declarations.
9013         * arm.cc (Target_arm::do_finalize_sections): Use
9014         add_target_dynamic_tags.
9015         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9016         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9017         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9018         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9019
9020 2010-01-07  Ian Lance Taylor  <iant@google.com>
9021
9022         PR 11042
9023         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9024         object as needed.
9025
9026 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9027             Ian Lance Taylor  <iant@google.com>
9028
9029         PR 11019
9030         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9031         Xindex::read_symtab_xindex.
9032
9033 2010-01-07  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9036         (Insn_template::thumb16_bcond_insn): New method declaration.
9037         (Insn_template): Fix spelling.
9038         (Stub::thumb16_special): New method declaration.
9039         (Stub::do_write): Define virtual method which was previously pure
9040         virtual.
9041         (Stub::do_thumb16_special): New method declaration.
9042         (Stub::do_fixed_endian_write): New template member.
9043         (Reloc_stub::do_write): Remove.
9044         (Reloc_stub::do_fixed_endian_write): Remove.
9045         (Cortex_a8_stub): New class definition.
9046         (Stub_factory::make_cortex_a8_stub): New method definition.
9047         (Stub_factory::Stub_factory): Add missing static storage class
9048         qualifier for elf32_arm_stub_a8_veneer_blx.
9049
9050 2010-01-07  Ian Lance Taylor  <iant@google.com>
9051
9052         PR 10980
9053         * options.h (class General_options): Add --warn-unresolved-symbols
9054         and --error-unresolved-symbols.
9055         * errors.cc (Errors::undefined_symbol): Implement
9056         --warn-unresolved-symbols.
9057
9058         * options.h (class General_options): Add -z text and -z textoff.
9059         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9060
9061 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9062
9063         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9064         (Garbage_collection::cident_sections): New function.
9065         (Garbage_collection::add_cident_section): New function.
9066         (Garbage_collection::cident_sections_): New member.
9067         (gc_process_relocs): Add references to sections whose names are C
9068         identifiers.
9069         * gold.h (cident_section_start_prefix): New constant.
9070         (cident_section_stop_prefix): New constant.
9071         (is_cident): New function.
9072         * layout.cc (Layout::define_section_symbols): Replace string constants
9073         with the newly defined constants.
9074         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9075         C identifiers.
9076         * testsuite/Makefile.am: Add gc_orphan_section_test.
9077         * testsuite/Makefile.in: Regenerate.
9078         * testsuite/gc_orphan_section_test.cc: New file.
9079         * testsuite/gc_orphan_section_test.sh: New file.
9080
9081 2010-01-06  Ian Lance Taylor  <iant@google.com>
9082
9083         PR 10980
9084         * options.h (class General_options): Add --warn-shared-textrel.
9085         * layout.cc (Layout::finish_dynamic_section): Implement
9086         --warn-shared-textrel.
9087
9088         PR 10980
9089         * options.h (class General_options): Add --warn-multiple-gp.
9090
9091 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9092
9093         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9094         $(THREADSLIB) and $(LIBDL).
9095         * Makefile.in: Rebuild.
9096
9097 2010-01-06  Ian Lance Taylor  <iant@google.com>
9098
9099         PR 10980
9100         * options.cc (General_options::parse_section_start): New function.
9101         (General_options::section_start): New function.
9102         (General_options::General_options): Initialize all members.
9103         * options.h: Include <map>
9104         (class General_options): Add --section-start.  Add section_starts_
9105         member.
9106         * layout.cc (Layout::attach_allocated_section_to_segment): If
9107         --section-start was used, set the address of the segment.  Remove
9108         local sort_sections.
9109         (Layout::relaxation_loop_body): If the address of the load segment
9110         has been set by --section-start, don't use it.
9111         * output.h (Output_segment::update_flags_for_output_section): New
9112         function.
9113         * output.cc (Output_segment::add_output_section): Call
9114         update_flags_for_output_section.
9115
9116 2010-01-05  Ian Lance Taylor  <iant@google.com>
9117
9118         PR 10980
9119         * options.h (class General_options): Add --undefined-version.
9120         * script.cc (struct Version_expression): Add was_matched_by_symbol
9121         field.
9122         (Version_script_info::matched_symbol): New function.
9123         (Version_script_info::get_symbol_version_helper): Call
9124         matched_symbol.
9125         (Version_script_info::check_unmatched_names): New function.
9126         * script.h (class Version_script_info): Update declarations.
9127         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9128
9129         * options.h (class General_options): Use DEFINE_bool_alias for
9130         allow_multiple_definition.
9131         * resolve.cc (Symbol_table::should_override): Don't test
9132         allow_multiple_definition.
9133
9134         PR 10980
9135         * options.h (class General_options): Add --cref.
9136         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9137         until after printing cref table.
9138         * cref.cc: Include "symtab.h".
9139         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9140         (Cref_table_compare::operator()): New function.
9141         (Cref_inputs::gather_cref): New function.
9142         (filecol): New static const.
9143         (Cref_inputs::print_cref): New function.
9144         (Cref::print_cref): New function.
9145         * cref.h: Include <cstdio>.
9146         (class Cref): Update declarations.
9147         * mapfile.h (Mapfile::file): New function.
9148         * object.h (class Object): Define Symbols.  Declare virtual
9149         do_get_global_symbols.
9150         (Object::get_global_symbols): New function.
9151         * object.cc (Input_objects::add_object): Pass object to cref_ if
9152         --cref.
9153         (Input_objects::archive_start): Likewise.
9154         (Input_objects::archive_stop): Likewise.
9155         (Input_objects::print_cref): New function.
9156         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9157         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9158         --cref.
9159         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9160         function.
9161         * plugin.h (class Sized_pluginobj): Update declarations.
9162
9163 2010-01-05  Ian Lance Taylor  <iant@google.com>
9164
9165         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9166         to is_default_version.  Rename insdef to insdefault.
9167         (Symbol_table::add_from_relobj): Rename def to is_default_version
9168         and local to is_forced_local.
9169         (Symbol_table::add_from_pluginobj): Likewise.
9170         (Symbol_table::add_from_dynobj): Likewise.
9171         (Symbol_table::define_special_symbol): Rename insdef to
9172         insdefault.
9173
9174 2010-01-04  Ian Lance Taylor  <iant@google.com>
9175
9176         PR 10980
9177         * options.h (class General_options): Add
9178         --allow-multiple-definition and -z muldefs.
9179         * resolve.cc (Symbol_table::should_override): Don't warn about a
9180         multiple symbol definition if --allow-multiple-definition or -z
9181         muldefs.
9182
9183         PR 10980
9184         * options.h (class General_options): Add --add-needed and
9185         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9186         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9187         error if --copy-dt-needed-entries aka --add-needed is used and
9188         would cause a change in behaviour.
9189
9190         PR 10980
9191         * options.h (class General_options): Add -G as a short version of
9192         --shared.  Add no-op options -assert, -g, and -i.
9193
9194 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9195
9196         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9197         check for .text or .gnu.linkonce.t sections.
9198         * icf.cc (Icf::find_identical_sections): Ditto.
9199         Change the detection for mangled function name within the section
9200         name.
9201         * icf.h (is_section_foldable_candidate): New function.
9202
9203 2009-12-30  Ian Lance Taylor  <iant@google.com>
9204
9205         PR 10980
9206         * options.h (class General_options): Permit two dashes with
9207         --retain-symbols-file.
9208
9209 2009-12-30  Ian Lance Taylor  <iant@google.com>
9210
9211         PR 10979
9212         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9213         don't put the file header and segment headers in the text
9214         segment.
9215
9216         PR 10979
9217         * common.cc (Sort_commons::operator()): Stabilize sort when both
9218         entries are NULL.
9219         (Symbol_table::do_allocate_commons_list): When allocating common
9220         symbols, skip a symbol which is no longer common.
9221         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9222         an object before checking its type.
9223         * testsuite/common_test_2.c: New file.
9224         * testsuite/common_test_3.c: New file.
9225         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9226         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9227         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9228         (common_test_2_pic.o, common_test_2.so): New targets.
9229         (common_test_3_pic.o, common_test_3.so): New targets.
9230         * testsuite/Makefile.in: Rebuild.
9231
9232         PR 10979
9233         * script.cc (read_input_script): If we see a new SECTIONS clause,
9234         and we have added an input section, give an error.
9235         * layout.h (class Layout): Add have_added_input_section function.
9236         Add have_added_input_section_ field.
9237         * layout.cc (Layout::Layout): Initialize
9238         have_added_input_section_.
9239         (Layout::layout): Set have_added_input_section_.
9240         (Layout::layout_eh_frame): Likewise.
9241
9242 2009-12-30  Ian Lance Taylor  <iant@google.com>
9243
9244         PR 10931
9245         * options.h (class General_options): Add --sort-common option.
9246         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9247         * common.cc (Sort_common): Add sort_order parameter to
9248         constructor.  Add sort_order_ field.
9249         (Sort_commons::operator): Check sort_order_.
9250         (Symbol_table::allocate_commons): Determine the sort order.
9251         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9252         Change all callers.
9253         (Symbol_table::do_allocate_commons_list): Likewise.
9254
9255 2009-12-30  Ian Lance Taylor  <iant@google.com>
9256
9257         PR 10916
9258         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9259         symbols from this object, don't change the visibility of an
9260         undefined symbol.
9261         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9262
9263 2009-12-30  Ian Lance Taylor  <iant@google.com>
9264
9265         PR 10861
9266         * script.h (class Version_script_info): Define Language enum.
9267         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9268         new fields globals_, locals_, and is_finalized_.
9269         * script.cc: Various formatting fixes.
9270         (class Parser_closure): Change language_stack_ from a vector of
9271         std::string to one of Version_script_info::Language.  Adjust all
9272         uses accordingly.
9273         (class Lazy_demangler): Remove.
9274         (struct Version_expression): Change language from std::string to
9275         Version_script_info::Language.
9276         (Version_script_info::Version_script_info): New function.
9277         (Version_script_info::~Version_script_info): Don't call clear.
9278         (Version_script_info::finalize): New function.
9279         (Version_script_info::build_lookup_tables): New function.
9280         (Version_script_info::build_expression_list_lookup): New
9281         function.
9282         (Version_script_info::get_symbol_version_helper): Rewrite to use
9283         lookup tables.
9284         (Version_script_info::print_expression_list): Adjust to use
9285         Version_script_info::Language.
9286         (script_push_lex_into_version_mode): Check that the version script
9287         has not been finalized.
9288         (version_script_push_lang): Change language string to
9289         Version_script_info::Language.
9290         * options.cc (Command_line::version_script): New function.
9291         * options.h (class General_options): Add finalize_dynamic_list
9292         function.  Change version_script from declaration to definition.
9293         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9294         * testsuite/version_script.map: Remove duplicate def of foo.
9295         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9296         version_script.map.
9297         * testsuite/Makefile.in: Rebuild.
9298
9299 2009-12-30  Ian Lance Taylor  <iant@google.com>
9300
9301         PR 10843
9302         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9303         if the input symbol index is 0, make the output symbol index 0.
9304
9305 2009-12-30  Ian Lance Taylor  <iant@google.com>
9306
9307         PR 10670
9308         * options.h (class General_options): Add -x/--discard-all.
9309         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9310         --discard-all.  If the local symbol needs a dynamic entry, check
9311         that before handling --discard-locals.
9312
9313 2009-12-30  Ian Lance Taylor  <iant@google.com>
9314
9315         PR 10450
9316         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9317         flags to PF_R.
9318         (Output_segment::add_output_section): Don't change the flags if
9319         the type is PT_TLS.
9320
9321         PR 10450
9322         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9323         GNU hash table if they need a dynamic value.  Otherwise, don't add
9324         them if they are defined in a dynamic object or are forced local.
9325
9326 2009-12-29  Ian Lance Taylor  <iant@google.com>
9327
9328         PR 10450
9329         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9330         .gnu.hash table for a 32-bit target.
9331
9332         PR 10450
9333         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9334         regular and a dynamic object only needs a dynamic symbol table
9335         entry if it is externally visible.
9336
9337         PR 10450
9338         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9339         constructor.  Add global_offset_table_ field.
9340         (Target_i386::got_section): Set global_offset_table_.
9341         (Target_i386::do_finalize_sections): Set global_offset_table_
9342         size.
9343         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9344         in constructor.  Add global_offset_table_ field.
9345         (Target_x86_64::got_section): Set global_offset_table_.
9346         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9347         size.
9348
9349         * layout.cc (Layout::Layout): Initialize increase_relro_.
9350         (Layout::get_output_section): Add is_relro, is_last_relro, and
9351         is_first_non_relro parameters.  Change all callers.
9352         (Layout::choose_output_section): Likewise.
9353         (Layout::add_output_section_data): Likewise.
9354         (Layout::make_output_section): Likewise.
9355         (Layout::set_segment_offsets): Clear increase_relro when using a
9356         linker script.
9357         * layout.h (class Layout): Add increase_relro method.  Add
9358         increase_relro_ field.  Update declarations.
9359         * output.cc (Output_section::Output_section): Initialize
9360         is_last_relro_ and is_first_non_relro_.
9361         (Output_segment::add_output_section): Group relro sections is
9362         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9363         (Output_segment::maximum_alignment): Remove relro handling.
9364         (Output_segment::set_section_addresses): Add increase_relro
9365         parameter.  Change all callers.  Add initial alignment to align
9366         relro sections on separate page.  Remove old relro handling.
9367         (Output_segment::set_section_list_addresses): Remove in_relro
9368         parameter.  Change all callers.
9369         (Output_segment::set_offset): Add increase parameter.  Change all
9370         callers.  Remove old relro handling.
9371         * output.h (class Output_section): Add new methods: is_last_relro,
9372         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9373         Add is_last_relro_ and is_first_non_relro_ fields.
9374         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9375         Create separate .got.plt section.  Call increase_relro.
9376         * x86_64.cc (Target_x86_64::got_section): Likewise.
9377         * testsuite/relro_script_test.t: Add .got.plt.
9378
9379         PR 10450
9380         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9381         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9382         (Layout::finalize): Call set_dynamic_symbol_size.
9383         (Layout::set_dynamic_symbol_size): New function.
9384         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9385         set_dynamic_symbol_size.
9386
9387         PR 10450
9388         * output.h (class Output_section): Add is_entsize_zero_ field.
9389         * output.cc (Output_section::Output_section): Initialize
9390         is_entsize_zero_.
9391         (Output_section::set_entsize): If two different entsizes are
9392         requested, force it to zero.
9393         (Output_section::add_input_section): Set flags for .debug_str
9394         before updating section flags.  Set entsize.
9395         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9396         and SHF_STRING if all input sections have those flags.
9397
9398 2009-12-29   Rafael Espindola  <espindola@google.com>
9399
9400         * main.cc (main): Fix the sys time reporting.
9401         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9402         reporting.
9403
9404 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9405
9406         * options.cc (General_options::parse_version): Allow -v to exit
9407         without an error if there is nothing to link.
9408
9409 2009-12-29  Ian Lance Taylor  <iant@google.com>
9410
9411         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9412         using a version of gcc before 4.1.
9413         * configure: Rebuild.
9414
9415 2009-12-28  Chris Demetriou  <cgd@google.com>
9416
9417         * attributes.cc (Output_attributes_section_data::do_write): Use
9418         std::vector::front rather than std::vector::data.
9419
9420 2009-12-28  Ian Lance Taylor  <iant@google.com>
9421
9422         * symtab.h (class Symbol_table): Add enum Defined.
9423         * resolve.cc (Symbol_table::should_override): Add defined
9424         parameter.  Change all callers.  Test whether object is NULL
9425         before calling a method on it.
9426         (Symbol_table::report_resolve_problem): Add defined parameter.
9427         Change all callers.
9428         (Symbol_table::should_override_with_special): Likewise.
9429         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9430         parameter.  Change all callers.
9431         (Symbol_table::do_define_in_output_data): Likewise.
9432         (Symbol_table::define_in_output_segment): Likewise.
9433         (Symbol_table::do_define_in_output_segment): Likewise.
9434         (Symbol_table::define_as_constant): Likewise.
9435         (Symbol_table::do_define_as_constant): Likewise.
9436         * script.h (class Symbol_assignment): Add is_defsym parameter to
9437         constructor; change all callers.
9438         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9439         parameter.  Change all callers.  Add is_defsym_ field.
9440         (class Parser_closure): Add parsing_defsym parameter to
9441         constructor; change all callers.  Add parsing_defsym accessor
9442         function.  Add parsing_defsym_ field.
9443
9444 2009-12-28  Ian Lance Taylor  <iant@google.com>
9445
9446         * gold.cc (queue_middle_tasks): Fix formatting.
9447         * object.cc (Relobj::is_section_name_included): Likewise.
9448
9449 2009-12-23  Ian Lance Taylor  <iant@google.com>
9450
9451         * i386.cc (Target_i386::do_calls_non_split): Recognize
9452         -fsplit-stack prologue for a function with a static chain.
9453         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9454         -fsplit-stack prologue when using %r11.
9455
9456 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9457
9458         * options.cc (General_options::parse_version): Make -v continue and do
9459         the link like GNU ld does.
9460
9461 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9462
9463         * Makefile.am (CCFILES): Add timer.cc.
9464         (HFILES): Add timer.h.
9465         * configure.ac: Check for sysconf and times.
9466         * main.cc: include timer.h.
9467         (main): Use Timer instead of get_run_time.
9468         * timer.cc: New.
9469         * timer.h: New.
9470         * workqueue.cc: include timer.h.
9471         (Workqueue::find_and_run_task):
9472         Report user, sys and wall time.
9473         * Makefile.in: Regenerate.
9474         * config.in: Regenerate.
9475         * configure: Regenerate.
9476
9477 2009-12-16  Doug Kwan  <dougkwan@google.com>
9478
9479         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9480         sections.
9481         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9482         relaxed input sections.
9483         * output.cc (Output_section::find_relaxed_input_section): Change
9484         return type to Output_relaxed_input_section pointer.  Adjust code
9485         for new type of relaxed_input_section_map_.
9486         * output.h (Output_section::find_relaxed_input_section): Change
9487         return type to Output_relaxed_input_section pointer.
9488         (Output_section::Output_relaxed_input_section_by_input_section_map):
9489         New type.
9490         (Output_section::relaxed_input_section_map_): Change type to
9491         Output_section::Output_relaxed_input_section_by_input_section_map.
9492         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9493         input section.
9494
9495 2009-12-15  Ian Lance Taylor  <iant@google.com>
9496
9497         * layout.cc (Layout::create_shstrtab): Only write out after input
9498         sections if we are compressing debug sections.
9499
9500 2009-12-15  Ian Lance Taylor  <iant@google.com>
9501
9502         * archive.cc (Archive::add_symbols): Only look up a symbol without
9503         a version if there is, in fact, a version.
9504
9505 2009-12-14  Ian Lance Taylor  <iant@google.com>
9506
9507         Revert -Wshadow changes, all changes from:
9508         2009-12-11  Doug Kwan  <dougkwan@google.com>
9509         2009-12-11  Nick Clifton  <nickc@redhat.com>
9510         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9511
9512 2009-12-11  Doug Kwan  <dougkwan@google.com>
9513
9514         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9515         due to -Wshadow.
9516         * attributes.cc (Object_attribute::size): Ditto.
9517         (Attributes_section_data::size): Ditto.
9518         (Attributes_section_data::Attributes_section_data): Ditto.
9519         (Output_attributes_section_data::do_write): Ditto.
9520         * attributes.h (Object_attribute::set_type): Ditto.
9521         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9522
9523 2009-12-11  Nick Clifton  <nickc@redhat.com>
9524
9525         * archive.cc: Fix shadowed variable warnings.
9526         * arm.cc: Likewise.
9527         * compressed_output.cc: Likewise.
9528         * compressed_output.h: Likewise.
9529         * configure: Likewise.
9530         * dwarf_reader.cc: Likewise.
9531         * dynobj.cc: Likewise.
9532         * dynobj.h: Likewise.
9533         * ehframe.cc: Likewise.
9534         * ehframe.h: Likewise.
9535         * errors.cc: Likewise.
9536         * expression.cc: Likewise.
9537         * fileread.cc: Likewise.
9538         * fileread.h: Likewise.
9539         * freebsd.h: Likewise.
9540         * i386.cc: Likewise.
9541         * icf.cc: Likewise.
9542         * incremental.h: Likewise.
9543         * layout.cc: Likewise.
9544         * layout.h: Likewise.
9545         * mapfile.cc: Likewise.
9546         * merge.cc: Likewise.
9547         * merge.h: Likewise.
9548         * object.cc: Likewise.
9549         * object.h: Likewise.
9550         * options.h: Likewise.
9551         * output.cc: Likewise.
9552         * output.h: Likewise.
9553         * parameters.cc: Likewise.
9554         * plugin.cc: Likewise.
9555         * powerpc.cc: Likewise.
9556         * reduced_debug_output.cc: Likewise.
9557         * reduced_debug_output.h: Likewise.
9558         * reloc.cc: Likewise.
9559         * reloc.h: Likewise.
9560         * resolve.cc: Likewise.
9561         * script-sections.cc: Likewise.
9562         * script.cc: Likewise.
9563         * script.h: Likewise.
9564         * sparc.cc: Likewise.
9565         * symtab.cc: Likewise.
9566         * symtab.h: Likewise.
9567         * target-select.cc: Likewise.
9568         * target-select.h: Likewise.
9569         * token.h: Likewise.
9570         * workqueue.cc: Likewise.
9571         * workqueue.h: Likewise.
9572         * x86_64.cc: Likewise.
9573
9574 2009-12-10  Doug Kwan  <dougkwan@google.com>
9575
9576         * arm.cc (attributes.h): New include.
9577         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9578         (Arm_relobj::~Arm_relobj): Delete object pointed by
9579         attributes_section_data_.
9580         (Arm_relobj::attributes_section_data): New method definition.
9581         (Arm_relobj::attributes_section_data_): New data member declaration.
9582         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9583         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9584         attributes_section_data_.
9585         (Arm_dynobj::attributes_section_data): New method definition.
9586         (Arm_dynobj::attributes_section_data_): New data member declaration.
9587         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9588         initialization value of may_use_blx_ to false.
9589         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9590         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9591         object attributes to compute results instead of hard-coding.
9592         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9593         Target_arm::get_secondary_compatible_arch,
9594         Target_arm::set_secondary_compatible_arch
9595         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9596         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9597         New method declarations.
9598         (Target_arm::get_aeabi_object_attribute): New method definition.
9599         (Target_arm::attributes_section_data_): New data member declaration.
9600         (read_arm_attributes_section): New template definition.
9601         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9602         (Arm_dynobj::do_read_symbols): Ditto.
9603         (Target_arm::do_finalize_sections): Merge attributes sections from
9604         input.  Check for BLX use after attributes section merging.
9605         Fix __exidx_start and __exidx_end visibility.  Create an
9606         .ARM.attributes section if necessary.
9607         (Target_arm::get_secondary_compatible_arch,
9608         Target_arm::set_secondary_compatible_arch,
9609         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9610         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9611         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9612         New method definitions.
9613
9614 2009-12-09  Ian Lance Taylor  <iant@google.com>
9615
9616         * plugin.cc (Plugin::load): Don't cast from void* to a function
9617         pointer.
9618
9619 2009-12-09  Ian Lance Taylor  <iant@google.com>
9620
9621         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9622         information fields.
9623
9624 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9625
9626         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9627         Replace two_file_shared_1.so with two_file_shared_2.so.
9628         * testsuite/Makefile.in: Regenerated.
9629
9630 2009-12-08  Doug Kwan  <dougkwan@google.com>
9631
9632         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9633         (HFILES): Add attributes.h and int_encoding.h.
9634         * Makefile.in: Regenerate.
9635         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9636         function definitions to int_encoding.cc
9637         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9638         prototypes to int_encoding.h
9639         * reduced_debug_output.cc (int_encoding.h): New include.
9640         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9641         function definitions to int_encoding.cc
9642         (insert_into_vector, read_from_pointer): Move template definitions to
9643         int_encoding.h
9644         * attributes.cc: New file.
9645         * attributes.h: New file.
9646         * int_encoding.cc: New file.
9647         * int_encoding.h: New file.
9648
9649 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9650
9651         PR gold/11055
9652         * incremental-dump.cc (dump_incremental_inputs): New.
9653         (main): Use dump_incremental_inputs.
9654
9655 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9656
9657         PR gold/10893
9658         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9659         checking elfcpp::STT_FUNC.
9660         (Target_i386::Relocate::relocate): Likewise.
9661         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9662
9663         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9664         symbols from shared libraries into normal FUNC symbols.
9665
9666         * symtab.h (Symbol): Add is_func and use it.
9667
9668 2009-12-05  Doug Kwan  <dougkwan@google.com>
9669
9670         * arm.cc (Target_arm::arm_info): Initialize new fields
9671         attributes_section and attributes_vendor.
9672         * i386.cc (Target_i386::i386_info): Same.
9673         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9674         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9675         fields attributes_section and attributes_vendor.
9676         * sparc.cc (Target_sparc::sparc_info): Same.
9677         * target.h (Target::attributes_section, Target::attributes_vendor,
9678         Target::is_attributes_section, Target::attribute_arg_type,
9679         Target::attributes_order): New method definitions.
9680         (Target::Target_info::attributes_section,
9681         Target::Target_info::attributes_vendor): New fields.
9682         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9683         virtual method definitions.
9684         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9685         attributes_section and attributes_vendor.
9686         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9687
9688 2009-12-05  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc: Update comments about interworking and stub generation.
9691         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9692         considered as non-PIC.
9693         (Arm_relocate_functions::base_abs): Fix formatting.
9694         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9695         of function to use GOT entry address instead of offset.
9696         (Target_arm::Scan::global): Issue an error if a symbol would need a
9697         PLT does not get one because it is untyped.  Remove code to create
9698         dynamic symbols for relative branches.
9699         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9700         takes unsigned integer instead of boolean.
9701
9702 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9703
9704         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9705         (two_file_test_LDADD): Likewise.
9706         (common_test_1_LDADD): Likewise.
9707         (exception_test_LDADD) Likewise.
9708         (weak_test_LDADD): Likewise.
9709         (many_sections_test_LDADD): Likewise.
9710         (initpri1_LDADD): Likewise.
9711         (script_test_1_LDADD): Likewise.
9712         (script_test_2_LDADD): Likewise.
9713         (justsyms_LDADD): Likewise.
9714         (binary_test_LDADD): Likewise.
9715         (large_LDADD): Likewise.
9716         * testsuite/Makefile.in: Regenerated.
9717
9718 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9719
9720         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9721         (Symbol_table::override_with_special): Likewise.
9722         (Symbol_table::add_from_object): Likewise.
9723
9724 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9725
9726         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9727         Don't set the data_offset twice.
9728
9729 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9730
9731         * testsuite/Makefile.in: Regenerate.
9732
9733 2009-12-03  Doug Kwan  <dougkwan@google.com>
9734
9735         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9736         (Target_arm::do_finalize_sections): Add parameter for symbol table
9737         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9738         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9739         parameter for symbol table pointer.
9740         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9741         an additional parameter for a pointer to symbol table.
9742         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9743         parameter for a symbol table pointer.
9744         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9745         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9746         Ditto.
9747         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9748         parameter for a symbol table pointer.
9749
9750 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9751
9752         * incremental.cc (Incremental_inputs_header)
9753         (Incremental_inputs_header_write, Incremental_inputs_entry)
9754         (Incremental_inputs_entry_write): Move ...
9755         * incremental.h (Incremental_inputs_header)
9756         (Incremental_inputs_header_write, Incremental_inputs_entry)
9757         (Incremental_inputs_entry_write): here.
9758
9759 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9760
9761         * incremental.cc (make_sized_incremental_binary): Set the target.
9762         Error if it is incompatible.
9763         * output.h (Output_file): Add filename method.
9764
9765 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9766
9767         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9768         from the get_* methods.
9769
9770 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9771
9772         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9773         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9774         Write 0 for the data_offset of scripts.
9775
9776 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9777
9778         * testsuite/Makefile.am: Add the incremental_test.sh test.
9779         * testsuite/incremental_test.sh: New.
9780         * testsuite/incremental_test_1.c: New.
9781         * testsuite/incremental_test_2.c: New.
9782
9783 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9784
9785         * incremental-dump.cc (main): Fix typos.
9786
9787 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9788
9789         PR gold/11025
9790         * incremental-dump.cc (main): Use llu to print 64 bit values.
9791
9792 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9793             H.J. Lu  <hongjiu.lu@intel.com>
9794
9795         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9796         $(LIBDL).
9797         (incremental_dump_LDADD): Likewise.
9798         * Makefile.in: Regenerated.
9799
9800 2009-11-25  Doug Kwan  <dougkwan@google.com>
9801
9802         Revert:
9803
9804         2009-11-25  Doug Kwan  <dougkwan@google.com>
9805
9806                 * arm.cc (Target_arm::Target_arm): Move method definition
9807                 outside of class definition.  Add code to handle
9808                 --target1-rel, --target1-abs and --target2= options.
9809                 (Target_arm::get_reloc_reloc_type): Change method to be
9810                 non-static and const.
9811                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9812                 New data member declaration.
9813                 (Target_arm::Scan::local, Target_arm::Scan::global,
9814                 Target_arm::Relocate::relocate,
9815                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9816                 Adjust call to Target_arm::get_real_reloc_type.
9817                 (Target_arm::get_real_reloc_type): Use command line options
9818                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9819                 * options.h (--target1-rel, --target1-abs, --target2): New
9820                 ARM-only options.
9821
9822 2009-11-25  Doug Kwan  <dougkwan@google.com>
9823
9824         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9825         class definition.  Add code to handle --target1-rel, --target1-abs
9826         and --target2= options.
9827         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9828         and const.
9829         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9830         member declaration.
9831         (Target_arm::Scan::local, Target_arm::Scan::global,
9832         Target_arm::Relocate::relocate,
9833         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9834         call to Target_arm::get_real_reloc_type.
9835         (Target_arm::get_real_reloc_type): Use command line options to
9836         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9837         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9838         options.
9839
9840 2009-11-25  Doug Kwan  <dougkwan@google.com>
9841
9842         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9843         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9844         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9845         formatting.
9846         (Arm_relocate_functions::thm_call): Replace body with a call to
9847         Arm_relocate_functions::thumb_branch_common.
9848         (Arm_relocate_functions::thm_jump24,
9849         Arm_relocate_functions::thm_xpc22): New method definitions.
9850         (Arm_relocate_functions::thumb_branch_common): New method definition.
9851         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9852         operator.
9853         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9854         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9855
9856 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9857
9858         * Makefile.am: Build incremental-dump
9859         * Makefile.in: Regenerate.
9860         * incremental-dump.cc: New.
9861         * incremental.cc (Incremental_inputs_header_data,
9862         Incremental_inputs_entry_data): Move to incremental.h
9863         * incremental.h: (Incremental_inputs_header_data,
9864         Incremental_inputs_entry_data): Move from incremental.cc
9865
9866 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9867
9868         * incremental.cc (Incremental_inputs_header,
9869         Incremental_inputs_header_write, Incremental_inputs_entry,
9870         Incremental_inputs_entry_write): Add a typedef with the data type.
9871
9872 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9873
9874         * incremental.cc (Incremental_inputs_header,
9875         Incremental_inputs_header_write, Incremental_inputs_entry,
9876         Incremental_inputs_entry_write): Update comment about which
9877         type has the filed descriptions.
9878
9879 2009-11-15  Doug Kwan  <dougkwan@google.com>
9880
9881         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9882         (Arm_relocate_functions::arm_branch_common): Change method defintion
9883         in class definition to a method declaration and update list of formal
9884         parameters.
9885         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9886         Arm_relocation_functions::jump24): Adjust call to
9887         Arm_relocate_functions::arm_branch_common.  Update list of formal
9888         parameters.
9889         (Arm_relocate_functions::xpc25): New method definition.
9890         (Arm_relocate_functions::arm_branch_common): Move method defintion
9891         out from class definition.  Use stubs for mode-switching and extending
9892         branch ranges.
9893         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9894         specially.  Change code to enable use of stubs in ARM branches.
9895
9896 2009-11-10  Doug Kwan  <dougkwan@google.com>
9897
9898         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9899         in method declaration.
9900         (Target_arm::relocate_stub): New method declaration.
9901         (Target_arm::default_target): Change to return a pointer instead of
9902         a const reference.
9903         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9904         Target_arm::default_target.
9905         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9906         method definition.
9907         (Target_arm::relocate_section): Adjust view.
9908         (Target_arm::relocate_stub): New method definition.
9909
9910 2009-11-10  Doug Kwan  <dougkwan@google.com>
9911
9912         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9913         a format warning.
9914         * incremental.cc (open_incremental_binary): Initialized local
9915         variables to avoid warnings.
9916         * object.cc (make_elf_object): Ditto.
9917         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9918         a format warning.
9919
9920 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9921
9922         PR gold/10930
9923         * testsuite/plugin_test.c: Include "config.h".
9924
9925 2009-11-09  Doug Kwan  <dougkwan@google.com>
9926
9927         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9928         (arm_symbol_value): Remove.
9929         (Arm_relocate_functions::arm_branch_common,
9930         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9931         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9932         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9933         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9934         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9935         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9936         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9937         Arm_relocate_functions::thm_mobw_abs_nc,
9938         Arm_relocate_functions::thm_mov_abs,
9939         Arm_relocate_functions::movw_prel_nc,
9940         Arm_relocate_functions::thm_movt_abs,
9941         Arm_relocate_functions::movt_prel,
9942         Arm_relocate_functions::thm_movw_prel_nc,
9943         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9944         (Target_arm::Relocate::relocate): Only decompose address into two
9945         parts if relocation type uses the thumb-bit and pass the actual
9946         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9947         calls to methods in Arm_relocate_functions for this change.
9948
9949 2009-11-08  Ian Lance Taylor  <iant@google.com>
9950
9951         PR 10925
9952         * reloc.cc: Instantiate
9953         Sized_relobj::initialize_input_to_output_maps and
9954         Sized_relobj:free_input_to_output_maps.
9955
9956 2009-11-06  Ian Lance Taylor  <iant@google.com>
9957
9958         PR 10876
9959         * defstd.cc (in_segment): Set only_if_ref true for "end".
9960
9961 2009-11-06  Doug Kwan  <dougkwan@google.com>
9962
9963         * arm.cc (class Reloc_stub): Correct a comment.
9964         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9965         (Target_arm::scan_section_for_stubs): New method declaration.
9966         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9967         Change methods from private to protected.
9968         (Target_arm::do_may_relax): New method definition.
9969         (Target_arm::do_relax, Target_arm::group_sections,
9970         Target_arm::scan_reloc_for_stub,
9971         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9972         (Target_arm::arm_input_section_map_): New data member declaration.
9973         (Target_arm::scan_reloc_for_stub,
9974         Target_arm::scan_reloc_section_for_stubs,
9975         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9976         Target_arm::do_relax): New method definitions.
9977
9978 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9979
9980         * configure.ac: Check for (struct stat)::st_mtim
9981         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9982         * config.in: Regenerate.
9983         * configure: Regenerate.
9984
9985 2009-11-05  Ian Lance Taylor  <iant@google.com>
9986
9987         PR 10910
9988         * output.cc (Output_segment::add_output_section): Add missing
9989         return statement.
9990
9991 2009-11-04  Ian Lance Taylor  <iant@google.com>
9992
9993         PR 10880
9994         * object.h (class Object): Add is_needed and set_is_needed
9995         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9996         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9997         defined in a dynamic object and referenced by a regular object,
9998         set is_needed for the dynamic object.
9999         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10000         if the file is marked with as_needed and it is not needed.
10001
10002 2009-11-04  Ian Lance Taylor  <iant@google.com>
10003
10004         PR 10887
10005         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10006         tags if data is discarded by linker script.
10007         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10008         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10009         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10010         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10011
10012 2009-11-04  Ian Lance Taylor  <iant@google.com>
10013
10014         * layout.cc (Layout::get_output_section): Add is_interp and
10015         is_dynamic_linker_section parameters.  Change all callers.
10016         (Layout::choose_output_section): Likewise.
10017         (Layout::make_output_section): Likewise.
10018         (Layout::add_output_section_data): Add is_dynamic_linker_section
10019         parameter.  Change all callers.
10020         * layout.h (class Layout): Update declarations.
10021         * output.h (class Output_section): Add is_interp, set_is_interp,
10022         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10023         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10024         generate_code_fills_at_write_ to a bitfield.
10025         * output.cc (Output_section::Output_sections): Initialize new
10026         fields.
10027         (Output_segment::add_output_section): Add do_sort parameter.
10028         Change all callers.
10029
10030 2009-11-03  Ian Lance Taylor  <iant@google.com>
10031
10032         PR 10860
10033         * options.h (class General_options): Add --warn-common.
10034         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10035         merging two common symbols.
10036         (Symbol_table::should_override): Handle --warn-common when merging
10037         a common symbol with a defined symbol.  Use report_resolve_problem
10038         for multiple definitions.
10039         (Symbol_table::report_resolve_problem): New function.
10040         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10041
10042 2009-11-03  Doug Kwan  <dougkwan@google.com>
10043
10044         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10045         stub_factory_.
10046         (Target_arm::stub_factory): New method definition.
10047         (Target_arm::new_arm_input_section,
10048         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10049         Target_arm::reloc_uses_thumb_bit): New method declarations.
10050         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10051         New type definitions.
10052         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10053         member declarations.
10054         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10055         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10056         New method definitions.
10057
10058 2009-11-03  Ian Lance Taylor  <iant@google.com>
10059
10060         * options.h (class General_options): Add --warn_constructors.
10061
10062 2009-11-03  Ian Lance Taylor  <iant@google.com>
10063
10064         PR 10893
10065         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10066         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10067
10068 2009-11-03  Ian Lance Taylor  <iant@google.com>
10069
10070         PR 10895
10071         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10072         --msgid-bugs-address.
10073         (install-pdf): New target.
10074         (install-data_yes): Look up one directory to find mkinstalldirs.
10075
10076 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10077
10078         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10079         tree.
10080
10081 2009-10-30  Doug Kwan  <dougkwan@google.com>
10082
10083         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10084
10085 2009-10-30  Doug Kwan  <dougkwan@google.com>
10086
10087         * arm.cc (Stub_addend_reader): New struct template definition
10088         and partial specializations.
10089         (Stub_addend_reader::operator()): New method definition for a
10090         partially specialized template.
10091
10092 2009-10-30  Doug Kwan  <dougkwan@google.com>
10093
10094         * arm.cc (Arm_relobj::processor_specific_flags): New method
10095         definition.
10096         (Arm_relobj::do_read_symbols): New method declaration.
10097         (Arm_relobj::processor_specific_flags_): New data member declaration.
10098         (Arm_dynobj): New class definition.
10099         (Target_arm::do_finalize_sections): Add input_objects parameter.
10100         (Target_arm::do_adjust_elf_header): New method declaration.
10101         (Target_arm::are_eabi_versions_compatible,
10102         (Target_arm::merge_processor_specific_flags): New method declaration.
10103         (Target_arm::do_make_elf_object): New overloaded method definitions
10104         and declaration.
10105         (Arm_relobj::do_read_symbols): New method definition.
10106         (Arm_dynobj::do_read_symbols): Ditto.
10107         (Target_arm::do_finalize_sections): Add input_objects parameters.
10108         Merge processor-specific flags from all input objects.
10109         (Target_arm::are_eabi_versions_compatible,
10110         Target_arm::merge_processor_specific_flags,
10111         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10112         New method definitions.
10113         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10114         Input_objects pointer type parameter.
10115         * layout.cc (Layout::finalize): Pass input objects to target's.
10116         finalize_sections function.
10117         * output.cc (Output_file_header::do_sized_write): Set ELF file
10118         header's processor-specific flags.
10119         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10120         Input_objects pointer type parameter.
10121         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10122         * target.h (Input_objects): New forward class declaration.
10123         (Target::processor_specific_flags,
10124         Target::are_processor_specific_flags_sect): New method definitions.
10125         (Target::finalize_sections): Add input_objects parameter.
10126         (Target::Target): Initialize processor_specific_flags_ and
10127         are_processor_specific_flags_set_.
10128         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10129         parameter.
10130         (Target::set_processor_specific_flags): New method definition.
10131         (Target::processor_specific_flags_,
10132         Target::are_processor_specific_flags_set_): New data member
10133         declarations.
10134         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10135         Input_objects pointer type parameter.
10136
10137 2009-10-30  Doug Kwan  <dougkwan@google.com>
10138
10139         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10140
10141 2009-10-28  Ian Lance Taylor  <iant@google.com>
10142
10143         * object.h (class Relobj): Drop options parameter from
10144         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10145         do_scan_relocs, do_relocate.  Change all callers.
10146         (class Sized_relobj): Drop options parameters from
10147         do_gc_process_relocs, do_scan_relocs, do_relocate,
10148         do_relocate_sections, relocate_sections, emit_relocs_scan,
10149         emit_relocs_scan_reltype.  Change all callers.
10150         (struct Relocate_info): Remove options field and all references to
10151         it.
10152         * reloc.h (class Read_relocs): Remove options constructor
10153         parameter and options_ field.  Change all callers.
10154         (class Gc_process_relocs, class Scan_relocs): Likewise.
10155         (class Relocate_task): Likewise.
10156         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10157         all callers.
10158         (scan_relocatable_relocs): Likewise.
10159         * target.h (class Sized_target): Remove options parameter from
10160         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10161         all callers.
10162         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10163         callers.
10164         * arm.cc: Update functions to remove options parameters.
10165         * i386.cc: Likewise.
10166         * powerpc.cc: Likewise.
10167         * sparc.cc: Likewise.
10168         * x86_64.cc: Likewise.
10169         * testsuite/testfile.cc: Likewise.
10170
10171 2009-10-28  Doug Kwan  <dougkwan@google.com>
10172
10173         * arm.cc (Arm_relobj): New class definition.
10174         (Arm_relobj::scan_sections_for_stubs,
10175         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10176         New method definitions.
10177
10178 2009-10-28  Cary Coutant  <ccoutant@google.com>
10179
10180         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10181         (Plugin::cleanup_done_): New member.
10182         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10183         (Plugin_manager::cleanup_done_): Remove.
10184         (Plugin_manager::add_input_file): Edit error message.
10185         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10186         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10187
10188 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10189
10190         * fileread.cc: (File_read::View::~View): Use the new
10191         data_ownership_ filed.
10192         (File_read::~File_read): Dispose the new whole_file_view_.
10193         (File_read::open): Mmap the whole file if needed.
10194         (File_read::open): Use whole_file_view_ instead of contents_.
10195         (File_read::find_view): Use whole_file_view_ if applicable.
10196         (File_read::do_read): Use whole_file_view_ instead of contents_.
10197         (File_read::make_view): Use whole_file_view_ instead of contents_,
10198         update File_read::View::View call.
10199         (File_read::find_or_make_view): Update File_read::View::View
10200         call.
10201         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10202         remove contents_
10203         (File_read::View::Data_ownership): New enum.
10204         (File_read::View::View): Replace bool mapped_ with Data_ownership
10205         argument.
10206         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10207         (File_read::View::data_ownership_): New field.
10208         (File_read::contents_): Remove (replaced by whole_file_view_).
10209         (File_read::whole_file_view_): New field.
10210         * options.h (class General_options): Add --keep-files-mapped.
10211
10212 2009-10-27  Cary Coutant  <ccoutant@google.com>
10213
10214         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10215         * testsuite/Makefile.am (plugin_test_5): New test case.
10216         * testsuite/Makefile.in: Regenerate.
10217
10218 2009-10-25  Doug Kwan  <dougkwan@google.com>
10219
10220         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10221         from private to protected to allow access by child class.
10222         (Sized_relobj::do_relocate_sections): New method declaration.
10223         (Sized_relobj::relocate_sections): Virtualize.
10224         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10225         Sized_relobj::relocate_sections.  Instantiate template explicitly
10226         for different target sizes and endianity.
10227
10228 2009-10-24  Doug Kwan  <dougkwan@google.com>
10229
10230         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10231         (Arm_input_section::as_arm_input_section): New method.
10232         (Arm_output_section): New class definition.
10233         (Arm_output_section::create_stub_group,
10234         Arm_output_section::group_sections): New method definitions.
10235
10236 2009-10-22  Doug Kwan  <dougkwan@google.com>
10237
10238         * arm.cc (Arm_input_section): New class definition.
10239         (Arm_input_section::init, Arm_input_section:do_write,
10240         Arm_input_section::set_final_data_size,
10241         Arm_input_section::do_reset_address_and_file_offset): New method
10242         definitions.
10243
10244 2009-10-21  Doug Kwan  <dougkwan@google.com>
10245
10246         * arm.cc (Stub_table, Arm_input_section): New forward class
10247         declarations.
10248         (Stub_table): New class defintion.
10249         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10250         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10251         New method definition.
10252
10253 2009-10-21  Doug Kwan  <dougkwan@google.com>
10254
10255         * arm.cc: Update copyright comments.
10256         (Target_arm): New forward class template declaration.
10257         (Arm_address): New type.
10258         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10259         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10260         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10261         constants.
10262         (Insn_template): Same.
10263         (DEF_STUBS): New macro.
10264         (Stub_type): New enum type.
10265         (Stub_template): New class definition.
10266         (Stub): Same.
10267         (Reloc_stub): Same.
10268         (Stub_factory): Same.
10269         (Target_arm::Target_arm): Initialize may_use_blx_ and
10270         should_force_pic_veneer_.
10271         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10272         Target_arm::should_force_pic_veneer,
10273         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10274         Target_arm::using_thumb_only, Target_arm:;default_target): New
10275         method defintions.
10276         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10277         New data member declarations.
10278         (Insn_template::size, Insn_template::alignment): New method defintions.
10279         (Stub_template::Stub_template): New method definition.
10280         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10281         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10282         (Stub_factory::Stub_factory): New method definition.
10283         * gold.h (string_hash): New template.
10284         * output.h (Input_section_specifier::hash_value): Use
10285         gold::string_hash.
10286         (Input_section_specifier::string_hash): Remove.
10287         * stringpool.cc (Stringpool_template::string_hash): Use
10288         gold::string_hash.
10289
10290 2009-10-20  Doug Kwan  <dougkwan@google.com>
10291
10292         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10293         symbols of relaxed input sections.
10294         * output.h (Output_section::find_relaxed_input_section): Make
10295         method public.
10296
10297 2009-10-16  Doug Kwan  <dougkwan@google.com>
10298
10299         * dynobj.cc (Versions::Versions): Initialize version_script_.
10300         Only insert base version symbol definition for a shared object
10301         if version script defines any version versions.
10302         (Versions::define_base_version): New method definition.
10303         (Versions::add_def): Check that base version is not needed.
10304         (Versions::add_need): Define base version lazily.
10305         * dynobj.h (Versions::define_base_version): New method declaration.
10306         (Versions::needs_base_version_): New data member declaration.
10307         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10308         (check_DATA): Add no_version_test.stdout.
10309         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10310         New make rules.
10311         * testsuite/Makefile.in: Regenerate.
10312         * testsuite/no_version_test.c: New file.
10313         * testsuite/no_version_test.sh: Ditto.
10314
10315 2009-10-16  Doug Kwan  <dougkwan@google.com>
10316
10317         * expression.cc (class Segment_start_expression): New class definition.
10318         (Segment_start_expression::value): New method definition.
10319         (script_exp_function_segment_start): Return a new
10320         Segment_start_expression.
10321         * gold/script-c.h (script_saw_segment_start_expression): New function
10322         prototype.
10323         * script-sections.cc (Script_sections::Script_sections): Initialize
10324         SAW_SEGMENT_START_EXPRESSION_ to false.
10325         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10326         and -Tbbs options to specify section addresses if given in
10327         command line and no SEGMENT_START expression is seen in a script.
10328         * script-sections.h (Script_sections::saw_segment_start_expression,
10329         Script_sections::set_saw_segment_start_expression): New method
10330         definition.
10331         (Script_sections::saw_segment_start_expression_): New data member
10332         declaration.
10333         * script.cc (script_saw_segment_start_expression): New function.
10334         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10335         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10336         script_test_7.sh and script_test_8.sh.
10337         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10338         script_test_8.stdout.
10339         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10340         (script_test_6, script_test_6.stdout, script_test_7,
10341         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10342         * Makefile.in: Regenerate.
10343         * testsuite/script_test_6.sh: New file.
10344         * testsuite/script_test_6.t: Same.
10345         * testsuite/script_test_7.sh: Same.
10346         * testsuite/script_test_7.t: Same.
10347         * testsuite/script_test_8.sh: Same.
10348
10349 2009-10-16  Doug Kwan  <dougkwan@google.com>
10350
10351         * output.cc (Output_segment::set_section_list_address): Cast
10352         expressions to unsigned long long type to avoid format warnings.
10353
10354 2009-10-15  Ian Lance Taylor  <iant@google.com>
10355
10356         * script.cc (Script_options::add_symbol_assignment): Always add a
10357         dot assignment to script_sections_.
10358         * script-sections.cc (Script_sections::add_dot_assignment):
10359         Initialize if necessary.
10360
10361         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10362         program headers with no load segment if there is a linker script.
10363
10364         * layout.cc (Layout::set_segment_offsets): Align the file offset
10365         to the segment aligment for -N or -n with no load segment.
10366         * output.cc (Output_segment::add_output_section): Don't crash if
10367         the first section is a TLS section.
10368         (Output_segment::set_section_list_addresses): Print an error
10369         message if the address moves backward in a linker script.
10370         * script-sections.cc
10371         (Output_section_element_input::set_section_addresses): Don't
10372         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10373         (Orphan_output_section::set_section_addresses): Likewise.
10374
10375 2009-10-15  Doug Kwan  <dougkwan@google.com>
10376
10377         * layout.cc (Layout::finish_dynamic_section): Generate tags
10378         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10379         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10380         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10381
10382 2009-10-14  Ian Lance Taylor  <iant@google.com>
10383
10384         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10385         fields.
10386         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10387         data_shdr fields of relinfo.
10388         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10389         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10390         R_386_TLS_LDO_32, adjust based on section flags.
10391         (Target_i386::Relocate::fix_up_ldo): Remove.
10392
10393 2009-10-13  Ian Lance Taylor  <iant@google.com>
10394
10395         Add support for -pie.
10396         * options.h (class General_options): Add -pie and
10397         --pic-executable.
10398         (General_options::output_is_position_independent): Test -pie.
10399         (General_options::output_is_executable): Return true if not shared
10400         and not relocatable.
10401         (General_options::output_is_pie): Remove.
10402         * options.cc (General_options::finalize): Reject incompatible uses
10403         of -pie.
10404         * gold.cc (queue_middle_tasks): A -pie link is not static.
10405         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10406         * symtab.cc (Symbol::final_value_is_known): Return false if
10407         output_is_position_independent.
10408         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10409         output_is_position_independent.
10410         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10411         output_is_position_independent.
10412         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10413         output_is_position_independent.
10414         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10415         two_file_pie_test.
10416         (basic_pie_test.o, basic_pie_test): New targets.
10417         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10418         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10419         (two_file_pie_test): New target.
10420         * testsuite/Makefile.in: Rebuild.
10421         * README: Remove note saying that -pie is not supported.
10422
10423 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10424
10425         * options.h (class General_options): Add -init and -fini.
10426         * layout.cc (Layout::finish_dynamic_section): Emit
10427         given init and fini functions.
10428
10429 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10430
10431         * gc.h (gc_process_relocs): Check if icf is enabled using new
10432         function.
10433         * gold.cc (queue_initial_tasks): Likewise.
10434         (queue_middle_tasks): Likewise.
10435         * object.cc (do_layout): Likewise.
10436         * symtab.cc (is_section_folded): Likewise.
10437         * main.cc (main): Likewise.
10438         * reloc.cc (Read_relocs::run): Likewise.
10439         (Sized_relobj::do_scan_relocs): Likewise.
10440         * icf.cc (is_function_ctor_or_dtor): New function.
10441         (Icf::find_identical_sections): Check if function is ctor or dtor when
10442         safe icf is chosen.
10443         * options.h (General_options::icf): Change option to be an enum.
10444         (Icf_status): New enum.
10445         (icf_enabled): New method.
10446         (icf_safe_folding): New method.
10447         (set_icf_status): New method.
10448         (icf_status_): New variable.
10449         * (options.cc) (General_options::finalize): Set icf_status_.
10450         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10451         icf_test and icf_keep_unique_test to use the --icf enum flag.
10452         * testsuite/icf_safe_test.sh: New file.
10453         * testsuite/icf_safe_test.cc: New file.
10454
10455 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10456
10457         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10458         includes to gc.h and icf.h.
10459         * arm.cc: Include gc.h.
10460         * gold.cc: Likewise.
10461         * i386.cc: Likewise.
10462         * powerpc.cc: Likewise.
10463         * sparc.cc: Likewise.
10464         * x86_64.cc: Likewise.
10465         * gc.h: Include icf.h.
10466
10467 2009-10-11  Ian Lance Taylor  <iant@google.com>
10468
10469         * plugin.cc: Include "gold.h" before other header files.
10470
10471 2009-10-10  Chris Demetriou  <cgd@google.com>
10472
10473         * options.h (Input_file_argument::Input_file_type): New enum.
10474         (Input_file_argument::is_lib_): Replace with...
10475         (Input_file_argument::type_): New member.
10476         (Input_file_argument::Input_file_argument): Take Input_file_type
10477         'type' rather than boolean 'is_lib' as second argument.
10478         (Input_file_argument::is_lib): Use type_.
10479         (Input_file_argument::is_searched_file): New function.
10480         (Input_file_argument::may_need_search): Handle is_searched_file.
10481         * options.cc (General_options::parse_library): Support -l:filename.
10482         (General_options::parse_just_symbols): Update for Input_file_argument
10483         changes.
10484         (Command_line::process): Likewise.
10485         * archive.cc (Archive::get_file_and_offset): Likewise.
10486         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10487         * script.cc (read_script_file, script_add_file): Likewise.
10488         * fileread.cc (Input_file::Input_file): Likewise.
10489         (Input_file::will_search_for): Handle is_searched_file.
10490         (Input_file::open): Likewise.
10491         * readsyms.cc (Read_symbols::get_name): Likewise.
10492         * testsuite/Makefile.am (searched_file_test): New test.
10493         * testsuite/Makefile.in: Regenerate.
10494         * testsuite/searched_file_test.cc: New file.
10495         * testsuite/searched_file_test_lib.cc: New file.
10496
10497 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10498             Ian Lance Taylor  <iant@google.com>
10499
10500         * descriptor.cc: Include <cstdio> and "binary-io.h".
10501         (Descriptors::open): Open the files in binary mode always.
10502         * script.cc (Lex::get_token): Treat \r as whitespace.
10503
10504 2009-10-09  Ian Lance Taylor  <iant@google.com>
10505
10506         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10507
10508 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10509             Ian Lance Taylor  <iant@google.com>
10510
10511         * configure.ac: Check for readv function also.
10512         * fileread.cc (readv): Define if not HAVE_READV.
10513         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10514         does not exist.
10515         * config.in: Regenerate.
10516         * configure: Regenerate.
10517
10518 2009-10-09  Doug Kwan  <dougkwan@google.com>
10519
10520         * layout.cc (Layout::make_output_section): Call target hook to make
10521         ordinary output section.
10522         (Layout::finalize): Adjust parameter list of call the
10523         Target::may_relax().
10524         * layout.h (class Layout::section_list): New method.
10525         * merge.h (Output_merge_base::entsize): Change visibility to public.
10526         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10527         New methods.
10528         (Output_merge_string::do_is_string): New method.
10529         * object.cc (Sized_relobj::do_setup): renamed from
10530         Sized_relobj::set_up.
10531         * object.h (Sized_relobj::adjust_shndx,
10532         Sized_relobj::initializ_input_to_output_maps,
10533         Sized_relobj::free_input_to_output_maps): Change visibilities to
10534         protected.
10535         (Sized_relobj::setup): Virtualize.
10536         (Sized_relobj::do_setup): New method declaration.
10537         (Sized_relobj::invalidate_section_offset,
10538         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10539         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10540         * options.cc (parse_int): New function.
10541         * options.h (parse_int): New declaration.
10542         (DEFINE_int): New macro.
10543         (stub_group_size): New option.
10544         * output.cc (Output_section::Output_section): Initialize memebers
10545         merge_section_map_, merge_section_by_properties_map_,
10546         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10547         (Output_section::add_input_section): Handled deferred code-fill
10548         generation and remove an old comment.
10549         (Output_section::add_relaxed_input_section): New method definition.
10550         (Output_section::add_merge_input_section): Use merge section by
10551         properties map to speed to search.  Update merge section maps
10552         as appropriate.
10553         (Output_section::build_relaxation_map): New method definition.
10554         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10555         Same.
10556         (Output_section::relax_input_section): Renamed to
10557         Output_section::convert_input_sections_to_relaxed_sections and change
10558         interface to take a vector of pointers to relaxed sections.
10559         (Output_section::find_merge_section,
10560         Output_section::find_relaxed_input_section): New method definitions.
10561         (Output_section::is_input_address_mapped,
10562         Output_section::output_offset, Output_section::output_address):
10563         Use output section data maps to speed up searching.
10564         (Output_section::find_starting_output_address): Add comments.
10565         (Output_section::do_write,
10566         Output_section::write_to_postprocessing_buffer): Do code-fill
10567         generation as appropriate.
10568         (Output_section::get_input_sections): Invalidate relaxed input section
10569         map.
10570         (Output_section::restore_states): Adjust type of checkpoint .
10571         Invalidate relaxed input section map.
10572         * output.h (Output_merge_base): New class declaration.
10573         (Input_section_specifier): New class defintion.
10574         (class Output_relaxed_input_section) Change base class to
10575         Output_section_data_build.
10576         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10577         base class initializer.
10578         (Output_section::add_relaxed_input_section): New method declaration.
10579         (Output_section::Input_section): Change visibility to protected.
10580         (Output_section::Input_section::relobj,
10581         Output_section::Input_section::shndx): Handle relaxed input sections.
10582         Output_section::input_sections) Change visibility to protected.  Also
10583         define overload to return a non-const pointer.
10584         (Output_section::Merge_section_properties): New class defintion.
10585         (Output_section::Merge_section_by_properties_map,
10586         Output_section::Output_section_data_by_input_section_map,
10587         Output_section::Relaxation_map): New types.
10588         (Output_section::relax_input_section): Rename method to
10589         Output_section::convert_input_sections_to_relaxed_sections and change
10590         interface to take a vector of relaxed section pointers.
10591         (Output_section::find_merge_section,
10592         Output_section::find_relaxed_input_section,
10593         Output_section::build_relaxation_map,
10594         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10595         New method declarations.
10596         (Output_section::merge_section_map_
10597         Output_section::merge_section_by_properties_map_,
10598         Output_section::relaxed_input_section_map_,
10599         Output_section::is_relaxed_input_section_map_valid_,
10600         Output_section::generate_code_fills_at_write_): New data members.
10601         * script-sections.cc
10602         (Output_section_element_input::set_section_addresses): Call
10603         current_data_size and addralign methods of relaxed input sections.
10604         (Orphan_output_section::set_section_addresses): Call current_data_size
10605         and addralign methods of relaxed input sections.
10606         * symtab.cc (Symbol_table::compute_final_value): Extract template
10607         from the body of Symbol_table::sized_finalize_symbol.
10608         (Symbol_table::sized_finalized_symbol): Call
10609         Symbol_table::compute_final_value.
10610         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10611         (Symbol_table::compute_final_value): New templated method declaration.
10612         * target.cc (Target::do_make_output_section): New method defintion.
10613         * target.h (Target::make_output_section): New method declaration.
10614         (Target::relax): Add more parameters for input objects, symbol table
10615         and layout.  Adjust call to do_relax.
10616         (Target::do_make_output_section): New method declaration.
10617         (Target::do_relax): Add parameters for input objects, symbol table
10618         and layout.
10619
10620 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10621
10622         * pread.c: Include stdio.h.
10623
10624 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10625
10626         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10627         defined.
10628
10629 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10630
10631         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10632         Change read_shndx type to unsigned int.
10633         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10634         int.
10635         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10636         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10637         Change read_shndx type to unsigned int.
10638         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10639         int.
10640         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10641         * layout.cc (Layout::create_symtab_sections): Cast the result of
10642         local_symcount * symsize to off_t in the gold_assert.
10643
10644 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10645
10646         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10647         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10648         R_ARM_BASE_ABS.
10649         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10650         (Arm_relocate_functions::thm_abs5): New function.
10651         (Arm_relocate_functions::abs12): New function.
10652         (Arm_relocate_functions::abs16): New function.
10653         (Arm_relocate_functions::base_abs): New function.
10654         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10655         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10656         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10657         R_ARM_BASE_ABS.
10658         (Scan::global): Likewise.
10659         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10660         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10661         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10662         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10663         R_ARM_BASE_ABS.
10664
10665 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10666
10667         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10668         (Arm_relocate_functions::movt_prel): New function.
10669         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10670         (Arm_relocate_functions::thm_movt_prel): New function.
10671         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10672         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10673         (Scan::global, Relocate::relocate): Likewise.
10674         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10675
10676 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10677
10678         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10679         Incremental_checker.
10680         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10681         unsigned int.
10682         (class Incremental_inputs_header): New class.
10683         (Incremental_inputs_header_writer): Edit comment.
10684         (Incremental_inputs_entry): New class.
10685         (Incremental_inputs_entry_writer): Edit comment.
10686         (Sized_incremental_binary::do_find_incremental_inputs_section):
10687         Add *strtab_shndx parameter, fill it.
10688         (Sized_incremental_binary::do_check_inputs): New method.
10689         (Incremental_checker::can_incrementally_link_output_file): Use
10690         Sized_incremental_binary::check_inputs.
10691         (Incremental_inputs::report_command_line): Save command line in
10692         command_line_.
10693         * incremental.h:
10694         (Incremental_binary::find_incremental_inputs_section): New
10695         method.
10696         (Incremental_binary::do_find_incremental_inputs_section): Add
10697         strtab_shndx parameter.
10698         (Incremental_binary::do_check_inputs): New pure virtual method.
10699         (Sized_incremental_binary::do_check_inputs): Declare.
10700         (Incremental_checker::Incremental_checker): Add incremental_inputs
10701         parameter, use it to initialize incremental_inputs_.
10702         (Incremental_checker::incremental_inputs_): New field.
10703         (Incremental_checker::command_line): New method.
10704         (Incremental_checker::inputs): New method.
10705         (Incremental_checker::command_line_): New field.
10706
10707 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10708
10709         * incremental.cc: Include <cstdarg> and "target-select.h".
10710         (vexplain_no_incremental): New function.
10711         (explain_no_incremental): New function.
10712         (Incremental_binary::error): New method.
10713         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10714         method.
10715         (make_sized_incremental_binary): New function.
10716         (open_incremental_binary): New function.
10717         (can_incrementally_link_file): Add checks if output is ELF and has
10718         inputs section.
10719         * incremental.h: Include "elfcpp_file.h" and "output.h".
10720         (Incremental_binary): New class.
10721         (Sized_incremental_binary): New class.
10722         (open_incremental_binary): Declare.
10723         * object.cc (is_elf_object): Use
10724         elfcpp::Elf_recognizer::is_elf_file.
10725         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10726         * output.h (Output_file::filesize): New method.
10727
10728 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10729
10730         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10731         New function.
10732         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10733         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10734         function.
10735         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10736         function.
10737         (Arm_relocate_functions::movw_abs_nc): New function.
10738         (Arm_relocate_functions::movt_abs): New function.
10739         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10740         (Arm_relocate_functions::thm_movt_abs): New function.
10741         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10742         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10743         (Scan::global): Likewise.
10744         (Relocate::relocate): Likewise.
10745         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10746
10747 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10748
10749         * arm.cc (Arm_relocate_functions::got_prel) New function.
10750         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10751         (Relocate::relocate): Likewise.
10752         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10753
10754 2009-10-06  Ian Lance Taylor  <iant@google.com>
10755
10756         * options.h (class General_options): Define
10757         split_stack_adjust_size parameter.
10758         * object.h (class Object): Add uses_split_stack_ and
10759         has_no_split_stack_ fields.  Add uses_split_stack and
10760         has_no_split_stack accessor functions.  Declare
10761         handle_split_stack_section.
10762         (class Reloc_symbol_changes): Define.
10763         (class Sized_relobj): Define Function_offsets.  Declare
10764         split_stack_adjust, split_stack_adjust_reltype, and
10765         find_functions.
10766         * object.cc (Object::handle_split_stack_section): New function.
10767         (Sized_relobj::do_layout): Call handle_split_stack_section.
10768         * dynobj.cc (Sized_dynobj::do_layout): Call
10769         handle_split_stack_section.
10770         * reloc.cc (Sized_relobj::relocate_sections): Call
10771         split_stack_adjust for executable sections in split_stack
10772         objects.  Pass reloc_map to relocate_section.
10773         (Sized_relobj::split_stack_adjust): New function.
10774         (Sized_relobj::split_stack_adjust_reltype): New function.
10775         (Sized_relobj::find_functions): New function.
10776         * target-reloc.h: Include "object.h".
10777         (relocate_section): Add reloc_symbol_changes parameter.  Change
10778         all callers.
10779         * target.h (class Target): Add calls_non_split method.  Declare
10780         do_calls_non_split virtual method.  Declare match_view and
10781         set_view_to_nop.
10782         * target.cc: Include "elfcpp.h".
10783         (Target::do_calls_non_split): New function.
10784         (Target::match_view): New function.
10785         (Target::set_view_to_nop): New function.
10786         * gold.cc (queue_middle_tasks): Give an error if mixing
10787         split-stack and non-split-stack objects with -r.
10788         * i386.cc (Target_i386::relocate_section): Add
10789         reloc_symbol_changes parameter.
10790         (Target_i386::do_calls_non_split): New function.
10791         * x86_64.cc (Target_x86_64::relocate_section): Add
10792         reloc_symbol_changes parameter.
10793         (Target_x86_64::do_calls_non_split): New function.
10794         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10795         parameter.
10796         * powerpc.cc (Target_powerpc::relocate_section): Add
10797         reloc_symbol_changes parameter.
10798         * sparc.cc (Target_sparc::relocate_section): Add
10799         reloc_symbol_changes parameter.
10800         * configure.ac: Call AM_CONDITIONAL for the default target.
10801         * configure: Rebuild.
10802         * testsuite/Makefile.am (TEST_AS): New variable.
10803         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10804         (check_DATA): Add split_i386 and split_x86_64 files.
10805         (SPLIT_DEFSYMS): Define.
10806         (split_i386_[1234n].o): New targets.
10807         (split_i386_[124]): New targets.
10808         (split_i386_[1234r].stdout): New targets.
10809         (split_x86_64_[1234n].o): New targets.
10810         (split_x86_64_[124]): New targets.
10811         (split_x86_64_[1234r].stdout): New targets.
10812         (MOSTLYCLEANFILES): Add new executables.
10813         * testsuite/split_i386.sh: New file.
10814         * testsuite/split_x86_64.sh: New file.
10815         * testsuite/split_i386_1.s: New file.
10816         * testsuite/split_i386_2.s: New file.
10817         * testsuite/split_i386_3.s: New file.
10818         * testsuite/split_i386_4.s: New file.
10819         * testsuite/split_i386_n.s: New file.
10820         * testsuite/split_x86_64_1.s: New file.
10821         * testsuite/split_x86_64_2.s: New file.
10822         * testsuite/split_x86_64_3.s: New file.
10823         * testsuite/split_x86_64_4.s: New file.
10824         * testsuite/split_x86_64_n.s: New file.
10825         * testsuite/testfile.cc (Target_test): Update relocation_section
10826         function.
10827         * testsuite/Makefile.in: Rebuild.
10828
10829 2009-10-06  Ian Lance Taylor  <iant@google.com>
10830
10831         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10832         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10833         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10834         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10835         the address on ldo_addrs_.
10836         (Target_i386::Relocate::fix_up_ldo): New function.
10837
10838 2009-10-06   Rafael Espindola  <espindola@google.com>
10839
10840         * plugin.cc (add_input_library): New.
10841         (Plugin::load): Add add_input_library to tv.
10842         (Plugin_manager::add_input_file): Add the is_lib argument.
10843         (add_input_file): Update call to Plugin_manager::add_input_file.
10844         (add_input_library): New.
10845         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10846
10847 2009-09-30  Doug Kwan  <dougkwan@google.com>
10848
10849         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10850         symbol and call Symbol::may_need_copy_reloc to determine if
10851         a copy reloc is needed.
10852         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10853         nocopyreloc is given in command line.
10854         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10855         given in command line.
10856         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10857         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10858         of the removed Target_i386::may_need_copy_reloc.
10859         * options.h (copyreloc): New option with default value false.
10860         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10861         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10862         instead of the removed Target_powerpc::may_need_copy_reloc.
10863         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10864         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10865         instead of the removed Target_sparc::may_need_copy_reloc.
10866         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10867         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10868         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10869         instead of the removed Target_x86_64::may_need_copy_reloc.
10870
10871 2009-09-30  Ian Lance Taylor  <iant@google.com>
10872
10873         * object.h (class Object): Remove target_ field, and target,
10874         sized_target, and set_target methods.
10875         (Object::sized_target): Remove.
10876         (class Sized_relobj): Update declarations.  Remove sized_target.
10877         * object.cc (Sized_relobj::setup): Remove target parameter.
10878         Change all callers.
10879         (Input_objects::add_object): Don't do anything with the target.
10880         (make_elf_sized_object): Add punconfigured parameter.  Change all
10881         callers.  Set or test parameter target.
10882         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10883         Change all callers.
10884         * parameters.cc (Parameters::set_target): Change parameter type to
10885         be non-const.
10886         (Parameters::default_target): Remove.
10887         (set_parameters_target): Change parameter type to be non-const.
10888         (parameters_force_valid_target): New function.
10889         (parameters_clear_target): New function.
10890         * parameters.h (class Parameters): Update declarations.  Remove
10891         default_target method.  Add sized_target and clear_target
10892         methods.  Change target_ to be non-const.
10893         (set_parameters_target): Update declaration.
10894         (parameters_force_valid_target): Declare.
10895         (parameters_clear_target): Declare.
10896         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10897         as NULL if we aren't searching.
10898         (Add_symbols::run): Don't check for compatible target.
10899         * fileread.cc (Input_file::open_binary): Call
10900         parameters_force_valid_target.
10901         * gold.cc (queue_middle_tasks): Likewise.
10902         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10903         set_target on object.
10904         * dynobj.h (class Sized_dynobj): Update declarations.
10905         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10906         make_elf_object returns NULL.
10907         (Archive::include_member): Don't check whether object target is
10908         compatible.
10909         * output.cc (Output_section::add_input_section): Get target from
10910         parameters.
10911         (Output_section::relax_input_section): Likewise.
10912         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10913         parameters.
10914         (Sized_relobj::do_scan_relocs): Likewise.
10915         (Sized_relobj::relocate_sections): Likewise.
10916         * resolve.cc (Symbol_table::resolve): Likewise.
10917         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10918         parameter.  Change all callers.
10919         (Symbol_table::add_from_object): Get target from parameters.
10920         (Symbol_table::add_from_relobj): Don't check object target.
10921         (Symbol_table::add_from_dynobj): Likewise.
10922         (Symbol_table::define_special_symbol): Get target from
10923         parameters.
10924         * symtab.h (class Symbol_table): Update declaration.
10925         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10926         parameter.  Change all callers.  Clear parameter target.
10927         (Binary_test): Test target here.
10928         * testsuite/object_unittest.cc (gold_testsuite): Remove
10929         target_test_pointer parameter.  Change all callers.
10930         (Object_test): Test target here.
10931
10932 2009-09-26  Ian Lance Taylor  <iant@google.com>
10933
10934         * testsuite/initpri1.c: Don't try to use constructor priorities if
10935         compiling with gcc before 4.3.
10936
10937 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10938
10939         * testsuite/retain_symbols_file_test.sh (check_present): Change
10940         output file name to retain_symbols_file_test.stdout.
10941         (check_absent): Likewise.
10942
10943 2009-09-18  Craig Silverstein  <csilvers@google.com>
10944
10945         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10946         * options.cc: Include <cerrno> and <fstream>.
10947         (General_options::finalize): Parse -retain-symbols-file tag.
10948         * options.h: New flag.
10949         (General_options): New method should_retain_symbol, new
10950         variable symbols_to_retain.
10951         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10952         should_retain_symbol map.
10953         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10954         * testsuite/Makefile.in: Regenerate.
10955         * testsuite/retain_symbols_file_test.sh: New file.
10956
10957 2009-09-18  Nick Clifton  <nickc@redhat.com>
10958
10959         * po/es.po: Updated Spanish translation.
10960
10961 2009-09-17  Doug Kwan  <dougkwan@google.com>
10962
10963         * debug.h (DEBUG_RELAXATION): New constant.
10964         (DEBUG_ALL): Add DEBUG_RELAXATION.
10965         (debug_string_to_enum): Add relaxation debug option.
10966         * layout.cc
10967         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10968         Layout::Relaxation_debug_check::read_sections,
10969         Layout::Relaxation_debug_check::read_sections): New method definitions.
10970         (Layout::Layout): Initialize data members
10971         record_output_section_data_from_scrips_,
10972         script_output_section_data_list_ and relaxation_debug_check_.
10973         (Layout::save_segments, Layout::restore_segments,
10974         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10975         Layout::relaxation_loop_body): New method definitions.
10976         (Layout::finalize): Support relaxation.  Move section layout code to
10977         Layout::relaxation_loop_body.
10978         (Layout::set_asection_address_from_script): Move code for orphan
10979         section placement out.
10980         (Layout::place_orphan_sections_in_script): New method definition.
10981         * layout.h (Output_segment_headers, Output_file_header):
10982         New forward class declarations.
10983         (Layout::~Layout): Define.
10984         (Layout::new_output_section_data_from_script): New method definition.
10985         (Layout::place_orphan_sections_in_script): New method declaration.
10986         (Layout::Segment_states): New type declaration.
10987         (Layout::save_segments, Layout::restore_segments,
10988         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10989         Layout::relaxation_loop_body): New method declarations.
10990         (Layout::Output_section_data_list): New type declaration.
10991         (Layout::Relaxation_debug_check): New class definition.
10992         (Layout::record_output_section_data_from_script_,
10993         Layout::script_output_section_data_list_, Layout::segment_states_,
10994         Layout::relaxation_debug_check_): New data members.
10995         * output.cc: (Output_section_headers::do_size): New method definition.
10996         (Output_section_headers::Output_section_headers): Move size
10997         computation to Output_section_headers::do_size.
10998         (Output_segment_headers::do_size): New method definition.
10999         (Output_file_header::Output_file_header): Move size computation to
11000         Output_file_header::do_size and call it.
11001         (Output_file_header::do_size): New method definition.
11002         (Output_data_group::Output_data_group): Adjust call to
11003         Output_section_data.
11004         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11005         (Output_symtab_xindex::do_write): Add array bound check.
11006         (Output_section::Input_section::print_to_mapfile): Handle
11007         RELAXED_INPUT_SECTION_CODE.
11008         (Output_section::Output_section): Initialize data member checkpoint_.
11009         (Output_section::~Output_section): Delete checkpoint object pointed
11010         by checkpoint_.
11011         (Output_section::add_input_section): Always add an Input_section if
11012         relaxing.
11013         (Output_section::add_merge_input_section): Add assert.
11014         (Output_section::relax_input_section): New method definition.
11015         (Output_section::set_final_data_size): Set load address to zero for
11016         an unallocated section.
11017         (Output_section::do_address_and_file_offset_have_reset_values):
11018         New method definition.
11019         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11020         Handle relaxed input section.
11021         (Output_section::sort_attached_input_sections): Checkpoint input
11022         section list lazily.
11023         (Output_section::get_input_sections): Change type of input_sections to
11024         list of Simple_input_section pointers.  Checkpoint input section list
11025         lazily.  Also handle relaxed input sections.
11026         (Output_section::add_input_section_for_script): Take a reference to
11027         a Simple_input_section object instead of Relobj pointer and section
11028         index as parameter.  Handle relaxed input sections.
11029         (Output_section::save_states, Output_section::restore_states): New
11030         method definitions.
11031         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11032         (Output_data::is_data_size_fixed): New method definition.
11033         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11034         if it is fixed.
11035         (Output_data::address_and_file_offset_have_reset_values): New method
11036         definition.
11037         (Output_data::do_address_and_file_offset_have_reset_values): New method
11038         definition.
11039         (Output_data::set_data_size): Check that data size is not fixed.
11040         (Output_data::fix_data_size): New method definition.
11041         (Output_data::is_data_size_fixed_): New data member.
11042         (Output_section_headers::set_final_data_size): New method definition.
11043         (Output_section_headers::do_size): New method declaration.
11044         (Output_segment_headers::set_final_data_size): New method definition.
11045         (Output_segment_headers::do_size): New method declaration.
11046         (Output_file_header::set_final_data_size)::New method definition.
11047         (Output_file_header::do_size)::New method declaration.
11048         (Output_section_data::Output_section_data): Add new parameter
11049         is_data_size_fixed and use it to fix data size.
11050         (Output_data_const::Output_data_const): Adjust call to base class
11051         constructor and fix data size.
11052         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11053         base class constructor and fix data size.
11054         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11055         base class constructor and fix data size.
11056         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11057         class constructor and fix data size.
11058         (Output_data_group::set_final_data_size): New method definition.
11059         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11060         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11061         class constructor and fix data size.
11062         (Output_relaxed_input_section): New class definition.
11063         (Output_section::Simple_input_section): New class definition.
11064         (Output_section::get_input_sections): Adjust parameter list.
11065         (Output_section::add_input_section_for_script): Same.
11066         (Output_section::save_states, Output_section::restore_states,
11067         Output_section::do_address_and_file_offset_have_reset_values,
11068         (Output_section::Input_section::Input_section): Handle
11069         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11070         Output_relaxed_input_section.
11071         (Output_section::Input_section::is_input_section,
11072         Output_section::Input_section::set_output_section): Handle relaxed
11073         input section.
11074         (Output_section::Input_section::is_relaxed_input_section,
11075         Output_section::Input_section::output_section_data,
11076         Output_section::Input_section::relaxed_input_section): New method
11077         definitions.
11078         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11079         value.
11080         (Output_section::Input_section::u1_): Update comments.
11081         (Output_section::Input_section::u2_): Add new union member poris.
11082         (Output_section::Checkpoint_output_section): New classs definition.
11083         (Output_section::relax_input_section): New method declaration.
11084         (Output_section::checkpoint_): New data member.
11085         (Output_segment): Update comments.
11086         (Output_segment::Output_segment): Un-privatize copy constructor.
11087         (Output_segment::operator=): Un-privatize.
11088         * script-sections.cc (Output_section_element::Input_section_list):
11089         Change element type to Output_section::Simple_input_section.
11090         (Output_section_element_dot_assignment::set_section_addresses):
11091         Register output section data for relaxation clean up.
11092         (Output_data_exression::Output_data_expression): Adjust call to base
11093         constructor to fix data size.
11094         (Output_section_element_data::set_section_addresses): Register
11095         Output_data_expression object for relaxation clean up.
11096         (struct Input_section_info): Replace Relobj pointer and section index
11097         pair with Output_section::Simple_input_section and Convert struct to a
11098         class.
11099         (Input_section_sorter::operator()): Adjust access to
11100         Input_section_info data member to use accessors.
11101         (Output_section_element_input::set_section_addresses): Use layout
11102         parameter.  Adjust code to use Output_section::Simple_input_section
11103         and Input_secction_info classes.  Register filler for relaxation
11104         clean up.
11105         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11106         and section index pair with Output_section::Simple_input_section
11107         class.  Adjust code accordingly.
11108         (Phdrs_element::release_segment): New method definition.
11109         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11110         segment list.
11111         (Script_sections::release_segments): New method definition.
11112         * gold/script-sections.h (Script_sections::release_segments): New
11113         method declaration.
11114         * gold/target.h (Target::may_relax, Target::relax,
11115         Target::do_may_relax, Target::do_relax): New method definitions.
11116
11117 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11118
11119         * arm.cc (has_signed_unsigned_overflow): New function.
11120         (Arm_relocate_functions::abs8): New function.
11121         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11122         (Target_arm::Scan::global): Likewise.
11123         (Target_arm::relocate::relocate): Likewise.
11124         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11125         Likewise.
11126
11127 2009-09-16  Cary Coutant  <ccoutant@google.com>
11128
11129         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11130         * testsuite/Makefile.in: Regenerate.
11131
11132 2009-09-11  Nick Clifton  <nickc@redhat.com>
11133
11134         * po/gold.pot: Updated by the Translation project.
11135
11136 2009-09-08  Cary Coutant  <ccoutant@google.com>
11137
11138         * output.cc (Output_file::open): Add execute permission to empty file.
11139         * testsuite/Makefile.am (permission_test): New test.
11140         * testsuite/Makefile.in: Regenerate.
11141
11142 2009-09-02  Ian Lance Taylor  <iant@google.com>
11143
11144         * output.cc (Output_file::resize): Call map_no_anonymous rather
11145         than map.
11146
11147 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11148
11149         * gold.cc: Include "incremental.h".
11150         (queue_initial_tasks): Call Incremental_checker methods.
11151         * incremental.cc: Include "output.h".
11152         (Incremental_checker::can_incrementally_link_output_file): New
11153         method.
11154         * incremental.h (Incremental_checker): New class.
11155
11156         * output.cc (Output_file::open_for_modification): New method.
11157         (Output_file::map_anonymous): Changed return type to bool.  Record
11158         map in base_ field.
11159         (Output_file::map_no_anonymous): New method, broken out of map.
11160         (Output_file::map): Use map_no_anonymous and map_anonymous.
11161         * output.h (class Output_file): Update declarations.
11162
11163 2009-08-24  Cary Coutant  <ccoutant@google.com>
11164
11165         * options.h (Command_line::Pre_options): New class.
11166         (Command_line::pre_options): New member.
11167         * options.cc (gold::options::ready_to_register): New variable.
11168         (One_option::register_option): Do nothing if not registering options.
11169         Assert if same short option registered twice.
11170         (General_options::General_options): Turn off option registration when
11171         done constructing.
11172         (Command_line::Pre_options::Pre_options): New constructor.
11173
11174 2009-08-24  Cary Coutant  <ccoutant@google.com>
11175
11176         * options.h (General_options::no_keep_memory): Remove incorrect
11177         short option.
11178
11179 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11180
11181         * Makefile.am (am__skiplex, am__skipyacc): New.
11182         * Makefile.in: Regenerate.
11183
11184 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11185
11186         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11187         (INCLUDES): ... this.
11188         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11189         (AM_CPPFLAGS): Renamed from ...
11190         (INCLUDE): ... this.
11191         * Makefile.in, testsuite/Makefile.in: Regenerate.
11192
11193         * Makefile.in: Regenerate.
11194         * aclocal.m4: Likewise.
11195         * config.in: Likewise.
11196         * configure: Likewise.
11197         * testsuite/Makefile.in: Likewise.
11198
11199         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11200         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11201         * Makefile.in: Regenerate.
11202         * testsuite/Makefile.in: Regenerate.
11203
11204 2009-08-19  Cary Coutant  <ccoutant@google.com>
11205
11206         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11207         symbols in shared libraries overridden by hidden or internal symbols
11208         in the main program.
11209
11210 2009-08-19  Chris Demetriou  <cgd@google.com>
11211
11212         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11213         checking source file names in error messages.
11214
11215 2009-08-18  Doug Kwan  <dougkwan@google.com>
11216
11217         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11218         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11219         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11220         an elfcpp::Ehdr as parameter.
11221         * object.cc (Object::set_target): Remove the version that looks up
11222         a target and sets it.
11223         (Sized_relobj::setup): Take a Target object instead of
11224         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11225         (make_elf_sized_object): Find target and ask target to
11226         make an ELF object.
11227         * object.h: (Object::set_target): Remove the version that looks up
11228         a target and sets it.
11229         (Sized_relobj::setup): Take a Target object instead of
11230         an elfcpp:Ehdr as parameter.
11231         * target.cc: Include dynobj.h.
11232         (Target::do_make_elf_object_implementation): New.
11233         (Target::do_make_elf_object): New.
11234         * target.h (Target::make_elf_object): New template declaration.
11235         (Target::do_make_elf_object): New method declarations.
11236         (Target::do_make_elf_object_implementation): New template declaration.
11237
11238 2009-08-14  Ian Lance Taylor  <iant@google.com>
11239
11240         * gold.h (FUNCTION_NAME): Define.
11241         (gold_unreachable): Use FUNCTION_NAME.
11242
11243 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11244
11245         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11246         symbol in the --keep-unique list is not found.
11247
11248 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11249
11250         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11251         been maked as --keep-unique.
11252         (Icf::unfold_section): New function.
11253         * icf.h (Icf::unfold_section): New function.
11254         * options.h (General_options::keep_unique): New option.
11255         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11256         * testsuite/Makefile.in: Regenerate.
11257         * testsuite/icf_keep_unique_test.sh: New file.
11258         * testsuite/icf_keep_unique_test.cc: New file.
11259
11260 2009-08-12  Cary Coutant  <ccoutant@google.com>
11261
11262         PR 10471
11263         * resolve.cc (Symbol_table::resolve): Check for references from
11264         dynamic objects to hidden and internal symbols.
11265         * testsuite/Makefile.am (hidden_test.sh): New test.
11266         * testsuite/Makefile.in: Regenerate.
11267         * testsuite/hidden_test.sh: New script.
11268         * testsuite/hidden_test_1.c: New test source.
11269         * testsuite/hidden_test_main.c: New test source.
11270
11271 2009-08-11  Doug Kwan  <dougkwan@google.com>
11272
11273         * arm.cc: Update comments.
11274         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11275         segment to locate the .ARM.exidx section if present.
11276
11277 2009-08-09  Doug Kwan  <dougkwan@google.com>
11278
11279         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11280         patch.
11281
11282 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11283         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11284         compiler warnings.
11285
11286 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11287
11288         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11289         valid tls_segment only for non-debug-section relocations.
11290         * testsuite/Makefile.am: Add gc_tls_test.
11291         * testsuite/Makefile.in: Regenerate.
11292         * testsuite/gc_tls_test.cc: New file.
11293         * testsuite/gc_tls_test.sh: New file.
11294
11295 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11296
11297         * icf.cc: New file.
11298         * icf.h: New file.
11299         * Makefile.am (CCFILES): Add icf.cc.
11300         (HFILES): Add icf.h
11301         * Makefile.in: Regenerate.
11302         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11303         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11304         section, symbol and addend information for the relocs.
11305         * gold.cc (queue_middle_tasks): Call identical code folding.
11306         * gold.h: Add defines for multimap.
11307         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11308         to the call of finalize_local_symbols.
11309         * main.cc (main): Create object of class Icf.
11310         * object.cc (Sized_relobj::do_layout): Allow this function to be
11311         called twice during icf.
11312         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11313         to sections marked as identical by icf.
11314         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11315         when available.
11316         (Sized_relobj::do_section_entsize): New function.
11317         * object.h (Object::section_entsize): New function.
11318         (Object::do_section_entsize): New pure virtual function.
11319         (Relobj::finalize_local_symbols): Add new parameter.
11320         (Relobj::do_section_entsize): New function.
11321         * options.h (General_options::icf): New option.
11322         (General_options::icf_iterations): New option.
11323         (General_options::print_icf_sections): New option.
11324         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11325         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11326         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11327         icf.
11328         * symtab.cc (Symbol_table::is_section_folded): New function.
11329         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11330         to sections marked as identical by icf.
11331         * symtab.h (Symbol_table::set_icf): New function.
11332         (Symbol_table::icf): New function.
11333         (Symbol_table::is_section_folded): New function.
11334         (Symbol_table::icf_): New data member.
11335         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11336         * testsuite/Makefile.am: Add commands to build icf_test.
11337         * testsuite/Makefile.in: Regenerate.
11338         * testsuite/icf_test.sh: New file.
11339         * testsuite/icf_test.cc: New file.
11340
11341 2009-07-24  Chris Demetriou  <cgd@google.com>
11342
11343         * layout.cc (is_compressible_debug_section): Fix incorrect
11344         comment about compressed section names.
11345
11346 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11347
11348         PR 10419
11349         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11350
11351 2009-07-16  Ian Lance Taylor  <iant@google.com>
11352
11353         PR 10400
11354         * layout.h: #include <map>.
11355         (class Kept_section): Change from struct to class.  Add accessors
11356         and setters.  Add section size to Comdat_group mapping.  Change
11357         Comdat_group to std::map.  Add is_comdat_ field.  Add
11358         linkonce_size field in union.
11359         (class Layout): Update declaration of find_or_add_kept_section.
11360         Don't declare find_kept_object.
11361         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11362         parameter.  Add object, shndx, is_comdat, and is_group_name
11363         parameters.  Change all callers.  Adjust for new Kept_section.
11364         (Layout::find_kept_object): Remove.
11365         * object.cc (Sized_relobj::include_section_group): Update use of
11366         Kept_section.  Rename secnum to shndx.  Only record
11367         Kept_comdat_section if sections are the same size.
11368         (Sized_relobj::include_linkonce_section): Update use of
11369         Kept_section.  Only record Kept_comdat_section if sections are the
11370         same size.  Set size of linkonce section.
11371         (Sized_relobj::map_to_kept_section): Update call to
11372         get_kept_comdat_section.
11373         * object.h (class Sized_relobj): Rename fields in
11374         Kept_comdat_section to drop trailing underscores; change object
11375         field to Relobj*.  Change Kept_comdat_section_table to store
11376         struct rather than pointer.
11377         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11378         Add kept_object and kept_shndx parameters.  Change all callers.
11379         (Sized_relobj::get_kept_comdat_section): Change return type to
11380         bool.  Add kept_object and kept_shndx parameters.  Change all
11381         callers.
11382         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11383         Layout::find_or_add_kept_section.
11384
11385 2009-07-09  Ian Lance Taylor  <iant@google.com>
11386
11387         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11388         Reserve space in the hash table.
11389
11390 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11391
11392         * fileread.cc (File_read::get_mtime): New method.
11393         * fileread.h (Timespec): New structure.
11394         (File_read::get_mtime): New method.
11395         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11396         Renamed from timestamp_nsec.
11397         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11398         Elf_Xword.
11399         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11400         timestamp_nsec.
11401         (Incremental_inputs::report_archive): Save mtime; style fix.
11402         (Incremental_inputs::report_obejct): Save mtime; style fix.
11403         (Incremental_inputs::report_script): Save mtime; style fix.
11404         (Incremental_inputs::finalize_inputs): Style fix.
11405         (Incremental_inputs::finalize): Style fix.
11406         (Incremental_inputs::create_input_section_data): Store inputs
11407         mtime.
11408         * incremental.h (Incremental_inputs::report_script): Add mtime
11409         argument.
11410         (Incremental_inputs::Input_info::Input_info): Intialize only one
11411         union member.
11412         (Incremental_inputs::Input_info::archive): Move to nameless
11413         union.
11414         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11415         (Incremental_inputs::Input_info::script): Move to nameless union.
11416         (Incremental_inputs::mtime): New field.
11417         * script.cc (read_input_script): Pass file mtime to
11418         Incremental_input.
11419         * script.h (Script_info::inputs): Style fix.
11420
11421 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11422
11423         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11424         instead of 32.
11425
11426 2009-06-24  Ian Lance Taylor  <iant@google.com>
11427
11428         PR 10156
11429         * layout.cc (Layout::choose_output_section): If we find an
11430         existing section, update the flags.
11431         (Layout::create_notes): New function, broken out of
11432         Layout::finalize.
11433         (Layout::finalize): Don't create note sections.
11434         (Layout::create_note): Don't crash if linker script discards
11435         section.
11436         (Layout::create_gold_note): Likewise.
11437         (Layout::create_build_id): Likewise.  Don't set
11438         after_input_sections on the section.
11439         (Layout::create_executable_stack_info): Remove target parameter.
11440         Change caller.
11441         * layout.h (class Layout): Declare create_notes.  Update
11442         declaration of create_executable_stack_info.
11443         * gold.cc (queue_middle_tasks): Call create_notes.
11444         * output.cc (Output_section::update_flags_for_input_section): Move
11445         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11446         invalid.
11447         * output.h (Output_data::mark_address_invalid): New function.
11448         (class Output_section): Only declare, not define,
11449         update_flags_for_input_section.  Remove set_flags.
11450
11451 2009-06-24  Ian Lance Taylor  <iant@google.com>
11452
11453         * script-sections.cc (Output_section_definition::
11454         set_section_addresses): Rename shadowing local load_address to
11455         laddr.
11456
11457 2009-06-24  Ian Lance Taylor  <iant@google.com>
11458
11459         PR 10244
11460         * reloc.cc (relocate_sections): Skip empty relocation sections.
11461
11462 2009-06-23  Ian Lance Taylor  <iant@google.com>
11463
11464         PR 10156
11465         * layout.cc (Layout::create_note): Use choose_output_section
11466         rather than make_output_section.
11467
11468 2009-06-23  Ian Lance Taylor  <iant@google.com>
11469
11470         PR 10237
11471         * options.cc (General_options::parse_V): Set printed_version_.
11472         (General_options::General_options): Initialize printed_version_.
11473         * options.h (class General_options): Add printed_version_ field.
11474         * gold.cc (queue_initial_tasks): If there are no input files,
11475         don't give a fatal error if we printed the version information.
11476         (queue_middle_tasks): If using -r with a shared object, give a
11477         fatal error rather than an ordinary error.
11478
11479 2009-06-23  Ian Lance Taylor  <iant@google.com>
11480
11481         PR 10219
11482         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11483         (Layout::make_output_section): Set have_stabstr_section_ if we see
11484         a .stab*str section.
11485         (Layout::finalize): Call link_stabs_sections.
11486         (Layout::link_stabs_sections): New file.
11487         * layout.h (class Layout): Add have_stabstr_section_ field.
11488         Declare link_stabs_sections.
11489
11490 2009-06-23  Doug Kwan  <dougkwan@google.com>
11491
11492         * Makefile.am (libgold_a_LIBADD): New.
11493         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11494         * Makefile.in: Regenerate.
11495         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11496         * configure: Regenerate.
11497         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11498         * fileread.cc: Include sys/state.h
11499         * gold.h: Declare memmem and strndup if found missing.
11500         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11501
11502 2009-06-23  Ian Lance Taylor  <iant@google.com>
11503
11504         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11505         * configure: Rebuild.
11506
11507 2009-06-23  Ian Lance Taylor  <iant@google.com>
11508
11509         PR 10147
11510         * object.cc (Object::section_contents): Don't try to get a view if
11511         the section has length zero.
11512         (Object::handle_gnu_warning_section): If the section is empty, use
11513         the name of the section as the warning.
11514
11515 2009-06-23  Ian Lance Taylor  <iant@google.com>
11516
11517         PR 10133
11518         * stringpool.h (class Stringpool_template): Add optimize_ field.
11519         (Stringpool_template::set_optimize): New function.
11520         * stringpool.cc (Stringpool_template::Stringpool_template):
11521         Initialize optimize_ field.
11522         (Stringpool_template::set_string_offsets): Test local optimize
11523         fild rather than parameter.
11524         * layout.cc (Layout::Layout): Call set_optimize on the section
11525         name stringpool.
11526
11527 2009-06-22  Ian Lance Taylor  <iant@google.com>
11528
11529         PR 10030
11530         * yyscript.y: Parse TARGET.
11531         * script.cc (script_set_target): New function.
11532         * script-c.h (script_set_target): Declare.
11533         * options.cc (General_options::string_to_object_format): Rename
11534         from string_to_object_format in anonymous namespace.  Change
11535         callers.
11536         * options.h (class General_options): Declare
11537         string_to_object_format.
11538
11539 2009-06-22  Ian Lance Taylor  <iant@google.com>
11540
11541         * script-sections.cc (Script_sections::create_segments): Don't put
11542         program headers in a PT_LOAD segment if -n or -N.
11543
11544 2009-06-22  Ian Lance Taylor  <iant@google.com>
11545
11546         PR 10141
11547         * options.h (class General_options): Add -z lazy and -z now.  Sort
11548         -z options into alphabetical order.
11549         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11550
11551 2009-06-21  Ian Lance Taylor  <iant@google.com>
11552
11553         * layout.cc (Layout::make_output_section): Call
11554         Target::new_output_section.
11555         (Layout::attach_allocated_section_to_segment): Put large section
11556         sections in a separate load segment with the large segment flag
11557         set.
11558         (Layout::segment_precedes): Sort large data segments after other
11559         load segments.
11560         (align_file_offset): New static function.
11561         (Layout::set_segment_offsets): Use align_file_offset.
11562         * output.h (class Output_section): Add is_small_section_ and
11563         is_large_section_ fields.
11564         (Output_section::is_small_section): New function.
11565         (Output_section::set_is_small_section):  New function.
11566         (Output_section::is_large_section): New function.
11567         (Output_section::set_is_large_section): New function.
11568         (Output_section::is_large_data_section): New function.
11569         (class Output_segment): Add is_large_data_segment_ field.
11570         (Output_segment::is_large_data_segment): New function.
11571         (Output_segment::set_is_large_data_segment): New function.
11572         * output.cc (Output_section::Output_section): Initialize new
11573         fields.
11574         (Output_segment::Output_segment): Likewise.
11575         (Output_segment::add_output_section): Add assertion that large
11576         data sections always go in large data segments.  Force small data
11577         sections to the end of the list of data sections.  Force small BSS
11578         sections to the start of the list of BSS sections.  For large BSS
11579         sections to the end of the list of BSS sections.
11580         * symtab.h (class Symbol): Declare is_common_shndx.
11581         (Symbol::is_defined): Check Symbol::is_common_shndx.
11582         (Symbol::is_common): Likewise.
11583         (class Symbol_table): Define enum Commons_section_type.  Update
11584         declarations.  Add small_commons_ and large_commons_ fields.
11585         * symtab.cc (Symbol::is_common_shndx): New function.
11586         (Symbol_table::Symbol_table): Initialize new fields.
11587         (Symbol_table::add_from_object): Put small and large common
11588         symbols in the right list.
11589         (Symbol_table::sized_finalized_symbol): Check
11590         Symbol::is_common_shndx.
11591         (Symbol_table::sized_write_globals): Likewise.
11592         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11593         common symbol lists.  Don't call do_allocate_commons_list if the
11594         list is empty.
11595         (Symbol_table::do_allocate_commons_list): Remove is_tls
11596         parameter.  Add comons_section_type parameter.  Change all
11597         callers.  Handle small and large common symbols.
11598         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11599         Symbol::is_common_shndx.
11600         * resolve.cc (symbol_to_bits): Likewise.
11601         * target.h (Target::small_common_shndx): New function.
11602         (Target::small_common_section_flags): New function.
11603         (Target::large_common_shndx): New function.
11604         (Target::large_common_section_flags): New function.
11605         (Target::new_output_section): New function.
11606         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11607         small_common_section_flags, and large_common_section_flags
11608         fields.
11609         (Target::do_new_output_section): New virtual function.
11610         * arm.cc (Target_arm::arm_info): Initialize new fields.
11611         * i386.cc (Target_i386::i386_info): Likewise.
11612         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11613         Likewise.
11614         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11615         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11616         (Target_x86_64::do_new_output_section): New function.
11617         * configure.ac: Define conditional MCMODEL_MEDIUM.
11618         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11619         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11620         (large_LDFLAGS): Define.
11621         * testsuite/large.c: New file.
11622         * testsuite/testfile.cc (Target_test::test_target_info):
11623         Initialize new fields.
11624         * configure, testsuite/Makefile.in: Rebuild.
11625
11626 2009-06-05  Doug Kwan  <dougkwan@google.com>
11627
11628         * Makefile.am (CCFILES): Add target.cc.
11629         * Makefile.in: Regenerate.
11630         * i386.cc (class Target_i386): Define new virtual method to
11631         override do_is_local_label_name in parent.
11632         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11633         local symbols if --discard-locals or -X is given.
11634         * options.h (class General_options): Declare new options
11635         '--discard-locals' and '-X' for discarding locals.
11636         * target.h (class Target): Define new methods is_local_label_name.
11637         Declare new virtual method do_is_local_label_name.
11638         * target.cc: New file.
11639         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11640         (check_SCRIPTS): Add discard_locals_test.sh.
11641         (check_DATA): Add discard_local_tests.syms.
11642         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11643         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11644         * testsuite/Makefile.in: Regenerate.
11645         * testsuite/discard_locals_test.c: New file.
11646         * testsuite/discard_locals_test.sh: Same.
11647
11648 2009-06-05  Doug Kwan  <dougkwan@google.com>
11649
11650         * object.cc (Sized_relobj::Sized_relobj): Initialize
11651         discarded_eh_frame_shndx_ to -1U.
11652         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11653         section.
11654         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11655         a discarded .eh_frame section.
11656         (Sized_relobj::do_finalize_local_symbols): Ditto.
11657         * object.h (class Sized_relobj): Declare new member
11658         discarded_eh_frame_shndx_.
11659         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11660         (local_labels_test.o, local_labels_test): New rules.
11661         * testsuite/Makefile.in: Regenerate.
11662
11663 2009-06-04  Doug Kwan  <dougkwan@google.com>
11664
11665         * layout.cc (Layout::section_name_mapping): Add mapping for
11666         special ARM sections.
11667
11668 2009-06-03  Doug Kwan  <dougkwan@google.com>
11669
11670         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11671         (utils::has_overflow): Same.
11672
11673 2009-06-03  Ian Lance Taylor  <iant@google.com>
11674
11675         * layout.cc (Layout::section_name_mapping): New array, replacing
11676         Layout::linkonce_mapping.
11677         (Layout::section_name_mapping_count): New variable, replacing
11678         Layout::linkonce_mapping_count.
11679         (Layout::linkonce_output_name): Remove.
11680         (Layout::output_section_name): Rewrite.
11681         * layout.h (class Layout): Rename Linkonce_mapping to
11682         Section_name_mapping, linkonce_mapping to section_name_mapping,
11683         linkonce_mapping_count to section_name_mapping_count.  Don't
11684         declare linkonce_output_name.
11685
11686 2009-06-03  Doug Kwan  <dougkwan@google.com>
11687
11688         * gold/arm.cc (namespace utils): New.
11689         (Target_arm::reloc_is_non_pic): Define new method.
11690         (class Arm_relocate_functions): New.
11691         (Target_arm::Relocate::relocate): Handle relocation types used by
11692         Android.
11693
11694 2009-06-03  Ian Lance Taylor  <iant@google.com>
11695
11696         * arm.cc (Target_arm::scan::global): Use || instead of |.
11697
11698 2009-06-02  Doug Kwan  <dougkwan@google.com>
11699
11700         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11701         issued_non_pic_error_.
11702         (class Target_arm::Scan): Declare new method check_non_pic.
11703         Define new method symbol_needs_plt_entry.
11704         Declare new data member issued_non_pic_error_.
11705         (class Target_arm::Relocate): Declare new method
11706         should_apply_static_reloc.
11707         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11708         (Target_arm::Scan::check_non_pic): Define new method.
11709         (Target_arm::Scan::local): Handle a small subset of reloc types used
11710         by Android.
11711         (Target_arm::Scan::local): Same.
11712         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11713
11714 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11715
11716         * incremental.cc (Incremental_inputs::report_command_line): Filter
11717         out --incremental-* options.
11718
11719 2009-05-29  Doug Kwan  <dougkwan@google.com>
11720
11721         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11722         template class.
11723         (class Target_arm): Update comment.
11724         (Target_arm::Target_arm): Initialize new data members GOT_,
11725         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11726         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11727         and Target_arm::rel_dyn_section.
11728         Declare new_enum Target_arm::Got_type.
11729         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11730         and DYNBSS_.
11731         Update commments for member do_dynsym_value.
11732         (Target_arm::got_size, Target_arm::plt_section,
11733         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11734         new methods inside class defintion.
11735         (Target_arm::got_section): Define new method.
11736         (Target_arm::rel_dyn_section): Same.
11737         (Output_data_plt_arm): New template class.
11738         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11739         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11740         (Output_data_plt_arm::add_entry): Same.
11741         (Output_data_plt_arm::first_plt_entry): Define new
11742         static data member for PLT instruction template.
11743         (Output_data_plt_arm::plt_entry): Same.
11744         (Output_data_plt_arm::do_write): Define new method.
11745         (Target_arm::make_plt_entry): Same.
11746         (Target_arm::do_finalize_sections): Same.
11747         (Target_arm::do_dynsym_value): Same.
11748
11749 2009-05-28  Doug Kwan  <dougkwan@google.com>
11750
11751         * Makefile.am (TARGETSOURCES): Add arm.cc.
11752         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11753         * Makefile.in: Regenerate.
11754         * arm.cc: New file.
11755         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11756
11757 2009-05-26  Doug Kwan  <dougkwan@google.com>
11758
11759         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11760         (General_options::check_excluded_libs): Strip off directories in
11761         archive name before matching like GNU ld does.
11762         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11763         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11764         (exclude_libs_test_LDFLAGS): Add linker option
11765         -Wl,--exclude-libs,libexclude_libs_test_3
11766         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11767         an explicit archive without using -l.
11768         (alt/libexclude_libs_test_3.a): New make rule.
11769         * testsuite/Makefile.in: Regenerate.
11770         * testsuite/exclude_libs_test.c : Declare lib3_default().
11771         (main): Call it.
11772         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11773         * exclude_libs_test_3.c: New file.
11774
11775 2009-05-26  Nick Clifton  <nickc@redhat.com>
11776
11777         * po/id.po: New Indonesian translation.
11778         * po/gold.pot: Updated template file.
11779
11780 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11781
11782         * testsuite/Makefile.am: Add -ffunction-sections to compile
11783         gc_comdat_test files.  Add -Wl,--gc-sections to build
11784         gc_comdat_test.
11785         * testsuite/Makefile.in: Regenerate.
11786         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11787
11788 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11789
11790         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11791         kept comdat section was garbage collected.
11792         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11793         * testsuite/Makefile.in: Regenerate.
11794         * testsuite/gc_comdat_test.sh: New file.
11795         * testsuite/gc_comdat_test_1.cc: New file.
11796         * testsuite/gc_comdat_test_2.cc: New file.
11797
11798 2009-05-19  Doug Kwan  <dougkwan@google.com>
11799
11800         * archive.cc (Archive::Archive): Move constructor from archive.h
11801         to here.  Initialize no_export_.
11802         (Archive::get_elf_object_for_member): Set no_export flag of object.
11803         * archive.h (Archive::Archive): Move constructor body to
11804         archive.cc.
11805         (Archive::no_export): New method.
11806         (Archive::no_export_): New field.
11807         * object.h (Object::Object): Initialize no_export_ to false.
11808         (Object::no_export, Object::set_no_export): New methods.
11809         (Object::no_export_): New field.
11810         * options.cc (General_options::parse_exclude_libs): New method.
11811         (General_options::check_excluded_libs) Same.
11812         * options.h (exclude_libs): New option.
11813         (General_options::check_excluded_libs): New method declaration.
11814         (General_options::excluded_libs_): New field.
11815         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11816         default or protected visibility if an object has no-export flag set.
11817         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11818         (check_SCRIPTS): Add exclude_libs_test.sh.
11819         (check_DATA): Add exclude_libs_test.syms.
11820         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11821         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11822         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11823         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11824         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11825         libexclude_libs_test_2.a): New rules.
11826         * testsuite/Makefile.in: Regenerate.
11827         * testsuite/exclude_libs_test.c: New file.
11828         * testsuite/exclude_libs_test.sh: Ditto.
11829         * testsuite/exclude_libs_test_1.c: Ditto.
11830         * testsuite/exclude_libs_test_2.c: Ditto.
11831
11832 2009-05-15  Ian Lance Taylor  <iant@google.com>
11833
11834         * configure.ac: Check for declarations for cases where libiberty.h
11835         checks HAVE_DECL_xxx.
11836         * configure, config.in: Rebuild.
11837
11838 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11839
11840         * gold.h (Incremental_argument_list): Remove (invalid) forward
11841         declaration.
11842         * incremental.cc (Incremental_inputs::report_achive): New method.
11843         (Incremental_inputs::report_object): New method.
11844         (Incremental_inputs::report_script): New method.
11845         (Incremental_inputs::finalize_inputs): New method.
11846         (Incremental_inputs::finalize): Call finalize_inputs().
11847         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11848         Create inputs entries.
11849         * incremental.h (Incremental_input_type): New enum.
11850         (Incremental_inputs::Incremental_input): Initialize new fields.
11851         (Incremental_inputs::report_inputs): New method.
11852         (Incremental_inputs::report_achive): New method.
11853         (Incremental_inputs::report_object): New method.
11854         (Incremental_inputs::report_script): New method.
11855         (Incremental_inputs::finalize_inputs): New method.
11856         (Incremental_inputs::Input_info): New struct.
11857         (Incremental_inputs::Input_info_map): New typedef.
11858         (Incremental_inputs::lock_): New field.
11859         (Incremental_inputs::Inputs_): New field.
11860         (Incremental_inputs::Inputs_map): New field.
11861         * main.cc (main): Call Incremental_input::report_inputs.
11862         * options.h (Input_argument_list): Typedef moved from
11863         Input_arguments.
11864         (Input_file_group::Files): Remove, use ::Input_argument_list.
11865         (Input_file_group::Input_argument_list): Remove, use
11866         ::Input_argument_list.
11867         * plugin.cc (Plugin_manager::add_input_file): Add error in
11868         incremental build.
11869         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11870         functions.
11871         * script.cc (read_input_script): Call
11872         Incremental_input::report_script.
11873         * script.h (Script_info): New class.
11874
11875 2009-04-27  Ian Lance Taylor  <iant@google.com>
11876
11877         * x86_64.cc (do_adjust_output_section): Set entsize to
11878         plt_entry_size.
11879
11880 2009-04-23  Elliott Hughes  <enh@google.com>
11881
11882         * output.cc (Output_file::close): After short writes, continue
11883         writing from the correct offset in the buffer being written.
11884
11885 2009-04-23  Chris Demetriou  <cgd@google.com>
11886
11887         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11888         * configure: Regenerate.
11889         * config.in: Regenerate.
11890         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11891         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11892
11893 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11894
11895         * incremental.cc (Incremental_inputs_header_data): Renamed from
11896         Incremental_input_header_data.
11897         (Incremental_inputs_header_data::data_size): New field.
11898         (Incremental_inputs_header_data::put_input_file_count): Renamed
11899         from input_file_count.
11900         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11901         from command_line_offset.
11902         (Incremental_inputs_header_data::put_reserved): Renamed from
11903         put_reserved.
11904         (Incremental_inputs_entry_data): Renamed from
11905         Incremental_input_entry_data.
11906         (Incremental_inputs_entry_data::data_size): New field.
11907         (Incremental_inputs::report_command_line): New method.
11908         (Incremental_inputs::finalize): New method.
11909         (Incremental_inputs::create_incremental_inputs_data): New method.
11910         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11911         * incremental.h: New file.
11912         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11913         (Layout::finalize): Create incremental inputs section in
11914         incremental builds.
11915         (Layout::create_incremental_info_sections): New method.
11916         * layout.h (Layout::incremental_inputs): New method.
11917         (Layout::create_incremental_info_sections): New method.
11918         (Layout::incremental_inputs_): New field.
11919         * main.cc (main): Notify Incremental_input of the command line.
11920
11921 2009-04-01  Ian Lance Taylor  <iant@google.com>
11922             Mikolaj Zalewski  <mikolajz@google.com>
11923
11924         * gold.h (reserve_unordered_map): Define, three versions, one for
11925         each version of Unordered_map.
11926         * layout.cc (Layout::Layout): Remove options parameter.  Add
11927         number_of_input_files parameter.  Don't initialize options_.
11928         Initialize number_of_input_files_ and resized_signatures_.  Move
11929         sections_are_attached_.
11930         (Layout::layout_group): Reserve space for group_signatures_.
11931         (Layout::find_or_add_kept_section): Change name parameter to be a
11932         reference.  Resize signatures_ map when it gets large enough.
11933         (Layout::layout_eh_frame): Use parameters->options() instead of
11934         this->options_.
11935         (Layout::make_output_section): Likewise.
11936         (Layout::attach_allocated_section_to_segment): Likewise.
11937         (Layout::finalize, Layout::create_executable_stack): Likewise.
11938         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11939         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11940         * layout.h (class Layout): Update declarations.  Remove options_
11941         field.  Add number_of_input_files_ and resized_signatures_
11942         fields.  Move sections_are_attached_ field.
11943         * main.cc (main): Pass number of input files to Layout
11944         constructor.  Don't pass options.
11945
11946 2009-03-30  Ian Lance Taylor  <iant@google.com>
11947
11948         * ffsll.c (ffsll): Correct implementation.
11949
11950 2009-03-27  Ian Lance Taylor  <iant@google.com>
11951
11952         * ffsll.c: New file.
11953         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11954         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11955         * ftruncate.c (ftruncate): Declare before definition.
11956         * mremap.c (mremap): Likewise.
11957         * pread.c (pread): Likewise.
11958         * configure, Makefile.in, config.in: Rebuild.
11959
11960         * mremap.c: New file.
11961         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11962         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11963         (mremap): Declare if HAVE_MREMAP is not defined.
11964         * configure, Makefile.in, config.in: Rebuild.
11965
11966 2009-03-27  Cary Coutant  <ccoutant@google.com>
11967
11968         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11969         position independent.
11970         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11971         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11972
11973 2009-03-24  Cary Coutant  <ccoutant@google.com>
11974
11975         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11976         an executable.
11977         (needs_dynamic_reloc): Likewise.
11978
11979 2009-03-24  Ian Lance Taylor  <iant@google.com>
11980
11981         * yyscript.y (file_cmd): Recognize EXTERN.
11982         (extern_name_list, extern_name_list_body): New nonterminals.
11983         * script.cc (script_add_extern): Define.
11984         * script-c.h (script_add_extern): Declare.
11985
11986 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11987
11988         * object.cc (is_elf_object): Define.
11989         * object.h (is_elf_object): Declare.
11990         * archive.cc (Archive::get_elf_object_for_member): Call
11991         is_elf_object.
11992         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11993
11994 2009-03-24  Elliott Hughes  <enh@google.com>
11995
11996         * output.cc (Output_file::map_anonymous): Define.
11997         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11998         try an anonymous one.  Report the size if the mmap fails.
11999         * output.h (class Output_file): Declare map_anonymous.
12000
12001 2009-03-24  Ian Lance Taylor  <iant@google.com>
12002
12003         * target-select.cc (instantiate_target): Don't acquire the lock if
12004         the instantiated_target_ field has already been set.
12005
12006 2009-03-23  Ian Lance Taylor  <iant@google.com>
12007
12008         * gold-threads.h (class Initialize_lock): Define.
12009         * gold-threads.cc (class Initialize_lock_once): Define.
12010         (initialize_lock_control): New static variable.
12011         (initialize_lock_pointer): New static variable.
12012         (initialize_lock_once): New static function.
12013         (Initialize_lock::Initialize_lock): Define.
12014         (Initialize_lock::initialize): Define.
12015         * target-select.h: Include "gold-threads.h".
12016         (class Target_selector): Add lock_ and initialize_lock_ fields.
12017         Don't define instantiate_target, just declare it.
12018         * target-select.cc (Target_selector::Target_selector): Initialize
12019         new fields.
12020         (Target_selector::instantiate_target): Define.
12021         * descriptors.h: Include "gold-threads.h".
12022         (class Descriptors): Add initialize_lock_ field.
12023         * descriptors.cc (Descriptors::Descriptors): Initialize new
12024         field.
12025         (Descriptors::open): Use initialize_lock_ field
12026         * errors.h (class Errors): Add initialize_lock_ field.
12027         * errors.cc (Errors::Errors): Initialize new field.
12028         (Errors::initialize_lock): Use initialize_lock_ field.
12029         * powerpc.cc (class Target_selector_powerpc): Remove
12030         instantiated_target_ field.  In do_recognize call
12031         instantiate_target rather than do_instantiate_target.  In
12032         do_instantiate_target just allocate a new target.
12033         * sparc.cc (class Target_selector_sparc): Likewise.
12034
12035         * freebsd.h: New file.
12036         * i386.cc: Include "freebsd.h".
12037         (Target_i386): Derive from Target_freebsd rather than
12038         Sized_target.
12039         (Target_selector_i386): Derive from Target_selector_freebsd rather
12040         than Target_selector.
12041         * x86_64.cc: Include "freebsd.h".
12042         (Target_x86_64): Derive from Target_freebsd rather than
12043         Sized_target.
12044         (Target_selector_x86_64): Derive from Target_selector_freebsd
12045         rather than Target_selector.
12046         * target.h (class Target): Add adjust_elf_header and
12047         do_adjust_elf_header.
12048         * output.cc (Output_file_header:: do_sized_write): Call target
12049         adjust_elf_header routine.
12050         * configure.tgt: Set targ_osabi.
12051         * configure.ac: Define GOLD_DEFAULT_OSABI.
12052         * parameters.cc (Parameters::default_target): Pass
12053         GOLD_DEFAULT_OSABI to select_target.
12054         * target-select.h (class Target_selector): Make instantiate_target
12055         protected rather than private.
12056         * Makefile.am (HFILES): Add freebsd.h.
12057         * configure, Makefile.in, config.in: Rebuild.
12058
12059         * merge.cc (do_add_input_section): Correct pend value.  Change
12060         message about last entry not being null terminated from error to
12061         warning.
12062
12063 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12064
12065         * incremental.cc: New file.
12066         * Makefile.am (CCFILES): Add incremental.cc.
12067         * Makefile.in: Rebuild.
12068
12069 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12070
12071         * layout.cc (Layout::output_section_name): Preserve names
12072         of '.note.' sections.
12073
12074 2009-03-19  Ian Lance Taylor  <iant@google.com>
12075
12076         * descriptors.cc (Descriptors::open): Check that the options are
12077         valid before using them.
12078
12079 2009-03-18  Ian Lance Taylor  <iant@google.com>
12080
12081         * script-sections.h: Include <list>.
12082         (class Script_sections): Change Sections_elements from std::vector
12083         to std::list.  Typedef public Elements_iterator.  Add
12084         orphan_section_placement_, data_segment_align_start_, and
12085         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12086         field.
12087         * script-sections.cc (class Orphan_section_placement): New class.
12088         (class Sections_element): Add virtual functions is_relro and
12089         orphan_section_init.  Remove virtual function place_orphan_here.
12090         (class Output_section_definition): Add is_relro and
12091         orphan_section_init.  Remove place_orphan_here.
12092         (class Orphan_output_section): Likewise.
12093         (Script_sections::Script_sections): Update for field changes.
12094         (Script_sections::data_segment_align): Set saw_data_segment_align_
12095         and data_segment_align_start_, not data_segment_align_index.
12096         (Script_sections::data_segment_relro_end): Check
12097         saw_data_segment_align_.  Use data_segment_align_start_ rather
12098         than data_segment_align_index_.
12099         (Script_sections::place_orphan): Rewrite to use
12100         Orphan_section_placement.
12101
12102 2009-03-17  Ian Lance Taylor  <iant@google.com>
12103
12104         * archive.cc (Archive::add_symbols): Check for a version attached
12105         to the symbol name in the archive map.
12106         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12107         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12108         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12109         (ver_test_11.a): New target.
12110         * testsuite/Makefile.in: Rebuild.
12111
12112         * configure.ac: Check for chsize and posix_fallocate.  Replace
12113         ftruncate.
12114         * ftruncate.c: New file, from gnulib.
12115         * output.cc (posix_fallocate): Define dummy version if not
12116         HAVE_POSIX_FALLOCATE.
12117         (Output_file::map): Call posix_fallocate rather than lseek and
12118         write.
12119         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12120         * configure, Makefile.in, config.in: Rebuild.
12121
12122 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12123
12124         * layout.h (Layout::create_note): Add section_name parameter.
12125         * layout.cc (Layout::create_note): Likewise.
12126         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12127
12128 2009-03-17  Ian Lance Taylor  <iant@google.com>
12129
12130         * descriptors.cc: Include "options.h".
12131         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12132         (Descriptors::open): Always use O_CLOEXEC when opening a new
12133         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12134         then set FD_CLOEXEC.
12135
12136         * sparc.cc (class Target_sparc): Add has_got_section.
12137         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12138         make sure we have a GOT section.
12139
12140         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12141         (Target_sparc::Scan::local): Likewise.
12142         (Target_sparc::Scan::global): Likewise.
12143         (Target_sparc::Relocate::relocate): Likewise.
12144         (Target_sparc::Relocate::relocate_tls): Likewise.
12145
12146         * symtab.cc (Symbol_table::define_default_version): New function,
12147         broken out of add_from_object.
12148         (Symbol_table::add_from_object): Call define_default_version.
12149         (Symbol_table::define_special_symbol): Add resolve_oldsym
12150         parameter.  Change all callers.  If the version for a symbol comes
12151         from a version script, resolve it with the symbol with the same
12152         name with no version.  Also add the symbol without a version if
12153         appropriate.
12154         (do_define_in_output_data): If resolving with oldsym, don't delete
12155         sym.
12156         (do_define_in_output_segment): Likewise.
12157         (do_define_as_constant): Likewise.
12158         * symtab.h (class Symbol_table): Update declarations.
12159
12160 2009-03-13  Ian Lance Taylor  <iant@google.com>
12161
12162         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12163         (Read_symbols::requeue): New function.
12164         (Read_symbols::do_read_symbols): If make_elf_object fails because
12165         the target type is not configured, and the file was searched for,
12166         issue a warning and retry with the next directory.
12167         (Add_symbols::run): If the file has an incompatible format, and
12168         it was searched for, requeue the Read_symbols task.  On error,
12169         release the object.
12170         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12171         dirindex parameter to constructor.  Change all callers.  Declare
12172         incompatible_warning and requeue.
12173         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12174         input_argument_ and input_group_ fields.  Add them to
12175         constructor.  Change all callers.
12176         (class Read_script): Add dirindex_ field.  Add it to constructor.
12177         Change all callers.
12178         * archive.cc (Archive::setup): Remove input_objects parameter.
12179         Change all callers.
12180         (Archive::get_file_and_offset): Likewise.
12181         (Archive::read_all_symbols): Likewise.
12182         (Archive::read_symbols): Likewise.
12183         (Archive::get_elf_object_for_member): Remove input_objects
12184         parameter.  Add punconfigured parameter.  Change all callers.
12185         (Archive::add_symbols): Change return type to bool.  Check return
12186         value of include_member.
12187         (Archive::include_all_members): Likewise.
12188         (Archive::include_member): Change return type to bool.  Return
12189         false if first included object has incompatible target.  Set
12190         included_member_ field.
12191         (Add_archive_symbols::run): If add_symbols returns false, requeue
12192         Read_symbols task.
12193         * archive.h (class Archive): Add included_member_ field.
12194         Initialize it in constructor.  Add input_file and searched_for
12195         methods.  Update declarations.
12196         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12197         input_argument_ fields.  Add them to constructor.  Change all
12198         callers.
12199         * script.cc: Include "target-select.h".
12200         (class Parser_closure): Add skip_on_incompatible_target_ and
12201         found_incompatible_target_ fields.  Add
12202         skip_on_incompatible_target parameter to constructor.  Change all
12203         callers.  Add methods skip_on_incompatible_target,
12204         clear_skip_on_incompatible_target, found_incompatible_target, and
12205         set_found_incompatible_target.
12206         (read_input_script): Add dirindex parameter.  Change all callers.
12207         If parser finds an incompatible target, requeue Read_symbols
12208         task.
12209         (script_set_symbol): Clear skip_on_incompatible_target in
12210         closure.
12211         (script_add_assertion, script_parse_option): Likewise.
12212         (script_start_sections, script_add_phdr): Likewise.
12213         (script_check_output_format): New function.
12214         * script.h (read_input_script): Update declaration.
12215         * script-c.h (script_check_output_format): Declare.
12216         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12217         (ignore_cmd): Remove OUTPUT_FORMAT.
12218         * fileread.cc (Input_file::Input_file): Add explicit this.
12219         (Input_file::will_search_for): New function.
12220         (Input_file::open): Add pindex parameter.  Change all callers.
12221         * fileread.h (class Input_file): Add input_file_argument method.
12222         Declare will_search_for.  Update declarations.
12223         * object.cc (make_elf_object): Add punconfigured parameter.
12224         Change all callers.
12225         * object.h (class Object): Make input_file public.  Add
12226         searched_for method.
12227         (make_elf_object): Update declaration.
12228         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12229         restart search.
12230         * dirsearch.h (class Dirsearch): Update declaration.
12231         * options.h (class General_options): Add --warn-search-mismatch.
12232         * parameters.cc (Parameters::is_compatible_target): New function.
12233         * parameters.h (class Parameters): Declare is_compatible_target.
12234         * workqueue.cc (Workqueue::add_blocker): New function.
12235         * workqueue.h (class Workqueue): Declare add_blocker.
12236
12237         * fileread.cc (Input_file::open): Remove options parameter.
12238         Change all callers.
12239         (Input_file::open_binary): Likewise.
12240         * script.cc (read_input_script): Likewise.
12241         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12242         options parameter from constructor.  Change all callers.
12243         (class Read_script): Likewise.
12244         * fileread.h (class Input_file): Update declarations.
12245         * script.h (read_input_script): Update declaration.
12246
12247 2009-03-10  Nick Clifton  <nickc@redhat.com>
12248
12249         * po/es.po: New Spanish translation.
12250
12251 2009-03-06  Cary Coutant  <ccoutant@google.com>
12252
12253         * options.cc (parse_short_option): Keep dash_z from registering itself.
12254
12255 2009-03-03  Ian Lance Taylor  <iant@google.com>
12256
12257         PR 9918
12258         * target-reloc.h (relocate_section): Pass output_section to
12259         relocate.
12260         * i386.cc (Target_i386::should_apply_static_reloc): Add
12261         output_section parameter.  Change all callers.
12262         (Target_i386::Relocate::relocate): Add output_section parameter.
12263         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12264         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12265         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12266         * testsuite/two_file_shared.sh: New script.
12267         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12268         (check_DATA): Add two_file_shared.dbg.
12269         (two_file_shared.dbg): New target.
12270         * testsuite/Makefile.in: Rebuild.
12271
12272 2009-03-01  Ian Lance Taylor  <iant@google.com>
12273
12274         * configure.ac: Check for byteswap.h.
12275         * configure: Rebuild.
12276         * config.in: Rebuild.
12277
12278 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12279
12280         * layout.cc (Layout::find_or_add_kept_section): New function.
12281         (Layout::add_comdat): Removed.
12282         * layout.h (struct Kept_section): Move out of class Layout.
12283         Remove trailing underscores from field names.  Add group_sections
12284         field.  Rename group_ field to is_group.  Change all uses.
12285         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12286         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12287         comdat_groups_ field.
12288         (Sized_relobj::include_section_group): Use
12289         find_or_add_kept_section and Kept_section::group_sections.
12290         (Sized_relobj::include_linkonce_section): Likewise.
12291         * object.cc (class Sized_relobj): Don't define Comdat_group or
12292         Comdat_group_table.  Remove find_comdat_group and
12293         add_comdat_group.  Remove comdat_groups_ field.
12294         * plugin.cc (include_comdat_group): Use
12295         Layout::find_or_add_kept_section.
12296
12297 2009-02-28  Ian Lance Taylor  <iant@google.com>
12298
12299         * README: --gc-sections and map files are now supported.  Document
12300         some build requirements.
12301
12302         PR 6992
12303         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12304         relocatable link set the value of the section symbol to zero.
12305         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12306         relocatable link don't include the section address in the local
12307         symbol value.
12308
12309 2009-02-27  Ian Lance Taylor  <iant@google.com>
12310
12311         PR 6811
12312         * options.h (class Search_directory): Add is_system_directory.
12313         (class General_options): Declare is_in_system_directory.
12314         * options.cc (get_relative_sysroot): Make static.
12315         (get_default_sysroot): Make static.
12316         (General_optoins::is_in_system_directory): New function.
12317         * fileread.cc (Input_file::is_in_system_directory): New function.
12318         * fileread.h (class Input_file): Declare is_in_system_directory.
12319         * object.h (class Object): Add is_in_system_directory.
12320         (class Input_objects): Remove system_library_directory_ field.
12321         * object.cc (Input_objects::add_object): Don't set
12322         system_library_directory_.
12323         (input_objects::found_in_system_library_directory): Remove.
12324         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12325         parameter.  Change all callers.
12326         (Symbol_table::sized_write_globals): Likewise.
12327         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12328         Call Object::is_in_system_directory.
12329         * symtab.h (class Symbol_table): Update declarations.
12330
12331         PR 5990
12332         * descriptors.h (Open_descriptor): Add is_on_stack field.
12333         * descriptors.cc (Descriptors::open): If the descriptor is on the
12334         top of the stack, remove it.  Initialize is_on_stack field.
12335         (Descriptors::release): Only add pod to stack if it is not on the
12336         stack already.
12337         (Descriptors::close_some_descriptor): Clear stack_next and
12338         is_on_stack fields.
12339
12340         PR 7091
12341         * output.cc (Output_section::find_starting_output_address): Rename
12342         from starting_output_address; add PADDR parameter; change return
12343         type.
12344         * output.h (class Output_section): Declare
12345         find_starting_output_address instead of starting_output_address.
12346         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12347         section symbol for which we can't find a merge section.
12348
12349         PR 9836
12350         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12351         hidden or internal, force the symbol to be local.
12352         * resolve.cc (Symbol::override_visibility): Define.
12353         (Symbol::override_base): Use override_visibility.
12354         (Symbol_table::resolve): Likewise.
12355         (Symbol::override_base_with_special): Likewise.
12356         (Symbol_table::override_with_special): If the visibility is hidden
12357         or internal, force the symbol to be local.
12358         * symtab.h (class Symbol): Add set_visibility and
12359         override_visibility.
12360         * testsuite/ver_test_1.sh: New file.
12361         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12362         (check_DATA): Add ver_test_1.syms.
12363         (ver_test_1.syms): New target.
12364         * testsuite/Makefile.in: Rebuild.
12365
12366 2009-02-25  Cary Coutant  <ccoutant@google.com>
12367
12368         * layout.cc (Layout::choose_output_section): Don't rename sections
12369         when using a linker script that has a SECTIONS clause.
12370         * Makefile.in: Regenerate.
12371
12372         * testsuite/Makefile.am (script_test_5.sh): New test case.
12373         * testsuite/Makefile.in: Regenerate.
12374         * testsuite/script_test_5.cc: New file.
12375         * testsuite/script_test_5.sh: New file.
12376         * testsuite/script_test_5.t: New file.
12377
12378 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12379
12380         * archive.cc (Archive::include_member): Update calls to add_symbols.
12381         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12382         the Layout argument.
12383         * dynobj.h (do_add_symbols): Add the Layout argument.
12384         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12385         Layout argument.
12386         * object.h (Object::add_symbols): Add the Layout argument.
12387         (Object::do_add_symbols): Add the Layout argument.
12388         (Sized_relobj::do_add_symbols): Add the Layout argument.
12389         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12390         Unify the two versions.
12391         (Add_plugin_symbols): Remove.
12392         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12393         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12394         (Add_plugin_symbols): Remove.
12395         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12396         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12397         (Add_symbols::run): Make it work with Pulginobj.
12398
12399 2009-02-06  Ian Lance Taylor  <iant@google.com>
12400
12401         * object.cc (Sized_relobj::do_layout): Make info message start
12402         with lower case letter.
12403
12404 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12405
12406         * binary.cc: Fix file comment.
12407
12408         * options.h (enum Incremental_disposition): Define.
12409         (class General_options): Add new options: --incremental,
12410         --incremental_changed, --incremental_unchanged,
12411         --incremental_unknown.  Add incremental_disposition_ and
12412         implicit_incremental_ fields.
12413         (General_options::incremental_disposition): New function.
12414         (class Position_dependent_options): Add incremental_disposition
12415         option.
12416         (Position_dependent_options::copy_from_options): Set incremental
12417         dispositions.
12418         * options.cc (General_options::parse_incremental_changed): New
12419         function.
12420         (General_options::parse_incremental_unchanged): New function.
12421         (General_options::parse_incremental_unknown): New function.
12422         (General_options::General_options): Initialize new fields
12423         incremental_disposition_ and implicit_incremental_.
12424         (General_options::finalize): Check for uasge of --incremental-*
12425         without --incremental.
12426
12427 2009-02-06  Chris Demetriou  <cgd@google.com>
12428
12429         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12430         pointer and to report location as the file name associated with
12431         the symbol.
12432         (gold_undefined_symbol_at_location): New function to replace the
12433         old gold_undefined_symbol functionality.
12434         * target-reloc.h (relocate_section): Update to use
12435         gold_undefined_symbol_at_location.
12436         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12437         Call gold_undefined_symbol function rather than gold_error.
12438         * errors.h (Errors::undefined_symbol): Take location as a
12439         string, rather than calculating it from a relocation.
12440         * errors.cc (Errors::fatal): Print "fatal error:" before the
12441         formatted message.
12442         (Errors::error, Errors::error_at_location): Print "error: "
12443         before the formatted message.
12444         (Errors::undefined_symbol): Take location as a string, rather
12445         than calculating it from a relocation.
12446         (gold_undefined_symbol_at_location): New function akin to
12447         old gold_undefined_symbol, calculates location from relocation.
12448         (gold_undefined_symbol): Change to take only a Symbol pointer
12449         and to report location as the file name associated with the symbol.
12450         * testsuite/debug_msg.sh: Update for changed error messages.
12451         * testsuite/undef_symbol.sh: Likewise.
12452
12453 2009-02-04  Duncan Sands  <baldrick@free.fr>
12454
12455         PR 9812
12456         * reduced_debug_output.h
12457         (Output_reduced_debug_abbrev_section::failed): Use format for
12458         gold_warning.
12459         (Output_reduced_debug_info_section::faild): Likewise.
12460
12461 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12462
12463         * script.cc (Lazy_demangler): New class.
12464         (Version_script_info::get_symbol_version_helper): Demangle a
12465         symbol only once.
12466
12467 2009-01-29  Cary Coutant  <ccoutant@google.com>
12468
12469         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12470         to __tls_get_addr.
12471         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12472
12473 2009-01-28  Ian Lance Taylor  <iant@google.com>
12474
12475         * version.cc (version_string): Bump to 1.9.
12476
12477         * gold.h: Include <cstring> and <stdint.h>.
12478         * version.cc: Include <cstdio>.
12479         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12480         warning.
12481         * reduced_debug_output.cc (insert_into_vector): Rename from
12482         Insert_into_vector; change all callers.  Use Swap_unaligned to
12483         avoid aliasing issue; remove union since it is unnecessary.
12484
12485 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12486
12487         * Makefile.am (CCFILES): Add gc.cc.
12488         (HFILES): Add gc.h.
12489         * Makefile.in: Regenerate.
12490         * gold.cc (Gc_runner): New class.
12491         (queue_initial_tasks): Call garbage collection related tasks
12492         when corresponding options are invoked.
12493         (queue_middle_gc_tasks): New function.
12494         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12495         processed early before laying out sections during garbage collection.
12496         * gold.h (queue_middle_gc_tasks): New function.
12497         (is_prefix_of): Move from "layout.cc".
12498         * i386.cc (Target_i386::gc_process_relocs): New function.
12499         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12500         * main.cc (main): Create object of class "Garbage_collection".
12501         * object.cc (Relobj::copy_symbols_data): New function.
12502         (Relobj::is_section_name_included): New function.
12503         (Sized_relobj::do_layout): Allow this function to be called twice
12504         during garbage collection and defer layout of section during the
12505         first call.
12506         * object.h (Relobj::get_symbols_data): New function.
12507         (Relobj::is_section_name_included): New function.
12508         (Relobj::copy_symbols_data): New function.
12509         (Relobj::set_symbols_data): New function.
12510         (Relobj::get_relocs_data): New function.
12511         (Relobj::set_relocs_data): New function.
12512         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12513         (Relobj::gc_process_relocs): New function.
12514         (Relobj::do_gc_process_relocs): New pure virtual function.
12515         (Relobj::sd_): New data member.
12516         (Sized_relobj::is_output_section_offset_invalid): New function.
12517         (Sized_relobj::do_gc_process_relocs): New function.
12518         * options.h (General_options::gc_sections): Modify to not be a no-op.
12519         (General_options::print_gc_sections): New option.
12520         * plugin.cc (Plugin_finish::run): Remove function call to
12521         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12522         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12523         * reloc.cc (Read_relocs::run): Add task to process relocs and
12524         determine unreferenced sections when doing garbage collection.
12525         (Gc_process_relocs): New class.
12526         (Sized_relobj::do_gc_process_relocs): New function.
12527         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12528         sections that are garbage collected.
12529         * reloc.h (Gc_process_relocs): New class.
12530         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12531         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12532         symbols whose corresponding sections are garbage collected.
12533         (Symbol_table::Symbol_table): Add new parameter for the garbage
12534         collection object.
12535         (Symbol_table::gc_mark_undef_symbols): New function.
12536         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12537         (Symbol_table::gc_mark_dyn_syms): New function.
12538         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12539         as garbage.
12540         (Symbol_table::add_from_object): Likewise.
12541         (Symbol_table::add_from_relobj): When building shared objects, do not
12542         treat externally visible symbols as garbage.
12543         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12544         table information for static and relocatable links.
12545         * symtab.h (Symbol_table::set_gc): New function.
12546         (Symbol_table::gc): New function.
12547         (Symbol_table::gc_mark_undef_symbols): New function.
12548         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12549         (Symbol_table::gc_mark_dyn_syms): New function.
12550         (Symbol_table::gc_): New data member.
12551         * target.h (Sized_target::gc_process_relocs): New pure virtual
12552         function.
12553         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12554         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12555
12556 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12557
12558         * options.h (General_options::gc_sections): Define as a no-op for now.
12559         (General_options::no_keep_memory): Ditto.
12560         (General_options::Bshareable): Define.
12561         * options.cc (General_options::finalize): Honor -Bshareable.
12562
12563 2009-01-20  Andreas Schwab  <schwab@suse.de>
12564
12565         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12566         read the value in the contents, since we don't use it.  Use the
12567         template endianness when writing.
12568         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12569
12570 2009-01-19  Andreas Schwab  <schwab@suse.de>
12571
12572         * configure.tgt (powerpc64-*): Fix targ_obj.
12573
12574 2009-01-15  Ian Lance Taylor  <iant@google.com>
12575
12576         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12577         local symbols when stripping all symbols.
12578
12579 2009-01-14  Cary Coutant  <ccoutant@google.com>
12580
12581         * output.cc (Output_reloc): Add explicit instantiations.
12582
12583 2009-01-14  Cary Coutant  <ccoutant@google.com>
12584
12585         * archive.cc (Archive::get_elf_object_for_member): Remove call
12586         to File_read::claim_for_plugin.
12587         * descriptors.cc (Descriptors::open): Remove reference to
12588         is_claimed.
12589         (Descriptors::claim_for_plugin): Remove.
12590         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12591         (Descriptors::is_claimed): Remove.
12592         (claim_descriptor_for_plugin): Remove.
12593         * fileread.cc (File_read::claim_for_plugin): Remove.
12594         * fileread.h (File_read::claim_for_plugin): Remove.
12595         (File_read::descriptor): Reopen descriptor if necessary.
12596         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12597         (Plugin_manager::all_symbols_read): Add task parameter. Change
12598         all callers.
12599         (Plugin_manager::get_input_file): New function.
12600         (Plugin_manager::release_input_file): New function.
12601         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12602         corresponding data member.
12603         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12604         and pass to base constructor. Change all callers.
12605         (get_input_file, release_input_file): New functions.
12606         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12607         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12608         (Plugin_manager::all_symbols_read): Add task parameter.
12609         (Plugin_manager::get_input_file): New function.
12610         (Plugin_manager::release_input_file): New function.
12611         (Plugin_manager::task_): New data member.
12612         (Pluginobj::Pluginobj): Add filesize parameter.
12613         (Pluginobj::filename): New function.
12614         (Pluginobj::descriptor): New function.
12615         (Pluginobj::filesize): New function.
12616         (Pluginobj::filesize_): New data member.
12617         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12618         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12619         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12620
12621         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12622         with archive libraries.
12623         * testsuite/Makefile.in: Regenerate.
12624         * testsuite/plugin_test.c (struct sym_info): New type.
12625         (get_input_file, release_input_file): New static variables.
12626         (onload): Capture new transfer vector entries.
12627         (claim_file_hook): Stop reading at end of file according to filesize.
12628         Factor out parsing of readelf output into separate function.
12629         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12630         APIs and get the source file name from the symbol table.  Convert
12631         source file name to corresponding object file name.  Print info
12632         message when adding new input files.
12633         (parse_readelf_line): New function.
12634         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12635         * testsuite/plugin_test_2.sh: Likewise.
12636         * testsuite/plugin_test_3.sh: Likewise.
12637         * testsuite/plugin_test_4.sh: New test case.
12638
12639 2009-01-07  Ian Lance Taylor  <iant@google.com>
12640
12641         * version.cc (version_string): Bump to 1.8.
12642
12643 2008-12-23  Cary Coutant  <ccoutant@google.com>
12644
12645         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12646         * plugin.cc (Plugin_manager::finish): Rename as
12647         layout_deferred_objects.  Move cleanup to separate function.
12648         (Plugin_manager::cleanup): New function.
12649         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12650         separately.
12651         * plugin.h (Plugin_manager::finish): Rename as
12652         layout_deferred_objects.
12653         (Plugin_manager::cleanup): New function.
12654         (Plugin_manager::cleanup_done): New field.
12655
12656 2008-12-23  Cary Coutant  <ccoutant@google.com>
12657
12658         * plugin.cc (is_visible_from_outside): New function.
12659         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12660         so we don't return "IR only" status for exported symbols or -r links.
12661
12662         * testsuite/Makefile.am (plugin_test_3): New test case.
12663         * testsuite/Makefile.in: Regenerate.
12664         * testsuite/plugin_test_3.sh: New file.
12665
12666 2008-12-22  Cary Coutant  <ccoutant@google.com>
12667
12668         * object.cc (Sized_relobj::layout_section): New function.
12669         (Sized_relobj::do_layout): Defer layout of input sections until after
12670         plugin has provided replacement files.
12671         (Sized_relobj::do_layout_deferred_sections): New function.
12672         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12673         (Relobj::layout_deferred_sections): New function.
12674         (Relobj::do_layout_deferred_sections): New function.
12675         (Sized_relobj::do_layout_deferred_sections): New function.
12676         (Sized_relobj::layout_section): New function.
12677         (Sized_relobj::Deferred_layout): New structure.
12678         (Sized_relobj::deferred_layout_): New field.
12679         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12680         Change all callers.  Layout deferred sections.
12681         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12682         references.
12683         (Plugin_hook::run): Move code from do_plugin_hook inline.
12684         (Plugin_hook::do_plugin_hook): Remove.
12685         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12686         (Plugin_manager::finish): Renamed, was cleanup.
12687         (Plugin_manager::should_defer_layout): New function.
12688         (Plugin_manager::add_deferred_layout_object): New function.
12689         (Plugin_manager::Deferred_layout_list): New type.
12690         (Plugin_manager::deferred_layout_objects_): New field.
12691         (Plugin_hook::do_plugin_hook): Remove.
12692
12693 2008-12-17  Ian Lance Taylor  <iant@google.com>
12694
12695         * options.h (class General_options): Add --no case for
12696         --export-dynamic.
12697
12698 2008-12-16  Cary Coutant  <ccoutant@google.com>
12699
12700         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12701         vector.
12702         (Plugin_manager::claim_file): Create plugin object even if
12703         plugin did not call the add_symbols callback.
12704         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12705         asking for more symbols than were added.
12706         * testsuite/Makefile.am (plugin_test_1): Add test case with
12707         no global symbols.
12708         (empty.syms): New target.
12709         * testsuite/Makefile.in: Regenerate.
12710         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12711         message. Don't call add_symbols if no globals.
12712         (all_symbols_read_hook): Don't provide replacement for empty
12713         claimed file.
12714
12715 2008-12-12  Ian Lance Taylor  <iant@google.com>
12716
12717         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12718         r_type == 0 for a local symbol with r_sym == 0.
12719         (scan_relocatable_relocs): Pass r_sym to
12720         local_non_section_strategy.
12721         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12722         r_sym parameter.
12723
12724         * configure.ac: Update test for TLS descriptors: they are
12725         supported as of glibc 2.9.
12726         * configure: Rebuild.
12727
12728 2008-12-11  Ian Lance Taylor  <iant@google.com>
12729
12730         PR 7091
12731         * target-reloc.h (Default_scan_relocatable_relocs): For each
12732         function, map r_type == 0 to RELOC_DISCARD.
12733
12734 2008-12-10  Cary Coutant  <ccoutant@google.com>
12735
12736         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12737         object to override a kept COMDAT group from a plugin object.
12738
12739 2008-12-09  Ian Lance Taylor  <iant@google.com>
12740
12741         PR 7088
12742         * yyscript.y (file_cmd): Handle INPUT.
12743
12744         * testsuite/initpri1.c: Change all declarations to be full
12745         prototypes by adding void, to avoid compiler warnings.
12746
12747 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12748
12749         * options.cc (General_options::parse_plugin_opt): New.
12750         (General_options::add_plugin): The argument now is just the filename.
12751         (General_options::add_plugin_option): New.
12752         * options.h (plugin_opt): New.
12753         (add_plugin): Change argument name.
12754         (add_plugin_option): New.
12755         * plugin.cc (Plugin::load): Don't parse the plugin option.
12756         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12757         (Plugin::add_option): New.
12758         (Plugin::args_): Change type.
12759         (Plugin::filename_): New.
12760         (Plugin_manager::add_plugin_option): New.
12761         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12762         * testsuite/Makefile.in: Regenerate.
12763
12764 2008-12-05  Cary Coutant  <ccoutant@google.com>
12765
12766         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12767         Handle --strip-lto-sections option.
12768         * options.h (strip_lto_sections): New option.
12769
12770 2008-12-01  Cary Coutant  <ccoutant@google.com>
12771
12772         * plugin.cc (ld_plugin_message): Change format parameter to const.
12773         Fix mismatch between new[] and delete.
12774
12775 2008-11-14  Cary Coutant  <ccoutant@google.com>
12776
12777         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12778         instead of -1U.
12779
12780 2008-11-05  Craig Silverstein  <csilvers@google.com>
12781
12782         * options.cc (General_options::parse_dynamic_list): New function.
12783         * options.h (General_options): New flags dynamic_list,
12784         dynamic_list_data, dynamic_list_cpp_new, and
12785         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12786         (General_options::in_dynamic_list): New function.
12787         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12788         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12789         (Lex::can_continue_name): Likewise.
12790         (yylex): Likewise.
12791         (read_script_file): New parameter script_options.
12792         (read_dynamic_list): New function.
12793         (Script_options::define_dynamic_list): New function.
12794         (dynamic_list_keyword_parsecodes): New variable.
12795         (dynamic_list_keywords): New variable.
12796         * script.h (Script_options::define_dynamic_list): New function
12797         prototype.
12798         (read_dynamic_list): New function prototype.
12799         * symtab.cc (strprefix): New macro.
12800         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12801         dynamic_list_data, dynamic_list_cpp_new, and
12802         dynamic_list_cpp_typeinfo.
12803         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12804         (dynamic_list_expr): New rule.
12805         (dynamic_list_nodes): Likewise.
12806         (dynamic_list_node): Likewise.
12807         * testsuite/Makefile.am (dynamic_list): New test.
12808         * testsuite/Makefile.in: Regenerated.
12809         * testsuite/dynamic_list.t: New file.
12810         * testsuite/dynamic_list.sh: New file.
12811
12812 2008-11-05  Craig Silverstein  <csilvers@google.com>
12813
12814         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12815         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12816         (t11_last): Likewise.
12817         * testsuite/ver_test_6.c (main): Likewise.
12818
12819 2008-10-07  Cary Coutant  <ccoutant@google.com>
12820
12821         * options.c (General_options::finalize): Add check for -static and
12822         -shared.
12823         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12824         is not empty.
12825
12826 2008-10-02  Cary Coutant  <ccoutant@google.com>
12827
12828         * plugin.cc (make_sized_plugin_object): Fix conditional
12829         compilation to work when not all targets are enabled.
12830
12831 2008-09-29  Cary Coutant  <ccoutant@google.com>
12832
12833         * archive.cc (Archive::get_file_and_offset): Use filename instead
12834         of name to get library path.
12835         (Archive::include_member): Unlock external member of a thin archive.
12836
12837         * testsuite/Makefile.am (TEST_AR): New variable.
12838         (thin_archive_test_1): New test.
12839         (thin_archive_test_2): New test.
12840         * testsuite/Makefile.in: Regenerate.
12841         * testsuite/thin_archive_main.cc: New file.
12842         * testsuite/thin_archive_test_1.cc: New file.
12843         * testsuite/thin_archive_test_2.cc: New file.
12844         * testsuite/thin_archive_test_3.cc: New file.
12845         * testsuite/thin_archive_test_4.cc: New file.
12846
12847 2008-09-29  Cary Coutant  <ccoutant@google.com>
12848
12849         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12850         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12851         instead of -1U.
12852         (Sized_relobj::do_finalize_local_symbols): Likewise.
12853         (Sized_relobj::map_to_kept_section): Likewise.
12854         * object.h (Sized_relobj::invalid_address): New constant.
12855         (Sized_relobj::do_output_section_offset): Check for invalid_address
12856         and return -1ULL.
12857         * output.cc (Output_reloc::local_section_offset): Use constant
12858         invalid_address instead of -1U.
12859         (Output_reloc::get_address): Likewise.
12860         (Output_section::output_address): Change -1U to -1ULL.
12861         * output.h (Output_reloc::invalid_address): New constant.
12862         * reloc.cc (Sized_relobj::write_sections): Use constant
12863         invalid_address instead of -1U.
12864         (Sized_relobj::relocate_sections): Likewise.
12865         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12866         values for merge sections.
12867         * target-reloc.h (relocate_for_relocatable): Use constant
12868         invalid_address instead of -1U.
12869
12870 2008-09-19  Cary Coutant  <ccoutant@google.com>
12871
12872         Add plugin functionality for link-time optimization (LTO).
12873         * configure.ac (plugins): Add --enable-plugins option.
12874         * configure: Regenerate.
12875         * config.in: Regenerate.
12876         * Makefile.am (LIBDL): New variable.
12877         (CCFILES): Add plugin.cc.
12878         (HFILES): Add plugin.h.
12879         (ldadd_var): Add LIBDL.
12880         * Makefile.in: Regenerate.
12881
12882         * archive.cc: Include "plugin.h".
12883         (Archive::setup): Don't preread archive symbols when using a plugin.
12884         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12885         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12886         files.
12887         (Archive::include_member): Add symbols from plugin objects.
12888         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12889         * descriptors.cc (Descriptors::open): Check for file descriptors
12890         abandoned by plugins.
12891         (Descriptors::claim_for_plugin): New function.
12892         * descriptors.h (Descriptors::claim_for_plugin): New function.
12893         (Open_descriptor::is_claimed): New field.
12894         (claim_descriptor_for_plugin): New function.
12895         * fileread.cc (File_read::claim_for_plugin): New function.
12896         * fileread.h (File_read::claim_for_plugin): New function.
12897         (File_read::descriptor): New function.
12898         * gold.cc: Include "plugin.h".
12899         (queue_initial_tasks): Add task to call plugin hooks for generating
12900         new object files.
12901         * main.cc: Include "plugin.h".
12902         (main): Load plugin libraries.
12903         * object.h (Pluginobj): Declare.
12904         (Object::pluginobj): New function.
12905         (Object::do_pluginobj): New function.
12906         (Object::set_target): New function.
12907         * options.cc: Include "plugin.h".
12908         (General_options::parse_plugin): New function.
12909         (General_options::General_options): Initialize plugins_ field.
12910         (General_options::add_plugin): New function.
12911         * options.h (Plugin_manager): Declare.
12912         (General_options): Add --plugin option.
12913         (General_options::has_plugins): New function.
12914         (General_options::plugins): New function.
12915         (General_options::add_plugin): New function.
12916         (General_options::plugins_): New field.
12917         * plugin.cc: New file.
12918         * plugin.h: New file.
12919         * readsyms.cc: Include "plugin.h".
12920         (Read_symbols::do_read_symbols): Check for archive before checking
12921         for ELF file.  Call plugin hooks to claim files.
12922         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12923         from a real object file; force override when processing replacement
12924         files.
12925         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12926         (Symbol::init_base_object): Likewise.
12927         (Symbol::init_base_output_data): Likewise.
12928         (Symbol::init_base_output_segment): Likewise.
12929         (Symbol::init_base_constant): Likewise.
12930         (Symbol::init_base_undefined): Likewise.
12931         (Symbol::output_section): Assert that object is not a plugin.
12932         (Symbol_table::add_from_pluginobj): New function.
12933         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12934         undefined.
12935         (Symbol_table::sized_write_globals): Likewise.
12936         (Symbol_table::add_from_pluginobj): Instantiate template.
12937         * symtab.h (Sized_pluginobj): Declare.
12938         (Symbol::in_real_elf): New function.
12939         (Symbol::set_in_real_elf): New function.
12940         (Symbol::in_real_elf_): New field.
12941         (Symbol_table::add_from_pluginobj): New function.
12942
12943         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12944         (LIBDL): New variable.
12945         (LDADD): Add LIBDL.
12946         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12947         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12948         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12949         (MOSTLYCLEANFILES): Likewise.
12950         * testsuite/Makefile.in: Regenerate.
12951         * testsuite/plugin_test.c: New file.
12952         * testsuite/plugin_test_1.sh: New file.
12953         * testsuite/plugin_test_2.sh: New file.
12954
12955 2008-09-16  Ian Lance Taylor  <iant@google.com>
12956
12957         * target-reloc.h (relocate_section): Check whether a symbol is
12958         defined by the ABI before reporting an undefined symbol error.
12959         * target.h (Target::is_defined_by_abi): Make parameter const.
12960         (Target::do_is_defined_by_abi): Likewise.
12961         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12962         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12963         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12964         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12965         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12966         * testsuite/Makefile.in: Rebuild.
12967
12968         * fileread.cc (make_view): Add casts to avoid warning.
12969
12970 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12971
12972         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12973         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12974
12975 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12976
12977         * options.h (General_options::output_is_executable): New.
12978         (General_options::output_is_pie): New.
12979         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12980         for shared libraries.
12981         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12982
12983 2008-09-11  Chris Demetriou  <cgd@google.com>
12984
12985         * options.h (origin): New -z option.
12986         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12987         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12988         in DT_FLAGS_1.
12989
12990 2008-09-05  Cary Coutant  <ccoutant@google.com>
12991
12992         * fileread.cc (File_read::make_view): Add check for attempt to map
12993         beyond end of file.
12994
12995 2008-09-05  Cary Coutant  <ccoutant@google.com>
12996
12997         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12998         explicit instantiations.
12999
13000 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13001
13002         PR gold/6858
13003         * options.cc (General_options::finalize): Allow undefined symbols
13004         in shlibs if linking -shared.
13005
13006         PR gold/6859
13007         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13008         symbols as not needing a dynsym entry.
13009
13010 2008-08-20  Craig Silverstein  <csilvers@google.com>
13011
13012         * fileread.cc (File_read::open): Do not lock the file unless it
13013         was successfully opened.
13014
13015 2008-08-14  Cary Coutant  <ccoutant@google.com>
13016
13017         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13018         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13019         * testsuite/tls_test.cc (struct int128): 128-bit struct
13020         for testing TLS relocs with non-zero addend.
13021         (v12): New TLS variable.
13022         (t12): New test.
13023         (t_last): Add check for v12.
13024         * testsuite/tls_test.h (t12): New function.
13025         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13026
13027 2008-08-13  Ian Lance Taylor  <iant@google.com>
13028
13029         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13030         set tls_segment_ or relro_segment_.
13031         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13032         when appropriate.
13033         * output.h (Output_section::clear_is_relro): New function.
13034         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13035         sections specially even when output_data_ is empty.
13036         (Output_segment::maximum_alignment): When first section is relro,
13037         only force alignment for PT_LOAD segments.
13038         * script.cc (script_data_segment_align): New function.
13039         (script_data_segment_relro_end): New function.
13040         * script-c.h (script_data_segment_align): Declare.
13041         (script_data_segment_relro_end): Declare.
13042         * script-sections.h (class Script_sections): Declare
13043         data_segment_align and data_segment_relro_end.  Add fields
13044         segment_align_index_ and saw_relro_end_.
13045         * script-sections.cc (class Sections_element): Add set_is_relro
13046         virtual function.  Add new bool* parameter to place_orphan_here.
13047         Add get_output_section virtual function.
13048         (class Output_section_definition): Add set_is_relro.  Add new
13049         bool* parameter to place_orphan_here.  Add get_output_section.
13050         Add is_relro_ field.
13051         (Output_section_definition::Output_section_definition): Initialize
13052         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13053         and is_relro_ fields.
13054         (Output_section_definition::place_orphan_here): Add is_relro
13055         parameter.
13056         (Output_section_definition::set_section_addresses): Set relro for
13057         output section.
13058         (Output_section_definition::alternate_constraint): Likewise.
13059         (class Orphan_output_section): Add new bool* parameter to
13060         place_orphan_here.  Add get_output_section.
13061         (Orphan_output_section::place_orphan_here): Add is_relro
13062         parameter.
13063         (Script_sections::Script_sections): Initialize
13064         data_segment_align_index_ and saw_relro_end_.
13065         (Script_sections::data_segment_align): New function.
13066         (Script_sections::data_segment_relro_end): New function.
13067         (Script_sections::place_orphan): Set or clear is_relro.
13068         (Script_sections::set_section_addresses): Force alignment of first
13069         TLS section.
13070         * yyscript.y (exp): Call script_data_segment_align and
13071         script_data_segment_relro_end.
13072         * testsuite/relro_script_test.t: New file.
13073         * testsuite/relro_test.cc (using_script): Declare.
13074         (t1, t2): Test using_script.
13075         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13076         (relro_script_test_SOURCES): Define.
13077         (relro_script_test_DEPENDENCIES): Define.
13078         (relro_script_test_LDFLAGS): Define.
13079         (relro_script_test_LDADD): Define.
13080         (relro_script_test.so): New target.
13081         * testsuite/Makefile.in: Rebuild.
13082
13083 2008-08-06  Cary Coutant <ccoutant@google.com>
13084
13085         * archive.cc (Archive::total_archives, Archive::total_members)
13086         (Archive::total_members_loaded): New variables.
13087         (Archive::setup): Add parameter.  Add option to preread
13088         archive symbols.
13089         (Archive::read_armap): Add counter.
13090         (Archive::get_file_and_offset): New function.
13091         (Archive::get_elf_object_for_member): New function.
13092         (Archive::read_all_symbols): New function.
13093         (Archive::read_symbols): New function.
13094         (Archive::add_symbols): Add counters.
13095         (Archive::include_all_members): Use armap to find members if it's
13096         already built.
13097         (Archive::include_member): Skip reading symbols if already read.
13098         Factored code into Archive::get_file_and_offset and
13099         Archive::get_elf_object_for_member.  Changed call to
13100         Mapfile::report_include_archive_member.
13101         (Archive::print_stats): New function.
13102         * archive.h: Declare Object and Read_symbols_data classes.
13103         (Archive::Archive): Add initializers for new members.
13104         (Archive::setup): Add parameter.
13105         (Archive::print_stats): New function.
13106         (Archive::total_archives, Archive::total_members)
13107         (Archive::total_members_loaded): New variables.
13108         (Archive::get_file_and_offset): New function.
13109         (Archive::get_elf_object_for_member): New function.
13110         (Archive::read_all_symbols): New function.
13111         (Archive::read_symbols): New function.
13112         (Archive::Archive_member): New class.
13113         (Archive::members_): New member.
13114         (Archive::num_members_): New member.
13115         * main.cc: Include archive.h.
13116         (main): Call Archive::print_stats.
13117         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13118         archive parameter; member_name is now the fully-decorated name.
13119         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13120         * options.h: (General_options): Add --preread-archive-symbols option.
13121         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13122         Archive::setup.
13123
13124 2008-08-04  Ian Lance Taylor  <iant@google.com>
13125
13126         * symtab.h (Symbol::use_plt_offset): New function.
13127         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13128         * powerpc.cc (Relocate::relocate): Likewise.
13129         * sparc.cc (Relocate::relocate): Likewise.
13130         * x86_64.cc (Relocate::relocate): Likewise.
13131         * testsuite/weak_plt.sh: New test.
13132         * testsuite/weak_plt_main.cc: New test.
13133         * testsuite/weak_plt_shared.cc: New test.
13134         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13135         (check_PROGRAMS): Add weak_plt.
13136         (check_DATA): Add weak_plt_shared.so.
13137         (weak_plt_main_pic.o, weak_plt): New targets.
13138         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13139         * testsuite/Makefile.in: Rebuild.
13140
13141         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13142         gcctestdir/ld.
13143         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13144         * testsuite/Makefile.in: Rebuild.
13145
13146 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13147
13148         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13149         * Makefile.in: Regenerate.
13150         * po/POTFILES.in: Regenerate.
13151
13152 2008-07-29  Ian Lance Taylor  <iant@google.com>
13153
13154         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13155         symbols before other symbols.
13156         * testsuite/script_test_2.cc (test_addr): Declare.
13157         (test_addr_alias): Declare.
13158         (main): Check that test_addr and test_addr_alias have the right
13159         values.
13160         * testsuite/script_test_2.t: Define test_addr_alias and
13161         test_addr.
13162
13163 2008-07-24  Ian Lance Taylor  <iant@google.com>
13164
13165         PR 5990
13166         * descriptors.cc: New file.
13167         * descriptors.h: New file.
13168         * gold-threads.h (class Hold_optional_lock): New class.
13169         * fileread.cc: Include "descriptors.h".
13170         (File_read::~File_read): Release descriptor rather than closing
13171         it.
13172         (File_read::open) [file]: Call open_descriptor rather than open.
13173         Set is_descriptor_opened_.
13174         (File_read::open) [memory]: Assert that descriptor is not open.
13175         (File_read::reopen_descriptor): New function.
13176         (File_read::release): Release descriptor.
13177         (File_read::do_read): Make non-const.  Reopen descriptor.
13178         (File_read::read): Make non-const.
13179         (File_read::make_view): Reopen descriptor.
13180         (File_read::do_readv): Likewise.
13181         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13182         Update declarations.
13183         * layout.cc: Include "descriptors.h".
13184         (Layout::create_build_id): Use open_descriptor rather than open.
13185         * output.cc: Include "descriptors.h".
13186         (Output_file::open): Use open_descriptor rather than open.
13187         * archive.cc (Archive::const_iterator): Change Archive to be
13188         non-const.
13189         (Archive::begin, Archive::end): Make non-const.
13190         (Archive::count_members): Likewise.
13191         * archive.h (class Archive): Update declarations.
13192         * object.h (Object::read): Make non-const.
13193         * Makefile.am (CCFILES): Add descriptors.cc.
13194         (HFILES): Add descriptors.h.
13195         * Makefile.in: Rebuild.
13196
13197         PR 6716
13198         * gold.h: Always include <clocale>.  Add Solaris workarounds
13199         following code in binutils/sysdep.h.
13200
13201         PR 6048
13202         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13203         this->eh_frame_hdr_ is NULL before using it.
13204
13205         * dynobj.cc (Versions::Versions): Update comment.
13206
13207         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13208         the base version name.
13209
13210         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13211         array size plus one.
13212         (Stringpool_template::set_string_offsets): Subtract one from key
13213         before using it as an array index.
13214         (Stringpool_template::get_offset_with_length): Likewise.
13215         (Stringpool_template::write_to_buffer): Likewise.
13216         * stringpool.h (Stringpool_template::get_offset_from_key):
13217         Likewise.
13218
13219 2008-07-23  Ian Lance Taylor  <iant@google.com>
13220
13221         PR 6658
13222         * object.h (Merged_symbol_value::value): Do our best to handle a
13223         negative addend.
13224
13225         PR 6647
13226         * script.cc (Version_script_info::get_versions): Don't add empty
13227         version tag to return value.
13228         (Version_script_info::get_symbol_version_helper): Change return
13229         type to bool.  Add pversion parameter.  Change all callers.
13230         (script_register_vers_node): Don't require a non-NULL tag.
13231         * script.h (class Version_script_info): Update declarations.
13232         (Version_script_info::get_symbol_version): Change return type to
13233         bool.  Add version parameter.  Change all callers.
13234         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13235         handling.  Handle an empty version from a version script.
13236         (Symbol_table::define_special_symbol): Likewise.
13237         * testsuite/ver_test_10.script: New file.
13238         * testsuite/ver_test_10.sh: New file.
13239         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13240         (check_DATA): Add ver_test_10.syms.
13241         (ver_test_10.syms, ver_test_10.so): New target.
13242         * testsuite/Makefile.in: Rebuild.
13243
13244 2008-07-23  Simon Baldwin  <simonb@google.com>
13245
13246         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13247         to zero for undefined symbols from dynamic libraries.
13248
13249 2008-07-23  Ian Lance Taylor  <iant@google.com>
13250
13251         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13252         Change all callers.
13253         * symtab.h (class Symbol_table): Update declaration.
13254         * testsuite/ver_test_9.cc: New file.
13255         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13256         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13257         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13258         (ver_test_9.so, ver_test_9.o): New targets.
13259         * testsuite/Makefile.in: Rebuild.
13260
13261 2008-07-22  Ian Lance Taylor  <iant@google.com>
13262
13263         * options.h (class General_options): Define --check-sections.
13264         * layout.cc (Layout::set_segment_offsets): Handle
13265         --check-sections.
13266
13267         * options.h (class General_options): Define -n/--nmagic and
13268         -N/--omagic.
13269         * options.cc (General_options::finalize): For -n/--nmagic or
13270         -N/--omagic, set -static.
13271         * layout.cc (Layout::attach_allocated_section_to_segment): If
13272         -N/--omagic, don't put read-only and read-write sections in
13273         different segments.
13274         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13275         finding a read-only segment.
13276         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13277         don't set the minimum segment alignment to the common page size,
13278         and don't set the file offset to the address modulo the page size.
13279         * script-sections.cc (Script_sections::create_segments): If
13280         -n/--omagic, don't put read-only and read-write sections in
13281         different segments.
13282
13283         * cref.cc: New file.
13284         * cref.h: New file.
13285         * options.h (class General_options): Add --print-symbol-counts.
13286         * main.cc (main): Issue defined symbol report if requested.
13287         * archive.cc (Archive::interpret_header): Make into a const member
13288         function.
13289         (Archive::add_symbols): Call Input_objects::archive_start and
13290         archive_stop.
13291         (Archive::const_iterator): Define new class.
13292         (Archive::begin, Archive::end): New functions.
13293         (Archive::include_all_members): Rewrite to use iterator.
13294         (Archive::count_members): New function.
13295         * archive.h (class Archive): Update declarations.
13296         (Archive::filename): New function.
13297         * object.cc: Include "cref.h".
13298         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13299         (Sized_relobj::do_get_global_symbol_counts): New function.
13300         (Input_objects::add_object): Add object to cross-referencer.
13301         (Input_objects::archive_start): New function.
13302         (Input_objects::archive_stop): New function.
13303         (Input_objects::print_symbol_counts): New function.
13304         * object.h: Declare Cref and Archive.
13305         (Object::get_global_symbol_counts): New function.
13306         (Object::do_get_global_symbol_counts): New pure virtual function.
13307         (class Sized_relobj): Add defined_count_ field.  Update
13308         declarations.
13309         (class Input_objects): Add cref_ field.  Update constructor.
13310         Update declarations.
13311         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13312         defined_count_.
13313         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13314         symbol counts.
13315         (Sized_dynobj::do_get_global_symbol_counts): New function.
13316         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13317         defined_count_.  Update declarations.  Define Symbols typedef.
13318         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13319         parameter.  Change all callers.
13320         (Symbol_table::add_from_dynobj): Add sympointers and defined
13321         parameters.  Change all callers.
13322         * symtab.h (class Symbol_table): Update declarations.
13323         * Makefile.am (CCFILES): Add cref.cc.
13324         (HFILES): Add cref.h.
13325         * Makefile.in: Rebuild.
13326
13327 2008-07-22  Simon Baldwin  <simonb@google.com>
13328
13329         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13330         to zero when writing undefined symbols.
13331
13332 2008-07-22  Ian Lance Taylor  <iant@google.com>
13333
13334         * output.cc (Output_section::add_input_section): Don't try to
13335         merge empty merge sections.
13336
13337 2008-07-21  Craig Silverstein  <csilvers@google.com>
13338
13339         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13340         Include symbol version in error message.
13341
13342 2008-07-20  Chris Demetriou  <cgd@google.com>
13343
13344         * configure.ac (gold_cv_c_random_seed): New configured variable.
13345         (RANDOM_SEED_CFLAGS): New substituted variable.
13346         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13347         * configure: Rebuild.
13348         * Makefile.in: Likewise.
13349         * testsuite/Makefile.in: Likewise.
13350
13351 2008-07-18  Ian Lance Taylor  <iant@google.com>
13352
13353         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13354         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13355         * testsuite/ver_test_main.cc (main): Call t4.
13356         (t4, t4_2a): Define.
13357         * testsuite/ver_test_2.cc (t4_2): Define.
13358         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13359         * testsuite/ver_test_4.cc (t4_2a): Define.
13360         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13361         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13362
13363 2008-07-17  Ian Lance Taylor  <iant@google.com>
13364
13365         * dynobj.cc (Versions::add_def): If we give an error about a
13366         missing version, go ahead and create the version anyhow.
13367
13368 2008-07-10  Ian Lance Taylor  <iant@google.com>
13369
13370         Handle output sections with more than 0x7fffffff bytes.
13371         * object.h (class Relobj): Change map_to_output_ to
13372         output_sections_, and just keep a section pointer.  Change all
13373         uses.  Move comdat group support to Sized_relobj.
13374         (Relobj::is_section_specially_mapped): Remove.
13375         (Relobj::output_section): Remove poff parameter.  Change all
13376         callers.
13377         (Relobj::output_section_offset): New function.
13378         (Relobj::set_section_offset): Rewrite.
13379         (Relobj::map_to_output): Remove.
13380         (Relobj::output_sections): New function.
13381         (Relobj::do_output_section_offset): New pure virtual function.
13382         (Relobj::do_set_section_offset): Likewise.
13383         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13384         group support from Relobj.  Update declarations.
13385         (Sized_relobj::get_output_section_offset): New function.
13386         (Sized_relobj::do_output_section_offset): New function.
13387         (Sized_relobj::do_set_section_offset): New function.
13388         * object.cc (Relobj::output_section_address): Remove.
13389         (Sized_relobj::Sized_relobj): Initialize new fields.
13390         (Sized_relobj::include_section_group): Cast find_kept_object to
13391         Sized_relobj.
13392         (Sized_relobj::include_linkonce_section): Likewise.
13393         (Sized_relobj::do_layout): Use separate arrays for output section
13394         and output offset.
13395         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13396         output_sections.
13397         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13398         output_sections and section_offsets.
13399         (Sized_relobj::write_local_symbols): Likewise.
13400         (map_to_kept_section): Compute output address directly.
13401         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13402         output_sections and section_offsets.
13403         (Sized_relobj::write_sections): Likewise.
13404         (Sized_relobj::relocate_sections): Likewise.
13405         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13406         * output.h (class Output_reloc): Update declarations.  Change
13407         u2_.relobj to Sized_relobj*.
13408         (class Output_data_reloc): Change add functions to use
13409         Sized_relobj*.
13410         * output.cc (Output_reloc::Output_reloc): Change relobj to
13411         Sized_relobj*.
13412         (Output_reloc::local_section_offset): Change return type to
13413         Elf_Addr.  Use get_output_section_offset.
13414         (Output_reloc::get_address): Likewise.
13415         (Output_section::is_input_address_mapped): Don't call
13416         is_section_specially_mapped.
13417         (Output_section::output_offset): Likewise.
13418         (Output_section::output_address): Likewise.
13419         (Output_section::starting_output_address): Likewise.
13420         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13421         parameter to Sized_relobj*.
13422         (Copy_relocs::need_copy_reloc): Likewise.
13423         (Copy_relocs::save): Likewise.
13424         * copy-relocs.h (class Copy_relocs): Update declarations.
13425         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13426         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13427         * target-reloc.h (relocate_for_relocatable): Change
13428         offset_in_output_section type to Elf_Addr.  Change code that uses
13429         it as well.
13430         * layout.cc (Layout::layout): Always set *off.
13431         * mapfile.cc (Mapfile::print_input_section): Use
13432         output_section_offset.
13433         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13434         Sized_relobj*.
13435         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13436         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13437         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13438
13439 2008-07-03  Ian Lance Taylor  <iant@google.com>
13440
13441         * layout.cc (Layout::include_section): Do not discard unrecognized
13442         SHT_STRTAB sections.
13443
13444 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13445
13446         * script.cc (Lex::can_continue_name): Make '?' allowable in
13447         version-script names.
13448         * testsuite/version_script.map: Change glob pattern to use '?'
13449
13450 2008-06-30  Manish Singh  <yosh@gimp.org>
13451
13452         PR 6585
13453         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13454         Correct typo.
13455
13456 2008-06-30  Ian Lance Taylor  <iant@google.com>
13457
13458         PR 6660
13459         PR 6682
13460         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13461         versions]: Don't try to read the value in the contents, since we
13462         don't use it.  Use the template endianness when writing.
13463
13464 2008-06-25  Cary Coutant  <ccoutant@google.com>
13465
13466         * fileread.cc (File_read::make_view): Assert on zero-length view.
13467         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13468         symbol table when there are no symbols to read.
13469
13470 2008-06-23  Craig Silverstein  <csilvers@google.com>
13471
13472         * version.cc (version_string): Bump to 1.7
13473
13474 2008-06-18  Craig Silverstein  <csilvers@google.com>
13475
13476         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13477         constant 0xFFFF to type Valtype.
13478         (Powerpc_relocate_functions::rel16_ha): Likewise.
13479
13480 2008-06-17  Ian Lance Taylor  <iant@google.com>
13481
13482         * output.h (Output_section::Input_section): Initialize p2align_ to
13483         zero for Output_section_data constructors.
13484         (Output_section::Input_section::addralign): If not an input
13485         section, return the alignment of the Output_section_data.
13486         * testsuite/copy_test.cc: New file.
13487         * testsuite/copy_test_1.cc: New file.
13488         * testsuite/copy_test_2.cc: New file.
13489         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13490         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13491         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13492         (copy_test_1_pic.o, copy_test_1.so): New targets.
13493         (copy_test_2_pic.o, copy_test_2.so): New targets.
13494         * testsuite/Makefile.in: Rebuild.
13495
13496         * script-sections.cc (Script_sections::place_orphan): Initialize
13497         local variable exact.
13498
13499 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13500
13501         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13502
13503 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13504             David S. Miller  <davem@davemloft.net>
13505
13506         * powerpc.cc: New file.
13507         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13508         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13509         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13510         * Makefile.in: Rebuild.
13511
13512 2008-06-09  Ian Lance Taylor  <iant@google.com>
13513
13514         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13515         <exception>.
13516         (throwing, orig_terminate): New static variables.
13517         (terminate_handler): New static function.
13518         (t2): Set terminate handler.
13519
13520 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13521
13522         PR 6584
13523         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13524         alignment.
13525
13526 2008-05-30  Cary Coutant  <ccoutant@google.com>
13527
13528         * archive.cc (Archive::include_all_members) Correct to step
13529         over symbol table and extended name table in thin archives.
13530
13531 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13532
13533         PR 6407
13534         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13535         calculation.
13536
13537 2008-05-28  Caleb Howe  <cshowe@google.com>
13538
13539         * reduced_debug_output.cc: New file.
13540         * reduced_debug_output.h: New file.
13541         * options.h (class General_options): Add --strip-debug-non-line.
13542         * options.cc (General_options::finalize): Add strip_debug_non_line
13543         to the strip heirarchy.
13544         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13545         fields.
13546         * layout.cc: Include "reduced_debug_output.h".
13547         (Layout::Layout): Initialize new fields.
13548         (line_only_debug_sections): New static array.
13549         (is_lines_only_debug_sections): New static inline function.
13550         (Layout::include_section): Handle --strip-debug-non-line.
13551         (Layout::make_output_section): If --strip-debug-non-line, build
13552         new output sections for .debug_abbrev and .debug_info.
13553         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13554         gold.  Warn about possible overflow.
13555         (read_signed_LEB_128): Likewise.
13556         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13557         (read_signed_LEB_128): Declare.
13558         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13559         (HFILES): Add reduced_debug_output.h.
13560         * Makefile.in: Rebuild.
13561
13562 2008-05-21  Ian Lance Taylor  <iant@google.com>
13563
13564         * mapfile.cc: New file.
13565         * mapfile.h: New file.
13566         * options.h (class General_options): Add -M/--print-map and -Map.
13567         * options.cc (General_options::finalize): Make -M equivalent to
13568         -Map -.
13569         * main.cc: Include <cstdio> and "mapfile.h".
13570         (main): Open mapfile if requested.
13571         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13572         constructor.  Change caller.
13573         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13574         (queue_middle_tasks): Likewise.
13575         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13576         declarations.
13577         * archive.cc: Include "mapfile.h".
13578         (Archive::add_symbols): Add mapfile parameter.  Change all
13579         callers.  Pass mapfile, symbol, and reason to include_member.
13580         (Archive::include_all_members): Add mapfile parameter.  Change all
13581         callers.
13582         (Archive::include_member): Add mapfile, sym, and why parameters.
13583         Change all callers.  Report inclusion to map file.
13584         * archive.h: Include "fileread.h".
13585         (class Archive): Update declarations.
13586         (Archive::file): New const method.
13587         (class Add_archive_symbols): Add mapfile_ field.  Update
13588         constructor.  Change all callers.
13589         * readsyms.h (class Read_symbols): Likewise.
13590         (class Finish_group): Likewise.
13591         (class Read_script): Likewise.
13592         * common.cc: Include "mapfile.h".
13593         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13594         all callers.
13595         (Symbol_table::do_allocate_commons): Likewise.
13596         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13597         symbol allocation to mapfile.
13598         * common.h (class Allocate_commons_task): Add mapfile_ field.
13599         Update constructor.  Change all callers.
13600         * symtab.h (class Symbol_table): Update declarations.
13601         * layout.cc: Include "mapfile.h".
13602         (Layout_task_runner::run): Print information to mapfile.
13603         (Layout::create_gold_note): Change Output_data_fixed_space to
13604         Output_data_zero_fill.
13605         (Layout::create_build_id): Likewise.
13606         (Layout::print_to_mapfile): New function.
13607         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13608         constructor.  Change caller.
13609         (class Layout): Declare print_to_mapfile.
13610         * output.cc (Output_section::Input_section::print_to_mapfile): New
13611         function.
13612         (Output_section::add_input_section): If producing a map, always
13613         add to input_sections_ list.
13614         (Output_section::do_print_to_mapfile): New function.
13615         (Output_segment::print_sections_to_mapfile): New function.
13616         (Output_segment::print_section_list_to_mapfile): New function.
13617         * output.h: Include "mapfile.h".
13618         (Output_data::print_to_mapfile): New function.
13619         (Output_data::do_print_to_mapfile): New virtual function.
13620         (Output_segment_headers::do_print_to_mapfile): New function.
13621         (Output_file_header::do_print_to_mapfile): New function.
13622         (Output_data_const::do_print_to_mapfile): New function.
13623         (class Output_data_const_buffer): Add map_name_ field.  Update
13624         constructor.  Change all callers.  Add do_print_to_mapfile
13625         function.
13626         (class Output_data_fixed_space): Likewise.
13627         (class Output_data_space): Likewise.
13628         (class Output_data_zero_fill): New class.
13629         (Output_data_strtab::do_print_to_mapfile): New function.
13630         (Output_data_reloc_base::do_print_to_mapfile): New function.
13631         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13632         (Output_data_group::do_print_to_mapfile): New function.
13633         (Output_data_got::do_print_to_mapfile): New function.
13634         (Output_data_dynamic::do_print_to_mapfile): New function.
13635         (Output_symtab_xindex::do_print_to_mapfile): New function.
13636         (class Output_section): Declare do_print_to_mapflie.  Declare
13637         print_to_mapfile in Input_section.
13638         (class Output_segment): Declare new functions.
13639         * object.h (Sized_relobj::symbol_count): New function.
13640         * script-sections.cc
13641         (Output_section_element_dot_assignment::set_section_addresses):
13642         Change Output_data_fixed_space to Output_data_zero_fill.
13643         (Output_data_expression::do_print_to_mapfile): New function.
13644         * script.cc (read_input_script): Add mapfile parameter.  Change
13645         all callers.
13646         * script.h (read_input_script): Update declaration.
13647         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13648         (Eh_frame::do_print_to_mapfile): New function.
13649         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13650         (Output_merge_string::do_print_to_mapfile): New function.
13651         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13652         function.
13653         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13654         function.
13655         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13656         function.
13657         * Makefile.am (CCFILES): Add mapfile.cc.
13658         (HFILES): Add mapfile.h.
13659         * Makefile.in: Rebuild.
13660
13661 2008-05-19  Ian Lance Taylor  <iant@google.com>
13662
13663         * options.h (class General_options): Add -z relro.
13664         * layout.cc (Layout::Layout): Initialize relro_segment_.
13665         (Layout::add_output_section_data): Return the output section.
13666         (Layout::make_output_section): Rcognize relro sections and mark
13667         them appropriately.
13668         (Layout::attach_allocated_section_to_segment): Put relro sections
13669         in a PT_GNU_RELRO segment.
13670         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13671         section as relro.
13672         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13673         PT_TLS segments.
13674         (Layout::linkonce_mapping): Map d.rel.ro.local to
13675         .data.rel.ro.local.
13676         (Layout::output_section_name): Us .data.rel.ro.local for any
13677         section which begins with that.
13678         * layout.h (class Layout): Update add_output_section_data
13679         declaration.  Add relro_segment_ field.
13680         * output.cc (Output_section::Output_section): Initialize is_relro_
13681         and is_relro_local_ fields.
13682         (Output_segment::add_output_section): Group relro sections.
13683         (Output_segment::is_first_section_relro): New function.
13684         (Output_segment::maximum_alignment): If there is a relro section,
13685         align the segment to the common page size.
13686         (Output_segment::set_section_addresses): Track whether we are
13687         looking at relro sections.  If the last section is a relro
13688         section, align to the common page size.
13689         (Output_segment::set_section_list_addresses): Add in_relro
13690         parameter.  Change all callers.  Align to the page size when
13691         moving from relro to non-relro section.
13692         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13693         segment.
13694         * output.h (class Output_section): Add is_relro_ and
13695         is_relro_local_ fields.
13696         (Output_section::is_relro): New function.
13697         (Output_section::set_is_relro): New function.
13698         (Output_section::is_relro_local): New function.
13699         (Output_section::set_is_relro_local): New function.
13700         (class Output_segment): Update declarations.
13701         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13702         * sparc.cc (Target_sparc::got_section): Likewise.
13703         * x86_64.cc (Target_x86_64::got_section): Likewise.
13704         * testsuite/relro_test_main.cc: New file.
13705         * testsuite/relro_test.cc: New file.
13706         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13707         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13708         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13709         (relro_test.so, relro_test_pic.o): New targets.
13710         * testsuite/Makefile.in: Rebuild.
13711
13712 2008-05-16  Ian Lance Taylor  <iant@google.com>
13713
13714         * output.cc (Output_segment::add_output_section): Remove front
13715         parameter.
13716         * output.h (class Output_segment): Remove
13717         add_initial_output_section and overloaded add_output_section.
13718         Update declaration of remaining add_output_section.
13719         * layout.cc (Layout::create_interp): Call add_output_section
13720         rather than add_initial_output_section.
13721         (Layout::finish_dynamic_section): Likewise.
13722
13723         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13724         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13725         know the dynamic type.
13726         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13727         field.  Initialize it in constructor.
13728         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13729         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13730         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13731         reloc.
13732
13733         * output.cc (Output_reloc::get_address): Change return type to
13734         Elf_Addr.
13735         * output.h (class Output_reloc): Update get_address declaration.
13736         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13737         for section addresses.
13738
13739 2008-05-09  Ian Lance Taylor  <iant@google.com>
13740
13741         PR 6493
13742         * gold.cc (gold_nomem): Use return value of write.
13743
13744 2008-05-08  Ian Lance Taylor  <iant@google.com>
13745
13746         * symtab.c (Symbol::init_base_output_data): Add version
13747         parameter.  Change all callers.
13748         (Symbol::init_base_output_segment): Likewise.
13749         (Symbol::init_base_constant): Likewise.
13750         (Symbol::init_base_undefined): Likewise.
13751         (Sized_symbol::init_output_data): Likewise.
13752         (Sized_symbol::init_output_segment): Likewise.
13753         (Sized_symbol::init_constant): Likewise.
13754         (Sized_symbol::init_undefined): Likewise.
13755         (Symbol_table::do_define_in_output_data): If the new symbol has a
13756         version, mark it as the default.
13757         (Symbol_table::do_define_in_output_segment): Likewise.
13758         (Symbol_table::do_define_as_constant): Likewise.
13759         * symtab.h (class Symbol): Update declarations.
13760         (class Sized_symbol): Likewise.
13761         * resolve.cc (Symbol::override_version): New function.
13762         (Symbol::override_base): Call override_version.
13763         (Symbol::override_base_with_special): Likewise.
13764         * testsuite/ver_script_8.script: New file.
13765         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13766         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13767         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13768         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13769
13770 2008-05-06  Ian Lance Taylor  <iant@google.com>
13771
13772         PR 6049
13773         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13774         functions.
13775         (class General_options): Remove existing --undefined, and add
13776         --no-undefined instead.  Add new --undefined as synonym for -u.
13777         * archive.cc (Archive::add_symbols): Check whether symbol was
13778         named with -u.
13779         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13780         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13781         all uses.  Add IS_UNDEFINED.  Update declarations to split
13782         different versions of init_base.  Declare init_base_undefined.
13783         (Symbol::is_defined): Handle IS_UNDEFINED.
13784         (Symbol::is_undefined): Likewise.
13785         (Symbol::is_weak_undefined): Call is_undefined.
13786         (Symbol::is_absolute): Handle IS_CONSTANT.
13787         (class Sized_symbol): Update declarations to split different
13788         versions of init.  Declare init_undefined.
13789         (class Symbol_table): Declare new functions.
13790         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13791         Change all callers.
13792         (Symbol::init_base_output_data): Likewise.
13793         (Symbol::init_base_output_segment): Likewise.
13794         (Symbol::init_base_constant): Likewise.
13795         (Symbol::init_base_undefined): New function.
13796         (Sized_symbol::init_object): Rename from init.  Change all
13797         callers.
13798         (Sized_symbol::init_output_data): Likewise.
13799         (Sized_symbol::init_output_segment): Likewise.
13800         (Sized_symbol::init_constant): Likewise.
13801         (Sized_symbol::init_undefined): New function.
13802         (Symbol_table::add_undefined_symbols_from_command_line): New
13803         function.
13804         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13805         function.
13806         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13807         (Symbol::output_section): Likewise.
13808         (Symbol::set_output_section): Likewise.
13809         (Symbol_table::sized_finalize_symbol): Likewise.
13810         (Symbol_table::sized_write_globals): Likewise.
13811         * resolve.cc (Symbol_table::should_override): Likewise.
13812         (Symbol::override_base_with_special): Likewise.
13813
13814         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13815         symbol, change it to have default visibility.
13816         * testsuite/protected_1.cc: New file.
13817         * testsuite/protected_2.cc: New file.
13818         * testsuite/protected_3.cc: New file.
13819         * testsuite/protected_main_1.cc: New file.
13820         * testsuite/protected_main_2.cc: New file.
13821         * testsuite/protected_main_3.cc: New file.
13822         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13823         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13824         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13825         (protected_1.so): New target.
13826         (protected_1_pic.o, protected_2_pic.o): New targets.
13827         (protected_3_pic.o): New target.
13828         (check_PROGRAMS): Add protected_2.
13829         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13830         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13831         * testsuite/Makefile.in: Rebuild.
13832
13833         * options.h (DEFINE_var): Add set_user_set_##varname__.
13834         (DEFINE_bool_alias): New macro.
13835         (class General_options): Define -Bstatic using DEFINE_bool_alias
13836         rather than DEFINE_special.  Add --undefined as an alias for -z
13837         defs.
13838         * options.cc (General_options::parse_Bstatic): Remove.
13839
13840         * options.h (class General_options): Add --fatal-warnings.
13841         * main.cc (main): Implement --fatal-warnings.
13842         * errors.h (Errors::warning_count): New function.
13843
13844         * options.h (class General_options): Add -Bsymbolic-functions.
13845         * symtab.h (Symbol::is_preemptible): Check for
13846         -Bsymbolic-functions.
13847
13848 2008-05-05  Ian Lance Taylor  <iant@google.com>
13849
13850         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13851         as noVARNAME rather than no-VARNAME.
13852         (class General_options): Add option -z combreloc.
13853         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13854         get_address.
13855         (Output_reloc::sort_before) [SHT_REL]: New function.
13856         (Output_reloc::sort_before) [SHT_RELA]: New function.
13857         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13858         Sort_relocs_comparison.
13859         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13860         parameter.  Change all callers.
13861         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13862         sort_relocs parameter.  Change all callers.
13863         * output.cc (Output_reloc::get_address): New function, broken out
13864         of write_rel.
13865         (Output_reloc::write_rel): Call it.
13866         (Output_reloc::compare): New function.
13867         (Output_data_reloc_base::do_write): Optionally sort relocs.
13868
13869         * configure.ac: If targ_extra_obj is set, link it in.
13870         * configure.tgt: Initialize all variables.
13871         (x86_64*): Set targ_extra_obj and targ_extra_size.
13872         * configure: Rebuild.
13873
13874         * object.cc (Sized_relobj::include_section_group): Adjust section
13875         indexes read from group data.  Build vector to pass to
13876         layout_group.
13877         * layout.cc (Layout::layout_group): Add flags and shndxes
13878         parameters.  Remove contents parameter.  Change caller.  Update
13879         explicit instantiations.
13880         * layout.h (class Layout): Update layout_group declaration.
13881         * output.cc (Output_data_group::Output_data_group): Add flags and
13882         input_shndxes parameters.  Remove contents parameter.  Change
13883         caller.
13884         (Output_data_group::do_write): Change input_sections_ to
13885         input_shndxes_.
13886         * output.h (class Output_data_group): Update constructor
13887         declaration.  Rename input_sections_ to input_shndxes_.
13888         * testsuite/many_sections_test.cc: Add template.
13889
13890 2008-04-30  Cary Coutant  <ccoutant@google.com>
13891
13892         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13893
13894         * layout.cc (Layout::include_section): Refactored check for debug
13895         info section.
13896         (Layout::add_comdat): Add new parameters.  Change type
13897         of signature parameter.  Add object and shndx to signatures table.
13898         (Layout::find_kept_object): New function.
13899         * layout.h: Include <cstring>.
13900         (Layout::is_debug_info_section): New function.
13901         (Layout::add_comdat): Add new parameters.
13902         (Layout::find_kept_object): New function.
13903         (Layout::Kept_section): New struct.
13904         (Layout::Signatures): Change type of map range.
13905         * object.cc (Relobj::output_section_address): New function.
13906         (Sized_relobj::include_section_group): Add new parameters.  Change
13907         calls to Layout::add_comdat.  Change to build table of kept comdat
13908         groups and table mapping discarded sections to kept sections.
13909         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13910         (Sized_relobj::do_layout): Change calls to include_section_group and
13911         include_linkonce_section.
13912         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13913         value to zero when section is discarded.
13914         (Sized_relobj::map_to_kept_section): New function.
13915         * object.h (Relobj::output_section_address): New function.
13916         (Relobj::Comdat_group): New type.
13917         (Relobj::find_comdat_group): New function.
13918         (Relobj::Comdat_group_table): New type.
13919         (Relobj::Kept_comdat_section): New type.
13920         (Relobj::Kept_comdat_section_table): New type.
13921         (Relobj::add_comdat_group): New function.
13922         (Relobj::set_kept_comdat_section): New function.
13923         (Relobj::get_kept_comdat_section): New function.
13924         (Relobj::comdat_groups_): New field.
13925         (Relobj::kept_comdat_sections_): New field.
13926         (Symbol_value::input_value): Update comment.
13927         (Sized_relobj::map_to_kept_section) New function.
13928         (Sized_relobj::include_linkonce_section): Add new parameter.
13929         * target-reloc.h (Comdat_behavior): New type.
13930         (get_comdat_behavior): New function.
13931         (relocate_section): Add code to map a discarded section to the
13932         corresponding kept section when applying a relocation.
13933
13934 2008-04-30  Craig Silverstein  <csilvers@google.com>
13935
13936         * dwarf_reader.cc (next_generation_count): New static var.
13937         (Addr2line_cache_entry): New struct.
13938         (addr2line_cache): New static var.
13939         (Dwarf_line_info::one_addr2line): Added caching.
13940         (Dwarf_line_info::clear_addr2line_cache): New function.
13941         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13942         cache-size parameter.
13943         (Dwarf_line_info::one_addr2line_cache): New function.
13944         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13945         new cache-size argument to one_addr2line(), and clear cache.
13946
13947 2008-04-28  Cary Coutant  <ccoutant@google.com>
13948
13949         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13950         R_386_PC8 relocations.
13951
13952 2008-04-23  Ian Lance Taylor  <iant@google.com>
13953
13954         * object.cc (Sized_relobj::include_section_group): Check for
13955         invalid section group.
13956
13957         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13958         header size.
13959
13960         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13961         than read for file header.
13962         * archive.cc (Archive::include_member): Likewise.
13963
13964 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13965
13966         * aclocal.m4: Regenerate.
13967         * configure: Regenerate.
13968
13969 2008-04-19  Ian Lance Taylor  <iant@google.com>
13970
13971         * version.cc (version_string): Bump to 1.6.
13972
13973         * testsuite/Makefile.am (many_sections_r_test): New target.
13974         (many_sections_r_test_SOURCES): Remove.
13975         (many_sections_r_test_DEPENDENCIES): Remove.
13976         (many_sections_r_test_LDFLAGS): Remove.
13977         (many_sections_r_test_LDADD): Remove.
13978
13979         * object.cc (Sized_relobj::do_add_symbols): Always pass
13980         local_symbol_count_ to add_from_relobj.
13981
13982         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13983         every thousand variables.
13984         * testsuite/Makefile.in: Rebuild.
13985
13986         * object.cc (Xindex::initialize_symtab_xindex): New function.
13987         (Xindex::read_symtab_xindex): New function.
13988         (Xindex::sym_xindex_to_shndx): New function.
13989         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13990         available.
13991         (Sized_relobj::do_initialize_xindex): New function.
13992         (Sized_relobj::do_read_symbols): Adjust section links.
13993         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13994         parameter.  Change all callers.
13995         (Sized_relobj::include_section_group): Adjust section links and
13996         symbol section indexes.
13997         (Sized_relobj::do_layout): Adjust section links.
13998         (Sized_relobj::do_count_local_symbols): Adjust section links and
13999         symbol section indexes.
14000         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14001         ordinary and special symbols.
14002         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14003         dynsym_xindex parameters.  Change all callers.  Adjust section
14004         links.  Use SHN_XINDEX when needed.
14005         (Sized_relobj::get_symbol_location_info): Adjust section links.
14006         Don't get fooled by special symbols.
14007         * object.h (class Xindex): Define.
14008         (class Object): Add xindex_ parameter.  Declare virtual functoin
14009         do_initialize_xindex.
14010         (Object::adjust_sym_shndx): New function.
14011         (Object::set_xindex): New protected function.
14012         (class Symbol_value): Add is_ordinary_shndx_ field.
14013         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14014         (Symbol_value::value): Assert ordinary section.
14015         (Symbol_value::initialize_input_to_output_map): Likewise.
14016         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14017         Change all callers.
14018         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14019         all callers.
14020         (class Sized_relobj): Update declarations.
14021         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14022         parameter.  Change all callers.
14023         (Sized_relobj::adjust_shndx): New function.
14024         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14025         field.
14026         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14027         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14028         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14029         (Sized_dynobj::read_dynsym_section): Adjust section links.
14030         (Sized_dynobj::read_dynamic): Likewise.
14031         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14032         section links.
14033         (Sized_dynobj::do_initialize_xindex): New function.
14034         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14035         do_initialize_xindex.
14036         (Sized_dynobj::adjust_shndx): New function.
14037         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14038         dynsym_xindex_ fields.
14039         (Layout::finalize): Add a call to set_section_indexes before
14040         creating the symtab sections.
14041         (Layout::set_section_indexes): Don't do anything if the section
14042         already has a section index.
14043         (Layout::create_symtab_sections): Add shnum parameter.  Change
14044         caller.  Create .symtab_shndx section if needed.
14045         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14046         caller.
14047         (Layout::allocated_output_section_count): New function.
14048         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14049         needed.
14050         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14051         fields.  Update declarations.
14052         (Layout::symtab_xindex): New function.
14053         (Layout::dynsym_xindex): New function.
14054         (class Write_symbols_task): Add layout_ field.
14055         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14056         Change caller.
14057         * output.cc (Output_section_headers::Output_section_headers): Add
14058         shstrtab_section parameter.  Change all callers.
14059         (Output_section_headers::do_sized_write): Store overflow values
14060         for section count and section string table section index in
14061         section header zero.
14062         (Output_file_header::do_sized_write): Check for overflow of
14063         section count and section string table section index.
14064         (Output_symtab_xindex::do_write): New function.
14065         (Output_symtab_xindex::endian_do_write): New function.
14066         * output.h (class Output_section_headers): Add shstrtab_section_.
14067         Update declarations.
14068         (class Output_symtab_xindex): Define.
14069         (Output_section::has_out_shndx): New function.
14070         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14071         field.
14072         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14073         Change all callers.
14074         (Sized_symbol::init): Likewise.
14075         (Symbol::output_section): Check for ordinary symbol.
14076         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14077         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14078         callers.
14079         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14080         Change all callers.  Simplify handling of symbols from sections
14081         not included in the link.
14082         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14083         distinction.
14084         (Weak_alias_sorter::operator()): Assert that symbols are
14085         ordinary.
14086         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14087         distinction.
14088         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14089         parameters.  Change all callers.
14090         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14091         symbol distinction.  Use SHN_XINDEX when needed.
14092         (Symbol_table::write_section_symbol): Add symtab_xindex
14093         parameter.  Change all callers.
14094         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14095         SHN_XINDEX when needed.
14096         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14097         declarations.
14098         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14099         (Symbol::is_defined): Check is_ordinary.
14100         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14101         (Symbol::is_absolute, Symbol::is_common): Likewise.
14102         (class Sized_symbol): Update declarations.
14103         (class Symbol_table): Update declarations.
14104         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14105         parameters.  Change all callers.
14106         (Sized_symbol::override): Likewise.
14107         (Symbol_table::override): Likewise.
14108         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14109         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14110         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14111         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14112         to be in an ordinary section.
14113         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14114         object and is_ordinary parameters.  Change all callers.
14115         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14116         Change all callers.  Don't add undefined or non-ordinary symbols
14117         to reloc_map_.
14118         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14119         Change all callers.
14120         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14121         declarations.
14122         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14123         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14124         (Sized_relobj::relocate_sections): Likewise.
14125         * target-reloc.h (scan_relocs): Adjust section symbol index.
14126         (scan_relocatable_relocs): Likewise.
14127         * i386.cc (Scan::local): Check for ordinary symbols.
14128         * sparc.cc (Scan::local): Likewise.
14129         * x86_64.cc (Scan::local): Likewise.
14130         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14131         to symbol_section_and_value.
14132         * testsuite/many_sections_test.cc: New file.
14133         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14134         (check_PROGRAMS): Add many_sections_test.
14135         (many_sections_test_SOURCES): Define.
14136         (many_sections_test_DEPENDENCIES): Define.
14137         (many_sections_test_LDFLAGS): Define.
14138         (BUILT_SOURCES): Add many_sections_define.h.
14139         (many_sections_define.h): New target.
14140         (BUILT_SOURCES): Add many_sections_check.h.
14141         (many_sections_check.h): New target.
14142         (check_PROGRAMS): Add many_sections_r_test.
14143         (many_sections_r_test_SOURCES): Define.
14144         (many_sections_r_test_DEPENDENCIES): Define.
14145         (many_sections_r_test_LDFLAGS): Define.
14146         (many_sections_r_test_LDADD): Define.
14147         (many_sections_r_test.o): New target.
14148         * testsuite/Makefile.in: Rebuild.
14149
14150 2008-04-17  Cary Coutant  <ccoutant@google.com>
14151
14152         * errors.cc (Errors::info): New function.
14153         (gold_info): New function.
14154         * errors.h (Errors::info): New function.
14155         * gold.h (gold_info): New function.
14156         * object.cc (Input_objects::add_object): Print trace output.
14157         * options.cc (options::parse_set): New function.
14158         (General_options::parse_wrap): Deleted.
14159         (General_options::General_options): Deleted initializer.
14160         * options.h (options::String_set): New typedef.
14161         (options::parse_set): New function.
14162         (DEFINE_set): New macro.
14163         (General_options::wrap): Changed to use DEFINE_set. Changed
14164         callers of any_wrap_symbols and is_wrap_symbol.
14165         (General_options::trace, General_options::trace_symbol):
14166         New options.
14167         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14168         (General_options::wrap_symbols_): Deleted.
14169         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14170
14171 2008-04-17  David S. Miller  <davem@davemloft.net>
14172
14173         * options.cc (General_options::parse_V): New function.
14174         * options.h: Add entries for -V and -Qy.
14175
14176 2008-04-17  Ian Lance Taylor  <iant@google.com>
14177
14178         * common.cc (Symbol_table::allocate_commons): Remove options
14179         parameter.  Change caller.
14180         (Symbol_table::do_allocate_commons): Remove options parameter.
14181         Change caller.  Just call do_allocate_commons_list twice.
14182         (Symbol_table::do_allocate_commons_list): New function, broken out
14183         of do_allocate_commons.
14184         * common.h (class Allocate_commons_task): Remove options_ field.
14185         Update constructor.
14186         * symtab.cc (Symbol_table::Symbol_table): Initialize
14187         tls_commons_.
14188         (Symbol_table::add_from_object): Put TLS common symbols on
14189         tls_commons_ list.
14190         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14191         which are IN_OUTPUT_DATA.
14192         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14193         allocate_commons and do_allocate_commons declarations.  Declare
14194         do_allocate_commons_list.
14195         * gold.cc (queue_middle_tasks): Update creation of
14196         Allocate_commons_task to not pass options.
14197         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14198         (TLS_TEST_C_FLAGS): New variable.
14199         (tls_test_c_pic.o): New target.
14200         (tls_test_shared.so): Link in tls_test_c_pic.o.
14201         (tls_test_c_pic_ie.o): New target.
14202         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14203         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14204         (tls_test_c.o): New target.
14205         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14206         (tls_pic_test_LDADD): Likewise.
14207         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14208         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14209         (tls_test_c_gnu2.o): New target.
14210         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14211         tls_test_c_gnu2.o.
14212         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14213         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14214         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14215         * testsuite/tls_test.cc: Include "config.h".
14216         (t_last): Call t11_last.
14217         * testsuite/tls_test.h (t11, t11_last): Declare.
14218         * testsuite/tls_test_c.c: New file.
14219         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14220         * configure.ac: Check for OpenMP support.
14221         * configure, config.in, Makefile.in: Rebuild.
14222         * testsuite/Makefile.in: Rebuild.
14223
14224 2008-04-16  Cary Coutant  <ccoutant@google.com>
14225
14226         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14227         (Target_i386::tls_base_symbol_defined_): New field.
14228         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14229         (Target_i386::Scan::global): Likewise.
14230         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14231         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14232         (Target_x86_64::tls_base_symbol_defined_): New field.
14233         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14234         (Target_x86_64::Scan::global): Likewise.
14235
14236 2008-04-16  Cary Coutant  <ccoutant@google.com>
14237
14238         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14239         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14240         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14241         building shared libraries.
14242         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14243         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14244         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14245         * testsuite/Makefile.in: Rebuild.
14246         * testsuite/weak_undef.h: New file.
14247         * testsuite/weak_undef_file1.cc: Add extra test cases.
14248         * testsuite/weak_undef_file2.cc: Likewise.
14249         * testsuite/weak_undef_test.cc: Likewise.
14250
14251 2008-04-16  David S. Miller  <davem@davemloft.net>
14252
14253         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14254         Add issued_non_pic_error_ field.  Declare check_non_pic.
14255         (Target_sparc::Scan::check_non_pic): New function.
14256         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14257         (Target_sparc::Scan::global): Likewise.
14258
14259         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14260         * configure: Rebuild.
14261
14262         * options.h (DEFINE_enable): New macro.
14263         (new_dtags): New enable option.
14264         (initfirst, interpose, loadfltr, nodefaultlib,
14265         nodelete, nodlopen, nodump): New -z options.
14266         * layout.cc (Layout:finish_dynamic_section): If new
14267         dtags enabled, emit DT_RUNPATH.  Also, emit a
14268         DT_FLAGS_1 containing any specified -z flags.
14269
14270 2008-04-16  Ian Lance Taylor  <iant@google.com>
14271
14272         * copy-relocs.cc: New file.
14273         * copy-relocs.h: New file.
14274         * reloc.cc: Remove Copy_relocs code.
14275         * reloc.h: Likewise.
14276         * reloc-types.h (struct Reloc_types) [both versions]: Add
14277         get_reloc_addend_noerror.
14278         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14279         variants of add_global which take an addend which must be zero.
14280         * i386.cc: Include "copy-relocs.h".
14281         (class Target_i386): Change type of copy_relocs_ to variable,
14282         update initializer.
14283         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14284         Change all callers.
14285         (Target_i386::do_finalize_sections): Change handling of
14286         copy_relocs_.
14287         * sparc.cc: Include "copy-relocs.h".
14288         (class Target_sparc): Change type of copy_relocs_ to variable,
14289         update initializer.
14290         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14291         Change all callers.
14292         (Target_sparc::do_finalize_sections): Change handling of
14293         copy_relocs_.
14294         * x86_64.cc: Include "copy-relocs.h".
14295         (class Target_x86_64): Change type of copy_relocs_ to variable,
14296         update initializer.
14297         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14298         class.  Change all callers.
14299         (Target_x86_64::do_finalize_sections): Change handling of
14300         copy_relocs_.
14301         * Makefile.am (CCFILES): Add copy-relocs.cc.
14302         (HFILES): Add copy-relocs.h.
14303
14304         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14305
14306         * testsuite/script_test_4.sh: Permit leading zeroes.
14307
14308 2008-04-15  Ian Lance Taylor  <iant@google.com>
14309
14310         * script-sections.cc (Script_sections::create_segments): Use
14311         header_size_adjustment even when there is enough room for the
14312         headers.
14313         * testsuite/script_test_4.sh: New file.
14314         * testsuite/script_test_4.t: New file.
14315         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14316         (check_DATA): Add script_test_4.stdout.
14317         (MOSTLYCLEANFILES): Likewise.
14318         (script_test_4): New target.
14319         (script_test_4.stdout): New target.
14320         * testsuite/Makefile.in: Rebuild.
14321
14322         * sparc.cc: Add definitions for Output_data_plt_sparc class
14323         constants.
14324
14325 2008-04-14  David S. Miller  <davem@davemloft.net>
14326
14327         * sparc.cc: New file.
14328         * Makefile.am (TARGETSOURCES): Add sparc.cc
14329         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14330         * configure.tgt: Document targ_extra_size and
14331         targ_extra_big_endian.  Add entries for sparc-* and
14332         sparc64-*.
14333         * configure.ac: Handle targ_extra_size and
14334         targ_extra_big_endian.
14335         * Makefile.in: Rebuild.
14336         * configure: Likewise.
14337         * po/POTFILES.in: Likewise.
14338         * po/gold.pot: Likewise.
14339
14340 2008-04-14  Ian Lance Taylor  <iant@google.com>
14341
14342         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14343         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14344         in the name/type/flags to section mapping.  Don't call
14345         allocate_output_section.
14346         (Layout::choose_output_section): Change parameter from adjust_name
14347         to is_input_section.  Don't permit input sections after sections
14348         are attached to segments.  Don't call allocate_output_section.
14349         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14350         not write_enable_output_section.
14351         (Layout::make_output_section): Don't push to
14352         unattached_section_list_ nor call attach_to_segment.  Call
14353         attach_section_to_segment if sections are attached.
14354         (Layout::attach_sections_to_segments): New function.
14355         (Layout::attach_section_to_segment): New function.
14356         (Layout::attach_allocated_section_to_segment): Rename from
14357         attach_to_segment.  Remove flags parameter.
14358         (Layout::allocate_output_section): Remove function.
14359         (Layout::write_enable_output_section): Remove function.
14360         * layout.h (class Layout): Update for above changes.  Add new
14361         field sections_are_attached_.
14362         * output.h (Output_section::update_flags_for_input_section): New
14363         function.
14364         * output.cc (Output_section::add_input_section): Call
14365         update_flags_for_input_section.
14366         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14367
14368 2008-04-11  Cary Coutant  <ccoutant@google.com>
14369
14370         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14371         thought unnecessary.
14372         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14373
14374 2008-04-11  Ian Lance Taylor  <iant@google.com>
14375
14376         * output.h (class Output_section_data): Remove inline definition
14377         of set_addralign.
14378         * output.cc (Output_section_data::set_addralign): New function.
14379
14380 2008-04-11  Cary Coutant  <ccoutant@google.com>
14381
14382         Add support for TLS descriptors for i386 and x86_64.
14383         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14384         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14385         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14386         GOT_TYPE_TLS_DESC.
14387         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14388         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14389         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14390         relocations.
14391         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14392         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14393         Fix problem with initial-exec relocations.
14394         (Target_i386::Relocate::relocate_tls): Likewise.
14395         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14396         relaxation.
14397         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14398         support for section-plus-offset dynamic table entries.
14399         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14400         (Output_data_dynamic::Dynamic_entry): Add support for
14401         section-plus-offset dynamic table entries.
14402         (Output_data_dynamic::Classification): Likewise.
14403         (Output_data_dynamic::classification_): Renamed offset_.
14404         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14405         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14406         (Target_x86_64::make_plt_section): New function.
14407         (Target_x86_64::reserve_tlsdesc_entries): New function.
14408         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14409         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14410         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14411         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14412         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14413         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14414         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14415         add extra PLT entry for TLS descriptors.
14416         (Output_data_plt_x86_64::got_): New field.
14417         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14418         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14419         fields.
14420         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14421         descriptors.
14422         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14423         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14424         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14425         R_386_TLS_DESC_CALL relocations.
14426         (Target_x86_64::Scan::global): Likewise.
14427         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14428         for TLS descriptors.
14429         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14430         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14431         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14432         GD-to-IE relaxation.
14433         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14434         and TLS_DESCRIPTORS.
14435         * Makefile.in: Rebuild.
14436         * configure: Rebuild.
14437         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14438         (tls_test_shared2.so): New target.
14439         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14440         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14441         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14442         (tls_shared_gd_to_ie_test_LDADD): New variable.
14443         (tls_shared_gnu2_gd_to_ie_test): New target.
14444         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14445         New targets.
14446         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14447         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14448         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14449         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14450         (tls_shared_gnu2_test): New target.
14451         (tls_test_gnu2_shared.so): New target.
14452         (tls_shared_gnu2_test_SOURCES): New variable.
14453         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14454         (tls_shared_gnu2_test_LDFLAGS): New variable.
14455         (tls_shared_gnu2_test_LDADD): New variable.
14456         * testsuite/Makefile.in: Rebuild.
14457         * testsuite/Makefile.
14458
14459 2008-04-11  Ian Lance Taylor  <iant@google.com>
14460
14461         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14462         justsyms.t.
14463         * testsuite/Makefile.in: Rebuild.
14464
14465         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14466         long.
14467         * testsuite/script_test_2.cc (main): Adjust test.
14468
14469 2008-04-11  David S. Miller  <davem@davemloft.net>
14470             Ian Lance Taylor  <iant@google.com>
14471
14472         * options.h (General_options): Add entries for '-Y' and
14473         '-relax'.
14474         * options.cc (General_options:finalize): If -Y was used, add those
14475         entries to the library path instead of the default "/lib" and
14476         "/usr/lib".
14477
14478 2008-04-11  David S. Miller  <davem@davemloft.net>
14479
14480         * testsuite/justsyms.t: Start at 0x100.
14481         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14482         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14483         long.
14484         * testsuite/script_test_2.cc: Adjust string and section length
14485         checks.
14486
14487 2008-04-09  Ian Lance Taylor  <iant@google.com>
14488
14489         PR gold/5996
14490         * script-sections.cc (Sections_element::allocate_to_segment): Add
14491         orphan parameter.
14492         (Output_section_definition::allocate_to_segment): Likewise.
14493         (Orphan_output_section::allocate_to_segment): Likewise.
14494         (Script_sections::attach_sections_using_phdrs_clause): Don't
14495         propagate non-PT_LOAD segments to orphan sections.
14496         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14497         readelf rather than objdump.
14498         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14499         .interp section and PT_INTERP segment are the same size.
14500         * testsuite/Makefile.in: Rebuild.
14501
14502         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14503         aliases for symbols defined in the same object.
14504         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14505         (weak_alias_test_SOURCES): New variable.
14506         (weak_alias_test_DEPENDENCIES): New variable.
14507         (weak_alias_test_LDFLAGS): New variable.
14508         (weak_alias_test_LDADD): New variable.
14509         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14510         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14511         (weak_alias_test_3.o): New target.
14512         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14513         * testsuite/weak_alias_test_main.cc: New file.
14514         * testsuite/weak_alias_test_1.cc: New file.
14515         * testsuite/weak_alias_test_2.cc: New file.
14516         * testsuite/weak_alias_test_3.cc: New file.
14517
14518 2008-04-08  Ian Lance Taylor  <iant@google.com>
14519
14520         * options.h (class General_options): Add --noinhibit-exec option.
14521         * main.cc (main): Check --noinhibit-exec.
14522
14523         * options.h (class General_options): Define --wrap as a special
14524         option.  Add wrap_symbols_ field.
14525         (General_options::any_wrap_symbols): New function.
14526         (General_options::is_wrap_symbol): New function.
14527         * options.cc (General_options::parse_wrap): New function.
14528         (General_options::General_options): Initialize wrap_symbols_.
14529         * symtab.cc (Symbol_table::wrap_symbol): New function.
14530         (Symbol_table::add_from_object): Handle --wrap.
14531         * symtab.h (class Symbol_table): Declare wrap_symbol.
14532         * target.h (Target::wrap_char): New function.
14533         (Target::Target_info): Add wrap_char field.
14534         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14535         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14536         * testsuite/testfile.cc (Target_test::test_target_info):
14537         Likewise.
14538
14539         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14540         there is one.
14541
14542         * layout.h (class Layout): Add added_eh_frame_data_ field.
14543         * layout.cc (Layout::Layout): Initialize new field.
14544         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14545         output section until we find a section we merged successfully.
14546         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14547         that the size be non-zero.
14548
14549         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14550         qualifier.
14551
14552 2008-04-08  Craig Silverstein  <csilvers@google.com>
14553
14554         * configure.ac: Export new conditional variable HAVE_ZLIB.
14555         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14556         on HAVE_ZLIB.
14557         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14558         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14559
14560 2008-04-07  Ian Lance Taylor  <iant@google.com>
14561
14562         * version.cc (version_string): Set to "1.5".
14563
14564         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14565         Add issued_non_pic_error_ field.  Declare check_non_pic.
14566         (Target_x86_64::Scan::check_non_pic): New function.
14567         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14568         (Target_x86_64::Scan::global): Likewise.
14569
14570         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14571         addend parameter.  Change caller.  Handle merge sections.
14572         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14573         Address to Addend.  Don't add in the result of
14574         local_section_offset, pass down the addend and use the returned
14575         value.
14576         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14577         Update declarations of local_section_offset and symbol_value.
14578         * testsuite/two_file_test_1.cc (t18): New function.
14579         * testsuite/two_file_test_2.cc (f18): New function.
14580         * testsuite/two_file_test_main.cc (main): Call t18.
14581         * testsuite/two_file_test.h (t18, f18): Declare.
14582
14583         * configure.ac: Don't test for objdump, c++filt, or readelf.
14584         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14585         conditionals.
14586         (TEST_READELF): New variable.
14587         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14588         (check_PROGRAMS): Add two_file_strip_test.
14589         (two_file_strip_test): New target.
14590         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14591         (two_file_same_shared_strip_test_SOURCES): New variable.
14592         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14593         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14594         (two_file_same_shared_strip_test_LDADD): New variable.
14595         (two_file_shared_strip.so): New target.
14596         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14597         (ver_test_5.syms, ver_test_7.syms): Likewise.
14598         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14599         (strip_test_3.stdout): Use TEST_OBJDUMP.
14600         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14601
14602 2008-04-04  Cary Coutant  <ccoutant@google.com>
14603
14604         * symtab.h (Symbol::is_weak_undefined): New function.
14605         (Symbol::is_strong_undefined): New function.
14606         (Symbol::is_absolute): New function.
14607         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14608         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14609         absolute symbols.
14610         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14611         (weak_undef_test): New target.
14612         * testsuite/Makefile.in: Rebuild.
14613         * testsuite/weak_undef_file1.cc: New file.
14614         * testsuite/weak_undef_file2.cc: New file.
14615         * testsuite/weak_undef_test.cc: New file.
14616
14617 2008-04-03  Craig Silverstein  <csilvers@google.com>
14618
14619         * compressed_output.h (class Output_compressed_section): Use
14620         unsigned buffer.
14621         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14622         add zlib header.
14623         (zlib_compressed_suffix): Removed.
14624         (Output_compressed_section::set_final_data_size): Use unsigned
14625         buffers.
14626         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14627         Fix linker invocation.
14628         (flagstest_o_specialfile_and_compress_debug_sections):
14629         Likewise.
14630         * testsuite/Makefile.in: Regenerated.
14631
14632 2008-04-02  David S. Miller  <davem@davemloft.net>
14633
14634         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14635         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14636
14637 2008-04-02  Craig Silverstein  <csilvers@google.com>
14638
14639         * TODO: New file.
14640
14641 2008-04-02  Ian Lance Taylor  <iant@google.com>
14642
14643         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14644         parameters.  Update for new key type to views_.  Change all
14645         callers.
14646         (File_read::read): Adjust for byteshift in returned view.
14647         (File_read::add_view): New function, broken out of
14648         find_and_make_view.
14649         (File_read::make_view): New function, broken out of
14650         find_and_make_view.
14651         (File_read::find_or_make_view): Add offset and aligned
14652         parameters.  Rewrite accordingly.  Change all callers.
14653         (File_read::get_view): Add offset and aligned parameters.  Adjust
14654         for byteshift in return value.
14655         (File_read::get_lasting_view): Likewise.
14656         * fileread.h (class File_read): Update declarations.
14657         (class File_read::View): Add byteshift_ field.  Add byteshift to
14658         constructor.  Add byteshift method.
14659         * archive.h (Archive::clear_uncached_views): New function.
14660         (Archive::get_view): Add aligned parameter.  Change all callers.
14661         * object.h (Object::get_view): Add aligned parameter.  Change all
14662         callers.
14663         (Object::get_lasting_view): Likewise.
14664
14665         * fileread.cc (File_read::release): Don't call clear_views if
14666         there are multiple objects.
14667         * fileread.h (File_read::clear_uncached_views): New function.
14668         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14669         on the archive.
14670
14671 2008-03-31  Cary Coutant  <ccoutant@google.com>
14672
14673         Add thin archive support.
14674         * archive.cc (Archive::armagt): New const.
14675         (Archive::setup): Remove task parameter and calls to unlock.
14676         (Archive::unlock_nested_archives): New function.
14677         (Archive::read_header): Add nested_off parameter. Change
14678         all callers.
14679         (Archive::interpret_header): Likewise.
14680         (Archive::include_all_members): Change to handle thin
14681         archives.
14682         (Archive::include_member): Likewise.
14683         * archive.h (Archive::Archive): Add new parameters and
14684         initializers.
14685         (Archive::armagt): New const.
14686         (Archive::setup): Remove task parameter.
14687         (Archive::unlock_nested_archives): New function.
14688         (Archive::read_header): Add nested_off parameter.
14689         (Archive::interpret_header): Likewise.
14690         (Archive::Nested_archive_table): New typedef.
14691         (Archive::is_thin_archive_): New field.
14692         (Archive::nested_archives_): New field.
14693         (Archive::options_): New field.
14694         (Archive::dirpath_): New field.
14695         (Archive::task_): New field.
14696         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14697         for thin archives.  Pass additional parameters to
14698         Archive::Archive.  Unlock the archive file after calling
14699         Archive::setup.
14700
14701 2008-03-29  Ian Lance Taylor  <iant@google.com>
14702
14703         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14704         version symbol to be local.
14705         * testsuite/ver_test_4.sh: New file.
14706         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14707         (check_DATA): Add ver_test_4.syms.
14708         (ver_test_4.syms): New target.
14709         * testsuite/Makefile.in: Rebuild.
14710
14711         * output.cc
14712         (Output_section::Input_section_sort_entry::has_priority): New
14713         function.
14714         (Output_section::Input_section_sort_entry::match_file_name): New
14715         function.
14716         (Output_section::Input_section_sort_entry::match_section_name):
14717         Remove.
14718         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14719         Remove.
14720         (Output_section::Input_section_sort_entry::match_section_file):
14721         Remove.
14722         (Output_section::Input_section_sort_compare::operator()): Rewrite
14723         using new Input_section_sort_entry functions.  Sort crtbegin and
14724         crtend first.  Sort sections with no priority before sections with
14725         a priority.
14726         * testsuite/initpri1.c (d3): Check j != 4.
14727         (cd5): New constructor/destructor function.
14728         (main): Check j != 2.
14729
14730         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14731         new symbol when resolving, don't call set_is_default.
14732         * testsuite/ver_test_7.cc: New file.
14733         * testsuite/ver_test_7.sh: New file.
14734         * testsuite/Makefile.am (ver_test_7.so): New target.
14735         (ver_test_7.o): New target.
14736         (check_SCRIPTS): Add ver_test_7.sh.
14737         (check_DATA): Add ver_test_7.syms.
14738         (ver_test_7.syms): New target.
14739
14740 2008-03-28  Ian Lance Taylor  <iant@google.com>
14741
14742         * layout.cc (Layout::layout): If we see an input section with a
14743         name that needs sorting, set the must_sort flag for the output
14744         section.
14745         (Layout::make_output_section): If the name of the output section
14746         indicates that it might require sorting, set the may_sort flag.
14747         * output.h (Output_section::may_sort_attached_input_sections): New
14748         function.
14749         (Output_section::set_may_sort_attached_input_sections): New
14750         function.
14751         (Output_section::must_sort_attached_input_sections): New
14752         function.
14753         (Output_section::set_must_sort_attached_input_sections): New
14754         function.
14755         (class Output_section): Declare Input_section_sort_entry.  Define
14756         Input_section_sort_compare.  Declare
14757         sort_attached_input_sections.  Add new fields:
14758         may_sort_attached_input_sections_,
14759         must_sort_attached_input_sections_,
14760         attached_input_sections_are_sorted_.
14761         * output.cc (Output_section::Output_section): Initialize new
14762         fields.
14763         (Output_section::add_input_section): Add an entry to
14764         input_sections_ if may_sort or must_sort are true.
14765         (Output_section::set_final_data_size): Call
14766         sort_attached_input_sections if necessary.
14767         (Output_section::Input_section_sort_entry): Define new class.
14768         (Output_section::Input_section_sort_compare::operator()): New
14769         function.
14770         (Output_section::sort_attached_input_sections): New function.
14771         * configure.ac: Check whether the compiler supports constructor
14772         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14773         * testsuite/initpri1.c: New file.
14774         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14775         CONSTRUCTOR_PRIORITY.
14776         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14777         (initpri1_LDFLAGS): New variable.
14778         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14779
14780 2008-03-27  Ian Lance Taylor  <iant@google.com>
14781
14782         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14783         * testsuite/common_test_1.c: New file.
14784         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14785         (common_test_1_SOURCES): New variable.
14786         (common_test_1_DEPENDENCIES): New variable.
14787         (common_test_1_LDFLAGS): New variable.
14788
14789         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14790         and commons_ correctly when NAME/VERSION does not override
14791         NAME/NULL.
14792         * testsuite/ver_test_6.c: New file.
14793         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14794         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14795         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14796
14797 2008-03-26  Ian Lance Taylor  <iant@google.com>
14798
14799         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14800         of an undefined symbol from a version script.
14801         * testsuite/Makefile.am (ver_test_5.so): New target.
14802         (ver_test_5.o): New target.
14803         (check_SCRIPTS): Add ver_test_5.sh.
14804         (check_DATA): Add ver_test_5.syms.
14805         (ver_test_5.syms): New target.
14806         * testsuite/ver_test_5.cc: New file.
14807         * testsuite/ver_test_5.script: New file.
14808         * testsuite/ver_test_5.sh: New file.
14809         * Makefile.in, testsuite/Makefile.in: Rebuild.
14810
14811         PR gold/5986
14812         Fix problems building gold with gcc 4.3.0.
14813         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14814         (gold_error_at_location, gold_warning_at_location): Use it.
14815         * configure.ac: Check whether we can compile and use a template
14816         function with a printf attribute.
14817         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14818         when jumping over bytes.
14819         * object.cc: Instantiate Object::read_section_data.
14820         * debug.h: Include <cstring>
14821         * dwarf_reader.cc: Include <algorithm>
14822         * main.cc: Include <cstring>.
14823         * options.cc: Include <cstring>.
14824         * output.cc: Include <cstring>.
14825         * script.cc: Include <cstring>.
14826         * script.h: Include <string>.
14827         * symtab.cc: Include <cstring> and <algorithm>.
14828         * target-select.cc: Include <cstring>.
14829         * version.cc: Include <string>.
14830         * testsuite/testmain.cc: Include <cstdlib>.
14831         * configure, config.in: Rebuild.
14832
14833 2008-03-25  Ian Lance Taylor  <iant@google.com>
14834
14835         * options.cc: Include "../bfd/bfdver.h".
14836         (options::help): Print bug reporting address.
14837
14838         * version.cc (print_version): Adjust output for current value of
14839         BFD_VERSION_STRING.
14840
14841         * NEWS: New file.
14842
14843         * options.cc (options::help): Print list of supported targets.
14844         * target-select.h: Include <vector>.
14845         (class Target_selector): Make machine_, size_, and is_big_endian_
14846         fields const.  Add bfd_name_ and instantiated_target_ fields.
14847         (Target_selector::Target_selector): Add bfd_name parameter.
14848         (Target_selector::recognize): Make non-virtual, call
14849         do_recognize.
14850         (Target_selector::recognize_by_name): Make non-virtual, call
14851         do_recognize_by_name.
14852         (Target_selector::supported_names): New function.
14853         (Target_selector::bfd_name): New function.
14854         (Target_selector::do_instantiate_target): New pure virtual
14855         function.
14856         (Target_selector::do_recognize): New virtual function.
14857         (Target_selector::do_recognize_by_name): New virtual function.
14858         (Target_selector::instantiate_target): New private function.
14859         (supported_target_names): Declare.
14860         * target-select.cc (Target_selector::Target_selector): Update for
14861         new parameter and fields.
14862         (select_target_by_name): Check that the name matches before
14863         calling recognize_by_name.
14864         (supported_target_names): New function.
14865         * i386.cc (class Target_selector_i386): Update Target_selector
14866         constructor call.  Remove recognize and recognize_by_name.  Add
14867         do_instantiate_target.
14868         * x86_64.cc (class Target_selector_x86_64): Likewise.
14869         * testsuite/testfile.cc (class Target_selector_test): Update for
14870         changes to Target_selector.
14871
14872         * README: Rewrite, with some notes on unsupported features.
14873
14874 2008-03-24  Cary Coutant  <ccoutant@google.com>
14875
14876         * i386.cc (Target_i386::Got_type): New enum declaration.
14877         (Target_i386::Scan::local): Updated callers of Output_data_got
14878         member functions.
14879         (Target_i386::Scan::global): Likewise.
14880         (Target_i386::Relocate::relocate): Likewise.
14881         (Target_i386::Relocate::relocate_tls): Likewise.
14882         * object.h (Got_offset_list): New class.
14883         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14884         (Sized_relobj::local_got_offset): Likewise.
14885         (Sized_relobj::set_local_got_offset): Likewise.
14886         (Sized_relobj::local_has_tls_got_offset): Removed.
14887         (Sized_relobj::local_tls_got_offset): Removed.
14888         (Sized_relobj::set_local_tls_got_offset): Removed.
14889         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14890         * output.cc (Output_data_got::add_global): Added got_type parameter.
14891         (Output_data_got::add_global_with_rel): Likewise.
14892         (Output_data_got::add_global_with_rela): Likewise.
14893         (Output_data_got::add_global_pair_with_rel): New function.
14894         (Output_data_got::add_global_pair_with_rela): New function.
14895         (Output_data_got::add_local): Added got_type parameter.
14896         (Output_data_got::add_local_with_rel): Likewise.
14897         (Output_data_got::add_local_with_rela): Likewise.
14898         (Output_data_got::add_local_pair_with_rel): New function.
14899         (Output_data_got::add_local_pair_with_rela): New function.
14900         (Output_data_got::add_global_tls): Removed.
14901         (Output_data_got::add_global_tls_with_rel): Removed.
14902         (Output_data_got::add_global_tls_with_rela): Removed.
14903         (Output_data_got::add_local_tls): Removed.
14904         (Output_data_got::add_local_tls_with_rel): Removed.
14905         (Output_data_got::add_local_tls_with_rela): Removed.
14906         * output.h (Output_data_got::add_global): Added got_type parameter.
14907         (Output_data_got::add_global_with_rel): Likewise.
14908         (Output_data_got::add_global_with_rela): Likewise.
14909         (Output_data_got::add_global_pair_with_rel): New function.
14910         (Output_data_got::add_global_pair_with_rela): New function.
14911         (Output_data_got::add_local): Added got_type parameter.
14912         (Output_data_got::add_local_with_rel): Likewise.
14913         (Output_data_got::add_local_with_rela): Likewise.
14914         (Output_data_got::add_local_pair_with_rel): New function.
14915         (Output_data_got::add_local_pair_with_rela): New function.
14916         (Output_data_got::add_global_tls): Removed.
14917         (Output_data_got::add_global_tls_with_rel): Removed.
14918         (Output_data_got::add_global_tls_with_rela): Removed.
14919         (Output_data_got::add_local_tls): Removed.
14920         (Output_data_got::add_local_tls_with_rel): Removed.
14921         (Output_data_got::add_local_tls_with_rela): Removed.
14922         * resolve.cc (Symbol::override_base_with_special): Removed
14923         reference to has_got_offset_ field.
14924         * symtab.cc (Symbol::init_fields): Replaced initialization
14925         of got_offset_ with got_offsets_.  Removed initialization
14926         of has_got_offset_
14927         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14928         (Symbol::got_offset): Likewise.
14929         (Symbol::set_got_offset): Likewise.
14930         (Symbol::has_tls_got_offset): Removed.
14931         (Symbol::tls_got_offset): Removed.
14932         (Symbol::set_tls_got_offset): Removed.
14933         (Symbol::got_offset_): Removed.
14934         (Symbol::tls_mod_got_offset_): Removed.
14935         (Symbol::tls_pair_got_offset_): Removed.
14936         (Symbol::got_offsets_): New field.
14937         (Symbol::has_got_offset): Removed.
14938         (Symbol::has_tls_mod_got_offset): Removed.
14939         (Symbol::has_tls_pair_got_offset): Removed.
14940         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14941         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14942         member functions.
14943         (Target_x86_64::Scan::global): Likewise.
14944         (Target_x86_64::Relocate::relocate): Likewise.
14945         (Target_x86_64::Relocate::relocate_tls): Likewise.
14946
14947 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14948
14949         * yyscript.y: Fix spelling error in comment.
14950
14951 2008-03-24  Ian Lance Taylor  <iant@google.com>
14952
14953         * options.h (class General_options): Define build_id option.
14954         * layout.h (class Layout): Declare write_build_id, create_note,
14955         create_build_id.  Add build_id_note_ member.
14956         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14957         "libiberty.h", "md5.h", "sha1.h".
14958         (Layout::Layout): Initialize eh_frame_data_,
14959         eh_frame_hdr_section_, and build_id_note_.
14960         (Layout::finalize): Call create_build_id.
14961         (Layout::create_note): New function, broken out of
14962         Layout::create_gold_note.
14963         (Layout::create_gold_note): Call create_note.
14964         (Layout::create_build_id): New function.
14965         (Layout::write_build_id): New function.
14966         (Close_task_runner::run): Call write_build_id.
14967
14968         * x86_64.cc: Correct license to GPLv3.
14969
14970 2008-03-23  Ian Lance Taylor  <iant@google.com>
14971
14972         * options.cc: Include "demangle.h".
14973         (parse_optional_string): New function.
14974         (parse_long_option): Handle takes_optional_argument.
14975         (parse_short_option): Update dash_z initializer.  Handle
14976         takes_optional_argument.
14977         (General_options::General_options): Initialize do_demangle_.
14978         (General_options::finalize): Set do_demangle_.  Handle demangling
14979         style.
14980         * options.h (parse_optional_string): Declare.
14981         (struct One_option): Add optional_arg field.  Update constructor.
14982         Update call constructor calls.  Add takes_optional_argument
14983         function.
14984         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14985         (DEFINE_optional_string): Define.
14986         (General_options::demangle): Change from DEFINE_bool to
14987         DEFINE_optional_string.
14988         (General_options::no_demangle): New function.
14989         (General_options::do_demangle): New function.
14990         (General_options::set_do_demangle): New function.
14991         (General_options::execstack_status_): Move definition to end of
14992         class definition.
14993         (General_options::static_): Likewise.
14994         (General_options::do_demangle_): New field.
14995         * object.cc (big_endian>::get_symbol_location_info): Call
14996         Options::do_demangle, not Options::demangle.
14997         * symtab.cc (demangle): Likewise.
14998
14999 2008-03-22  Ian Lance Taylor  <iant@google.com>
15000
15001         * gold.h: Include <cstddef> and <sys/types.h>
15002         * options.h: Include <cstring>.
15003
15004 2008-03-21  Ian Lance Taylor  <iant@google.com>
15005
15006         * Added source code to GNU binutils.
15007 \f
15008 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15009
15010 Copying and distribution of this file, with or without modification,
15011 are permitted in any medium without royalty provided the copyright
15012 notice and this notice are preserved.
15013
15014 Local Variables:
15015 mode: change-log
15016 left-margin: 8
15017 fill-column: 74
15018 version-control: never
15019 End: