Add missing author to last ChangeLog entry.
[external/binutils.git] / gold / ChangeLog
1 2013-07-23  Cary Coutant  <ccoutant@google.com>
2             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
3
4         * parameters.cc (Parameters::entry): Return target-specific entry
5         symbol name.
6         * target.h (Target::entry_symbol_name): New function.
7         (Target_info::entry_symbol_name): New data member.
8
9         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
10         * i386.cc (Target_i386::i386_info): Likewise.
11         (Target_i386_nacl::i386_nacl_info): Likewise.
12         * sparc.cc (Target_sparc::sparc_info): Likewise.
13         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
14         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
15         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
16         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
17
18 2013-07-22  Sterling Augustine  <saugustine@google.com>
19
20         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
21         Convert parameter shndx to local variable. Add parameters symtab
22         and symtab_size.  Scan over section names.  Find relocation
23         section corresponding to current section.  Create and initialize
24         reloc_mapper_ and reloc_type_.
25         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
26         unit_length to off_t.  Initialize member unit_length_.  Fill in field
27         cu_offset_.
28         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
29         Initialize new fields unit_length_ and cu_offset_.
30         (Dwarf_pubnames_table::read_section): Update prototype.
31         (Dwarf_pubnames_table::cu_offset): New member function.
32         (Dwarf_pubnames_table::subsection_size): Likewise.
33         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
34         New fields.
35         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
36         member functions public.
37         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
38         Update comment.  Rework logic.  Move repeated parts to...
39         (Gdb_index_info_reader::read_pubtable): ...here. New function.
40         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
41         pubtypes_table_, and stmt_list_offset.
42         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
43         Gdb_index::find_pubtype_offset,
44         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
45         (Gdb_index::pubnames_read): Update prototype and rework logic.
46         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
47         Forward declare.
48         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
49         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
50         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
51         Gdb_index::map_pubtable_to_dies):
52         Declare functions.
53         (Gdb_index::pubnames_read): Update declaration.
54         (Gdb_index::Pubname_offset_map): New type.
55         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
56         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
57         Gdb_index::stmt_list_offset): Declare.
58         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
59         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
60         Gdb_index::pubtypes_offset_): Remove.
61
62 2013-07-19  Roland McGrath  <mcgrathr@google.com>
63
64         * options.h (General_options): Add -Trodata-segment option.
65         * parameters.cc (Parameters::check_rodata_segment): New function.
66         (Parameters::set_target_once): Call it.
67         * parameters.h (Parameters): Declare it (private member function).
68         * layout.cc (load_seg_unusable_for_headers): New function, broken
69         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
70         then validate rodata segment rather than text segment.
71         (relaxation_loop_body): Call that.
72         (is_text_segment): New function.  Don't admit a non-executable
73         segment if TARGET->isolate_execinstr().
74         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
75
76 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
77
78         PR gold/15070
79         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
80         * nacl.h (Sniff_file::View::View): Request aligned view.
81
82 2013-07-11  Cary Coutant  <ccoutant@google.com>
83
84         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
85         correct BRLT entry size.
86
87 2013-07-03  Alan Modra  <amodra@gmail.com>
88
89         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
90         comment.
91
92 2013-07-01  Cary Coutant  <ccoutant@google.com>
93
94         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
95         reloc_type_.
96         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
97         (Dwarf_ranges_table::lookup_reloc): New function.
98         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
99         reloc_type_.
100         (Dwarf_ranges_table::lookup_reloc): New function.
101         (Dwarf_ranges_table::reloc_type_): New data member.
102
103 2013-06-27  Jing Yu  <jingyu@google.com>
104
105         PR gold/15662
106         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
107         function.
108         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
109         (Target_powerpc::do_relax): Call the above.
110
111 2013-06-27  Cary Coutant  <ccoutant@google.com>
112
113         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
114         on garbage collected .opd section.
115
116 2013-06-27  Alan Modra  <amodra@gmail.com>
117
118         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
119         is non-zero.
120         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
121         (Target_powerpc::do_function_location): Likewise for loc->shndx.
122
123 2013-06-14  Cary Coutant  <ccoutant@google.com>
124
125         * resolve.cc (Symbol::override_base): Don't override st_type
126         from plugin placeholder symbols.
127         (Symbol_table::resolve): Likewise.
128         (Symbol_table::should_override): Don't complain about TLS mismatch
129         if the TO symbol is a plugin placeholder.
130         * testsuite/Makefile.am (plugin_test_tls): New test.
131         * testsuite/Makefile.in: Regenerate.
132         * testsuite/plugin_test_tls.sh: New test script.
133         * testsuite/two_file_test_2_tls.cc: New test source.
134         * testsuite/two_file_test_tls.cc: New test source.
135
136 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
137
138         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
139         the maximum segment alignment is larger than the page size.
140         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
141         correctly aligns the symbols with large alignemnt.
142         * testsuite/Makefile.in: Regenerate.
143         * testsuite/large_symbol_alignment.cc: New file.
144
145 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
146             Sriraman Tallam  <tmsriram@google.com>
147
148         * options.h (sort_section): New option.
149         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
150         Rename from Input_section_sort_section_name_special_ordering_compare.
151         (Input_section_sort_section_name_compare): New struct.
152         * output.cc (Output_section::Input_section_sort_section_name_compare::
153         operator()): New function.
154         (Output_section::sort_attached_input_sections): Use new sort function
155         for .text if --sort-section=name is specified.
156         * layout.cc (Layout::make_output_section):
157         Add sorting by name when --sort-section=name is specified.
158         * testsuite/Makefile.am (text_section_grouping): Test option
159         --sort-section=name.
160         * testsuite/Makefile.in: Regenerate.
161         * testsuite/section_sorting_name.cc: New file.
162         * testsuite/section_sorting_name.sh: New file.
163
164 2013-05-21  Cary Coutant  <ccoutant@google.com>
165
166         * symtab.h (Symbol::is_cxx_vtable): New function.
167         * target-reloc.h (relocate_section): Check for vtable symbol.
168         * testsuite/Makefile.am (missing_key_func.sh): New test case.
169         * testsuite/Makefile.in: Regenerate.
170         * testsuite/missing_key_func.cc: New test source.
171         * testsuite/missing_key_func.sh: New test script.
172
173 2013-05-21  Cary Coutant  <ccoutant@google.com>
174
175         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
176         type of enclosing symbol.
177         (Relocate_info::location): Check symbol type when describing symbol.
178         * object.h (Symbol_location_info): Remove unused line_number;
179         add enclosing_symbol_type.
180         * testsuite/debug_msg.sh: Adjust expected output.
181
182 2013-05-13  Cary Coutant  <ccoutant@google.com>
183
184         * configure.ac: Export DEFAULT_TARGET.
185         * configure: Regenerate.
186         * Makefile.in: Regenerate.
187         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
188         * testsuite/Makefile.in: Regenerate.
189         * testsuite/debug_msg.sh: Delete duplicate tests.
190         Don't check undef_int error message match for powerpc where the
191         source file and line number aren't available.
192
193 2013-05-10  Roland McGrath  <mcgrathr@google.com>
194
195         * options.h (General_options): Add --rosegment-gap option.
196         * options.cc (finalize): --rosegment-gap implies --rosegment.
197         * layout.cc (set_segment_offsets): Let user option override
198         target->rosegment_gap().
199
200 2013-05-10  Roland McGrath  <mcgrathr@google.com>
201
202         * options.h (General_options): Remove leading space from help
203         messages for -nostdlib and --rosegment.
204
205 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
206
207         PR ld/15365
208         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
209
210 2013-05-03  Alan Modra  <amodra@gmail.com>
211
212         * merge.cc (Output_merge_string::do_add_input_section): Correct
213         scan for number of strings.  Rename vars to avoid shadowing.
214         Include missing terminator in input_size_.
215
216 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
217
218         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
219         Restore empty string handling.
220
221 2013-05-01  Cary Coutant  <ccoutant@google.com>
222
223         * stringpool.cc (Stringpool_template::new_key_offset): Fix
224         uninitialized warning.
225
226 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
227
228         * output.cc (Output_section::add_merge_input_section): Allow
229         to merge sections if the alignment is more than character size.
230         * merge.h (Output_merge_string::Output_merge_string): Remove
231         assert.
232         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
233         only not-null strings. Check the alignment of strings.
234         * stringpool.h
235         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
236         alignment as the argument.
237         (Stringpool_template<Stringpool_char>::addralign_): New class member.
238         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
239         Align non-zero length strings according to the addralign_.
240         (Stringpool_template<Stringpool_char>::set_string_offsets):
241         Updating offsets according to the given alignment.
242         * testsuite/Makefile.am (text_section_grouping): Test if string
243         literals are getting merged.
244         * testsuite/Makefile.in: Regenerate.
245         * testsuite/merge_string_literals_1.c: New file.
246         * testsuite/merge_string_literals_2.c: Ditto.
247         * testsuite/merge_string_literals.sh: Ditto.
248
249 2013-04-26  Ian Lance Taylor  <iant@google.com>
250
251         * target-reloc.h (relocate_section): If the reloc offset is out of
252         range, pass VIEW as NULL to relocate.relocate.
253         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
254         * i386.cc (Target_i386::Relocate::relocate): Likewise.
255         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
256         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
257         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
258         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
259
260 2013-04-26  Geoff Pike  <gpike@chromium.org>
261
262         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
263         * layout.cc (Hash_task): New class.
264         (Layout::queue_build_id_tasks): New function.
265         (Layout::write_build_id): Handle single-thread portion of build ID
266         computation.  (In some cases, all of it is single-threaded.)  Replace
267         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
268         functionality in fewer lines of code.
269         * layout.h (Layout::queue_build_id_tasks): New function declaration.
270         * options.h (General_options): make "--build-id" default to tree
271         rather than sha1.  Add two new options related to --build-id=tree:
272         --build-id-chunk-size-for-treehash and
273         --build-id-min-file-size-for-treehash.
274         * Makefile.am: add testing of --build-id=tree and related new options
275         (these tests will be invoked by "make check").
276         * Makefile.in: Regenerate.
277
278 2013-04-25  Alan Modra  <amodra@gmail.com>
279
280         * configure.tgt: Add powerpcle and powerpc64le.
281
282 2013-04-22  Alan Modra  <amodra@gmail.com>
283
284         PR gold/15355
285         * layout.cc (Layout::segment_precedes): Allow more than one
286         segment with the same type and flags.
287
288 2013-04-15  Cary Coutant  <ccoutant@google.com>
289
290         * layout.cc (Layout::set_relocatable_section_offsets): Don't
291         allocate space in file for BSS sections.
292
293 2013-04-15  Cary Coutant  <ccoutant@google.com>
294
295         * script-sections.cc (Orphan_output_section): Reset address
296         to zero after each orphaned section for relocatable links.
297
298 2013-04-15  Cary Coutant  <ccoutant@google.com>
299
300         * symtab.cc (Symbol_table::sized_write_globals): Subtract
301         section starting address for relocatable link.
302         * testsuite/Makefile.am (script_test_11): New test.
303         * testsuite/Makefile.in: Regenerate.
304         * testsuite/script_test_11.c: New source file.
305         * testsuite/script_test_11.t: New linker script.
306
307 2013-04-13  Alan Modra  <amodra@gmail.com>
308
309         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
310         owner when sections are not adjacent and exceed group size.
311         (Target_powerpc::group_sections): Handle corner case.
312         (Target_powerpc::Branch_info::make_stub): Handle case where
313         stub table doesn't exist due to branches in non-exec sections.
314         (Target_powerpc::Relocate::relocate): Likewise.
315
316 2013-04-11  Alan Modra  <amodra@gmail.com>
317
318         PR gold/15354
319         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
320         .branch_lt to match bfd ld.  Adjust comments throughout file.
321
322 2013-04-04  Ian Lance Taylor  <iant@google.com>
323
324         GCC PR c++/56840
325         * object.cc (do_layout_deferred_sections): Handle .eh_frame
326         sections before checking whether they are included in the link.
327
328 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
329
330         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
331         object before calling the plugin claim_file handler.  Pass the elf
332         object of the archive to the plugin. Delete the elf object if the
333         plugin claims the file.
334
335 2013-03-21  Alan Modra  <amodra@gmail.com>
336
337         * layout.cc (Layout::set_segment_offsets): Accept writable .text
338         segment when omagic.
339
340 2013-03-21  Alan Modra  <amodra@gmail.com>
341
342         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
343         comparison warning.
344         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
345         uninitialized" warning.
346
347 2013-03-20  Alan Modra  <amodra@gmail.com>
348
349         * symtab.h (Symbol::clear_version): New function.
350         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
351         is_needed by weak references.  Clear version for symbols defined
352         in as-needed objects that are not needed.
353
354 2013-03-15  Alan Modra  <amodra@gmail.com>
355
356         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
357         static and public.  Add report_err param.  Return false for data refs.
358         (Target_powerpc::rela_dyn_section): New overloaded function.
359         (Target_powerpc::plt_, iplt_): Elucidate.
360         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
361         (Output_data_plt_powerpc::do_write): Don't write .iplt.
362         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
363         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
364         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
365         push_branch and make_plt_entry for ifunc syms when
366         reloc_needs_plt_for_ifunc.
367         (Target_powerpc::Relocate::relocate): Don't use plt entry value
368         for ifunc unless reloc_needs_plt_for_ifunc.
369
370 2013-03-15  Alan Modra  <amodra@gmail.com>
371
372         * gc.h (gc_process_relocs): Don't look through function descriptors.
373         * icf.cc (get_section_contents): Do so here instead.
374
375 2013-03-13  Alan Modra  <amodra@gmail.com>
376
377         * powerpc.cc (is_branch_reloc): Forward declare.
378         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
379         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
380         false for 64-bit, true for 32-bit non-branch relocs.
381         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
382         * testsuite/Makefile.am (icf_test): Use linker map file instead of
383         nm output.
384         (icf_safe_test): Generate linker map file as well as nm output.
385         (icf_safe_so_test): Likewise.
386         * testsuite/Makefile.in: Regenerate.
387         * testsuite/icf_test.sh: Parse linker map file to determine
388         section folding.
389         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
390         * testsuite/icf_safe_so_test.sh: Likewise.
391         (X86_32_or_ARM_specific_safe_fold): Merge into..
392         (arch_specific_safe_fold): ..this.
393         (X86_64_specific_safe_fold): Delete unused function.
394
395 2013-03-12  Alan Modra  <amodra@gmail.com>
396
397         * gc.h (gc_process_relocs): Look through function descriptors
398         to determine shndx, symvalue and addend used by ICF.  Tidy
399         variable duplication.
400
401 2013-03-11  Alan Modra  <amodra@gmail.com>
402
403         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
404         * layout.cc (Layout_task_runner::run): ..to here.
405         * symtab.h (struct Symbol_location): Extract from..
406         (class Symbol_table): ..here.
407         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
408         * target.h (class Target): Add function_location and
409         do_function_location functions.
410         (class Sized_target): Add do_function_location.
411         * object.h (class Sized_relobj_file): Move find_shdr..
412         (class Object): ..to here.
413         * object.cc: Likewise.  Update to suit.  Instantiate.
414         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
415         * powerpc.cc (class Powerpc_dynobj): New.
416         (Target_powerpc::do_function_location): New function.
417         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
418         (Powerpc_dynobj::do_read_symbols): New function.
419         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
420
421 2013-03-08  Ian Lance Taylor  <iant@google.com>
422
423         * options.cc (General_options::string_to_object_format): Accept
424         "default".
425
426 2013-03-08  Alan Modra  <amodra@gmail.com>
427
428         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
429         pointer to Post_fde.
430         (struct Post_fde): Move definition to here..
431         * ehframe.cc (struct Post_fde): ..from here.
432         (Cie::write): Don't alloc Post_fde.
433         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
434
435 2013-03-07  Alan Modra  <amodra@gmail.com>
436
437         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
438         relocation referencing .LC0.
439         * testsuite/discard_locals_test.sh: Remove FIXMEs.
440
441 2013-03-07  Alan Modra  <amodra@gmail.com>
442
443         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
444         always_inline.  Add assembly for powerpc to avoid GOT.
445
446 2013-03-07  Alan Modra  <amodra@gmail.com>
447
448         * testsuite/script_test_10.sh: Don't test .bss section
449         header number.
450
451 2013-03-06  Alan Modra  <amodra@gmail.com>
452
453         * powerpc.cc (class Powerpc_relobj): Move some member functions.
454         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
455         all callers.  Handle folded sections.
456         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
457         to Powerpc_relobj.
458         (Global_symbol_visitor_opd::operator()): Likewise.
459
460 2013-03-04  Alan Modra  <amodra@gmail.com>
461
462         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
463         * testsuite/Makefile.in: Regenerate.
464
465 2013-03-01  Cary Coutant  <ccoutant@google.com>
466
467         Add dwp support for v2 DWARF package file format.
468         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
469         tu_length parameter.  Adjust all callers.
470         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
471         * dwp.cc: Include dwarf.h.
472         (Section_bounds): New struct type.
473         (Unit_set): New struct type.
474         (Dwo_file::Dwo_file): Initialize new data member.
475         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
476         Combine and rename to...
477         (Dwo_file::read_unit_index): ...this.
478         (Dwo_file::sized_read_compunit_index)
479         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
480         (Dwo_file::sized_read_unit_index): ...this.
481         (Dwo_file::copy_section): Remove section_name, is_str_offsets
482         parameters; add section_id parameter.
483         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
484         (Dwo_file::add_unit_set): ...this.
485         (Dwo_file::shndx_map_): Remove.
486         (Dwo_file::sect_offsets_): New data member.
487         (Dwp_output_file::Dwp_output_file): Initialize new data members.
488         (Dwp_output_file::add_section): Rename to...
489         (Dwp_output_file::add_contribution): ...this.
490         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
491         (Dwp_output_file::add_tu_set): Likewise.
492         (Dwp_output_file::Contribution): New type.
493         (Dwp_output_file::Section::contributions): New data member.
494         (Dwp_output_file::Cu_or_tu_set): Remove.
495         (Dwp_output_file::Section::Section): New ctor.
496         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
497         (Dwp_output_file::Dwp_index::Section_table): New type.
498         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
499         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
500         parameter.
501         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
502         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
503         (Dwp_output_file::Dwp_index::section_table): New member function.
504         (Dwp_output_file::Dwp_index::section_table_end): New member function.
505         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
506         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
507         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
508         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
509         (Dwp_output_file::Dwp_index::section_table_): New data member.
510         (Dwp_output_file::Dwp_index::section_mask_): New data member.
511         (Dwp_output_file::add_output_section): New member function.
512         (Dwp_output_file::write_new_section): New member function.
513         (Dwp_output_file::write_contributions): New member function.
514         (Dwp_output_file::section_id_map_): New data member.
515         (class Dwo_id_info_reader): Remove.
516         (class Unit_reader): New class.
517         (get_dwarf_section_name): New function.
518         (Dwo_file::read_executable): Adjust initializations of class data.
519         (Dwo_file::read): Add support for v2 package file format.
520         (Dwo_file::read_unit_index): Likewise.
521         (Dwo_file::sized_read_unit_index): Likewise.
522         (Dwo_file::copy_section): Likewise.
523         (Dwo_file::add_unit_set): Likewise.
524         (Dwp_output_file::add_output_section): Likewise.
525         (Dwp_output_file::add_contribution): Likewise.
526         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
527         for empty slot.
528         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
529         file format.
530         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
531         slot.
532         (Dwp_output_file::initialize): Remove unused function.
533         (Dwp_output_file::finalize): Add support for v2 package file format.
534         (Dwp_output_file::write_index): Likewise.
535         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
536         function prototype.
537
538 2013-03-01  Cary Coutant  <ccoutant@google.com>
539
540         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
541         function into class definition in header file.
542         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
543         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
544         New function.
545         (Dwarf_info_reader::check_buffer): Move here from .cc file.
546
547 2013-02-28  Alan Modra  <amodra@gmail.com>
548
549         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
550         * target.cc (Target::do_plt_fde_location): New function.
551         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
552         accessor function, and constructor param.
553         (struct Post_fde, Post_fdes): Declare.
554         (Cie::write): Add post_fdes param.
555         * ehframe.cc (Fde::write): Use plt_fde_location.
556         (struct Post_fde): Define.
557         (Cie::write): Stash FDEs added post merge mapping.
558         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
559         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
560         (Eh_frame::do_sized_write): Arrange to write post map FDES after
561         other FDEs.
562         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
563         (Target_powerpc::has_glink): New function.
564         (Target_powerpc::do_relax): Add eh_frame info for stubs.
565         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
566         glink_eh_frame_fde_32, default_fde): New data.
567         (Stub_table::eh_frame_added_): New var.
568         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
569         Make const.
570         (Stub_table::add_eh_frame): New function.
571         (Output_data_glink::add_eh_frame): New function.
572         (Target_powerpc::make_glink_section): Call add_eh_frame.
573
574 2013-02-15  Ian Lance Taylor  <iant@google.com>
575
576         * options.h (DEFINE_uint64_alias): Define.
577         (class General_options): Add -Ttext-segment as an alias for
578         -Ttext.
579
580 2013-02-15  Alan Modra  <amodra@gmail.com>
581
582         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
583         (Stub_table::do_write): ..here, two places.
584         (Stub_table::plt_call_size): Use it here too.
585
586 2013-02-11  Ian Lance Taylor  <iant@google.com>
587
588         * descriptors.cc (Descriptors::close_all): New function.
589         * descriptors.h (class Descriptors): Declare close_all.
590         (close_all_descriptors): New inline function.
591         * plugin.cc: Include "descriptors.h".
592         (Plugin_manager::cleanup): Call close_all_descriptors.
593
594 2013-02-06  Alan Modra  <amodra@gmail.com>
595
596         * README: Update coding style link.
597
598 2013-01-28  Cary Coutant  <ccoutant@google.com>
599
600         * dwp.cc (File_list): New typedef.
601         (Dwo_name_info_reader): New class.
602         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
603         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
604         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
605         (Dwo_file::read_executable): New function.
606         (Dwo_file::read): Move common setup code to ...
607         (Dwo_file::make_object): ... here.
608         (dwp_options): Add --exec/-e.
609         (usage): Likewise.
610         (main): Likewise.
611
612 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
613
614         * layout.cc (Layout::layout): Check for option text_reorder.
615         (Layout::make_output_section): Ditto.
616         * options.h (text_reorder): New option.
617         * output.cc (Input_section_sort_compare): Remove special ordering
618         of section names.
619         (Output_section::
620          Input_section_sort_section_name_special_ordering_compare::
621          operator()): New function.
622         (Output_section::sort_attached_input_sections): Use new sort function
623         for .text.
624         * output.h (Input_section_sort_section_name_special_ordering_compare):
625         New struct.
626         * testsuite/Makefile.am (text_section_grouping): Test option
627         --no-text-reorder
628         * testsuite/Makefile.in: Regenerate.
629         * testsuite/text_section_grouping.sh: Check order of functions without
630         default text reordering.
631
632 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
633
634         * options.h (General_options): Change default to true for new_dtags.
635
636 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
637
638         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
639         when enable_new_dtags is false.  Only add DT_RUNPATH when
640         enable_new_dtags is true.
641
642 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
643
644         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
645         used in declaration and definition consistent.
646         (Target_powerpc::symval_for_branch): Ditto.
647
648 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
649
650         * testsuite/plugin_final_layout.cc: Fix comment.
651
652 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
653
654         * layout.cc (Layout::layout): Do not do default sorting for
655         text sections when section ordering is specified.
656         (make_output_section): Ditto.
657         * testsuite/plugin_final_layout.cc: Name the function sections
658         to catch reordering issues.
659
660 2013-01-15  Alan Modra  <amodra@gmail.com>
661
662         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
663         plt-thread-safe.
664
665 2013-01-15  Alan Modra  <amodra@gmail.com>
666
667         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
668         * testsuite/Makefile.in: Regenerate.
669
670 2013-01-14  Alan Modra  <amodra@gmail.com>
671
672         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
673         * testsuite/Makefile.in: Regenerate.
674
675 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
676
677         PR bfd/14430
678         Fix mingw gold build with plugins enabled
679         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
680         * configure.ac: Export DLOPEN_LIBS and add headers check.
681         * plugin.cc: Handle non-dlfcn case.
682         * Makefile.in: Regenerate.
683         * config.in: Regenerate.
684         * configure: Regenerate.
685         * testsuite/Makefile.in: Regenerate.
686
687 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
688
689         * output.h (sort_attached_input_sections): Change to be public.
690         * script-sections.cc
691         (Output_section_definition::set_section_addresses): Sort
692         attached input sections according to section order before linker
693         script assigns section addresses.
694         (Orphan_output_section::set_section_addresses): Sort
695         attached input sections according to section order before linker
696         script assigns section addresses.
697         * Makefile.am (final_layout.sh): Use a simple linker script to
698         check if section ordering still works.
699         * Makefile.in: Regenerate.
700
701 2013-01-09  Ben Cheng  <bccheng@google.com>
702
703         * arm.cc (Target_arm::attributes_accept_div): New function.
704         (Target_arm::attributes_forbid_div): New function.
705         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
706         attribute using the same new functions as what bfd/elf32_arm.c
707         does.
708
709 2013-01-07  Cary Coutant  <ccoutant@google.com>
710
711         PR gold/14993
712         * output.cc (Output_section::add_input_section): For incremental
713         updates, don't track input sections that are allocated from patch
714         space.
715
716 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
717             Ian Lance Taylor  <iant@google.com>
718
719         PR gold/14897
720         * configure.ac (--enable-ld): Removed.
721         (install_as_default): Set to yes only for --enable-gold=default
722         or --disable-ld.
723         * configure: Regenerated.
724
725 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
726
727         * options.h (General_options): Add -fuse-ld= for GCC linker
728         option compatibility.
729
730 2013-01-04  Cary Coutant  <ccoutant@google.com>
731
732         * configure.ac: Fix typo restoring CXXFLAGS.
733         * configure: Regenerate.
734
735 2013-01-04  Cary Coutant  <ccoutant@google.com>
736
737         * testsuite/Makefile.am (CXXLINK_S): New macro.
738         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
739         * testsuite/Makefile.in: Regenerate.
740
741 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
742
743         * version.cc (print_version): Update copyright year to 2013.
744
745 2012-12-20  Ian Lance Taylor  <iant@google.com>
746
747         * layout.cc (Layout::special_ordering_of_input_section): New
748         function.
749         (Layout::layout): If input section requires special ordering, must
750         sort input sections.
751         (Layout::make_output_section): May sort .text input sections.
752         (Layout::is_section_name_prefix_grouped): Remove.
753         * layout.h (class Layout): Declare
754         special_ordering_of_input_section.  Don't declare
755         is_section_name_prefix_grouped.
756         * output.cc (Output_section::add_input_section): Revert last
757         change.
758         (Output_section::Input_section_sort::match_file_name): Don't crash
759         if called on output section data.
760         (Output_section::Input_section_sort_compare): Sort based on
761         special ordering.
762         (Output_section::Input_section_sort_section_order_index_compare):
763         Revert last patch.
764         (Output_section::sort_attached_input_sections): Likewise.
765
766 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
767
768         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
769         * layout.h (Layout::is_section_name_prefix_grouped): New function.
770         * output.cc (Output_section::add_input_section): Check if section
771         name contains special prefix.  Keep input sections to sort such
772         sections.
773         (Output_section::Input_section_sort_section_order_index_compare
774          ::operator()): Group sections according to prefixes.
775         (Output_section::sort_attached_input_sections): Add condition to
776         Input_section_entry constructor call.
777         * testsuite/Makefile.am (text_section_grouping): New test.
778         * testsuite/Makefile.in: Regenerate.
779         * testsuite/text_section_grouping.cc: New file.
780         * testsuite/text_section_grouping.sh: New file.
781
782 2012-12-17  Nick Clifton  <nickc@redhat.com>
783
784         * Makefile.am: Add copyright notice.
785         * NEWS: Likewise.
786         * README: Likewise.
787         * configure.ac: Likewise.
788         * ftruncate.c: Likewise.
789         * Makefile.in: Regenerate.
790
791 2012-12-14  Cary Coutant  <ccoutant@google.com>
792
793         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
794         --no-as-needed flag.
795         (exception_separate_shared_12_test): Likewise.
796         (incremental_copy_test): Likewise.
797         * testsuite/Makefile.in: Regenerate.
798
799 2012-12-14  Cary Coutant  <ccoutant@google.com>
800
801         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
802         (Dwp_output_file::Dwp_index::enter_set): Add assert.
803
804 2012-12-12  Alan Modra  <amodra@gmail.com>
805
806         * powerpc.cc (class Track_tls): New.
807         (class Relocate, class Scan): Inherit Track_tls.
808         (Target_powerpc::Scan::local, global): Track tls optimization
809         and avoid creating plt entry for __tls_get_addr if all uses
810         are optimized away.
811         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
812
813 2012-12-12  Alan Modra  <amodra@gmail.com>
814
815         * options.h (General_options): Add --toc-sort/--no-toc-sort.
816         Replace no_toc_optimize with toc_optimize.
817         * output.h (Output_section::input_sections): Provide non-const variant.
818         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
819         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
820         accessors.
821         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
822         (class Sort_toc_sections): New.
823         (Target_powerpc::do_finalize_sections): Sort toc sections.
824         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
825
826 2012-12-10  Roland McGrath  <mcgrathr@google.com>
827
828         * testsuite/binary_unittest.cc (read_all): New function.
829         (Sized_binary_test): Use it instead of ::read.
830         * fileread.cc (do_read): Don't assume pread always reads the whole
831         amount in a single call.
832
833 2012-12-10  Alan Modra  <amodra@gmail.com>
834
835         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
836         Set EM_PPC64 or EM_PPC here.
837         (Target_selector_powerpc::do_recognize): Delete.
838
839 2012-12-10  Alan Modra  <amodra@gmail.com>
840
841         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
842         stub_table_.
843         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
844
845 2012-12-07  Roland McGrath  <mcgrathr@google.com>
846
847         * testsuite/binary_unittest.cc (Sized_binary_test):
848         Use open_descriptor rather than ::open.
849
850 2012-12-07  Alan Modra  <amodra@gmail.com>
851
852         * powerpc.cc (Stub_table::do_write): Delete redundant Address
853         typedef and invalid_address constant.
854         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
855         instantiate constants.
856
857 2012-12-06  Roland McGrath  <mcgrathr@google.com>
858
859         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
860         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
861         * aclocal.m4: Regenerate.
862         * configure: Regenerate.
863         * Makefile.in: Regenerate.
864         * testsuite/Makefile.in: Regenerate.
865
866 2012-12-07  Alan Modra  <amodra@gmail.com>
867
868         * options.h (General_options): Add no_toc_optimize.
869         * powerpc.cc (ok_lo_toc_insn): New function.
870         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
871
872 2012-12-06  Alan Modra  <amodra@gmail.com>
873
874         * options.h (General_options): Add plt_align, plt_static_chain,
875         plt_thread_safe.  Update stub_group_size help text.
876         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
877         for new plt_thread_safe_ var.
878         (use_plt_offset): Correct comments.
879         (Target_powerpc::do_relax): Look for thread creation symbols to
880         determine default plt_thread_safe value.  Clear plt call stubs
881         as well as branch stubs each iteration.
882         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
883         insn constants.
884         (l, hi, ha, write_insn): Move earlier.
885         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
886         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
887         plt stubs too.
888         (Stub_table::update_size): Adjust.
889         (Stub_table::prev_size, set_prev_size): Delete.
890         (Stub_table::stub_align): Let --plt-align affect result.
891         (Stub_table::plt_call_size): Calculate sizes for various stubs.
892         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
893         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
894         (Stub_table::do_write): Support more stub variants.
895
896 2012-12-04  Alan Modra  <amodra@gmail.com>
897
898         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
899         (Target_powerpc::do_define_standard_symbols): New function.
900
901 2012-12-03  Alan Modra  <amodra@gmail.com>
902
903         * output.h: Formatting, whitespace.
904
905 2012-12-03  Alan Modra  <amodra@gmail.com>
906
907         * layout.h (Layout::get_executable_sections): Declare.
908         * layout.cc (Layout::get_executable_sections): New function.
909         * arm.cc (Target_arm::group_sections): Use it.
910         (Arm_output_section::group_sections): Delete now redundant test.
911         * output.cc (Output_reloc::Output_reloc): Add is_relative.
912         param to handle relative relocs.
913         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
914         (Output_data_reloc::add_absolute): Adjust.
915         (Output_data_reloc::add_relative): New function.
916         (Output_data::reset_data_size): New function.
917         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
918         (Output_section::set_addralign): New function.
919         (Output_section::checkpoint_set_addralign): New function.
920         (Output_section::clear_section_offsets_need_adjustment): New function.
921         (Output_section::input_sections): Make public.
922         * powerpc.cc (class Output_data_brlt_powerpc): New.
923         (class Stub_table, class Stub_control): New.
924         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
925         stub_table_, set_stub_table, stub_table): New vectors and accessor
926         functions.
927         (Target_powerpc::do_may_relax, do_relax, push_branch,
928         new_stub_table, stub_tables, brlt_section, group_sections,
929         add_branch_lookup_table, find_branch_lookup_table,
930         write_branch_lookup_table, make_brlt_section): New functions.
931         (Target_powerpc::struct Sort_sections, class Branch_info): New.
932         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
933         branch_info_): New vars.
934         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
935         make call stubs here.
936         (Output_data_glink): Remove all call stub handling from this class.
937         (Target_powerpc::Scan::local, global): Save interesting branch
938         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
939         (Target_powerpc::do_finalize_sections): Only make reg save/restore
940         functions on final link.
941         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
942         Handle long branch destinations too.
943         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
944         do_plt_address_for_local): Adjust lookup of plt call stubs.
945
946 2012-11-30  Alan Modra  <amodra@gmail.com>
947
948         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
949         relocs against protected symbols when building 32-bit shared libs.
950
951 2012-11-30  Alan Modra  <amodra@gmail.com>
952
953         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
954         param.  Call got_section() to make .got.  Update all callers
955         and their callers and so on.
956
957 2012-11-30  Alan Modra  <amodra@gmail.com>
958
959         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
960         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
961         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
962         value if it already exists.
963
964 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
965
966         PR gold/14858
967         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
968
969 2012-11-14  Roland McGrath  <mcgrathr@google.com>
970
971         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
972         than bfc instruction for data sandboxing.
973
974 2012-11-08  Alan Modra  <amodra@gmail.com>
975
976         * po/POTFILES.in: Regenerate.
977
978 2012-11-05  Alan Modra  <amodra@gmail.com>
979
980         * configure.ac: Apply 2012-09-10 change to config.in here.
981         * configure: Regenerate.
982
983 2012-11-05  Alan Modra  <amodra@gmail.com>
984
985         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
986         (struct Opd_ent): Use "Address" rather than "Offset".
987         (Output_data_got_powerpc::got_base_offset): Return Valtype.
988         (Target_powerpc::got_section): Make public.
989         (Target_powerpc::scan_relocs): Move code setting symbols..
990         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
991         Create _SDA_BASE_ only when referenced.
992
993 2012-11-02  Roland McGrath  <mcgrathr@google.com>
994
995         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
996         from last change.
997
998 2012-11-01  Roland McGrath  <mcgrathr@google.com>
999
1000         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1001         for offset_in_output_section parameter.
1002         (Sized_target::relocate_special_relocatable): Likewise.
1003         * arm.cc (Target_arm::relocate_relocs): Likewise.
1004         (Target_arm::relocate_special_relocatable): Likewise.
1005         * i386.cc (Target_i386::relocate_relocs): Likewise.
1006         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1007         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1008         * target-reloc.h (relocate_relocs): Likewise.
1009         * testsuite/testfile.cc (Target_test): Likewise.
1010         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1011         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1012
1013         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1014         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1015
1016         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1017         parameter, which is unused in the [!F_SETFD] case.
1018
1019         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1020         SYMNDX to off_t before comparing it to this->data_size().
1021         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1022         * incremental.cc (Output_section_incremental_inputs::do_write):
1023         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1024
1025         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1026
1027 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1028
1029         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1030         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1031         in EABI_VER5.
1032
1033 2012-10-29  Cary Coutant  <ccoutant@google.com>
1034
1035         * dwp.cc (usage): Add file and exit status parameters;
1036         add --help and --version options.
1037         (print_version): New function.
1038         (main): Add --help and --version options.
1039
1040 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1041
1042         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1043         final_layout_sequence.txt.
1044         * testsuite/Makefile.in: Regenerated.
1045
1046 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1047
1048         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1049         COMPILE generated by automake.
1050         (LINK1): Likewise.
1051         (CXXCOMPILE1): Likewise.
1052         (CXXLINK1): Likewise.
1053         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1054         (LINK): Likewise.
1055         (CXXCOMPILE): Likewise.
1056         (CXXLINK): Likewise.
1057         * testsuite/Makefile.in: Regenerated.
1058
1059 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1060
1061         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1062         on bad fwrite return.
1063
1064 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1065
1066         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1067         on val.
1068
1069 2012-10-23  Cary Coutant  <ccoutant@google.com>
1070
1071         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1072         * testsuite/Makefile.in: Regenerate.
1073         * testsuite/dwp_test.h: New source file.
1074         * testsuite/dwp_test_1.cc: New source file.
1075         * testsuite/dwp_test_1.s: New source file.
1076         * testsuite/dwp_test_1.sh: New source file.
1077         * testsuite/dwp_test_1b.cc: New source file.
1078         * testsuite/dwp_test_1b.s: New source file.
1079         * testsuite/dwp_test_2.cc: New source file.
1080         * testsuite/dwp_test_2.s: New source file.
1081         * testsuite/dwp_test_2.sh: New source file.
1082         * testsuite/dwp_test_main.cc: New source file.
1083         * testsuite/dwp_test_main.s: New source file.
1084
1085 2012-10-23  Cary Coutant  <ccoutant@google.com>
1086
1087         * dwp.h: New header file.
1088         * dwp.cc: New source file.
1089         * gold.h: Move shared declarations to system.h.
1090         * system.h: New header file.
1091         * Makefile.am: Add dwp.
1092         * Makefile.in: Regenerate.
1093
1094 2012-10-23  Cary Coutant  <ccoutant@google.com>
1095
1096         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1097         Dwarf_info_reader::read_from_pointer.
1098         (Dwarf_pubnames_table::read_header): Likewise.
1099         (Dwarf_pubnames_table::next_name): Likewise.
1100         (Dwarf_die::read_attributes): Likewise.
1101         (Dwarf_die::skip_attributes): Likewise.
1102         (Dwarf_info_reader::read_from_pointer): New function template.
1103         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1104         (Dwarf_pubnames_table): Likewise.
1105         (Dwarf_info_reader::read_from_pointer): New function template.
1106         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1107         Dwarf_pubnames_table ctor.
1108
1109 2012-10-23  Cary Coutant  <ccoutant@google.com>
1110
1111         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1112         abbrev_shndx.
1113         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1114         abbrev_shndx_.
1115         (Dwarf_info_reader::set_abbrev_shndx): New method.
1116         (Dwarf_info_reader::abbrev_shndx_): New data member.
1117
1118 2012-10-23  Cary Coutant  <ccoutant@google.com>
1119
1120         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1121         from object, not parameters.
1122         (Dwarf_info_reader::parse): Likewise.
1123         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1124         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1125         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1126         methods.
1127
1128 2012-10-23  Cary Coutant  <ccoutant@google.com>
1129
1130         * fileread.cc (Input_file::Input_file): New constructor.
1131         * fileread.h (class Input_file): Add new constructor.
1132
1133 2012-10-18  Alan Modra  <amodra@gmail.com>
1134
1135         PR gold/14727
1136         * object.cc (Relobj::is_section_name_included): Also match
1137         .sdata personality section.
1138
1139 2012-10-18  Alan Modra  <amodra@gmail.com>
1140
1141         * target-reloc.h (class Default_comdat_behavior): New, package up..
1142         (get_comdat_behaviour): ..this.
1143         (relocate_section): Add Relocate_comdat_behavior template arg,
1144         adjust code to suit.
1145         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1146         (Target_arm::scan_reloc_section): Likewise.
1147         * i386.cc (Target_i386::relocate_section): Likewise.
1148         * sparc.cc (Target_sparc::relocate_section): Likewise.
1149         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1150         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1151         * powerpc.cc (class Relocate_comdat_behavior): New.
1152         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1153         gold::relocate_section with new template arg.
1154
1155 2012-10-18  Alan Modra  <amodra@gmail.com>
1156
1157         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1158         dynamic relocs for GOT_TPREL got entries, without symbol if
1159         resolving locally.
1160         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1161         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1162         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1163
1164 2012-10-17  Alan Modra  <amodra@gmail.com>
1165
1166         PR gold/14726
1167         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1168
1169 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1170
1171         * layout.cc (Layout::include_section): Keep sections marked
1172         SHF_EXCLUDE when doing relocatable links.
1173
1174 2012-10-16  Alan Modra  <amodra@gmail.com>
1175
1176         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1177         (Target_powerpc::do_finalize_sections): Call it.
1178         (Output_data_save_res): New class and supporting functions.
1179         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1180         normal symbols defined in object files.
1181
1182 2012-10-12  Alan Modra  <amodra@gmail.com>
1183
1184         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1185         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1186         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1187         section if scan_opd_relocs not yet called.
1188         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1189
1190 2012-10-12  Alan Modra  <amodra@gmail.com>
1191
1192         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1193         add_local_ifunc_entry): Revert last change.
1194         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1195
1196 2012-10-05  Alan Modra  <amodra@gmail.com>
1197
1198         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1199         do_plt_address_for_global): New functions.
1200         (Output_data_got_powerpc::do_write): Don't segfault when linking
1201         statically.
1202         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1203         add_local_ifunc_entry): Return true on adding entry..
1204         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1205         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1206         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1207         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1208         set up symbols here.
1209         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1210         syms here.  Do so even when no .iplt.  Don't segfault when linking
1211         statically.
1212         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1213         new variants without reloc param.
1214         (Glink_sym_ent::Glink_sym_ent): Likewise.
1215         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1216         reloc when refs will resolve to plt call stub.
1217         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1218         R_PPC_PLTREL24 to resolve locally.
1219         (Target_powerpc::Scan::global): Correct ifunc handling.
1220         (Target_powerpc::Relocate::relocate): Correct local sym glink
1221         lookup.  Don't destroy "value" when we have a plt call stub,
1222         and when checking plt call validity.
1223         (Target_powerpc::do_dynsym_value): Simplify.
1224
1225 2012-10-05  Alan Modra  <amodra@gmail.com>
1226
1227         * i386.cc (Output_data_plt_i386::address_for_global,
1228         address_for_local): Add plt offset to returned value.  Adjust uses.
1229         * sparc.cc (Output_data_plt_sparc::address_for_global,
1230         address_for_local): Likewise.
1231         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1232         address_for_local): Likewise.
1233         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1234         address_for_local): Likewise.
1235         * target.h (Target::plt_address_for_global, plt_address_for_local):
1236         Update comment.
1237         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1238         (Output_data_got::Got_entry::write): Nor here.
1239         * output.h: Comment fix.
1240
1241 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1242
1243         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1244         global_offset_table_ value for larget got.
1245         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1246
1247 2012-09-29  Alan Modra  <amodra@gmail.com>
1248
1249         * powerpc.cc (Target_powerpc::iplt_): New output section.
1250         (Target_powerpc::iplt_section, make_iplt_section,
1251         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1252         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1253         Target_powerpc::plt_entry_count): Count iplt entries too.
1254         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1255         reloc section in constructor.  New params.
1256         (Target_powerpc::make_plt_section): Create reloc section here instead.
1257         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1258         functions.
1259         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1260         (Output_data_glink::add_entry, find_entry): New functions to
1261         deal with local syms.
1262         (Glink_sym_ent): Add support for local syms.
1263         (Output_data_glink::do_write): Handle ifunc plt entries.
1264         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1265         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1266         (Target_powerpc::Relocate::relocate): Likewise.
1267         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1268
1269 2012-09-25  Alan Modra  <amodra@gmail.com>
1270
1271         * object.h (Sized_relobj_file::adjust_local_symbol,
1272         do_adjust_local_symbol): New functions.
1273         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1274         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1275         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1276         and irregular opd entry spacing.
1277         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1278         (Global_symbol_visitor_opd): New functor.
1279         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1280         on deleted opd entries.
1281
1282 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1283
1284         * tilegx.cc: New file.
1285         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1286         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1287         * configure.tgt: Add entries for tilegx*.
1288         * configure.ac: Likewise.
1289         * Makefile.in: Rebuild.
1290         * configure: Likewise.
1291         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1292         tilegx.
1293
1294 2012-09-13  Alan Modra  <amodra@gmail.com>
1295
1296         * target-reloc.h (scan_relocs): Call scan.local for relocs
1297         against symbols in discarded sections.  Pass is_discarded
1298         param.
1299         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1300         Add is_discarded param.
1301         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1302         is_discarded to flag opd entry as discarded.  Don't emit dyn
1303         relocs on such entries.
1304         (Target_powerpc::Scan::global): Similarly detect and handle
1305         such opd entries.
1306         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1307         opd_ent_.  Update all uses.
1308         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1309         (Target_powerpc::relocate_section): Zero out discarded opd
1310         entry relocs.
1311
1312 2012-09-12  Ian Lance Taylor  <iant@google.com>
1313
1314         PR gold/14570
1315         * output.cc: Rename Output_data_got template parameter from size
1316         to got_size for all functions.  Compile all variants of
1317         Output_data_got.
1318         (Output_data_got::Got_entry::write): Correct use of size for
1319         symbol value.  Use local_is_tls rather than casting to
1320         Sized_relobj_file.
1321         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1322         (class Sized_relobj_file): Add do_local_is_tls.
1323         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1324
1325 2012-09-11  Alan Modra  <amodra@gmail.com>
1326
1327         PR gold/14566
1328         * layout.cc (Layout::set_segment_offsets): When using
1329         common-page-size alignment, ensure we are on a new max-page-size
1330         page.
1331         * output.cc (Output_segment::set_section_addresses): Use
1332         abi_pagesize, not common_pagesize for relro boundary.
1333         (Output_segment::set_offset): Likewise.
1334
1335 2012-09-11  Alan Modra  <amodra@gmail.com>
1336
1337         * output.h (Output_data_got::add_global_tls, add_local_tls,
1338         add_local_tls_pair): New functions.
1339         (Output_data_got::add_local_pair_with_rel): Remove second
1340         reloc param.  Expand comment.
1341         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1342         use_plt_or_tls_offset_, similarly for constructor param.
1343         (Output_data_got::Got_entry::write): Add got_index param.
1344         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1345         add_local_tls_pair): New functions.
1346         (Output_data_got::Got_entry::write): Handle tls symbols
1347         with use_plt_or_tls_offset_ set specially.
1348         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1349         (Output_data_got::do_write): Replace iterator with index, pass
1350         index to entry write function.
1351         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1352         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1353         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1354         call.
1355         * i386.cc (Target_i386::Scan::local): Likewise.
1356         * sparc.cc (Target_sparc::Scan::local): Likewise.
1357         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1358         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1359         do_tls_offset_for_global): New functions.
1360         (Target_powerpc::Scan::local): Correct TLS relocations and got
1361         entry values.
1362         (Target_powerpc::Scan::global): Don't emit unnecessary
1363         dynamic relocations on TLS GOT entries.
1364
1365 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1366
1367         * config.in: Disable sanity check for kfreebsd.
1368
1369 2012-09-10  Sterling Augustine  <saugustine@google.com>
1370
1371         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1372         (Gdb_index::pubtypes_read): New parameter.
1373         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1374         to calls.
1375         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1376         pubtypes_object_.
1377
1378 2012-09-09  Alan Modra  <amodra@gmail.com>
1379
1380         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1381         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1382         * gc.h (gc_process_relocs): Call target gc_add_reference.
1383         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1384         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1385         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1386         unnecessary cast.
1387         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1388         to cater for when we don't need code offset.  Update use.
1389         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1390         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1391         set_opd_valid): New functions.
1392         (Target_powerpc::do_gc_add_reference): New function.
1393         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1394         stashed refs.
1395         (Target_powerpc::do_gc_mark_symbol): New function.
1396
1397 2012-09-06  Cary Coutant  <ccoutant@google.com>
1398
1399         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1400         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1401         (Dwarf_die::skip_attributes): Likewise.
1402         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1403         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1404         (main): Call it.
1405         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1406
1407 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1408
1409         * testsuite/script_test_3.t: Add .got.plt output section
1410         statement.
1411         * testsuite/script_test_4.t: Likewise.
1412
1413 2012-09-05  Alan Modra  <amodra@gmail.com>
1414
1415         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1416         update all uses and lose "enum" when using type.
1417
1418 2012-09-05  Alan Modra  <amodra@gmail.com>
1419
1420         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1421         * configure: Regenerate.
1422         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1423         (plugin_final_layout.stdout): Likewise.
1424         (memory_test): Set page sizes to 0x1000.
1425         * testsuite/Makefile.in: Regenerate.
1426         * testsuite/discard_locals_test.sh: Add FIXME comment.
1427         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1428         * testsuite/pr14265.t: Add .got output section statement.
1429         * testsuite/script_test_2.t: Likewise.
1430         * testsuite/script_test_3.t: Likewise.
1431         * testsuite/script_test_4.t: Likewise.
1432         * testsuite/script_test_5.t: Likewise.
1433         * testsuite/script_test_6.t: Likewise.
1434         * testsuite/script_test_7.t: Likewise.
1435         * testsuite/script_test_9.t: Likewise.
1436
1437 2012-09-05  Alan Modra  <amodra@gmail.com>
1438
1439         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1440         (Powerpc_relocate_functions::Status): New typedef.
1441         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1442         (Target_powerpc::Scan::local): Handle REL64.
1443         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1444         for REL32 and REL64.
1445         (Target_powerpc::symval_for_branch): New function, extracted from..
1446         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1447         checks.  Report overflow errors.
1448
1449 2012-09-05  Alan Modra  <amodra@gmail.com>
1450
1451         * object.h (Sized_relobj_file::emit_relocs): Delete.
1452         (Sized_relobj_file::emit_relocs_reltype): Delete.
1453         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1454         relocate_relocs for --emit-relocs.
1455         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1456         * output.h: Update comment.
1457         (Output_segment::first_section): New function.
1458         (Output_segment::first_section_load_address): Use first_section.
1459         * output.cc (Output_segment::first_section): New function extracted..
1460         (Output_segment::first_section_load_address): ..from here.  Delete.
1461         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1462         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1463         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1464         adjust call to target.h function.
1465         * i386.cc (Target_i386): Likewise.
1466         * sparc.cc (Target_sparc): Likewise.
1467         * x86_64.cc (Target_x86_64): Likewise.
1468         * powerpc.cc (Target_powerpc): Likewise.
1469         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1470         first tls section has section symbol for optimised local dynamic
1471         output relocs.
1472         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1473         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1474         optimised tls code.
1475         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1476         Rename to relocate_relocs.  Update error message.
1477
1478 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1479
1480         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1481         --just-symbols.
1482
1483 2012-08-31  Alan Modra  <amodra@gmail.com>
1484
1485         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1486         (Powerpc_relobj::toc_base_offset): New stub function.
1487         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1488         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1489         (Target_powerpc::Relocate::enum skip_tls): New.
1490         (Target_powerpc::call_tls_get_addr_): New var.
1491         (Target_powerpc::is_branch_reloc): Move to file scope.
1492         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1493         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1494         New functions.
1495         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1496         (powerpc_info): Correct common_pagesize for ppc64.
1497         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1498         (Powerpc_relocate_functions): Add overflow check enums and functions.
1499         Add non-shift version of rela, rela_ua.  Delete all rel public
1500         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1501         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1502         addr16_ha3, addr14 functions.
1503         (Output_data_got_powerpc::add_constant_pair): New function.
1504         (Output_data_got_powerpc::got_base_offset): Likewise.
1505         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1506         (instruction constants): Sort, add some more.
1507         (Output_data_glink::do_write): Add and use Address typedef.  Use
1508         object->toc_base_offset() stub for 64-bit.
1509         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1510         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1511         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1512         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1513         Always treat .opd relocs as against locally defined symbol.
1514         Correct condition for RELATIVE relocs.
1515         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1516         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1517         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1518         calculations.  Handle TLS relocs, and more.  Add overflow
1519         checking and adjust for Powerpc_relocate_functions changes.
1520         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1521         Reinstate --emit-relocs code with FIXME.
1522
1523 2012-08-30  Alan Modra  <amodra@gmail.com>
1524
1525         * layout.cc (Layout::set_segment_offsets): Set p_align to
1526         abi_pagesize, not common_pagesize.
1527         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1528         to determine whether file header can go in segment.
1529
1530 2012-08-30  Alan Modra  <amodra@gmail.com>
1531
1532         * output.h (Output_reloc::Output_reloc <output section>): Add
1533         is_relative param.  Adjust calls.
1534         (Output_reloc::add_output_section_relative): New functions.
1535         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1536         is_relative.
1537         (Output_reloc::symbol_value): Handle SECTION_CODE.
1538
1539 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1540
1541         * gold.cc (queue_middle_tasks): Call layout again when unique
1542         segments for sections is desired.
1543         * layout.cc (Layout::Layout): Initialize new members.
1544         (Layout::get_output_section_flags): New function.
1545         (Layout::choose_output_section): Call get_output_section_flags.
1546         (Layout::layout): Make output section for mapping to a unique segment.
1547         (Layout::insert_section_segment_map): New function.
1548         (Layout::attach_allocated_section_to_segment): Make unique segment for
1549         output sections marked so.
1550         (Layout::segment_precedes): Check for unique segments when sorting.
1551         * layout.h (Layout::Unique_segment_info): New struct.
1552         (Layout::Section_segment_map): New typedef.
1553         (Layout::insert_section_segment_map): New function.
1554         (Layout::get_output_section_flags): New function.
1555         (Layout::is_unique_segment_for_sections_specified): New function.
1556         (Layout::set_unique_segment_for_sections_specified): New function.
1557         (Layout::unique_segment_for_sections_specified_): New member.
1558         (Layout::section_segment_map_): New member.
1559         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1560         Rename is_gc_pass_one to is_pass_one.
1561         Rename is_gc_pass_two to is_pass_two.
1562         Rename is_gc_or_icf to is_two_pass.
1563         Check for which pass based on whether symbols data is present.
1564         Make it two pass when unique segments for sections is desired.
1565         * output.cc (Output_section::Output_section): Initialize new
1566         members.
1567         * output.h (Output_section::is_unique_segment): New function.
1568         (Output_section::set_is_unique_segment): New function.
1569         (Output_section::is_unique_segment_): New member.
1570         (Output_section::extra_segment_flags): New function.
1571         (Output_section::set_extra_segment_flags): New function.
1572         (Output_section::extra_segment_flags_): New member.
1573         (Output_section::segment_alignment): New function.
1574         (Output_section::set_segment_alignment): New function.
1575         (Output_section::segment_alignment_): New member.
1576         (Output_segment::Output_segment): Initialize is_unique_segment_.
1577         (Output_segment::is_unique_segment): New function.
1578         (Output_segment::set_is_unique_segment): New function.
1579         (Output_segment::is_unique_segment_): New member.
1580         * plugin.cc (allow_unique_segment_for_sections): New function.
1581         (unique_segment_for_sections): New function.
1582         (Plugin::load): Add new functions to transfer vector.
1583         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1584         * Makefile.in: Regenerate.
1585         * testsuite/plugin_final_layout.sh: Check if unique segment
1586         functionality works.
1587         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1588         are available.
1589         (allow_unique_segment_for_sections): New global.
1590         (unique_segment_for_sections): New global.
1591         (claim_file_hook): Call allow_unique_segment_for_sections.
1592         (all_symbols_read_hook): Call unique_segment_for_sections.
1593
1594 2012-08-22  Cary Coutant  <ccoutant@google.com>
1595
1596         * layout.cc (Layout::include_section): Don't assert on GROUP
1597         sections with --emit-relocs.
1598
1599 2012-08-21  Cary Coutant  <ccoutant@google.com>
1600
1601         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1602         if --export-dynamic-symbol names an undef symbol.
1603
1604 2012-08-18  Alan Modra  <amodra@gmail.com>
1605
1606         * powerpc.cc: Formatting and white space.
1607         (Powerpc_relobj): Rename got2_section_ to special_.
1608         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1609         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1610         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1611         (Target_powerpc): Add Address typedef and invalid_address.  Use
1612         throughout.
1613         (Target_powerpc::is_branch_reloc): New function.
1614         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1615         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1616         for dst_mask, value and addend.
1617         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1618         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1619         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1620         uint16_t for 24-bit offset.  Use get_output_section_offset and
1621         check return.
1622         (Target_powerpc::Scan::local): Handle more relocs.
1623         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1624         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1625         Plug in toc restoring insn after plt calls.  Translate branches
1626         to function descriptor symbols to corresponding entry point.
1627         (Target_powerpc::relocate_for_relocatable): Check return from
1628         get_output_section_offset.
1629         * symtab.h: Comment typo.
1630
1631 2012-08-14  Ian Lance Taylor  <iant@google.com>
1632
1633         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1634         unsupported_relocal_local to call unsupported_reloc_global.
1635
1636 2012-08-14  Nick Clifton  <nickc@redhat.com>
1637
1638         PR ld/14265
1639         * script-sections.cc (Sections_element::output_section_name): Add
1640         keep return parameter.
1641         (Output_section_element::match_name): Add keep return parameter.
1642         Return the value of the keep_ member.
1643         * script-sections.h (class Output_section): Update
1644         output_section_name prototype.
1645         * layout.cc (Layout::keep_input_section): New public member
1646         function.
1647         (Layout::choose_output_section): Pass keep parameter to
1648         output_section_name.
1649         * layout.h (class Layout): Add keep_input_section.
1650         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1651         sections.
1652         * testsuite/Makefile.am: Add a test.
1653         * testsuite/Makefile.in: Regenerate.
1654         * testsuite/pr14265.c: Source file for the test.
1655         * testsuite/pr14265.t: Linker script for the test.
1656         * testsuite/pr14265.sh: Shell script for the test.
1657
1658 2012-08-14  Alan Modra  <amodra@gmail.com>
1659
1660         * target.h (Target::output_section_name): New function.
1661         (Target::do_output_section_name): New function.
1662         * layout.cc (Layout::choose_output_section): Call the above.
1663         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1664
1665 2012-08-14  Alan Modra  <amodra@gmail.com>
1666
1667         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1668         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1669         for replace_constant call.
1670         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1671         (Output_data_glink::do_print_to_mapfile): New function.
1672         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1673         (Target_powerpc::Relocate::relocate): Likewise.
1674
1675 2012-08-14  Alan Modra  <amodra@gmail.com>
1676
1677         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1678         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1679         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1680         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1681         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1682         here.
1683         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1684         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1685         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1686         here.
1687         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1688         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1689
1690 2012-08-12  Alan Modra  <amodra@gmail.com>
1691
1692         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1693         (glink insn constants): Use uint32_t.
1694         (Output_data_glink::add_entry): Use insert, not [] operator.
1695
1696 2012-08-11  Alan Modra  <amodra@gmail.com>
1697
1698         * object.h (Sized_relobj_file::find_shdr): New function.
1699         (Sized_relobj_file::find_special_sections): New function.
1700         * object.cc (Sized_relobj_file::find_shdr): New function.
1701         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1702         (Sized_relobj_file::find_special_sections): New function, split out..
1703         (Sized_relobj_file::do_read_symbols): ..from here.
1704         * output.h (Output_data_got::replace_constant): New function.
1705         (Output_data_got::num_entries): New function.
1706         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1707         (Output_data_got::got_offset): Protected rather than private.
1708         (Output_data_got::replace_got_entry): New function.
1709         * output.cc (Output_data_got::replace_got_entry): New function.
1710         * powerpc.cc (class Powerpc_relobj): New.
1711         (class Powerpc_relocate_functions): Delete all psymval variants or
1712         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1713         Implement _ha functions using corresponding _hi function.
1714         (Powerpc_relobj::find_special_sections): New function.
1715         (Target_powerpc::do_make_elf_object): New function.
1716         (class Output_data_got_powerpc): New.
1717         (class Output_data_glink): New.
1718         (class Powerpc_scan_relocatable_reloc): New.
1719         Many more changes througout file.
1720
1721 2012-08-09  Nick Clifton  <nickc@redhat.com>
1722
1723         * po/vi.po: Updated Vietnamese translation.
1724
1725 2012-08-07  Ian Lance Taylor  <iant@google.com>
1726
1727         * layout.cc (Layout::add_target_dynamic_tags): If
1728         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1729         plt_rel.
1730
1731 2012-07-30  Nick Clifton  <nickc@redhat.com>
1732
1733         * po/gold.pot: Updated template.
1734         * po/es.po: Updated Spanish translation.
1735
1736 2012-07-18  Cary Coutant  <ccoutant@google.com>
1737
1738         PR gold/14344
1739         * configure.ac: Add check for -gpubnames support.
1740         * configure: Regenerate.
1741         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1742         support; force -gno-pubnames.
1743         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1744         support.
1745         (gdb_index_test_4): New test.
1746         * testsuite/Makefile.in: Regenerate.
1747         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1748         * testsuite/gdb_index_test_2.sh: Likewise.
1749         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1750         * testsuite/gdb_index_test_4.sh: New script.
1751         * testsuite/gdb_index_test_comm.sh: New script with common code;
1752         don't look for space after colon.
1753
1754 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1755
1756         * gold.cc (queue_middle_tasks): Update function order only after
1757         deferred objects due to plugins are processed.
1758
1759 2012-07-11  Ian Lance Taylor  <iant@google.com>
1760
1761         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1762         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1763         (Target_arm::scan_reloc_for_stub): Likewise.
1764         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1765         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1766         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1767         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1768         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1769
1770 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1771             Ian Lance Taylor  <iant@google.com>
1772
1773         PR gold/14309
1774         * configure.ac: Test whether std::tr1::hash<off_t> works.
1775         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1776         needed.
1777         * output.h (class Output_fill): Add virtual destructor.
1778         * configure, config.in: Rebuild.
1779
1780 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1781
1782         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1783
1784 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1785
1786         * plugin.cc (Plugin::load): Handle position independent executables.
1787
1788 2012-06-06  Cary Coutant  <ccoutant@google.com>
1789
1790         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1791         add .debug_macro.
1792         (lines_only_debug_sections): Likewise.
1793         (gdb_fast_lookup_sections): New static array.
1794         (is_gdb_debug_section): Rename formal parameter.
1795         (is_lines_only_debug_section): Likewise.
1796         (is_gdb_fast_lookup_section): New function.
1797         (Layout::include_section): Check for ".zdebug_" prefix; pass
1798         section name suffix to is_gdb_debug_section, et al.; check for
1799         fast-lookup sections when building .gdb_index.
1800         * options.h (--strip-debug-gdb): Update GDB version number.
1801
1802 2012-06-06  Cary Coutant  <ccoutant@google.com>
1803
1804         * configure.ac: Add check for fallocate.
1805         * configure: Regenerate.
1806         * config.in: Regenerate.
1807
1808         * options.h (class General_options): Add --mmap-output-file and
1809         --posix-fallocate options.
1810         * output.cc: (posix_fallocate): Remove; replace with...
1811         (gold_fallocate): New function.
1812         (Output_file::map_no_anonymous): Call gold_fallocate.
1813         (Output_file::map): Check --mmap-output-file option.
1814
1815 2012-06-05  Jing Yu  <jingyu@google.com>
1816
1817         * gold.h (textdomain): Add do {} to empty while(0).
1818         (bindtextdomain): Likewise.
1819
1820 2012-06-04  Cary Coutant  <ccoutant@google.com>
1821
1822         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1823         has_dynsym_index.
1824
1825 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1826
1827         * symtab.cc (Symbol_table::define_special_symbol):
1828         Initialize *poldsym to prevent uninitialized variable errors.
1829
1830 2012-05-23  Cary Coutant  <ccoutant@google.com>
1831
1832         * layout.cc (Layout::section_name_mapping): Add rules to handle
1833         exact match on .data.rel.ro.local or .data.rel.ro.
1834         (Layout::output_section_name): Check for exact matches.
1835
1836 2012-05-23  Cary Coutant  <ccoutant@google.com>
1837
1838         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1839         more carefully.
1840
1841 2012-05-22  Cary Coutant  <ccoutant@google.com>
1842
1843         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1844         object before exporting symbol.
1845
1846 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1847
1848         * testsuite/tls_test.cc: Include "config.h" first.
1849         * testsuite/tls_test_c.c: Likewise.
1850
1851 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1852             Nick Clifton  <nickc@redhat.com>
1853
1854         PR 14072
1855         * configure.in: Add check that sysdep.h has been included before
1856         any system header files.
1857         * configure: Regenerate.
1858         * config.in: Regenerate.
1859
1860 2012-05-14  Cary Coutant  <ccoutant@google.com>
1861
1862         * layout.cc (Layout::make_output_section): Mark .tdata section
1863         as RELRO.
1864         * testsuite/relro_test.cc: Add a TLS variable.
1865
1866 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1867
1868         PR gold/14091
1869         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1870         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1871         R_X86_64_64.
1872
1873 2012-05-08  Cary Coutant  <ccoutant@google.com>
1874
1875         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1876         (lines_only_debug_sections): Likewise.
1877
1878 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1879
1880         * nacl.cc: New file.
1881         * nacl.h: New file.
1882         * Makefile.am (CCFILES, HFILES): Add them.
1883         * Makefile.in: Regenerate.
1884         * i386.cc (Output_data_plt_i386_nacl): New class.
1885         (Output_data_plt_i386_nacl_exec): New class.
1886         (Output_data_plt_i386_nacl_dyn): New class.
1887         (Target_i386_nacl): New class.
1888         (Target_selector_i386_nacl): New class.
1889         (target_selector_i386): Use it instead of Target_selector_i386.
1890         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1891         (Target_x86_64_nacl): New class.
1892         (Target_selector_x86_64_nacl): New class.
1893         (target_selector_x86_64, target_selector_x32): Use it instead of
1894         Target_selector_x86_64.
1895         * arm.cc (Output_data_plt_arm_nacl): New class.
1896         (Target_arm_nacl): New class.
1897         (Target_selector_arm_nacl): New class.
1898         (target_selector_arm, target_selector_armbe): Use it instead of
1899         Target_selector_arm.
1900
1901         * target-select.cc (select_target): Take new Input_file* and off_t
1902         arguments, pass them on to recognize method of selector.
1903         * object.cc (make_elf_sized_object): Update caller.
1904         * parameters.cc (parameters_force_valid_target): Likewise.
1905         * incremental.cc (make_sized_incremental_binary): Likewise.
1906         * target-select.h: Update decl.
1907         (Target_selector::recognize): Take new Input_file* argument,
1908         pass it on to do_recognize.
1909         (Target_selector::do_recognize): Take new Input_file* argument.
1910         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1911         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1912         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1913         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1914
1915         * target.h (Target::Target_info): New members isolate_execinstr
1916         and rosegment_gap.
1917         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1918         * arm.cc (Target_arm::arm_info): Update initializer.
1919         * i386.cc (Target_i386::i386_info): Likewise.
1920         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1921         * sparc.cc (Target_sparc::sparc_info): Likewise.
1922         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1923         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1924         * layout.cc (Layout::attach_allocated_section_to_segment):
1925         Take new const Target* argument.  If target->isolate_execinstr(), act
1926         like --rosegment.
1927         (Layout::find_first_load_seg): Take new const Target* argument;
1928         if target->isolate_execinstr(), reject PF_X segments.
1929         (Layout::relaxation_loop_body): Update caller.
1930         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1931         reset file offset to zero when we hit LOAD_SEG, and then do a second
1932         loop over the segments before LOAD_SEG to reassign offsets after
1933         addresses have been determined.  Handle target->rosegment_gap().
1934         (Layout::attach_section_to_segment): Take new const Target* argument;
1935         pass it to attach_allocated_section_to_segment.
1936         (Layout::make_output_section): Update caller.
1937         (Layout::attach_sections_to_segments): Take new const Target* argument;
1938         pass it to attach_section_to_segment.
1939         * gold.cc (queue_middle_tasks): Update caller.
1940         * layout.h (Layout): Update method decls with new arguments.
1941
1942         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1943         Target_info pointer to use.
1944         (Target_arm::do_make_data_plt): New virtual method.
1945         (Target_arm::make_data_plt): New method that calls it.
1946         (Target_arm::make_plt_entry): Use it.
1947         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1948         for the section alignment.
1949         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1950         method.
1951         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1952         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1953         method.
1954         (Output_data_plt_arm::get_plt_entry_size): Call it.
1955         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1956         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1957         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1958         method.
1959         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1960         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1961         method instead of sizeof(plt_entry).
1962         (Output_data_plt_arm::add_entry): Likewise.
1963         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1964         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1965         than static method.
1966         (Target_arm::plt_entry_size): Likewise.
1967         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1968         Move to ...
1969         (Output_data_plt_arm_standard): ... here, new class.
1970         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1971         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1972         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1973
1974         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1975         Take additional argument for the PLT entry size.
1976         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1977         Use get_plt_entry_size method rather than plt_entry_size variable.
1978         (Output_data_plt_x86_64::reserve_slot): Likewise.
1979         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1980         (Output_data_plt_x86_64::add_entry): Likewise.
1981         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1982         (Output_data_plt_x86_64::address_for_global): Likewise.
1983         (Output_data_plt_x86_64::address_for_local): Likewise.
1984         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1985         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1986         Make method non-static.
1987         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1988         method.
1989         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1990         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1991         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1992         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1993         virtual method.
1994         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1995         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1996         virtual method.
1997         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1998         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1999         virtual method.
2000         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2001         (Output_data_plt_x86_64::plt_entry_size)
2002         (Output_data_plt_x86_64::first_plt_entry)
2003         (Output_data_plt_x86_64::plt_entry)
2004         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2005         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2006         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2007         (Output_data_plt_x86_64_standard): ... here, new class.
2008         (Target_x86_64::Target_x86_64): Take optional argument for the
2009         Target_info pointer to use.
2010         (Target_x86_64::do_make_data_plt): New virtual method.
2011         (Target_x86_64::make_data_plt): New method to call it.
2012         (Target_x86_64::init_got_plt_for_update): Use that.
2013         Call this->plt_->add_eh_frame method here.
2014         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2015         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2016         rather than static method.
2017         (Target_x86_64::plt_entry_size): Likewise.
2018         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2019         rather than plt_entry_size variable.  Move guts of PLT filling to...
2020         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2021         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2022         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2023
2024         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2025         additional argument for the section alignment.
2026         Don't do add_eh_frame_for_plt here.
2027         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2028         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2029         variable.
2030         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2031         method.
2032         (Output_data_plt_i386::get_plt_entry_size): Call it.
2033         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2034         (Output_data_plt_i386::add_eh_frame): New method to call it.
2035         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2036         method.
2037         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2038         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2039         method.
2040         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2041         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2042         method instead of plt_entry_size.
2043         (Output_data_plt_i386::plt_entry_size)
2044         (Output_data_plt_i386::plt_eh_frame_fde_size)
2045         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2046         (Output_data_plt_i386_standard): ... here, new class.
2047         (Output_data_plt_i386_exec): New class.
2048         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2049         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2050         (Output_data_plt_i386::exec_plt_entry): Move to ...
2051         (Output_data_plt_i386_exec::plt_entry): ... here.
2052         (Output_data_plt_i386_dyn): New class.
2053         (Output_data_plt_i386::first_plt_entry): Move to ...
2054         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2055         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2056         (Output_data_plt_i386_dyn::plt_entry): ... here.
2057         (Target_i386::Target_i386): Take optional argument for the Target_info
2058         pointer to use.
2059         (Target_i386::do_make_data_plt): New virtual method.
2060         (Target_i386::make_data_plt): New method to call it.
2061         (Target_i386::make_plt_section): Use that.
2062         Call this->plt_->add_eh_frame method here.
2063         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2064         rather than plt_entry_size variable.
2065         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2066         (Output_data_plt_i386::address_for_local): Likewise.
2067         (Output_data_plt_i386::do_write): Likewise.
2068         Move guts of PLT filling to...
2069         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2070         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2071         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2072         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2073
2074 2012-05-01  Cary Coutant  <ccoutant@google.com>
2075
2076         * dwarf_reader.cc (Dwarf_die::read_attributes)
2077         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2078         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2079         * reduced_debug_output.cc
2080         (Output_reduced_debug_info_section::get_die_end): Remove
2081         DW_FORM_GNU_ref_index.  Add default case.
2082
2083 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2084
2085         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2086         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2087         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2088         DW_AT_high_pc as offset from DW_AT_low_pc.
2089
2090         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2091         * testsuite/Makefile.in: Regenerate.
2092         * testsuite/gdb_index_test_3.c: New test source file.
2093         * testsuite/gdb_index_test_3.sh: New test source file.
2094
2095 2012-04-25  Ian Lance Taylor  <iant@google.com>
2096
2097         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2098         pointer.
2099         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2100         as a class, not a struct.
2101         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2102         (Target_arm::apply_cortex_a8_workaround): Likewise.
2103         * gc.h: Declare Reloc_types as a struct, not a class.
2104         * object.h: Declare Symbols_data as a struct.
2105         * reloc.h: Declare Read_relocs_data as a struct.
2106         * target.h: Declare Relocate_info as a struct.
2107
2108 2012-04-24  David S. Miller  <davem@davemloft.net>
2109
2110         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2111         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2112         and R_SPARC_WPLT30.
2113
2114 2012-04-24  Cary Coutant  <ccoutant@google.com>
2115
2116         * incremental-dump.cc (find_input_containing_global): Replace
2117         magic number with symbolic constant.
2118         (dump_incremental_inputs): Update version number.
2119         * incremental.cc (Output_section_incremental_inputs): Update version
2120         number; import symbolic constants from Incremental_inputs_reader.
2121         (Incremental_inputs::create_data_sections): Align relocations
2122         section correctly for 64-bit targets.
2123         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2124         constants; add padding.
2125         (Output_section_incremental_inputs::write_header): Add assert for
2126         header_size.
2127         (Output_section_incremental_inputs::write_input_files): Add assert
2128         for input_entry_size.
2129         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2130         add assert for object_info_size, input_section_entry_size,
2131         global_sym_entry_size.
2132         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2133         for data structure sizes; use them.
2134         (Incremental_input_entry_reader): Import symbolic constants from
2135         Incremental_inputs_reader; use them.
2136
2137 2012-04-23  David S. Miller  <davem@davemloft.net>
2138
2139         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2140         and elf_flags_set_.
2141         (Target_sparc::Target_sparc): Initialize new fields.
2142         (Target_sparc::do_make_elf_object): New function.
2143         (Target_sparc::do_adjust_elf_header): New function.
2144
2145 2012-04-23  Cary Coutant  <ccoutant@google.com>
2146
2147         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2148         CU range table of gdb index.
2149
2150 2012-04-20  David S. Miller  <davem@davemloft.net>
2151
2152         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2153         instead of false.
2154
2155 2012-04-16  David S. Miller  <davem@davemloft.net>
2156
2157         * sparc.cc (Target_sparc::got_address): New function.
2158         (Sparc_relocate_functions::gdop_hix22): New function.
2159         (Sparc_relocate_functions::gdop_lox10): New function.
2160         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2161         relocs.
2162         (Target_sparc::Scan::local): Likewise if the global symbol is not
2163         preemptible and is not IFUNC.
2164         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2165         transformations for local and non-preemptible non-IFUNC global
2166         symbols.
2167
2168         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2169         writing out 64-bit part of ranges.
2170
2171         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2172         -fpic and -fpie respectively.
2173         * Makefile.in: Regenerate.
2174
2175         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2176         (Target_sparc::Target_sparc): Initialize new field.
2177         (Target_sparc::do_plt_section_for_global): New function.
2178         (Target_sparc::do_plt_section_for_local): New function.
2179         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2180         (Target_sparc::make_plt_section): New function, broken out of
2181         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2182         (Target_sparc::make_plt_entry): Call make_plt_section.
2183         (Target_sparc::make_local_ifunc_plt_entry): New function.
2184         (Target_sparc::rela_ifunc_section): New function.
2185         (Target_sparc::plt_section): Remove const.
2186         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2187         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2188         and ifunc_count_ fields.
2189         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2190         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2191         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2192         (Output_data_plt_sparc::rela_ifunc): New function.
2193         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2194         (Output_data_plt_sparc::has_ifunc_section): New function.
2195         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2196         (Output_data_plt_sparc::address_for_global): New function.
2197         (Output_data_plt_sparc::address_for_local): New function.
2198         (Output_data_plt_sparc::plt_index_to_offset): New function.
2199         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2200         and entry_count.
2201         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2202         entry_count.
2203         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2204         R_SPARC_JMP_IREL to switch.
2205         (Target_sparc::Scan::check_non_pic): Likewise.
2206         (Target_sparc::Scan::local): Handle IFUNC symbols.
2207         (Target_sparc::Scan::local): Likewise.
2208         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2209         and plt_address_for_local.
2210         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2211         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2212
2213         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2214         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2215         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2216         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2217         global relocs too.
2218         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2219         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2220         calls.
2221         * sparc.cc (Target_sparc::Scan::global): Likewise.
2222         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2223
2224 2012-04-16  Cary Coutant  <ccoutant@google.com>
2225
2226         * archive.cc (Library_base::should_include_member): Check for
2227         --export-dynamic-symbol.
2228         * options.h (class General_options): Add --export-dynamic-symbol.
2229         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2230         --export-dynamic-symbol.
2231         (Symbol_table::gc_mark_undef_symbols): Likewise.
2232         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2233
2234 2012-04-12  David S. Miller  <davem@davemloft.net>
2235
2236         * sparc.cc (Reloc::wdisp10): New relocation method.
2237         (Reloc::h34): Likewise.
2238         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2239         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2240         R_SPARC_WDISP10.
2241         (Target_sparc::Scan::local): Likewise.
2242         (Target_sparc::Scan::global): Likewise.
2243         (Target_sparc::Relocate::relocate): Likewise.
2244
2245 2012-04-09  Cary Coutant  <ccoutant@google.com>
2246
2247         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2248         low_pc == 0.
2249
2250 2012-04-06  Ian Lance Taylor  <iant@google.com>
2251
2252         * timer.cc: #include <unistd.h>.
2253
2254 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2255
2256         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2257         * config.in: Regenerate.
2258         * configure: Regenerate.
2259
2260 2012-04-05  Nick Clifton  <nickc@redhat.com>
2261
2262         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2263         (AM_LC_MESSAGES): Add.
2264         * aclocal.m4: Regenerate.
2265         * config.in: Regenerate.
2266         * configure: Regenerate.
2267
2268 2012-03-21  Cary Coutant  <ccoutant@google.com>
2269
2270         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2271         * Makefile.in: Regenerate.
2272         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2273         (Sized_elf_reloc_mapper::symbol_section): New function.
2274         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2275         (make_elf_reloc_mapper): New function.
2276         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2277         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2278         (Dwarf_abbrev_table::do_get_abbrev): New function.
2279         (Dwarf_ranges_table::read_ranges_table): New function.
2280         (Dwarf_ranges_table::read_range_list): New function.
2281         (Dwarf_pubnames_table::read_section): New function.
2282         (Dwarf_pubnames_table::read_header): New function.
2283         (Dwarf_pubnames_table::next_name): New function.
2284         (Dwarf_die::Dwarf_die): New function.
2285         (Dwarf_die::read_attributes): New function.
2286         (Dwarf_die::skip_attributes): New function.
2287         (Dwarf_die::set_name): New function.
2288         (Dwarf_die::set_linkage_name): New function.
2289         (Dwarf_die::attribute): New function.
2290         (Dwarf_die::string_attribute): New function.
2291         (Dwarf_die::int_attribute): New function.
2292         (Dwarf_die::uint_attribute): New function.
2293         (Dwarf_die::ref_attribute): New function.
2294         (Dwarf_die::child_offset): New function.
2295         (Dwarf_die::sibling_offset): New function.
2296         (Dwarf_info_reader::check_buffer): New function.
2297         (Dwarf_info_reader::parse): New function.
2298         (Dwarf_info_reader::do_parse): New function.
2299         (Dwarf_info_reader::do_read_string_table): New function.
2300         (Dwarf_info_reader::lookup_reloc): New function.
2301         (Dwarf_info_reader::get_string): New function.
2302         (Dwarf_info_reader::visit_compilation_unit): New function.
2303         (Dwarf_info_reader::visit_type_unit): New function.
2304         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2305         Sized_elf_reloc_mapper.
2306         (Sized_dwarf_line_info::symbol_section): Remove function.
2307         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2308         (Sized_dwarf_line_info::read_line_mappings): Remove object
2309         parameter, adjust callers.
2310         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2311         * dwarf_reader.h: Include <sys/types.h>.
2312         (class Track_relocs): Remove forward declaration.
2313         (class Elf_reloc_mapper): New class.
2314         (class Sized_elf_reloc_mapper): New class.
2315         (class Dwarf_abbrev_table): New class.
2316         (class Dwarf_range_list): New class.
2317         (class Dwarf_ranges_table): New class.
2318         (class Dwarf_pubnames_table): New class.
2319         (class Dwarf_die): New class.
2320         (class Dwarf_info_reader): New class.
2321         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2322         (Sized_dwarf_line_info::symbol_section): Remove member function.
2323         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2324         base class.
2325         * gdb-index.cc: New source file.
2326         * gdb-index.h: New source file.
2327         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2328         and .debug_types sections, call Layout::add_to_gdb_index.
2329         (Sized_relobj_incr::do_section_name): Implement.
2330         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2331         return type; Implement.
2332         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2333         return type.
2334         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2335         parameter list and return type.
2336         (Sized_incr_dynobj::do_section_contents): Likewise.
2337         * layout.cc: Include gdb-index.h.
2338         (Layout::Layout): Initialize gdb_index_data_.
2339         (Layout::init_fixed_output_section): Check for .gdb_index section.
2340         (Layout::add_to_gdb_index): New function. Instantiate.
2341         * layout.h: Add forward declaration for class Gdb_index.
2342         (Layout::add_to_gdb_index): New member function.
2343         (Layout::gdb_index_data_): New data member.
2344         * main.cc: Include gdb-index.h.
2345         (main): Print statistics for gdb index.
2346         * object.cc (Object::section_contents): Move code into
2347         do_section_contents.
2348         (need_decompressed_section): Check for sections needed when building
2349         gdb index.
2350         (build_compressed_section_map): Likewise.
2351         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2352         gdb index.
2353         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2354         sections; call Layout::add_to_gdb_index.
2355         (Sized_relobj_file::do_decompressed_section_contents): Call
2356         do_section_contents directly.
2357         * object.h (Object::do_section_contents): Adjust parameter list and
2358         return type.
2359         (Object::do_decompressed_section_contents): Call do_section_contents
2360         directly.
2361         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2362         return type.
2363         * options.h (class General_options): Add --gdb-index option.
2364         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2365         list and return type.
2366         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2367         * reloc.h (Track_relocs::checkpoint): New function.
2368         (Track_relocs::reset): New function.
2369
2370         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2371         New test cases.
2372         * testsuite/Makefile.in: Regenerate.
2373         * testsuite/gdb_index_test.cc: New test source file.
2374         * testsuite/gdb_index_test_1.sh: New test source file.
2375         * testsuite/gdb_index_test_2.sh: New test source file.
2376
2377 2012-03-19  Doug Kwan  <dougkwan@google.com>
2378
2379         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2380         (Target_arm::do_finalize_sections): Remove code which defines
2381         __exidx_start and __exidx_end.  Make symbol table parameter
2382         anonymous as it is not used.
2383         * gold.cc (queue_middle_tasks): Call target hook to define any
2384         target-specific symbols.
2385         * target.h (Target::define_standard_symbols): New method.
2386         (Target::do_define_standard_symbols): Same.
2387         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2388         * testsuite/Makefile.in: Regenerate.
2389         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2390         and __exidx_end.
2391         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2392         relocations are generated for __exidx_start and __exidx_end.
2393
2394 2012-03-16  Doug Kwan  <dougkwan@google.com>
2395
2396         * testsuite/Makefile.am: Disable test initpri3b.
2397         * testsuite/Makefile.in: Regenerate.
2398
2399 2012-03-15  Doug Kwan  <dougkwan@google.com>
2400
2401         * arm.cc (Target_arm::got_section): Make .got section read-only
2402         if -z now is given.
2403
2404 2012-03-15  Ian Lance Taylor  <iant@google.com>
2405
2406         PR gold/13850
2407         * layout.cc (Layout::make_output_section): Correctly mark
2408         SHT_INIT_ARRAY, et. al., as relro.
2409
2410 2012-03-14  Doug Kwan  <dougkwan@google.com>
2411
2412         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2413         dynamic relocations for protected symbols in shared objects.
2414
2415 2012-03-13  Ian Lance Taylor  <iant@google.com>
2416
2417         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2418         keep the larger alignment.
2419
2420 2012-03-12  Cary Coutant  <ccoutant@google.com>
2421
2422         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2423         handling of DW_LNE_define_file.
2424
2425 2012-03-12  Cary Coutant  <ccoutant@google.com>
2426
2427         * reduced_debug_output.cc
2428         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2429         codes to switch.
2430
2431 2012-02-29  Cary Coutant  <ccoutant@google.com>
2432
2433         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2434
2435 2012-02-29  Cary Coutant  <ccoutant@google.com>
2436
2437         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2438         Call Object::decompressed_section_contents.
2439         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2440         New dtor.
2441         (Sized_dwarf_line_info::buffer_start_): New data member.
2442         * merge.cc (Output_merge_data::do_add_input_section): Call
2443         Object::decompressed_section_contents.
2444         (Output_merge_string::do_add_input_section): Likewise.
2445         * object.cc (need_decompressed_section): New function.
2446         (build_compressed_section_map): Decompress sections needed later.
2447         (Sized_relobj_file::do_decompressed_section_contents): New function.
2448         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2449         * object.h (Object::decompressed_section_contents): New function.
2450         (Object::discard_decompressed_sections): New function.
2451         (Object::do_decompressed_section_contents): New function.
2452         (Object::do_discard_decompressed_sections): New function.
2453         (Compressed_section_info): New type.
2454         (Compressed_section_map): Include decompressed section contents.
2455         (Sized_relobj_file::do_decompressed_section_contents): New function.
2456         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2457
2458 2012-02-16  Cary Coutant  <ccoutant@google.com>
2459
2460         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2461         * testsuite/Makefile.in: Regenerate.
2462
2463 2012-02-14  Cary Coutant  <ccoutant@google.com>
2464
2465         * options.cc (General_options::finalize): Disallow -pie and -static.
2466
2467 2012-02-03  Doug Kwan  <dougkwan@google.com>
2468
2469         * arm.cc (Arm_relocate_functions::abs8,
2470         Arm_relocate_functions::abs16): Use
2471         Bits::has_signed_unsigned_overflow32.
2472         (Arm_relocate_functions::thm_abs8): Correct range of
2473         overflow check.
2474         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2475         in assertions.
2476
2477 2012-02-02  Doug Kwan  <dougkwan@google.com>
2478
2479         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2480         position independent outputs, not just shared objects.
2481
2482 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2483
2484         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2485         * configure: Regenerated.
2486
2487 2012-01-27  Ian Lance Taylor  <iant@google.com>
2488
2489         * reloc.h (Bits): New class with static functions, copied from
2490         namespace utils in arm.cc.
2491         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2492         instead.
2493
2494 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2495
2496         * incremental.cc (write_info_blocks): Correct relocation offset.
2497
2498 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2499
2500         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2501         (Relocate::tls_gd_to_le): Likewise.
2502
2503 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2504
2505         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2506
2507 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2508
2509         * configure.ac: Check if -mcmodel=medium works.
2510         * configure: Regenerated.
2511
2512 2012-01-24  Cary Coutant  <ccoutant@google.com>
2513
2514         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2515         definition and ...
2516         (read_unsigned_LEB_128_x): ... this new function.
2517         (read_signed_LEB_128): Replaced with inline definition and ...
2518         (read_signed_LEB_128_x): ... this new function.
2519         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2520         (read_unsigned_LEB_128): Add inline definition.
2521         (read_signed_LEB_128_x): New function.
2522         (read_signed_LEB_128): Add inline definition.
2523         * testsuite/Makefile.am (leb128_unittest): New unit test.
2524         * testsuite/Makefile.in: Regenerate.
2525         * testsuite/leb128_unittest.cc: New unit test.
2526
2527 2012-01-23  Ian Lance Taylor  <iant@google.com>
2528
2529         PR gold/13617
2530         * i386.cc (Target_i386::do_code_fill): When using a jmp
2531         instruction, pad with nop instructions.
2532         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2533
2534 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2535
2536         * x86_64.cc (gc_process_relocs): Add typename on types used in
2537         template.
2538         (scan_relocs): Likewise.
2539         (relocate_section): Likewise.
2540         (apply_relocation): Likewise.
2541
2542 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2543
2544         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2545         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2546         under x32.
2547
2548 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2549
2550         * x86_64.cc: Initial support for x32.
2551
2552 2012-01-03  Cary Coutant  <ccoutant@google.com>
2553
2554         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2555         Use abstract base class for GOT.
2556         * gold/output.h (class Output_data_got_base): New abstract base class.
2557         (class Output_data_got): Derive from new base class, adjust ctors.
2558         (Output_data_got::reserve_slot): Make virtual; rename to
2559         do_reserve_slot; Adjust callers.
2560         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2561         pointer to abstract base class.
2562         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2563
2564 2011-12-18  Ian Lance Taylor  <iant@google.com>
2565
2566         * object.h (Relobj::local_symbol_value): New function.
2567         (Relobj::local_plt_offset): New function.
2568         (Relobj::local_has_got_offset): New function.
2569         (Relobj::local_got_offset): New function.
2570         (Relobj::set_local_got_offset): New function.
2571         (Relobj::do_local_symbol_value): New pure virtual function.
2572         (Relobj::do_local_plt_offset): Likewise.
2573         (Relobj::do_local_has_got_offset): Likewise.
2574         (Relobj::do_local_got_offset): Likewise.
2575         (Relobj::do_set_local_got_offset): Likewise.
2576         (Sized_relobj::do_local_has_got_offset): Rename from
2577         local_has_got_offset.
2578         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2579         (Sized_relobj::do_set_local_got_offset): Rename from
2580         set_local_got_offset.
2581         (Sized_relobj_file::do_local_plt_offset): Rename from
2582         local_plt_offset.
2583         (Sized_relobj_file::do_local_symbol_value): New function.
2584         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2585         local_plt_offset.
2586         * output.cc (Output_data_got::Got_entry::write): Change object to
2587         Relobj.  Use local_symbol_value.
2588         (Output_data_got::add_global_with_rel): Change rel_dyn to
2589         Output_data_reloc_generic*.  Use add_global_generic.
2590         (Output_data_got::add_global_with_rela): Remove.  Change all
2591         callers to use add_global_with_rel.
2592         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2593         Output_data_reloc_generic*.  Use add_global_generic.
2594         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2595         callers to use add_global_pair_with_rel.
2596         (Output_data_got::add_local): Change object to Relobj*.
2597         (Output_data_got::add_local_plt): Likewise.
2598         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2599         change rel_dyn to Output_data_reloc_generic*.  Use
2600         add_local_generic.
2601         (Output_data_got::add_local_with_rela): Remove.  Change all
2602         callers to use all_local_with_rel.
2603         (Output_data_got::add_local_pair_with_rel): Change object to
2604         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2605         add_output_section_generic.
2606         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2607         callers to use add_local_pair_with_rel.
2608         (Output_data_got::reserve_local): Change object to Relobj*.
2609         * output.h: (class Output_data_reloc_generic): Add pure virtual
2610         declarations for add_global_generic, add_local_generic,
2611         add_output_section_generic.
2612         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2613         functions for Output_data_reloc_generic.  Update declarations for
2614         changes listed in output.cc.
2615         (class Output_data_got): Change template parameter to got_size.
2616         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2617         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2618         function.
2619         (Sized_relobj_incr::do_local_plt_offset): New function.
2620         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2621         add_global_generic.
2622
2623 2011-12-17  Cary Coutant  <ccoutant@google.com>
2624
2625         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2626         * resolve.cc (Symbol_table::resolve): Likewise.
2627         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2628         arrays.
2629         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2630
2631 2011-12-16  Ian Lance Taylor  <iant@google.com>
2632
2633         * output.h (Output_data_reloc_generic::add): Only call
2634         add_dynamic_reloc if this is a dynamic reloc section.
2635
2636 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2637
2638         PR gold/13505
2639         * target-reloc.h (apply_relocation): Replace <64, false> with
2640         <size, big_endian>.
2641
2642 2011-11-25  Nick Clifton  <nickc@redhat.com>
2643
2644         * po/it.po: New Italian translation.
2645
2646 2011-11-17  Sterling Augustine  <saugustine@google.com>
2647
2648         * script.cc (script_include_directive): Implement.
2649         (read_script_file): New local variables name and search_path. Update
2650         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2651         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2652         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2653
2654 2011-11-11  Sterling Augustine  <saugustine@google.com>
2655
2656         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2657         (file_or_sections_cmd): Likewise.
2658
2659 2011-11-11  Doug Kwan  <dougkwan@google.com>
2660
2661         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2662         if --just-symbols is given.
2663
2664 2011-11-10  Doug Kwan  <dougkwan@google.com>
2665
2666         PR gold/13362
2667         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2668         when processing data relocs.
2669         * reloc.h (Relocate_functions::rel_unaligned): New method.
2670         (Relocate_functions::pcrel_unaligned): Ditto.
2671         (Relocate_functions::rel32_unaligned): Ditto.
2672         (Relocate_functions::pcrel32_unaligned): Ditto.
2673
2674 2011-11-09  Doug Kwan  <dougkwan@google.com>
2675
2676         PR gold/13362
2677         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2678         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2679         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2680         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2681         (Relocate_functions::rel_unaligned): New.
2682         (Relocate_functions::rel32_unaligned): New.
2683         * target-reloc.h (relocate_for_relocatable): Add code to handle
2684         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2685         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2686         arm_unaligned_reloc_r): New targets.
2687         * testsuite/Makefile.in: Regenerate.
2688         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2689         linking.
2690
2691 2011-11-02  Ian Lance Taylor  <iant@google.com>
2692
2693         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2694         NATIVE_LINKER.
2695         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2696         * options.cc (General_options::finalize): Use library search path
2697         from configure script if specified.  If not native and no sysroot,
2698         only search TOOLLIBDIR.
2699         * options.h (Search_directory::Search_directory): Change name to
2700         const std::string&.
2701         (General_options::add_to_library_path_with_sysroot): Change arg to
2702         const std::string&.
2703         * configure, Makefile.in, config.in: Rebuild.
2704
2705 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2706
2707         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2708         we are working around the ARM1176 Erratum.
2709         * options.h (General_options::fix_arm1176): Add option.
2710         * testsuite/Makefile.am: Add testcases, and keep current ones
2711         working.
2712         * testsuite/Makefile.in: Regenerate.
2713         * testsuite/arm_fix_1176.s: New file.
2714         * testsuite/arm_fix_1176.sh: Likewise.
2715
2716 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2717
2718         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2719         may_use_blx_.
2720         (Target_arm::may_use_blx): Remove method.
2721         (Target_arm::set_may_use_blx): Likewise.
2722         (Target_arm::may_use_v4t_interworking): New method.
2723         (Target_arm::may_use_v5t_interworking): Likewise.
2724         (Target_arm::may_use_blx_): Remove member variable.
2725         (Arm_relocate_functions::arm_branch_common): Check for v5T
2726         interworking.
2727         (Arm_relocate_functions::thumb_branch_common): Likewise.
2728         (Reloc_stub::stub_type_for_reloc): Likewise.
2729         (Target_arm::do_finalize_sections): Correct interworking checks.
2730         * testsuite/Makefile.am: Add new tests.
2731         * testsuite/Makefile.in: Regenerate.
2732         * testsuite/arm_farcall_arm_arm.s: New test.
2733         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2734         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2735         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2736         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2737         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2738         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2739         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2740
2741 2011-10-31  Cary Coutant  <ccoutant@google.com>
2742
2743         PR gold/13023
2744         * expression.cc (Expression::eval_with_dot): Add
2745         is_section_dot_assignment parameter.
2746         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2747         absolute and assigning to dot within a section.
2748         * script-sections.cc
2749         (Output_section_element_assignment::set_section_addresses): Pass
2750         dot_section to set_if_absolute.
2751         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2752         as is_section_dot_assignment flag to eval_with_dot.
2753         (Output_section_element_dot_assignment::set_section_addresses):
2754         Likewise.
2755         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2756         parameter.  Also set value if relative to dot_section; set the
2757         symbol's output_section.
2758         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2759         parameter.  Adjust all callers.
2760         (Expression::eval_maybe_dot): Likewise.
2761         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2762         Adjust all callers.
2763         * testsuite/script_test_2.t: Test assignment of an absolute value
2764         to dot within an output section element.
2765
2766 2011-10-31  Cary Coutant  <ccoutant@google.com>
2767
2768         * options.h (class General_options): Add --[no-]gnu-unique options.
2769         * symtab.cc (Symbol_table::sized_write_globals): Convert
2770         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2771
2772 2011-10-31  Cary Coutant  <ccoutant@google.com>
2773
2774         PR gold/13359
2775         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2776         unnecessary assertion.
2777         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2778
2779 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2780
2781         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2782         gc_mark_symbol.
2783         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2784         gc_mark_symbol.
2785         Change to just keep the section associated with symbol.
2786         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2787         they are externally visible and --export-dynamic is turned on.
2788         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2789
2790 2011-10-19  Ian Lance Taylor  <iant@google.com>
2791
2792         PR gold/13163
2793         * script-sections.cc
2794         (Output_section_element_dot_assignment::needs_output_section): New
2795         function.
2796
2797 2011-10-19  Ian Lance Taylor  <iant@google.com>
2798
2799         PR gold/13204
2800         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2801         --section-start option was seen.
2802         * options.h (General_options::any_section_start): New function.
2803
2804 2011-10-18  David S. Miller  <davem@davemloft.net>
2805
2806         PR binutils/13301
2807         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2808         member to track relocation locations that have moved during TLS
2809         reloc optimizations.
2810         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2811         (Target_sparc::Relocate::relocate): Adjust view down by 4
2812         bytes if it matches reloc_adjust_addr_.
2813         (Target_sparc::Relocate::relocate_tls): Always move the
2814         __tls_get_addr call delay slot instruction forward 4 bytes when
2815         performing relaxation.
2816
2817 2011-10-18  Cary Coutant  <ccoutant@google.com>
2818
2819         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2820         (Output_file::map_no_anonymous): Check for non-zero
2821         return code from posix_fallocate.
2822
2823 2011-10-17  Cary Coutant  <ccoutant@google.com>
2824
2825         PR gold/13245
2826         * plugin.cc (is_visible_from_outside): Check for symbols
2827         referenced from dynamic objects.
2828         * resolve.cc (Symbol_table::resolve): Don't count references
2829         from dynamic objects as references from real ELF files.
2830         * testsuite/plugin_test_2.sh: Adjust expected result.
2831
2832 2011-10-17  Cary Coutant  <ccoutant@google.com>
2833
2834         * gold.cc: Include timer.h.
2835         (queue_middle_tasks): Stamp time.
2836         (queue_final_tasks): Likewise.
2837         * main.cc (main): Store timer in parameters.  Print timers
2838         for each pass.
2839         * parameters.cc (Parameters::Parameters): Initialize timer_.
2840         (Parameters::set_timer): New function.
2841         (set_parameters_timer): New function.
2842         * parameters.h (Parameters::set_timer): New function.
2843         (Parameters::timer): New function.
2844         (Parameters::timer_): New data member.
2845         (set_parameters_timer): New function.
2846         * timer.cc (Timer::stamp): New function.
2847         (Timer::get_pass_time): New function.
2848         * timer.h (Timer::stamp): New function.
2849         (Timer::get_pass_time): New function.
2850         (Timer::pass_times_): New data member.
2851
2852 2011-10-17  Cary Coutant  <ccoutant@google.com>
2853
2854         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2855         task for members of lib groups.
2856
2857 2011-10-17  Cary Coutant  <ccoutant@google.com>
2858
2859         PR gold/13288
2860         * fileread.cc (File_read::find_view): Add assert.
2861         (File_read::make_view): Move bounds check (replace with assert)...
2862         (File_read::find_or_make_view): ... to here.
2863
2864 2011-10-12  Cary Coutant  <ccoutant@google.com>
2865
2866         * output.cc (Output_file::open_base_file): Handle case where
2867         ::read returns less than requested size.
2868
2869 2011-10-10  Cary Coutant  <ccoutant@google.com>
2870
2871         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2872         Initialize defined_count_.
2873         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2874         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2875         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2876         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2877         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2878         * incremental.h (Sized_relobj_incr::defined_count_): New data
2879         member.
2880         (Sized_incr_dynobj::defined_count_): New data member.
2881         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2882         Return zeroes instead of internal error.
2883
2884 2011-10-10  Cary Coutant  <ccoutant@google.com>
2885
2886         PR gold/13249
2887         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2888         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2889         * output.h (class Output_reloc): Add use_plt_offset flag.
2890         (Output_reloc::type_): Adjust size of bit field.
2891         (Output_reloc::use_plt_offset_): New bit field.
2892         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2893         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2894         flag.  Adjust all callers.
2895         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2896         creating RELATIVE relocations.
2897
2898 2011-10-10  Nick Clifton  <nickc@redhat.com>
2899
2900         * po/es.po: Updated Spanish translation.
2901         * po/fi.po: Updated Finnish translation.
2902
2903 2011-10-03   Diego Novillo  <dnovillo@google.com>
2904
2905         * options.cc (parse_uint): Fix dereference of RETVAL.
2906
2907 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2908
2909         * layout.h (section_order_map_): New member.
2910         (get_section_order_map): New member function.
2911         * output.cc (Output_section::add_input_section): Check for patterns
2912         only when --section-ordering-file is specified.
2913         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2914         output_sections have been formed.
2915         * layout.cc (Layout_Layout): Initialize section_order_map_.
2916         * plugin.cc (update_section_order): Store order in order_map. Do not
2917         update the order.
2918         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2919         * testsuite/Makefile.in: Regenerate.
2920         * testsuite/plugin_section_order.c: New file.
2921         * testsuite/plugin_final_layout.cc: New file.
2922         * testsuite/plugin_final_layout.sh: New file.
2923
2924 2011-09-29  Cary Coutant  <ccoutant@google.com>
2925
2926         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2927         Check for NULL.
2928         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2929         symbols during incremental update.
2930         (Symbol_table::add_from_dynobj): Likewise.
2931
2932 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2933             Ian Lance Taylor  <iant@google.com>
2934
2935         * symtab.cc (Symbol_table::define_special_symbol): Always
2936         canonicalize version string.
2937
2938 2011-09-26  Cary Coutant  <ccoutant@google.com>
2939
2940         * gold.cc (queue_initial_tasks): Move option checks ...
2941         * options.cc (General_options::finalize): ... to here. Disable
2942         some options; make others fatal.
2943
2944 2011-09-26  Cary Coutant  <ccoutant@google.com>
2945
2946         gcc PR lto/47247
2947         * plugin.cc (get_symbols_v2): New function.
2948         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2949         (is_referenced_from_outside): New function.
2950         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2951         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2952         (get_symbols): Pass version parameter.
2953         (get_symbols_v2): New function.
2954         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2955         parameter.
2956         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2957         (onload): Add LDPT_GET_SYMBOLS_V2.
2958         (all_symbols_read_hook): Use get_symbols_v2; check for
2959         LDPR_PREVAILING_DEF_IRONLY_EXP.
2960         * testsuite/plugin_test_3.sh: Update expected results.
2961
2962 2011-09-23  Simon Baldwin  <simonb@google.com>
2963
2964         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2965         configuration options.
2966         * configure: Regenerate.
2967         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2968         * Makefile.in: Regenerate.
2969         * testsuite/Makefile.in: Regenerate.
2970
2971 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2972
2973         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2974
2975 2011-09-19  Cary Coutant  <ccoutant@google.com>
2976
2977         * incremental.cc (can_incremental_update): Fix typo in comment.
2978         * incremental.h (can_incremental_update): Likewise.
2979
2980 2011-09-18  Cary Coutant  <ccoutant@google.com>
2981
2982         * incremental.cc (can_incremental_update): New function.
2983         * incremental.h (can_incremental_update): New function.
2984         * layout.cc (Layout::init_fixed_output_section): Call it.
2985         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2986         * object.cc (Sized_relobj_file::do_layout): Call
2987         can_incremental_update.
2988
2989 2011-09-13  Cary Coutant  <ccoutant@google.com>
2990
2991         * configure.ac: Check for glibc support for gnu_indirect_function
2992         support with static linking, setting automake conditional
2993         IFUNC_STATIC.
2994         * Makefile.in: Regenerate.
2995         * configure: Regenerate.
2996
2997         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2998         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2999         for IFUNC_STATIC.
3000         * testsuite/Makefile.in: Regenerate.
3001
3002 2011-09-13  Cary Coutant  <ccoutant@google.com>
3003
3004         * incremental.cc (Sized_relobj_incr::do_layout): Call
3005         report_comdat_group for kept comdat sections.
3006         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3007         * testsuite/Makefile.in: Regenerate.
3008         * testsuite/incr_comdat_test_1.cc: New source file.
3009         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3010         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3011         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3012
3013 2011-09-13  Ian Lance Taylor  <iant@google.com>
3014
3015         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3016         variable external_symbols_offset.
3017
3018 2011-09-12  Ian Lance Taylor  <iant@google.com>
3019
3020         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3021         triggered if object has no symbols.
3022
3023 2011-09-09  David S. Miller  <davem@davemloft.net>
3024
3025         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3026         (Output_fill_debug_line::do_write): Likewise.
3027
3028 2011-08-29  Cary Coutant  <ccoutant@google.com>
3029
3030         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3031         casts to match formatting specs.
3032         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3033
3034 2011-08-26  Cary Coutant  <ccoutant@google.com>
3035
3036         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3037         remaining hole size when allocating.
3038         (Layout::make_output_section): Set fill methods for debug sections.
3039         * layout.h (Free_list::Free_list_node): Move from private to
3040         public.
3041         (Free_list::set_min_hole_size): New function.
3042         (Free_list::begin, Free_list::end): New functions.
3043         (Free_list::min_hole_): New data member.
3044         * output.cc: Include dwarf.h.
3045         (Output_fill_debug_info::do_minimum_hole_size): New function.
3046         (Output_fill_debug_info::do_write): New function.
3047         (Output_fill_debug_line::do_minimum_hole_size): New function.
3048         (Output_fill_debug_line::do_write): New function.
3049         (Output_section::Output_section): Initialize new data member.
3050         (Output_section::set_final_data_size): Ensure patch space is larger
3051         than minimum hole size.
3052         (Output_section::do_write): Fill holes in debug sections.
3053         * output.h (Output_fill): New class.
3054         (Output_fill_debug_info): New class.
3055         (Output_fill_debug_line): New class.
3056         (Output_section::set_free_space_fill): New function.
3057         (Output_section::free_space_fill_): New data member.
3058         * testsuite/Makefile.am (incremental_test_3): Add
3059         --incremental-patch option.
3060         (incremental_test_4): Likewise.
3061         (incremental_test_5): Likewise.
3062         (incremental_test_6): Likewise.
3063         (incremental_copy_test): Likewise.
3064         (incremental_common_test_1): Likewise.
3065         * testsuite/Makefile.in: Regenerate.
3066
3067 2011-08-26  Nick Clifton  <nickc@redhat.com>
3068
3069         * po/es.po: Updated Spanish translation.
3070
3071 2011-08-01  Cary Coutant  <ccoutant@google.com>
3072
3073         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3074         * gold/testsuite/Makefile.in: Regenerate.
3075         * gold/testsuite/justsyms_exec.c: New source file.
3076         * gold/testsuite/justsyms_lib.c: New source file.
3077
3078 2011-08-01  Cary Coutant  <ccoutant@google.com>
3079
3080         * layout.cc (Layout::set_segment_offsets): Don't realign text
3081         segment if -Ttext was specified.
3082         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3083         file type.
3084         * object.h (Sized_relobj_file::e_type): New function.
3085         (Sized_relobj_file::e_type_): New data member.
3086         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3087         base address for ET_EXEC files.
3088         * target.cc (Target::do_make_elf_object_implementation): Allow
3089         ET_EXEC files with --just-symbols option.
3090
3091 2011-07-28  Cary Coutant  <ccoutant@google.com>
3092
3093         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3094         Add thread_number parameter.
3095         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3096         * workqueue-threads.cc
3097         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3098         current thread if its thread number is greater than desired thread
3099         count.
3100         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3101         Add thread_number parameter.
3102         (Workqueue::should_cancel_thread): Likewise.
3103         (Workqueue::find_runnable_or_wait): Pass thread_number to
3104         should_cancel_thread.
3105         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3106         parameter.
3107
3108 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3109
3110         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3111         only after checking if it cannot be forced local.
3112         * symtab.h (is_externally_visible): Check if the symbol is not forced
3113         local.
3114
3115 2011-07-15  Ian Lance Taylor  <iant@google.com>
3116
3117         * options.h (class General_options): Add --print-output-format.
3118         Move -EL next to -EB, for  better --help output.
3119         * target-select.cc: Include <cstdio>, "options.h", and
3120         "parameters.h".
3121         (Target_selector::do_target_bfd_name): New function.
3122         (print_output_format): New function.
3123         * target-select.h (class Target_selector): Update declarations.
3124         (Target_selector::target_bfd_name): New function.
3125         (print_output_format): Declare.
3126         * main.cc: Include "target-select.h".
3127         (main): Handle --print-output-format.
3128         * gold.cc: Include "target-select.h".
3129         (queue_initial_tasks): Handle --print-output-format when there are
3130         no input files.
3131         * parameters.cc (parameters_force_valid_target): Give a better
3132         error message if -EB/-EL does not match target.
3133         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3134         function.
3135
3136 2011-07-15  Ian Lance Taylor  <iant@google.com>
3137
3138         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3139         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3140         (Output_data_plt_i386::do_write): Write address of .dynamic
3141         section to first entry in .got.plt section.
3142         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3143         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3144         Initialize layout_.
3145         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3146         section to first entry in .got.plt section.
3147         * layout.h (Layout::dynamic_section): New function.
3148
3149 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3150
3151         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3152         to claim_file call.
3153         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3154         input_section_position_, and input_section_glob_.
3155         (read_layout_from_file): Call function section_ordering_specified.
3156         * layout.h (is_section_ordering_specified): New function.
3157         (section_ordering_specified): New function.
3158         (section_ordering_specified_): New boolean member.
3159         * main.cc(main): Call load_plugins after layout object is defined.
3160         * output.cc (Output_section::add_input_section): Use
3161         function section_ordering_specified to check if section ordering is
3162         needed.
3163         * output.cc (Output_section::add_relaxed_input_section): Use
3164         function section_ordering_specified to check if section ordering is
3165         needed.
3166         (Output_section::update_section_layout): New function.
3167         (Output_section::sort_attached_input_sections): Check if input section
3168         must be reordered.
3169         * output.h (Output_section::update_section_layout): New function.
3170         * plugin.cc (get_section_count): New function.
3171         (get_section_type): New function.
3172         (get_section_name): New function.
3173         (get_section_contents): New function.
3174         (update_section_order): New function.
3175         (allow_section_ordering): New function.
3176         (Plugin::load): Add the new interfaces to the transfer vector.
3177         (Plugin_manager::load_plugins): New parameter.
3178         (Plugin_manager::all_symbols_read): New parameter.
3179         (Plugin_manager::claim_file): New parameter. Save the elf object for
3180         unclaimed objects.
3181         (Plugin_manager::get_elf_object): New function.
3182         (Plugin_manager::get_view): Change to directly use the bool to check
3183         if get_view is called from claim_file_hook.
3184         * plugin.h (input_objects): New function
3185         (Plugin__manager::load_plugins): New parameter.
3186         (Plugin_manager::claim_file): New parameter.
3187         (Plugin_manager::get_elf_object): New function.
3188         (Plugin_manager::in_claim_file_handler): New function.
3189         (Plugin_manager::in_claim_file_handler_): New member.
3190         (layout): New function.
3191         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3192         handler with an extra parameter. Make the elf object before calling
3193         claim_file handler.
3194         * testsuite/plugin_test.c (get_section_count): New function pointer.
3195         (get_section_type): New function pointer.
3196         (get_section_name): New function pointer.
3197         (get_section_contents): New function pointer.
3198         (update_section_order): New function pointer.
3199         (allow_section_ordering): New function pointer.
3200         (onload): Check if the new interfaces exist.
3201
3202 2011-07-13  Ian Lance Taylor  <iant@google.com>
3203
3204         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3205         relro section.
3206         * x86_64.cc (Target_x86_64::got_section): Likewise.
3207         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3208         (relro_now_test_SOURCES): New variable.
3209         (relro_now_test_DEPENDENCIES): New variable.
3210         (relro_now_test_LDFLAGS): New variable.
3211         (relro_now_test_LDADD): New variable.
3212         (relro_now_test.so): New target.
3213         * testsuite/Makefile.in: Rebuild.
3214
3215 2011-07-12  Ian Lance Taylor  <iant@google.com>
3216
3217         PR gold/12980
3218         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3219         GLOB_DAT relocation rather than a RELATIVE relocation for a
3220         protected symbol when creating a shared library.
3221         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3222         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3223         * testsuite/protected_main_1.cc (main): Test that protected
3224         function has same address.
3225
3226 2011-07-11  Ian Lance Taylor  <iant@google.com>
3227
3228         PR gold/12979
3229         * options.h (class General_options): Add -Bgroup.
3230         * options.cc (General_options::finalize): If -Bgroup is set,
3231         default to --unresolved-symbols=report-all.
3232         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3233         * target-reloc.h (issue_undefined_symbol_error): Handle
3234         --unresolved-symbols=report-all.
3235
3236 2011-07-08  Ian Lance Taylor  <iant@google.com>
3237
3238         PR gold/11985
3239         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3240         if linker script discards key sections.
3241         (Layout::create_dynamic_symtab): Likewise.
3242         (Layout::assign_local_dynsym_offsets): Likewise.
3243         (Layout::sized_create_version_sections): Likewise.
3244         (Layout::create_interp): Likewise.
3245         (Layout::finish_dynamic_section): Likewise.
3246         (Layout::set_dynamic_symbol_size): Likewise.
3247
3248 2011-07-08  Ian Lance Taylor  <iant@google.com>
3249
3250         PR gold/12386
3251         * options.h (class General_options): Add --unresolved-symbols.
3252         * target-reloc.h (issue_undefined_symbol_error): Check
3253         --unresolved-symbols.  Add comments.
3254
3255 2011-07-08  Ian Lance Taylor  <iant@google.com>
3256
3257         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3258         expression more complex.
3259
3260 2011-07-08  Ian Lance Taylor  <iant@google.com>
3261
3262         PR gold/11317
3263         * target-reloc.h (issue_undefined_symbol_error): New inline
3264         function, broken out of relocate_section.
3265         (relocate_section): Call issue_undefined_symbol_error.
3266         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3267         there is no TLS segment if we are about to issue an undefined
3268         symbol error.
3269         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3270
3271 2011-07-08  Ian Lance Taylor  <iant@google.com>
3272
3273         PR gold/12279
3274         * resolve.cc (Symbol_table::should_override): Add fromtype
3275         parameter.  Change all callers.  Give error when linking together
3276         TLS and non-TLS symbol.
3277         (Symbol_table::should_override_with_special): Add fromtype
3278         parameter.  Change all callers.
3279         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3280         there is no TLS segment if we have reported some errors.
3281         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3282
3283 2011-07-08  Ian Lance Taylor  <iant@google.com>
3284
3285         PR gold/12372
3286         * target.h (Target::plt_address_for_global): New function.
3287         (Target::plt_address_for_local): New function.
3288         (Target::plt_section_for_global): Remove.
3289         (Target::plt_section_for_local): Remove.
3290         (Target::do_plt_address_for_global): New virtual function.
3291         (Target::do_plt_address_for_local): New virtual function.
3292         (Target::do_plt_section_for_global): Remove.
3293         (Target::do_plt_section_for_local): Remove.
3294         (Target::register_global_plt_entry): Add Symbol_table and Layout
3295         parameters.
3296         * output.cc (Output_data_got::Got_entry::write): Use
3297         plt_address_for_global and plt_address_for_local.
3298         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3299         address of output section.
3300         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3301         got_irelative_, and irelative_count_ fields.  Update
3302         declarations.
3303         (Output_data_plt_i386::has_irelative_section): New function.
3304         (Output_data_plt_i386::entry_count): Add irelative_count_.
3305         (Output_data_plt_i386::set_final_data_size): Likewise.
3306         (class Target_i386): Add got_irelative_ and rel_irelative_
3307         fields.  Update declarations.
3308         (Target_i386::Target_i386): Initialize new fields.
3309         (Target_i386::do_plt_address_for_global): New function replacing
3310         do_plt_section_for_global.
3311         (Target_i386::do_plt_address_for_local): New function replacing
3312         do_plt_section_for_local.
3313         (Target_i386::got_section): Create got_irelative_.
3314         (Target_i386::rel_irelative_section): New function.
3315         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3316         fields.  Don't define __rel_iplt_{start,end}.
3317         (Output_data_plt_i386::add_entry): Add symtab and layout
3318         parameters.  Change all callers.  Use different PLT and GOT for
3319         IFUNC symbols.
3320         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3321         layout parameters.  Change all callers.  Use different PLT and
3322         GOT.
3323         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3324         (Output_data_plt_i386::rel_irelative): New function.
3325         (Output_data_plt_i386::address_for_global): New function.
3326         (Output_data_plt_i386::address_for_local): New function.
3327         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3328         IRELATIVE GOT when changing IFUNC GOT entries.
3329         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3330         reloc.
3331         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3332         if we didn't create an IRELATIVE GOT.
3333         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3334         plt_address_for_local.
3335         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3336         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3337         got_irelative_, and irelative_count_ fields.  Update
3338         declarations.
3339         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3340         Initialize new fields.  Remove symtab parameter.  Change all
3341         callers.
3342         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3343         irelative_count_.
3344         (Output_data_plt_x86_64::has_irelative_section): New function.
3345         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3346         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3347         fields.  Update declarations.
3348         (Target_x86_64::Target_x86_64): Initialize new fields.
3349         (Target_x86_64::do_plt_address_for_global): New function replacing
3350         do_plt_section_for_global.
3351         (Target_x86_64::do_plt_address_for_local): New function replacing
3352         do_plt_section_for_local.
3353         (Target_x86_64::got_section): Create got_irelative_.
3354         (Target_x86_64::rela_irelative_section): New function.
3355         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3356         all callers.  Don't create __rel_iplt_{start,end}.
3357         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3358         parameters.  Change all callers.  Use different PLT and GOT for
3359         IFUNC symbols.
3360         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3361         layout parameters.  Change all callers.  Use different PLT and
3362         GOT.
3363         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3364         parameters.  Change all callers.  Use different PLT and GOT for
3365         IFUNC symbols.
3366         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3367         (Output_data_plt_x86_64::rela_irelative): New function.
3368         (Output_data_plt_x86_64::address_for_global): New function.
3369         (Output_data_plt_x86_64::address_for_local): New function.
3370         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3371         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3372         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3373         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3374         parameters.
3375         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3376         reloc.
3377         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3378         symbols if we didn't create an IRELATIVE GOT.
3379         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3380         plt_address_for_local.
3381         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3382         * testsuite/ifuncvar1.c: New test file.
3383         * testsuite/ifuncvar2.c: New test file.
3384         * testsuite/ifuncvar3.c: New test file.
3385         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3386         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3387         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3388         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3389         * testsuite/Makefile.in: Rebuild.
3390
3391 2011-07-07  Cary Coutant  <ccoutant@google.com>
3392
3393         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3394         (two_file_test_1_ndebug.o): Likewise.
3395         (two_file_test_1b_ndebug.o): Likewise.
3396         (two_file_test_2_ndebug.o): Likewise.
3397         (two_file_test_main_ndebug.o): Likewise.
3398         (incremental_test_2): Link with no-debug versions.
3399
3400 2011-07-06  Cary Coutant  <ccoutant@google.com>
3401
3402         * gold/incremental.cc
3403         (Output_section_incremental_inputs::write_info_blocks): Check for
3404         hidden and internal symbols.
3405
3406 2011-07-06  Cary Coutant  <ccoutant@google.com>
3407
3408         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3409         Check disposition for startup file.
3410         (Incremental_inputs::report_command_line): Ignore
3411         --incremental-startup-unchanged option.
3412         * options.cc (General_options::parse_incremental_startup_unchanged):
3413         New function.
3414         (General_options::General_options): Initialize new data member.
3415         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3416         (General_options): Add --incremental-startup-unchanged option.
3417         (General_options::incremental_startup_disposition): New function.
3418         (General_options::incremental_startup_disposition_): New data member.
3419
3420 2011-07-06  Cary Coutant  <ccoutant@google.com>
3421
3422         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3423         input file index to Script_info ctor.
3424         (Sized_incremental_binary::do_file_has_changed): Find the
3425         command-line argument for files named in scripts.
3426         * incremental.h (Script_info::Script_info): New ctor
3427         with input file index.
3428         (Script_info::input_file_index): New function.
3429         (Script_info::input_file_index_): New data member.
3430         (Incremental_binary::get_library): Add const.
3431         (Incremental_binary::get_script_info): Add const.
3432         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3433         * testsuite/Makefile.am (incremental_test_5): New test case.
3434         (incremental_test_6): New test case.
3435         * testsuite/Makefile.in: Regenerate.
3436
3437 2011-07-06  Cary Coutant  <ccoutant@google.com>
3438
3439         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3440         debug output when command lines differ.
3441
3442 2011-07-06  Cary Coutant  <ccoutant@google.com>
3443
3444         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3445         --incremental-patch option.
3446         * layout.cc (Free_list::allocate): Extend allocation beyond original
3447         end if enabled.
3448         (Layout::make_output_section): Mark sections that should get
3449         patch space.
3450         * options.cc (parse_percent): New function.
3451         * options.h (parse_percent): New function.
3452         (DEFINE_percent): New macro.
3453         (General_options): Add --incremental-patch option.
3454         * output.cc (Output_section::Output_section): Initialize new data
3455         members.
3456         (Output_section::add_input_section): Print section name when out
3457         of patch space.
3458         (Output_section::add_output_section_data): Likewise.
3459         (Output_section::set_final_data_size): Add patch space when
3460         doing --incremental-full.
3461         (Output_section::do_reset_address_and_file_offset): Remove patch
3462         space.
3463         (Output_segment::set_section_list_addresses): Print debug output
3464         only if --incremental-update.
3465         * output.h (Output_section::set_is_patch_space_allowed): New function.
3466         (Output_section::is_patch_space_allowed_): New data member.
3467         (Output_section::patch_space_): New data member.
3468         * parameters.cc (Parameters::incremental_full): New function.
3469         * parameters.h (Parameters::incremental_full): New function
3470         * testsuite/Makefile.am (incremental_test_2): Add test for
3471         --incremental-patch option.
3472         * testsuite/Makefile.in: Regenerate.
3473         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3474         (t18): Remove function body.
3475
3476 2011-07-05  Doug Kwan  <dougkwan@google.com>
3477
3478         PR gold/12771
3479         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3480         Arm_Address type for relocation result.
3481         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3482         overflow check.
3483         (Arm_relocate_functions::abs32): Use unaligned access.
3484         (Arm_relocate_functions::rel32): Ditto.
3485         (Arm_relocate_functions::prel31): Ditto.
3486         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3487         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3488         static data relocations.
3489         * testsuite/Makefile.in: Regnerate.
3490         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3491
3492 2011-07-05  Ian Lance Taylor  <iant@google.com>
3493
3494         PR gold/12392
3495         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3496         symbols if necessary.
3497         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3498
3499 2011-07-05  Ian Lance Taylor  <iant@google.com>
3500
3501         PR gold/12952
3502         * resolve.cc (Symbol::override_base_with_special): Simply override
3503         version with special symbol version, ignoring previous version.
3504
3505 2011-07-05  Ian Lance Taylor  <iant@google.com>
3506
3507         * object.cc (Sized_relobj_file::include_section_group): Add
3508         information to comment about signature location.
3509
3510 2011-07-02  Ian Lance Taylor  <iant@google.com>
3511
3512         PR gold/12957
3513         * options.h (class General_options): Add -f and -F.
3514         * options.cc (General_options::finalize): Fatal error if -f/-F
3515         are used without -shared.
3516         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3517
3518 2011-07-02  Ian Lance Taylor  <iant@google.com>
3519
3520         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3521
3522 2011-07-01  Ian Lance Taylor  <iant@google.com>
3523
3524         PR gold/12525
3525         PR gold/12952
3526         * resolve.cc (Symbol::override_base_with_special): Don't override
3527         the version if the overriding symbol has a different name.
3528         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3529         all callers.  If we give an error about an undefined version,
3530         define the base version if necessary.
3531         * dynobj.h (class Versions): Update declaration.
3532         * testsuite/weak_alias_test_5.cc: New file.
3533         * testsuite/weak_alias_test.script: New file.
3534         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3535         and versioned_alias have the right value, and call t2.
3536         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3537         weak_alias_test_5.so.
3538         (weak_alias_test_LDADD): Likewise.
3539         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3540         * testsuite/Makefile.in: Rebuild.
3541
3542 2011-07-01  Ian Lance Taylor  <iant@google.com>
3543
3544         PR gold/12525
3545         * options.h (class General_options): Support -z notext.
3546         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3547         -Wl,-z,notext.
3548         (two_file_shared_nonpic.so): Likewise.
3549         (two_file_shared_mixed.so): Likewise.
3550         (two_file_shared_mixed_1.so): Likewise.
3551         (weak_undef_lib_nonpic.so): Likewise.
3552         (alt/weak_undef_lib_nonpic.so): Likewise.
3553         (tls_test_shared_nonpic.so): Likewise.
3554         * testsuite/Makefile.in: Rebuild.
3555
3556 2011-07-01  Ian Lance Taylor  <iant@google.com>
3557
3558         PR gold/12525
3559         * configure.ac: Test whether static linking works, setting
3560         the automake conditional HAVE_STATIC.
3561         * testsuite/Makefile.am: Disable tests using -static if
3562         HAVE_STATIC is not true.
3563         * configure, testsuite/Makefile.in: Rebuild.
3564
3565 2011-07-01  Ian Lance Taylor  <iant@google.com>
3566
3567         PR gold/12525
3568         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3569         Assert if we see DW_EH_PE_indirect.
3570         * target.h (Target::ehframe_datarel_base): New function.
3571         (Target::do_ehframe_datarel_base): New target function.
3572         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3573         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3574         function.
3575
3576 2011-07-01  Ian Lance Taylor  <iant@google.com>
3577
3578         PR gold/12571
3579         * options.h (class General_options): Add
3580         --ld-generated-unwind-info.
3581         * ehframe.cc (Fde::write): Add address parameter.  Change all
3582         callers.  If associated with PLT, fill in address and size.
3583         (Cie::set_output_offset): Only add merge mapping if there is an
3584         object.
3585         (Cie::write): Add address parameter.  Change all callers.
3586         (Eh_frame::add_ehframe_for_plt): New function.
3587         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3588         input_offset_ fields into union u_, with new plt field.
3589         (Fde::Fde): Adjust for new union field.
3590         (Fde::Fde) [Output_data version]: New constructor.
3591         (Fde::add_mapping): Only add merge mapping if there is an object.
3592         (class Cie): Update declarations.
3593         (class Eh_frame): Declare add_ehframe_for_plt.
3594         * layout.cc (Layout::layout_eh_frame): Break out code into
3595         make_eh_frame_section, and call it.
3596         (Layout::make_eh_frame_section): New function.
3597         (Layout::add_eh_frame_for_plt): New function.
3598         * layout.h (class Layout): Update declarations.
3599         * merge.cc (Merge_map::add_mapping): Add assertion.
3600         * i386.cc: Include "dwarf.h".
3601         (class Output_data_plt_i386): Make first_plt_entry,
3602         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3603         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3604         and plt_eh_frame_fde.
3605         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3606         boundary.  Call add_eh_frame_for_plt if appropriate.
3607         * x86_64.cc: Include "dwarf.h".
3608         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3609         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3610         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3611         and plt_eh_frame_fde.
3612         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3613         appropriate.
3614
3615 2011-06-29  Ian Lance Taylor  <iant@google.com>
3616
3617         PR gold/12629
3618         * object.cc (Sized_relobj_file::layout_section): Change shdr
3619         parameter to be const.
3620         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3621         out of do_layout.
3622         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3623         appropriate.  Call layout_eh_frame_section.
3624         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3625         sections.
3626         * object.h (class Sized_relobj_file): Update declarations.
3627
3628 2011-06-29  Ian Lance Taylor  <iant@google.com>
3629
3630         PR gold/12652
3631         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3632         modifier.
3633         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3634
3635 2011-06-29  Ian Lance Taylor  <iant@google.com>
3636
3637         PR gold/12675
3638         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3639         SHT_X86_64_UNWIND.
3640         * layout.cc (Layout::layout_eh_frame): Likewise.
3641
3642 2011-06-29  Ian Lance Taylor  <iant@google.com>
3643
3644         PR gold/12695
3645         * layout.cc (Layout::symtab_section_shndx): New function.
3646         * layout.h (class Layout): Declare symtab_section_shndx.
3647         * output.cc (Output_section::write_header): Call it.
3648
3649 2011-06-29  Ian Lance Taylor  <iant@google.com>
3650
3651         PR gold/12818
3652         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3653         symbols which are not used in a relocation.
3654
3655 2011-06-28  Ian Lance Taylor  <iant@google.com>
3656
3657         PR gold/12898
3658         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3659         script create indistinguishable segments.
3660         (Layout::set_segment_offsets): Use stable_sort when sorting
3661         segments.  Pass this to Compare_segments constructor.
3662         * layout.h (class Layout): Make segment_precedes non-static.
3663         (class Compare_segments): Change from struct to class.  Add
3664         layout_ field.  Add constructor.
3665         * script-sections.cc
3666         (Script_sections::attach_sections_using_phdrs_clause): Rename
3667         local orphan to is_orphan.  Don't report failure to put empty
3668         section in segment.  On attachment failure, report name of
3669         section, and attach to first PT_LOAD segment.
3670
3671 2011-06-28  Ian Lance Taylor  <iant@google.com>
3672
3673         PR gold/12934
3674         * target-select.cc (Target_selector::Target_selector): Add
3675         emulation parameter.  Change all callers.
3676         (select_target_by_bfd_name): Rename from select_target_by_name.
3677         Change all callers.
3678         (select_target_by_emulation): New function.
3679         (supported_emulation_names): New function.
3680         * target-select.h (class Target_selector): Add emulation_ field.
3681         Update declarations.
3682         (Target_selector::recognize_by_bfd_name): Rename from
3683         recognize_by_name.  Change all callers.
3684         (Target_selector::supported_bfd_names): Rename from
3685         supported_names.  Change all callers.
3686         (Target_selector::recognize_by_emulation): New function.
3687         (Target_selector::supported_emulations): New function.
3688         (Target_selector::emulation): New function.
3689         (Target_selector::do_recognize_by_bfd_name): Rename from
3690         do_recognize_by_name.  Change all callers.
3691         (Target_selector::do_supported_bfd_names): Rename from
3692         do_supported_names.  Change all callers.
3693         (Target_selector::do_recognize_by_emulation): New function.
3694         (Target_selector::do_supported_emulations): New function.
3695         (select_target_by_bfd_name): Change name in declaration.
3696         (select_target_by_emulation): Declare.
3697         (supported_emulation_names): Declare.
3698         * parameters.cc (parameters_force_valid_target): Try to find
3699         target based on emulation from -m option.
3700         * options.h (class General_options): Change doc string for -m.
3701         * options.cc (help): Print emulations.
3702         (General_options::parse_V): Likewise.
3703         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3704         Add emulation parameter.  Change all callers.
3705
3706 2011-06-28  Ian Lance Taylor  <iant@google.com>
3707
3708         * target.h (class Target): Add osabi_ field.
3709         (Target::osabi): New function.
3710         (Target::set_osabi): New function.
3711         (Target::Target): Initialize osabi_.
3712         (Target::do_adjust_elf_header): Make pure virtual.
3713         (Sized_target::do_adjust_elf_header): Declare.
3714         * target.cc (Sized_target::do_adjust_elf_header): New function.
3715         (class Sized_target): Instantiate all versions.
3716         * freebsd.h (class Target_freebsd): Remove.
3717         (Target_selector_freebsd::do_recognize): Call set_osabi on
3718         Target.
3719         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3720         (Target_selector_freebsd::set_osabi): Remove.
3721         * i386.cc (class Target_i386): Inherit from Sized_target rather
3722         than Target_freebsd.
3723         * x86_64.cc (class Target_x86_64): Likewise.
3724
3725 2011-06-28  Ian Lance Taylor  <iant@google.com>
3726
3727         * target.h (Target::can_check_for_function_pointers): Rewrite.
3728         Make non-virtual.
3729         (Target::can_icf_inline_merge_sections): Likewise.
3730         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3731         (Target::Target_info): Add can_icf_inline_merge_sections field.
3732         (Target::do_can_check_for_function_pointers): New virtual
3733         function.
3734         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3735         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3736         from can_check_for_function_pointers, move in file.
3737         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3738         section_may_have_icf_unsafe_poineters, move in file.
3739         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3740         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3741         Rename from can_check_for_function_pointers, move in file.
3742         (Target_i386::can_icf_inline_merge_sections): Remove.
3743         (Target_i386::i386_info): Initialize
3744         can_icf_inline_merge_sections.
3745         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3746         Initialize can_icf_inline_merge_sections.
3747         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3748         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3749         Rename from can_check_for_function_pointers, move in file.
3750         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3751         (Target_x86_64::x86_64_info): Initialize
3752         can_icf_inline_merge_sections.
3753         * testsuite/testfile.cc (Target_test::test_target_info):
3754         Likewise.
3755         * icf.cc (get_section_contents): Correct formatting.
3756
3757 2011-06-27  Ian Lance Taylor  <iant@google.com>
3758
3759         * symtab.cc (Symbol::versioned_name): New function.
3760         (Symbol_table::add_to_final_symtab): Use versioned_name when
3761         appropriate.
3762         (Symbol_table::sized_write_symbol): Likewise.
3763         * symtab.h (class Symbol): Declare versioned_name.
3764         * stringpool.h (class Stringpool_template): Add variant of add
3765         which takes a std::basic_string.
3766         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3767         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3768         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3769         (ver_test_12.o): New target.
3770         * testsuite/Makefile.in: Rebuild.
3771
3772 2011-06-27  Doug Kwan  <dougkwan@google.com>
3773
3774         * arm.cc (Arm_relocate_functions::thm_jump8,
3775         Arm_relocate_functions::thm_jump11): Use a wider signed
3776         type to compute offset.
3777         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3778         arm_thm_jump8.
3779         * testsuite/Makefile.in: Regenerate.
3780         * testsuite/arm_branch_in_range.sh: Check test results of
3781         arm_thm_jump11 and arm_thm_jump8.
3782         * testsuite/arm_thm_jump11.s: New test source file.
3783         * testsuite/arm_thm_jump11.t: New linker script.
3784         * testsuite/arm_thm_jump8.s: New test source file.
3785         * testsuite/arm_thm_jump8.t: New linker script.
3786
3787 2011-06-24  Ian Lance Taylor  <iant@google.com>
3788
3789         * layout.cc: Include "object.h".
3790         (ctors_sections_in_init_array): New static variable.
3791         (Layout::is_ctors_in_init_array): New function.
3792         (Layout::layout): Add entry to ctors_sections_in_init_array if
3793         appropriate.
3794         * layout.h (class Layout): Declare is_ctors_in_init_array.
3795         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3796         is_ctors_reverse_view is set.
3797         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3798         all callers.  Set is_ctors_reverse_view field of View_size.
3799         (Sized_relobj_file::reverse_words): New function.
3800         * object.h (Sized_relobj_file::View_size): Add
3801         is_ctors_reverse_view field.
3802         (class Sized_relobj_file): Update declarations.
3803         * testsuite/initpri3.c: New test.
3804         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3805         initpri3b.
3806         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3807         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3808         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3809         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3810         * testsuite/Makefile.in: Rebuild.
3811
3812 2011-06-24  Cary Coutant  <ccoutant@google.com>
3813
3814         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3815         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3816         (debug_msg_cdebug.err): New targets.
3817         * testsuite/Makefile.in: Regenerate.
3818         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3819         Fix checks for link with shared library.
3820
3821 2011-06-24  Doug Kwan  <dougkwan@google.com>
3822
3823         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3824         skip empty text sections.
3825         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3826
3827 2011-06-22  Ian Lance Taylor  <iant@google.com>
3828
3829         PR gold/12910
3830         * options.h (class General_options): Add --ctors-in-init-array.
3831         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3832         friends as SHT_PROGBITS for merging sections.
3833         (Layout::layout): Remove special handling of .init_array and
3834         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3835         and .dtors if ctors_in_init_array.
3836         (Layout::make_output_section): Force correct section types for
3837         .init_array and friends.  Don't sort if doing relocatable link,
3838         Don't sort .ctors and .dtors if ctors_in_init_array.
3839         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3840         (Layout::output_section_name): Add relobj parameter.  Change all
3841         callers.  Handle .ctors. and .dtors. in code rather than table.
3842         Handle .ctors and .dtors if ctors_in_init_array.
3843         (Layout::match_file_name): New function, moved from output.cc.
3844         * layout.h (class Layout): Update declarations.
3845         * output.cc: Include "layout.h".
3846         (Input_section_sort_entry::get_priority): New function.
3847         (Input_section_sort_entry::match_file_name): Just call
3848         Layout::match_file_name.
3849         (Output_section::Input_section_sort_init_fini_compare::operator()):
3850         Handle .ctors and .dtors.  Sort by explicit priority rather than
3851         by name.
3852         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3853         * testsuite/initpri2.c: New test.
3854         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3855         (check_PROGRAMS): Add initpri2.
3856         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3857         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3858         * configure, testsuite/Makefile.in: Rebuild.
3859
3860 2011-06-19  Ian Lance Taylor  <iant@google.com>
3861
3862         PR gold/12880
3863         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3864         .interp section to a PT_INTERP segment even if we have seen a
3865         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3866         clause in a linker script.
3867         (Layout::finalize): Don't create a .interp section if we've
3868         already create a PT_INTERP segment.
3869         (Layout::create_interp): Always call choose_output_section (revert
3870         patch of 2011-06-17).  Don't create PT_INTERP segment.
3871         * script-sections.cc
3872         (Script_sections::create_note_and_tls_segments): Add a .interp
3873         section to a PT_INTERP segment even if we have seen a
3874         --dynamic-linker option.
3875
3876 2011-06-18  Ian Lance Taylor  <iant@google.com>
3877
3878         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3879         merely because a non-PT_LOAD segment has a dynamic reloc.
3880
3881 2011-06-18  Ian Lance Taylor  <iant@google.com>
3882
3883         * layout.cc (Layout::finish_dynamic_section): Don't create
3884         DT_FLAGS entry if not needed.
3885
3886 2011-06-18  Ian Lance Taylor  <iant@google.com>
3887
3888         PR gold/12745
3889         * layout.cc (Layout::layout_eh_frame): Correct handling of
3890         writable .eh_frame section.
3891
3892 2011-06-17  Ian Lance Taylor  <iant@google.com>
3893
3894         PR gold/12893
3895         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3896         symbol is redefined with the exact same object and value.
3897
3898 2011-06-17  Ian Lance Taylor  <iant@google.com>
3899
3900         PR gold/12880
3901         * layout.h (class Layout): Add interp_segment_ field.
3902         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3903         (Layout::attach_allocated_section_to_segment): If making shared
3904         library, put .interp section in PT_INTERP segment.
3905         (Layout::finalize): Also call create_interp if -dynamic-linker
3906         option was used.
3907         (Layout::create_interp): Assert that there is no PT_INTERP
3908         segment.  If not using a SECTIONS clause, use make_output_section.
3909         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3910         * script-sections.cc
3911         (Script_sections::create_note_and_tls_segments): If making shared
3912         library, put .interp section in PT_INTERP segment.
3913
3914 2011-06-17  Ian Lance Taylor  <iant@google.com>
3915
3916         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3917         when making a shared library.
3918
3919 2011-06-17  Ian Lance Taylor  <iant@google.com>
3920
3921         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3922         parameter.  Change all callers.  Don't issue warning about PC32
3923         against locally defined symbol.
3924
3925 2011-06-16  Ian Lance Taylor  <iant@google.com>
3926
3927         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3928         occurs in same object.
3929
3930 2011-06-14  Alan Modra  <amodra@gmail.com>
3931
3932         * po/POTFILES.in: Regenerate.
3933
3934 2011-06-09  Ian Lance Taylor  <iant@google.com>
3935
3936         * script-sections.cc
3937         (Orphan_output_section::set_section_addresses): For a relocatable
3938         link set address to 0.
3939
3940 2011-06-09  Cary Coutant  <ccoutant@google.com>
3941
3942         PR gold/12804
3943         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3944         used with --compress-debug-sections.
3945         * gold/object.cc (Sized_relobj_file::do_layout): Report
3946         uncompressed size of compressed input sections.
3947
3948 2011-06-08  Cary Coutant  <ccoutant@google.com>
3949
3950         PR gold/12804
3951         * testsuite/two_file_test_2_v1.cc: Change initialization of
3952         v2 to keep it in .data.
3953
3954 2011-06-07  Cary Coutant  <ccoutant@google.com>
3955
3956         * common.cc (Symbol_table::do_allocate_commons_list): Call
3957         gold_fallback.
3958         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3959         (Errors::fallback): New function.
3960         (gold_fallback): New function.
3961         * errors.h (Errors::fallback): New function.
3962         * gold.cc (gold_exit): Change status parameter to enum; adjust
3963         all callers.
3964         (queue_initial_tasks): Call gold_fallback.
3965         * gold.h: Include cstdlib.
3966         (Exit_status): New enum type.
3967         (gold_exit): Change status parameter to enum.
3968         (gold_fallback): New function.
3969         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3970         (Layout::create_symtab_sections): Likewise.
3971         (Layout::create_shdrs): Likewise.
3972         * main.cc (main): Adjust call to gold_exit.
3973         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3974         (Output_data_got::add_got_entry_pair): Likewise.
3975         (Output_section::add_input_section): Likewise.
3976         (Output_section::add_output_section_data): Likewise.
3977         (Output_segment::set_section_list_addresses): Likewise.
3978         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3979
3980 2011-06-07  Cary Coutant  <ccoutant@google.com>
3981
3982         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3983         for incremental links.
3984         * output.cc (Output_segment::set_section_list_addresses): Remove
3985         FIXME and test for TLS or BSS.
3986
3987 2011-06-07  Cary Coutant  <ccoutant@google.com>
3988
3989         * testsuite/Makefile.am: Add incremental_copy_test,
3990         incremental_common_test_1.
3991         * testsuite/Makefile.in: Regenerate.
3992         * testsuite/common_test_1_v1.c: New source file.
3993         * testsuite/common_test_1_v2.c: New source file.
3994         * testsuite/copy_test_v1.cc: New source file.
3995
3996 2011-06-07  Cary Coutant  <ccoutant@google.com>
3997
3998         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3999         update, allocate common from bss section's free list.
4000         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4001         linker-defined symbols.
4002         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4003         Skip GOT and PLT entries that are no longer referenced.
4004         (Output_section_incremental_inputs::write_info_blocks): Mark
4005         linker-defined symbols.
4006         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4007         * output.cc (Output_section::allocate): New function.
4008         * output.h (Output_section::allocate): New function.
4009         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4010         linker-defined symbols.
4011         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4012         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4013         (Symbol::init_base_output_data): Likewise.
4014         (Symbol::init_base_output_segment): Likewise.
4015         (Symbol::init_base_constant): Likewise.
4016         (Sized_symbol::init_output_data): Likewise.
4017         (Sized_symbol::init_output_segment): Likewise.
4018         (Sized_symbol::init_constant): Likewise.
4019         (Symbol_table::do_define_in_output_data): Likewise.
4020         (Symbol_table::do_define_in_output_segment): Likewise.
4021         (Symbol_table::do_define_as_constant): Likewise.
4022         * symtab.h (Symbol::is_predefined): New function.
4023         (Symbol::init_base_output_data): Add is_predefined parameter.
4024         (Symbol::init_base_output_segment): Likewise.
4025         (Symbol::init_base_constant): Likewise.
4026         (Symbol::is_predefined_): New data member.
4027         (Sized_symbol::init_output_data): Add is_predefined parameter.
4028         (Sized_symbol::init_output_segment): Likewise.
4029         (Sized_symbol::init_constant): Likewise.
4030         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4031
4032 2011-06-07  Cary Coutant  <ccoutant@google.com>
4033
4034         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4035         instead of emit_copy_reloc.
4036         (Copy_relocs::emit_copy_reloc): Refactor.
4037         (Copy_relocs::make_copy_reloc): New function.
4038         (Copy_relocs::add_copy_reloc): Remove.
4039         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4040         section.
4041         (Copy_relocs::make_copy_reloc): New function.
4042         (Copy_relocs::add_copy_reloc): Remove.
4043         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4044         unchanged input files.
4045         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4046         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4047         Reserve BSS space for COPY relocations.
4048         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4049         (Output_section_incremental_inputs::write_info_blocks): Record
4050         whether a symbol is copied from a shared object.
4051         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4052         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4053         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4054         (Incremental_input_entry_reader::get_output_symbol_index): Add
4055         is_copy parameter.
4056         (Incremental_binary::emit_copy_relocs): New function.
4057         (Incremental_binary::do_emit_copy_relocs): New function.
4058         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4059         new data member.
4060         (Sized_incremental_binary::add_copy_reloc): New function.
4061         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4062         (Sized_incremental_binary::Copy_reloc): New struct.
4063         (Sized_incremental_binary::Copy_relocs): New typedef.
4064         (Sized_incremental_binary::copy_relocs_): New data member.
4065         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4066         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4067         * target.h (Sized_target::emit_copy_reloc): New function.
4068         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4069
4070 2011-06-02  Cary Coutant  <ccoutant@google.com>
4071
4072         PR gold/12163
4073         * gold/archive.cc (Archive::Archive): Initialize new data member.
4074         (Archive::include_all_members): Return if archive has already been
4075         included.
4076         * gold/archive.h (Archive::include_all_members_): New data member.
4077
4078 2011-06-02  Nick Clifton  <nickc@redhat.com>
4079
4080         * dynobj.h: Fix spelling mistake in comment.
4081         * output.cc: Likewise.
4082
4083 2011-05-31  Doug Kwan  <dougkwan@google.com>
4084             Asier Llano
4085
4086         PR gold/12826
4087         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4088         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4089         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4090         redundant arm_exidx_test.so.
4091         * testsuite/Makefile.in: Regenerate.
4092         (check_SCRIPTS): Add pr12826.sh
4093         (check_DATA): Add pr12826.stdout
4094         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4095         * testsuite/pr12826.sh: New file.
4096         * testsuite/pr12826_1.s: Ditto.
4097         * testsuite/pr12826_1.s: Ditto.
4098
4099 2011-05-30  Ian Lance Taylor  <iant@google.com>
4100
4101         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4102         sections.
4103
4104 2011-05-29  Ian Lance Taylor  <iant@google.com>
4105
4106         PR gold/12804
4107         * testsuite/Makefile.am: Use different file name for two_file_test
4108         temporary file for each incremental test.
4109         * testsuite/Makefile.in: Rebuild.
4110
4111 2011-05-29  Ian Lance Taylor  <iant@google.com>
4112
4113         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4114         binary input file is empty.
4115
4116 2011-05-27  Ian Lance Taylor  <iant@google.com>
4117
4118         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4119         (ver_test_9.so): Likewise.
4120         * testsuite/Makefile.in: Rebuild.
4121
4122 2011-05-26 Cary Coutant  <ccoutant@google.com>
4123
4124         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4125         * incremental.cc (Incremental_inputs::report_input_section): Fix
4126         comment, indentation.
4127         (Incremental_inputs::report_comdat_group): New function.
4128         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4129         of data for incremental input file entry.
4130         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4131         group count, COMDAT group signatures.
4132         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4133         an unchanged input file.
4134         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4135         Initialize new data member.
4136         (Incremental_object_entry::add_comdat_group): New function.
4137         (Incremental_object_entry::get_comdat_group_count): New function.
4138         (Incremental_object_entry::get_comdat_signature_key): New function.
4139         (Incremental_object_entry::groups_): New data member.
4140         (Incremental_inputs::report_comdat_group): New function.
4141         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4142         data for incremental input file entry.
4143         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4144         (Incremental_input_entry_reader::get_input_section): Adjust size of
4145         data for incremental input file entry.
4146         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4147         (Incremental_input_entry_reader::get_comdat_group_signature): New
4148         function.
4149         * object.cc (Sized_relobj::include_section_group): Report kept
4150         COMDAT groups for incremental links.
4151
4152 2011-05-24  David Meyer  <pdox@google.com>
4153
4154         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4155         with name parameter.  Add found_name parameter.
4156         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4157         * dirsearch.h (class Dirsearch): Update declaration.
4158
4159 2011-05-24  Ian Lance Taylor  <iant@google.com>
4160
4161         * archive.cc (Library_base::should_include_member): Pull in object
4162         from archive if it defines the entry symbol.
4163         * parameters.cc (Parameters::entry): New function.
4164         * parameters.h (class Parameters): Declare entry.
4165         * output.h (class Output_file_header): Remove entry_ field.
4166         * output.cc (Output_file_header::Output_file_header): Remove entry
4167         parameter.  Change all callers.
4168         (Output_file_header::entry): Use parameters->entry.
4169         * gold.cc (queue_middle_tasks): Likewise.
4170         * plugin.cc (Plugin_hook::run): Likewise.
4171
4172 2011-05-24 Cary Coutant  <ccoutant@google.com>
4173
4174         * gold.cc (queue_initial_tasks): Pass incremental base filename
4175         to Output_file::open_base_file; don't print error message.
4176         * incremental-dump.cc (main): Adjust call to
4177         Output_file::open_for_modification.
4178         * incremental-dump.cc (main): Likewise.
4179         * incremental.cc (Incremental_inputs::report_command_line):
4180         Ignore --incremental-base option when comparing command lines.
4181         Ignore parameter when given as separate argument.
4182         * options.h (class General_options): Add --incremental-base.
4183         * output.cc (Output_file::Output_file):
4184         (Output_file::open_base_file): Add base_name and writable parameters;
4185         read base file into new file; print error message here.
4186         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4187         callers.
4188         * output.h (Output_file::open_for_modification): Rename to...
4189         (Output_file::open_base_file): ...this; add base_name and
4190         writable parameters; adjust all callers.
4191         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4192         callers.
4193         * testsuite/Makefile.am (incremental_test_4): Test
4194         --incremental-base.
4195         * testsuite/Makefile.in: Regenerate.
4196
4197 2011-05-24 Cary Coutant  <ccoutant@google.com>
4198
4199         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4200         incremental_test_4.
4201         * testsuite/Makefile.in: Regenerate.
4202         * testsuite/two_file_test_1_v1.cc: New test source file.
4203         * testsuite/two_file_test_1b_v1.cc: New test source file.
4204         * testsuite/two_file_test_2_v1.cc: New test source file.
4205
4206 2011-05-24 Cary Coutant  <ccoutant@google.com>
4207
4208         * dynobj.h (Dynobj::do_dynobj): New function.
4209         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4210         flag and soname for shared objects.
4211         * incremental.cc (Incremental_inputs::report_object): Make
4212         either Incremental_object_entry or Incremental_dynobj_entry; add
4213         soname to string table.
4214         (Incremental_inputs::report_input_section): Add assertion.
4215         (Output_section_incremental_inputs::set_final_data_size): Adjust
4216         type of input file entry for shared libraries; adjust size of
4217         shared library info entry.
4218         (Output_section_incremental_inputs::write_input_files): Write
4219         as_needed flag for shared libraries.
4220         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4221         of input file entry for shared libraries; write soname.
4222         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4223         soname from incremental info.
4224         * incremental.h (enum Incremental_input_flags): Add
4225         INCREMENTAL_INPUT_AS_NEEDED.
4226         (Incremental_input_entry::Incremental_input_entry): Initialize new
4227         data member.
4228         (Incremental_input_entry::set_as_needed): New function.
4229         (Incremental_input_entry::as_needed): New function.
4230         (Incremental_input_entry::do_dynobj_entry): New function.
4231         (Incremental_input_entry::as_needed_): New data member.
4232         (Incremental_object_entry::Incremental_object_entry): Don't check
4233         for shared library.
4234         (Incremental_object_entry::do_type): Likewise.
4235         (class Incremental_dynobj_entry): New class.
4236         (Incremental_input_entry_reader::as_needed): New function.
4237         (Incremental_input_entry_reader::get_soname): New function.
4238         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4239         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4240         size of shared library info entry.
4241         * layout.cc (Layout::finish_dynamic_section): Don't test for
4242         incremental link when adding DT_NEEDED entries.
4243         * object.h (Object::Object): Initialize new data member.
4244         (Object::dynobj): New function.
4245         (Object::set_as_needed): New function.
4246         (Object::as_needed): New function.
4247         (Object::do_dynobj): New function.
4248         (Object::as_needed_): New data member.
4249
4250 2011-05-24 Cary Coutant  <ccoutant@google.com>
4251
4252         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4253         info; adjust display of GOT entries.
4254         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4255         vector of input objects; remove file_status_.
4256         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4257         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4258         got_plt reader; call target hooks to reserve GOT entries.
4259         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4260         of input file info header and GOT info entry.
4261         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4262         relocation info.
4263         (Got_plt_view_info::got_descriptor): Remove.
4264         (Got_plt_view_info::sym_index): New data member.
4265         (Got_plt_view_info::input_index): New data member.
4266         (Local_got_offset_visitor::visit): Write input file index.
4267         (Global_got_offset_visitor::visit): Write 0 for input file index.
4268         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4269         with sym_index and input_index.
4270         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4271         incremental info GOT entry; replace got_descriptor with input_index.
4272         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4273         map from input file index to object.
4274         (Sized_relobj_incr::do_layout): Replace direct data member reference
4275         with accessor function.
4276         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4277         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4278         Adjust size of input file info header.
4279         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4280         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4281         (Incremental_input_entry_reader::get_input_section): Adjust size of
4282         input file info header.
4283         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4284         of incremental info GOT entry.
4285         (Incremental_got_plt_reader::get_got_desc): Remove.
4286         (Incremental_got_plt_reader::get_got_symndx): New function.
4287         (Incremental_got_plt_reader::get_got_input_index): New function.
4288         (Sized_incremental_binary::Sized_incremental_binary): Remove
4289         file_status_; add input_objects_.
4290         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4291         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4292         (Sized_incremental_binary::file_is_unchanged): Remove.
4293         (Sized_incremental_binary::set_input_object): New function.
4294         (Sized_incremental_binary::input_object): New function.
4295         (Sized_incremental_binary::file_status_): Remove.
4296         (Sized_incremental_binary::input_objects_): New data member.
4297         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4298         references.
4299         (Sized_relobj_incr::invalid_address): Move to base class.
4300         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4301         class.
4302         (Sized_relobj_incr::do_output_section_offset): Likewise.
4303         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4304         (Sized_relobj_incr::section_offsets_): Likewise.
4305         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4306         function.
4307         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4308         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4309         with accessor function.
4310         (Sized_relobj_file::do_layout): Likewise.
4311         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4312         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4313         (Sized_relobj_file::compute_final_local_value): Replace refs to
4314         section_offsets_ with accessor function.
4315         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4316         * object.h (Relobj::Relobj): Initialize new data members.
4317         (Relobj::add_dyn_reloc): New function.
4318         (Relobj::first_dyn_reloc): New function.
4319         (Relobj::dyn_reloc_count): New function.
4320         (Relobj::first_dyn_reloc_): New data member.
4321         (Relobj::dyn_reloc_count_): New data member.
4322         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4323         references.
4324         (Sized_relobj::Address): New typedef.
4325         (Sized_relobj::invalid_address): Move here from child class.
4326         (Sized_relobj::Sized_relobj): Initialize new data members.
4327         (Sized_relobj::sized_relobj): New function.
4328         (Sized_relobj::is_output_section_offset_invalid): Move here from
4329         child class.
4330         (Sized_relobj::get_output_section_offset): Likewise.
4331         (Sized_relobj::local_has_got_offset): Likewise.
4332         (Sized_relobj::local_got_offset): Likewise.
4333         (Sized_relobj::set_local_got_offset): Likewise.
4334         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4335         (Sized_relobj::clear_got_offsets): New function.
4336         (Sized_relobj::section_offsets): Move here from child class.
4337         (Sized_relobj::do_output_section_offset): Likewise.
4338         (Sized_relobj::do_set_section_offset): Likewise.
4339         (Sized_relobj::Local_got_offsets): Likewise.
4340         (Sized_relobj::local_got_offsets_): Likewise.
4341         (Sized_relobj::section_offsets_): Likewise.
4342         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4343         references.
4344         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4345         class.
4346         (Sized_relobj_file::sized_relobj): New function
4347         (Sized_relobj_file::local_has_got_offset): Move to base class.
4348         (Sized_relobj_file::local_got_offset): Likewise.
4349         (Sized_relobj_file::set_local_got_offset): Likewise.
4350         (Sized_relobj_file::get_output_section_offset): Likewise.
4351         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4352         (Sized_relobj_file::do_output_section_offset): Likewise.
4353         (Sized_relobj_file::do_set_section_offset): Likewise.
4354         (Sized_relobj_file::Local_got_offsets): Likewise.
4355         (Sized_relobj_file::local_got_offsets_): Likewise.
4356         (Sized_relobj_file::section_offsets_): Likewise.
4357         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4358         (all constructors).
4359         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4360         (Output_reloc::get_symbol_index): Likewise.
4361         (Output_reloc::local_section_offset): Likewise.
4362         (Output_reloc::get_address): Likewise.
4363         (Output_reloc::symbol_value): Likewise.
4364         (Output_data_got::reserve_slot): Move to class definition.
4365         (Output_data_got::reserve_local): New function.
4366         (Output_data_got::reserve_slot_for_global): Remove.
4367         (Output_data_got::reserve_global): New function.
4368         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4369         (all constructors, two instantiations).
4370         (Output_reloc::get_relobj): New function (two instantiations).
4371         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4372         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4373         (Output_data_reloc::add_global): Adjust type of relobj.
4374         (Output_data_reloc::add_global_relative): Likewise.
4375         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4376         (Output_data_reloc::add_local): Likewise.
4377         (Output_data_reloc::add_local_relative): Likewise.
4378         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4379         (Output_data_reloc::add_local_section): Likewise.
4380         (Output_data_reloc::add_output_section): Likewise.
4381         (Output_data_reloc::add_absolute): Likewise.
4382         (Output_data_reloc::add_target_specific): Likewise.
4383         (Output_data_got::reserve_slot): Move definition here.
4384         (Output_data_got::reserve_local): New function.
4385         (Output_data_got::reserve_global): New function.
4386         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4387         section_offsets_ with accessor function.
4388         (Sized_relobj_file::write_sections): Likewise.
4389         (Sized_relobj_file::do_relocate_sections): Likewise.
4390         * target.h (Sized_target::reserve_local_got_entry): New function.
4391         (Sized_target::reserve_global_got_entry): New function.
4392         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4393         (Target_x86_64::reserve_global_got_entry): New function.
4394         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4395
4396 2011-05-23 Cary Coutant  <ccoutant@google.com>
4397
4398         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4399         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4400         bit when checking got_type.
4401         * incremental.cc (Sized_incremental_binary::setup_readers):
4402         Store symbol table and string table locations; initialize bit vector
4403         of file status flags.
4404         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4405         unchanged files.
4406         (Sized_incremental_binary::do_process_got_plt): New function.
4407         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4408         (Output_section_incremental_inputs::set_final_data_size): Record
4409         file index for each input file.
4410         (Output_section_incremental_inputs::write_got_plt): Store file index
4411         instead of input entry offset for each GOT entry.
4412         * incremental.h
4413         (Incremental_input_entry::Incremental_input_entry): Initialize new
4414         data member.
4415         (Incremental_input_entry::set_offset): Store file index.
4416         (Incremental_input_entry::get_file_index): New function.
4417         (Incremental_input_entry::file_index_): New data member.
4418         (Incremental_binary::process_got_plt): New function.
4419         (Incremental_binary::do_process_got_plt): New function.
4420         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4421         data members.
4422         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4423         (Sized_incremental_binary::set_file_is_unchanged): New function.
4424         (Sized_incremental_binary::file_is_unchanged): New function.
4425         (Sized_incremental_binary::do_process_got_plt): New function.
4426         (Sized_incremental_binary::file_status_): New data member.
4427         (Sized_incremental_binary::main_symtab_loc_): New data member.
4428         (Sized_incremental_binary::main_strtab_loc_): New data member.
4429         * output.cc (Output_data_got::Got_entry::write): Add case
4430         RESERVED_CODE.
4431         (Output_data_got::add_global): Call add_got_entry.
4432         (Output_data_got::add_global_plt): Likewise.
4433         (Output_data_got::add_global_with_rel): Likewise.
4434         (Output_data_got::add_global_with_rela): Likewise.
4435         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4436         (Output_data_got::add_global_pair_with_rela): Likewise.
4437         (Output_data_got::add_local): Call add_got_entry.
4438         (Output_data_got::add_local_plt): Likewise.
4439         (Output_data_got::add_local_with_rel): Likewise.
4440         (Output_data_got::add_local_with_rela): Likewise.
4441         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4442         (Output_data_got::add_local_pair_with_rela): Likewise.
4443         (Output_data_got::reserve_slot): New function.
4444         (Output_data_got::reserve_slot_for_global): New function.
4445         (Output_data_got::add_got_entry): New function.
4446         (Output_data_got::add_got_entry_pair): New function.
4447         (Output_section::add_output_section_data): Edit FIXME.
4448         * output.h
4449         (Output_section_data_build::Output_section_data_build): New
4450         constructor with size parameter.
4451         (Output_data_space::Output_data_space): Likewise.
4452         (Output_data_got::Output_data_got): Initialize new data member; new
4453         constructor with size parameter.
4454         (Output_data_got::add_constant): Call add_got_entry.
4455         (Output_data_got::reserve_slot): New function.
4456         (Output_data_got::reserve_slot_for_global): New function.
4457         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4458         (Output_data_got::add_got_entry): New function.
4459         (Output_data_got::add_got_entry_pair): New function.
4460         (Output_data_got::free_list_): New data member.
4461         * target.h (Sized_target::init_got_plt_for_update): New function.
4462         (Sized_target::register_global_plt_entry): New function.
4463         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4464         Initialize new data member; call init; add constructor with PLT count.
4465         (Output_data_plt_x86_64::init): New function.
4466         (Output_data_plt_x86_64::add_relocation): New function.
4467         (Output_data_plt_x86_64::reserve_slot): New function.
4468         (Output_data_plt_x86_64::free_list_): New data member.
4469         (Target_x86_64::init_got_plt_for_update): New function.
4470         (Target_x86_64::register_global_plt_entry): New function.
4471         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4472         incremental updates.
4473         (Output_data_plt_x86_64::add_relocation): New function.
4474         * testsuite/object_unittest.cc (Object_test): Set default options.
4475
4476 2011-05-16  Ian Lance Taylor  <iant@google.com>
4477
4478         * options.h (class General_options): Make -i a synonym for -r.
4479
4480 2011-05-16  Ian Lance Taylor  <iant@google.com>
4481
4482         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4483
4484 2011-05-10 Cary Coutant  <ccoutant@google.com>
4485
4486         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4487         strip_all (-s).
4488
4489 2011-05-06  Ian Lance Taylor  <iant@google.com>
4490
4491         * layout.cc (Layout::layout): If the output section flags change,
4492         update the ordering.
4493
4494 2011-04-25 Cary Coutant  <ccoutant@google.com>
4495
4496         * incremental-dump.cc (dump_incremental_inputs): Print local
4497         symbol info for each input file.
4498         * incremental.cc
4499         (Output_section_incremental_inputs::set_final_data_size): Add local
4500         symbol info to input file entries in incremental info.
4501         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4502         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4503         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4504         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4505         implementation.
4506         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4507         (Sized_incr_relobj::do_relocate): Write the local symbols.
4508         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4509         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4510         Adjust size of input file header.
4511         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4512         (Incremental_inputs_reader::get_local_symbol_count): New function.
4513         (Incremental_inputs_reader::get_input_section): Adjust size of input
4514         file header.
4515         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4516         (Sized_incr_relobj::This): New typedef.
4517         (Sized_incr_relobj::sym_size): New const data member.
4518         (Sized_incr_relobj::Local_symbol): New struct.
4519         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4520         (Sized_incr_relobj::do_local_symbol_offset): New function.
4521         (Sized_incr_relobj::local_symbol_count_): New data member.
4522         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4523         (Sized_incr_relobj::local_symbol_index_): New data member.
4524         (Sized_incr_relobj::local_symbol_offset_): New data member.
4525         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4526         (Sized_incr_relobj::local_symbols_): New data member.
4527         * object.h (Relobj::output_local_symbol_count): New function.
4528         (Relobj::local_symbol_offset): New function.
4529         (Relobj::do_output_local_symbol_count): New function.
4530         (Relobj::do_local_symbol_offset): New function.
4531         (Sized_relobj::do_output_local_symbol_count): New function.
4532         (Sized_relobj::do_local_symbol_offset): New function.
4533
4534 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4535
4536         * descriptors.cc (set_close_on_exec): New function.
4537         (Descriptors::open): Use set_close_on_exec.
4538         * output.cc (S_ISLNK): Define if not defined.
4539
4540 2011-04-22 Cary Coutant  <ccoutant@google.com>
4541
4542         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4543         global symbol map.
4544         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4545         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4546         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4547         relocations.
4548         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4549         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4550         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4551         * incremental.h
4552         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4553         function.
4554         (Incremental_binary::apply_incremental_relocs): New function.
4555         (Incremental_binary::do_apply_incremental_relocs): New function.
4556         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4557         data member.
4558         (Sized_incremental_binary::add_global_symbol): New function.
4559         (Sized_incremental_binary::global_symbol): New function.
4560         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4561         (Sized_incremental_binary::symbol_map_): New data member.
4562         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4563         * target.h (Sized_target::apply_relocation): New function.
4564         * target-reloc.h (apply_relocation): New function.
4565         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4566
4567 2011-04-22  Doug Kwan  <dougkwan@google.com>
4568
4569         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4570         flag of a SHT_ARM_EXIDX section.
4571         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4572         * testsuite/Makefile.in: Regenerate.
4573         * testsuite/arm_exidx_test.s: New file.
4574         * testsuite/arm_exidx_test.sh: Same.
4575
4576 2011-04-20 Cary Coutant  <ccoutant@google.com>
4577
4578         PR gold/12689
4579         * archive.h (Incremental_archive_entry::Archive_member):
4580         Initialize arg_serial_ (second constructor).
4581
4582 2011-04-17  Ian Lance Taylor  <iant@google.com>
4583
4584         * object.cc (Relocate_info::location): Simplify location string.
4585         * errors.cc (Errors::error_at_location): Don't print program
4586         name.
4587         (Errors::warning_at_location): Likewise.
4588         (Errors::undefined_symbol): Likewise.
4589         * testsuite/debug_msg.sh: Update accordingly.
4590
4591 2011-04-14 Cary Coutant  <ccoutant@google.com>
4592
4593         * gold/layout.cc (Layout::symtab_section_offset): New function.
4594         * gold/layout.h (Layout::symtab_section_offset): New function.
4595         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4596
4597 2011-04-12  Ian Lance Taylor  <iant@google.com>
4598
4599         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4600         with MREMAP_MAYMOVE.
4601         * output.h (class Output_file): Add map_is_allocated_ field.
4602         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4603         not available, provide stubs.  If mremap is not available, #define
4604         it to gold_mremap.
4605         (MREMAP_MAYMOVE): Define if not defined.
4606         (Output_file::Output_file): Initialize map_is_allocated_.
4607         (Output_file::resize): Check map_is_allocated_.
4608         (Output_file::map_anonymous): If mmap fails, use malloc.
4609         (Output_file::unmap): Don't do anything for an anonymous map.
4610         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4611         is not available, provide stubs.
4612         (File_read::View::~View): Use free rather than delete[].
4613         (File_read::make_view): Use malloc rather than new[].  If mmap
4614         fails, use malloc.
4615         (File_read::find_or_make_view): Use malloc rather than new[].
4616         * gold.h: Remove HAVE_REMAP code.
4617         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4618         exists.  Rename mremap to gold_mremap.  If mmap is not available
4619         don't do anything.
4620         * configure, config.in: Rebuild.
4621
4622 2011-04-11  Ian Lance Taylor  <iant@google.com>
4623
4624         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4625         initialize local variable v.
4626
4627 2011-04-11  Cary Coutant  <ccoutant@google.com>
4628
4629         * archive.cc (Archive::include_member): Adjust call to
4630         report_object.
4631         (Add_archive_symbols::run): Track argument serial numbers.
4632         (Lib_group::include_member): Likewise.
4633         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4634         * archive.h (Incremental_archive_entry::Archive_member):
4635         Initialize arg_serial_.
4636         (Archive_member::arg_serial_): New data member.
4637         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4638         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4639         incremental link.
4640         (Sized_dynobj::do_for_all_local_got_entries): New function.
4641         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4642         function.
4643         * fileread.cc (get_mtime): New function.
4644         * fileread.h (get_mtime): New function.
4645         * gold.cc (queue_initial_tasks): Check for incremental update.
4646         (process_incremental_input): New function.
4647         (queue_middle_tasks): Don't force valid target for incremental
4648         update.
4649         * incremental-dump.cc (find_input_containing_global): Adjust
4650         size of symbol info entry.
4651         (dump_incremental_inputs): Dump argument serial number and
4652         in_system_directory flag; bias shndx by 1; print symbol names
4653         when dumping per-file symbol lists; use new symbol info readers.
4654         * incremental.cc
4655         (Output_section_incremental_inputs:update_data_size): New function.
4656         (Sized_incremental_binary::setup_readers): Setup input readers
4657         for each input file; build maps for files added from libraries
4658         and scripts.
4659         (Sized_incremental_binary::check_input_args): New function.
4660         (Sized_incremental_binary::do_check_inputs): Build map of argument
4661         serial numbers to input arguments.
4662         (Sized_incremental_binary::do_file_has_changed): Rename
4663         do_file_is_unchanged to this; compare file modification times.
4664         (Sized_incremental_binary::do_init_layout): New function.
4665         (Sized_incremental_binary::do_reserve_layout): New function.
4666         (Sized_incremental_binary::do_get_input_reader): Remove.
4667         (Sized_incremental_binary::get_symtab_view): New function.
4668         (Incremental_checker::can_incrementally_link_output_file): Remove.
4669         (Incremental_inputs::report_command_line): Exclude --debug options.
4670         (Incremental_inputs::report_archive_begin): Add parameter; track
4671         argument serial numbers; don't put input file entry for archive
4672         before archive members.
4673         (Incremental_inputs::report_archive_end): Put input file entry
4674         for archive after archive members.
4675         (Incremental_inputs::report_object): Add parameter; track argument
4676         serial numbers and in_system_directory flag.
4677         (Incremental_inputs::report_script): Add parameter; track argument
4678         serial numbers.
4679         (Output_section_incremental_inputs::set_final_data_size): Adjust
4680         size of symbol info entry; check for forwarding symbols.
4681         (Output_section_incremental_inputs::write_input_files): Write
4682         in_system_directory flag and argument serial number.
4683         (Output_section_incremental_inputs::write_info_blocks): Map section
4684         indices between incremental info and original input file; store
4685         input section index for each symbol.
4686         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4687         change operator() to visit().
4688         (class Global_got_offset_visitor): Likewise.
4689         (class Global_symbol_visitor_got_plt):
4690         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4691         classes.
4692         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4693         (Sized_incr_relobj::do_read_symbols): New function.
4694         (Sized_incr_relobj::do_layout): New function.
4695         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4696         (Sized_incr_relobj::do_add_symbols): New function.
4697         (Sized_incr_relobj::do_should_include_member): New function.
4698         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4699         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4700         (Sized_incr_relobj::do_section_size): New function.
4701         (Sized_incr_relobj::do_section_name): New function.
4702         (Sized_incr_relobj::do_section_contents): New function.
4703         (Sized_incr_relobj::do_section_flags): New function.
4704         (Sized_incr_relobj::do_section_entsize): New function.
4705         (Sized_incr_relobj::do_section_address): New function.
4706         (Sized_incr_relobj::do_section_type): New function.
4707         (Sized_incr_relobj::do_section_link): New function.
4708         (Sized_incr_relobj::do_section_info): New function.
4709         (Sized_incr_relobj::do_section_addralign): New function.
4710         (Sized_incr_relobj::do_initialize_xindex): New function.
4711         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4712         (Sized_incr_relobj::do_read_relocs): New function.
4713         (Sized_incr_relobj::do_gc_process_relocs): New function.
4714         (Sized_incr_relobj::do_scan_relocs): New function.
4715         (Sized_incr_relobj::do_count_local_symbols): New function.
4716         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4717         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4718         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4719         (Sized_incr_relobj::do_relocate): New function.
4720         (Sized_incr_relobj::do_set_section_offset): New function.
4721         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4722         (Sized_incr_dynobj::do_read_symbols): New function.
4723         (Sized_incr_dynobj::do_layout): New function.
4724         (Sized_incr_dynobj::do_add_symbols): New function.
4725         (Sized_incr_dynobj::do_should_include_member): New function.
4726         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4727         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4728         (Sized_incr_dynobj::do_section_size): New function.
4729         (Sized_incr_dynobj::do_section_name): New function.
4730         (Sized_incr_dynobj::do_section_contents): New function.
4731         (Sized_incr_dynobj::do_section_flags): New function.
4732         (Sized_incr_dynobj::do_section_entsize): New function.
4733         (Sized_incr_dynobj::do_section_address): New function.
4734         (Sized_incr_dynobj::do_section_type): New function.
4735         (Sized_incr_dynobj::do_section_link): New function.
4736         (Sized_incr_dynobj::do_section_info): New function.
4737         (Sized_incr_dynobj::do_section_addralign): New function.
4738         (Sized_incr_dynobj::do_initialize_xindex): New function.
4739         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4740         (make_sized_incremental_object): New function.
4741         (Incremental_library::copy_unused_symbols): New function.
4742         (Incremental_library::do_for_all_unused_symbols): New function.
4743         * incremental.h (enum Incremental_input_flags): New type.
4744         (class Incremental_checker): Remove.
4745         (Incremental_input_entry::Incremental_input_entry): Add argument
4746         serial number.
4747         (Incremental_input_entry::arg_serial): New function.
4748         (Incremental_input_entry::set_is_in_system_directory): New function.
4749         (Incremental_input_entry::is_in_system_directory): New function.
4750         (Incremental_input_entry::arg_serial_): New data member.
4751         (Incremental_input_entry::is_in_system_directory_): New data member.
4752         (class Script_info): Move here from script.h.
4753         (Script_info::Script_info): Add filename parameter.
4754         (Script_info::filename): New function.
4755         (Script_info::filename_): New data member.
4756         (Incremental_script_entry::Incremental_script_entry): Add argument
4757         serial number.
4758         (Incremental_object_entry::Incremental_object_entry): Likewise.
4759         (Incremental_object_entry::add_input_section): Build list of input
4760         sections with map to original shndx.
4761         (Incremental_object_entry::get_input_section_index): New function.
4762         (Incremental_object_entry::shndx_): New data member.
4763         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4764         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4765         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4766         serial number.
4767         (Incremental_inputs::report_archive_begin): Likewise.
4768         (Incremental_inputs::report_object): Likewise.
4769         (Incremental_inputs::report_script): Likewise.
4770         (class Incremental_global_symbol_reader): New class.
4771         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4772         and store flags and input file type.
4773         (Incremental_input_entry_reader::arg_serial): New function.
4774         (Incremental_input_entry_reader::type): Extract type from flags.
4775         (Incremental_input_entry_reader::is_in_system_directory): New function.
4776         (Incremental_input_entry_reader::get_input_section_count): Call
4777         accessor function for type.
4778         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4779         function for type; adjust size of global symbol entry.
4780         (Incremental_input_entry_reader::get_global_symbol_count): Call
4781         accessor function for type.
4782         (Incremental_input_entry_reader::get_object_count): Likewise.
4783         (Incremental_input_entry_reader::get_object_offset): Likewise.
4784         (Incremental_input_entry_reader::get_member_count): Likewise.
4785         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4786         (Incremental_input_entry_reader::get_member_offset): Likewise.
4787         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4788         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4789         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4790         (Incremental_input_entry_reader::get_global_symbol_reader): New
4791         function.
4792         (Incremental_input_entry_reader::get_output_symbol_index): New
4793         function.
4794         (Incremental_input_entry_reader::type_): Remove.
4795         (Incremental_input_entry_reader::flags_): New data member.
4796         (Incremental_inputs_reader::input_file_offset): New function.
4797         (Incremental_inputs_reader::input_file_index): New function.
4798         (Incremental_inputs_reader::input_file): Call input_file_offset.
4799         (Incremental_inputs_reader::input_file_at_offset): New function.
4800         (Incremental_relocs_reader::get_r_type): Reformat.
4801         (Incremental_relocs_reader::get_r_shndx): Reformat.
4802         (Incremental_relocs_reader::get_r_offset): Reformat.
4803         (Incremental_relocs_reader::data): New function.
4804         (Incremental_binary::Incremental_binary): Initialize new data members.
4805         (Incremental_binary::check_inputs): Add cmdline parameter.
4806         (Incremental_binary::file_is_unchanged): Remove.
4807         (Input_reader::arg_serial): New function.
4808         (Input_reader::get_unused_symbol_count): New function.
4809         (Input_reader::get_unused_symbol): New function.
4810         (Input_reader::do_arg_serial): New function.
4811         (Input_reader::do_get_unused_symbol_count): New function.
4812         (Input_reader::do_get_unused_symbol): New function.
4813         (Incremental_binary::input_file_count): New function.
4814         (Incremental_binary::get_input_reader): Change signature to use
4815         index instead of filename.
4816         (Incremental_binary::file_has_changed): New function.
4817         (Incremental_binary::get_input_argument): New function.
4818         (Incremental_binary::get_library): New function.
4819         (Incremental_binary::get_script_info): New function.
4820         (Incremental_binary::init_layout): New function.
4821         (Incremental_binary::reserve_layout): New function.
4822         (Incremental_binary::output_file): New function.
4823         (Incremental_binary::do_check_inputs): New function.
4824         (Incremental_binary::do_file_is_unchanged): Remove.
4825         (Incremental_binary::do_file_has_changed): New function.
4826         (Incremental_binary::do_init_layout): New function.
4827         (Incremental_binary::do_reserve_layout): New function.
4828         (Incremental_binary::do_input_file_count): New function.
4829         (Incremental_binary::do_get_input_reader): Change signature.
4830         (Incremental_binary::input_args_map_): New data member.
4831         (Incremental_binary::library_map_): New data member.
4832         (Incremental_binary::script_map_): New data member.
4833         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4834         new data members.
4835         (Sized_incremental_binary::output_section): New function.
4836         (Sized_incremental_binary::inputs_reader): Add const.
4837         (Sized_incremental_binary::symtab_reader): Add const.
4838         (Sized_incremental_binary::relocs_reader): Add const.
4839         (Sized_incremental_binary::got_plt_reader): Add const.
4840         (Sized_incremental_binary::get_symtab_view): New function.
4841         (Sized_incremental_binary::Inputs_reader): New typedef.
4842         (Sized_incremental_binary::Input_entry_reader): New typedef.
4843         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4844         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4845         (Sized_incremental_binary::do_file_has_changed): New function.
4846         (Sized_incremental_binary::do_init_layout): New function.
4847         (Sized_incremental_binary::do_reserve_layout): New function.
4848         (Sized_input_reader::Inputs_reader): Remove.
4849         (Sized_input_reader::Input_entry_reader): Remove.
4850         (Sized_input_reader::do_arg_serial): New function.
4851         (Sized_input_reader::do_get_unused_symbol_count): New function.
4852         (Sized_input_reader::do_get_unused_symbol): New function.
4853         (Sized_incremental_binary::do_input_file_count): New function.
4854         (Sized_incremental_binary::do_get_input_reader): Change signature;
4855         use index instead of filename.
4856         (Sized_incremental_binary::section_map_): New data member.
4857         (Sized_incremental_binary::input_entry_readers_): New data member.
4858         (class Sized_incr_relobj): New class.
4859         (class Sized_incr_dynobj): New class.
4860         (make_sized_incremental_object): New function.
4861         (class Incremental_library): New class.
4862         * layout.cc (Free_list::num_lists): New static data member.
4863         (Free_list::num_nodes): New static data member.
4864         (Free_list::num_removes): New static data member.
4865         (Free_list::num_remove_visits): New static data member.
4866         (Free_list::num_allocates): New static data member.
4867         (Free_list::num_allocate_visits): New static data member.
4868         (Free_list::init): New function.
4869         (Free_list::remove): New function.
4870         (Free_list::allocate): New function.
4871         (Free_list::dump): New function.
4872         (Free_list::print_stats): New function.
4873         (Layout_task_runner::run): Resize output file for incremental updates.
4874         (Layout::Layout): Initialize new data members.
4875         (Layout::set_incremental_base): New function.
4876         (Layout::init_fixed_output_section): New function.
4877         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4878         incremental updates.
4879         (Layout::create_gold_note): Do not create gold note section for
4880         incremental updates.
4881         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4882         for incremental updates.
4883         (Layout::set_section_offsets): For incremental updates, allocate space
4884         from free list.
4885         (Layout::create_symtab_sections): Layout with offsets relative to
4886         start of section; for incremental updates, allocate space from free
4887         list.
4888         (Layout::create_shdrs): For incremental updates, allocate space from
4889         free list.
4890         (Layout::finish_dynamic_section): For incremental updates, do not
4891         check --as-needed (fixed in subsequent patch).
4892         * layout.h (class Free_list): New class.
4893         (Layout::set_incremental_base): New function.
4894         (Layout::incremental_base): New function.
4895         (Layout::init_fixed_output_section): New function.
4896         (Layout::allocate): New function.
4897         (Layout::incremental_base_): New data member.
4898         (Layout::free_list_): New data member.
4899         * main.cc (main): Print Free_list statistics.
4900         * object.cc (Relobj::finalize_incremental_relocs): Add
4901         clear_counts parameter; clear counts only when clear_counts is set.
4902         (Sized_relobj::Sized_relobj): Initialize new base class.
4903         (Sized_relobj::do_layout): Don't report special sections.
4904         (Sized_relobj::do_for_all_local_got_entries): New function.
4905         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4906         symtab_off to all symbol table offsets.
4907         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4908         * object.h (class Got_offset_list): Move to top of file.
4909         (Object::Object): Allow case where input_file == NULL.
4910         (Object::~Object): Likewise.
4911         (Object::input_file): Assert that input_file != NULL.
4912         (Object::lock): Allow case where input_file == NULL.
4913         (Object::unlock): Likewise.
4914         (Object::is_locked): Likewise.
4915         (Object::token): Likewise.
4916         (Object::release): Likewise.
4917         (Object::is_incremental): New function.
4918         (Object::get_mtime): New function.
4919         (Object::for_all_local_got_entries): New function.
4920         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4921         (Object::set_is_in_system_directory): New function.
4922         (Object::is_in_system_directory): New function.
4923         (Object::do_is_incremental): New function.
4924         (Object::do_get_mtime): New function.
4925         (Object::do_for_all_local_got_entries): New function.
4926         (Object::is_in_system_directory_): New data member.
4927         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4928         (class Sized_relobj_base): New class.
4929         (class Sized_relobj): Derive from Sized_relobj_base.
4930         (class Sized_relobj::Symbols): Redeclare from base class.
4931         (class Sized_relobj::local_got_offset_list): Remove.
4932         (class Sized_relobj::Output_sections): Redeclare from base class.
4933         (class Sized_relobj::do_for_all_local_got_entries): New function.
4934         (class Sized_relobj::write_local_symbols): Add offset parameter.
4935         (class Sized_relobj::local_symbol_offset_): Update comment.
4936         (class Sized_relobj::local_dynsym_offset_): Update comment.
4937         * options.cc (Input_arguments::add_file): Remove const.
4938         * options.h (Input_file_argument::Input_file_argument):
4939         Initialize arg_serial_ (all constructors).
4940         (Input_file_argument::set_arg_serial): New function.
4941         (Input_file_argument::arg_serial): New function.
4942         (Input_file_argument::arg_serial_): New data member.
4943         (Input_arguments::Input_arguments): Initialize file_count_.
4944         (Input_arguments::add_file): Remove const.
4945         (Input_arguments::number_of_input_files): New function.
4946         (Input_arguments::file_count_): New data member.
4947         (Command_line::number_of_input_files): Call
4948         Input_arguments::number_of_input_files.
4949         * output.cc (Output_segment_headers::Output_segment_headers):
4950         Set current size.
4951         (Output_section::Input_section::current_data_size): New function.
4952         (Output_section::Output_section): Initialize new data members.
4953         (Output_section::add_input_section): Don't do merge sections for
4954         an incremental link; allocate space from free list for an
4955         incremental update.
4956         (Output_section::add_output_section_data): Allocate space from
4957         free list for an incremental update.
4958         (Output_section::update_data_size): New function.
4959         (Output_section::set_fixed_layout): New function.
4960         (Output_section::reserve): New function.
4961         (Output_segment::set_section_addresses): Remove const.
4962         (Output_segment::set_section_list_addresses): Remove const; allocate
4963         space from free list for an incremental update.
4964         (Output_segment::set_offset): Adjust size of RELRO segment for an
4965         incremental update.
4966         * output.h (Output_data::current_data_size): Move here from
4967         child classes.
4968         (Output_data::pre_finalize_data_size): New function.
4969         (Output_data::update_data_size): New function.
4970         (Output_section_headers::update_data_size): new function.
4971         (Output_section_data_build::current_data_size): Move to Output_data.
4972         (Output_data_strtab::update_data_size): New function.
4973         (Output_section::current_data_size): Move to Output_data.
4974         (Output_section::set_fixed_layout): New function.
4975         (Output_section::has_fixed_layout): New function.
4976         (Output_section::reserve): New function.
4977         (Output_section::update_data_size): New function.
4978         (Output_section::has_fixed_layout_): New data member.
4979         (Output_section::free_list_): New data member.
4980         (Output_segment::set_section_addresses): Remove const.
4981         (Output_segment::set_section_list_addresses): Remove const.
4982         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4983         New function.
4984         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4985         New function.
4986         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4987         parameter when calling Add_symbols constructor; store argument
4988         serial number for members of a lib group.
4989         (Add_symbols::locks): Allow case where token == NULL.
4990         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4991         (Read_member::~Read_member): New function.
4992         (Read_member::is_runnable): New function.
4993         (Read_member::locks): New function.
4994         (Read_member::run): New function.
4995         (Check_script::~Check_script): New function.
4996         (Check_script::is_runnable): New function.
4997         (Check_script::locks): New function.
4998         (Check_script::run): New function.
4999         (Check_library::~Check_library): New function.
5000         (Check_library::is_runnable): New function.
5001         (Check_library::locks): New function.
5002         (Check_library::run): New function.
5003         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5004         (Add_symbols::library_): New data member.
5005         (class Read_member): New class.
5006         (class Check_script): New class.
5007         (class Check_library): New class.
5008         * reloc.cc (Read_relocs::is_runnable): Allow case where
5009         token == NULL.
5010         (Read_relocs::locks): Likewise.
5011         (Scan_relocs::locks): Likewise.
5012         (Relocate_task::locks): Likewise.
5013         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5014         to clear counters.
5015         (Sized_relobj::incremental_relocs_scan): Fix comment.
5016         (Sized_relobj::do_relocate): Pass output file offset to
5017         write_local_symbols.
5018         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5019         from class declaration.
5020         * script.cc (read_input_script): Allocate Script_info; pass
5021         argument serial number to report_script.
5022         * script.h (class Script_info): Move to incremental.h.
5023         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5024         * symtab.h (Symbol_table::add_from_incrobj): New function.
5025         (Symbol_table::set_file_offset): New function.
5026
5027 2011-04-05  Cary Coutant  <ccoutant@google.com>
5028
5029         * incremental-dump.cc (dump_incremental_inputs): Change signature
5030         to take a Sized_incremental_binary; change caller.  Use readers
5031         in Sized_incremental_binary.
5032         * incremental.cc
5033         (Sized_incremental_binary::find_incremental_inputs_sections):
5034         Rename do_find_incremental_inputs_sections to this.
5035         (Sized_incremental_binary::setup_readers): New function.
5036         (Sized_incremental_binary::do_check_inputs): Check
5037         has_incremental_info_ flag; move setup code to setup_readers;
5038         use input readers.
5039         (Sized_incremental_binary::do_file_is_unchanged): New function.
5040         (Sized_incremental_binary::do_get_input_reader): New function.
5041         * incremental.h (class Incremental_binary): Move to end of file.
5042         (Incremental_binary::file_is_unchanged): New function.
5043         (Incremental_binary::do_file_is_unchanged): New function.
5044         (Incremental_binary::Input_reader): New class.
5045         (Incremental_binary::get_input_reader): New function.
5046         (class Sized_incremental_binary): Move to end of file.
5047         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5048         input section reader classes.
5049         (Sized_incremental_binary::has_incremental_info): New function.
5050         (Sized_incremental_binary::inputs_reader): New function.
5051         (Sized_incremental_binary::symtab_reader): New function.
5052         (Sized_incremental_binary::relocs_reader): New function.
5053         (Sized_incremental_binary::got_plt_reader): New function.
5054         (Sized_incremental_binary::do_file_is_unchanged): New function.
5055         (Sized_incremental_binary::Sized_input_reader): New class.
5056         (Sized_incremental_binary::get_input_reader): New function.
5057         (Sized_incremental_binary::find_incremental_inputs_sections):
5058         Rename do_find_incremental_inputs_sections to this.
5059         (Sized_incremental_binary::setup_readers): New function.
5060         (Sized_incremental_binary::has_incremental_info_): New data member.
5061         (Sized_incremental_binary::inputs_reader_): New data member.
5062         (Sized_incremental_binary::symtab_reader_): New data member.
5063         (Sized_incremental_binary::relocs_reader_): New data member.
5064         (Sized_incremental_binary::got_plt_reader_): New data member.
5065         (Sized_incremental_binary::current_input_file_): New data member.
5066
5067 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5068
5069         PR gold/12640
5070         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5071         violation.
5072
5073 2011-03-30  Cary Coutant  <ccoutant@google.com>
5074
5075         * archive.cc (Archive::include_member): Adjust call to report_object.
5076         (Add_archive_symbols::run): Add script_info to call to
5077         report_archive_begin.
5078         (Lib_group::include_member): Adjust call to report_object.
5079         (Add_lib_group_symbols::run): Adjust call to report_object.
5080         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5081         blocks.  Add object count for script input files.
5082         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5083         script_info parameter; change all callers.
5084         (Incremental_inputs::report_object): Add script_info parameter;
5085         change all callers.
5086         (Incremental_inputs::report_script): Store backpointer to
5087         incremental info entry.
5088         (Output_section_incremental_inputs::set_final_data_size): Record
5089         additional information for scripts.
5090         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5091         * incremental.h (Incremental_script_entry::add_object): New function.
5092         (Incremental_script_entry::get_object_count): New function.
5093         (Incremental_script_entry::get_object): New function.
5094         (Incremental_script_entry::objects_): New data member; adjust
5095         constructor.
5096         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5097         (Incremental_inputs::report_object): Add script_info parameter.
5098         (Incremental_inputs_reader::get_object_count): New function.
5099         (Incremental_inputs_reader::get_object_offset): New function.
5100         * options.cc (Input_arguments::add_file): Return reference to
5101         new input argument.
5102         * options.h (Input_argument::set_script_info): New function.
5103         (Input_argument::script_info): New function.
5104         (Input_argument::script_info_): New data member; adjust all
5105         constructors.
5106         (Input_file_group::add_file): Return reference to new input argument.
5107         (Input_file_lib::add_file): Likewise.
5108         (Input_arguments::add_file): Likewise.
5109         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5110         * script.cc (Parser_closure::Parser_closure): Add script_info
5111         parameter; adjust all callers.
5112         (Parser_closure::script_info): New function.
5113         (Parser_closure::script_info_): New data member.
5114         (read_input_script): Report scripts earlier to incremental info.
5115         (script_add_file): Set script_info in Input_argument.
5116         (script_add_library): Likewise.
5117         * script.h (Script_options::Script_info): Rewrite class.
5118
5119 2011-03-29  Cary Coutant  <ccoutant@google.com>
5120
5121         * archive.cc (Library_base::should_include_member): Move
5122         method here from class Archive.
5123         (Archive::Archive): Initialize base class.
5124         (Archive::should_include_member): Move to base class.
5125         (Archive::do_for_all_unused_symbols): New function.
5126         (Add_archive_symbols::run): Remove redundant access to
5127         incremental_inputs.
5128         (Lib_group::Lib_group): Initialize base class.
5129         (Lib_group::do_filename): New function.
5130         (Lib_group::include_member): Pass pointer to Lib_group to
5131         report_object.
5132         (Lib_group::do_for_all_unused_symbols): New function.
5133         (Add_lib_group_symbols::run): Report archive information for
5134         incremental links.
5135         * archive.h (class Library_base): New base class.
5136         (class Archive): Derive from Library_base.
5137         (Archive::filename): Move to base class.
5138         (Archive::set_incremental_info): Likewise.
5139         (Archive::incremental_info): Likewise.
5140         (Archive::Should_include): Likewise.
5141         (Archive::should_include_member): Likewise.
5142         (Archive::Armap_entry): Remove.
5143         (Archive::Unused_symbol_iterator): Remove.
5144         (Archive::unused_symbols_begin): Remove.
5145         (Archive::unused_symbols_end): Remove.
5146         (Archive::do_filename): New function.
5147         (Archive::do_get_mtime): New function.
5148         (Archive::do_for_all_unused_symbols): New function.
5149         (Archive::task_): Move to base class.
5150         (Archive::incremental_info_): Likewise.
5151         (class Lib_group): Derive from Library_base.
5152         (Lib_group::do_filename): New function.
5153         (Lib_group::do_get_mtime): New function.
5154         (Lib_group::do_for_all_unused_symbols): New function.
5155         (Lib_group::task_): Move to base class.
5156         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5157         function.
5158         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5159         function.
5160         * incremental.cc (Incremental_inputs::report_archive_begin):
5161         Use Library_base; call library's get_mtime; add incremental inputs
5162         entry before members.
5163         (class Unused_symbol_visitor): New class.
5164         (Incremental_inputs::report_archive_end): Use Library_base; use
5165         visitor class to record unused symbols; don't add incremental inputs
5166         entry after members.
5167         (Incremental_inputs::report_object): Use Library_base.
5168         * incremental.h
5169         (Incremental_archive_entry::Incremental_archive_entry): Remove
5170         unused Archive parameter.
5171         (Incremental_inputs::report_archive_begin): Use Library_base.
5172         (Incremental_inputs::report_archive_end): Likewise.
5173         (Incremental_inputs::report_object): Likewise.
5174         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5175         function.
5176         * object.h (Object::for_all_global_symbols): New function.
5177         (Object::do_for_all_global_symbols): New function.
5178         (Sized_relobj::do_for_all_global_symbols): New function.
5179         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5180         function.
5181         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5182         function.
5183
5184 2011-03-27  Ian Lance Taylor  <iant@google.com>
5185
5186         * archive.cc (Archive::interpret_header): Return -1 if something
5187         goes wrong.  Change callers accordingly.
5188
5189 2011-03-25  Cary Coutant  <ccoutant@google.com>
5190
5191         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5192         * testsuite/Makefile.in: Regenerate.
5193
5194 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5195
5196         * plugin.cc (get_view): New.
5197         (Plugin::load): Pass get_view to the plugin.
5198         (Plugin_manager::get_view): New.
5199
5200 2011-03-21  Ian Lance Taylor  <iant@google.com>
5201
5202         * testsuite/final_layout.sh: Rewrite to not use dc.
5203         * testsuite/relro_test.sh: Fail if dc is not present.
5204
5205 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5206
5207         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5208         Change == to -eq.
5209         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5210         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5211         Change == to -eq.
5212         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5213         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5214
5215 2011-03-14  Ian Lance Taylor  <iant@google.com>
5216
5217         * script-sections.cc (Sort_output_sections::script_compare):
5218         Rename from is_before, change return type.
5219         (Sort_output_sections::operator()): Adjust accordingly.
5220
5221 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5222
5223         PR gold/12572
5224         * testsuite/odr_violation2.cc: Add comment to make all error line
5225         numbers double digits.
5226         * testsuite/debug_msg.sh: Adjust expected errors.
5227
5228 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5229
5230         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5231         but mark earlier ones as non-canonical
5232         (offset_to_iterator): Update search target and example
5233         (do_addr2line): Return extra lines in a vector*
5234         (format_file_lineno): Extract from do_addr2line
5235         (one_addr2line): Add vector* out-param
5236         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5237         when a lineno entry appeared last for its instruction
5238         (Dwarf_line_info): Add vector* out-param
5239         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5240         * symtab.cc (Odr_violation_compare): Include the lineno in the
5241         comparison again.
5242         (linenos_from_loc): New. Combine the canonical line for an
5243         address with its other lines.
5244         (True_if_intersect): New. Helper functor to make
5245         std::set_intersection a query.
5246         (detect_odr_violations): Compare sets of lines instead of just
5247         one line for each function. This became less deterministic, but
5248         has fewer false positives.
5249         * symtab.h: Declarations.
5250         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5251         mix an optimized and non-optimized object in the same binary
5252         (odr_violation2.so): Same.
5253         * testsuite/Makefile.in: Regenerate from Makefile.am.
5254         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5255         * testsuite/debug_msg.sh: Update line numbers and add
5256         assertions.
5257         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5258         non-optimized context.
5259         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5260         isn't inlined, and use OdrDerived in an optimized context.
5261         * testsuite/odr_header1.h: Defines OdrDerived, where
5262         optimization will change the
5263         first-instruction-in-the-destructor's file and line number.
5264         * testsuite/odr_header2.h: Defines OdrBase.
5265
5266 2011-03-09  Ian Lance Taylor  <iant@google.com>
5267
5268         * fileread.cc (File_read::clear_views): Don't delete the whole
5269         file view.
5270
5271 2011-03-08  Ian Lance Taylor  <iant@google.com>
5272
5273         PR gold/12525
5274         * fileread.cc: #include <climits>.
5275         (GOLD_IOV_MAX): Define.
5276         (File_read::read_multiple): Limit number of entries by iov_max.
5277         * fileread.h (class File_read): Always set max_readv_entries to
5278         128.
5279
5280 2011-03-07  Ian Lance Taylor  <iant@google.com>
5281
5282         PR gold/12525
5283         * options.h (class General_options): Add -dy and -dn.
5284
5285 2011-03-02  Cary Coutant  <ccoutant@google.com>
5286
5287         * testsuite/script_test_9.t: Add TLS segment.
5288
5289 2011-03-02  Simon Baldwin  <simonb@google.com>
5290
5291         * configure.ac: Add check for gnu_indirect_function support in
5292         the toolchain building binutils.
5293         * configure: Rebuild.
5294
5295 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5296
5297         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5298         plugin only symbols.
5299         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5300         in plugin files as not needed in the symbol table.
5301
5302 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5303
5304         * output.cc (Output_section::add_input_section): Delay fill
5305         generation for section ordering.
5306
5307 2011-02-09  Ian Lance Taylor  <iant@google.com>
5308
5309         PR gold/12316
5310         * object.h (class Sized_relobj): Remove clear_local_symbols.
5311         * reloc.cc (Sized_relobj::do_relocate): Don't call
5312         clear_local_symbols.
5313
5314 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5315
5316         * plugin.cc (is_visible_from_outside): Return true for symbols
5317         in the -u option.
5318
5319 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5320
5321         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5322         filename.
5323
5324 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5325
5326         * icf.h (is_section_foldable_candidate): Change type of parameter
5327         to std::string.
5328         * icf.cc (Icf::find_identical_sections): Change type of local variable
5329         section_name to be std::string.
5330         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5331
5332 2011-01-25  Ian Lance Taylor  <iant@google.com>
5333
5334         * script.cc (script_add_extern): Rewrite to use
5335         add_symbol_reference.
5336
5337 2011-01-25  Doug Kwan  <dougkwan@google.com>
5338
5339         * icf.cc (get_section_contents): Always lock section's object.
5340
5341 2011-01-24  Ian Lance Taylor  <iant@google.com>
5342
5343         * options.h (class General_options): Accept
5344         --no-detect-odr-violations.
5345
5346 2011-01-24  Ian Lance Taylor  <iant@google.com>
5347
5348         * version.cc (version_string): Bump to 1.11.
5349
5350 2011-01-24  Ian Lance Taylor  <iant@google.com>
5351
5352         * plugin.cc (class Plugin_rescan): Define new class.
5353         (Plugin_manager::claim_file): Set any_claimed_.
5354         (Plugin_manager::save_archive): New function.
5355         (Plugin_manager::save_input_group): New function.
5356         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5357         necessary.
5358         (Plugin_manager::new_undefined_symbol): New function.
5359         (Plugin_manager::rescan): New function.
5360         (Plugin_manager::rescannable_defines): New function.
5361         (Plugin_manager::add_input_file): Set any_added_.
5362         * plugin.h (class Plugin_manager): define new fields rescannable_,
5363         undefined_symbols_, any_claimed_, and any_added_.  Declare
5364         Plugin_rescan as friend.  Declare new functions.
5365         (Plugin_manager::Rescannable): Define type.
5366         (Plugin_manager::Rescannable_list): Define type.
5367         (Plugin_manager::Undefined_symbol_list): Define type.
5368         (Plugin_manager::Plugin_manager): Initialize new fields.
5369         * archive.cc (Archive::defines_symbol): New function.
5370         (Add_archive_symbols::run): Pass archive to plugins if any.
5371         * archive.h (class Archive): Declare defines_symbol.
5372         * readsyms.cc (Input_group::~Input_group): New function.
5373         (Finish_group::run): Pass input_group to plugins if any.
5374         * readsyms.h (class Input_group): Declare destructor.
5375         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5376         any.
5377
5378 2011-01-10  Ian Lance Taylor  <iant@google.com>
5379
5380         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5381         section as relro.
5382         (Layout::set_segment_offsets): Reset increase_relro before calling
5383         set_section_addresses a second time.
5384
5385 2011-01-04  Cary Coutant  <ccoutant@google.com>
5386
5387         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5388         sections before NOBITS sections.
5389
5390 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5391
5392         * version.cc (print_version): Update copyright to 2011.
5393
5394 2010-12-23  Cary Coutant  <ccoutant@google.com>
5395
5396         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5397         of OS to this->add.  Add OD parameter to second form of the function.
5398
5399 2010-12-20  Ian Lance Taylor  <iant@google.com>
5400
5401         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5402         second of two consecutive entries with same offset.
5403
5404 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5405
5406         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5407         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5408         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5409         to avoid unneeded links against $(LDADD).
5410         * testsuite/Makefile.in: Regenerate.
5411
5412 2010-12-15  Ian Lance Taylor  <iant@google.com>
5413
5414         PR gold/12324
5415         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5416         for R_X86_64_32 and R_X86_64_PC32.
5417         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5418         ver_matching_def_pic.o.
5419         (ver_matching_def_pic.o): New target.
5420
5421 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5422
5423         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5424         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5425         Move definition before File_read::View member definitions.
5426         (File_read::View::~View): Initialize and hold lock before
5427         updating current_mapped_bytes.
5428
5429 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5430
5431         * dwarf_reader.cc: Remove outdated comment.
5432         * gold-threads.cc: Fix typo in error message.
5433         * archive.cc: Fix typos in comments.
5434         * archive.h: Likewise.
5435         * arm-reloc-property.cc: Likewise.
5436         * arm-reloc-property.h: Likewise.
5437         * arm-reloc.def: Likewise.
5438         * arm.cc: Likewise.
5439         * attributes.h: Likewise.
5440         * cref.cc: Likewise.
5441         * ehframe.cc: Likewise.
5442         * fileread.h: Likewise.
5443         * gold.h: Likewise.
5444         * i386.cc: Likewise.
5445         * icf.cc: Likewise.
5446         * incremental.h: Likewise.
5447         * int_encoding.cc: Likewise.
5448         * layout.h: Likewise.
5449         * main.cc: Likewise.
5450         * merge.h: Likewise.
5451         * object.cc: Likewise.
5452         * object.h: Likewise.
5453         * options.cc: Likewise.
5454         * readsyms.cc: Likewise.
5455         * reduced_debug_output.cc: Likewise.
5456         * reloc.cc: Likewise.
5457         * script-sections.cc: Likewise.
5458         * sparc.cc: Likewise.
5459         * symtab.h: Likewise.
5460         * target-reloc.h: Likewise.
5461         * target.cc: Likewise.
5462         * target.h: Likewise.
5463         * timer.cc: Likewise.
5464         * timer.h: Likewise.
5465         * x86_64.cc: Likewise.
5466
5467 2010-12-09  Cary Coutant  <ccoutant@google.com>
5468
5469         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5470         stack.
5471         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5472         parameter; change all callers.
5473         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5474         * options.h (warn_execstack): New option.
5475
5476 2010-12-07  Doug Kwan  <dougkwan@google.com>
5477
5478         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5479         like function call relocations.
5480
5481 2010-12-07  Ian Lance Taylor  <iant@google.com>
5482
5483         * archive.cc (Archive::get_elf_object_for_member): Permit
5484         punconfigured to be NULL.
5485         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5486         (Archive::include_member): Pass NULL to get_elf_object_for_member
5487         if we searched for the archive and this is the first included
5488         object.
5489
5490 2010-12-01  Ian Lance Taylor  <iant@google.com>
5491
5492         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5493         track_relocs_type_ field.
5494         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5495         Set track_relocs_type_.
5496         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5497         contents when using RELA relocs.
5498         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5499         reloc_map_.
5500         * reloc.cc (Track_relocs::next_addend): New function.
5501         * reloc.h (class Track_relocs): Declare next_addend.
5502
5503 2010-12-01  Ian Lance Taylor  <iant@google.com>
5504
5505         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5506         virtual destructor.
5507
5508 2010-12-01  Ian Lance Taylor  <iant@google.com>
5509
5510         * README: Update compilers known to work and fail.
5511
5512 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5513
5514         * configure.in: For --enable-gold, handle value `default' instead of
5515         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5516         not the default.
5517         * configure: Regenerate.
5518
5519 2010-11-18  Doug Kwan  <dougkwan@google.com>
5520
5521         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5522         and right_alignment to be zero.  Store result alignment only if it is
5523         greater than existing alignment.
5524
5525 2010-11-16  Cary Coutant  <ccoutant@google.com>
5526
5527         PR gold/12220
5528         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5529         Check for ".zdebug_line".
5530
5531 2010-11-16  Doug Kwan  <dougkwan@google.com>
5532             Cary Coutant  <ccoutant@google.com>
5533
5534         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5535         by reference; adjust all callers.
5536         * output.cc (Output_segment::set_section_addresses): Adjust references
5537         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5538         list is empty.
5539         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5540         end at page boundary.
5541
5542 2010-11-16  Cary Coutant  <ccoutant@google.com>
5543
5544         PR gold/12220
5545         * layout.cc (Layout::choose_output_section): Transform names of
5546         compressed sections even when using a script with a SECTIONS clause.
5547         (Layout::output_section_name): Remove code to transform
5548         compressed debug section names.
5549         * output.cc (Output_section::add_input_section): Use uncompressed
5550         section size when tracking input sections.
5551
5552 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5553
5554         * symtab.h (Symbol::NON_PIC_REF): Remove.
5555         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5556         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5557         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5558         (Symbol::use_plt_offset): Take a flags argument and pass it
5559         directly to needs_dynamic_reloc.  Restrict check for undefined
5560         weak symbols to function calls.
5561         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5562         (Target_arm::Scan::global): Use it.
5563         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5564         (Target_arm::Relocate::relocate): Likewise.
5565         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5566         parameter with an r_type parameter.  Use get_reference_flags
5567         to get the flags.
5568         (Target_arm::Relocate::relocate): Update accordingly.
5569         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5570         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5571         (Target_i386::Scan::global): Likewise.
5572         (Target_i386::Relocate::relocate): Likewise.
5573         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5574         parameter with an r_type parameter.  Use get_reference_flags
5575         to get the flags.
5576         (Target_i386::Relocate::relocate): Update accordingly.
5577         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5578         (Target_powerpc::Scan::global): Use it.
5579         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5580         (Target_powerpc::Relocate::relocate): Likewise.
5581         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5582         (Target_sparc::Scan::global): Use it.
5583         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5584         (Target_sparc::Relocate::relocate): Likewise.
5585         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5586         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5587         (Target_x86_64::Scan::global): Likewise.
5588         (Target_x86_64::Relocate::relocate): Likewise.
5589
5590 2010-11-08  Doug Kwan  <dougkwan@google.com>
5591             Cary Coutant  <ccoutant@google.com>
5592
5593         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5594         (Arm_exidx_merge_section::section_contents_): New data member.
5595         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5596         (Arm_input_section::~Arm_input_section): De-allocate memory.
5597         (Arm_input_section::original_contents_): New data member.
5598         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5599         in parameters instead of calling Object::section_contents without
5600         locking.
5601         (Arm_output_section::group_section): New parameter TASK.  Pass it
5602         to callees that need locking objects.
5603         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5604         to lock EXIDX input sections.  Fix a formatting issue.  Call
5605         Arm_exidx_merged_section::build_contents to create merged section
5606         contents.
5607         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5608         to lock object of stub table owner.
5609         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5610         TEXT_SIZE to initialize data member TEXT_SIZE_.
5611         (Arm_exidx_input_section::addralign): Fix typo in comment.
5612         (Arm_exidx_input_section::text_size): New method.
5613         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5614         that require locking objects.  Lock objects before scanning for stubs
5615         and updating local symbols.
5616         (Arm_input_section<big_endian>::init): Copy contents of original
5617         input section.
5618         (Arm_input_section<big_endian>::do_write): Use saved contents of
5619         original input section instead of calling Object::section_contents
5620         without locking.
5621         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5622         size without calling Object::section_size().
5623         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5624         for size.  Allocate a buffer for merged EXIDX entries.
5625         (Arm_exidx_merged_section::build_contents): New method.
5626         (Arm_exidx_merged_section::do_write): Move merge section contents
5627         building code to Arm_exidx_merged_section::build_contetns.  Write
5628         out contetns in buffer instead of building it on the fly.
5629         (Arm_relobj::make_exidx_input_section): Also pass text section size
5630         to Arm_exidx_input_section constructor.
5631         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5632         (Arm_dynobj::do_read_symbols): Fix memory leak.
5633         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5634         * target.h: (class Task): Add forward declaration.
5635         (Target::relax): Add new parameter TASK and pass it to
5636         Target::do_relax().
5637         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5638
5639 2010-11-05  Cary Coutant  <ccoutant@google.com>
5640
5641         PR gold/10708
5642         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5643         object when reading from the file.
5644         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5645         second layout pass.
5646         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5647         when reading section contents.
5648         (get_section_contents): Likewise.
5649         (icf::find_identical_sections): Likewise.
5650         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5651         object when reading from the file.
5652         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5653         the object when doing deferred section layout.
5654
5655 2010-11-03  Nick Clifton  <nickc@redhat.com>
5656
5657         PR gold/12001
5658         * script.h (class Symbol_assignment: name): New member.  Returns
5659         the name of the symbol.
5660         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5661         Returns true if the given symbol name is on the list of
5662         assignments wating to be processed.
5663         * archive.cc (should_incldue_member): If the symbol is undefined,
5664         check to see if it is on the list of symbols pending assignment.
5665
5666 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5667
5668         * script-sections.cc (Script_sections::find_memory_region): Check
5669         for a NULL output section pointer.
5670
5671 2010-10-29  Doug Kwan  <dougkwan@google.com>
5672
5673         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5674         Output_section::add_relaxed_input_section.
5675         * output.cc (Output_section::add_relaxed_input_section): Add new
5676         arguments LAYOUT and NAME.  Set section order index.
5677         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5678         Copy section order index.
5679         * output.h (Output_section::add_relaxed_input_section): Add new
5680         arguments LAYOUT and NAME.
5681
5682 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5683
5684         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5685         NATIVE_OR_CROSS_LINKER.
5686         * testsuite/Makefile.in: Regenerate.
5687
5688 2010-10-20  Doug Kwan  <dougkwan@google.com>
5689
5690         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5691         without SHF_LINK_ORDER flags.
5692         * layout.cc (Layout::choose_output_section): Do not filter
5693         SHF_LINK_ORDER flag in a relocatable link.
5694
5695 2010-10-17  Cary Coutant  <ccoutant@google.com>
5696
5697         * output.h (Output_segment::set_section_addresses): Change function
5698         signature.  Update all callers.
5699         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5700         sections.
5701         (Output_segment::set_section_addresses): Align after last TLS
5702         section.  Add padding before last relro section instead of after.
5703
5704 2010-10-17  Doug Kwan  <dougkwan@google.com>
5705
5706         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5707         GOT output section to be writable.
5708
5709 2010-10-14  Cary Coutant  <ccoutant@google.com>
5710
5711         * debug.h (DEBUG_INCREMENTAL): New flag.
5712         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5713         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5714         mode.
5715         * incremental.cc (report_command_line): Ignore all forms of
5716         --incremental.
5717         * layout.cc (Layout::Layout): Check parameters for incremental link
5718         mode.
5719         * options.cc (General_options::parse_incremental): New function.
5720         (General_options::parse_no_incremental): New function.
5721         (General_options::parse_incremental_full): New function.
5722         (General_options::parse_incremental_update): New function.
5723         (General_options::incremental_mode_): New data member.
5724         (General_options::finalize): Check incremental_mode_.
5725         * options.h (General_options): Update help text for --incremental.
5726         Add --no-incremental, --incremental-full, --incremental-update.
5727         (General_options::Incremental_mode): New enum type.
5728         (General_options::incremental_mode): New function.
5729         (General_options::incremental_mode_): New data member.
5730         * parameters.cc (Parameters::incremental_mode_): New data member.
5731         (Parameters::set_options): Set incremental_mode_.
5732         (Parameters::set_incremental_full): New function.
5733         (Parameters::incremental): New function.
5734         (Parameters::incremental_update): New function.
5735         (set_parameters_incremental_full): New function.
5736         * parameters.h (Parameters::set_incremental_full): New function.
5737         (Parameters::incremental): New function.
5738         (Parameters::incremental_update): New function.
5739         (Parameters::incremental_mode_): New data member.
5740         (set_parameters_incremental_full): New function.
5741         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5742         incremental link mode.
5743         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5744         (Sized_relobj::do_relocate_sections): Likewise.
5745         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5746         option.
5747         * testsuite/Makefile.in: Regenerate.
5748         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5749
5750 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5751
5752         * script-sections.h (class Script_sections): Make
5753         Sections_elements typedef public.
5754         * script-sections.cc (class Sort_output_sections): Add elements_
5755         field.  Add constructor which sets it; change all callers.
5756         (Sort_output_sections::is_before): New function.
5757         (Sort_output_sections::operator()): Call is_before.
5758         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5759         conditional.
5760         * testsuite/script_test_10.sh: New test. Test script section
5761         order.
5762         * testsuite/script_test_10.t: Likewise.
5763         * testsuite/script_test_10.s: Likewise.
5764         * testsuite/Makefile.am: Wrap the cross linker tests and the
5765         common tests into NATIVE_OR_CROSS_LINKER.
5766         (check_SCRIPTS): Add script_test_10.sh.
5767         (check_DATA): Add script_test_10.stdout.
5768         (script_test_10.o, script_test_10): New targets.
5769         (script_test_10.stdout): New target.
5770         * configure, testsuite/Makefile.in: Regenerate.
5771
5772 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5773
5774         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5775         error for the deprecated relocations.
5776         (Target_arm::Scan::global): Likewise.
5777         (Target_arm::Relocate::relocate): Likewise.
5778
5779 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5780
5781         * fileread.cc (Input_file::find_file): Initialize *found_name
5782         and *namep when using the fallback search for case 4.
5783
5784 2010-10-11  Cary Coutant  <ccoutant@google.com>
5785
5786         * options.h (class General_options): Redefine -z lazy as an alias for
5787         the negation of -z now.
5788
5789 2010-10-11  Ian Lance Taylor  <iant@google.com>
5790
5791         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5792         binding.
5793
5794 2010-10-06  Nick Clifton  <nickc@redhat.com>
5795
5796         * script-sections.cc(class Memory_region): Remove
5797         current_lma_offset_ field.  Rename current_vma_offset_ to
5798         current_offset_.  Add last_section_ field.
5799         (Memory_region::get_current_vma_address): Rename to
5800         get_current_address.
5801         (Memory_region::get_current_lma_address): Delete.
5802         (Memory_region::increment_vma_offset): Rename to
5803         increment_offset.
5804         (Memory_region::increment_lma_offset): Delete.
5805         (Memory_region::attributes_compatible): New method.  Returns
5806         true if the provided section is compatible with the region.
5807         (Memory_region::get_last_section): New method.  Returns the last
5808         section to use the region.
5809         (Memory_region::set_last_section): New method.  Stores the last
5810         section to use the region.
5811         (Script_sections::block_in_region): New method.  Returns true if
5812         a block of memory is contained within a region.
5813         (Script_sections::find_memory_region): New method.  Locates a
5814         memory region to be used to set a VMA or LMA address.
5815         (Output_section_definition::set_section_addresses): Add code to
5816         check for addresses set by memory regions.
5817         (Output_segment::set_section_addresses): Remove memory region
5818         walking code.
5819         (Script_sections::create_segment): Add a warning if a header
5820         segment is created outside of any region.
5821         * script-sections.h (class Script_sections): Add prototypes for
5822         find_memory_region and block_in_region methods.
5823         * testsuite/memory_test.s: Use .long instead of .word.
5824         * testsuite/memory_test.t: Add some more output sections.
5825         * testsuite/memory_test.sh: Update expected output.
5826
5827 2010-10-02  Doug Kwan  <dougkwan@google.com>
5828
5829         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5830         defintion to symtab.h
5831         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5832         declaration to defintion.
5833
5834 2010-10-01  Nick Clifton  <nickc@redhat.com>
5835
5836         * expression.cc (eval): Replace dummy argument with NULL.
5837         (eval_maybe_dot): Check for a NULL result section pointer.
5838         (Symbol_expression::value): Likewise.
5839         (Dot_expression::value): Likewise.
5840         (BINARY_EXPRESSION): Likewise.
5841         (Max_expression::value): Likewise.
5842         (Min_expression::value): Likewise.
5843         (Absolute_expression::value): Likewise.
5844         (Addr_expression::value_from_output_section): Likewise.
5845         (Loaddddr_expression::value_from_output_section): Likewise.
5846         (Segment_start_expression::value): Likewise.
5847         * script-sections.cc
5848         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5849         argument with NULL.
5850         (Sections_elememt_dot_assignment::set_section_addresses):
5851         Likewise.
5852         (Output_data_expression::do_write_to_buffer): Likewise.
5853         (Output_section_definition::finalize_symbols): Likewise.
5854         (Output_section_definition::set_section_addresses): Likewise.
5855
5856 2010-09-30  Doug Kwan  <dougkwan@google.com>
5857
5858         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5859
5860 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5861
5862         * target.h (Target::can_icf_inline_merge_sections): New virtual
5863         function.
5864         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5865         virtual function.
5866         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5867         virtual function.
5868         * icf.cc (get_section_contents): Inline merge sections only when
5869         target allows it.
5870
5871 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5872
5873         * configure: Regenerate.
5874
5875 2010-09-17  Ian Lance Taylor  <iant@google.com>
5876
5877         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5878         * testsuite/Makefile.am (memory_test.o): New target.
5879         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5880         memory_test.t.
5881         * testsuite/Makefile.in: Rebuild.
5882
5883 2010-09-17  Doug Kwan  <dougkwan@google.com>
5884
5885         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5886         defintion if relocation uses GOT entries of the symbol.
5887         * testsuite/icf_safe_test.sh: Fix test.
5888         * testsuite/icf_safe_so_test.sh: Fix test.
5889
5890 2010-09-16  Cary Coutant  <ccoutant@google.com>
5891
5892         * script_sections.cc (class Memory_region): Remove "NULL" from
5893         vector initializations.
5894
5895 2010-09-15  Cary Coutant  <ccoutant@google.com>
5896
5897         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5898         Resolve forwarding symbols.
5899
5900 2010-09-15  Doug Kwan  <dougkwan@google.com>
5901
5902         * gold/testsuite/script_test_3.t: Add ARM special sections.
5903         * gold/testsuite/script_test_4.t: Same.
5904         * gold/testsuite/script_test_5.t: Same.
5905         * gold/testsuite/script_test_6.t: Same.
5906         * gold/testsuite/script_test_7.t: Same.
5907         * gold/testsuite/script_test_7.t: Same.
5908         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5909
5910 2010-09-14  Cary Coutant  <ccoutant@google.com>
5911
5912         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5913         (Target_x86_64::Relocate::relocate_tls): Replace check for
5914         saw_tls_block_reloc_ with test for executable section.
5915
5916 2010-09-12  Cary Coutant  <ccoutant@google.com>
5917
5918         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5919         position-independent executables to shared libraries need dynamic
5920         relocations.
5921         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5922         position-independent executables.
5923         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5924         * testsuite/Makefile.in: Regenerate.
5925
5926 2010-09-10  Nick Clifton  <nickc@redhat.com>
5927
5928         PR gold/11997
5929         * testsuite/memory_test.t: Discard any sections that are not
5930         needed.
5931
5932 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5933
5934         PR gold/11996
5935         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5936         "This::" to work around a bug in gcc 4.2.
5937
5938         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5939
5940 2010-09-09  Rafael Espindola  <espindola@google.com>
5941
5942         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5943         sections with different PF_X flags in the same segment.
5944         (Layout::find_first_load_seg): Search all segments to find the first
5945         one.
5946         * options.h (rosegment): New.
5947
5948 2010-09-08  Rafael Espindola  <espindola@google.com>
5949
5950         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5951
5952 2010-09-08  Doug Kwan  <dougkwan@google.com>
5953
5954         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5955         (Arm_relobj::do_relocate_sections): Add new parameter for output
5956         file to match the parent.
5957         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5958         of local symbols instead of input values.  Update code to track
5959         changes in gold::relocate_section.
5960         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5961         (Sized_relobj::compute_final_local_value_internal): New methods.
5962         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5963         body into private version of Sized_relobj::compute_final_local_value.
5964         Call the inline method.
5965         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5966         merged symbol value if there is one.
5967         (Symbol_value::has_output_value): New method defintiion.
5968         (Sized_relobj::Compute_final_local_value_status): New enum type.
5969         (Sized_relobj::compute_final_local_value): New methods.
5970         (Sized_relobj::compute_final_local_value_internal): New methods.
5971         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5972         and arm_cortex_a8.sh.
5973         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5974         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5975         New tests.
5976         * Makefile.in: Regenerate.
5977         * testsuite/arm_bl_out_of_range.s: Update test.
5978         * testsuite/thumb_bl_out_of_range.s: Ditto.
5979         * testsuite/thumb_blx_out_of_range.s: Ditto.
5980         * testsuite/arm_branch_out_of_range.sh: New file.
5981         * testsuite/arm_cortex_a8.sh: Ditto.
5982         * testsuite/arm_cortex_a8_b.s: Ditto.
5983         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5984         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5985         * testsuite/arm_cortex_a8_bl.s: Ditto.
5986         * testsuite/arm_cortex_a8_blx.s: Ditto.
5987         * testsuite/arm_cortex_a8_local.s: Ditto.
5988         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5989         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5990
5991 2010-09-08  Rafael Espindola  <espindola@google.com>
5992
5993         * Makefile.am (memory_test.stdout): Run readelf with -W.
5994         * Makefile.in: Regenerate.
5995         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5996         64 bit output.
5997
5998 2010-09-08  Rafael Espindola  <espindola@google.com>
5999
6000         * script-sections.cc (Script_sections::add_memory_region): Convert
6001         field precision to int.
6002         * script.cc (script_set_section_region, script_set_section_region):
6003         Convert field precision to int.
6004
6005 2010-09-08  Rafael Espindola  <espindola@google.com>
6006
6007         * arm.cc (do_finalize_sections): Create the __exidx_start and
6008         __exdix_end symbols even when the section is missing.
6009
6010 2010-09-08  Nick Clifton  <nickc@redhat.com>
6011
6012         * README: Remove claim that MEMORY is not supported.
6013         * expression.cc (script_exp_function_origin)
6014         (script_exp_function_length): Move from here to ...
6015         * script.cc: ... here.
6016         (script_set_section_region, script_add_memory)
6017         (script_parse_memory_attr, script_include_directive): New
6018         functions.
6019         * script-sections.cc
6020         (class Memory_region): New class.
6021         (class Output_section_definition): Add set_memory_region,
6022         set_section_vma, set_section_lma and get_section_name methods.
6023         (class Script_Sections): Add add_memory_region,
6024         find_memory_region, find_memory_region_origin,
6025         find_memory_region_length and set_memory_region methods.
6026         Have set_section_addresses method walk the list of set memory
6027         regions.
6028         Extend the print methos to display memory regions.
6029         * script-sections.h: Add prototypes for new methods.
6030         Add enum for MEMORY region attributes.
6031         * yyscript.y: Add support for parsing MEMORY regions.
6032         * script-c.h: Add prototypes for new functions.
6033         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6034         * testsuite/Makefile.in: Regenerate.
6035         * testsuite/memory_test.sh: New script.
6036         * testsuite/memory_test.s: New assembler source file.
6037         * testsuite/memory_test.t: New linker script.
6038
6039 2010-08-27  Doug Kwan  <dougkwan@google.com>
6040
6041         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6042         reference override an existing dynamic weak reference.
6043         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6044         * testsuite/Makefile.in: Regenerate.
6045         * testsuite/dyn_weak_ref.sh: New file.
6046         * testsuite/dyn_weak_ref_1.c: Ditto.
6047         * testsuite/dyn_weak_ref_2.c: Ditto.
6048
6049 2010-08-27  Ian Lance Taylor  <iant@google.com>
6050
6051         * incremental.h (class Incremental_input_entry): Add virtual
6052         destructor.
6053
6054 2010-08-27  Ian Lance Taylor  <iant@google.com>
6055
6056         * testsuite/start_lib_test_3.c: Mark t3 as used.
6057
6058 2010-08-27  Nick Clifton  <nickc@redhat.com>
6059
6060         * options.cc (version_script): Fix small typo in previous
6061         whitespace tidyup.
6062
6063 2010-08-25  Nick Clifton  <nickc@redhat.com>
6064
6065         * archive.cc: Formatting fixes: Remove whitespace between
6066         typename and following asterisk.  Remove whitespace between
6067         function name and opening parenthesis.
6068         * archive.h: Likewise.
6069         * arm.cc: Likewise.
6070         * attributes.cc: Likewise.
6071         * attributes.h: Likewise.
6072         * common.cc: Likewise.
6073         * copy-relocs.cc: Likewise.
6074         * dirsearch.h: Likewise.
6075         * dynobj.cc: Likewise.
6076         * ehframe.cc: Likewise.
6077         * ehframe.h: Likewise.
6078         * expression.cc: Likewise.
6079         * fileread.cc: Likewise.
6080         * fileread.h: Likewise.
6081         * gc.h: Likewise.
6082         * gold-threads.cc: Likewise.
6083         * gold.cc: Likewise.
6084         * i386.cc: Likewise.
6085         * icf.h: Likewise.
6086         * incremental-dump.cc: Likewise.
6087         * incremental.cc: Likewise.
6088         * layout.cc: Likewise.
6089         * layout.h: Likewise.
6090         * main.cc: Likewise.
6091         * merge.cc: Likewise.
6092         * merge.h: Likewise.
6093         * object.cc: Likewise.
6094         * object.h: Likewise.
6095         * options.cc: Likewise.
6096         * options.h: Likewise.
6097         * output.cc: Likewise.
6098         * output.h: Likewise.
6099         * plugin.cc: Likewise.
6100         * plugin.h: Likewise.
6101         * powerpc.cc: Likewise.
6102         * reloc.cc: Likewise.
6103         * script-c.h: Likewise.
6104         * script-sections.cc: Likewise.
6105         * script.cc: Likewise.
6106         * stringpool.cc: Likewise.
6107         * symtab.cc: Likewise.
6108         * symtab.h: Likewise.
6109         * target.cc: Likewise.
6110         * timer.cc: Likewise.
6111         * timer.h: Likewise.
6112         * version.cc: Likewise.
6113         * x86_64.cc: Likewise.
6114
6115 2010-08-24  Nick Clifton  <nickc@redhat.com>
6116
6117         PR 11899
6118         * layout.cc (segment_precedes): Sort segments by their physical
6119         addresses, if they have been set.
6120
6121 2010-08-23  Cary Coutant  <ccoutant@google.com>
6122
6123         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6124         symbols data.
6125         (Lib_group::include_member): Unlock object after deleting its
6126         symbols data.
6127         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6128         the bug fixed here.
6129
6130 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6131             Cary Coutant  <ccoutant@google.com>
6132
6133         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6134         constructor, and set_blocker.
6135         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6136         readsyms_blocker_.
6137         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6138         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6139         * testsuite/Makefile.am (start_lib_test): New test case.
6140         * testsuite/Makefile.in: Regenerate.
6141         * testsuite/start_lib_test_main.c: New file.
6142         * testsuite/start_lib_test_1.c: New file.
6143         * testsuite/start_lib_test_2.c: New file.
6144         * testsuite/start_lib_test_3.c: New file.
6145
6146 2010-08-19  Ian Lance Taylor  <iant@google.com>
6147
6148         * Makefile.in: Rebuild with automake 1.11.1.
6149         * aclocal.m4: Likewise.
6150         * testsuite/Makefile.in: Likewise.
6151
6152 2010-08-19  Ian Lance Taylor  <iant@google.com>
6153
6154         PR 10893
6155         * i386.cc (class Output_data_plt_i386): Update declarations.
6156         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6157         local_ifuncs_ fields.
6158         (Target_i386::do_plt_section_for_global): New function.
6159         (Target_i386::do_plt_section_for_local): New function.
6160         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6161         parameter; change all callers.  Initialize global_ifuncs_ and
6162         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6163         __rel_iplt_end.
6164         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6165         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6166         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6167         symbols.
6168         (Target_i386::make_plt_section): New function, broken out of
6169         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6170         (Target_i386::make_plt_entry): Call make_plt_section.
6171         (Target_i386::make_local_ifunc_plt_entry): New function.
6172         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6173         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6174         R_386_IRELATIVE to switch.
6175         (Target_i386::Scan::global): Likewise.
6176         (Target_i386::Relocate::relocate): Likewise.
6177         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6178         switch.
6179         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6180         (Target_x86_64::do_plt_section_for_global): New function.
6181         (Target_x86_64::do_plt_section_for_local): New function.
6182         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6183         parameter; change all callers.  If doing a static link define
6184         __rela_iplt_start and __rela_iplt_end.
6185         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6186         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6187         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6188         to point to .plt.
6189         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6190         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6191         switch.
6192         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6193         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6194         R_X86_64_IRELATIVE to switch.
6195         (Target_x86_64::Scan::global): Likewise.
6196         (Target_x86_64::Relocate::relocate): Likewise.
6197         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6198         switch.
6199         * target.h (class Target): Add plt_section_for_global and
6200         plt_section_for_local functions.  Add do_plt_section_for_global
6201         and do_plt_section_for_local virtual functions.
6202         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6203         clarifying comments.
6204         (Symbol::use_plt_offset): Handle IFUNC symbol.
6205         * object.cc (Sized_relobj::Sized_relobj): Initialize
6206         local_plt_offsets_.
6207         (Sized_relobj::local_has_plt_offset): New function.
6208         (Sized_relobj::local_plt_offset): New function.
6209         (Sized_relobj::set_local_plt_offset): New function.
6210         (Sized_relobj::do_count): Handle IFUNC symbol.
6211         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6212         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6213         is_ifunc_symbol functions.
6214         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6215         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6216         local_plt_offsets_ field.
6217         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6218         * output.h (class Output_section_data): Add non-const
6219         output_section function.
6220         (class Output_data_got): Update declarations.
6221         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6222         Add use_plt_offset parameter to global and local constructors.
6223         Change all callers.  Change local_sym_index_ field to 31 bits.
6224         Change GSYM_CODE and CONSTANT_CODE accordingly.
6225         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6226         doing a static link don't set sh_link field.
6227         (Output_data_got::Got_entry::write): Use PLT offset if
6228         appropriate.
6229         (Output_data_got::add_global_plt): New function.
6230         (Output_data_got::add_local_plt): New function.
6231         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6232         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6233         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6234         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6235         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6236         IFUNC conditional.
6237         * testsuite/ifunc-sel.h: New file.
6238         * testsuite/ifuncmain1.c: New file.
6239         * testsuite/ifuncmain1vis.c: New file.
6240         * testsuite/ifuncmod1.c: New file.
6241         * testsuite/ifuncdep2.c: New file.
6242         * testsuite/ifuncmain2.c: New file.
6243         * testsuite/ifuncmain3.c: New file.
6244         * testsuite/ifuncmod3.c: New file.
6245         * testsuite/ifuncmain4.c: New file.
6246         * testsuite/ifuncmain5.c: New file.
6247         * testsuite/ifuncmod5.c: New file.
6248         * testsuite/ifuncmain6pie.c: New file.
6249         * testsuite/ifuncmod6.c: New file.
6250         * testsuite/ifuncmain7.c: New file.
6251         * configure, testsuite/Makefile.in: Rebuild.
6252
6253 2010-08-18  Ian Lance Taylor  <iant@google.com>
6254
6255         * incremental.cc
6256         (Output_section_incremental_inputs::write_input_files): Add cast
6257         to avoid signed/unsigned comparison warning.
6258         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6259
6260 2010-08-12  Cary Coutant  <ccoutant@google.com>
6261
6262         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6263
6264 2010-08-13  Ian Lance Taylor  <iant@google.com>
6265
6266         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6267
6268 2010-08-12  Cary Coutant  <ccoutant@google.com>
6269             Doug Kwan  <dougkwan@google.com>
6270
6271         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6272         defintion overrides non-weak undef, remember that the original undef
6273         is not weak.
6274         * symtab.cc (Symbol_table::sized_write_global): For undef without
6275         an original weak binding, set binding to global in output.
6276         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6277         * testsuite/Makefile.in: Regenerate.
6278         * testsuite/strong_ref_weak_def.sh: New file.
6279         * testsuite/strong_ref_weak_def_1.c: Ditto.
6280         * testsuite/strong_ref_weak_def_2.c: Ditto.
6281
6282 2010-08-12  Cary Coutant  <ccoutant@google.com>
6283
6284         * testsuite/incremental_test.sh: Rewrite.
6285         * testsuite/incremental_test_1.c: Rewrite.
6286         * testsuite/incremental_test_2.c: Rewrite.
6287
6288 2010-08-12  Cary Coutant  <ccoutant@google.com>
6289
6290         * arm.cc (Target_arm::got_size): Add const.
6291         (Target_arm::got_entry_count): New function.
6292         (Target_arm::plt_entry_count): New function.
6293         (Target_arm::first_plt_entry_offset): New function.
6294         (Target_arm::plt_entry_size): New function.
6295         (Output_data_plt_arm::entry_count): New function.
6296         (Output_data_plt_arm::first_plt_entry_offset): New function.
6297         (Output_data_plt_arm::get_plt_entry_size): New function.
6298         * i386.cc (Target_i386::got_size): Add const.
6299         (Target_i386::got_entry_count): New function.
6300         (Target_i386::plt_entry_count): New function.
6301         (Target_i386::first_plt_entry_offset): New function.
6302         (Target_i386::plt_entry_size): New function.
6303         (Output_data_plt_i386::entry_count): New function.
6304         (Output_data_plt_i386::first_plt_entry_offset): New function.
6305         (Output_data_plt_i386::get_plt_entry_size): New function.
6306         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6307         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6308         * incremental.cc: Include target.h.
6309         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6310         parameter.  Adjust all callers.  Find incremental_got_plt section.
6311         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6312         section.
6313         (Output_section_incremental_inputs::set_final_data_size): Calculate
6314         size of incremental_got_plt section.
6315         (Output_section_incremental_inputs::do_write): Write the
6316         incremental_got_plt section.
6317         (Got_plt_view_info): New struct.
6318         (Local_got_offset_visitor): New class.
6319         (Global_got_offset_visitor): New class.
6320         (Global_symbol_visitor_got_plt): New class.
6321         (Output_section_incremental_inputs::write_got_plt): New function.
6322         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6323         Add parameter.  Adjust all callers.
6324         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6325         (Incremental_inputs::got_plt_section): New function.
6326         (Incremental_inputs::got_plt_section_): New data member.
6327         (Incremental_got_plt_reader): New class.
6328         * layout.cc (Layout::create_incremental_info_sections): Add the
6329         incremental_got_plt section.
6330         * object.h (Got_offset_list::get_list): New function.
6331         (Got offset_list::for_all_got_offsets): New function.
6332         (Sized_relobj::local_got_offset_list): New function.
6333         * powerpc.cc (Target_powerpc::got_size): Add const.
6334         (Target_powerpc::got_entry_count): New function.
6335         (Target_powerpc::plt_entry_count): New function.
6336         (Target_powerpc::first_plt_entry_offset): New function.
6337         (Target_powerpc::plt_entry_size): New function.
6338         (Output_data_plt_powerpc::entry_count): New function.
6339         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6340         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6341         * sparc.cc (Target_sparc::got_size): Add const.
6342         (Target_sparc::got_entry_count): New function.
6343         (Target_sparc::plt_entry_count): New function.
6344         (Target_sparc::first_plt_entry_offset): New function.
6345         (Target_sparc::plt_entry_size): New function.
6346         (Output_data_plt_sparc::entry_count): New function.
6347         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6348         (Output_data_plt_sparc::get_plt_entry_size): New function.
6349         * symtab.h (Symbol::got_offset_list): New function.
6350         (Symbol_table::for_all_symbols): New function.
6351         * target.h (Sized_target::got_entry_count): New function.
6352         (Sized_target::plt_entry_count): New function.
6353         (Sized_target::plt_entry_size): New function.
6354         * x86_64.cc (Target_x86_64::got_size): Add const.
6355         (Target_x86_64::got_entry_count): New function.
6356         (Target_x86_64::plt_entry_count): New function.
6357         (Target_x86_64::first_plt_entry_offset): New function.
6358         (Target_x86_64::plt_entry_size): New function.
6359         (Output_data_plt_x86_64::entry_count): New function.
6360         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6361         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6362
6363 2010-08-12  Cary Coutant  <ccoutant@google.com>
6364
6365         * archive.cc: Include incremental.h.
6366         (Archive::Archive): Initialize incremental_info_.
6367         (Archive::include_member): Record archive members in incremental info.
6368         (Add_archive_symbols::run): Record begin and end of an archive in
6369         incremental info.
6370         (Lib_group::include_member): Record objects in incremental info.
6371         * archive.h (Incremental_archive_entry): Forward declaration.
6372         (Archive::set_incremental_info): New member function.
6373         (Archive::incremental_info): New member function.
6374         (Archive::Unused_symbol_iterator): New class.
6375         (Archive::unused_symbols_begin): New member function.
6376         (Archive::unused_symbols_end): New member function.
6377         (Archive::incremental_info_): New data member.
6378         * incremental-dump.cc (find_input_containing_global): New function.
6379         (dump_incremental_inputs): Dump new incremental info sections.
6380         * incremental.cc: Include symtab.h.
6381         (Output_section_incremental_inputs): New class.
6382         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6383         new incremental info sections.
6384         (Sized_incremental_binary::do_check_inputs): Likewise.
6385         (Incremental_inputs::report_archive): Remove.
6386         (Incremental_inputs::report_archive_begin): New function.
6387         (Incremental_inputs::report_archive_end): New function.
6388         (Incremental_inputs::report_object): New function.
6389         (Incremental_inputs::finalize_inputs): Remove.
6390         (Incremental_inputs::report_input_section): New function.
6391         (Incremental_inputs::report_script): Rewrite.
6392         (Incremental_inputs::finalize): Do nothing but finalize string table.
6393         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6394         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6395         (Incremental_inputs::create_data_sections): New function.
6396         (Incremental_inputs::relocs_entsize): New function.
6397         (Output_section_incremental_inputs::set_final_data_size): New function.
6398         (Output_section_incremental_inputs::do_write): New function.
6399         (Output_section_incremental_inputs::write_header): New function.
6400         (Output_section_incremental_inputs::write_input_files): New function.
6401         (Output_section_incremental_inputs::write_info_blocks): New function.
6402         (Output_section_incremental_inputs::write_symtab): New function.
6403         * incremental.h (Incremental_script_entry): Forward declaration.
6404         (Incremental_object_entry): Forward declaration.
6405         (Incremental_archive_entry): Forward declaration.
6406         (Incremental_inputs): Forward declaration.
6407         (Incremental_inputs_header_data): Remove.
6408         (Incremental_inputs_header): Remove.
6409         (Incremental_inputs_header_write): Remove.
6410         (Incremental_inputs_entry_data): Remove.
6411         (Incremental_inputs_entry): Remove.
6412         (Incremental_inputs_entry_write): Remove.
6413         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6414         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6415         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6416         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6417         Likewise.
6418         (Incremental_input_entry): New class.
6419         (Incremental_script_entry): New class.
6420         (Incremental_object_entry): New class.
6421         (Incremental_archive_entry): New class.
6422         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6423         (Incremental_inputs::report_inputs): Remove.
6424         (Incremental_inputs::report_archive): Remove.
6425         (Incremental_inputs::report_archive_begin): New function.
6426         (Incremental_inputs::report_archive_end): New function.
6427         (Incremental_inputs::report_object): Change prototype.
6428         (Incremental_inputs::report_input_section): New function.
6429         (Incremental_inputs::report_script): Change prototype.
6430         (Incremental_inputs::get_reloc_count): New function.
6431         (Incremental_inputs::set_reloc_count): New function.
6432         (Incremental_inputs::create_data_sections): New function.
6433         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6434         (Incremental_inputs::inputs_section): New function.
6435         (Incremental_inputs::symtab_section): New function.
6436         (Incremental_inputs::relocs_section): New function.
6437         (Incremental_inputs::get_stringpool): Add const.
6438         (Incremental_inputs::command_line): Add const.
6439         (Incremental_inputs::inputs): Remove.
6440         (Incremental_inputs::command_line_key): New function.
6441         (Incremental_inputs::input_file_count): New function.
6442         (Incremental_inputs::input_files): New function.
6443         (Incremental_inputs::relocs_entsize): New function.
6444         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6445         (Incremental_inputs::finalize_inputs): Remove.
6446         (Incremental_inputs::Input_info): Remove.
6447         (Incremental_inputs::lock_): Remove.
6448         (Incremental_inputs::inputs_): Change type.
6449         (Incremental_inputs::inputs_map_): Remove.
6450         (Incremental_inputs::current_object_entry_): New data member.
6451         (Incremental_inputs::inputs_section_): New data member.
6452         (Incremental_inputs::symtab_section_): New data member.
6453         (Incremental_inputs::relocs_section_): New data member.
6454         (Incremental_inputs::reloc_count_): New data member.
6455         (Incremental_inputs_reader): New class.
6456         (Incremental_symtab_reader): New class.
6457         (Incremental_relocs_reader): New class.
6458         * layout.cc (Layout::finalize): Move finalization of incremental info
6459         and creation of incremental info sections to follow finalization of
6460         symbol table.  Set offsets for postprocessing sections.
6461         (Layout::create_incremental_info_sections): Call
6462         Incremental_inputs::create_data_sections.  Add incremental symtab
6463         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6464         sections to layout after input sections.
6465         * layout.h (struct Timespec): Forward declaration.
6466         (Layout::incremental_inputs): Add const.
6467         (Layout::create_incremental_info_sections): Add parameter.
6468         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6469         * object.cc: Include incremental.h.
6470         (Relobj::finalize_incremental_relocs): New function.
6471         (Sized_relobj::do_layout): Record input sections in incremental info.
6472         * object.h (Object::output_section): New function.
6473         (Object::output_section_offset): Moved from Relobj.
6474         (Object::get_incremental_reloc_base): New function.
6475         (Object::get_incremental_reloc_count): New function.
6476         (Object::do_output_section): New function.
6477         (Object::do_output_section_offset): Moved from Relobj.
6478         (Object::do_get_incremental_reloc_base): New function.
6479         (Object::do_get_incremental_reloc_count): New function.
6480         (Object::Object): Initialize new data members.
6481         (Relobj::output_section): Renamed do_output_section and moved to
6482         protected.
6483         (Relobj::output_section_offset): Moved to Object.
6484         (Relobj::do_get_incremental_reloc_base): New function.
6485         (Relobj::do_get_incremental_reloc_count): New function.
6486         (Relobj::allocate_incremental_reloc_counts): New function.
6487         (Relobj::count_incremental_reloc): New function.
6488         (Relobj::finalize_incremental_relocs): New function.
6489         (Relobj::next_incremental_reloc_index): New function.
6490         (Relobj::reloc_counts_): New data member.
6491         (Relobj::reloc_bases_): New data member.
6492         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6493         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6494         (Sized_relobj::incremental_relocs_scan): New function.
6495         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6496         (Sized_relobj::incremental_relocs_write): New function.
6497         (Sized_relobj::incremental_relocs_write_reltype): New function.
6498         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6499         incremental link.
6500         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6501         archives and object files elsewhere.
6502         (Add_symbols::run): Report object files here.
6503         (Finish_group::run): Report end of archive at end of group.
6504         * reloc.cc: Include layout.h, incremental.h.
6505         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6506         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6507         (Sized_relobj::incremental_relocs_scan): New function.
6508         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6509         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6510         (Sized_relobj::incremental_relocs_write): New function.
6511         (Sized_relobj::incremental_relocs_write_reltype): New function.
6512         * script.cc (read_input_script): Rewrite test for incremental link.
6513         Change call to Incremental_inputs::report_script.
6514         * symtab.h (Symbol_table::first_global_index): New function.
6515         (Symbol_table::output_count): New function.
6516
6517 2010-08-12  Doug Kwan  <dougkwan@google.com>
6518
6519         * arm.cc (Target_arm::merge_object_attributes): Check command line
6520         options --no-wchar-size-warning and --no-enum-size-warning.
6521         * options.h (General_options): Add ld-compatible options
6522         --no-enum-size-warning and --no-wchar-size-warning.
6523
6524 2010-08-04  Ian Lance Taylor  <iant@google.com>
6525
6526         * x86_64.cc (Target_x86_64::Scan::local): Use
6527         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6528         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6529         (Target_x86_64::Scan::global): Likewise.
6530         (Target_x86_64::Relocate::relocate): Likewise.
6531         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6532         Likewise.
6533
6534 2010-08-03  Cary Coutant  <ccoutant@google.com>
6535
6536         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6537         to reserve space in merged_strings vector. Keep total input size
6538         for stats.
6539         (Output_merge_string::do_print_merge_stats): Print total input size.
6540         * merge.h (Output_merge_string): Add input_size_ field.
6541         * stringpool.cc (Stringpool_template::string_length): Move
6542         implementations out of Stringpool_template class and place in
6543         stringpool.h.
6544         * stringpool.h (string_length): Move out of Stringpool_template.
6545
6546 2010-08-03  Ian Lance Taylor  <iant@google.com>
6547
6548         PR 11712
6549         * layout.cc (relaxation_loop_body): If address of load segment is
6550         set, adjust address to include headers if possible.
6551
6552 2010-08-03  Ian Lance Taylor  <iant@google.com>
6553
6554         * version.cc (version_string): Bump to 1.10.
6555
6556 2010-08-03  Ian Lance Taylor  <iant@google.com>
6557
6558         PR 11805
6559         * layout.h (enum Output_section_order): Define.
6560         (class Layout): Update declarations.
6561         * layout.cc (Layout::get_output_section): Add order parameter.
6562         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6563         is_first_non_relro parameters.  Change all callers.
6564         (Layout::choose_output_section): Likewise.
6565         (Layout::add_output_section_data): Likewise.
6566         (Layout::make_output_section): Likewise.  Set order.
6567         (Layout::default_section_order): New function.
6568         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6569         * output.cc (Output_section::Output_section): Initialize order_.
6570         Don't initialize deleted fields.
6571         (Output_segment::Output_segment): Don't initialize deleted
6572         fields.
6573         (Output_segment::add_output_section_to_load): New function
6574         replacing add_output_section.  Change all callers to call this or
6575         add_output_section_to_nonload.
6576         (Output_segment::add_output_section_to_nonload): New function.
6577         (Output_segment::remove_output_section): Rewrite.
6578         (Output_segment::add_initial_output_data): Likewise.
6579         (Output_segment::has_any_data_sections): Likewise.
6580         (Output_segment::is_first_section_relro): Likewise.
6581         (Output_segment::maximum_alignment): Likewise.
6582         (Output_segment::has_dynamic_reloc): New function replacing
6583         dynamic_reloc_count.  Change all callers.
6584         (Output_segment::has_dynamic_reloc_list): New function replacing
6585         dynamic_reloc_count_list.  Change all callers.
6586         (Output_segment::set_section_addresses): Rewrite.
6587         (Output_segment::set_offset): Rewrite.
6588         (Output_segment::find_first_and_last_list): Remove.
6589         (Output_segment::set_tls_offsets): Rewrite.
6590         (Output_segment::first_section_load_address): Likewise.
6591         (Output_segment::output_section_count): Likewise.
6592         (Output_segment::section_with_lowest_load_address): Likewise.
6593         (Output_segment::write_section_headers): Likewise.
6594         (Output_segment::print_sections_to_map): Likewise.
6595         * output.h (class Output_data): Remove dynamic_reloc_count_
6596         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6597         (Output_data::add_dynamic_reloc): Rewrite.
6598         (Output_data::has_dynamic_reloc): New function.
6599         (Output_data::dynamic_reloc_count): Remove.
6600         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6601         is_last_relro_, is_first_non_relro_, is_interp_,
6602         is_dynamic_linker_section_ fields.  Add order and set_order
6603         functions.  Remove is_relro_local, set_is_relro_local,
6604         is_last_relro, set_is_last_relro, is_first_non_relro,
6605         set_is_first_non_relro functions, is_interp, set_is_interp,
6606         is_dynamic_linker_section, and set_is_dynamic_linker_section
6607         functions.
6608         (class Output_segment): Change Output_data_list from std::list to
6609         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6610         output_bss_ fields.  Update declarations.
6611
6612 2010-08-02  Ian Lance Taylor  <iant@google.com>
6613
6614         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6615         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6616         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6617
6618 2010-08-02  Ian Lance Taylor  <iant@google.com>
6619
6620         PR 11855
6621         * script.cc (Script_options::Script_options): Initialize
6622         symbol_definitions_ and symbol_references_.
6623         (Script_options::add_symbol_assignment): Update
6624         symbol_definitions_ and symbol_references_.
6625         (Script_options::add_symbol_reference): New function.
6626         (script_symbol): New function.
6627         * script.h (class Script_options): Add symbol_definitions_ and
6628         symbol_references_ fields.
6629         (Script_options::referenced_const_iterator): New type.
6630         (Script_options::referenced_begin): New function.
6631         (Script_options::referenced_end): New function.
6632         (Script_options::is_referenced): New function.
6633         (Script_options::any_unreferenced): New function.
6634         * script-c.h (script_symbol): Declare.
6635         * yyscript.y (exp): Call script_symbol.
6636         * symtab.cc: Include "script.h".
6637         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6638         Change all callers.  Check symbols referenced by scripts.
6639         (Symbol_table::add_undefined_symbols_from_command_line): Add
6640         layout parameter.  Change all callers.
6641         (Symbol_table::do_add_undefined_symbols_from_command_line):
6642         Likewise.  Break out loop body.  Check symbols referenced by
6643         scripts.
6644         (Symbol_table::add_undefined_symbol_from_command_line): New
6645         function broken out of
6646         do_add_undefined_symbols_from_command_line.
6647         * symtab.h (class Symbol_table): Update declarations.
6648         * archive.cc: Include "layout.h".
6649         (Archive::should_include_member): Add layout parameter.  Change
6650         all callers.  Check for symbol mentioned in expression.
6651         * archive.h (class Archive): Update declaration.
6652         * object.cc (Sized_relobj::do_should_include_member): Add layout
6653         parameter.
6654         * object.h (Object::should_include_member): Add layout parameter.
6655         Change all callers.
6656         (Object::do_should_include_member): Add layout parameter.
6657         (class Sized_relobj): Update declaration.
6658         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6659         parameter.
6660         * dynobj.h (class Sized_dynobj): Update declaration.
6661         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6662         layout parameter.
6663         * plugin.h (class Sized_pluginobj): Update declaration.
6664
6665 2010-08-02  Ian Lance Taylor  <iant@google.com>
6666
6667         PR 11866
6668         * output.cc (Output_segment::set_offset): Search for the first and
6669         last sections rather than assuming that the list is in order.
6670         (Output_segment::find_first_and_last_list): New function.
6671         * output.h (class Output_segment): Update declarations.
6672         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6673         (relro_strip_test_SOURCES): New variable.
6674         (relro_strip_test_DEPENDENCIES): New variable.
6675         (relro_strip_test_LDFLAGS): New variable.
6676         (relro_strip_test_LDADD): New variable.
6677         (relro_strip_test.so): New target.
6678
6679 2010-08-02  Ian Lance Taylor  <iant@google.com>
6680
6681         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6682         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6683         (Target_i386::got_tlsdesc_section): New function.
6684         (Target_i386::got_section): Create space for GOT entries for
6685         TLSDESC relocations.
6686         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6687         R_386_TLS_GOTDESC.
6688         (Target_i386::Scan::global): Likewise.
6689         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6690         using TLSDESC GOT.
6691         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6692         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6693         (Target_x86_64::got_tlsdesc_section): New function.
6694         (Target_x86_64::got_section): Create space for GOT entries for
6695         TLSDESC relocations.
6696         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6697         R_386_TLS_GOTDESC.
6698         (Target_x86_64::Scan::global): Likewise.
6699         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6700         using TLSDESC GOT.
6701
6702 2010-08-02  Ian Lance Taylor  <iant@google.com>
6703
6704         * testsuite/final_layout.sh: Use dc to convert from hex to
6705         decimal.
6706
6707 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6708
6709         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6710         paramter to the call to gold::gc_process_relocs.
6711         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6712         paramter to the call to gold::gc_process_relocs.
6713         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6714         parameter to the call to gold::gc_process_relocs.
6715         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6716         template parameter to the call to gold::gc_process_relocs.
6717         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6718         paramter to the call to gold::gc_process_relocs.
6719         * gc.h (get_embedded_addend_size): New function.
6720         (gc_process_relocs): Save the size of the reloc for use by ICF.
6721         * icf.cc (get_section_contents): Get the addend from the text section
6722         for SHT_REL relocation sections.
6723         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6724         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6725         * int_encoding.h (read_from_pointer): New overloaded function.
6726         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6727         * testsuite/icf_sht_rel_addend_test.sh: New file.
6728         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6729         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6730
6731 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6732
6733         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6734         * Makefile.in: Regenerate.
6735         * testsuite/Makefile.in: Regenerate.
6736
6737 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6738
6739         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6740         * gold/testsuite/debug_msg.cc: Likewise.
6741         * gold/testsuite/odr_violation1.cc
6742         * gold/testsuite/odr_violation2.cc
6743
6744 2010-07-21  Cary Coutant  <ccoutant@google.com>
6745
6746         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6747         string, and length fields.
6748         (Output_merge_string::Merged_strings_list): New type.
6749         (Output_merge_string::Merged_strings_lists): New typedef.
6750         (Output_merge_string): Replace merged_strings_ with
6751         merged_strings_lists_.
6752         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6753         Merged_strings_list per input object and section.  Don't store pointer
6754         to the string.  Don't store length with each merged string entry.
6755         (Output_merge_string::finalize_merged_data): Loop over list of merged
6756         strings lists.  Recompute length of each merged string.
6757
6758 2010-07-15  Cary Coutant  <ccoutant@google.com>
6759
6760         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6761         here.
6762
6763 2010-07-14  Ian Lance Taylor  <iant@google.com>
6764
6765         * descriptors.cc (Descriptors::open): Report correct name in error
6766         message.
6767
6768 2010-07-13  Doug Kwan  <dougkwan@google.com>
6769
6770         * arm.cc (Arm_input_section::Arm_input_section): For a
6771         SHT_ARM_EXIDX section, always keeps the input sections.
6772         (Arm_input_section::set_exidx_section_link): New method.
6773         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6774         has_errors_ to false.
6775         (Arm_exidx_input_section::has_errors,
6776         Arm_exidx_input_section::set_has_errors): New methods.
6777         (Arm_exidx_input_section::has_errors_): New data member.
6778         (Arm_relobj::get_exidx_shndx_list): New method.
6779         (Arm_output_section::append_text_sections_to_list): Do not skip
6780         section without SHF_EXECINSTR.
6781         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6782         errors.
6783         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6784         section header.  Make error messages more verbose.  Check for
6785         a non-executable section linked to an EXIDX section.
6786         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6787         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6788         check that there is no deferred EXIDX section if we exit early.
6789         Instead of not making an EXIDX section in case of an error, make one
6790         and set the has_errors flag of it.
6791         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6792         in a relocatable link.
6793         (Target_arm::do_relax): Look for the EXIDX output section instead of
6794         assuming that it is called .ARM.exidx.
6795         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6796         section list.  Do not check for SHF_EXECINSTR section flags but
6797         skip any input section with errors.
6798         * output.cc (Output_section::Output_section): Initialize
6799         always_keeps_input_sections_ to false.
6800         (Output_section::add_input_section): Check for
6801         always_keeps_input_sections_.
6802         *  output.h (Output_section::always_keeps_input_sections,
6803         Output_section::set_always_keeps_input_sections): New methods.
6804         (Output_section::always_keeps_input_sections): New data member.
6805
6806 2010-07-13  Rafael Espindola  <espindola@google.com>
6807
6808         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6809         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6810
6811 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6812             Ian Lance Taylor  <iant@google.com>
6813
6814         * output.h (Output_section_lookup_maps::add_merge_section):
6815         Correct check of whether value was inserted.
6816         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6817         (Output_section_lookup_maps::add_relaxed_input_section):
6818         Likewise.
6819         * arm.cc (Target_arm::got_section): Remove used local os.
6820         * i386.cc (Target_i386::got_section): Likewise.
6821         * x86_64.cc (Target_x86_64::got_section): Likewise.
6822         * sparc.cc (Target_sparc::got_section): Likewise.
6823         (Target_sparc::relocate): Remove unused local have_got_offset.
6824         * powerpc.cc (Target_powerpc::relocate): Likewise.
6825
6826 2010-07-13  Ian Lance Taylor  <iant@google.com>
6827
6828         * compressed_output.cc (zlib_decompress): Fix signature in
6829         !HAVE_ZLIB_H case.
6830
6831         * archive.cc (Archive::include_member): Unlock an external member
6832         of a thin archive.  Don't bother to delete an object we know is
6833         NULL.
6834
6835 2010-07-12  Cary Coutant  <ccoutant@google.com>
6836
6837         * compressed_output.cc (zlib_decompress): New function.
6838         (get_uncompressed_size): New function.
6839         (decompress_input_section): New function.
6840         * compressed_output.h (get_uncompressed_size): New function.
6841         (decompress_input_section): New function.
6842         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6843         Handle compressed debug sections.
6844         * layout.cc (is_compressed_debug_section): New function.
6845         (Layout::output_section_name): Map compressed section names to
6846         canonical names.
6847         * layout.h (is_compressed_debug_section): New function.
6848         (is_debug_info_section): Recognize compressed debug sections.
6849         * merge.cc: Include compressed_output.h.
6850         (Output_merge_data::do_add_input_section): Handle compressed
6851         debug sections.
6852         (Output_merge_string::do_add_input_section): Handle compressed
6853         debug sections.
6854         * object.cc: Include compressed_output.h.
6855         (Sized_relobj::Sized_relobj): Initialize new data members.
6856         (build_compressed_section_map): New function.
6857         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6858         * object.h (Object::section_is_compressed): New method.
6859         (Object::do_section_is_compressed): New method.
6860         (Sized_relobj::Compressed_section_map): New type.
6861         (Sized_relobj::do_section_is_compressed): New method.
6862         (Sized_relobj::compressed_sections_): New data member.
6863         * output.cc (Output_section::add_input_section): Handle compressed
6864         debug sections.
6865         * reloc.cc: Include compressed_output.h.
6866         (Sized_relobj::write_sections): Handle compressed debug sections.
6867
6868 2010-07-08  Cary Coutant  <ccoutant@google.com>
6869
6870         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6871         weak when resolving to a dynamic def.
6872         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6873         for weak undef/dynamic def cases. Adjust callers.
6874         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6875         undef_binding_weak_.
6876         (Symbol_table::sized_write_globals): Adjust symbol binding.
6877         (Symbol_table::sized_write_symbol): Add binding parameter.
6878         * symtab.h (Symbol::set_undef_binding): New method.
6879         (Symbol::is_undef_binding_weak): New method.
6880         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6881         (Symbol_table::should_override): Add new parameter.
6882         (Symbol_table::sized_write_symbol): Add new parameter.
6883
6884         * testsuite/weak_undef_file1.cc: Add new test case.
6885         * testsuite/weak_undef_file2.cc: Fix header comment.
6886         * testsuite/weak_undef_test.cc: Add new test case.
6887
6888 2010-06-29  Doug Kwan  <dougkwan@google.com>
6889
6890         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6891         Initialize USE_SYMBOL_.
6892         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6893         definition.
6894         (Arm_reloc_property::uses_symbol_): New data member declaration.
6895         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6896         uses symbol value and symbol is undefined but not weakly undefined.
6897
6898 2010-06-28  Rafael Espindola  <espindola@google.com>
6899
6900         * plugin.cc (Plugin::load): Use dlerror.
6901
6902 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6903
6904         * symtab.cc (detect_odr_violations): When reporting an ODR
6905         violation, report an object where the symbol is defined.
6906
6907 2010-06-25  Doug Kwan  <dougkwan@google.com>
6908
6909         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6910         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6911         definition.
6912         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6913         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6914         target hook to detect function points.
6915         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6916         * icf.h (Icf::check_section_for_function_pointers): Change type of
6917         parameter SECTION_NAME to const reference to std::string.  Use
6918         target hook to determine if section may have unsafe pointers.
6919         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6920         method definition.
6921
6922 2010-06-21  Rafael Espindola  <espindola@google.com>
6923
6924         * fileread.cc (Input_file::find_fie): New
6925         (Input_file::open): Use Input_file::find_fie.
6926         * fileread.h (Input_file::find_fie): New
6927         * plugin.cc (set_extra_library_path): New.
6928         (Plugin::load): Add set_extra_library_path to the transfer vector.
6929         (Plugin_manager::set_extra_library_path): New.
6930         (Plugin_manager::add_input_file): Use the extra search path if set.
6931         (set_extra_library_path(): New.
6932         * plugin.h (Plugin_manager): Add set_extra_library_path and
6933         extra_search_path_.
6934
6935 2010-06-19  Cary Coutant  <ccoutant@google.com>
6936
6937         * layout.cc (gdb_sections): Add .debug_types.
6938         (lines_only_debug_sections): Likewise.
6939
6940 2010-06-18  Rafael Espindola  <espindola@google.com>
6941
6942         * plugin.cc (add_input_file,add_input_library)
6943         (Plugin_manager::add_input_file): Make filename arguments const.
6944         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6945         const.
6946
6947 2010-06-16  Doug Kwan  <dougkwan@google.com>
6948
6949         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6950         .ARM.attributes section if we have not merged any input
6951         attributes sections.
6952
6953 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6954
6955         * arm.cc: Allow combining objects with no EABI version
6956         information.
6957
6958 2010-06-15  Rafael Espindola  <espindola@google.com>
6959
6960         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6961
6962 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6963
6964         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6965         (struct iovec): Correct !HAVE_READV definition.
6966
6967 2010-06-10  Cary Coutant  <ccoutant@google.com>
6968
6969         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6970         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6971         reloc sections.
6972         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6973
6974         PR 11683
6975         * symtab.h (Symbol::is_placeholder): New member function.
6976         * target-reloc.h (relocate_section): Check for placeholder symbols.
6977
6978         * testsuite/Makefile.am (plugin_test_8): New test.
6979         (plugin_test_9): New test.
6980         * testsuite/Makefile.in: Regenerate.
6981
6982 2010-06-09  Nick Clifton  <nickc@redhat.com>
6983
6984         * yyscript.y (input_list_element): Allow strings prefixed with
6985         the '-' character.  Treat these as libraries.
6986         * script.cc (script_add_library): New function.  Adds a library
6987         specified by "-l<name>" found in an input script.
6988         * script-c.h: Add prototype for script_add_library.
6989
6990 2010-06-07  Doug Kwan  <dougkwan@google.com>
6991
6992         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6993         Restrict stub-group size to be within long conditional branch
6994         range when working around cortex-A8 erratum.
6995
6996 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6997
6998         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6999         #ifdef typo.
7000
7001 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7002
7003         PR gold/11658
7004         * output.cc
7005         (Output_section::Input_section_sort_entry::compare_section_ordering):
7006         Change to return non-zero correctly.
7007         (Output_section::Input_section_sort_section_order_index_compare
7008         ::operator()): Change to fix ambiguity in comparisons.
7009
7010 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7011
7012         * gold.h (is_wildcard_string): New function.
7013         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7014         (Layout::layout_eh_frame): Ditto.
7015         (Layout::find_section_order_index): New method.
7016         (Layout::read_layout_from_file): New method.
7017         * layout.h (Layout::find_section_order_index): New method.
7018         (Layout::read_layout_from_file): New method.
7019         (Layout::input_section_position_): New private member.
7020         (Layout::input_section_glob_): New private member.
7021         * main.cc (main): Call read_layout_from_file here.
7022         * options.h (--section-ordering-file): New option.
7023         * output.cc (Output_section::input_section_order_specified_): New
7024         member.
7025         (Output_section::Output_section): Initialize new member.
7026         (Output_section::add_input_section): Add new parameter.
7027         Keep input sections when --section-ordering-file is used.
7028         (Output_section::set_final_data_size): Sort input sections when
7029         section ordering file is specified.
7030         (Output_section::Input_section_sort_entry): Add new parameter.
7031         Check sorting type.
7032         (Output_section::Input_section_sort_entry::compare_section_ordering):
7033         New method.
7034         (Output_section::Input_section_sort_compare::operator()): Change to
7035         consider section_order_index.
7036         (Output_section::Input_section_sort_init_fini_compare::operator()):
7037         Change to consider section_order_index.
7038         (Output_section::Input_section_sort_section_order_index_compare
7039         ::operator()): New method.
7040         (Output_section::sort_attached_input_sections): Change to sort
7041         according to section order when specified.
7042         (Output_section::add_input_section<32, true>): Add new parameter.
7043         (Output_section::add_input_section<64, true>): Add new parameter.
7044         (Output_section::add_input_section<32, false>): Add new parameter.
7045         (Output_section::add_input_section<64, false>): Add new parameter.
7046         * output.h (Output_section::add_input_section): Add new parameter.
7047         (Output_section::input_section_order_specified): New
7048         method.
7049         (Output_section::set_input_section_order_specified): New method.
7050         (Input_section::Input_section): Initialize section_order_index_.
7051         (Input_section::section_order_index): New method.
7052         (Input_section::set_section_order_index): New method.
7053         (Input_section::section_order_index_): New member.
7054         (Input_section::Input_section_sort_section_order_index_compare): New
7055         struct.
7056         (Output_section::input_section_order_specified_): New member.
7057         * script-sections.cc (is_wildcard_string): Delete and move modified
7058         method to gold.h.
7059         (Output_section_element_input::Output_section_element_input): Modify
7060         call to is_wildcard_string.
7061         (Output_section_element_input::Input_section_pattern
7062         ::Input_section_pattern): Ditto.
7063         (Output_section_element_input::Output_section_element_input): Ditto.
7064         * testsuite/Makefile.am (final_layout): New test case.
7065         * testsuite/Makefile.in: Regenerate.
7066         * testsuite/final_layout.cc: New file.
7067         * testsuite/final_layout.sh: New file.
7068
7069 2010-06-01  Rafael Espindola  <espindola@google.com>
7070
7071         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7072
7073 2010-06-01  Rafael Espindola  <espindola@google.com>
7074
7075         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7076         visibility of symbols.
7077
7078 2010-05-27  Doug Kwan  <dougkwan@google.com>
7079
7080         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7081         from start of output section instead of address for a local symbol
7082         in a merged or relaxed section when doing a relocatable link.
7083
7084 2010-05-26  Rafael Espindola  <espindola@google.com>
7085
7086         PR 11604
7087         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7088         adding sections the garbage collector removed.
7089         * gold/testsuite/Makefile.am: Add test.
7090         * gold/testsuite/Makefile.in: Regenerate.
7091         * gold/testsuite/plugin_test_7.sh: New.
7092         * gold/testsuite/plugin_test_7_1.c: New.
7093         * gold/testsuite/plugin_test_7_2.c: New.
7094
7095 2010-05-26  Rafael Espindola  <espindola@google.com>
7096
7097         * script-sections.cc (Output_section_definition::set_section_addresses):
7098         Check for --section-start.
7099
7100 2010-05-26  Doug Kwan  <dougkwan@google.com>
7101
7102         * arm.cc (Arm_scan_relocatable_relocs): New class.
7103         (Target_arm::relocate_special_relocatable): New method.
7104         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7105         (Arm_relocate_functions::thumb_branch_common): Same.
7106         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7107         instead of Default_scan_relocatable_relocs.
7108         * target-reloc.h (relocate_for_relocatable): Let target handle
7109         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7110         * target.h (Sized_target::relocate_special_relocatable): New method.
7111
7112 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7113
7114         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7115
7116 2010-05-23  Doug Kwan  <dougkwan@google.com>
7117
7118         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7119         instead of a cast.
7120         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7121         with a direct branch, not a conditional branch, to a stub.
7122         * merge.cc (Output_merge_base::record_input_section): New method
7123         defintion.
7124         (Output_merge_data::do_add_input_section): Record input section if
7125         keeps-input-sections flag is set.
7126         (Output_merge_string::do_add_input_section): Ditto.
7127         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7128         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7129         INPUT_SECTIONS_.
7130         (Output_merge_base::keeps_input_sections,
7131         Output_merge_base::set_keeps_input_sections,
7132         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7133         method definitions.
7134         (Output_merge_base::Input_sections): New type declaration.
7135         (Output_merge_base::input_sections_begin,
7136         Output_merge_base::input_sections_end,
7137         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7138         (Output_merge_base::bool keeps_input_sections_,
7139         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7140         Output_merge_base::input_sections_): New data members.
7141         (Output_merge_data::do_set_keeps_input_sections): New method
7142         defintion.
7143         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7144         * output.cc (Output_section::Input_section::relobj): Move method
7145         defintion from class declaration to here and handle merge sections.
7146         (Output_section::Input_section::shndx): Ditto.
7147         (Output_section::Output_section): Remove initializations of removed
7148         data members and initialize new data member LOOKUP_MAPS_.
7149         (Output_section::add_input_section): Set keeps-input-sections flag
7150         for a newly created merge output section as appropriate.  Adjust code
7151         to use Output_section_lookup_maps class.
7152         (Output_section::add_relaxed_input_section): Adjst code for lookup
7153         maps code refactoring.
7154         (Output_section::add_merge_input_section): Add a new parameter
7155         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7156         class.  If adding input section to a newly created merge output
7157         section fails, remove the new merge section.
7158         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7159         Adjust code for use of the Output_section_lookup_maps class.
7160         (Output_section::find_merge_section): Ditto.
7161         (Output_section::build_lookup_maps): New method defintion.
7162         (Output_section::find_relaxed_input_section): Adjust code to use
7163         Output_section_lookup_maps class.
7164         (Output_section::get_input_sections): Export merge sections.  Adjust
7165         code to use Output_section_lookup_maps class.
7166         (Output_section:::add_script_input_section): Adjust code to use
7167         Output_section_lookup_maps class.  Update lookup maps for merge
7168         sections also.
7169         (Output_section::discard_states): Use Output_section_lookup_maps.
7170         (Output_section::restore_states): Same.
7171         * output.h (Merge_section_properties): Move class defintion out of
7172         Output_section.
7173         (Output_section_lookup_maps): New class.
7174         (Output_section::Input_section::is_merge_section): New method
7175         defintion.
7176         (Output_section::Input_section::relobj): Move defintion out of class
7177         defintion.  Declare method only.
7178         (Output_section::Input_section::shndx): Ditto.
7179         (Output_section::Input_section::output_merge_base): New method defintion.
7180         (Output_section::Input_section::u2_.pomb): New union field.
7181         (Output_section::Merge_section_by_properties_map,
7182         Output_section::Output_section_data_by_input_section_map,
7183         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7184         Remove types.
7185         (Output_section::add_merge_input_section): Add new parameter
7186         KEEPS_INPUT_SECTIONS.
7187         (Output_section::build_lookup_maps): New method declaration.
7188         (Output_section::merge_section_map_,
7189         Output_section::merge_section_by_properties_map_,
7190         Output_section::relaxed_input_section_map_,
7191         Output_section::is_relaxed_input_section_map_valid_): Remove data
7192         members.
7193         (Output_section::lookup_maps_): New data member.
7194
7195 2010-05-21  Doug Kwan  <dougkwan@google.com>
7196
7197         PR gold/11619
7198         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7199         avoid a compilation error.
7200
7201 2010-05-19  Rafael Espindola  <espindola@google.com>
7202
7203         * script-sections.cc (Output_section_definition::allocate_to_segment):
7204         Update the phdrs_list even when the output section is NULL.
7205         * testsuite/Makefile.am: Add test.
7206         * testsuite/Makefile.in: Regenerate.
7207         * testsuite/script_test_9.cc: New.
7208         * testsuite/script_test_9.sh: New.
7209         * testsuite/script_test_9.t: New.
7210
7211 2010-05-19  Doug Kwan  <dougkwan@google.com>
7212
7213         * arm.cc (Arm_input_section::original_size): New method.
7214         (Arm_input_section::do_addralign): Add a cast.
7215         (Arm_input_section::do_output_offset): Remove static cast.
7216         (Arm_input_section::original_addralign,
7217          Arm_input_section::original_size_): Change type to uint32_t.
7218         (Arm_input_section::init): Add safe casts for section alignment
7219         and size.
7220         (Arm_input_section::set_final_data_size): Do not set address and
7221         offset of stub table.
7222         (Arm_output_section::fix_exidx_coverage): Change use of of
7223         Output_section::Simple_input_section to that of
7224         Output_section::Input_section.
7225         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7226         except for the first pass.
7227         * output.cc (Output_section::get_input_sections): Change type of
7228         input_sections to std::list<Input_section>.
7229         (Output_section::add_script_input_section): Rename from
7230         Output_section::add_simple_input_section.  Change type of SIS
7231         parameter from Simple_input_section to Input_section.
7232         * output.h (Output_section::Simple_input_section): Remove class.
7233         (Output_section::Input_section): Change class visibility to public.
7234         (Output_section::Input_section::addralign): Use stored alignments
7235         for special input sections if set.
7236         (Output_section::Input_section::set_addralign): New method.
7237         (Output_section::get_input_sections): Change parameter type from
7238         list of Simple_input_section to list of Input_section.
7239         (Output_section::add_script_input_section): Rename from
7240         Output_section::add_simple_input_section. Change first parameter's
7241         type from Simple_input_section to Input_section and remove the
7242         second and third parameters.
7243         * script-sections.cc (Input_section::Input_section_list): Change
7244         type to list of Output_section::Input_section/
7245         (Input_section_info::Input_section_info): Change parameter type of
7246         INPUT_SECTION to Output_section::Input_section.
7247         (Input_section_info::input_section): Change return type.
7248         (Input_section_info::input_section_): Change type to
7249         Output_section::Input_section.
7250         (Output_section_element_input::set_section_addresses): Adjust code
7251         to use Output_section::Input_section instead of
7252         Output_section::Simple_input_section.  Adjust code for renaming
7253         of Output_section::add_simple_input_section.
7254         (Orphan_output_section::set_section_addresses): Ditto.
7255
7256 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7257
7258         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7259         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7260
7261 2010-05-18  Rafael Espindola  <espindola@google.com>
7262
7263         * options.cc (General_options::finalize): Handle -nostdlib.
7264         * options.h (nostdlib): New option.
7265         * script.cc (script_add_search_dir): Handle -nostdlib.
7266
7267 2010-05-12  Doug Kwan  <dougkwan@google.com>
7268
7269         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7270         attributes section only if there no attributes section after merging.
7271         (Target_arm::merge_object_attributes): Move value of
7272         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7273         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7274         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7275         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7276         and arm_attr_merge_7.stdout.
7277         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7278         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7279         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7280         arm_attr_merge_7b.o): New rules.
7281         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7282         arm_attr_merge_7
7283         * testsuite/Makefile.in: Regenerate.
7284         * testsuite/arm_attr_merge.sh: New file.
7285         * testsuite/arm_attr_merge_[67][ab].s: Same.
7286
7287 2010-05-05  Nick Clifton  <nickc@redhat.com>
7288
7289         * po/es.po: Updated Spanish translation.
7290
7291 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7292
7293         * Makefile.am (install-exec-local): Properly install gold as
7294         default cross linker.
7295         * Makefile.in: Regenerated.
7296
7297 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7298             Nick Clifton  <nickc@redhat.com>
7299
7300         * configure.ac (install_as_default): Define and set to false
7301         unless --enable-gold or --enable-gold=both/gold has been
7302         specified.
7303         * configure: Regenerate.
7304
7305         * Makefile.am (install-exec-local): Install the executable as
7306         'ld.gold'.  If install_as_default is true then also install it as
7307         'ld'.
7308         * Makefile.in: Regenerated.
7309
7310 2010-04-24  Ian Lance Taylor  <iant@google.com>
7311
7312         * layout.cc (Layout::layout_reloc): In relocatable link don't
7313         combine reloc sections for grouped sections.
7314
7315 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7316
7317         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7318         sections that are not ordinary to icf.
7319         * icf.cc (get_section_contents): Handle relocation pointing to section
7320         with no object or shndx information.
7321         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7322         * testsuite/Makefile.in: Regenerate.
7323         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7324         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7325
7326 2010-04-22  Ian Lance Taylor  <iant@google.com>
7327
7328         * expression.cc (Expression::Expression_eval_info): Add
7329         result_alignment_pointer field.
7330         (Expression::eval_with_dot): Add result_alignment_pointer
7331         parameter.  Change all callers.
7332         (Expression::eval_maybe_dot): Likewise.
7333         (class Binary_expression): Add alignment_pointer parameter to
7334         left_value and right_value.  Change all callers.
7335         (BINARY_EXPRESSION): Set result alignment.
7336         (class Trinary_expression): Add alignment_pointer parameter to
7337         arg2_value and arg3_value.  Change all callers.
7338         (Trinary_cond::value): Set result alignment.
7339         (Max_expression::value, Min_expression::value): Likewise.
7340         (Align_expression::value): Likewise.
7341         * script-sections.cc (class Sections_element): Add dot_alignment
7342         parameter to set_section_addresses virtual function.  Update
7343         instantiations.
7344         (class Output_section_element): Likewise.
7345         (Script_sections::create_segments): Add dot_alignment parameter.
7346         Change all callers.
7347         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7348         (Script_sections::set_phdrs_clause_addresses): Likewise.
7349         * script-sections.h: Update declarations.
7350         * script.h: Update declarations.
7351         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7352         min_p_align.
7353         * testsuite/script_test_3.t: Set large alignment.
7354         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7355         segment has expected alignment.
7356
7357 2010-04-22  Nick Clifton  <nickc@redhat.com>
7358
7359         * po/gold.pot: Updated by the Translation project.
7360         * po/vi.po: Updated Vietnamese translation.
7361
7362 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7363
7364         * testsuite/Makefile.am (check_PROGRAMS): Add
7365         icf_virtual_function_folding_test.
7366         * testsuite/Makefile.in: Regenerated.
7367
7368 2010-04-15  Andrew Haley  <aph@redhat.com>
7369
7370         * options.h (merge_exidx_entries): New option.
7371         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7372         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7373         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7374         (Target_arm::merge_exidx_entries): New function.
7375         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7376         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7377         to Arm_exidx_fixup constructor.
7378         Add new arg, merge_exidx_entries.
7379         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7380         Arm_output_section::fix_exidx_coverage.
7381
7382 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7383
7384         * icf.cc (get_section_contents): Check for preemptible functions.
7385         Ignore addend when appropriate.
7386         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7387         section folded.
7388         (add_from_relobj): Check for section folded.
7389         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7390         * symtab.h (should_add_dynsym_entry): Add new parameter.
7391         * target-reloc.h (scan_relocs): Check for section folded.
7392         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7393         Check reloc types for function pointers in shared objects.
7394         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7395         case.
7396         (icf_preemptible_functions_test): New test case.
7397         (icf_string_merge_test): New test case.
7398         * testsuite.Makefile.in: Regenerate.
7399         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7400         bar_glob.  Refactor code.
7401         * testsuite/icf_preemptible_functions_test.cc: New file.
7402         * testsuite/icf_preemptible_functions_test.sh: New file.
7403         * testsuite/icf_string_merge_test.cc: New file.
7404         * testsuite/icf_string_merge_test.sh: New file.
7405         * testsuite/icf_virtual_function_folding_test.cc: New file.
7406         * testsuite/icf_virtual_function_folding_test.sh: New file.
7407
7408 2010-04-14  Doug Kwan  <dougkwan@google.com>
7409
7410         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7411         for local symbol recounting if we remove a section due to ICF.
7412         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7413         there are no regular objects in input.
7414
7415 2010-04-13  Doug Kwan  <dougkwan@google.com>
7416
7417         * arm.cc (Arm_input_section::set_final_data_size): Compute
7418         accurate final data size instead of using current data size.
7419
7420 2010-04-09  Doug Kwan  <dougkwan@google.com>
7421
7422         * layout.cc (Layout::choose_output_section): Handle script section
7423         types.
7424         (Layout::make_output_section_for_script): Add section type parameter.
7425         Handle script section types.
7426         * layout.h (Layout::make_output_section_for_script): Add section
7427         type parameter.
7428         * output.cc (Output_section::Output_section): Initialize data member
7429         is_noload_.
7430         (Output_section::do_reset_address_and_file_offset): Do not set address
7431         to 0 if section is a NOLOAD section.
7432         * output.h (Output_section::is_noload): New method.
7433         (Output_section::set_is_noload): Ditto.
7434         (Output_section::is_noload_): New data member.
7435         * script-c.h (Script_section_type): New enum type.
7436         (struct Parser_output_section_header): Add new file section_type.
7437         * script-sections.cc (Sections_element::output_section_name): Add
7438         parameter for returning script section type.
7439         (Output_section_definition::output_section_name): Ditto.
7440         (Output_section_definition::section_type)P; New method.
7441         (Output_section_definiton::script_section_type_name): Ditto.
7442         (Output_section_definition::script_section_type_): New data member.
7443         (Output_section_definition::Output_section_definition): Initialize
7444         data member Output_section_definition::script_section_type_.
7445         (Output_section_definition::create_sections): Pass script section type
7446         to Layout::make_output_section_for_script.
7447         (Output_section_definition::output_section_name): Return script
7448         section type to caller.
7449         (Output_section_definition::set_section_address): Do not advance
7450         dot value and load address if section type is NOLOAD.  Set address
7451         of NOLOAD sections regardless of section flags.
7452         (Output_section_definition::print): Print section type if it is
7453         not SCRIPT_SECTION_TYPE_NONE.
7454         (Output_section_definition::section_type): New method.
7455         (Output_section_definition::script_section_type_name): Ditto.
7456         (Script_sections::output_section_name): Add new parameter
7457         PSECTION_TYPE for returning script section type.  Pass it to
7458         section elements.  Handle discard sections.
7459         (Sort_output_sections::operator()): Handle NOLOAD sections.
7460         * script-sections.h (Script_sections::Section_type): New enum type.
7461         (Script_sections::output_section_name): Add a new parameter for
7462         returning script section type.
7463         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7464         INFO and NOLOAD.
7465         * yyscript.y (union): Add new field SECTION_TYPE.
7466         (COPY, DSECT, INFO, NOLOAD): New tokens.
7467         (opt_address_and_section_type): Change type to output_section_header.
7468         (section_type): New non-terminal
7469         (section_header): Handle section type.
7470         (opt_address_and_section_type): Return section type value.
7471
7472 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7473
7474         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7475         * testsuite/plugin_common_test_2.c (foo): Likewise.
7476
7477 2010-04-08  Doug Kwan  <dougkwan@google.com>
7478
7479         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7480         Output_merge_data.
7481         * output.cc (Output_section::add_merge_input_section): Simplify
7482         code and return status of Output_merge_base::add_input_section.
7483         Update merge section map only if Output_merge_base::add_input_section
7484         returns true.
7485
7486 2010-04-07  Doug Kwan  <dougkwan@google.com>
7487
7488         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7489         if section is marked as containing instructions but has no mapping
7490         symbols.
7491         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7492         correct section index.
7493         (Arm_relobj::find_linked_text_section): Ditto.
7494
7495 2010-04-07  Cary Coutant  <ccoutant@google.com>
7496
7497         * archive.cc (include_member): Destroy Read_symbols_data object before
7498         releasing file.
7499         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7500         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7501         (Read_symbols_data::~Read_symbols_data) New destructor.
7502         (Section_relocs::Section_relocs) New constructor.
7503         (Section_relocs::~Section_relocs) New destructor.
7504         (Read_relocs_data::Read_relocs_data) New constructor.
7505         (Read_relocs_data::~Read_relocs_data) New destructor.
7506         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7507         pointers to NULL after deleting.
7508
7509 2010-04-07  Doug Kwan  <dougkwan@google.com>
7510
7511         * arm.cc: Replace "endianity" with "endianness" in comments.
7512         (Arm_exidx_cantunwind): Ditto.
7513         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7514         (Arm_relobj::merge_flags_and_attributes): New method.
7515         (Arm_relobj::merge_flags_and_attributes_): New data member.
7516         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7517         (Arm_relobj::scan_sections_for_stubs): Ditto.
7518         (Arm_relobj::do_read_symbols): Check to see if we really want to
7519         merge processor-specific flags and attributes.  Exit early if
7520         an object is empty except for section names and the undefined symbol.
7521         (Target_arm::do_finalize_sections): Move check for ELF format to
7522         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7523         attributes from a regular object only when we have determined that
7524         it is aapropriate.  Do not create an .ARM.attributes section in
7525         output if there is no regular input object.
7526         (Target_arm::merge_processor_specific_flags): Check
7527         --warn-mismatch before printing any error.
7528         (Target_arm::merge_object_attributes): Ditto.
7529         * gold.cc (queue_middle_tasks): Handle the case in which there is
7530         no regular object in input.
7531         * options.cc (General_options::parse_EB): New method.
7532         (General_options::parse_EL): Same.
7533         (General_options::General_options): Initialize endianness_.
7534         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7535         New options.
7536         (General_options::Endianness): New enum.
7537         (General_options::endianness): New method.
7538         (General_options::endianness_): New data member.
7539         * parameters.cc (Parameters::set_options): Check target endianness.
7540         (Parameters::set_target_once): Ditto.
7541         (Parameters::check_target_endianness): New method.
7542         (parameters_force_valid_target): If either -EL or -EB is specified,
7543         use it to define endianness of default target.
7544         * parameters.h (Parameters::check_target_endianness): New method
7545         declaration.
7546         * target.h (class Target): Change "endianity" to "endianness"
7547         in comments.
7548
7549 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7550
7551         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7552         * configure: Regenerate.
7553         * Makefile.in: Regenerate.
7554         * testsuite/Makefile.in: Regenerate.
7555
7556 2010-04-06  Cary Coutant  <ccoutant@google.com>
7557
7558         gcc PR lto/42757
7559         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7560         prevailing definitions of common symbols.
7561         * testsuite/plugin_test_6.sh: New test case.
7562         * testsuite/plugin_common_test_1.c: New test case.
7563         * testsuite/plugin_common_test_2.c: New test case.
7564         * testsuite/Makefile.am (plugin_test_6): New test case.
7565         * testsuite/Makefile.in: Regenerate.
7566
7567 2010-04-06  Nick Clifton  <nickc@redhat.com>
7568
7569         * po/vi.po: New Vietnamese translation.
7570
7571 2010-03-30  Doug Kwan  <dougkwan@google.com>
7572
7573         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7574
7575 2010-03-25  Doug Kwan  <dougkwan@google.com>
7576
7577         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7578         to avoid a conversion warning on a 32-bit host.
7579
7580 2010-03-24  Ian Lance Taylor  <iant@google.com>
7581
7582         * testsuite/script_test_3.t: Add a TLS segment.
7583         * testsuite/Makefile.am (check_PROGRAMS): Add
7584         tls_phdrs_script_test.
7585         (tls_phdrs_script_test_SOURCES): Define.
7586         (tls_phdrs_script_test_DEPENDENCIES): Define.
7587         (tls_phdrs_script_test_LDFLAGS): Define.
7588         (tls_phdrs_script_test_LDADD): Define.
7589         * testsuite/Makefile.in: Rebuild.
7590
7591 2010-03-23  Cary Coutant  <ccoutant@google.com>
7592
7593         * fileread.cc (find_or_make_view): Fix comment.
7594
7595 2010-03-23  Ian Lance Taylor  <iant@google.com>
7596
7597         * script-sections.cc (class Orphan_section_placement): Define
7598         PLACE_TLS and PLACE_TLS_BSS.
7599         (Orphan_section_placement::Orphan_section_placement): Initialize
7600         new places.
7601         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7602         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7603         (tls_script_test_SOURCES): Define.
7604         (tls_script_test_DEPENDENCIES): Define.
7605         (tls_script_test_LDFLAGS): Define.
7606         (tls_script_test_LDADD): Define.
7607         * testsuite/Makefile.in: Rebuild.
7608
7609 2010-03-22  Doug Kwan  <dougkwan@google.com>
7610
7611         * arm.cc (Arm_relocate_functions::abs8,
7612         Arm_relocate_functions::abs16): Use correct check for overflow
7613         specified in the ARM ELF specs.
7614         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7615         target of a BLX instruction specially.
7616         (Reloc_stub::stub_type_for_reloc): Ditto.
7617         (Relocate::relocate): Use symbolic names instead of numeric relocation
7618         codes to report error.
7619         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7620         workaround.
7621         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7622         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7623         thumb2_blx_out_of_range.stdout
7624         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7625         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7626         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7627         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7628         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7629         thumb2_blx_in_range, thumb2_blx_in_range.o,
7630         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7631         thumb2_blx_out_of_range.o): New rules.
7632         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7633         thumb2_blx_in_range and thumb2_blx_out_of_range.
7634         * testsuite/Makefile.in: Regenerate.
7635         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7636         * testsuite/thumb_blx_in_range.s: New file.
7637         * testsuite/thumb_blx_out_of_range.s: New file.
7638
7639 2010-03-22  Rafael Espindola  <espindola@google.com>
7640
7641         * archive.cc (Should_include): Move to archive.h.
7642         (should_include_member): Make it a member of Archive.
7643         (Lib_group): New.
7644         (Add_lib_group_symbols): New.
7645         * archive.h: Include options.h.
7646         (Archive_member): Moved from Archive.
7647         (Should_include): Moved from archive.cc.
7648         (Lib_group): New.
7649         (Add_lib_group_symbols): New.
7650         * dynobj.cc (do_should_include_member): New.
7651         * dynobj.h (do_should_include_member): New.
7652         * gold.cc (queue_initial_tasks): Update call to queue.
7653         * main.cc (main): Print lib group stats.
7654         * object.cc (do_should_include_member): New.
7655         * object.h: Include archive.h.
7656         (Object::should_include_member): New.
7657         (Object::do_should_include_member): New.
7658         (Sized_relobj::do_should_include_member): New.
7659         * options.cc (General_options::parse_start_lib): New.
7660         (General_options::parse_end_lib): New.
7661         (Input_arguments::add_file): Handle lib groups.
7662         (Input_arguments::start_group): Check we are not in a lib.
7663         (Input_arguments::start_lib): New.
7664         (Input_arguments::end_lib): New.
7665         * options.h (General_options): Add start_lib and end_lib.
7666         (Input_argument::lib_): New.
7667         (Input_argument::lib): New.
7668         (Input_argument::is_lib): New.
7669         (Input_file_lib): New.
7670         (Input_arguments::in_lib_): New.
7671         (Input_arguments::in_lib): New.
7672         (Input_arguments::start_lib): New.
7673         (Input_arguments::end_lib_): New.
7674         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7675         in unused members as preempted.
7676         (Sized_pluginobj::do_should_include_member): New.
7677         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7678         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7679         return the blocker.
7680         (Read_symbols::do_whole_lib_group): New.
7681         (Read_symbols::do_lib_group): New.
7682         (Read_symbols::do_read_symbols): Handle lib groups.
7683         (Read_symbols::get_name): Handle lib groups.
7684         * readsyms.h (Read_symbols): Add an archive member pointer.
7685         (Read_symbols::do_whole_lib_group): New.
7686         (Read_symbols::do_lib_group): New.
7687         (Read_symbols::member_): New.
7688         * script.cc (read_input_script): Update call to queue_soon.
7689
7690 2010-03-19  Doug Kwan  <dougkwan@google.com>
7691
7692         * arm.cc (Stub_table::Stub_table): Initialize new data members
7693         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7694         (Stub_table::add_reloc_stub): Assign stub offset and update
7695         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7696         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7697         New data members.
7698         (Stub_table::update_data_size_and_addralign): Use
7699         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7700         instead of going over all reloc stubs.
7701         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7702         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7703         Stringpool_template::offset_ to size of Stringpool_char.
7704         (Stringpool_template::new_key_offset): Remove code to initialize
7705         Stringpool_template::offset_.
7706         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7707         Stringpool_template::offset_ to zero.
7708
7709 2010-03-15  Doug Kwan  <dougkwan@google.com>
7710
7711         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7712         offset_.
7713         (Stringpool_template::new_key_offset): New method.
7714         (Stringpool_template::add_string): Assign offsets when adding new
7715         strings.
7716         (Stringpool_template::set_string_offsets): Do not set string offsets
7717         when not optimizing.
7718         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7719         member size_.
7720         (Chunked_vector::clear): Clear size_.
7721         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7722         (Chunked_vector::size): Return size_.
7723         (Chunked_vector::push_back): Use size_ to find insert position.
7724         (Chunked_vector::size_): New data member.
7725         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7726         (Stringpool_template::new_key_offset): New method declaration.
7727         (Stringpool_template::offset_): New data member.
7728
7729 2010-03-15   Rafael Espindola  <espindola@google.com>
7730
7731         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7732         Add_symbols' constructor.
7733         * readsyms.h (Add_symbols): Remove the input_group member.
7734
7735 2010-03-10  Ian Lance Taylor  <iant@google.com>
7736
7737         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7738         target to ask whether a reference to a symbol requires a stack
7739         split.
7740         * target.h (Target::is_call_to_non_split): New function.
7741         (Target::do_is_call_to_non_split): Declare virtual function.
7742         * target.cc: Include "symtab.h".
7743         (Target::do_is_call_to_non_split): New function.
7744         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7745
7746 2010-03-10  Cary Coutant  <ccoutant@google.com>
7747
7748         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7749         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7750         (File_read::open[2]): Add whole_file_view_ to list of views.
7751         (File_read::make_view): Remove test of whole_file_view_.
7752         (File_read::find_or_make_view): Create whole_file_view_ if
7753         necessary.
7754         (File_read::clear_views): Replace bool parameter with enum;
7755         adjust all callers.  Don't delete views with permanent data;
7756         do delete cached views and views from archives if
7757         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7758         if clearing the corresponding view.
7759         * fileread.h (File_read::Clear_views_mode): New enum.
7760         (File_read::View::is_permanent_view): New method.
7761         (File_read::clear_views): Replace bool parameter
7762         with enum; adjust all callers.
7763         * options.h (General_options): Change keep_files_mapped option;
7764         add map_whole_files.
7765         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7766         releasing the file.
7767         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7768         the file.
7769
7770 2010-03-10  David S. Miller  <davem@davemloft.net>
7771
7772         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7773
7774 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7775
7776         * icf.cc (get_section_contents): Add '@' marker after processing the
7777         merge reloc.
7778
7779 2010-03-08  Doug Kwan  <dougkwan@google.com>
7780
7781         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7782         due to a conversion warning.
7783         (Arm_relobj::update_output_local_symbol_count): Check for local
7784         symbol with unset output index.
7785
7786 2010-03-05  Ian Lance Taylor  <iant@google.com>
7787
7788         * options.h (class General_options): Add --spare-dynamic-tags.
7789         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7790         --spare-dynamic-tags.
7791
7792 2010-03-05  Ian Lance Taylor  <iant@google.com>
7793
7794         * incremental.cc: Include "libiberty.h".
7795
7796 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7797
7798         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7799         function, is_info_ member.
7800         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7801         (Versions::Versions): Update caller.
7802         (Versions::define_base_version): Likewise.
7803         (Versions::add_def): Likewise.
7804
7805 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7806
7807         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7808         (Scan::possible_function_pointer_reloc): New function.
7809         (Scan::local_reloc_may_be_function_pointer): Change to call
7810         possible_function_pointer_reloc.
7811         (Scan::global_reloc_may_be_function_pointer): Ditto.
7812         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7813         relocations in ".data.rel.ro._ZTV" section.
7814         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7815         * testsuite/icf_safe_so_test.cc: Ditto.
7816         * testsuite/icf_safe_test.cc: Ditto.
7817         * testsuite/icf_safe_test.sh: Ditto.
7818
7819 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7820             Ian Lance Taylor  <iant@google.com>
7821
7822         * target-reloc.h (relocate_section): Check the symbol table index
7823         for -1U before setting the local symbol index.
7824         (scan_relocatable_relocs): If copying the relocation, record that
7825         the local symbol is required.
7826         * object.h (Symbol_value::is_output_symtab_index_set): New
7827         function.
7828         (Symbol_value::may_be_discarded_from_output_symtab): New
7829         function.
7830         (Symbol_value::has_output_symtab_entry): New function.
7831         (Symbol_value::needs_output_symtab_entry): Remove.
7832         (Symbol_value::output_symtab_index): Make sure the symbol index is
7833         set.
7834         (Symbol_value::set_output_symtab_index): Make sure the symbol
7835         index is not set.  Make sure the new index is valid.
7836         (Symbol_value::set_must_have_output_symtab_entry): New function.
7837         (Symbol_value::has_output_dynsym_entry): New function.
7838         (Symbol_value::set_output_dynsym_index): Make sure the new index
7839         is valid.
7840         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7841         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7842         local symbol if permitted.
7843         (Sized_relobj::do_finalize_local_symbols): Call
7844         is_output_symtab_index_set rather than needs_output_symtab_entry.
7845         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7846         rather than needs_output_symtab_entry.  Call
7847         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7848         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7849         is_output_symtab_index_set rather than needs_output_symtab_entry.
7850         * testsuite/discard_locals_relocatable_test.c: New file.
7851         * testsuite/discard_locals_test.sh: Test -r.
7852         * testsuite/Makefile.am (check_DATA): Add
7853         discard_locals_relocatable_test1.syms,
7854         discard_local_relocatable_test2.syms.
7855         (MOSTLYCLEANFILES): Likewise.  Also add
7856         discard_locals_relocatable_test1.lout and
7857         discard_locals_relocatable_test2.out.
7858         (discard_locals_relocatable_test1.syms): New target.
7859         (discard_locals_relocatable_test.o): New target.
7860         (discard_locals_relocatable_test1.out): New target.
7861         (discard_locals_relocatable_test2.syms): New target.
7862         (discard_locals_relocatable_test2.out): New target.
7863         (various): Add missing ../ld-new dependencies.
7864         * testsuite/Makefile.in: Rebuild.
7865
7866 2010-03-03  Nick Clifton  <nickc@redhat.com>
7867
7868         * po/fi.po: New Finnish translation.
7869
7870 2010-03-01  Doug Kwan  <dougkwan@google.com>
7871
7872         * layout.cc (Layout::Layout): Force section types of .init_array*,
7873         .preinit_array* and .fini_array* sections.
7874         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7875         Fix check of return value of std::string::find.().
7876         (Output_section::Input_section_sort_compare::operator()): Remove
7877         comment about .init_array.
7878         (Output_section::Input_section_sort_init_fini_compare::operator()):
7879         New method.
7880         (Output_section::sort_attached_input_sections): Handle .init_array
7881         and .fini_array specially.
7882         * output.h (Output_section::Inut_section_sort_compare): Update
7883         comment.
7884         (Output_section::Input_section_sort_init_fini_compare): New struct.
7885
7886 2010-02-26  Doug Kwan  <dougkwan@google.com>
7887
7888         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7889         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7890         * testsuite/debug_msg.sh: Avoid matching source line number for
7891         use of global variable undef_int.
7892
7893 2010-02-26  Doug Kwan  <dougkwan@google.com>
7894
7895         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7896         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7897         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7898         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7899         * options.cc (General_options::General_options): Initialize member
7900         fix_v4bx_.
7901         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7902         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7903         and rm_no_fix_v4bx.stdout
7904         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7905         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7906         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7907         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7908         and arm_no_fix_v4bx.
7909         * Makefile.in: Regenerate.
7910         * testsuite/arm_fix_v4bx.s: New file.
7911         * testsuite/arm_fix_v4bx.sh: Ditto.
7912
7913 2010-02-24  Doug Kwan  <dougkwan@google.com>
7914
7915         * arm.cc (Target_arm::got_section): Make the .got section the first
7916         non RELRO section in the data segment.
7917         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7918         suffixes of section names.
7919
7920 2010-02-24  Doug Kwan  <dougkwan@google.com>
7921
7922         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7923         flags and attributes merging if an input file is a binary file.
7924         * fileread.cc (Input_file::open): Record format of original file.
7925         * fileread.h (Input_file::Format): New enum type.
7926         (Input_file::Input_file): Initialize data member format_.
7927         (Input_file::format): New method definition.
7928         (Input_file::format_):: New data member.
7929
7930 2010-02-24  Doug Kwan  <dougkwan@google.com>
7931
7932         * arm.cc (Arm_output_data_got): New class.
7933         (ARM_TCB_SIZE): New constant
7934         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7935         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7936         If user uses a script with a SECTIONS clause, issue only a warning
7937         for a misplaced EXIDX input section.  Otherwise, issue an error.
7938         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7939         garbage collection.
7940         (Target_arm::got_mode_index_entry): Handle static linking.
7941         (Target_arm::Scan::local): Ditto.
7942         (Target_arm::Scan::global): Ditto.
7943         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7944         all incorrectly implemented relocations.
7945         (Target_arm::fix_exidx_coverage): Pass layout to
7946         Arm_output_section::fix_exidx_coverage.
7947         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7948         from ".ARM.exidx." and ".ARM.extab.".
7949
7950 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7951
7952         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7953         section if it does not already exist.
7954         * attributes.cc (Attributes_section_data::Attributes_section_data):
7955         Don't crash if size is zero.
7956
7957 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7958             Ian Lance Taylor  <iant@google.com>
7959
7960         * gold.cc (queue_middle_tasks): If no input files were opened,
7961         exit.
7962         * workqueue.h (Task_function::Task_function): Assert that there is
7963         a blocker.
7964
7965 2010-02-22  Doug Kwan  <dougkwan@google.com>
7966
7967         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7968         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7969         types to avoid warnings due to different uint64_t implementations
7970         on different hosts.
7971
7972 2010-02-21  Doug Kwan  <dougkwan@google.com>
7973
7974         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7975         handling of the maximum backward branch offset.
7976         (Arm_relocate_functions::thumb_branch_common): Ditto.
7977         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7978         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7979         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7980         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7981         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7982         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7983         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7984         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7985         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7986         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7987         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7988         thumb2_bl_out_of_range.o): New rules.
7989         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7990         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7991         thumb2_bl_out_of_range
7992         * testsuite/Makefile.in: Regenerate.
7993         * testsuite/arm_bl_in_range.s: New file.
7994         * testsuite/arm_bl_out_of_range.s: Ditto.
7995         * testsuite/arm_branch_in_range.sh: Ditto.
7996         * testsuite/arm_branch_range.t: Ditto.
7997         * testsuite/thumb2_branch_range.t: Ditto.
7998         * testsuite/thumb_bl_in_range.s: Ditto.
7999         * testsuite/thumb_bl_out_of_range.s: Ditto.
8000         * testsuite/thumb_branch_range.t: Ditto.
8001
8002 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8003
8004         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8005         Add reloc offset information.
8006         * icf.cc (get_section_contents): Change iterators to point to the new
8007         vectors. Add reloc offset information to the contents.
8008         * icf.h (Icf::Sections_reachable_info): New typedef.
8009         (Icf::Sections_reachable_list): New typedef.
8010         (Icf::Offset_info): New typedef.
8011         (Icf::Reloc_info): New struct typedef.
8012         (Icf::Reloc_info_list): New typedef.
8013         (Icf::symbol_reloc_list): Delete method.
8014         (Icf::addend_reloc_list): Delete method.
8015         (Icf::section_reloc_list): Delete method.
8016         (Icf::reloc_info_list): New method.
8017         (Icf::reloc_info_list_): New member.
8018
8019 2010-02-19  Doug Kwan  <dougkwan@google.com>
8020
8021         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8022         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8023         * arm.cc (Arm_relocation_functions): New forward declaration.
8024         (Target_arm::Target_arm): Initialize new data members
8025         got_mod_index_offset_ and tls_base_symbol_defined_.
8026         (Target_arm::Relocate::relocate_tls): New method.
8027         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8028          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8029         New methods.
8030         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8031         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8032         (Target_arm::got_mod_index_offset_,
8033         Target_arm::tls_base_symbol_defined_): New data members.
8034         (Target_arm::Scan::local, Target::Scan::global,
8035         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8036         relocations.
8037
8038 2010-02-18  Doug Kwan  <dougkwan@google.com>
8039
8040         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8041         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8042         text section as a parameter becuase some broken tools may not set
8043         the link in section header.
8044         (Target_arm::has_got_section): New method.
8045         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8046         without any mapping symbol as data only.  Remove warning.
8047         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8048         link in its section header, try to discover the link by inspecting the
8049         REL31 relocation at the beginning of the section.
8050         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8051         in error message.
8052         (Target_arm::Scan::global): Treat any reference to the symbol
8053         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8054
8055 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8056
8057         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8058         (Scan::global_reloc_may_be_function_pointer): New function.
8059         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8060         (Scan::global_reloc_may_be_function_pointer): New function.
8061         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8062         (Scan::global_reloc_may_be_function_pointer): New function.
8063         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8064         (Scan::global_reloc_may_be_function_pointer): New function.
8065         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8066         (Scan::global_reloc_may_be_function_pointer): New function.
8067         (Scan::possible_function_pointer_reloc): New function.
8068         (Target_x86_64::can_check_for_function_pointers): New function.
8069         * gc.h (gc_process_relocs): Scan relocation types to determine if
8070         function pointers were taken for targets that support it.
8071         * icf.cc (Icf::find_identical_sections): Include functions for
8072         folding in safe ICF whose pointer is not taken.
8073         * icf.h (Secn_fptr_taken_set): New typedef.
8074         (fptr_section_id_): New member.
8075         (section_has_function_pointers): New function.
8076         (set_section_has_function_pointers): New function.
8077         (check_section_for_function_pointers): New function.
8078         * options.h: Fix comment for safe ICF option.
8079         * target.h (can_check_for_function_pointers): New function.
8080         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8081         Modify icf_safe_test for X86-64.
8082         * testsuite/Makefile.in: Regenerate.
8083         * testsuite/icf_safe_so_test.cc: New file.
8084         * testsuite/icf_safe_so_test.sh: New file.
8085         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8086         (main): Change to take pointer to function kept_func_3.
8087         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8088         folding is done correctly for X86-64.
8089
8090 2010-02-12  David S. Miller  <davem@davemloft.net>
8091
8092         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8093         is_symbolless parameter.
8094         (Output_reloc<SHT_REL>::is_symbolless): New.
8095         (Output_reloc<SHT_REL>::is_symbolless_): New.
8096         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8097         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8098         (Output_reloc<SHT_RELA>::is_symbolless): New.
8099         (Output_data_reloc::add_global): Handle is_symbolless.
8100         (Output_data_reloc::add_global_relative): Likewise.
8101         (Output_data_reloc::add_local): Likewise.
8102         (Output_data_reloc::add_local_relative): Likewise.
8103         (Output_data_reloc::add_symbolless_global_addend): New.
8104         (Output_data_reloc::add_symbolless_local_addend): New.
8105         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8106         is_symbolless.
8107         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8108         instead of ->is_relative_
8109         (Output_reloc::write): Likewise.
8110         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8111         (Output_reloc::write_rel): Simplify.
8112
8113         * sparc.cc (Target_sparc::Scan::local): Use
8114         ->add_symbolless_local_addend as needed.
8115         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8116         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8117         based upon relocation offset.
8118
8119 2010-02-11  Doug Kwan  <dougkwan@google.com>
8120
8121         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8122         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8123         beginning of function.
8124         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8125         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8126         parameter is_32bit in calls to should_apply_static_reloc.
8127         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8128         (check_DATA): Add arm_abs_global.stdout.
8129         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8130         arm_abs_global.stdout): New rules.
8131         (MOSTLLYCLEANFILES): Add arm_abs_global
8132         * Makefile.in: Regenerate.
8133         * testsuite/arm_abs_global.s: New file.
8134         * testsuite/arm_abs_global.sh: Ditto.
8135         * testsuite/arm_abs_lib.s: Ditto.
8136
8137 2010-02-11  Ian Lance Taylor  <iant@google.com>
8138
8139         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8140         Read_relocs task.
8141         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8142         Allocate_commons_task first.
8143         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8144         task, rather than symtab_lock_.
8145         (Gc_process_relocs::~Gc_process_relocs): New function.
8146         (Gc_process_relocs::is_runnable): Check this_blocker_.
8147         (Gc_process_relocs::locks): Use next_blocker_ rather than
8148         blocker_.
8149         (Scan_relocs::~Scan_relocs): New function.
8150         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8151         symtab_lock_.
8152         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8153         next_blocker_.
8154         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8155         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8156         constructor accordingly.
8157         (class Gc_process_relocs): Likewise.
8158         (class Scan_relocs): Likewise.
8159         * common.h (class Allocate_commons_task): Remove symtab_lock_
8160         field, and corresponding constructor parameter.
8161         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8162         symtab_lock_.
8163         (Allocate_commons_task::locks): Likewise.
8164
8165 2010-02-11  Ian Lance Taylor  <iant@google.com>
8166
8167         * gold-threads.h (class Once): Define.
8168         (class Initialize_lock): Rewrite as child of Once.
8169         * gold-threads.cc (class Once_initialize): Define.
8170         (once_pointer_control): New static variable.
8171         (once_pointer, once_arg): New static variables.
8172         (c_run_once): New static function.
8173         (Once::Once, Once::run_once, Once::internal_run): New functions.
8174         (class Initialize_lock_once): Remove.
8175         (initialize_lock_control): Remove.
8176         (initialize_lock_pointer): Remove.
8177         (initialize_lock_once): Remove.
8178         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8179         (Initialize_lock::initialize): Rewrite.
8180         (Initialize_lock::do_run_once): New function.
8181         * archive.cc (Archive::interpret_header): Only clear name if it is
8182         not already empty.
8183         * fileread.cc: Include "gold-threads.h"
8184         (file_counts_lock): New static variable.
8185         (file_counts_initialize_lock): Likewise.
8186         (File_read::release): Only increment counts when using --stats.
8187         Use a lock around the increment.
8188         * parameters.cc (class Set_parameters_target_once): Define.
8189         (set_parameters_target_once): New static variable.
8190         (Parameters::Parameters): Move here from parameters.h.
8191         (Parameters::set_target): Rewrite.
8192         (Parameters::set_target_once): New function.
8193         (Parameters::clear_target): Move here and rewrite.
8194         * parameters.h (class Parameters): Update declarations.  Add
8195         set_parameters_target_once_ field.
8196         (Parameters::Parameters): Move to parameters.cc.
8197         (Parameters::clear_target): Likewise.
8198         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8199         task.
8200         (Start_group::~Start_group): New function.
8201         (Start_group::is_runnable): New function.
8202         (Start_group::locks, Start_group::run): New functions.
8203         (Finish_group::run): Change saw_undefined to size_t.
8204         * readsyms.h (class Start_group): Define.
8205         (class Finish_group): Change saw_undefined_ field to size_t.
8206         (Finish_group::Finish_group): Remove saw_undefined and
8207         this_blocker parameters.  Change all callers.
8208         (Finish_group::set_saw_undefined): New function.
8209         (Finish_group::set_blocker): New function.
8210         * symtab.h (class Symbol_table): Change saw_undefined to return
8211         size_t.  Change saw_undefined_ field to size_t.
8212         * target-select.cc (Set_target_once::do_run_once): New function.
8213         (Target_selector::Target_selector): Initialize set_target_once_
8214         field.  Don't initialize lock_ and initialize_lock_ fields.
8215         (Target_selector::instantiate_target): Rewrite.
8216         (Target_selector::set_target): New function.
8217         * target-select.h (class Set_target_once): Define.
8218         (class Target_selector): Update declarations.  Make
8219         Set_target_once a friend.  Remove lock_ and initialize_lock_
8220         fields.  Add set_target_once_ field.
8221
8222 2010-02-10  Ian Lance Taylor  <iant@google.com>
8223
8224         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8225         queueing any tasks.
8226         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8227         (queue_middle_tasks): Add all blockers before queueing any tasks.
8228         (queue_final_tasks): Likewise.
8229         * token.h (Task_token::add_blockers): New function.
8230         * object.h (Input_objects::number_of_relobjs): New function.
8231
8232 2010-02-10  Ian Lance Taylor  <iant@google.com>
8233
8234         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8235         shared, not if not position independent.
8236         * x86_64.cc (Relocate::relocate_tls): Likewise.
8237         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8238         (tls_pie_pic_test): New target.
8239         * testsuite/Makefile.in: Rebuild.
8240
8241         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8242         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8243         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8244         * testsuite/Makefile.in: Rebuild.
8245
8246 2010-02-09  David S. Miller  <davem@davemloft.net>
8247
8248         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8249         R_SPARC_RELATIVE using ->add_local_relative().
8250         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8251
8252         * output.h (Output_data_dynamic::add_section_size): New method
8253         that takes two Output_data objects.
8254         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8255         entry param.  Handle it in initializers.
8256         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8257         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8258         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8259         arg.
8260         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8261         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8262         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8263         for dynrel_includes_plt.
8264         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8265         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8266         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8267         before .rela.plt
8268         (Target_sparc::do_finalize_sections): Update to pass true for
8269         dynrel_includes_plt.
8270         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8271         output before .rela.plt
8272         (Target_powerpc::do_finalize_sections): Update to pass true for
8273         dynrel_includes_plt when 32-bit.
8274
8275 2010-02-08  Doug Kwan  <dougkwan@google.com>
8276
8277         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8278         method.
8279         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8280         Arm_relobj::scan_section_for_cortex_a8_stubs,
8281         Arm_relobj::do_relocation_section): Instead of calling
8282         Output_section::output_address, use faster
8283         Arm_relobj::simple_input_section_output_address.
8284
8285 2010-02-08  David S. Miller  <davem@davemloft.net>
8286
8287         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8288         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8289         relocation helper function.
8290
8291         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8292         just like R_SPARC_GOT{10,13,22}.
8293         (Target_sparc::Scan::local): Likewise.
8294         (Target_sparc::Relocate:relocate): Likewise.
8295
8296 2010-02-06  Ian Lance Taylor  <iant@google.com>
8297
8298         * configure.ac: Rewrite targetobjs duplicate removal code to use
8299         only shell constructs.
8300         * configure: Rebuild.
8301
8302 2010-02-05  Doug Kwan  <dougkwan@google.com>
8303
8304         PR 11247
8305         * arm.cc (Arm_relobj::section_is_scannable): New method.
8306         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8307         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8308
8309 2010-02-04  Doug Kwan  <dougkwan@google.com>
8310
8311         PR 11247
8312         * arm-reloc-property.cc (cstdio): Include.
8313         * configure.ac (targetobjs): Remove duplicates.
8314         * configure: Regenerate.
8315         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8316         big and little endian version for a given address size.
8317
8318 2010-02-03  Doug Kwan  <dougkwan@google.com>
8319
8320         * arm-reloc-property.cc
8321         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8322         definition.
8323         * arm-reloc-property.h
8324         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8325         New method definition.
8326         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8327         declaration.
8328         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8329         overflow to N.
8330         (GOT_PREL): Change implemented to Y.
8331         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8332         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8333         (Arm_relocate_functions::movw_abs_nc): Remove method.
8334         (Arm_relocate_functions::movt_abs): Ditto.
8335         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8336         (Arm_relocate_functions::thm_movt_abs): Ditto.
8337         (Arm_relocate_functions::movw_rel_nc): Ditto.
8338         (Arm_relocate_functions::movw_rel): Ditto.
8339         (Arm_relocate_functions::movt_rel): Ditto.
8340         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8341         (Arm_relocate_functions:thm_movw_rel): Ditto.
8342         (Arm_relocate_functions:thm_movt_rel): Ditto.
8343         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8344         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8345         New method definitions.
8346         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8347         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8348         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8349         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8350         (Target_arm::Relocate::relocate): Check for non-static or
8351         unimplemented relocation code and exit early.  Change calls to
8352         Target_arm::reloc_uses_thumb_bit and
8353         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8354         instead.  Refactor code to handle similar relocations to increase
8355         code sharing.  Remove check for unsupported relocation code in switch
8356         statement.
8357         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8358         relocation property table to find out size.  Change error message to
8359         print out the name of a relocation code instead of the numeric value.
8360         (Target_arm::scan_reloc_for_stub): Use relocation property table
8361         instead of calling Target_arm::reloc_uses_thumb_bit().
8362
8363 2010-02-02  Doug Kwan  <dougkwan@google.com>
8364
8365         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8366         types of relaxed input section.
8367
8368 2010-02-02  Doug Kwan  <dougkwan@google.com>
8369
8370         * Makefile.am (HFILES): Add arm-reloc-property.h.
8371         (DEFFILES): New.
8372         (TARGETSOURCES): Add arm-reloc-property.cc
8373         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8374         (libgold_a_SOURCES): $(DEFFILES)
8375         * Makefile.in: Regenerate.
8376         * arm-reloc-property.cc: New file.
8377         * arm-reloc-property.h: New file.
8378         * arm-reloc.def: New file.
8379         * arm.cc: Update comments.
8380         (arm-reloc-property.h): New included header.
8381         (arm_reloc_property_table): New global variable.
8382         (Target_arm::do_select_as_default_target): New method definition.
8383         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8384         arm-reloc-property to targ_extra_obj.
8385         * parameters.cc (set_parameters_target): Call
8386         Target::select_as_default_target().
8387         * target.h (Target::select_as_default_target): New method definition.
8388         (Target::do_select_as_default_target): Same.
8389
8390 2010-02-01  Doug Kwan  <dougkwan@google.com>
8391
8392         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8393         first_output_text_section_.
8394         (Arm_exidx_fixup::first_output_text_section): New method definition.
8395         (Arm_exidx_fixup::first_output_text_section_): New data member.
8396         (Arm_exidx_fixup::process_exidx_section): Record the first text
8397         output section seen.
8398         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8399         and entsize in output section header.
8400
8401 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8402
8403         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8404         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8405         (Arm_relocate_functions::thm_alu11): New Method.
8406         (Arm_relocate_functions::thm_pc8): New Method.
8407         (Arm_relocate_functions::thm_pc12): New Method.
8408         (Target_arm::Scan::local): Handle the relocations.
8409         (Target_arm::Scan::global): Likewise.
8410         (Target_arm::Relocate::relocate): Likewise.
8411         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8412
8413 2010-01-29  Doug Kwan  <dougkwan@google.com>
8414
8415         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8416         of relocation types as ld.
8417
8418 2010-01-29  Doug Kwan  <dougkwan@google.com>
8419
8420         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8421         to public.
8422         (Arm_relocate_functions::thumb_branch_common): Ditto.
8423         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8424         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8425         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8426         Arm_relocate_functions::jump24): Remove.
8427         (Target_arm::Relocate::relocate): Adjust code to call
8428         Arm_relocation_functions::arm_branch_common and
8429         Arm_relocation_functions::thumb_branch_common instead of their removed
8430         wrappers.  Merge switch-cases together to reduce source code size.
8431
8432 2010-01-29  Doug Kwan  <dougkwan@google.com>
8433
8434         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8435         output_local_symbol_count_needs_update_.
8436         (Arm_relobj::output_local_symbol_count_needs_update,
8437          Arm_relobj::set_output_local_symbol_count_needs_update,
8438          Arm_relobj::update_output_local_symbol_count): New methods.
8439         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8440         member.
8441         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8442         of pointed function as in a R_ARM_PREL31 relocation.
8443         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8444         for output local symbol count updating.
8445         (Target_arm::do_relax): Update output local symbol counts in objects
8446         if necessary.
8447         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8448
8449 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8450
8451         * arm.cc: Added support for the ARM relocations:
8452         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8453         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8454         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8455         movw_prel_nc).
8456         (Arm_relocate_functions::movw_rel): New method.
8457         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8458         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8459         thm_movw_prel_nc).
8460         (Arm_relocate_functions::thm_movw_rel): New method.
8461         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8462         thm_movt_prel).
8463         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8464         relocations.
8465         (Target_arm::Scan::global): Likewise.
8466         (Target_arm::Relocate::relocate): Likewise.
8467         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8468         Likewise.
8469
8470 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8471
8472         * arm.cc: Added support for ARM group relocations.
8473         (Target_arm::reloc_needs_sym_origin): New method.
8474         (Arm_relocate_functions::calc_grp_kn): New method.
8475         (Arm_relocate_functions::calc_grp_residual): New method.
8476         (Arm_relocate_functions::calc_grp_gn): New method.
8477         (Arm_relocate_functions::arm_grp_alu): New Method.
8478         (Arm_relocate_functions::arm_grp_ldr): New Method.
8479         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8480         (Arm_relocate_functions::arm_grp_ldc): New Method.
8481         (Target_arm::Scan::local): Handle the ARM group relocations.
8482         (Target_arm::Scan::global): Likewise.
8483         (Target_arm::Relocate::relocate): Likewise.
8484         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8485         Likewise.
8486
8487 2010-01-26  Doug Kwan  <dougkwan@google.com>
8488
8489         * arm.cc (set): Include.
8490         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8491         pointer type.
8492         (Arm_output_section::Text_section_list): New type.
8493         (Arm_output_section::append_text_sections_to_list): New method.
8494         (Arm_output_section::fix_exidx_coverage): Ditto.
8495         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8496         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8497         Relobj::set_section_offset() instead of
8498         Sized_relobj::invalidate_section_offset().
8499         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8500         parameter for section headers. Ignore relocation sections for
8501         unallocated sections and EXIDX sections.
8502         (Target_arm::fix_exidx_coverage): New method.
8503         (Target_arm::output_section_address_less_than): New type.
8504         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8505         linked text section instead of the EXIDX section.
8506         (Arm_output_section::create_stub_group): Add an assertion to check
8507         that this is not an EXIDX output section.
8508         (Arm_output_section::append_text_sections_to_list): New method.
8509         (Arm_output_section::fix_exidx_coverage): Ditto.
8510         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8511         Arm_relobj::section_needs_reloc_stub_scanning.
8512         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8513         first pass.
8514         (Target_arm::fix_exidx_coverage): New method.
8515         * object.h (Relobj::set_output_section): New method.
8516         (Sized_relobj::invalidate_section_offset): Remove method.
8517         (Sized_relobj::do_invalidate_section_offset): Remove method.
8518         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8519
8520 2010-01-25  Doug Kwan  <dougkwan@google.com>
8521
8522         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8523         Fix warning due to signed and unsigned comparison on a 32-bit host.
8524
8525 2010-01-22  Doug Kwan  <dougkwan@google.com>
8526
8527         * arm.cc (Target_arm::do_relax): Record an output section for section
8528         offset adjustment it contains any stub table that has changed.
8529         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8530         offsets in an output section if necessary.
8531         * output.cc (Output_section::Output_section): Initialize
8532         section_offsets_need_adjustments_.
8533         (Output_section::add_input_section_for_script): Renamed to
8534         Output_section::add_simple_input_section.
8535         (Output_section::save_states): Add a comment.
8536         (Output_section::discard_states): New method defintion.
8537         (Output_section::adjust_section_offsets): Same.
8538         * output.h (Output_section::add_input_section_for_script): Renamed to
8539         Output_section::add_simple_input_section.
8540         (Output_section::discard_states): New method declaration.
8541         (Output_section::adjust_section_offsets): Same.
8542         (Output_section::section_offsets_need_adjustment,
8543         Output_section::set_section_offsets_need_adjustment): New method
8544         definitions.
8545         (Output_section::section_offsets_need_adjustment_): New data member.
8546         * script-sections.cc
8547         (Output_section_element_input::set_section_address): Adjust code for
8548         renaming of Output_section::add_input_section_for_script.
8549         (Orphan_output_section::set_section_address): Same.
8550
8551 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8552
8553         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8554         Fix_v4bx enum values .
8555         * gold/options.h (General_options): New option definitions.
8556         (General_options::fix_v4bx): New method.
8557         (General_options::Fix_v4bx): New enum.
8558         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8559         (General_options::parse_fix_v4bx_interworking): New method.
8560
8561 2010-01-22  Doug Kwan  <dougkwan@google.com>
8562
8563         * arm.cc (Arm_exidx_fixup): New class.
8564
8565 2010-01-21  Doug Kwan  <dougkwan@google.com>
8566
8567         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8568         classes.
8569         (Arm_exidx_section_offset_map): New type.
8570
8571 2010-01-21  Doug Kwan  <dougkwan@google.com>
8572
8573         * arm.cc (Arm_exidx_input_section): New class.
8574         (Arm_relobj::exidx_input_section_by_link,
8575         Arm_relobj::exidx_input_section_by_shndx,
8576         Arm_relobj::make_exidx_input_section): New methods.
8577         (read_arm_attributes_section): Remove.
8578         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8579         information about them.
8580         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8581         to here.
8582
8583 2010-01-20  Doug Kwan  <dougkwan@google.com>
8584
8585         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8586         Input_section_specifier to Section_id.
8587         (Target_arm::new_arm_input_section: Adjust code for change of key
8588         type.
8589         (Target_arm::find_arm_input_section): Ditto.
8590         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8591         (Section_id): Remove.
8592         (Garbage_collection::Section_id_hash): Remove.
8593         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8594         (Section_id): Remove.
8595         (Icf::Section_id_hash): Remove.
8596         * object.h (Section_id, Const_section_id, Section_id_hash,
8597         Const_section_id_hash): New type definitions.
8598         * output.cc (Output_section::add_relaxed_input_section): Change to
8599         use Const_section_id instead of Input_section_specifier as key type.
8600         (Output_section::add_merge_input_section): Ditto.
8601         (Output_section::build_relaxation_map): Change to use Section_id
8602         instead of Input_section_specifier as key type.
8603         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8604         Ditto.
8605         (Output_section::convert_input_sections_to_relaxed_sections): Change
8606         to use Const_section_id instead of Input_section_specifier as key type.
8607         (Output_section::find_merge_section): Ditto.
8608         (Output_section::find_relaxed_input_section): Ditto.
8609         * output.h (Input_section_specifier): Remove class.
8610         (Output_section::Output_section_data_by_input_section_map): Change
8611         key type to Const_section_id.
8612         (Output_section::Output_relaxed_input_section_by_input_section_map):
8613         Ditto.
8614         (Output_section::Relaxation_map): Change key type to Section_id.
8615
8616 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8617
8618         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8619         (class Arm_v4bx_stub): New class.
8620         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8621         (Stub_factory::make_arm_v4bx_stub): New method.
8622         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8623         (Stub_table::empty): Handle v4bx stubs.
8624         (Stub_table::add_arm_v4bx_stub): New method.
8625         (Stub_table::find_arm_v4bx_stub): New method.
8626         (Arm_relocate_functions::v4bx): New method.
8627         (Target_arm::fix_v4bx): New method.
8628         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8629         (Stub_table::relocate_stubs): Likewise.
8630         (Stub_table::do_write): Likewise.
8631         (Stub_table::update_data_size_and_addralign): Likewise.
8632         (Stub_table::finalize_stubs):  Likewise.
8633         (Target_arm::Scan::local): Likewise.
8634         (Target_arm::Scan::global): Likewise.
8635         (Target_arm::do_finalize_sections): Likewise.
8636         (Target_arm::Relocate::relocate): Likewise.
8637         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8638         Likewise.
8639         (Target_arm::scan_reloc_for_stub): Likewise.
8640         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8641
8642 2010-01-19  Ian Lance Taylor  <iant@google.com>
8643
8644         * output.cc (Output_section_headers::do_sized_write): Write large
8645         segment count to sh_info field.
8646         (Output_file_header::do_sized_write): For large segment count,
8647         write PN_XNUM to e_phnum field.
8648
8649 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8650
8651         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8652         (Arm_relocate_functions::thm_jump8): New function.
8653         (Arm_relocate_functions::thm_jump11): New function.
8654         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8655         R_ARM_THM_JUMP11.
8656         (Target_arm::Scan::global): Likewise.
8657         (Target_arm::Relocate::relocate): Likewise.
8658         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8659         Likewise.
8660
8661 2010-01-14  Doug Kwan  <dougkwan@google.com>
8662
8663         * arm.cc (map, utility): Include headers.
8664         (Target_arm::apply_cortex_a8_workaround): New method.
8665         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8666         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8667         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8668         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8669         the --[no-]fix-cortex-a8 command line options.
8670         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8671         (Target_arm::relocate_stub): Use addend in instruction template.
8672         * options.h (DEFINE_bool): Set the user-set flag.
8673         (General_options): Add --[no-]-fix-cortex options.
8674         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8675         : Update fast look-up map after conversion.
8676
8677 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8678
8679         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8680         in the first pass of do_layout.
8681
8682 2010-01-13  Doug Kwan  <dougkwan@google.com>
8683
8684         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8685         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8686         apparent compiler problem of not folding static constant integral
8687         data members of elfcpp::Elf_sizes<32>.
8688
8689 2010-01-13  Doug Kwan  <dougkwan@google.com>
8690
8691         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8692         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8693         Arm_relobj::scan_section_for_cortex_a8_erratum,
8694         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8695         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8696         sections to scan for relocation stubs into a new method
8697         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8698         relocation and Cortex-A8 stub scanning.
8699         (Target_arm::do_relax): Force stubs to be after stubbed sections
8700         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8701         the beginning of a new relaxation pass.  Update a comment.
8702         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8703
8704 2010-01-12  Ian Lance Taylor  <iant@google.com>
8705
8706         * target-reloc.h (visibility_error): New inline function.
8707         (relocate_section): Call visibility_error.
8708         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8709         (MOSTLYCLEANFILES): Likewise.
8710         (protected_4_pic.o, protected_3.err): New targets.
8711         * testsuite/protected_4.cc: New file.
8712
8713 2010-01-12  Doug Kwan  <dougkwan@google.com>
8714
8715         * arm.cc (Cortex_a8_reloc): New class.
8716         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8717         and cortex_a8_relocs_info_.
8718         (Target_arm::fix_cortex_a8): New method definition.
8719         (Target_arm::Cortex_a8_relocs_info): New type.
8720         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8721         New data member declarations.
8722         (Target_arm::scan_reloc_for_stub): Record information about
8723         relocations for THUMB branches that might be exempted from the
8724         Cortex-A8 workaround.
8725         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8726         at the beginning of a relaxation pass.
8727
8728 2010-01-12  Doug Kwan  <dougkwan@google.com>
8729
8730         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8731         (Arm_relobj::Mapping_symbol_position,
8732          Arm_reloj::Mapping_symbol_position_less,
8733          Arm_relobj::Mapping_symbols_info): New types.
8734         (Target_arm::is_mapping_symbol_name): New method definition.
8735         (Arm_relobj::do_count_local_symbols): Save information about mapping
8736         symbols.
8737
8738 2010-01-11  Doug Kwan  <dougkwan@google.com>
8739
8740         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8741         Arm_relocate_functions::thumb32_branch_upper,
8742         Arm_relocate_functions::thumb32_branch_lower,
8743         Arm_relocate_functions::thumb32_cond_branch_offset,
8744         Arm_relocate_functions::thumb32_cond_branch_upper,
8745         Arm_relocate_functions::thumb32_cond_branch_lower,
8746         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8747         branch offset encoding.
8748         (Arm_relocate_functions::thumb_branch_common): Use new branch
8749         offset encoding methods to avoid code duplication.
8750         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8751         (Stub_addend_reader::operator()): Use new branch encoding method
8752         to avoid code duplication.
8753
8754 2010-01-11  Doug Kwan  <dougkwan@google.com>
8755
8756         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8757         (Target_arm::do_finalize_sections): Define special EXIDX section
8758         symbols only if referenced.
8759         * gc.h (Garbage_collection::add_reference): New method.
8760         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8761         code duplication.
8762
8763 2010-01-11  Ian Lance Taylor  <iant@google.com>
8764
8765         * script.cc (Version_script_info::build_expression_list_lookup):
8766         Change complaing about duplicate wildcard match from error to
8767         warning.
8768
8769         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8770         of 2009-12-30.
8771         (Version_script_info::Version_script_info): Initialize globs_,
8772         default_version_, default_is_global_, and exact_.  Don't
8773         initialize globals_ or locals_.
8774         (Version_script_info::build_lookup_tables): Build local symbols
8775         first.
8776         (Version_script_info::unquote): New function.
8777         (Version_script_info::add_exact_match): New function.
8778         (Version_script_info::build_expression_list_lookup): Remove lookup
8779         parameter.  Add is_global parameter.  Change all callers.  Handle
8780         wildcard pattern specially.  Unquote pattern.  Call
8781         add_exact_match.
8782         (Version_script_info::get_name_to_match): New function.
8783         (Version_script_info::get_symbol_version): New function.
8784         (Version_script_info::get_symbol_version_helper): Remove.
8785         (Version_script_info::check_unmatched_names): Call unquote.
8786         * script.h (class Version_script_info): Change get_symbol_version
8787         to be non-inline and add is_global parameter; change all callers.
8788         Rewrite symbol_is_local.  Update declarations.  Define struct
8789         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8790         Remove globals_ and locals_ members.  Add exact_, globs_,
8791         default_version_, is_global_.
8792         (Version_script_info::Glob): Remove pattern, add expression and
8793         is_global.  Update constructor.  Change all callers.
8794         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8795         default version.
8796         (Versions::symbol_section_contents): If a symbol is undefined, or
8797         defined in a dynamic object, set the version index to
8798         VER_NDX_LOCAL.
8799         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8800         symbol_is_local.
8801         (Symbol_table::add_from_pluginobj): Likewise.
8802         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8803
8804 2010-01-11  Doug Kwan  <dougkwan@google.com>
8805
8806         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8807         (incremental_dump_LDADD): Add linking option for libintl.
8808         * Makefile.in: Regenerate.
8809
8810 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8811
8812         PR gold/11144
8813         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8814         instead of -Ds.
8815         * testsuite/Makefile.in: Regenerated.
8816
8817 2010-01-10  Doug Kwan  <dougkwan@google.com>
8818
8819         * options.h (DEFINE_var): Use parentheses around argument varname__
8820         in macro body to avoid any unintended subsequent substitutions.
8821
8822 2010-01-10  Ian Lance Taylor  <iant@google.com>
8823
8824         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8825         candidates before doing symbol resolution.
8826
8827         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8828         ODR candidates if only one is weak.
8829
8830 2010-01-08  Ian Lance Taylor  <iant@google.com>
8831
8832         * script.cc (Version_script_info::build_expression_list_lookup):
8833         Don't warn about ambiguous version, just record the ambiguity.
8834         (Version_script_info::get_symbol_version_helper): Give error if
8835         version is ambiguous.
8836
8837 2010-01-08  Doug Kwan  <dougkwan@google.com>
8838
8839         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8840         prev_data_size_ and prev_addralign_.  Remove initializer for
8841         deleted data member has_been_changed_.
8842         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8843         to determine if the table is empty.
8844         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8845         Remove.
8846         (Stub_table::add_reloc_stub): Define method in class definition
8847         instead of just declaring it there.
8848         (Stub_table::add_cortex_a8_stub): New method definition.
8849         (Stub_table::update_data_size_and_addralign): Ditto.
8850         (Stub_table::finalize_stubs): Ditto.
8851         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8852         (Stub_table::do_addralign_): Return address alignment in the
8853         (Stub_table::do_reset_address_and_file_offset): Define method in
8854         class definition instead of declaring it there.  Set current data
8855         size to be the data size of the previous pass.
8856         (Stub_table::set_final_data_size): Use current data size as the
8857         final data size.
8858         (Stub_table::relocate_stub): Change parameter type of stub from
8859         Reloc_stub pointer to Stub pointer.
8860         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8861         (Stub_table::Cortex_a8_stub_list): New typedef.
8862         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8863          Stub_table::prev_addralign_): New data member.
8864         (Arm_relobj::Arm_relobj): Initialize data member
8865         section_has_cortex_a8_workaround_.
8866         (Arm_relobj::section_has_cortex_a8_workaround,
8867          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8868          definitions.
8869         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8870         declarations.
8871         (Target_arm::relocate_stub): Change parameter type of stub from
8872         Reloc_stub pointer to Stub pointer.
8873         (Insn_template::size, Insn_template::alignment): Handle
8874         THUMB16_SPECIAL_TYPE.
8875         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8876          Stub_table::update_data_size_and_addralign,
8877          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8878         definitions.
8879         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8880         (Stub_table::do_write): Ditto.
8881         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8882
8883 2010-01-08  Ian Lance Taylor  <iant@google.com>
8884
8885         PR 11108
8886         * symtab.h (class Symbol): Remove fields is_target_special_ and
8887         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8888         (Symbol::is_defined_in_discarded_section): New function.
8889         (Symbol::set_is_defined_in_discarded_section): New function.
8890         (Symbol::has_plt_offset): Rewrite.
8891         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8892         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8893         Don't initialize is_target_special_ or has_plt_offset_.
8894         Initialize is_defined_in_discarded_section_.
8895         (Symbol_table::add_from_relobj): If appropriate, set
8896         is_defined_in_discarded_section.
8897         * resolve.cc (Symbol::override_base_with_special): Don't test
8898         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8899         * target-reloc.h (relocate_section): Do special handling for
8900         symbols defined in discarded sections for global symbols as well
8901         as local symbols.
8902
8903 2010-01-08  Ian Lance Taylor  <iant@google.com>
8904
8905         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8906         the SHT_SYMTAB case.
8907
8908 2010-01-08  Ian Lance Taylor  <iant@google.com>
8909
8910         * object.cc (Sized_relobj::do_layout): Don't get confused if
8911         layout_eh_frame returns NULL.
8912
8913 2010-01-08  Ian Lance Taylor  <iant@google.com>
8914
8915         PR 11084
8916         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8917         dynamic symbol table, use the normal symbol table.
8918         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8919         symbol table.
8920
8921 2010-01-08  Ian Lance Taylor  <iant@google.com>
8922
8923         PR 11072
8924         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8925         sections.
8926
8927 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8928
8929         * version.cc (print_version): Change to "Copyright 2010".
8930
8931 2010-01-08  Ian Lance Taylor  <iant@google.com>
8932
8933         PR 10287
8934         PR 11063
8935         * i386.cc (class Target_i386): Change return type of plt_section
8936         to be non-const.
8937         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8938         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8939         tls_desc_rel_ field.
8940         (Output_data_plt_i386::rel_tls_desc): New function.
8941         (Target_i386::rel_tls_desc_section): New function.
8942         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8943         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8944         R_386_TLS_DESC reloc in rel_tls_desc_section.
8945         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8946         Define struct Tlsdesc_info.
8947         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8948         (Target_x86_64::do_reloc_symbol_index): New function.
8949         (Target_x86_64::add_tlsdesc_info): New function.
8950         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8951         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8952         tlsdesc_rel_ field.
8953         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8954         all callers.
8955         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8956         (Target_x86_64::rela_tlsdesc_section): New function.
8957         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8958         handling.
8959         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8960         (Target_x86_64::do_reloc_addend): New function.
8961         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8962         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8963         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8964         (Output_reloc::type): New function.
8965         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8966         (Output_reloc::is_target_specific): New function.
8967         (Output_reloc::target_arg): New function.
8968         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8969         absolute relocs and target specific relocs.
8970         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8971         add_target_specific.
8972         (class Output_data_reloc) [SHT_RELA]: Likewise.
8973         * output.cc (Output_reloc::Output_reloc): Add four new versions
8974         for absolute relocs and target specific relocs.
8975         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8976         (Output_reloc::get_symbol_index): Likewise.
8977         (Output_reloc::local_section_offset): Check that local_sym_index_
8978         is not TARGET_CODE or 0.
8979         (Output_reloc::symbol_value): Likewise.
8980         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8981         reloc.
8982         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8983         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8984         functions.
8985         * layout.cc (add_target_dynamic_tags): Use output section for
8986         DT_PLTRELSZ and DT_JMPREL.
8987
8988 2010-01-07  Ian Lance Taylor  <iant@google.com>
8989
8990         PR 11061
8991         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8992         function.
8993         (class Output_data_reloc_generic): Define.
8994         (class Output_data_reloc_base): Change base class to
8995         Output_data_reloc_generic.  Change add() method to call
8996         bump_relative_reloc_count for a relative reloc.  Remove
8997         sort_relocs_ field.
8998         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8999         to sort_relocs().
9000         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9001         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9002         appropriate.
9003         * layout.h (class Layout): Update declaration.
9004
9005 2010-01-07  Ian Lance Taylor  <iant@google.com>
9006
9007         * output.h (class Output_data): Add const version of
9008         output_section and do_output_section.
9009         (class Output_section_data): Add const version of
9010         do_output_section.
9011         (class Output_section): Likewise.
9012         * layout.cc (Layout::add_target_dynamic_tags): New function.
9013         * layout.h (class Layout): Update declarations.
9014         * arm.cc (Target_arm::do_finalize_sections): Use
9015         add_target_dynamic_tags.
9016         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9017         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9018         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9019         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9020
9021 2010-01-07  Ian Lance Taylor  <iant@google.com>
9022
9023         PR 11042
9024         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9025         object as needed.
9026
9027 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9028             Ian Lance Taylor  <iant@google.com>
9029
9030         PR 11019
9031         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9032         Xindex::read_symtab_xindex.
9033
9034 2010-01-07  Doug Kwan  <dougkwan@google.com>
9035
9036         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9037         (Insn_template::thumb16_bcond_insn): New method declaration.
9038         (Insn_template): Fix spelling.
9039         (Stub::thumb16_special): New method declaration.
9040         (Stub::do_write): Define virtual method which was previously pure
9041         virtual.
9042         (Stub::do_thumb16_special): New method declaration.
9043         (Stub::do_fixed_endian_write): New template member.
9044         (Reloc_stub::do_write): Remove.
9045         (Reloc_stub::do_fixed_endian_write): Remove.
9046         (Cortex_a8_stub): New class definition.
9047         (Stub_factory::make_cortex_a8_stub): New method definition.
9048         (Stub_factory::Stub_factory): Add missing static storage class
9049         qualifier for elf32_arm_stub_a8_veneer_blx.
9050
9051 2010-01-07  Ian Lance Taylor  <iant@google.com>
9052
9053         PR 10980
9054         * options.h (class General_options): Add --warn-unresolved-symbols
9055         and --error-unresolved-symbols.
9056         * errors.cc (Errors::undefined_symbol): Implement
9057         --warn-unresolved-symbols.
9058
9059         * options.h (class General_options): Add -z text and -z textoff.
9060         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9061
9062 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9063
9064         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9065         (Garbage_collection::cident_sections): New function.
9066         (Garbage_collection::add_cident_section): New function.
9067         (Garbage_collection::cident_sections_): New member.
9068         (gc_process_relocs): Add references to sections whose names are C
9069         identifiers.
9070         * gold.h (cident_section_start_prefix): New constant.
9071         (cident_section_stop_prefix): New constant.
9072         (is_cident): New function.
9073         * layout.cc (Layout::define_section_symbols): Replace string constants
9074         with the newly defined constants.
9075         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9076         C identifiers.
9077         * testsuite/Makefile.am: Add gc_orphan_section_test.
9078         * testsuite/Makefile.in: Regenerate.
9079         * testsuite/gc_orphan_section_test.cc: New file.
9080         * testsuite/gc_orphan_section_test.sh: New file.
9081
9082 2010-01-06  Ian Lance Taylor  <iant@google.com>
9083
9084         PR 10980
9085         * options.h (class General_options): Add --warn-shared-textrel.
9086         * layout.cc (Layout::finish_dynamic_section): Implement
9087         --warn-shared-textrel.
9088
9089         PR 10980
9090         * options.h (class General_options): Add --warn-multiple-gp.
9091
9092 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9093
9094         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9095         $(THREADSLIB) and $(LIBDL).
9096         * Makefile.in: Rebuild.
9097
9098 2010-01-06  Ian Lance Taylor  <iant@google.com>
9099
9100         PR 10980
9101         * options.cc (General_options::parse_section_start): New function.
9102         (General_options::section_start): New function.
9103         (General_options::General_options): Initialize all members.
9104         * options.h: Include <map>
9105         (class General_options): Add --section-start.  Add section_starts_
9106         member.
9107         * layout.cc (Layout::attach_allocated_section_to_segment): If
9108         --section-start was used, set the address of the segment.  Remove
9109         local sort_sections.
9110         (Layout::relaxation_loop_body): If the address of the load segment
9111         has been set by --section-start, don't use it.
9112         * output.h (Output_segment::update_flags_for_output_section): New
9113         function.
9114         * output.cc (Output_segment::add_output_section): Call
9115         update_flags_for_output_section.
9116
9117 2010-01-05  Ian Lance Taylor  <iant@google.com>
9118
9119         PR 10980
9120         * options.h (class General_options): Add --undefined-version.
9121         * script.cc (struct Version_expression): Add was_matched_by_symbol
9122         field.
9123         (Version_script_info::matched_symbol): New function.
9124         (Version_script_info::get_symbol_version_helper): Call
9125         matched_symbol.
9126         (Version_script_info::check_unmatched_names): New function.
9127         * script.h (class Version_script_info): Update declarations.
9128         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9129
9130         * options.h (class General_options): Use DEFINE_bool_alias for
9131         allow_multiple_definition.
9132         * resolve.cc (Symbol_table::should_override): Don't test
9133         allow_multiple_definition.
9134
9135         PR 10980
9136         * options.h (class General_options): Add --cref.
9137         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9138         until after printing cref table.
9139         * cref.cc: Include "symtab.h".
9140         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9141         (Cref_table_compare::operator()): New function.
9142         (Cref_inputs::gather_cref): New function.
9143         (filecol): New static const.
9144         (Cref_inputs::print_cref): New function.
9145         (Cref::print_cref): New function.
9146         * cref.h: Include <cstdio>.
9147         (class Cref): Update declarations.
9148         * mapfile.h (Mapfile::file): New function.
9149         * object.h (class Object): Define Symbols.  Declare virtual
9150         do_get_global_symbols.
9151         (Object::get_global_symbols): New function.
9152         * object.cc (Input_objects::add_object): Pass object to cref_ if
9153         --cref.
9154         (Input_objects::archive_start): Likewise.
9155         (Input_objects::archive_stop): Likewise.
9156         (Input_objects::print_cref): New function.
9157         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9158         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9159         --cref.
9160         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9161         function.
9162         * plugin.h (class Sized_pluginobj): Update declarations.
9163
9164 2010-01-05  Ian Lance Taylor  <iant@google.com>
9165
9166         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9167         to is_default_version.  Rename insdef to insdefault.
9168         (Symbol_table::add_from_relobj): Rename def to is_default_version
9169         and local to is_forced_local.
9170         (Symbol_table::add_from_pluginobj): Likewise.
9171         (Symbol_table::add_from_dynobj): Likewise.
9172         (Symbol_table::define_special_symbol): Rename insdef to
9173         insdefault.
9174
9175 2010-01-04  Ian Lance Taylor  <iant@google.com>
9176
9177         PR 10980
9178         * options.h (class General_options): Add
9179         --allow-multiple-definition and -z muldefs.
9180         * resolve.cc (Symbol_table::should_override): Don't warn about a
9181         multiple symbol definition if --allow-multiple-definition or -z
9182         muldefs.
9183
9184         PR 10980
9185         * options.h (class General_options): Add --add-needed and
9186         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9187         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9188         error if --copy-dt-needed-entries aka --add-needed is used and
9189         would cause a change in behaviour.
9190
9191         PR 10980
9192         * options.h (class General_options): Add -G as a short version of
9193         --shared.  Add no-op options -assert, -g, and -i.
9194
9195 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9196
9197         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9198         check for .text or .gnu.linkonce.t sections.
9199         * icf.cc (Icf::find_identical_sections): Ditto.
9200         Change the detection for mangled function name within the section
9201         name.
9202         * icf.h (is_section_foldable_candidate): New function.
9203
9204 2009-12-30  Ian Lance Taylor  <iant@google.com>
9205
9206         PR 10980
9207         * options.h (class General_options): Permit two dashes with
9208         --retain-symbols-file.
9209
9210 2009-12-30  Ian Lance Taylor  <iant@google.com>
9211
9212         PR 10979
9213         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9214         don't put the file header and segment headers in the text
9215         segment.
9216
9217         PR 10979
9218         * common.cc (Sort_commons::operator()): Stabilize sort when both
9219         entries are NULL.
9220         (Symbol_table::do_allocate_commons_list): When allocating common
9221         symbols, skip a symbol which is no longer common.
9222         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9223         an object before checking its type.
9224         * testsuite/common_test_2.c: New file.
9225         * testsuite/common_test_3.c: New file.
9226         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9227         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9228         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9229         (common_test_2_pic.o, common_test_2.so): New targets.
9230         (common_test_3_pic.o, common_test_3.so): New targets.
9231         * testsuite/Makefile.in: Rebuild.
9232
9233         PR 10979
9234         * script.cc (read_input_script): If we see a new SECTIONS clause,
9235         and we have added an input section, give an error.
9236         * layout.h (class Layout): Add have_added_input_section function.
9237         Add have_added_input_section_ field.
9238         * layout.cc (Layout::Layout): Initialize
9239         have_added_input_section_.
9240         (Layout::layout): Set have_added_input_section_.
9241         (Layout::layout_eh_frame): Likewise.
9242
9243 2009-12-30  Ian Lance Taylor  <iant@google.com>
9244
9245         PR 10931
9246         * options.h (class General_options): Add --sort-common option.
9247         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9248         * common.cc (Sort_common): Add sort_order parameter to
9249         constructor.  Add sort_order_ field.
9250         (Sort_commons::operator): Check sort_order_.
9251         (Symbol_table::allocate_commons): Determine the sort order.
9252         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9253         Change all callers.
9254         (Symbol_table::do_allocate_commons_list): Likewise.
9255
9256 2009-12-30  Ian Lance Taylor  <iant@google.com>
9257
9258         PR 10916
9259         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9260         symbols from this object, don't change the visibility of an
9261         undefined symbol.
9262         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9263
9264 2009-12-30  Ian Lance Taylor  <iant@google.com>
9265
9266         PR 10861
9267         * script.h (class Version_script_info): Define Language enum.
9268         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9269         new fields globals_, locals_, and is_finalized_.
9270         * script.cc: Various formatting fixes.
9271         (class Parser_closure): Change language_stack_ from a vector of
9272         std::string to one of Version_script_info::Language.  Adjust all
9273         uses accordingly.
9274         (class Lazy_demangler): Remove.
9275         (struct Version_expression): Change language from std::string to
9276         Version_script_info::Language.
9277         (Version_script_info::Version_script_info): New function.
9278         (Version_script_info::~Version_script_info): Don't call clear.
9279         (Version_script_info::finalize): New function.
9280         (Version_script_info::build_lookup_tables): New function.
9281         (Version_script_info::build_expression_list_lookup): New
9282         function.
9283         (Version_script_info::get_symbol_version_helper): Rewrite to use
9284         lookup tables.
9285         (Version_script_info::print_expression_list): Adjust to use
9286         Version_script_info::Language.
9287         (script_push_lex_into_version_mode): Check that the version script
9288         has not been finalized.
9289         (version_script_push_lang): Change language string to
9290         Version_script_info::Language.
9291         * options.cc (Command_line::version_script): New function.
9292         * options.h (class General_options): Add finalize_dynamic_list
9293         function.  Change version_script from declaration to definition.
9294         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9295         * testsuite/version_script.map: Remove duplicate def of foo.
9296         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9297         version_script.map.
9298         * testsuite/Makefile.in: Rebuild.
9299
9300 2009-12-30  Ian Lance Taylor  <iant@google.com>
9301
9302         PR 10843
9303         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9304         if the input symbol index is 0, make the output symbol index 0.
9305
9306 2009-12-30  Ian Lance Taylor  <iant@google.com>
9307
9308         PR 10670
9309         * options.h (class General_options): Add -x/--discard-all.
9310         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9311         --discard-all.  If the local symbol needs a dynamic entry, check
9312         that before handling --discard-locals.
9313
9314 2009-12-30  Ian Lance Taylor  <iant@google.com>
9315
9316         PR 10450
9317         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9318         flags to PF_R.
9319         (Output_segment::add_output_section): Don't change the flags if
9320         the type is PT_TLS.
9321
9322         PR 10450
9323         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9324         GNU hash table if they need a dynamic value.  Otherwise, don't add
9325         them if they are defined in a dynamic object or are forced local.
9326
9327 2009-12-29  Ian Lance Taylor  <iant@google.com>
9328
9329         PR 10450
9330         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9331         .gnu.hash table for a 32-bit target.
9332
9333         PR 10450
9334         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9335         regular and a dynamic object only needs a dynamic symbol table
9336         entry if it is externally visible.
9337
9338         PR 10450
9339         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9340         constructor.  Add global_offset_table_ field.
9341         (Target_i386::got_section): Set global_offset_table_.
9342         (Target_i386::do_finalize_sections): Set global_offset_table_
9343         size.
9344         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9345         in constructor.  Add global_offset_table_ field.
9346         (Target_x86_64::got_section): Set global_offset_table_.
9347         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9348         size.
9349
9350         * layout.cc (Layout::Layout): Initialize increase_relro_.
9351         (Layout::get_output_section): Add is_relro, is_last_relro, and
9352         is_first_non_relro parameters.  Change all callers.
9353         (Layout::choose_output_section): Likewise.
9354         (Layout::add_output_section_data): Likewise.
9355         (Layout::make_output_section): Likewise.
9356         (Layout::set_segment_offsets): Clear increase_relro when using a
9357         linker script.
9358         * layout.h (class Layout): Add increase_relro method.  Add
9359         increase_relro_ field.  Update declarations.
9360         * output.cc (Output_section::Output_section): Initialize
9361         is_last_relro_ and is_first_non_relro_.
9362         (Output_segment::add_output_section): Group relro sections is
9363         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9364         (Output_segment::maximum_alignment): Remove relro handling.
9365         (Output_segment::set_section_addresses): Add increase_relro
9366         parameter.  Change all callers.  Add initial alignment to align
9367         relro sections on separate page.  Remove old relro handling.
9368         (Output_segment::set_section_list_addresses): Remove in_relro
9369         parameter.  Change all callers.
9370         (Output_segment::set_offset): Add increase parameter.  Change all
9371         callers.  Remove old relro handling.
9372         * output.h (class Output_section): Add new methods: is_last_relro,
9373         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9374         Add is_last_relro_ and is_first_non_relro_ fields.
9375         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9376         Create separate .got.plt section.  Call increase_relro.
9377         * x86_64.cc (Target_x86_64::got_section): Likewise.
9378         * testsuite/relro_script_test.t: Add .got.plt.
9379
9380         PR 10450
9381         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9382         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9383         (Layout::finalize): Call set_dynamic_symbol_size.
9384         (Layout::set_dynamic_symbol_size): New function.
9385         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9386         set_dynamic_symbol_size.
9387
9388         PR 10450
9389         * output.h (class Output_section): Add is_entsize_zero_ field.
9390         * output.cc (Output_section::Output_section): Initialize
9391         is_entsize_zero_.
9392         (Output_section::set_entsize): If two different entsizes are
9393         requested, force it to zero.
9394         (Output_section::add_input_section): Set flags for .debug_str
9395         before updating section flags.  Set entsize.
9396         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9397         and SHF_STRING if all input sections have those flags.
9398
9399 2009-12-29   Rafael Espindola  <espindola@google.com>
9400
9401         * main.cc (main): Fix the sys time reporting.
9402         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9403         reporting.
9404
9405 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9406
9407         * options.cc (General_options::parse_version): Allow -v to exit
9408         without an error if there is nothing to link.
9409
9410 2009-12-29  Ian Lance Taylor  <iant@google.com>
9411
9412         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9413         using a version of gcc before 4.1.
9414         * configure: Rebuild.
9415
9416 2009-12-28  Chris Demetriou  <cgd@google.com>
9417
9418         * attributes.cc (Output_attributes_section_data::do_write): Use
9419         std::vector::front rather than std::vector::data.
9420
9421 2009-12-28  Ian Lance Taylor  <iant@google.com>
9422
9423         * symtab.h (class Symbol_table): Add enum Defined.
9424         * resolve.cc (Symbol_table::should_override): Add defined
9425         parameter.  Change all callers.  Test whether object is NULL
9426         before calling a method on it.
9427         (Symbol_table::report_resolve_problem): Add defined parameter.
9428         Change all callers.
9429         (Symbol_table::should_override_with_special): Likewise.
9430         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9431         parameter.  Change all callers.
9432         (Symbol_table::do_define_in_output_data): Likewise.
9433         (Symbol_table::define_in_output_segment): Likewise.
9434         (Symbol_table::do_define_in_output_segment): Likewise.
9435         (Symbol_table::define_as_constant): Likewise.
9436         (Symbol_table::do_define_as_constant): Likewise.
9437         * script.h (class Symbol_assignment): Add is_defsym parameter to
9438         constructor; change all callers.
9439         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9440         parameter.  Change all callers.  Add is_defsym_ field.
9441         (class Parser_closure): Add parsing_defsym parameter to
9442         constructor; change all callers.  Add parsing_defsym accessor
9443         function.  Add parsing_defsym_ field.
9444
9445 2009-12-28  Ian Lance Taylor  <iant@google.com>
9446
9447         * gold.cc (queue_middle_tasks): Fix formatting.
9448         * object.cc (Relobj::is_section_name_included): Likewise.
9449
9450 2009-12-23  Ian Lance Taylor  <iant@google.com>
9451
9452         * i386.cc (Target_i386::do_calls_non_split): Recognize
9453         -fsplit-stack prologue for a function with a static chain.
9454         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9455         -fsplit-stack prologue when using %r11.
9456
9457 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9458
9459         * options.cc (General_options::parse_version): Make -v continue and do
9460         the link like GNU ld does.
9461
9462 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9463
9464         * Makefile.am (CCFILES): Add timer.cc.
9465         (HFILES): Add timer.h.
9466         * configure.ac: Check for sysconf and times.
9467         * main.cc: include timer.h.
9468         (main): Use Timer instead of get_run_time.
9469         * timer.cc: New.
9470         * timer.h: New.
9471         * workqueue.cc: include timer.h.
9472         (Workqueue::find_and_run_task):
9473         Report user, sys and wall time.
9474         * Makefile.in: Regenerate.
9475         * config.in: Regenerate.
9476         * configure: Regenerate.
9477
9478 2009-12-16  Doug Kwan  <dougkwan@google.com>
9479
9480         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9481         sections.
9482         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9483         relaxed input sections.
9484         * output.cc (Output_section::find_relaxed_input_section): Change
9485         return type to Output_relaxed_input_section pointer.  Adjust code
9486         for new type of relaxed_input_section_map_.
9487         * output.h (Output_section::find_relaxed_input_section): Change
9488         return type to Output_relaxed_input_section pointer.
9489         (Output_section::Output_relaxed_input_section_by_input_section_map):
9490         New type.
9491         (Output_section::relaxed_input_section_map_): Change type to
9492         Output_section::Output_relaxed_input_section_by_input_section_map.
9493         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9494         input section.
9495
9496 2009-12-15  Ian Lance Taylor  <iant@google.com>
9497
9498         * layout.cc (Layout::create_shstrtab): Only write out after input
9499         sections if we are compressing debug sections.
9500
9501 2009-12-15  Ian Lance Taylor  <iant@google.com>
9502
9503         * archive.cc (Archive::add_symbols): Only look up a symbol without
9504         a version if there is, in fact, a version.
9505
9506 2009-12-14  Ian Lance Taylor  <iant@google.com>
9507
9508         Revert -Wshadow changes, all changes from:
9509         2009-12-11  Doug Kwan  <dougkwan@google.com>
9510         2009-12-11  Nick Clifton  <nickc@redhat.com>
9511         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9512
9513 2009-12-11  Doug Kwan  <dougkwan@google.com>
9514
9515         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9516         due to -Wshadow.
9517         * attributes.cc (Object_attribute::size): Ditto.
9518         (Attributes_section_data::size): Ditto.
9519         (Attributes_section_data::Attributes_section_data): Ditto.
9520         (Output_attributes_section_data::do_write): Ditto.
9521         * attributes.h (Object_attribute::set_type): Ditto.
9522         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9523
9524 2009-12-11  Nick Clifton  <nickc@redhat.com>
9525
9526         * archive.cc: Fix shadowed variable warnings.
9527         * arm.cc: Likewise.
9528         * compressed_output.cc: Likewise.
9529         * compressed_output.h: Likewise.
9530         * configure: Likewise.
9531         * dwarf_reader.cc: Likewise.
9532         * dynobj.cc: Likewise.
9533         * dynobj.h: Likewise.
9534         * ehframe.cc: Likewise.
9535         * ehframe.h: Likewise.
9536         * errors.cc: Likewise.
9537         * expression.cc: Likewise.
9538         * fileread.cc: Likewise.
9539         * fileread.h: Likewise.
9540         * freebsd.h: Likewise.
9541         * i386.cc: Likewise.
9542         * icf.cc: Likewise.
9543         * incremental.h: Likewise.
9544         * layout.cc: Likewise.
9545         * layout.h: Likewise.
9546         * mapfile.cc: Likewise.
9547         * merge.cc: Likewise.
9548         * merge.h: Likewise.
9549         * object.cc: Likewise.
9550         * object.h: Likewise.
9551         * options.h: Likewise.
9552         * output.cc: Likewise.
9553         * output.h: Likewise.
9554         * parameters.cc: Likewise.
9555         * plugin.cc: Likewise.
9556         * powerpc.cc: Likewise.
9557         * reduced_debug_output.cc: Likewise.
9558         * reduced_debug_output.h: Likewise.
9559         * reloc.cc: Likewise.
9560         * reloc.h: Likewise.
9561         * resolve.cc: Likewise.
9562         * script-sections.cc: Likewise.
9563         * script.cc: Likewise.
9564         * script.h: Likewise.
9565         * sparc.cc: Likewise.
9566         * symtab.cc: Likewise.
9567         * symtab.h: Likewise.
9568         * target-select.cc: Likewise.
9569         * target-select.h: Likewise.
9570         * token.h: Likewise.
9571         * workqueue.cc: Likewise.
9572         * workqueue.h: Likewise.
9573         * x86_64.cc: Likewise.
9574
9575 2009-12-10  Doug Kwan  <dougkwan@google.com>
9576
9577         * arm.cc (attributes.h): New include.
9578         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9579         (Arm_relobj::~Arm_relobj): Delete object pointed by
9580         attributes_section_data_.
9581         (Arm_relobj::attributes_section_data): New method definition.
9582         (Arm_relobj::attributes_section_data_): New data member declaration.
9583         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9584         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9585         attributes_section_data_.
9586         (Arm_dynobj::attributes_section_data): New method definition.
9587         (Arm_dynobj::attributes_section_data_): New data member declaration.
9588         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9589         initialization value of may_use_blx_ to false.
9590         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9591         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9592         object attributes to compute results instead of hard-coding.
9593         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9594         Target_arm::get_secondary_compatible_arch,
9595         Target_arm::set_secondary_compatible_arch
9596         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9597         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9598         New method declarations.
9599         (Target_arm::get_aeabi_object_attribute): New method definition.
9600         (Target_arm::attributes_section_data_): New data member declaration.
9601         (read_arm_attributes_section): New template definition.
9602         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9603         (Arm_dynobj::do_read_symbols): Ditto.
9604         (Target_arm::do_finalize_sections): Merge attributes sections from
9605         input.  Check for BLX use after attributes section merging.
9606         Fix __exidx_start and __exidx_end visibility.  Create an
9607         .ARM.attributes section if necessary.
9608         (Target_arm::get_secondary_compatible_arch,
9609         Target_arm::set_secondary_compatible_arch,
9610         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9611         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9612         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9613         New method definitions.
9614
9615 2009-12-09  Ian Lance Taylor  <iant@google.com>
9616
9617         * plugin.cc (Plugin::load): Don't cast from void* to a function
9618         pointer.
9619
9620 2009-12-09  Ian Lance Taylor  <iant@google.com>
9621
9622         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9623         information fields.
9624
9625 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9626
9627         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9628         Replace two_file_shared_1.so with two_file_shared_2.so.
9629         * testsuite/Makefile.in: Regenerated.
9630
9631 2009-12-08  Doug Kwan  <dougkwan@google.com>
9632
9633         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9634         (HFILES): Add attributes.h and int_encoding.h.
9635         * Makefile.in: Regenerate.
9636         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9637         function definitions to int_encoding.cc
9638         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9639         prototypes to int_encoding.h
9640         * reduced_debug_output.cc (int_encoding.h): New include.
9641         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9642         function definitions to int_encoding.cc
9643         (insert_into_vector, read_from_pointer): Move template definitions to
9644         int_encoding.h
9645         * attributes.cc: New file.
9646         * attributes.h: New file.
9647         * int_encoding.cc: New file.
9648         * int_encoding.h: New file.
9649
9650 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9651
9652         PR gold/11055
9653         * incremental-dump.cc (dump_incremental_inputs): New.
9654         (main): Use dump_incremental_inputs.
9655
9656 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9657
9658         PR gold/10893
9659         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9660         checking elfcpp::STT_FUNC.
9661         (Target_i386::Relocate::relocate): Likewise.
9662         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9663
9664         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9665         symbols from shared libraries into normal FUNC symbols.
9666
9667         * symtab.h (Symbol): Add is_func and use it.
9668
9669 2009-12-05  Doug Kwan  <dougkwan@google.com>
9670
9671         * arm.cc (Target_arm::arm_info): Initialize new fields
9672         attributes_section and attributes_vendor.
9673         * i386.cc (Target_i386::i386_info): Same.
9674         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9675         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9676         fields attributes_section and attributes_vendor.
9677         * sparc.cc (Target_sparc::sparc_info): Same.
9678         * target.h (Target::attributes_section, Target::attributes_vendor,
9679         Target::is_attributes_section, Target::attribute_arg_type,
9680         Target::attributes_order): New method definitions.
9681         (Target::Target_info::attributes_section,
9682         Target::Target_info::attributes_vendor): New fields.
9683         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9684         virtual method definitions.
9685         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9686         attributes_section and attributes_vendor.
9687         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9688
9689 2009-12-05  Doug Kwan  <dougkwan@google.com>
9690
9691         * arm.cc: Update comments about interworking and stub generation.
9692         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9693         considered as non-PIC.
9694         (Arm_relocate_functions::base_abs): Fix formatting.
9695         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9696         of function to use GOT entry address instead of offset.
9697         (Target_arm::Scan::global): Issue an error if a symbol would need a
9698         PLT does not get one because it is untyped.  Remove code to create
9699         dynamic symbols for relative branches.
9700         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9701         takes unsigned integer instead of boolean.
9702
9703 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9704
9705         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9706         (two_file_test_LDADD): Likewise.
9707         (common_test_1_LDADD): Likewise.
9708         (exception_test_LDADD) Likewise.
9709         (weak_test_LDADD): Likewise.
9710         (many_sections_test_LDADD): Likewise.
9711         (initpri1_LDADD): Likewise.
9712         (script_test_1_LDADD): Likewise.
9713         (script_test_2_LDADD): Likewise.
9714         (justsyms_LDADD): Likewise.
9715         (binary_test_LDADD): Likewise.
9716         (large_LDADD): Likewise.
9717         * testsuite/Makefile.in: Regenerated.
9718
9719 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9720
9721         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9722         (Symbol_table::override_with_special): Likewise.
9723         (Symbol_table::add_from_object): Likewise.
9724
9725 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9726
9727         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9728         Don't set the data_offset twice.
9729
9730 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9731
9732         * testsuite/Makefile.in: Regenerate.
9733
9734 2009-12-03  Doug Kwan  <dougkwan@google.com>
9735
9736         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9737         (Target_arm::do_finalize_sections): Add parameter for symbol table
9738         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9739         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9740         parameter for symbol table pointer.
9741         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9742         an additional parameter for a pointer to symbol table.
9743         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9744         parameter for a symbol table pointer.
9745         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9746         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9747         Ditto.
9748         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9749         parameter for a symbol table pointer.
9750
9751 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9752
9753         * incremental.cc (Incremental_inputs_header)
9754         (Incremental_inputs_header_write, Incremental_inputs_entry)
9755         (Incremental_inputs_entry_write): Move ...
9756         * incremental.h (Incremental_inputs_header)
9757         (Incremental_inputs_header_write, Incremental_inputs_entry)
9758         (Incremental_inputs_entry_write): here.
9759
9760 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9761
9762         * incremental.cc (make_sized_incremental_binary): Set the target.
9763         Error if it is incompatible.
9764         * output.h (Output_file): Add filename method.
9765
9766 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9767
9768         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9769         from the get_* methods.
9770
9771 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9772
9773         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9774         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9775         Write 0 for the data_offset of scripts.
9776
9777 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9778
9779         * testsuite/Makefile.am: Add the incremental_test.sh test.
9780         * testsuite/incremental_test.sh: New.
9781         * testsuite/incremental_test_1.c: New.
9782         * testsuite/incremental_test_2.c: New.
9783
9784 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9785
9786         * incremental-dump.cc (main): Fix typos.
9787
9788 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9789
9790         PR gold/11025
9791         * incremental-dump.cc (main): Use llu to print 64 bit values.
9792
9793 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9794             H.J. Lu  <hongjiu.lu@intel.com>
9795
9796         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9797         $(LIBDL).
9798         (incremental_dump_LDADD): Likewise.
9799         * Makefile.in: Regenerated.
9800
9801 2009-11-25  Doug Kwan  <dougkwan@google.com>
9802
9803         Revert:
9804
9805         2009-11-25  Doug Kwan  <dougkwan@google.com>
9806
9807                 * arm.cc (Target_arm::Target_arm): Move method definition
9808                 outside of class definition.  Add code to handle
9809                 --target1-rel, --target1-abs and --target2= options.
9810                 (Target_arm::get_reloc_reloc_type): Change method to be
9811                 non-static and const.
9812                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9813                 New data member declaration.
9814                 (Target_arm::Scan::local, Target_arm::Scan::global,
9815                 Target_arm::Relocate::relocate,
9816                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9817                 Adjust call to Target_arm::get_real_reloc_type.
9818                 (Target_arm::get_real_reloc_type): Use command line options
9819                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9820                 * options.h (--target1-rel, --target1-abs, --target2): New
9821                 ARM-only options.
9822
9823 2009-11-25  Doug Kwan  <dougkwan@google.com>
9824
9825         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9826         class definition.  Add code to handle --target1-rel, --target1-abs
9827         and --target2= options.
9828         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9829         and const.
9830         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9831         member declaration.
9832         (Target_arm::Scan::local, Target_arm::Scan::global,
9833         Target_arm::Relocate::relocate,
9834         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9835         call to Target_arm::get_real_reloc_type.
9836         (Target_arm::get_real_reloc_type): Use command line options to
9837         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9838         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9839         options.
9840
9841 2009-11-25  Doug Kwan  <dougkwan@google.com>
9842
9843         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9844         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9845         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9846         formatting.
9847         (Arm_relocate_functions::thm_call): Replace body with a call to
9848         Arm_relocate_functions::thumb_branch_common.
9849         (Arm_relocate_functions::thm_jump24,
9850         Arm_relocate_functions::thm_xpc22): New method definitions.
9851         (Arm_relocate_functions::thumb_branch_common): New method definition.
9852         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9853         operator.
9854         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9855         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9856
9857 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9858
9859         * Makefile.am: Build incremental-dump
9860         * Makefile.in: Regenerate.
9861         * incremental-dump.cc: New.
9862         * incremental.cc (Incremental_inputs_header_data,
9863         Incremental_inputs_entry_data): Move to incremental.h
9864         * incremental.h: (Incremental_inputs_header_data,
9865         Incremental_inputs_entry_data): Move from incremental.cc
9866
9867 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9868
9869         * incremental.cc (Incremental_inputs_header,
9870         Incremental_inputs_header_write, Incremental_inputs_entry,
9871         Incremental_inputs_entry_write): Add a typedef with the data type.
9872
9873 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9874
9875         * incremental.cc (Incremental_inputs_header,
9876         Incremental_inputs_header_write, Incremental_inputs_entry,
9877         Incremental_inputs_entry_write): Update comment about which
9878         type has the filed descriptions.
9879
9880 2009-11-15  Doug Kwan  <dougkwan@google.com>
9881
9882         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9883         (Arm_relocate_functions::arm_branch_common): Change method defintion
9884         in class definition to a method declaration and update list of formal
9885         parameters.
9886         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9887         Arm_relocation_functions::jump24): Adjust call to
9888         Arm_relocate_functions::arm_branch_common.  Update list of formal
9889         parameters.
9890         (Arm_relocate_functions::xpc25): New method definition.
9891         (Arm_relocate_functions::arm_branch_common): Move method defintion
9892         out from class definition.  Use stubs for mode-switching and extending
9893         branch ranges.
9894         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9895         specially.  Change code to enable use of stubs in ARM branches.
9896
9897 2009-11-10  Doug Kwan  <dougkwan@google.com>
9898
9899         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9900         in method declaration.
9901         (Target_arm::relocate_stub): New method declaration.
9902         (Target_arm::default_target): Change to return a pointer instead of
9903         a const reference.
9904         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9905         Target_arm::default_target.
9906         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9907         method definition.
9908         (Target_arm::relocate_section): Adjust view.
9909         (Target_arm::relocate_stub): New method definition.
9910
9911 2009-11-10  Doug Kwan  <dougkwan@google.com>
9912
9913         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9914         a format warning.
9915         * incremental.cc (open_incremental_binary): Initialized local
9916         variables to avoid warnings.
9917         * object.cc (make_elf_object): Ditto.
9918         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9919         a format warning.
9920
9921 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9922
9923         PR gold/10930
9924         * testsuite/plugin_test.c: Include "config.h".
9925
9926 2009-11-09  Doug Kwan  <dougkwan@google.com>
9927
9928         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9929         (arm_symbol_value): Remove.
9930         (Arm_relocate_functions::arm_branch_common,
9931         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9932         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9933         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9934         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9935         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9936         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9937         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9938         Arm_relocate_functions::thm_mobw_abs_nc,
9939         Arm_relocate_functions::thm_mov_abs,
9940         Arm_relocate_functions::movw_prel_nc,
9941         Arm_relocate_functions::thm_movt_abs,
9942         Arm_relocate_functions::movt_prel,
9943         Arm_relocate_functions::thm_movw_prel_nc,
9944         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9945         (Target_arm::Relocate::relocate): Only decompose address into two
9946         parts if relocation type uses the thumb-bit and pass the actual
9947         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9948         calls to methods in Arm_relocate_functions for this change.
9949
9950 2009-11-08  Ian Lance Taylor  <iant@google.com>
9951
9952         PR 10925
9953         * reloc.cc: Instantiate
9954         Sized_relobj::initialize_input_to_output_maps and
9955         Sized_relobj:free_input_to_output_maps.
9956
9957 2009-11-06  Ian Lance Taylor  <iant@google.com>
9958
9959         PR 10876
9960         * defstd.cc (in_segment): Set only_if_ref true for "end".
9961
9962 2009-11-06  Doug Kwan  <dougkwan@google.com>
9963
9964         * arm.cc (class Reloc_stub): Correct a comment.
9965         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9966         (Target_arm::scan_section_for_stubs): New method declaration.
9967         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9968         Change methods from private to protected.
9969         (Target_arm::do_may_relax): New method definition.
9970         (Target_arm::do_relax, Target_arm::group_sections,
9971         Target_arm::scan_reloc_for_stub,
9972         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9973         (Target_arm::arm_input_section_map_): New data member declaration.
9974         (Target_arm::scan_reloc_for_stub,
9975         Target_arm::scan_reloc_section_for_stubs,
9976         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9977         Target_arm::do_relax): New method definitions.
9978
9979 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9980
9981         * configure.ac: Check for (struct stat)::st_mtim
9982         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9983         * config.in: Regenerate.
9984         * configure: Regenerate.
9985
9986 2009-11-05  Ian Lance Taylor  <iant@google.com>
9987
9988         PR 10910
9989         * output.cc (Output_segment::add_output_section): Add missing
9990         return statement.
9991
9992 2009-11-04  Ian Lance Taylor  <iant@google.com>
9993
9994         PR 10880
9995         * object.h (class Object): Add is_needed and set_is_needed
9996         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9997         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9998         defined in a dynamic object and referenced by a regular object,
9999         set is_needed for the dynamic object.
10000         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10001         if the file is marked with as_needed and it is not needed.
10002
10003 2009-11-04  Ian Lance Taylor  <iant@google.com>
10004
10005         PR 10887
10006         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10007         tags if data is discarded by linker script.
10008         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10009         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10010         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10011         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10012
10013 2009-11-04  Ian Lance Taylor  <iant@google.com>
10014
10015         * layout.cc (Layout::get_output_section): Add is_interp and
10016         is_dynamic_linker_section parameters.  Change all callers.
10017         (Layout::choose_output_section): Likewise.
10018         (Layout::make_output_section): Likewise.
10019         (Layout::add_output_section_data): Add is_dynamic_linker_section
10020         parameter.  Change all callers.
10021         * layout.h (class Layout): Update declarations.
10022         * output.h (class Output_section): Add is_interp, set_is_interp,
10023         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10024         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10025         generate_code_fills_at_write_ to a bitfield.
10026         * output.cc (Output_section::Output_sections): Initialize new
10027         fields.
10028         (Output_segment::add_output_section): Add do_sort parameter.
10029         Change all callers.
10030
10031 2009-11-03  Ian Lance Taylor  <iant@google.com>
10032
10033         PR 10860
10034         * options.h (class General_options): Add --warn-common.
10035         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10036         merging two common symbols.
10037         (Symbol_table::should_override): Handle --warn-common when merging
10038         a common symbol with a defined symbol.  Use report_resolve_problem
10039         for multiple definitions.
10040         (Symbol_table::report_resolve_problem): New function.
10041         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10042
10043 2009-11-03  Doug Kwan  <dougkwan@google.com>
10044
10045         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10046         stub_factory_.
10047         (Target_arm::stub_factory): New method definition.
10048         (Target_arm::new_arm_input_section,
10049         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10050         Target_arm::reloc_uses_thumb_bit): New method declarations.
10051         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10052         New type definitions.
10053         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10054         member declarations.
10055         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10056         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10057         New method definitions.
10058
10059 2009-11-03  Ian Lance Taylor  <iant@google.com>
10060
10061         * options.h (class General_options): Add --warn_constructors.
10062
10063 2009-11-03  Ian Lance Taylor  <iant@google.com>
10064
10065         PR 10893
10066         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10067         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10068
10069 2009-11-03  Ian Lance Taylor  <iant@google.com>
10070
10071         PR 10895
10072         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10073         --msgid-bugs-address.
10074         (install-pdf): New target.
10075         (install-data_yes): Look up one directory to find mkinstalldirs.
10076
10077 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10078
10079         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10080         tree.
10081
10082 2009-10-30  Doug Kwan  <dougkwan@google.com>
10083
10084         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10085
10086 2009-10-30  Doug Kwan  <dougkwan@google.com>
10087
10088         * arm.cc (Stub_addend_reader): New struct template definition
10089         and partial specializations.
10090         (Stub_addend_reader::operator()): New method definition for a
10091         partially specialized template.
10092
10093 2009-10-30  Doug Kwan  <dougkwan@google.com>
10094
10095         * arm.cc (Arm_relobj::processor_specific_flags): New method
10096         definition.
10097         (Arm_relobj::do_read_symbols): New method declaration.
10098         (Arm_relobj::processor_specific_flags_): New data member declaration.
10099         (Arm_dynobj): New class definition.
10100         (Target_arm::do_finalize_sections): Add input_objects parameter.
10101         (Target_arm::do_adjust_elf_header): New method declaration.
10102         (Target_arm::are_eabi_versions_compatible,
10103         (Target_arm::merge_processor_specific_flags): New method declaration.
10104         (Target_arm::do_make_elf_object): New overloaded method definitions
10105         and declaration.
10106         (Arm_relobj::do_read_symbols): New method definition.
10107         (Arm_dynobj::do_read_symbols): Ditto.
10108         (Target_arm::do_finalize_sections): Add input_objects parameters.
10109         Merge processor-specific flags from all input objects.
10110         (Target_arm::are_eabi_versions_compatible,
10111         Target_arm::merge_processor_specific_flags,
10112         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10113         New method definitions.
10114         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10115         Input_objects pointer type parameter.
10116         * layout.cc (Layout::finalize): Pass input objects to target's.
10117         finalize_sections function.
10118         * output.cc (Output_file_header::do_sized_write): Set ELF file
10119         header's processor-specific flags.
10120         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10121         Input_objects pointer type parameter.
10122         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10123         * target.h (Input_objects): New forward class declaration.
10124         (Target::processor_specific_flags,
10125         Target::are_processor_specific_flags_sect): New method definitions.
10126         (Target::finalize_sections): Add input_objects parameter.
10127         (Target::Target): Initialize processor_specific_flags_ and
10128         are_processor_specific_flags_set_.
10129         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10130         parameter.
10131         (Target::set_processor_specific_flags): New method definition.
10132         (Target::processor_specific_flags_,
10133         Target::are_processor_specific_flags_set_): New data member
10134         declarations.
10135         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10136         Input_objects pointer type parameter.
10137
10138 2009-10-30  Doug Kwan  <dougkwan@google.com>
10139
10140         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10141
10142 2009-10-28  Ian Lance Taylor  <iant@google.com>
10143
10144         * object.h (class Relobj): Drop options parameter from
10145         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10146         do_scan_relocs, do_relocate.  Change all callers.
10147         (class Sized_relobj): Drop options parameters from
10148         do_gc_process_relocs, do_scan_relocs, do_relocate,
10149         do_relocate_sections, relocate_sections, emit_relocs_scan,
10150         emit_relocs_scan_reltype.  Change all callers.
10151         (struct Relocate_info): Remove options field and all references to
10152         it.
10153         * reloc.h (class Read_relocs): Remove options constructor
10154         parameter and options_ field.  Change all callers.
10155         (class Gc_process_relocs, class Scan_relocs): Likewise.
10156         (class Relocate_task): Likewise.
10157         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10158         all callers.
10159         (scan_relocatable_relocs): Likewise.
10160         * target.h (class Sized_target): Remove options parameter from
10161         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10162         all callers.
10163         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10164         callers.
10165         * arm.cc: Update functions to remove options parameters.
10166         * i386.cc: Likewise.
10167         * powerpc.cc: Likewise.
10168         * sparc.cc: Likewise.
10169         * x86_64.cc: Likewise.
10170         * testsuite/testfile.cc: Likewise.
10171
10172 2009-10-28  Doug Kwan  <dougkwan@google.com>
10173
10174         * arm.cc (Arm_relobj): New class definition.
10175         (Arm_relobj::scan_sections_for_stubs,
10176         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10177         New method definitions.
10178
10179 2009-10-28  Cary Coutant  <ccoutant@google.com>
10180
10181         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10182         (Plugin::cleanup_done_): New member.
10183         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10184         (Plugin_manager::cleanup_done_): Remove.
10185         (Plugin_manager::add_input_file): Edit error message.
10186         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10187         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10188
10189 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10190
10191         * fileread.cc: (File_read::View::~View): Use the new
10192         data_ownership_ filed.
10193         (File_read::~File_read): Dispose the new whole_file_view_.
10194         (File_read::open): Mmap the whole file if needed.
10195         (File_read::open): Use whole_file_view_ instead of contents_.
10196         (File_read::find_view): Use whole_file_view_ if applicable.
10197         (File_read::do_read): Use whole_file_view_ instead of contents_.
10198         (File_read::make_view): Use whole_file_view_ instead of contents_,
10199         update File_read::View::View call.
10200         (File_read::find_or_make_view): Update File_read::View::View
10201         call.
10202         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10203         remove contents_
10204         (File_read::View::Data_ownership): New enum.
10205         (File_read::View::View): Replace bool mapped_ with Data_ownership
10206         argument.
10207         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10208         (File_read::View::data_ownership_): New field.
10209         (File_read::contents_): Remove (replaced by whole_file_view_).
10210         (File_read::whole_file_view_): New field.
10211         * options.h (class General_options): Add --keep-files-mapped.
10212
10213 2009-10-27  Cary Coutant  <ccoutant@google.com>
10214
10215         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10216         * testsuite/Makefile.am (plugin_test_5): New test case.
10217         * testsuite/Makefile.in: Regenerate.
10218
10219 2009-10-25  Doug Kwan  <dougkwan@google.com>
10220
10221         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10222         from private to protected to allow access by child class.
10223         (Sized_relobj::do_relocate_sections): New method declaration.
10224         (Sized_relobj::relocate_sections): Virtualize.
10225         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10226         Sized_relobj::relocate_sections.  Instantiate template explicitly
10227         for different target sizes and endianity.
10228
10229 2009-10-24  Doug Kwan  <dougkwan@google.com>
10230
10231         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10232         (Arm_input_section::as_arm_input_section): New method.
10233         (Arm_output_section): New class definition.
10234         (Arm_output_section::create_stub_group,
10235         Arm_output_section::group_sections): New method definitions.
10236
10237 2009-10-22  Doug Kwan  <dougkwan@google.com>
10238
10239         * arm.cc (Arm_input_section): New class definition.
10240         (Arm_input_section::init, Arm_input_section:do_write,
10241         Arm_input_section::set_final_data_size,
10242         Arm_input_section::do_reset_address_and_file_offset): New method
10243         definitions.
10244
10245 2009-10-21  Doug Kwan  <dougkwan@google.com>
10246
10247         * arm.cc (Stub_table, Arm_input_section): New forward class
10248         declarations.
10249         (Stub_table): New class defintion.
10250         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10251         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10252         New method definition.
10253
10254 2009-10-21  Doug Kwan  <dougkwan@google.com>
10255
10256         * arm.cc: Update copyright comments.
10257         (Target_arm): New forward class template declaration.
10258         (Arm_address): New type.
10259         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10260         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10261         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10262         constants.
10263         (Insn_template): Same.
10264         (DEF_STUBS): New macro.
10265         (Stub_type): New enum type.
10266         (Stub_template): New class definition.
10267         (Stub): Same.
10268         (Reloc_stub): Same.
10269         (Stub_factory): Same.
10270         (Target_arm::Target_arm): Initialize may_use_blx_ and
10271         should_force_pic_veneer_.
10272         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10273         Target_arm::should_force_pic_veneer,
10274         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10275         Target_arm::using_thumb_only, Target_arm:;default_target): New
10276         method defintions.
10277         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10278         New data member declarations.
10279         (Insn_template::size, Insn_template::alignment): New method defintions.
10280         (Stub_template::Stub_template): New method definition.
10281         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10282         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10283         (Stub_factory::Stub_factory): New method definition.
10284         * gold.h (string_hash): New template.
10285         * output.h (Input_section_specifier::hash_value): Use
10286         gold::string_hash.
10287         (Input_section_specifier::string_hash): Remove.
10288         * stringpool.cc (Stringpool_template::string_hash): Use
10289         gold::string_hash.
10290
10291 2009-10-20  Doug Kwan  <dougkwan@google.com>
10292
10293         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10294         symbols of relaxed input sections.
10295         * output.h (Output_section::find_relaxed_input_section): Make
10296         method public.
10297
10298 2009-10-16  Doug Kwan  <dougkwan@google.com>
10299
10300         * dynobj.cc (Versions::Versions): Initialize version_script_.
10301         Only insert base version symbol definition for a shared object
10302         if version script defines any version versions.
10303         (Versions::define_base_version): New method definition.
10304         (Versions::add_def): Check that base version is not needed.
10305         (Versions::add_need): Define base version lazily.
10306         * dynobj.h (Versions::define_base_version): New method declaration.
10307         (Versions::needs_base_version_): New data member declaration.
10308         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10309         (check_DATA): Add no_version_test.stdout.
10310         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10311         New make rules.
10312         * testsuite/Makefile.in: Regenerate.
10313         * testsuite/no_version_test.c: New file.
10314         * testsuite/no_version_test.sh: Ditto.
10315
10316 2009-10-16  Doug Kwan  <dougkwan@google.com>
10317
10318         * expression.cc (class Segment_start_expression): New class definition.
10319         (Segment_start_expression::value): New method definition.
10320         (script_exp_function_segment_start): Return a new
10321         Segment_start_expression.
10322         * gold/script-c.h (script_saw_segment_start_expression): New function
10323         prototype.
10324         * script-sections.cc (Script_sections::Script_sections): Initialize
10325         SAW_SEGMENT_START_EXPRESSION_ to false.
10326         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10327         and -Tbbs options to specify section addresses if given in
10328         command line and no SEGMENT_START expression is seen in a script.
10329         * script-sections.h (Script_sections::saw_segment_start_expression,
10330         Script_sections::set_saw_segment_start_expression): New method
10331         definition.
10332         (Script_sections::saw_segment_start_expression_): New data member
10333         declaration.
10334         * script.cc (script_saw_segment_start_expression): New function.
10335         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10336         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10337         script_test_7.sh and script_test_8.sh.
10338         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10339         script_test_8.stdout.
10340         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10341         (script_test_6, script_test_6.stdout, script_test_7,
10342         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10343         * Makefile.in: Regenerate.
10344         * testsuite/script_test_6.sh: New file.
10345         * testsuite/script_test_6.t: Same.
10346         * testsuite/script_test_7.sh: Same.
10347         * testsuite/script_test_7.t: Same.
10348         * testsuite/script_test_8.sh: Same.
10349
10350 2009-10-16  Doug Kwan  <dougkwan@google.com>
10351
10352         * output.cc (Output_segment::set_section_list_address): Cast
10353         expressions to unsigned long long type to avoid format warnings.
10354
10355 2009-10-15  Ian Lance Taylor  <iant@google.com>
10356
10357         * script.cc (Script_options::add_symbol_assignment): Always add a
10358         dot assignment to script_sections_.
10359         * script-sections.cc (Script_sections::add_dot_assignment):
10360         Initialize if necessary.
10361
10362         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10363         program headers with no load segment if there is a linker script.
10364
10365         * layout.cc (Layout::set_segment_offsets): Align the file offset
10366         to the segment aligment for -N or -n with no load segment.
10367         * output.cc (Output_segment::add_output_section): Don't crash if
10368         the first section is a TLS section.
10369         (Output_segment::set_section_list_addresses): Print an error
10370         message if the address moves backward in a linker script.
10371         * script-sections.cc
10372         (Output_section_element_input::set_section_addresses): Don't
10373         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10374         (Orphan_output_section::set_section_addresses): Likewise.
10375
10376 2009-10-15  Doug Kwan  <dougkwan@google.com>
10377
10378         * layout.cc (Layout::finish_dynamic_section): Generate tags
10379         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10380         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10381         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10382
10383 2009-10-14  Ian Lance Taylor  <iant@google.com>
10384
10385         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10386         fields.
10387         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10388         data_shdr fields of relinfo.
10389         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10390         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10391         R_386_TLS_LDO_32, adjust based on section flags.
10392         (Target_i386::Relocate::fix_up_ldo): Remove.
10393
10394 2009-10-13  Ian Lance Taylor  <iant@google.com>
10395
10396         Add support for -pie.
10397         * options.h (class General_options): Add -pie and
10398         --pic-executable.
10399         (General_options::output_is_position_independent): Test -pie.
10400         (General_options::output_is_executable): Return true if not shared
10401         and not relocatable.
10402         (General_options::output_is_pie): Remove.
10403         * options.cc (General_options::finalize): Reject incompatible uses
10404         of -pie.
10405         * gold.cc (queue_middle_tasks): A -pie link is not static.
10406         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10407         * symtab.cc (Symbol::final_value_is_known): Return false if
10408         output_is_position_independent.
10409         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10410         output_is_position_independent.
10411         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10412         output_is_position_independent.
10413         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10414         output_is_position_independent.
10415         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10416         two_file_pie_test.
10417         (basic_pie_test.o, basic_pie_test): New targets.
10418         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10419         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10420         (two_file_pie_test): New target.
10421         * testsuite/Makefile.in: Rebuild.
10422         * README: Remove note saying that -pie is not supported.
10423
10424 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10425
10426         * options.h (class General_options): Add -init and -fini.
10427         * layout.cc (Layout::finish_dynamic_section): Emit
10428         given init and fini functions.
10429
10430 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10431
10432         * gc.h (gc_process_relocs): Check if icf is enabled using new
10433         function.
10434         * gold.cc (queue_initial_tasks): Likewise.
10435         (queue_middle_tasks): Likewise.
10436         * object.cc (do_layout): Likewise.
10437         * symtab.cc (is_section_folded): Likewise.
10438         * main.cc (main): Likewise.
10439         * reloc.cc (Read_relocs::run): Likewise.
10440         (Sized_relobj::do_scan_relocs): Likewise.
10441         * icf.cc (is_function_ctor_or_dtor): New function.
10442         (Icf::find_identical_sections): Check if function is ctor or dtor when
10443         safe icf is chosen.
10444         * options.h (General_options::icf): Change option to be an enum.
10445         (Icf_status): New enum.
10446         (icf_enabled): New method.
10447         (icf_safe_folding): New method.
10448         (set_icf_status): New method.
10449         (icf_status_): New variable.
10450         * (options.cc) (General_options::finalize): Set icf_status_.
10451         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10452         icf_test and icf_keep_unique_test to use the --icf enum flag.
10453         * testsuite/icf_safe_test.sh: New file.
10454         * testsuite/icf_safe_test.cc: New file.
10455
10456 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10457
10458         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10459         includes to gc.h and icf.h.
10460         * arm.cc: Include gc.h.
10461         * gold.cc: Likewise.
10462         * i386.cc: Likewise.
10463         * powerpc.cc: Likewise.
10464         * sparc.cc: Likewise.
10465         * x86_64.cc: Likewise.
10466         * gc.h: Include icf.h.
10467
10468 2009-10-11  Ian Lance Taylor  <iant@google.com>
10469
10470         * plugin.cc: Include "gold.h" before other header files.
10471
10472 2009-10-10  Chris Demetriou  <cgd@google.com>
10473
10474         * options.h (Input_file_argument::Input_file_type): New enum.
10475         (Input_file_argument::is_lib_): Replace with...
10476         (Input_file_argument::type_): New member.
10477         (Input_file_argument::Input_file_argument): Take Input_file_type
10478         'type' rather than boolean 'is_lib' as second argument.
10479         (Input_file_argument::is_lib): Use type_.
10480         (Input_file_argument::is_searched_file): New function.
10481         (Input_file_argument::may_need_search): Handle is_searched_file.
10482         * options.cc (General_options::parse_library): Support -l:filename.
10483         (General_options::parse_just_symbols): Update for Input_file_argument
10484         changes.
10485         (Command_line::process): Likewise.
10486         * archive.cc (Archive::get_file_and_offset): Likewise.
10487         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10488         * script.cc (read_script_file, script_add_file): Likewise.
10489         * fileread.cc (Input_file::Input_file): Likewise.
10490         (Input_file::will_search_for): Handle is_searched_file.
10491         (Input_file::open): Likewise.
10492         * readsyms.cc (Read_symbols::get_name): Likewise.
10493         * testsuite/Makefile.am (searched_file_test): New test.
10494         * testsuite/Makefile.in: Regenerate.
10495         * testsuite/searched_file_test.cc: New file.
10496         * testsuite/searched_file_test_lib.cc: New file.
10497
10498 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10499             Ian Lance Taylor  <iant@google.com>
10500
10501         * descriptor.cc: Include <cstdio> and "binary-io.h".
10502         (Descriptors::open): Open the files in binary mode always.
10503         * script.cc (Lex::get_token): Treat \r as whitespace.
10504
10505 2009-10-09  Ian Lance Taylor  <iant@google.com>
10506
10507         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10508
10509 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10510             Ian Lance Taylor  <iant@google.com>
10511
10512         * configure.ac: Check for readv function also.
10513         * fileread.cc (readv): Define if not HAVE_READV.
10514         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10515         does not exist.
10516         * config.in: Regenerate.
10517         * configure: Regenerate.
10518
10519 2009-10-09  Doug Kwan  <dougkwan@google.com>
10520
10521         * layout.cc (Layout::make_output_section): Call target hook to make
10522         ordinary output section.
10523         (Layout::finalize): Adjust parameter list of call the
10524         Target::may_relax().
10525         * layout.h (class Layout::section_list): New method.
10526         * merge.h (Output_merge_base::entsize): Change visibility to public.
10527         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10528         New methods.
10529         (Output_merge_string::do_is_string): New method.
10530         * object.cc (Sized_relobj::do_setup): renamed from
10531         Sized_relobj::set_up.
10532         * object.h (Sized_relobj::adjust_shndx,
10533         Sized_relobj::initializ_input_to_output_maps,
10534         Sized_relobj::free_input_to_output_maps): Change visibilities to
10535         protected.
10536         (Sized_relobj::setup): Virtualize.
10537         (Sized_relobj::do_setup): New method declaration.
10538         (Sized_relobj::invalidate_section_offset,
10539         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10540         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10541         * options.cc (parse_int): New function.
10542         * options.h (parse_int): New declaration.
10543         (DEFINE_int): New macro.
10544         (stub_group_size): New option.
10545         * output.cc (Output_section::Output_section): Initialize memebers
10546         merge_section_map_, merge_section_by_properties_map_,
10547         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10548         (Output_section::add_input_section): Handled deferred code-fill
10549         generation and remove an old comment.
10550         (Output_section::add_relaxed_input_section): New method definition.
10551         (Output_section::add_merge_input_section): Use merge section by
10552         properties map to speed to search.  Update merge section maps
10553         as appropriate.
10554         (Output_section::build_relaxation_map): New method definition.
10555         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10556         Same.
10557         (Output_section::relax_input_section): Renamed to
10558         Output_section::convert_input_sections_to_relaxed_sections and change
10559         interface to take a vector of pointers to relaxed sections.
10560         (Output_section::find_merge_section,
10561         Output_section::find_relaxed_input_section): New method definitions.
10562         (Output_section::is_input_address_mapped,
10563         Output_section::output_offset, Output_section::output_address):
10564         Use output section data maps to speed up searching.
10565         (Output_section::find_starting_output_address): Add comments.
10566         (Output_section::do_write,
10567         Output_section::write_to_postprocessing_buffer): Do code-fill
10568         generation as appropriate.
10569         (Output_section::get_input_sections): Invalidate relaxed input section
10570         map.
10571         (Output_section::restore_states): Adjust type of checkpoint .
10572         Invalidate relaxed input section map.
10573         * output.h (Output_merge_base): New class declaration.
10574         (Input_section_specifier): New class defintion.
10575         (class Output_relaxed_input_section) Change base class to
10576         Output_section_data_build.
10577         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10578         base class initializer.
10579         (Output_section::add_relaxed_input_section): New method declaration.
10580         (Output_section::Input_section): Change visibility to protected.
10581         (Output_section::Input_section::relobj,
10582         Output_section::Input_section::shndx): Handle relaxed input sections.
10583         Output_section::input_sections) Change visibility to protected.  Also
10584         define overload to return a non-const pointer.
10585         (Output_section::Merge_section_properties): New class defintion.
10586         (Output_section::Merge_section_by_properties_map,
10587         Output_section::Output_section_data_by_input_section_map,
10588         Output_section::Relaxation_map): New types.
10589         (Output_section::relax_input_section): Rename method to
10590         Output_section::convert_input_sections_to_relaxed_sections and change
10591         interface to take a vector of relaxed section pointers.
10592         (Output_section::find_merge_section,
10593         Output_section::find_relaxed_input_section,
10594         Output_section::build_relaxation_map,
10595         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10596         New method declarations.
10597         (Output_section::merge_section_map_
10598         Output_section::merge_section_by_properties_map_,
10599         Output_section::relaxed_input_section_map_,
10600         Output_section::is_relaxed_input_section_map_valid_,
10601         Output_section::generate_code_fills_at_write_): New data members.
10602         * script-sections.cc
10603         (Output_section_element_input::set_section_addresses): Call
10604         current_data_size and addralign methods of relaxed input sections.
10605         (Orphan_output_section::set_section_addresses): Call current_data_size
10606         and addralign methods of relaxed input sections.
10607         * symtab.cc (Symbol_table::compute_final_value): Extract template
10608         from the body of Symbol_table::sized_finalize_symbol.
10609         (Symbol_table::sized_finalized_symbol): Call
10610         Symbol_table::compute_final_value.
10611         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10612         (Symbol_table::compute_final_value): New templated method declaration.
10613         * target.cc (Target::do_make_output_section): New method defintion.
10614         * target.h (Target::make_output_section): New method declaration.
10615         (Target::relax): Add more parameters for input objects, symbol table
10616         and layout.  Adjust call to do_relax.
10617         (Target::do_make_output_section): New method declaration.
10618         (Target::do_relax): Add parameters for input objects, symbol table
10619         and layout.
10620
10621 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10622
10623         * pread.c: Include stdio.h.
10624
10625 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10626
10627         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10628         defined.
10629
10630 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10631
10632         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10633         Change read_shndx type to unsigned int.
10634         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10635         int.
10636         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10637         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10638         Change read_shndx type to unsigned int.
10639         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10640         int.
10641         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10642         * layout.cc (Layout::create_symtab_sections): Cast the result of
10643         local_symcount * symsize to off_t in the gold_assert.
10644
10645 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10646
10647         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10648         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10649         R_ARM_BASE_ABS.
10650         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10651         (Arm_relocate_functions::thm_abs5): New function.
10652         (Arm_relocate_functions::abs12): New function.
10653         (Arm_relocate_functions::abs16): New function.
10654         (Arm_relocate_functions::base_abs): New function.
10655         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10656         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10657         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10658         R_ARM_BASE_ABS.
10659         (Scan::global): Likewise.
10660         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10661         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10662         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10663         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10664         R_ARM_BASE_ABS.
10665
10666 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10667
10668         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10669         (Arm_relocate_functions::movt_prel): New function.
10670         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10671         (Arm_relocate_functions::thm_movt_prel): New function.
10672         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10673         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10674         (Scan::global, Relocate::relocate): Likewise.
10675         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10676
10677 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10678
10679         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10680         Incremental_checker.
10681         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10682         unsigned int.
10683         (class Incremental_inputs_header): New class.
10684         (Incremental_inputs_header_writer): Edit comment.
10685         (Incremental_inputs_entry): New class.
10686         (Incremental_inputs_entry_writer): Edit comment.
10687         (Sized_incremental_binary::do_find_incremental_inputs_section):
10688         Add *strtab_shndx parameter, fill it.
10689         (Sized_incremental_binary::do_check_inputs): New method.
10690         (Incremental_checker::can_incrementally_link_output_file): Use
10691         Sized_incremental_binary::check_inputs.
10692         (Incremental_inputs::report_command_line): Save command line in
10693         command_line_.
10694         * incremental.h:
10695         (Incremental_binary::find_incremental_inputs_section): New
10696         method.
10697         (Incremental_binary::do_find_incremental_inputs_section): Add
10698         strtab_shndx parameter.
10699         (Incremental_binary::do_check_inputs): New pure virtual method.
10700         (Sized_incremental_binary::do_check_inputs): Declare.
10701         (Incremental_checker::Incremental_checker): Add incremental_inputs
10702         parameter, use it to initialize incremental_inputs_.
10703         (Incremental_checker::incremental_inputs_): New field.
10704         (Incremental_checker::command_line): New method.
10705         (Incremental_checker::inputs): New method.
10706         (Incremental_checker::command_line_): New field.
10707
10708 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10709
10710         * incremental.cc: Include <cstdarg> and "target-select.h".
10711         (vexplain_no_incremental): New function.
10712         (explain_no_incremental): New function.
10713         (Incremental_binary::error): New method.
10714         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10715         method.
10716         (make_sized_incremental_binary): New function.
10717         (open_incremental_binary): New function.
10718         (can_incrementally_link_file): Add checks if output is ELF and has
10719         inputs section.
10720         * incremental.h: Include "elfcpp_file.h" and "output.h".
10721         (Incremental_binary): New class.
10722         (Sized_incremental_binary): New class.
10723         (open_incremental_binary): Declare.
10724         * object.cc (is_elf_object): Use
10725         elfcpp::Elf_recognizer::is_elf_file.
10726         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10727         * output.h (Output_file::filesize): New method.
10728
10729 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10730
10731         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10732         New function.
10733         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10734         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10735         function.
10736         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10737         function.
10738         (Arm_relocate_functions::movw_abs_nc): New function.
10739         (Arm_relocate_functions::movt_abs): New function.
10740         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10741         (Arm_relocate_functions::thm_movt_abs): New function.
10742         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10743         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10744         (Scan::global): Likewise.
10745         (Relocate::relocate): Likewise.
10746         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10747
10748 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10749
10750         * arm.cc (Arm_relocate_functions::got_prel) New function.
10751         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10752         (Relocate::relocate): Likewise.
10753         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10754
10755 2009-10-06  Ian Lance Taylor  <iant@google.com>
10756
10757         * options.h (class General_options): Define
10758         split_stack_adjust_size parameter.
10759         * object.h (class Object): Add uses_split_stack_ and
10760         has_no_split_stack_ fields.  Add uses_split_stack and
10761         has_no_split_stack accessor functions.  Declare
10762         handle_split_stack_section.
10763         (class Reloc_symbol_changes): Define.
10764         (class Sized_relobj): Define Function_offsets.  Declare
10765         split_stack_adjust, split_stack_adjust_reltype, and
10766         find_functions.
10767         * object.cc (Object::handle_split_stack_section): New function.
10768         (Sized_relobj::do_layout): Call handle_split_stack_section.
10769         * dynobj.cc (Sized_dynobj::do_layout): Call
10770         handle_split_stack_section.
10771         * reloc.cc (Sized_relobj::relocate_sections): Call
10772         split_stack_adjust for executable sections in split_stack
10773         objects.  Pass reloc_map to relocate_section.
10774         (Sized_relobj::split_stack_adjust): New function.
10775         (Sized_relobj::split_stack_adjust_reltype): New function.
10776         (Sized_relobj::find_functions): New function.
10777         * target-reloc.h: Include "object.h".
10778         (relocate_section): Add reloc_symbol_changes parameter.  Change
10779         all callers.
10780         * target.h (class Target): Add calls_non_split method.  Declare
10781         do_calls_non_split virtual method.  Declare match_view and
10782         set_view_to_nop.
10783         * target.cc: Include "elfcpp.h".
10784         (Target::do_calls_non_split): New function.
10785         (Target::match_view): New function.
10786         (Target::set_view_to_nop): New function.
10787         * gold.cc (queue_middle_tasks): Give an error if mixing
10788         split-stack and non-split-stack objects with -r.
10789         * i386.cc (Target_i386::relocate_section): Add
10790         reloc_symbol_changes parameter.
10791         (Target_i386::do_calls_non_split): New function.
10792         * x86_64.cc (Target_x86_64::relocate_section): Add
10793         reloc_symbol_changes parameter.
10794         (Target_x86_64::do_calls_non_split): New function.
10795         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10796         parameter.
10797         * powerpc.cc (Target_powerpc::relocate_section): Add
10798         reloc_symbol_changes parameter.
10799         * sparc.cc (Target_sparc::relocate_section): Add
10800         reloc_symbol_changes parameter.
10801         * configure.ac: Call AM_CONDITIONAL for the default target.
10802         * configure: Rebuild.
10803         * testsuite/Makefile.am (TEST_AS): New variable.
10804         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10805         (check_DATA): Add split_i386 and split_x86_64 files.
10806         (SPLIT_DEFSYMS): Define.
10807         (split_i386_[1234n].o): New targets.
10808         (split_i386_[124]): New targets.
10809         (split_i386_[1234r].stdout): New targets.
10810         (split_x86_64_[1234n].o): New targets.
10811         (split_x86_64_[124]): New targets.
10812         (split_x86_64_[1234r].stdout): New targets.
10813         (MOSTLYCLEANFILES): Add new executables.
10814         * testsuite/split_i386.sh: New file.
10815         * testsuite/split_x86_64.sh: New file.
10816         * testsuite/split_i386_1.s: New file.
10817         * testsuite/split_i386_2.s: New file.
10818         * testsuite/split_i386_3.s: New file.
10819         * testsuite/split_i386_4.s: New file.
10820         * testsuite/split_i386_n.s: New file.
10821         * testsuite/split_x86_64_1.s: New file.
10822         * testsuite/split_x86_64_2.s: New file.
10823         * testsuite/split_x86_64_3.s: New file.
10824         * testsuite/split_x86_64_4.s: New file.
10825         * testsuite/split_x86_64_n.s: New file.
10826         * testsuite/testfile.cc (Target_test): Update relocation_section
10827         function.
10828         * testsuite/Makefile.in: Rebuild.
10829
10830 2009-10-06  Ian Lance Taylor  <iant@google.com>
10831
10832         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10833         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10834         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10835         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10836         the address on ldo_addrs_.
10837         (Target_i386::Relocate::fix_up_ldo): New function.
10838
10839 2009-10-06   Rafael Espindola  <espindola@google.com>
10840
10841         * plugin.cc (add_input_library): New.
10842         (Plugin::load): Add add_input_library to tv.
10843         (Plugin_manager::add_input_file): Add the is_lib argument.
10844         (add_input_file): Update call to Plugin_manager::add_input_file.
10845         (add_input_library): New.
10846         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10847
10848 2009-09-30  Doug Kwan  <dougkwan@google.com>
10849
10850         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10851         symbol and call Symbol::may_need_copy_reloc to determine if
10852         a copy reloc is needed.
10853         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10854         nocopyreloc is given in command line.
10855         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10856         given in command line.
10857         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10858         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10859         of the removed Target_i386::may_need_copy_reloc.
10860         * options.h (copyreloc): New option with default value false.
10861         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10862         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10863         instead of the removed Target_powerpc::may_need_copy_reloc.
10864         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10865         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10866         instead of the removed Target_sparc::may_need_copy_reloc.
10867         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10868         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10869         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10870         instead of the removed Target_x86_64::may_need_copy_reloc.
10871
10872 2009-09-30  Ian Lance Taylor  <iant@google.com>
10873
10874         * object.h (class Object): Remove target_ field, and target,
10875         sized_target, and set_target methods.
10876         (Object::sized_target): Remove.
10877         (class Sized_relobj): Update declarations.  Remove sized_target.
10878         * object.cc (Sized_relobj::setup): Remove target parameter.
10879         Change all callers.
10880         (Input_objects::add_object): Don't do anything with the target.
10881         (make_elf_sized_object): Add punconfigured parameter.  Change all
10882         callers.  Set or test parameter target.
10883         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10884         Change all callers.
10885         * parameters.cc (Parameters::set_target): Change parameter type to
10886         be non-const.
10887         (Parameters::default_target): Remove.
10888         (set_parameters_target): Change parameter type to be non-const.
10889         (parameters_force_valid_target): New function.
10890         (parameters_clear_target): New function.
10891         * parameters.h (class Parameters): Update declarations.  Remove
10892         default_target method.  Add sized_target and clear_target
10893         methods.  Change target_ to be non-const.
10894         (set_parameters_target): Update declaration.
10895         (parameters_force_valid_target): Declare.
10896         (parameters_clear_target): Declare.
10897         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10898         as NULL if we aren't searching.
10899         (Add_symbols::run): Don't check for compatible target.
10900         * fileread.cc (Input_file::open_binary): Call
10901         parameters_force_valid_target.
10902         * gold.cc (queue_middle_tasks): Likewise.
10903         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10904         set_target on object.
10905         * dynobj.h (class Sized_dynobj): Update declarations.
10906         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10907         make_elf_object returns NULL.
10908         (Archive::include_member): Don't check whether object target is
10909         compatible.
10910         * output.cc (Output_section::add_input_section): Get target from
10911         parameters.
10912         (Output_section::relax_input_section): Likewise.
10913         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10914         parameters.
10915         (Sized_relobj::do_scan_relocs): Likewise.
10916         (Sized_relobj::relocate_sections): Likewise.
10917         * resolve.cc (Symbol_table::resolve): Likewise.
10918         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10919         parameter.  Change all callers.
10920         (Symbol_table::add_from_object): Get target from parameters.
10921         (Symbol_table::add_from_relobj): Don't check object target.
10922         (Symbol_table::add_from_dynobj): Likewise.
10923         (Symbol_table::define_special_symbol): Get target from
10924         parameters.
10925         * symtab.h (class Symbol_table): Update declaration.
10926         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10927         parameter.  Change all callers.  Clear parameter target.
10928         (Binary_test): Test target here.
10929         * testsuite/object_unittest.cc (gold_testsuite): Remove
10930         target_test_pointer parameter.  Change all callers.
10931         (Object_test): Test target here.
10932
10933 2009-09-26  Ian Lance Taylor  <iant@google.com>
10934
10935         * testsuite/initpri1.c: Don't try to use constructor priorities if
10936         compiling with gcc before 4.3.
10937
10938 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10939
10940         * testsuite/retain_symbols_file_test.sh (check_present): Change
10941         output file name to retain_symbols_file_test.stdout.
10942         (check_absent): Likewise.
10943
10944 2009-09-18  Craig Silverstein  <csilvers@google.com>
10945
10946         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10947         * options.cc: Include <cerrno> and <fstream>.
10948         (General_options::finalize): Parse -retain-symbols-file tag.
10949         * options.h: New flag.
10950         (General_options): New method should_retain_symbol, new
10951         variable symbols_to_retain.
10952         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10953         should_retain_symbol map.
10954         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10955         * testsuite/Makefile.in: Regenerate.
10956         * testsuite/retain_symbols_file_test.sh: New file.
10957
10958 2009-09-18  Nick Clifton  <nickc@redhat.com>
10959
10960         * po/es.po: Updated Spanish translation.
10961
10962 2009-09-17  Doug Kwan  <dougkwan@google.com>
10963
10964         * debug.h (DEBUG_RELAXATION): New constant.
10965         (DEBUG_ALL): Add DEBUG_RELAXATION.
10966         (debug_string_to_enum): Add relaxation debug option.
10967         * layout.cc
10968         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10969         Layout::Relaxation_debug_check::read_sections,
10970         Layout::Relaxation_debug_check::read_sections): New method definitions.
10971         (Layout::Layout): Initialize data members
10972         record_output_section_data_from_scrips_,
10973         script_output_section_data_list_ and relaxation_debug_check_.
10974         (Layout::save_segments, Layout::restore_segments,
10975         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10976         Layout::relaxation_loop_body): New method definitions.
10977         (Layout::finalize): Support relaxation.  Move section layout code to
10978         Layout::relaxation_loop_body.
10979         (Layout::set_asection_address_from_script): Move code for orphan
10980         section placement out.
10981         (Layout::place_orphan_sections_in_script): New method definition.
10982         * layout.h (Output_segment_headers, Output_file_header):
10983         New forward class declarations.
10984         (Layout::~Layout): Define.
10985         (Layout::new_output_section_data_from_script): New method definition.
10986         (Layout::place_orphan_sections_in_script): New method declaration.
10987         (Layout::Segment_states): New type declaration.
10988         (Layout::save_segments, Layout::restore_segments,
10989         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10990         Layout::relaxation_loop_body): New method declarations.
10991         (Layout::Output_section_data_list): New type declaration.
10992         (Layout::Relaxation_debug_check): New class definition.
10993         (Layout::record_output_section_data_from_script_,
10994         Layout::script_output_section_data_list_, Layout::segment_states_,
10995         Layout::relaxation_debug_check_): New data members.
10996         * output.cc: (Output_section_headers::do_size): New method definition.
10997         (Output_section_headers::Output_section_headers): Move size
10998         computation to Output_section_headers::do_size.
10999         (Output_segment_headers::do_size): New method definition.
11000         (Output_file_header::Output_file_header): Move size computation to
11001         Output_file_header::do_size and call it.
11002         (Output_file_header::do_size): New method definition.
11003         (Output_data_group::Output_data_group): Adjust call to
11004         Output_section_data.
11005         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11006         (Output_symtab_xindex::do_write): Add array bound check.
11007         (Output_section::Input_section::print_to_mapfile): Handle
11008         RELAXED_INPUT_SECTION_CODE.
11009         (Output_section::Output_section): Initialize data member checkpoint_.
11010         (Output_section::~Output_section): Delete checkpoint object pointed
11011         by checkpoint_.
11012         (Output_section::add_input_section): Always add an Input_section if
11013         relaxing.
11014         (Output_section::add_merge_input_section): Add assert.
11015         (Output_section::relax_input_section): New method definition.
11016         (Output_section::set_final_data_size): Set load address to zero for
11017         an unallocated section.
11018         (Output_section::do_address_and_file_offset_have_reset_values):
11019         New method definition.
11020         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11021         Handle relaxed input section.
11022         (Output_section::sort_attached_input_sections): Checkpoint input
11023         section list lazily.
11024         (Output_section::get_input_sections): Change type of input_sections to
11025         list of Simple_input_section pointers.  Checkpoint input section list
11026         lazily.  Also handle relaxed input sections.
11027         (Output_section::add_input_section_for_script): Take a reference to
11028         a Simple_input_section object instead of Relobj pointer and section
11029         index as parameter.  Handle relaxed input sections.
11030         (Output_section::save_states, Output_section::restore_states): New
11031         method definitions.
11032         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11033         (Output_data::is_data_size_fixed): New method definition.
11034         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11035         if it is fixed.
11036         (Output_data::address_and_file_offset_have_reset_values): New method
11037         definition.
11038         (Output_data::do_address_and_file_offset_have_reset_values): New method
11039         definition.
11040         (Output_data::set_data_size): Check that data size is not fixed.
11041         (Output_data::fix_data_size): New method definition.
11042         (Output_data::is_data_size_fixed_): New data member.
11043         (Output_section_headers::set_final_data_size): New method definition.
11044         (Output_section_headers::do_size): New method declaration.
11045         (Output_segment_headers::set_final_data_size): New method definition.
11046         (Output_segment_headers::do_size): New method declaration.
11047         (Output_file_header::set_final_data_size)::New method definition.
11048         (Output_file_header::do_size)::New method declaration.
11049         (Output_section_data::Output_section_data): Add new parameter
11050         is_data_size_fixed and use it to fix data size.
11051         (Output_data_const::Output_data_const): Adjust call to base class
11052         constructor and fix data size.
11053         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11054         base class constructor and fix data size.
11055         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11056         base class constructor and fix data size.
11057         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11058         class constructor and fix data size.
11059         (Output_data_group::set_final_data_size): New method definition.
11060         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11061         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11062         class constructor and fix data size.
11063         (Output_relaxed_input_section): New class definition.
11064         (Output_section::Simple_input_section): New class definition.
11065         (Output_section::get_input_sections): Adjust parameter list.
11066         (Output_section::add_input_section_for_script): Same.
11067         (Output_section::save_states, Output_section::restore_states,
11068         Output_section::do_address_and_file_offset_have_reset_values,
11069         (Output_section::Input_section::Input_section): Handle
11070         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11071         Output_relaxed_input_section.
11072         (Output_section::Input_section::is_input_section,
11073         Output_section::Input_section::set_output_section): Handle relaxed
11074         input section.
11075         (Output_section::Input_section::is_relaxed_input_section,
11076         Output_section::Input_section::output_section_data,
11077         Output_section::Input_section::relaxed_input_section): New method
11078         definitions.
11079         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11080         value.
11081         (Output_section::Input_section::u1_): Update comments.
11082         (Output_section::Input_section::u2_): Add new union member poris.
11083         (Output_section::Checkpoint_output_section): New classs definition.
11084         (Output_section::relax_input_section): New method declaration.
11085         (Output_section::checkpoint_): New data member.
11086         (Output_segment): Update comments.
11087         (Output_segment::Output_segment): Un-privatize copy constructor.
11088         (Output_segment::operator=): Un-privatize.
11089         * script-sections.cc (Output_section_element::Input_section_list):
11090         Change element type to Output_section::Simple_input_section.
11091         (Output_section_element_dot_assignment::set_section_addresses):
11092         Register output section data for relaxation clean up.
11093         (Output_data_exression::Output_data_expression): Adjust call to base
11094         constructor to fix data size.
11095         (Output_section_element_data::set_section_addresses): Register
11096         Output_data_expression object for relaxation clean up.
11097         (struct Input_section_info): Replace Relobj pointer and section index
11098         pair with Output_section::Simple_input_section and Convert struct to a
11099         class.
11100         (Input_section_sorter::operator()): Adjust access to
11101         Input_section_info data member to use accessors.
11102         (Output_section_element_input::set_section_addresses): Use layout
11103         parameter.  Adjust code to use Output_section::Simple_input_section
11104         and Input_secction_info classes.  Register filler for relaxation
11105         clean up.
11106         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11107         and section index pair with Output_section::Simple_input_section
11108         class.  Adjust code accordingly.
11109         (Phdrs_element::release_segment): New method definition.
11110         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11111         segment list.
11112         (Script_sections::release_segments): New method definition.
11113         * gold/script-sections.h (Script_sections::release_segments): New
11114         method declaration.
11115         * gold/target.h (Target::may_relax, Target::relax,
11116         Target::do_may_relax, Target::do_relax): New method definitions.
11117
11118 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11119
11120         * arm.cc (has_signed_unsigned_overflow): New function.
11121         (Arm_relocate_functions::abs8): New function.
11122         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11123         (Target_arm::Scan::global): Likewise.
11124         (Target_arm::relocate::relocate): Likewise.
11125         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11126         Likewise.
11127
11128 2009-09-16  Cary Coutant  <ccoutant@google.com>
11129
11130         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11131         * testsuite/Makefile.in: Regenerate.
11132
11133 2009-09-11  Nick Clifton  <nickc@redhat.com>
11134
11135         * po/gold.pot: Updated by the Translation project.
11136
11137 2009-09-08  Cary Coutant  <ccoutant@google.com>
11138
11139         * output.cc (Output_file::open): Add execute permission to empty file.
11140         * testsuite/Makefile.am (permission_test): New test.
11141         * testsuite/Makefile.in: Regenerate.
11142
11143 2009-09-02  Ian Lance Taylor  <iant@google.com>
11144
11145         * output.cc (Output_file::resize): Call map_no_anonymous rather
11146         than map.
11147
11148 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11149
11150         * gold.cc: Include "incremental.h".
11151         (queue_initial_tasks): Call Incremental_checker methods.
11152         * incremental.cc: Include "output.h".
11153         (Incremental_checker::can_incrementally_link_output_file): New
11154         method.
11155         * incremental.h (Incremental_checker): New class.
11156
11157         * output.cc (Output_file::open_for_modification): New method.
11158         (Output_file::map_anonymous): Changed return type to bool.  Record
11159         map in base_ field.
11160         (Output_file::map_no_anonymous): New method, broken out of map.
11161         (Output_file::map): Use map_no_anonymous and map_anonymous.
11162         * output.h (class Output_file): Update declarations.
11163
11164 2009-08-24  Cary Coutant  <ccoutant@google.com>
11165
11166         * options.h (Command_line::Pre_options): New class.
11167         (Command_line::pre_options): New member.
11168         * options.cc (gold::options::ready_to_register): New variable.
11169         (One_option::register_option): Do nothing if not registering options.
11170         Assert if same short option registered twice.
11171         (General_options::General_options): Turn off option registration when
11172         done constructing.
11173         (Command_line::Pre_options::Pre_options): New constructor.
11174
11175 2009-08-24  Cary Coutant  <ccoutant@google.com>
11176
11177         * options.h (General_options::no_keep_memory): Remove incorrect
11178         short option.
11179
11180 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11181
11182         * Makefile.am (am__skiplex, am__skipyacc): New.
11183         * Makefile.in: Regenerate.
11184
11185 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11186
11187         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11188         (INCLUDES): ... this.
11189         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11190         (AM_CPPFLAGS): Renamed from ...
11191         (INCLUDE): ... this.
11192         * Makefile.in, testsuite/Makefile.in: Regenerate.
11193
11194         * Makefile.in: Regenerate.
11195         * aclocal.m4: Likewise.
11196         * config.in: Likewise.
11197         * configure: Likewise.
11198         * testsuite/Makefile.in: Likewise.
11199
11200         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11201         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11202         * Makefile.in: Regenerate.
11203         * testsuite/Makefile.in: Regenerate.
11204
11205 2009-08-19  Cary Coutant  <ccoutant@google.com>
11206
11207         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11208         symbols in shared libraries overridden by hidden or internal symbols
11209         in the main program.
11210
11211 2009-08-19  Chris Demetriou  <cgd@google.com>
11212
11213         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11214         checking source file names in error messages.
11215
11216 2009-08-18  Doug Kwan  <dougkwan@google.com>
11217
11218         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11219         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11220         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11221         an elfcpp::Ehdr as parameter.
11222         * object.cc (Object::set_target): Remove the version that looks up
11223         a target and sets it.
11224         (Sized_relobj::setup): Take a Target object instead of
11225         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11226         (make_elf_sized_object): Find target and ask target to
11227         make an ELF object.
11228         * object.h: (Object::set_target): Remove the version that looks up
11229         a target and sets it.
11230         (Sized_relobj::setup): Take a Target object instead of
11231         an elfcpp:Ehdr as parameter.
11232         * target.cc: Include dynobj.h.
11233         (Target::do_make_elf_object_implementation): New.
11234         (Target::do_make_elf_object): New.
11235         * target.h (Target::make_elf_object): New template declaration.
11236         (Target::do_make_elf_object): New method declarations.
11237         (Target::do_make_elf_object_implementation): New template declaration.
11238
11239 2009-08-14  Ian Lance Taylor  <iant@google.com>
11240
11241         * gold.h (FUNCTION_NAME): Define.
11242         (gold_unreachable): Use FUNCTION_NAME.
11243
11244 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11245
11246         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11247         symbol in the --keep-unique list is not found.
11248
11249 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11250
11251         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11252         been maked as --keep-unique.
11253         (Icf::unfold_section): New function.
11254         * icf.h (Icf::unfold_section): New function.
11255         * options.h (General_options::keep_unique): New option.
11256         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11257         * testsuite/Makefile.in: Regenerate.
11258         * testsuite/icf_keep_unique_test.sh: New file.
11259         * testsuite/icf_keep_unique_test.cc: New file.
11260
11261 2009-08-12  Cary Coutant  <ccoutant@google.com>
11262
11263         PR 10471
11264         * resolve.cc (Symbol_table::resolve): Check for references from
11265         dynamic objects to hidden and internal symbols.
11266         * testsuite/Makefile.am (hidden_test.sh): New test.
11267         * testsuite/Makefile.in: Regenerate.
11268         * testsuite/hidden_test.sh: New script.
11269         * testsuite/hidden_test_1.c: New test source.
11270         * testsuite/hidden_test_main.c: New test source.
11271
11272 2009-08-11  Doug Kwan  <dougkwan@google.com>
11273
11274         * arm.cc: Update comments.
11275         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11276         segment to locate the .ARM.exidx section if present.
11277
11278 2009-08-09  Doug Kwan  <dougkwan@google.com>
11279
11280         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11281         patch.
11282
11283 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11284         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11285         compiler warnings.
11286
11287 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11288
11289         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11290         valid tls_segment only for non-debug-section relocations.
11291         * testsuite/Makefile.am: Add gc_tls_test.
11292         * testsuite/Makefile.in: Regenerate.
11293         * testsuite/gc_tls_test.cc: New file.
11294         * testsuite/gc_tls_test.sh: New file.
11295
11296 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11297
11298         * icf.cc: New file.
11299         * icf.h: New file.
11300         * Makefile.am (CCFILES): Add icf.cc.
11301         (HFILES): Add icf.h
11302         * Makefile.in: Regenerate.
11303         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11304         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11305         section, symbol and addend information for the relocs.
11306         * gold.cc (queue_middle_tasks): Call identical code folding.
11307         * gold.h: Add defines for multimap.
11308         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11309         to the call of finalize_local_symbols.
11310         * main.cc (main): Create object of class Icf.
11311         * object.cc (Sized_relobj::do_layout): Allow this function to be
11312         called twice during icf.
11313         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11314         to sections marked as identical by icf.
11315         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11316         when available.
11317         (Sized_relobj::do_section_entsize): New function.
11318         * object.h (Object::section_entsize): New function.
11319         (Object::do_section_entsize): New pure virtual function.
11320         (Relobj::finalize_local_symbols): Add new parameter.
11321         (Relobj::do_section_entsize): New function.
11322         * options.h (General_options::icf): New option.
11323         (General_options::icf_iterations): New option.
11324         (General_options::print_icf_sections): New option.
11325         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11326         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11327         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11328         icf.
11329         * symtab.cc (Symbol_table::is_section_folded): New function.
11330         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11331         to sections marked as identical by icf.
11332         * symtab.h (Symbol_table::set_icf): New function.
11333         (Symbol_table::icf): New function.
11334         (Symbol_table::is_section_folded): New function.
11335         (Symbol_table::icf_): New data member.
11336         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11337         * testsuite/Makefile.am: Add commands to build icf_test.
11338         * testsuite/Makefile.in: Regenerate.
11339         * testsuite/icf_test.sh: New file.
11340         * testsuite/icf_test.cc: New file.
11341
11342 2009-07-24  Chris Demetriou  <cgd@google.com>
11343
11344         * layout.cc (is_compressible_debug_section): Fix incorrect
11345         comment about compressed section names.
11346
11347 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11348
11349         PR 10419
11350         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11351
11352 2009-07-16  Ian Lance Taylor  <iant@google.com>
11353
11354         PR 10400
11355         * layout.h: #include <map>.
11356         (class Kept_section): Change from struct to class.  Add accessors
11357         and setters.  Add section size to Comdat_group mapping.  Change
11358         Comdat_group to std::map.  Add is_comdat_ field.  Add
11359         linkonce_size field in union.
11360         (class Layout): Update declaration of find_or_add_kept_section.
11361         Don't declare find_kept_object.
11362         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11363         parameter.  Add object, shndx, is_comdat, and is_group_name
11364         parameters.  Change all callers.  Adjust for new Kept_section.
11365         (Layout::find_kept_object): Remove.
11366         * object.cc (Sized_relobj::include_section_group): Update use of
11367         Kept_section.  Rename secnum to shndx.  Only record
11368         Kept_comdat_section if sections are the same size.
11369         (Sized_relobj::include_linkonce_section): Update use of
11370         Kept_section.  Only record Kept_comdat_section if sections are the
11371         same size.  Set size of linkonce section.
11372         (Sized_relobj::map_to_kept_section): Update call to
11373         get_kept_comdat_section.
11374         * object.h (class Sized_relobj): Rename fields in
11375         Kept_comdat_section to drop trailing underscores; change object
11376         field to Relobj*.  Change Kept_comdat_section_table to store
11377         struct rather than pointer.
11378         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11379         Add kept_object and kept_shndx parameters.  Change all callers.
11380         (Sized_relobj::get_kept_comdat_section): Change return type to
11381         bool.  Add kept_object and kept_shndx parameters.  Change all
11382         callers.
11383         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11384         Layout::find_or_add_kept_section.
11385
11386 2009-07-09  Ian Lance Taylor  <iant@google.com>
11387
11388         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11389         Reserve space in the hash table.
11390
11391 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11392
11393         * fileread.cc (File_read::get_mtime): New method.
11394         * fileread.h (Timespec): New structure.
11395         (File_read::get_mtime): New method.
11396         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11397         Renamed from timestamp_nsec.
11398         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11399         Elf_Xword.
11400         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11401         timestamp_nsec.
11402         (Incremental_inputs::report_archive): Save mtime; style fix.
11403         (Incremental_inputs::report_obejct): Save mtime; style fix.
11404         (Incremental_inputs::report_script): Save mtime; style fix.
11405         (Incremental_inputs::finalize_inputs): Style fix.
11406         (Incremental_inputs::finalize): Style fix.
11407         (Incremental_inputs::create_input_section_data): Store inputs
11408         mtime.
11409         * incremental.h (Incremental_inputs::report_script): Add mtime
11410         argument.
11411         (Incremental_inputs::Input_info::Input_info): Intialize only one
11412         union member.
11413         (Incremental_inputs::Input_info::archive): Move to nameless
11414         union.
11415         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11416         (Incremental_inputs::Input_info::script): Move to nameless union.
11417         (Incremental_inputs::mtime): New field.
11418         * script.cc (read_input_script): Pass file mtime to
11419         Incremental_input.
11420         * script.h (Script_info::inputs): Style fix.
11421
11422 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11423
11424         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11425         instead of 32.
11426
11427 2009-06-24  Ian Lance Taylor  <iant@google.com>
11428
11429         PR 10156
11430         * layout.cc (Layout::choose_output_section): If we find an
11431         existing section, update the flags.
11432         (Layout::create_notes): New function, broken out of
11433         Layout::finalize.
11434         (Layout::finalize): Don't create note sections.
11435         (Layout::create_note): Don't crash if linker script discards
11436         section.
11437         (Layout::create_gold_note): Likewise.
11438         (Layout::create_build_id): Likewise.  Don't set
11439         after_input_sections on the section.
11440         (Layout::create_executable_stack_info): Remove target parameter.
11441         Change caller.
11442         * layout.h (class Layout): Declare create_notes.  Update
11443         declaration of create_executable_stack_info.
11444         * gold.cc (queue_middle_tasks): Call create_notes.
11445         * output.cc (Output_section::update_flags_for_input_section): Move
11446         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11447         invalid.
11448         * output.h (Output_data::mark_address_invalid): New function.
11449         (class Output_section): Only declare, not define,
11450         update_flags_for_input_section.  Remove set_flags.
11451
11452 2009-06-24  Ian Lance Taylor  <iant@google.com>
11453
11454         * script-sections.cc (Output_section_definition::
11455         set_section_addresses): Rename shadowing local load_address to
11456         laddr.
11457
11458 2009-06-24  Ian Lance Taylor  <iant@google.com>
11459
11460         PR 10244
11461         * reloc.cc (relocate_sections): Skip empty relocation sections.
11462
11463 2009-06-23  Ian Lance Taylor  <iant@google.com>
11464
11465         PR 10156
11466         * layout.cc (Layout::create_note): Use choose_output_section
11467         rather than make_output_section.
11468
11469 2009-06-23  Ian Lance Taylor  <iant@google.com>
11470
11471         PR 10237
11472         * options.cc (General_options::parse_V): Set printed_version_.
11473         (General_options::General_options): Initialize printed_version_.
11474         * options.h (class General_options): Add printed_version_ field.
11475         * gold.cc (queue_initial_tasks): If there are no input files,
11476         don't give a fatal error if we printed the version information.
11477         (queue_middle_tasks): If using -r with a shared object, give a
11478         fatal error rather than an ordinary error.
11479
11480 2009-06-23  Ian Lance Taylor  <iant@google.com>
11481
11482         PR 10219
11483         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11484         (Layout::make_output_section): Set have_stabstr_section_ if we see
11485         a .stab*str section.
11486         (Layout::finalize): Call link_stabs_sections.
11487         (Layout::link_stabs_sections): New file.
11488         * layout.h (class Layout): Add have_stabstr_section_ field.
11489         Declare link_stabs_sections.
11490
11491 2009-06-23  Doug Kwan  <dougkwan@google.com>
11492
11493         * Makefile.am (libgold_a_LIBADD): New.
11494         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11495         * Makefile.in: Regenerate.
11496         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11497         * configure: Regenerate.
11498         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11499         * fileread.cc: Include sys/state.h
11500         * gold.h: Declare memmem and strndup if found missing.
11501         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11502
11503 2009-06-23  Ian Lance Taylor  <iant@google.com>
11504
11505         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11506         * configure: Rebuild.
11507
11508 2009-06-23  Ian Lance Taylor  <iant@google.com>
11509
11510         PR 10147
11511         * object.cc (Object::section_contents): Don't try to get a view if
11512         the section has length zero.
11513         (Object::handle_gnu_warning_section): If the section is empty, use
11514         the name of the section as the warning.
11515
11516 2009-06-23  Ian Lance Taylor  <iant@google.com>
11517
11518         PR 10133
11519         * stringpool.h (class Stringpool_template): Add optimize_ field.
11520         (Stringpool_template::set_optimize): New function.
11521         * stringpool.cc (Stringpool_template::Stringpool_template):
11522         Initialize optimize_ field.
11523         (Stringpool_template::set_string_offsets): Test local optimize
11524         fild rather than parameter.
11525         * layout.cc (Layout::Layout): Call set_optimize on the section
11526         name stringpool.
11527
11528 2009-06-22  Ian Lance Taylor  <iant@google.com>
11529
11530         PR 10030
11531         * yyscript.y: Parse TARGET.
11532         * script.cc (script_set_target): New function.
11533         * script-c.h (script_set_target): Declare.
11534         * options.cc (General_options::string_to_object_format): Rename
11535         from string_to_object_format in anonymous namespace.  Change
11536         callers.
11537         * options.h (class General_options): Declare
11538         string_to_object_format.
11539
11540 2009-06-22  Ian Lance Taylor  <iant@google.com>
11541
11542         * script-sections.cc (Script_sections::create_segments): Don't put
11543         program headers in a PT_LOAD segment if -n or -N.
11544
11545 2009-06-22  Ian Lance Taylor  <iant@google.com>
11546
11547         PR 10141
11548         * options.h (class General_options): Add -z lazy and -z now.  Sort
11549         -z options into alphabetical order.
11550         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11551
11552 2009-06-21  Ian Lance Taylor  <iant@google.com>
11553
11554         * layout.cc (Layout::make_output_section): Call
11555         Target::new_output_section.
11556         (Layout::attach_allocated_section_to_segment): Put large section
11557         sections in a separate load segment with the large segment flag
11558         set.
11559         (Layout::segment_precedes): Sort large data segments after other
11560         load segments.
11561         (align_file_offset): New static function.
11562         (Layout::set_segment_offsets): Use align_file_offset.
11563         * output.h (class Output_section): Add is_small_section_ and
11564         is_large_section_ fields.
11565         (Output_section::is_small_section): New function.
11566         (Output_section::set_is_small_section):  New function.
11567         (Output_section::is_large_section): New function.
11568         (Output_section::set_is_large_section): New function.
11569         (Output_section::is_large_data_section): New function.
11570         (class Output_segment): Add is_large_data_segment_ field.
11571         (Output_segment::is_large_data_segment): New function.
11572         (Output_segment::set_is_large_data_segment): New function.
11573         * output.cc (Output_section::Output_section): Initialize new
11574         fields.
11575         (Output_segment::Output_segment): Likewise.
11576         (Output_segment::add_output_section): Add assertion that large
11577         data sections always go in large data segments.  Force small data
11578         sections to the end of the list of data sections.  Force small BSS
11579         sections to the start of the list of BSS sections.  For large BSS
11580         sections to the end of the list of BSS sections.
11581         * symtab.h (class Symbol): Declare is_common_shndx.
11582         (Symbol::is_defined): Check Symbol::is_common_shndx.
11583         (Symbol::is_common): Likewise.
11584         (class Symbol_table): Define enum Commons_section_type.  Update
11585         declarations.  Add small_commons_ and large_commons_ fields.
11586         * symtab.cc (Symbol::is_common_shndx): New function.
11587         (Symbol_table::Symbol_table): Initialize new fields.
11588         (Symbol_table::add_from_object): Put small and large common
11589         symbols in the right list.
11590         (Symbol_table::sized_finalized_symbol): Check
11591         Symbol::is_common_shndx.
11592         (Symbol_table::sized_write_globals): Likewise.
11593         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11594         common symbol lists.  Don't call do_allocate_commons_list if the
11595         list is empty.
11596         (Symbol_table::do_allocate_commons_list): Remove is_tls
11597         parameter.  Add comons_section_type parameter.  Change all
11598         callers.  Handle small and large common symbols.
11599         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11600         Symbol::is_common_shndx.
11601         * resolve.cc (symbol_to_bits): Likewise.
11602         * target.h (Target::small_common_shndx): New function.
11603         (Target::small_common_section_flags): New function.
11604         (Target::large_common_shndx): New function.
11605         (Target::large_common_section_flags): New function.
11606         (Target::new_output_section): New function.
11607         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11608         small_common_section_flags, and large_common_section_flags
11609         fields.
11610         (Target::do_new_output_section): New virtual function.
11611         * arm.cc (Target_arm::arm_info): Initialize new fields.
11612         * i386.cc (Target_i386::i386_info): Likewise.
11613         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11614         Likewise.
11615         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11616         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11617         (Target_x86_64::do_new_output_section): New function.
11618         * configure.ac: Define conditional MCMODEL_MEDIUM.
11619         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11620         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11621         (large_LDFLAGS): Define.
11622         * testsuite/large.c: New file.
11623         * testsuite/testfile.cc (Target_test::test_target_info):
11624         Initialize new fields.
11625         * configure, testsuite/Makefile.in: Rebuild.
11626
11627 2009-06-05  Doug Kwan  <dougkwan@google.com>
11628
11629         * Makefile.am (CCFILES): Add target.cc.
11630         * Makefile.in: Regenerate.
11631         * i386.cc (class Target_i386): Define new virtual method to
11632         override do_is_local_label_name in parent.
11633         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11634         local symbols if --discard-locals or -X is given.
11635         * options.h (class General_options): Declare new options
11636         '--discard-locals' and '-X' for discarding locals.
11637         * target.h (class Target): Define new methods is_local_label_name.
11638         Declare new virtual method do_is_local_label_name.
11639         * target.cc: New file.
11640         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11641         (check_SCRIPTS): Add discard_locals_test.sh.
11642         (check_DATA): Add discard_local_tests.syms.
11643         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11644         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11645         * testsuite/Makefile.in: Regenerate.
11646         * testsuite/discard_locals_test.c: New file.
11647         * testsuite/discard_locals_test.sh: Same.
11648
11649 2009-06-05  Doug Kwan  <dougkwan@google.com>
11650
11651         * object.cc (Sized_relobj::Sized_relobj): Initialize
11652         discarded_eh_frame_shndx_ to -1U.
11653         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11654         section.
11655         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11656         a discarded .eh_frame section.
11657         (Sized_relobj::do_finalize_local_symbols): Ditto.
11658         * object.h (class Sized_relobj): Declare new member
11659         discarded_eh_frame_shndx_.
11660         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11661         (local_labels_test.o, local_labels_test): New rules.
11662         * testsuite/Makefile.in: Regenerate.
11663
11664 2009-06-04  Doug Kwan  <dougkwan@google.com>
11665
11666         * layout.cc (Layout::section_name_mapping): Add mapping for
11667         special ARM sections.
11668
11669 2009-06-03  Doug Kwan  <dougkwan@google.com>
11670
11671         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11672         (utils::has_overflow): Same.
11673
11674 2009-06-03  Ian Lance Taylor  <iant@google.com>
11675
11676         * layout.cc (Layout::section_name_mapping): New array, replacing
11677         Layout::linkonce_mapping.
11678         (Layout::section_name_mapping_count): New variable, replacing
11679         Layout::linkonce_mapping_count.
11680         (Layout::linkonce_output_name): Remove.
11681         (Layout::output_section_name): Rewrite.
11682         * layout.h (class Layout): Rename Linkonce_mapping to
11683         Section_name_mapping, linkonce_mapping to section_name_mapping,
11684         linkonce_mapping_count to section_name_mapping_count.  Don't
11685         declare linkonce_output_name.
11686
11687 2009-06-03  Doug Kwan  <dougkwan@google.com>
11688
11689         * gold/arm.cc (namespace utils): New.
11690         (Target_arm::reloc_is_non_pic): Define new method.
11691         (class Arm_relocate_functions): New.
11692         (Target_arm::Relocate::relocate): Handle relocation types used by
11693         Android.
11694
11695 2009-06-03  Ian Lance Taylor  <iant@google.com>
11696
11697         * arm.cc (Target_arm::scan::global): Use || instead of |.
11698
11699 2009-06-02  Doug Kwan  <dougkwan@google.com>
11700
11701         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11702         issued_non_pic_error_.
11703         (class Target_arm::Scan): Declare new method check_non_pic.
11704         Define new method symbol_needs_plt_entry.
11705         Declare new data member issued_non_pic_error_.
11706         (class Target_arm::Relocate): Declare new method
11707         should_apply_static_reloc.
11708         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11709         (Target_arm::Scan::check_non_pic): Define new method.
11710         (Target_arm::Scan::local): Handle a small subset of reloc types used
11711         by Android.
11712         (Target_arm::Scan::local): Same.
11713         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11714
11715 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11716
11717         * incremental.cc (Incremental_inputs::report_command_line): Filter
11718         out --incremental-* options.
11719
11720 2009-05-29  Doug Kwan  <dougkwan@google.com>
11721
11722         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11723         template class.
11724         (class Target_arm): Update comment.
11725         (Target_arm::Target_arm): Initialize new data members GOT_,
11726         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11727         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11728         and Target_arm::rel_dyn_section.
11729         Declare new_enum Target_arm::Got_type.
11730         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11731         and DYNBSS_.
11732         Update commments for member do_dynsym_value.
11733         (Target_arm::got_size, Target_arm::plt_section,
11734         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11735         new methods inside class defintion.
11736         (Target_arm::got_section): Define new method.
11737         (Target_arm::rel_dyn_section): Same.
11738         (Output_data_plt_arm): New template class.
11739         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11740         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11741         (Output_data_plt_arm::add_entry): Same.
11742         (Output_data_plt_arm::first_plt_entry): Define new
11743         static data member for PLT instruction template.
11744         (Output_data_plt_arm::plt_entry): Same.
11745         (Output_data_plt_arm::do_write): Define new method.
11746         (Target_arm::make_plt_entry): Same.
11747         (Target_arm::do_finalize_sections): Same.
11748         (Target_arm::do_dynsym_value): Same.
11749
11750 2009-05-28  Doug Kwan  <dougkwan@google.com>
11751
11752         * Makefile.am (TARGETSOURCES): Add arm.cc.
11753         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11754         * Makefile.in: Regenerate.
11755         * arm.cc: New file.
11756         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11757
11758 2009-05-26  Doug Kwan  <dougkwan@google.com>
11759
11760         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11761         (General_options::check_excluded_libs): Strip off directories in
11762         archive name before matching like GNU ld does.
11763         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11764         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11765         (exclude_libs_test_LDFLAGS): Add linker option
11766         -Wl,--exclude-libs,libexclude_libs_test_3
11767         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11768         an explicit archive without using -l.
11769         (alt/libexclude_libs_test_3.a): New make rule.
11770         * testsuite/Makefile.in: Regenerate.
11771         * testsuite/exclude_libs_test.c : Declare lib3_default().
11772         (main): Call it.
11773         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11774         * exclude_libs_test_3.c: New file.
11775
11776 2009-05-26  Nick Clifton  <nickc@redhat.com>
11777
11778         * po/id.po: New Indonesian translation.
11779         * po/gold.pot: Updated template file.
11780
11781 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11782
11783         * testsuite/Makefile.am: Add -ffunction-sections to compile
11784         gc_comdat_test files.  Add -Wl,--gc-sections to build
11785         gc_comdat_test.
11786         * testsuite/Makefile.in: Regenerate.
11787         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11788
11789 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11790
11791         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11792         kept comdat section was garbage collected.
11793         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11794         * testsuite/Makefile.in: Regenerate.
11795         * testsuite/gc_comdat_test.sh: New file.
11796         * testsuite/gc_comdat_test_1.cc: New file.
11797         * testsuite/gc_comdat_test_2.cc: New file.
11798
11799 2009-05-19  Doug Kwan  <dougkwan@google.com>
11800
11801         * archive.cc (Archive::Archive): Move constructor from archive.h
11802         to here.  Initialize no_export_.
11803         (Archive::get_elf_object_for_member): Set no_export flag of object.
11804         * archive.h (Archive::Archive): Move constructor body to
11805         archive.cc.
11806         (Archive::no_export): New method.
11807         (Archive::no_export_): New field.
11808         * object.h (Object::Object): Initialize no_export_ to false.
11809         (Object::no_export, Object::set_no_export): New methods.
11810         (Object::no_export_): New field.
11811         * options.cc (General_options::parse_exclude_libs): New method.
11812         (General_options::check_excluded_libs) Same.
11813         * options.h (exclude_libs): New option.
11814         (General_options::check_excluded_libs): New method declaration.
11815         (General_options::excluded_libs_): New field.
11816         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11817         default or protected visibility if an object has no-export flag set.
11818         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11819         (check_SCRIPTS): Add exclude_libs_test.sh.
11820         (check_DATA): Add exclude_libs_test.syms.
11821         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11822         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11823         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11824         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11825         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11826         libexclude_libs_test_2.a): New rules.
11827         * testsuite/Makefile.in: Regenerate.
11828         * testsuite/exclude_libs_test.c: New file.
11829         * testsuite/exclude_libs_test.sh: Ditto.
11830         * testsuite/exclude_libs_test_1.c: Ditto.
11831         * testsuite/exclude_libs_test_2.c: Ditto.
11832
11833 2009-05-15  Ian Lance Taylor  <iant@google.com>
11834
11835         * configure.ac: Check for declarations for cases where libiberty.h
11836         checks HAVE_DECL_xxx.
11837         * configure, config.in: Rebuild.
11838
11839 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11840
11841         * gold.h (Incremental_argument_list): Remove (invalid) forward
11842         declaration.
11843         * incremental.cc (Incremental_inputs::report_achive): New method.
11844         (Incremental_inputs::report_object): New method.
11845         (Incremental_inputs::report_script): New method.
11846         (Incremental_inputs::finalize_inputs): New method.
11847         (Incremental_inputs::finalize): Call finalize_inputs().
11848         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11849         Create inputs entries.
11850         * incremental.h (Incremental_input_type): New enum.
11851         (Incremental_inputs::Incremental_input): Initialize new fields.
11852         (Incremental_inputs::report_inputs): New method.
11853         (Incremental_inputs::report_achive): New method.
11854         (Incremental_inputs::report_object): New method.
11855         (Incremental_inputs::report_script): New method.
11856         (Incremental_inputs::finalize_inputs): New method.
11857         (Incremental_inputs::Input_info): New struct.
11858         (Incremental_inputs::Input_info_map): New typedef.
11859         (Incremental_inputs::lock_): New field.
11860         (Incremental_inputs::Inputs_): New field.
11861         (Incremental_inputs::Inputs_map): New field.
11862         * main.cc (main): Call Incremental_input::report_inputs.
11863         * options.h (Input_argument_list): Typedef moved from
11864         Input_arguments.
11865         (Input_file_group::Files): Remove, use ::Input_argument_list.
11866         (Input_file_group::Input_argument_list): Remove, use
11867         ::Input_argument_list.
11868         * plugin.cc (Plugin_manager::add_input_file): Add error in
11869         incremental build.
11870         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11871         functions.
11872         * script.cc (read_input_script): Call
11873         Incremental_input::report_script.
11874         * script.h (Script_info): New class.
11875
11876 2009-04-27  Ian Lance Taylor  <iant@google.com>
11877
11878         * x86_64.cc (do_adjust_output_section): Set entsize to
11879         plt_entry_size.
11880
11881 2009-04-23  Elliott Hughes  <enh@google.com>
11882
11883         * output.cc (Output_file::close): After short writes, continue
11884         writing from the correct offset in the buffer being written.
11885
11886 2009-04-23  Chris Demetriou  <cgd@google.com>
11887
11888         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11889         * configure: Regenerate.
11890         * config.in: Regenerate.
11891         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11892         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11893
11894 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11895
11896         * incremental.cc (Incremental_inputs_header_data): Renamed from
11897         Incremental_input_header_data.
11898         (Incremental_inputs_header_data::data_size): New field.
11899         (Incremental_inputs_header_data::put_input_file_count): Renamed
11900         from input_file_count.
11901         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11902         from command_line_offset.
11903         (Incremental_inputs_header_data::put_reserved): Renamed from
11904         put_reserved.
11905         (Incremental_inputs_entry_data): Renamed from
11906         Incremental_input_entry_data.
11907         (Incremental_inputs_entry_data::data_size): New field.
11908         (Incremental_inputs::report_command_line): New method.
11909         (Incremental_inputs::finalize): New method.
11910         (Incremental_inputs::create_incremental_inputs_data): New method.
11911         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11912         * incremental.h: New file.
11913         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11914         (Layout::finalize): Create incremental inputs section in
11915         incremental builds.
11916         (Layout::create_incremental_info_sections): New method.
11917         * layout.h (Layout::incremental_inputs): New method.
11918         (Layout::create_incremental_info_sections): New method.
11919         (Layout::incremental_inputs_): New field.
11920         * main.cc (main): Notify Incremental_input of the command line.
11921
11922 2009-04-01  Ian Lance Taylor  <iant@google.com>
11923             Mikolaj Zalewski  <mikolajz@google.com>
11924
11925         * gold.h (reserve_unordered_map): Define, three versions, one for
11926         each version of Unordered_map.
11927         * layout.cc (Layout::Layout): Remove options parameter.  Add
11928         number_of_input_files parameter.  Don't initialize options_.
11929         Initialize number_of_input_files_ and resized_signatures_.  Move
11930         sections_are_attached_.
11931         (Layout::layout_group): Reserve space for group_signatures_.
11932         (Layout::find_or_add_kept_section): Change name parameter to be a
11933         reference.  Resize signatures_ map when it gets large enough.
11934         (Layout::layout_eh_frame): Use parameters->options() instead of
11935         this->options_.
11936         (Layout::make_output_section): Likewise.
11937         (Layout::attach_allocated_section_to_segment): Likewise.
11938         (Layout::finalize, Layout::create_executable_stack): Likewise.
11939         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11940         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11941         * layout.h (class Layout): Update declarations.  Remove options_
11942         field.  Add number_of_input_files_ and resized_signatures_
11943         fields.  Move sections_are_attached_ field.
11944         * main.cc (main): Pass number of input files to Layout
11945         constructor.  Don't pass options.
11946
11947 2009-03-30  Ian Lance Taylor  <iant@google.com>
11948
11949         * ffsll.c (ffsll): Correct implementation.
11950
11951 2009-03-27  Ian Lance Taylor  <iant@google.com>
11952
11953         * ffsll.c: New file.
11954         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11955         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11956         * ftruncate.c (ftruncate): Declare before definition.
11957         * mremap.c (mremap): Likewise.
11958         * pread.c (pread): Likewise.
11959         * configure, Makefile.in, config.in: Rebuild.
11960
11961         * mremap.c: New file.
11962         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11963         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11964         (mremap): Declare if HAVE_MREMAP is not defined.
11965         * configure, Makefile.in, config.in: Rebuild.
11966
11967 2009-03-27  Cary Coutant  <ccoutant@google.com>
11968
11969         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11970         position independent.
11971         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11972         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11973
11974 2009-03-24  Cary Coutant  <ccoutant@google.com>
11975
11976         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11977         an executable.
11978         (needs_dynamic_reloc): Likewise.
11979
11980 2009-03-24  Ian Lance Taylor  <iant@google.com>
11981
11982         * yyscript.y (file_cmd): Recognize EXTERN.
11983         (extern_name_list, extern_name_list_body): New nonterminals.
11984         * script.cc (script_add_extern): Define.
11985         * script-c.h (script_add_extern): Declare.
11986
11987 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11988
11989         * object.cc (is_elf_object): Define.
11990         * object.h (is_elf_object): Declare.
11991         * archive.cc (Archive::get_elf_object_for_member): Call
11992         is_elf_object.
11993         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11994
11995 2009-03-24  Elliott Hughes  <enh@google.com>
11996
11997         * output.cc (Output_file::map_anonymous): Define.
11998         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11999         try an anonymous one.  Report the size if the mmap fails.
12000         * output.h (class Output_file): Declare map_anonymous.
12001
12002 2009-03-24  Ian Lance Taylor  <iant@google.com>
12003
12004         * target-select.cc (instantiate_target): Don't acquire the lock if
12005         the instantiated_target_ field has already been set.
12006
12007 2009-03-23  Ian Lance Taylor  <iant@google.com>
12008
12009         * gold-threads.h (class Initialize_lock): Define.
12010         * gold-threads.cc (class Initialize_lock_once): Define.
12011         (initialize_lock_control): New static variable.
12012         (initialize_lock_pointer): New static variable.
12013         (initialize_lock_once): New static function.
12014         (Initialize_lock::Initialize_lock): Define.
12015         (Initialize_lock::initialize): Define.
12016         * target-select.h: Include "gold-threads.h".
12017         (class Target_selector): Add lock_ and initialize_lock_ fields.
12018         Don't define instantiate_target, just declare it.
12019         * target-select.cc (Target_selector::Target_selector): Initialize
12020         new fields.
12021         (Target_selector::instantiate_target): Define.
12022         * descriptors.h: Include "gold-threads.h".
12023         (class Descriptors): Add initialize_lock_ field.
12024         * descriptors.cc (Descriptors::Descriptors): Initialize new
12025         field.
12026         (Descriptors::open): Use initialize_lock_ field
12027         * errors.h (class Errors): Add initialize_lock_ field.
12028         * errors.cc (Errors::Errors): Initialize new field.
12029         (Errors::initialize_lock): Use initialize_lock_ field.
12030         * powerpc.cc (class Target_selector_powerpc): Remove
12031         instantiated_target_ field.  In do_recognize call
12032         instantiate_target rather than do_instantiate_target.  In
12033         do_instantiate_target just allocate a new target.
12034         * sparc.cc (class Target_selector_sparc): Likewise.
12035
12036         * freebsd.h: New file.
12037         * i386.cc: Include "freebsd.h".
12038         (Target_i386): Derive from Target_freebsd rather than
12039         Sized_target.
12040         (Target_selector_i386): Derive from Target_selector_freebsd rather
12041         than Target_selector.
12042         * x86_64.cc: Include "freebsd.h".
12043         (Target_x86_64): Derive from Target_freebsd rather than
12044         Sized_target.
12045         (Target_selector_x86_64): Derive from Target_selector_freebsd
12046         rather than Target_selector.
12047         * target.h (class Target): Add adjust_elf_header and
12048         do_adjust_elf_header.
12049         * output.cc (Output_file_header:: do_sized_write): Call target
12050         adjust_elf_header routine.
12051         * configure.tgt: Set targ_osabi.
12052         * configure.ac: Define GOLD_DEFAULT_OSABI.
12053         * parameters.cc (Parameters::default_target): Pass
12054         GOLD_DEFAULT_OSABI to select_target.
12055         * target-select.h (class Target_selector): Make instantiate_target
12056         protected rather than private.
12057         * Makefile.am (HFILES): Add freebsd.h.
12058         * configure, Makefile.in, config.in: Rebuild.
12059
12060         * merge.cc (do_add_input_section): Correct pend value.  Change
12061         message about last entry not being null terminated from error to
12062         warning.
12063
12064 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12065
12066         * incremental.cc: New file.
12067         * Makefile.am (CCFILES): Add incremental.cc.
12068         * Makefile.in: Rebuild.
12069
12070 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12071
12072         * layout.cc (Layout::output_section_name): Preserve names
12073         of '.note.' sections.
12074
12075 2009-03-19  Ian Lance Taylor  <iant@google.com>
12076
12077         * descriptors.cc (Descriptors::open): Check that the options are
12078         valid before using them.
12079
12080 2009-03-18  Ian Lance Taylor  <iant@google.com>
12081
12082         * script-sections.h: Include <list>.
12083         (class Script_sections): Change Sections_elements from std::vector
12084         to std::list.  Typedef public Elements_iterator.  Add
12085         orphan_section_placement_, data_segment_align_start_, and
12086         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12087         field.
12088         * script-sections.cc (class Orphan_section_placement): New class.
12089         (class Sections_element): Add virtual functions is_relro and
12090         orphan_section_init.  Remove virtual function place_orphan_here.
12091         (class Output_section_definition): Add is_relro and
12092         orphan_section_init.  Remove place_orphan_here.
12093         (class Orphan_output_section): Likewise.
12094         (Script_sections::Script_sections): Update for field changes.
12095         (Script_sections::data_segment_align): Set saw_data_segment_align_
12096         and data_segment_align_start_, not data_segment_align_index.
12097         (Script_sections::data_segment_relro_end): Check
12098         saw_data_segment_align_.  Use data_segment_align_start_ rather
12099         than data_segment_align_index_.
12100         (Script_sections::place_orphan): Rewrite to use
12101         Orphan_section_placement.
12102
12103 2009-03-17  Ian Lance Taylor  <iant@google.com>
12104
12105         * archive.cc (Archive::add_symbols): Check for a version attached
12106         to the symbol name in the archive map.
12107         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12108         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12109         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12110         (ver_test_11.a): New target.
12111         * testsuite/Makefile.in: Rebuild.
12112
12113         * configure.ac: Check for chsize and posix_fallocate.  Replace
12114         ftruncate.
12115         * ftruncate.c: New file, from gnulib.
12116         * output.cc (posix_fallocate): Define dummy version if not
12117         HAVE_POSIX_FALLOCATE.
12118         (Output_file::map): Call posix_fallocate rather than lseek and
12119         write.
12120         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12121         * configure, Makefile.in, config.in: Rebuild.
12122
12123 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12124
12125         * layout.h (Layout::create_note): Add section_name parameter.
12126         * layout.cc (Layout::create_note): Likewise.
12127         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12128
12129 2009-03-17  Ian Lance Taylor  <iant@google.com>
12130
12131         * descriptors.cc: Include "options.h".
12132         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12133         (Descriptors::open): Always use O_CLOEXEC when opening a new
12134         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12135         then set FD_CLOEXEC.
12136
12137         * sparc.cc (class Target_sparc): Add has_got_section.
12138         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12139         make sure we have a GOT section.
12140
12141         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12142         (Target_sparc::Scan::local): Likewise.
12143         (Target_sparc::Scan::global): Likewise.
12144         (Target_sparc::Relocate::relocate): Likewise.
12145         (Target_sparc::Relocate::relocate_tls): Likewise.
12146
12147         * symtab.cc (Symbol_table::define_default_version): New function,
12148         broken out of add_from_object.
12149         (Symbol_table::add_from_object): Call define_default_version.
12150         (Symbol_table::define_special_symbol): Add resolve_oldsym
12151         parameter.  Change all callers.  If the version for a symbol comes
12152         from a version script, resolve it with the symbol with the same
12153         name with no version.  Also add the symbol without a version if
12154         appropriate.
12155         (do_define_in_output_data): If resolving with oldsym, don't delete
12156         sym.
12157         (do_define_in_output_segment): Likewise.
12158         (do_define_as_constant): Likewise.
12159         * symtab.h (class Symbol_table): Update declarations.
12160
12161 2009-03-13  Ian Lance Taylor  <iant@google.com>
12162
12163         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12164         (Read_symbols::requeue): New function.
12165         (Read_symbols::do_read_symbols): If make_elf_object fails because
12166         the target type is not configured, and the file was searched for,
12167         issue a warning and retry with the next directory.
12168         (Add_symbols::run): If the file has an incompatible format, and
12169         it was searched for, requeue the Read_symbols task.  On error,
12170         release the object.
12171         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12172         dirindex parameter to constructor.  Change all callers.  Declare
12173         incompatible_warning and requeue.
12174         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12175         input_argument_ and input_group_ fields.  Add them to
12176         constructor.  Change all callers.
12177         (class Read_script): Add dirindex_ field.  Add it to constructor.
12178         Change all callers.
12179         * archive.cc (Archive::setup): Remove input_objects parameter.
12180         Change all callers.
12181         (Archive::get_file_and_offset): Likewise.
12182         (Archive::read_all_symbols): Likewise.
12183         (Archive::read_symbols): Likewise.
12184         (Archive::get_elf_object_for_member): Remove input_objects
12185         parameter.  Add punconfigured parameter.  Change all callers.
12186         (Archive::add_symbols): Change return type to bool.  Check return
12187         value of include_member.
12188         (Archive::include_all_members): Likewise.
12189         (Archive::include_member): Change return type to bool.  Return
12190         false if first included object has incompatible target.  Set
12191         included_member_ field.
12192         (Add_archive_symbols::run): If add_symbols returns false, requeue
12193         Read_symbols task.
12194         * archive.h (class Archive): Add included_member_ field.
12195         Initialize it in constructor.  Add input_file and searched_for
12196         methods.  Update declarations.
12197         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12198         input_argument_ fields.  Add them to constructor.  Change all
12199         callers.
12200         * script.cc: Include "target-select.h".
12201         (class Parser_closure): Add skip_on_incompatible_target_ and
12202         found_incompatible_target_ fields.  Add
12203         skip_on_incompatible_target parameter to constructor.  Change all
12204         callers.  Add methods skip_on_incompatible_target,
12205         clear_skip_on_incompatible_target, found_incompatible_target, and
12206         set_found_incompatible_target.
12207         (read_input_script): Add dirindex parameter.  Change all callers.
12208         If parser finds an incompatible target, requeue Read_symbols
12209         task.
12210         (script_set_symbol): Clear skip_on_incompatible_target in
12211         closure.
12212         (script_add_assertion, script_parse_option): Likewise.
12213         (script_start_sections, script_add_phdr): Likewise.
12214         (script_check_output_format): New function.
12215         * script.h (read_input_script): Update declaration.
12216         * script-c.h (script_check_output_format): Declare.
12217         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12218         (ignore_cmd): Remove OUTPUT_FORMAT.
12219         * fileread.cc (Input_file::Input_file): Add explicit this.
12220         (Input_file::will_search_for): New function.
12221         (Input_file::open): Add pindex parameter.  Change all callers.
12222         * fileread.h (class Input_file): Add input_file_argument method.
12223         Declare will_search_for.  Update declarations.
12224         * object.cc (make_elf_object): Add punconfigured parameter.
12225         Change all callers.
12226         * object.h (class Object): Make input_file public.  Add
12227         searched_for method.
12228         (make_elf_object): Update declaration.
12229         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12230         restart search.
12231         * dirsearch.h (class Dirsearch): Update declaration.
12232         * options.h (class General_options): Add --warn-search-mismatch.
12233         * parameters.cc (Parameters::is_compatible_target): New function.
12234         * parameters.h (class Parameters): Declare is_compatible_target.
12235         * workqueue.cc (Workqueue::add_blocker): New function.
12236         * workqueue.h (class Workqueue): Declare add_blocker.
12237
12238         * fileread.cc (Input_file::open): Remove options parameter.
12239         Change all callers.
12240         (Input_file::open_binary): Likewise.
12241         * script.cc (read_input_script): Likewise.
12242         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12243         options parameter from constructor.  Change all callers.
12244         (class Read_script): Likewise.
12245         * fileread.h (class Input_file): Update declarations.
12246         * script.h (read_input_script): Update declaration.
12247
12248 2009-03-10  Nick Clifton  <nickc@redhat.com>
12249
12250         * po/es.po: New Spanish translation.
12251
12252 2009-03-06  Cary Coutant  <ccoutant@google.com>
12253
12254         * options.cc (parse_short_option): Keep dash_z from registering itself.
12255
12256 2009-03-03  Ian Lance Taylor  <iant@google.com>
12257
12258         PR 9918
12259         * target-reloc.h (relocate_section): Pass output_section to
12260         relocate.
12261         * i386.cc (Target_i386::should_apply_static_reloc): Add
12262         output_section parameter.  Change all callers.
12263         (Target_i386::Relocate::relocate): Add output_section parameter.
12264         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12265         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12266         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12267         * testsuite/two_file_shared.sh: New script.
12268         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12269         (check_DATA): Add two_file_shared.dbg.
12270         (two_file_shared.dbg): New target.
12271         * testsuite/Makefile.in: Rebuild.
12272
12273 2009-03-01  Ian Lance Taylor  <iant@google.com>
12274
12275         * configure.ac: Check for byteswap.h.
12276         * configure: Rebuild.
12277         * config.in: Rebuild.
12278
12279 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12280
12281         * layout.cc (Layout::find_or_add_kept_section): New function.
12282         (Layout::add_comdat): Removed.
12283         * layout.h (struct Kept_section): Move out of class Layout.
12284         Remove trailing underscores from field names.  Add group_sections
12285         field.  Rename group_ field to is_group.  Change all uses.
12286         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12287         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12288         comdat_groups_ field.
12289         (Sized_relobj::include_section_group): Use
12290         find_or_add_kept_section and Kept_section::group_sections.
12291         (Sized_relobj::include_linkonce_section): Likewise.
12292         * object.cc (class Sized_relobj): Don't define Comdat_group or
12293         Comdat_group_table.  Remove find_comdat_group and
12294         add_comdat_group.  Remove comdat_groups_ field.
12295         * plugin.cc (include_comdat_group): Use
12296         Layout::find_or_add_kept_section.
12297
12298 2009-02-28  Ian Lance Taylor  <iant@google.com>
12299
12300         * README: --gc-sections and map files are now supported.  Document
12301         some build requirements.
12302
12303         PR 6992
12304         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12305         relocatable link set the value of the section symbol to zero.
12306         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12307         relocatable link don't include the section address in the local
12308         symbol value.
12309
12310 2009-02-27  Ian Lance Taylor  <iant@google.com>
12311
12312         PR 6811
12313         * options.h (class Search_directory): Add is_system_directory.
12314         (class General_options): Declare is_in_system_directory.
12315         * options.cc (get_relative_sysroot): Make static.
12316         (get_default_sysroot): Make static.
12317         (General_optoins::is_in_system_directory): New function.
12318         * fileread.cc (Input_file::is_in_system_directory): New function.
12319         * fileread.h (class Input_file): Declare is_in_system_directory.
12320         * object.h (class Object): Add is_in_system_directory.
12321         (class Input_objects): Remove system_library_directory_ field.
12322         * object.cc (Input_objects::add_object): Don't set
12323         system_library_directory_.
12324         (input_objects::found_in_system_library_directory): Remove.
12325         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12326         parameter.  Change all callers.
12327         (Symbol_table::sized_write_globals): Likewise.
12328         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12329         Call Object::is_in_system_directory.
12330         * symtab.h (class Symbol_table): Update declarations.
12331
12332         PR 5990
12333         * descriptors.h (Open_descriptor): Add is_on_stack field.
12334         * descriptors.cc (Descriptors::open): If the descriptor is on the
12335         top of the stack, remove it.  Initialize is_on_stack field.
12336         (Descriptors::release): Only add pod to stack if it is not on the
12337         stack already.
12338         (Descriptors::close_some_descriptor): Clear stack_next and
12339         is_on_stack fields.
12340
12341         PR 7091
12342         * output.cc (Output_section::find_starting_output_address): Rename
12343         from starting_output_address; add PADDR parameter; change return
12344         type.
12345         * output.h (class Output_section): Declare
12346         find_starting_output_address instead of starting_output_address.
12347         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12348         section symbol for which we can't find a merge section.
12349
12350         PR 9836
12351         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12352         hidden or internal, force the symbol to be local.
12353         * resolve.cc (Symbol::override_visibility): Define.
12354         (Symbol::override_base): Use override_visibility.
12355         (Symbol_table::resolve): Likewise.
12356         (Symbol::override_base_with_special): Likewise.
12357         (Symbol_table::override_with_special): If the visibility is hidden
12358         or internal, force the symbol to be local.
12359         * symtab.h (class Symbol): Add set_visibility and
12360         override_visibility.
12361         * testsuite/ver_test_1.sh: New file.
12362         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12363         (check_DATA): Add ver_test_1.syms.
12364         (ver_test_1.syms): New target.
12365         * testsuite/Makefile.in: Rebuild.
12366
12367 2009-02-25  Cary Coutant  <ccoutant@google.com>
12368
12369         * layout.cc (Layout::choose_output_section): Don't rename sections
12370         when using a linker script that has a SECTIONS clause.
12371         * Makefile.in: Regenerate.
12372
12373         * testsuite/Makefile.am (script_test_5.sh): New test case.
12374         * testsuite/Makefile.in: Regenerate.
12375         * testsuite/script_test_5.cc: New file.
12376         * testsuite/script_test_5.sh: New file.
12377         * testsuite/script_test_5.t: New file.
12378
12379 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12380
12381         * archive.cc (Archive::include_member): Update calls to add_symbols.
12382         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12383         the Layout argument.
12384         * dynobj.h (do_add_symbols): Add the Layout argument.
12385         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12386         Layout argument.
12387         * object.h (Object::add_symbols): Add the Layout argument.
12388         (Object::do_add_symbols): Add the Layout argument.
12389         (Sized_relobj::do_add_symbols): Add the Layout argument.
12390         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12391         Unify the two versions.
12392         (Add_plugin_symbols): Remove.
12393         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12394         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12395         (Add_plugin_symbols): Remove.
12396         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12397         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12398         (Add_symbols::run): Make it work with Pulginobj.
12399
12400 2009-02-06  Ian Lance Taylor  <iant@google.com>
12401
12402         * object.cc (Sized_relobj::do_layout): Make info message start
12403         with lower case letter.
12404
12405 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12406
12407         * binary.cc: Fix file comment.
12408
12409         * options.h (enum Incremental_disposition): Define.
12410         (class General_options): Add new options: --incremental,
12411         --incremental_changed, --incremental_unchanged,
12412         --incremental_unknown.  Add incremental_disposition_ and
12413         implicit_incremental_ fields.
12414         (General_options::incremental_disposition): New function.
12415         (class Position_dependent_options): Add incremental_disposition
12416         option.
12417         (Position_dependent_options::copy_from_options): Set incremental
12418         dispositions.
12419         * options.cc (General_options::parse_incremental_changed): New
12420         function.
12421         (General_options::parse_incremental_unchanged): New function.
12422         (General_options::parse_incremental_unknown): New function.
12423         (General_options::General_options): Initialize new fields
12424         incremental_disposition_ and implicit_incremental_.
12425         (General_options::finalize): Check for uasge of --incremental-*
12426         without --incremental.
12427
12428 2009-02-06  Chris Demetriou  <cgd@google.com>
12429
12430         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12431         pointer and to report location as the file name associated with
12432         the symbol.
12433         (gold_undefined_symbol_at_location): New function to replace the
12434         old gold_undefined_symbol functionality.
12435         * target-reloc.h (relocate_section): Update to use
12436         gold_undefined_symbol_at_location.
12437         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12438         Call gold_undefined_symbol function rather than gold_error.
12439         * errors.h (Errors::undefined_symbol): Take location as a
12440         string, rather than calculating it from a relocation.
12441         * errors.cc (Errors::fatal): Print "fatal error:" before the
12442         formatted message.
12443         (Errors::error, Errors::error_at_location): Print "error: "
12444         before the formatted message.
12445         (Errors::undefined_symbol): Take location as a string, rather
12446         than calculating it from a relocation.
12447         (gold_undefined_symbol_at_location): New function akin to
12448         old gold_undefined_symbol, calculates location from relocation.
12449         (gold_undefined_symbol): Change to take only a Symbol pointer
12450         and to report location as the file name associated with the symbol.
12451         * testsuite/debug_msg.sh: Update for changed error messages.
12452         * testsuite/undef_symbol.sh: Likewise.
12453
12454 2009-02-04  Duncan Sands  <baldrick@free.fr>
12455
12456         PR 9812
12457         * reduced_debug_output.h
12458         (Output_reduced_debug_abbrev_section::failed): Use format for
12459         gold_warning.
12460         (Output_reduced_debug_info_section::faild): Likewise.
12461
12462 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12463
12464         * script.cc (Lazy_demangler): New class.
12465         (Version_script_info::get_symbol_version_helper): Demangle a
12466         symbol only once.
12467
12468 2009-01-29  Cary Coutant  <ccoutant@google.com>
12469
12470         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12471         to __tls_get_addr.
12472         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12473
12474 2009-01-28  Ian Lance Taylor  <iant@google.com>
12475
12476         * version.cc (version_string): Bump to 1.9.
12477
12478         * gold.h: Include <cstring> and <stdint.h>.
12479         * version.cc: Include <cstdio>.
12480         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12481         warning.
12482         * reduced_debug_output.cc (insert_into_vector): Rename from
12483         Insert_into_vector; change all callers.  Use Swap_unaligned to
12484         avoid aliasing issue; remove union since it is unnecessary.
12485
12486 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12487
12488         * Makefile.am (CCFILES): Add gc.cc.
12489         (HFILES): Add gc.h.
12490         * Makefile.in: Regenerate.
12491         * gold.cc (Gc_runner): New class.
12492         (queue_initial_tasks): Call garbage collection related tasks
12493         when corresponding options are invoked.
12494         (queue_middle_gc_tasks): New function.
12495         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12496         processed early before laying out sections during garbage collection.
12497         * gold.h (queue_middle_gc_tasks): New function.
12498         (is_prefix_of): Move from "layout.cc".
12499         * i386.cc (Target_i386::gc_process_relocs): New function.
12500         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12501         * main.cc (main): Create object of class "Garbage_collection".
12502         * object.cc (Relobj::copy_symbols_data): New function.
12503         (Relobj::is_section_name_included): New function.
12504         (Sized_relobj::do_layout): Allow this function to be called twice
12505         during garbage collection and defer layout of section during the
12506         first call.
12507         * object.h (Relobj::get_symbols_data): New function.
12508         (Relobj::is_section_name_included): New function.
12509         (Relobj::copy_symbols_data): New function.
12510         (Relobj::set_symbols_data): New function.
12511         (Relobj::get_relocs_data): New function.
12512         (Relobj::set_relocs_data): New function.
12513         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12514         (Relobj::gc_process_relocs): New function.
12515         (Relobj::do_gc_process_relocs): New pure virtual function.
12516         (Relobj::sd_): New data member.
12517         (Sized_relobj::is_output_section_offset_invalid): New function.
12518         (Sized_relobj::do_gc_process_relocs): New function.
12519         * options.h (General_options::gc_sections): Modify to not be a no-op.
12520         (General_options::print_gc_sections): New option.
12521         * plugin.cc (Plugin_finish::run): Remove function call to
12522         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12523         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12524         * reloc.cc (Read_relocs::run): Add task to process relocs and
12525         determine unreferenced sections when doing garbage collection.
12526         (Gc_process_relocs): New class.
12527         (Sized_relobj::do_gc_process_relocs): New function.
12528         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12529         sections that are garbage collected.
12530         * reloc.h (Gc_process_relocs): New class.
12531         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12532         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12533         symbols whose corresponding sections are garbage collected.
12534         (Symbol_table::Symbol_table): Add new parameter for the garbage
12535         collection object.
12536         (Symbol_table::gc_mark_undef_symbols): New function.
12537         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12538         (Symbol_table::gc_mark_dyn_syms): New function.
12539         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12540         as garbage.
12541         (Symbol_table::add_from_object): Likewise.
12542         (Symbol_table::add_from_relobj): When building shared objects, do not
12543         treat externally visible symbols as garbage.
12544         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12545         table information for static and relocatable links.
12546         * symtab.h (Symbol_table::set_gc): New function.
12547         (Symbol_table::gc): New function.
12548         (Symbol_table::gc_mark_undef_symbols): New function.
12549         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12550         (Symbol_table::gc_mark_dyn_syms): New function.
12551         (Symbol_table::gc_): New data member.
12552         * target.h (Sized_target::gc_process_relocs): New pure virtual
12553         function.
12554         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12555         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12556
12557 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12558
12559         * options.h (General_options::gc_sections): Define as a no-op for now.
12560         (General_options::no_keep_memory): Ditto.
12561         (General_options::Bshareable): Define.
12562         * options.cc (General_options::finalize): Honor -Bshareable.
12563
12564 2009-01-20  Andreas Schwab  <schwab@suse.de>
12565
12566         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12567         read the value in the contents, since we don't use it.  Use the
12568         template endianness when writing.
12569         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12570
12571 2009-01-19  Andreas Schwab  <schwab@suse.de>
12572
12573         * configure.tgt (powerpc64-*): Fix targ_obj.
12574
12575 2009-01-15  Ian Lance Taylor  <iant@google.com>
12576
12577         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12578         local symbols when stripping all symbols.
12579
12580 2009-01-14  Cary Coutant  <ccoutant@google.com>
12581
12582         * output.cc (Output_reloc): Add explicit instantiations.
12583
12584 2009-01-14  Cary Coutant  <ccoutant@google.com>
12585
12586         * archive.cc (Archive::get_elf_object_for_member): Remove call
12587         to File_read::claim_for_plugin.
12588         * descriptors.cc (Descriptors::open): Remove reference to
12589         is_claimed.
12590         (Descriptors::claim_for_plugin): Remove.
12591         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12592         (Descriptors::is_claimed): Remove.
12593         (claim_descriptor_for_plugin): Remove.
12594         * fileread.cc (File_read::claim_for_plugin): Remove.
12595         * fileread.h (File_read::claim_for_plugin): Remove.
12596         (File_read::descriptor): Reopen descriptor if necessary.
12597         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12598         (Plugin_manager::all_symbols_read): Add task parameter. Change
12599         all callers.
12600         (Plugin_manager::get_input_file): New function.
12601         (Plugin_manager::release_input_file): New function.
12602         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12603         corresponding data member.
12604         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12605         and pass to base constructor. Change all callers.
12606         (get_input_file, release_input_file): New functions.
12607         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12608         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12609         (Plugin_manager::all_symbols_read): Add task parameter.
12610         (Plugin_manager::get_input_file): New function.
12611         (Plugin_manager::release_input_file): New function.
12612         (Plugin_manager::task_): New data member.
12613         (Pluginobj::Pluginobj): Add filesize parameter.
12614         (Pluginobj::filename): New function.
12615         (Pluginobj::descriptor): New function.
12616         (Pluginobj::filesize): New function.
12617         (Pluginobj::filesize_): New data member.
12618         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12619         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12620         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12621
12622         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12623         with archive libraries.
12624         * testsuite/Makefile.in: Regenerate.
12625         * testsuite/plugin_test.c (struct sym_info): New type.
12626         (get_input_file, release_input_file): New static variables.
12627         (onload): Capture new transfer vector entries.
12628         (claim_file_hook): Stop reading at end of file according to filesize.
12629         Factor out parsing of readelf output into separate function.
12630         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12631         APIs and get the source file name from the symbol table.  Convert
12632         source file name to corresponding object file name.  Print info
12633         message when adding new input files.
12634         (parse_readelf_line): New function.
12635         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12636         * testsuite/plugin_test_2.sh: Likewise.
12637         * testsuite/plugin_test_3.sh: Likewise.
12638         * testsuite/plugin_test_4.sh: New test case.
12639
12640 2009-01-07  Ian Lance Taylor  <iant@google.com>
12641
12642         * version.cc (version_string): Bump to 1.8.
12643
12644 2008-12-23  Cary Coutant  <ccoutant@google.com>
12645
12646         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12647         * plugin.cc (Plugin_manager::finish): Rename as
12648         layout_deferred_objects.  Move cleanup to separate function.
12649         (Plugin_manager::cleanup): New function.
12650         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12651         separately.
12652         * plugin.h (Plugin_manager::finish): Rename as
12653         layout_deferred_objects.
12654         (Plugin_manager::cleanup): New function.
12655         (Plugin_manager::cleanup_done): New field.
12656
12657 2008-12-23  Cary Coutant  <ccoutant@google.com>
12658
12659         * plugin.cc (is_visible_from_outside): New function.
12660         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12661         so we don't return "IR only" status for exported symbols or -r links.
12662
12663         * testsuite/Makefile.am (plugin_test_3): New test case.
12664         * testsuite/Makefile.in: Regenerate.
12665         * testsuite/plugin_test_3.sh: New file.
12666
12667 2008-12-22  Cary Coutant  <ccoutant@google.com>
12668
12669         * object.cc (Sized_relobj::layout_section): New function.
12670         (Sized_relobj::do_layout): Defer layout of input sections until after
12671         plugin has provided replacement files.
12672         (Sized_relobj::do_layout_deferred_sections): New function.
12673         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12674         (Relobj::layout_deferred_sections): New function.
12675         (Relobj::do_layout_deferred_sections): New function.
12676         (Sized_relobj::do_layout_deferred_sections): New function.
12677         (Sized_relobj::layout_section): New function.
12678         (Sized_relobj::Deferred_layout): New structure.
12679         (Sized_relobj::deferred_layout_): New field.
12680         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12681         Change all callers.  Layout deferred sections.
12682         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12683         references.
12684         (Plugin_hook::run): Move code from do_plugin_hook inline.
12685         (Plugin_hook::do_plugin_hook): Remove.
12686         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12687         (Plugin_manager::finish): Renamed, was cleanup.
12688         (Plugin_manager::should_defer_layout): New function.
12689         (Plugin_manager::add_deferred_layout_object): New function.
12690         (Plugin_manager::Deferred_layout_list): New type.
12691         (Plugin_manager::deferred_layout_objects_): New field.
12692         (Plugin_hook::do_plugin_hook): Remove.
12693
12694 2008-12-17  Ian Lance Taylor  <iant@google.com>
12695
12696         * options.h (class General_options): Add --no case for
12697         --export-dynamic.
12698
12699 2008-12-16  Cary Coutant  <ccoutant@google.com>
12700
12701         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12702         vector.
12703         (Plugin_manager::claim_file): Create plugin object even if
12704         plugin did not call the add_symbols callback.
12705         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12706         asking for more symbols than were added.
12707         * testsuite/Makefile.am (plugin_test_1): Add test case with
12708         no global symbols.
12709         (empty.syms): New target.
12710         * testsuite/Makefile.in: Regenerate.
12711         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12712         message. Don't call add_symbols if no globals.
12713         (all_symbols_read_hook): Don't provide replacement for empty
12714         claimed file.
12715
12716 2008-12-12  Ian Lance Taylor  <iant@google.com>
12717
12718         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12719         r_type == 0 for a local symbol with r_sym == 0.
12720         (scan_relocatable_relocs): Pass r_sym to
12721         local_non_section_strategy.
12722         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12723         r_sym parameter.
12724
12725         * configure.ac: Update test for TLS descriptors: they are
12726         supported as of glibc 2.9.
12727         * configure: Rebuild.
12728
12729 2008-12-11  Ian Lance Taylor  <iant@google.com>
12730
12731         PR 7091
12732         * target-reloc.h (Default_scan_relocatable_relocs): For each
12733         function, map r_type == 0 to RELOC_DISCARD.
12734
12735 2008-12-10  Cary Coutant  <ccoutant@google.com>
12736
12737         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12738         object to override a kept COMDAT group from a plugin object.
12739
12740 2008-12-09  Ian Lance Taylor  <iant@google.com>
12741
12742         PR 7088
12743         * yyscript.y (file_cmd): Handle INPUT.
12744
12745         * testsuite/initpri1.c: Change all declarations to be full
12746         prototypes by adding void, to avoid compiler warnings.
12747
12748 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12749
12750         * options.cc (General_options::parse_plugin_opt): New.
12751         (General_options::add_plugin): The argument now is just the filename.
12752         (General_options::add_plugin_option): New.
12753         * options.h (plugin_opt): New.
12754         (add_plugin): Change argument name.
12755         (add_plugin_option): New.
12756         * plugin.cc (Plugin::load): Don't parse the plugin option.
12757         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12758         (Plugin::add_option): New.
12759         (Plugin::args_): Change type.
12760         (Plugin::filename_): New.
12761         (Plugin_manager::add_plugin_option): New.
12762         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12763         * testsuite/Makefile.in: Regenerate.
12764
12765 2008-12-05  Cary Coutant  <ccoutant@google.com>
12766
12767         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12768         Handle --strip-lto-sections option.
12769         * options.h (strip_lto_sections): New option.
12770
12771 2008-12-01  Cary Coutant  <ccoutant@google.com>
12772
12773         * plugin.cc (ld_plugin_message): Change format parameter to const.
12774         Fix mismatch between new[] and delete.
12775
12776 2008-11-14  Cary Coutant  <ccoutant@google.com>
12777
12778         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12779         instead of -1U.
12780
12781 2008-11-05  Craig Silverstein  <csilvers@google.com>
12782
12783         * options.cc (General_options::parse_dynamic_list): New function.
12784         * options.h (General_options): New flags dynamic_list,
12785         dynamic_list_data, dynamic_list_cpp_new, and
12786         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12787         (General_options::in_dynamic_list): New function.
12788         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12789         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12790         (Lex::can_continue_name): Likewise.
12791         (yylex): Likewise.
12792         (read_script_file): New parameter script_options.
12793         (read_dynamic_list): New function.
12794         (Script_options::define_dynamic_list): New function.
12795         (dynamic_list_keyword_parsecodes): New variable.
12796         (dynamic_list_keywords): New variable.
12797         * script.h (Script_options::define_dynamic_list): New function
12798         prototype.
12799         (read_dynamic_list): New function prototype.
12800         * symtab.cc (strprefix): New macro.
12801         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12802         dynamic_list_data, dynamic_list_cpp_new, and
12803         dynamic_list_cpp_typeinfo.
12804         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12805         (dynamic_list_expr): New rule.
12806         (dynamic_list_nodes): Likewise.
12807         (dynamic_list_node): Likewise.
12808         * testsuite/Makefile.am (dynamic_list): New test.
12809         * testsuite/Makefile.in: Regenerated.
12810         * testsuite/dynamic_list.t: New file.
12811         * testsuite/dynamic_list.sh: New file.
12812
12813 2008-11-05  Craig Silverstein  <csilvers@google.com>
12814
12815         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12816         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12817         (t11_last): Likewise.
12818         * testsuite/ver_test_6.c (main): Likewise.
12819
12820 2008-10-07  Cary Coutant  <ccoutant@google.com>
12821
12822         * options.c (General_options::finalize): Add check for -static and
12823         -shared.
12824         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12825         is not empty.
12826
12827 2008-10-02  Cary Coutant  <ccoutant@google.com>
12828
12829         * plugin.cc (make_sized_plugin_object): Fix conditional
12830         compilation to work when not all targets are enabled.
12831
12832 2008-09-29  Cary Coutant  <ccoutant@google.com>
12833
12834         * archive.cc (Archive::get_file_and_offset): Use filename instead
12835         of name to get library path.
12836         (Archive::include_member): Unlock external member of a thin archive.
12837
12838         * testsuite/Makefile.am (TEST_AR): New variable.
12839         (thin_archive_test_1): New test.
12840         (thin_archive_test_2): New test.
12841         * testsuite/Makefile.in: Regenerate.
12842         * testsuite/thin_archive_main.cc: New file.
12843         * testsuite/thin_archive_test_1.cc: New file.
12844         * testsuite/thin_archive_test_2.cc: New file.
12845         * testsuite/thin_archive_test_3.cc: New file.
12846         * testsuite/thin_archive_test_4.cc: New file.
12847
12848 2008-09-29  Cary Coutant  <ccoutant@google.com>
12849
12850         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12851         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12852         instead of -1U.
12853         (Sized_relobj::do_finalize_local_symbols): Likewise.
12854         (Sized_relobj::map_to_kept_section): Likewise.
12855         * object.h (Sized_relobj::invalid_address): New constant.
12856         (Sized_relobj::do_output_section_offset): Check for invalid_address
12857         and return -1ULL.
12858         * output.cc (Output_reloc::local_section_offset): Use constant
12859         invalid_address instead of -1U.
12860         (Output_reloc::get_address): Likewise.
12861         (Output_section::output_address): Change -1U to -1ULL.
12862         * output.h (Output_reloc::invalid_address): New constant.
12863         * reloc.cc (Sized_relobj::write_sections): Use constant
12864         invalid_address instead of -1U.
12865         (Sized_relobj::relocate_sections): Likewise.
12866         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12867         values for merge sections.
12868         * target-reloc.h (relocate_for_relocatable): Use constant
12869         invalid_address instead of -1U.
12870
12871 2008-09-19  Cary Coutant  <ccoutant@google.com>
12872
12873         Add plugin functionality for link-time optimization (LTO).
12874         * configure.ac (plugins): Add --enable-plugins option.
12875         * configure: Regenerate.
12876         * config.in: Regenerate.
12877         * Makefile.am (LIBDL): New variable.
12878         (CCFILES): Add plugin.cc.
12879         (HFILES): Add plugin.h.
12880         (ldadd_var): Add LIBDL.
12881         * Makefile.in: Regenerate.
12882
12883         * archive.cc: Include "plugin.h".
12884         (Archive::setup): Don't preread archive symbols when using a plugin.
12885         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12886         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12887         files.
12888         (Archive::include_member): Add symbols from plugin objects.
12889         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12890         * descriptors.cc (Descriptors::open): Check for file descriptors
12891         abandoned by plugins.
12892         (Descriptors::claim_for_plugin): New function.
12893         * descriptors.h (Descriptors::claim_for_plugin): New function.
12894         (Open_descriptor::is_claimed): New field.
12895         (claim_descriptor_for_plugin): New function.
12896         * fileread.cc (File_read::claim_for_plugin): New function.
12897         * fileread.h (File_read::claim_for_plugin): New function.
12898         (File_read::descriptor): New function.
12899         * gold.cc: Include "plugin.h".
12900         (queue_initial_tasks): Add task to call plugin hooks for generating
12901         new object files.
12902         * main.cc: Include "plugin.h".
12903         (main): Load plugin libraries.
12904         * object.h (Pluginobj): Declare.
12905         (Object::pluginobj): New function.
12906         (Object::do_pluginobj): New function.
12907         (Object::set_target): New function.
12908         * options.cc: Include "plugin.h".
12909         (General_options::parse_plugin): New function.
12910         (General_options::General_options): Initialize plugins_ field.
12911         (General_options::add_plugin): New function.
12912         * options.h (Plugin_manager): Declare.
12913         (General_options): Add --plugin option.
12914         (General_options::has_plugins): New function.
12915         (General_options::plugins): New function.
12916         (General_options::add_plugin): New function.
12917         (General_options::plugins_): New field.
12918         * plugin.cc: New file.
12919         * plugin.h: New file.
12920         * readsyms.cc: Include "plugin.h".
12921         (Read_symbols::do_read_symbols): Check for archive before checking
12922         for ELF file.  Call plugin hooks to claim files.
12923         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12924         from a real object file; force override when processing replacement
12925         files.
12926         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12927         (Symbol::init_base_object): Likewise.
12928         (Symbol::init_base_output_data): Likewise.
12929         (Symbol::init_base_output_segment): Likewise.
12930         (Symbol::init_base_constant): Likewise.
12931         (Symbol::init_base_undefined): Likewise.
12932         (Symbol::output_section): Assert that object is not a plugin.
12933         (Symbol_table::add_from_pluginobj): New function.
12934         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12935         undefined.
12936         (Symbol_table::sized_write_globals): Likewise.
12937         (Symbol_table::add_from_pluginobj): Instantiate template.
12938         * symtab.h (Sized_pluginobj): Declare.
12939         (Symbol::in_real_elf): New function.
12940         (Symbol::set_in_real_elf): New function.
12941         (Symbol::in_real_elf_): New field.
12942         (Symbol_table::add_from_pluginobj): New function.
12943
12944         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12945         (LIBDL): New variable.
12946         (LDADD): Add LIBDL.
12947         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12948         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12949         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12950         (MOSTLYCLEANFILES): Likewise.
12951         * testsuite/Makefile.in: Regenerate.
12952         * testsuite/plugin_test.c: New file.
12953         * testsuite/plugin_test_1.sh: New file.
12954         * testsuite/plugin_test_2.sh: New file.
12955
12956 2008-09-16  Ian Lance Taylor  <iant@google.com>
12957
12958         * target-reloc.h (relocate_section): Check whether a symbol is
12959         defined by the ABI before reporting an undefined symbol error.
12960         * target.h (Target::is_defined_by_abi): Make parameter const.
12961         (Target::do_is_defined_by_abi): Likewise.
12962         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12963         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12964         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12965         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12966         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12967         * testsuite/Makefile.in: Rebuild.
12968
12969         * fileread.cc (make_view): Add casts to avoid warning.
12970
12971 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12972
12973         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12974         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12975
12976 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12977
12978         * options.h (General_options::output_is_executable): New.
12979         (General_options::output_is_pie): New.
12980         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12981         for shared libraries.
12982         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12983
12984 2008-09-11  Chris Demetriou  <cgd@google.com>
12985
12986         * options.h (origin): New -z option.
12987         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12988         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12989         in DT_FLAGS_1.
12990
12991 2008-09-05  Cary Coutant  <ccoutant@google.com>
12992
12993         * fileread.cc (File_read::make_view): Add check for attempt to map
12994         beyond end of file.
12995
12996 2008-09-05  Cary Coutant  <ccoutant@google.com>
12997
12998         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12999         explicit instantiations.
13000
13001 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13002
13003         PR gold/6858
13004         * options.cc (General_options::finalize): Allow undefined symbols
13005         in shlibs if linking -shared.
13006
13007         PR gold/6859
13008         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13009         symbols as not needing a dynsym entry.
13010
13011 2008-08-20  Craig Silverstein  <csilvers@google.com>
13012
13013         * fileread.cc (File_read::open): Do not lock the file unless it
13014         was successfully opened.
13015
13016 2008-08-14  Cary Coutant  <ccoutant@google.com>
13017
13018         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13019         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13020         * testsuite/tls_test.cc (struct int128): 128-bit struct
13021         for testing TLS relocs with non-zero addend.
13022         (v12): New TLS variable.
13023         (t12): New test.
13024         (t_last): Add check for v12.
13025         * testsuite/tls_test.h (t12): New function.
13026         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13027
13028 2008-08-13  Ian Lance Taylor  <iant@google.com>
13029
13030         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13031         set tls_segment_ or relro_segment_.
13032         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13033         when appropriate.
13034         * output.h (Output_section::clear_is_relro): New function.
13035         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13036         sections specially even when output_data_ is empty.
13037         (Output_segment::maximum_alignment): When first section is relro,
13038         only force alignment for PT_LOAD segments.
13039         * script.cc (script_data_segment_align): New function.
13040         (script_data_segment_relro_end): New function.
13041         * script-c.h (script_data_segment_align): Declare.
13042         (script_data_segment_relro_end): Declare.
13043         * script-sections.h (class Script_sections): Declare
13044         data_segment_align and data_segment_relro_end.  Add fields
13045         segment_align_index_ and saw_relro_end_.
13046         * script-sections.cc (class Sections_element): Add set_is_relro
13047         virtual function.  Add new bool* parameter to place_orphan_here.
13048         Add get_output_section virtual function.
13049         (class Output_section_definition): Add set_is_relro.  Add new
13050         bool* parameter to place_orphan_here.  Add get_output_section.
13051         Add is_relro_ field.
13052         (Output_section_definition::Output_section_definition): Initialize
13053         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13054         and is_relro_ fields.
13055         (Output_section_definition::place_orphan_here): Add is_relro
13056         parameter.
13057         (Output_section_definition::set_section_addresses): Set relro for
13058         output section.
13059         (Output_section_definition::alternate_constraint): Likewise.
13060         (class Orphan_output_section): Add new bool* parameter to
13061         place_orphan_here.  Add get_output_section.
13062         (Orphan_output_section::place_orphan_here): Add is_relro
13063         parameter.
13064         (Script_sections::Script_sections): Initialize
13065         data_segment_align_index_ and saw_relro_end_.
13066         (Script_sections::data_segment_align): New function.
13067         (Script_sections::data_segment_relro_end): New function.
13068         (Script_sections::place_orphan): Set or clear is_relro.
13069         (Script_sections::set_section_addresses): Force alignment of first
13070         TLS section.
13071         * yyscript.y (exp): Call script_data_segment_align and
13072         script_data_segment_relro_end.
13073         * testsuite/relro_script_test.t: New file.
13074         * testsuite/relro_test.cc (using_script): Declare.
13075         (t1, t2): Test using_script.
13076         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13077         (relro_script_test_SOURCES): Define.
13078         (relro_script_test_DEPENDENCIES): Define.
13079         (relro_script_test_LDFLAGS): Define.
13080         (relro_script_test_LDADD): Define.
13081         (relro_script_test.so): New target.
13082         * testsuite/Makefile.in: Rebuild.
13083
13084 2008-08-06  Cary Coutant <ccoutant@google.com>
13085
13086         * archive.cc (Archive::total_archives, Archive::total_members)
13087         (Archive::total_members_loaded): New variables.
13088         (Archive::setup): Add parameter.  Add option to preread
13089         archive symbols.
13090         (Archive::read_armap): Add counter.
13091         (Archive::get_file_and_offset): New function.
13092         (Archive::get_elf_object_for_member): New function.
13093         (Archive::read_all_symbols): New function.
13094         (Archive::read_symbols): New function.
13095         (Archive::add_symbols): Add counters.
13096         (Archive::include_all_members): Use armap to find members if it's
13097         already built.
13098         (Archive::include_member): Skip reading symbols if already read.
13099         Factored code into Archive::get_file_and_offset and
13100         Archive::get_elf_object_for_member.  Changed call to
13101         Mapfile::report_include_archive_member.
13102         (Archive::print_stats): New function.
13103         * archive.h: Declare Object and Read_symbols_data classes.
13104         (Archive::Archive): Add initializers for new members.
13105         (Archive::setup): Add parameter.
13106         (Archive::print_stats): New function.
13107         (Archive::total_archives, Archive::total_members)
13108         (Archive::total_members_loaded): New variables.
13109         (Archive::get_file_and_offset): New function.
13110         (Archive::get_elf_object_for_member): New function.
13111         (Archive::read_all_symbols): New function.
13112         (Archive::read_symbols): New function.
13113         (Archive::Archive_member): New class.
13114         (Archive::members_): New member.
13115         (Archive::num_members_): New member.
13116         * main.cc: Include archive.h.
13117         (main): Call Archive::print_stats.
13118         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13119         archive parameter; member_name is now the fully-decorated name.
13120         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13121         * options.h: (General_options): Add --preread-archive-symbols option.
13122         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13123         Archive::setup.
13124
13125 2008-08-04  Ian Lance Taylor  <iant@google.com>
13126
13127         * symtab.h (Symbol::use_plt_offset): New function.
13128         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13129         * powerpc.cc (Relocate::relocate): Likewise.
13130         * sparc.cc (Relocate::relocate): Likewise.
13131         * x86_64.cc (Relocate::relocate): Likewise.
13132         * testsuite/weak_plt.sh: New test.
13133         * testsuite/weak_plt_main.cc: New test.
13134         * testsuite/weak_plt_shared.cc: New test.
13135         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13136         (check_PROGRAMS): Add weak_plt.
13137         (check_DATA): Add weak_plt_shared.so.
13138         (weak_plt_main_pic.o, weak_plt): New targets.
13139         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13140         * testsuite/Makefile.in: Rebuild.
13141
13142         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13143         gcctestdir/ld.
13144         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13145         * testsuite/Makefile.in: Rebuild.
13146
13147 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13148
13149         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13150         * Makefile.in: Regenerate.
13151         * po/POTFILES.in: Regenerate.
13152
13153 2008-07-29  Ian Lance Taylor  <iant@google.com>
13154
13155         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13156         symbols before other symbols.
13157         * testsuite/script_test_2.cc (test_addr): Declare.
13158         (test_addr_alias): Declare.
13159         (main): Check that test_addr and test_addr_alias have the right
13160         values.
13161         * testsuite/script_test_2.t: Define test_addr_alias and
13162         test_addr.
13163
13164 2008-07-24  Ian Lance Taylor  <iant@google.com>
13165
13166         PR 5990
13167         * descriptors.cc: New file.
13168         * descriptors.h: New file.
13169         * gold-threads.h (class Hold_optional_lock): New class.
13170         * fileread.cc: Include "descriptors.h".
13171         (File_read::~File_read): Release descriptor rather than closing
13172         it.
13173         (File_read::open) [file]: Call open_descriptor rather than open.
13174         Set is_descriptor_opened_.
13175         (File_read::open) [memory]: Assert that descriptor is not open.
13176         (File_read::reopen_descriptor): New function.
13177         (File_read::release): Release descriptor.
13178         (File_read::do_read): Make non-const.  Reopen descriptor.
13179         (File_read::read): Make non-const.
13180         (File_read::make_view): Reopen descriptor.
13181         (File_read::do_readv): Likewise.
13182         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13183         Update declarations.
13184         * layout.cc: Include "descriptors.h".
13185         (Layout::create_build_id): Use open_descriptor rather than open.
13186         * output.cc: Include "descriptors.h".
13187         (Output_file::open): Use open_descriptor rather than open.
13188         * archive.cc (Archive::const_iterator): Change Archive to be
13189         non-const.
13190         (Archive::begin, Archive::end): Make non-const.
13191         (Archive::count_members): Likewise.
13192         * archive.h (class Archive): Update declarations.
13193         * object.h (Object::read): Make non-const.
13194         * Makefile.am (CCFILES): Add descriptors.cc.
13195         (HFILES): Add descriptors.h.
13196         * Makefile.in: Rebuild.
13197
13198         PR 6716
13199         * gold.h: Always include <clocale>.  Add Solaris workarounds
13200         following code in binutils/sysdep.h.
13201
13202         PR 6048
13203         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13204         this->eh_frame_hdr_ is NULL before using it.
13205
13206         * dynobj.cc (Versions::Versions): Update comment.
13207
13208         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13209         the base version name.
13210
13211         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13212         array size plus one.
13213         (Stringpool_template::set_string_offsets): Subtract one from key
13214         before using it as an array index.
13215         (Stringpool_template::get_offset_with_length): Likewise.
13216         (Stringpool_template::write_to_buffer): Likewise.
13217         * stringpool.h (Stringpool_template::get_offset_from_key):
13218         Likewise.
13219
13220 2008-07-23  Ian Lance Taylor  <iant@google.com>
13221
13222         PR 6658
13223         * object.h (Merged_symbol_value::value): Do our best to handle a
13224         negative addend.
13225
13226         PR 6647
13227         * script.cc (Version_script_info::get_versions): Don't add empty
13228         version tag to return value.
13229         (Version_script_info::get_symbol_version_helper): Change return
13230         type to bool.  Add pversion parameter.  Change all callers.
13231         (script_register_vers_node): Don't require a non-NULL tag.
13232         * script.h (class Version_script_info): Update declarations.
13233         (Version_script_info::get_symbol_version): Change return type to
13234         bool.  Add version parameter.  Change all callers.
13235         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13236         handling.  Handle an empty version from a version script.
13237         (Symbol_table::define_special_symbol): Likewise.
13238         * testsuite/ver_test_10.script: New file.
13239         * testsuite/ver_test_10.sh: New file.
13240         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13241         (check_DATA): Add ver_test_10.syms.
13242         (ver_test_10.syms, ver_test_10.so): New target.
13243         * testsuite/Makefile.in: Rebuild.
13244
13245 2008-07-23  Simon Baldwin  <simonb@google.com>
13246
13247         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13248         to zero for undefined symbols from dynamic libraries.
13249
13250 2008-07-23  Ian Lance Taylor  <iant@google.com>
13251
13252         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13253         Change all callers.
13254         * symtab.h (class Symbol_table): Update declaration.
13255         * testsuite/ver_test_9.cc: New file.
13256         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13257         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13258         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13259         (ver_test_9.so, ver_test_9.o): New targets.
13260         * testsuite/Makefile.in: Rebuild.
13261
13262 2008-07-22  Ian Lance Taylor  <iant@google.com>
13263
13264         * options.h (class General_options): Define --check-sections.
13265         * layout.cc (Layout::set_segment_offsets): Handle
13266         --check-sections.
13267
13268         * options.h (class General_options): Define -n/--nmagic and
13269         -N/--omagic.
13270         * options.cc (General_options::finalize): For -n/--nmagic or
13271         -N/--omagic, set -static.
13272         * layout.cc (Layout::attach_allocated_section_to_segment): If
13273         -N/--omagic, don't put read-only and read-write sections in
13274         different segments.
13275         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13276         finding a read-only segment.
13277         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13278         don't set the minimum segment alignment to the common page size,
13279         and don't set the file offset to the address modulo the page size.
13280         * script-sections.cc (Script_sections::create_segments): If
13281         -n/--omagic, don't put read-only and read-write sections in
13282         different segments.
13283
13284         * cref.cc: New file.
13285         * cref.h: New file.
13286         * options.h (class General_options): Add --print-symbol-counts.
13287         * main.cc (main): Issue defined symbol report if requested.
13288         * archive.cc (Archive::interpret_header): Make into a const member
13289         function.
13290         (Archive::add_symbols): Call Input_objects::archive_start and
13291         archive_stop.
13292         (Archive::const_iterator): Define new class.
13293         (Archive::begin, Archive::end): New functions.
13294         (Archive::include_all_members): Rewrite to use iterator.
13295         (Archive::count_members): New function.
13296         * archive.h (class Archive): Update declarations.
13297         (Archive::filename): New function.
13298         * object.cc: Include "cref.h".
13299         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13300         (Sized_relobj::do_get_global_symbol_counts): New function.
13301         (Input_objects::add_object): Add object to cross-referencer.
13302         (Input_objects::archive_start): New function.
13303         (Input_objects::archive_stop): New function.
13304         (Input_objects::print_symbol_counts): New function.
13305         * object.h: Declare Cref and Archive.
13306         (Object::get_global_symbol_counts): New function.
13307         (Object::do_get_global_symbol_counts): New pure virtual function.
13308         (class Sized_relobj): Add defined_count_ field.  Update
13309         declarations.
13310         (class Input_objects): Add cref_ field.  Update constructor.
13311         Update declarations.
13312         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13313         defined_count_.
13314         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13315         symbol counts.
13316         (Sized_dynobj::do_get_global_symbol_counts): New function.
13317         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13318         defined_count_.  Update declarations.  Define Symbols typedef.
13319         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13320         parameter.  Change all callers.
13321         (Symbol_table::add_from_dynobj): Add sympointers and defined
13322         parameters.  Change all callers.
13323         * symtab.h (class Symbol_table): Update declarations.
13324         * Makefile.am (CCFILES): Add cref.cc.
13325         (HFILES): Add cref.h.
13326         * Makefile.in: Rebuild.
13327
13328 2008-07-22  Simon Baldwin  <simonb@google.com>
13329
13330         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13331         to zero when writing undefined symbols.
13332
13333 2008-07-22  Ian Lance Taylor  <iant@google.com>
13334
13335         * output.cc (Output_section::add_input_section): Don't try to
13336         merge empty merge sections.
13337
13338 2008-07-21  Craig Silverstein  <csilvers@google.com>
13339
13340         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13341         Include symbol version in error message.
13342
13343 2008-07-20  Chris Demetriou  <cgd@google.com>
13344
13345         * configure.ac (gold_cv_c_random_seed): New configured variable.
13346         (RANDOM_SEED_CFLAGS): New substituted variable.
13347         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13348         * configure: Rebuild.
13349         * Makefile.in: Likewise.
13350         * testsuite/Makefile.in: Likewise.
13351
13352 2008-07-18  Ian Lance Taylor  <iant@google.com>
13353
13354         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13355         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13356         * testsuite/ver_test_main.cc (main): Call t4.
13357         (t4, t4_2a): Define.
13358         * testsuite/ver_test_2.cc (t4_2): Define.
13359         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13360         * testsuite/ver_test_4.cc (t4_2a): Define.
13361         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13362         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13363
13364 2008-07-17  Ian Lance Taylor  <iant@google.com>
13365
13366         * dynobj.cc (Versions::add_def): If we give an error about a
13367         missing version, go ahead and create the version anyhow.
13368
13369 2008-07-10  Ian Lance Taylor  <iant@google.com>
13370
13371         Handle output sections with more than 0x7fffffff bytes.
13372         * object.h (class Relobj): Change map_to_output_ to
13373         output_sections_, and just keep a section pointer.  Change all
13374         uses.  Move comdat group support to Sized_relobj.
13375         (Relobj::is_section_specially_mapped): Remove.
13376         (Relobj::output_section): Remove poff parameter.  Change all
13377         callers.
13378         (Relobj::output_section_offset): New function.
13379         (Relobj::set_section_offset): Rewrite.
13380         (Relobj::map_to_output): Remove.
13381         (Relobj::output_sections): New function.
13382         (Relobj::do_output_section_offset): New pure virtual function.
13383         (Relobj::do_set_section_offset): Likewise.
13384         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13385         group support from Relobj.  Update declarations.
13386         (Sized_relobj::get_output_section_offset): New function.
13387         (Sized_relobj::do_output_section_offset): New function.
13388         (Sized_relobj::do_set_section_offset): New function.
13389         * object.cc (Relobj::output_section_address): Remove.
13390         (Sized_relobj::Sized_relobj): Initialize new fields.
13391         (Sized_relobj::include_section_group): Cast find_kept_object to
13392         Sized_relobj.
13393         (Sized_relobj::include_linkonce_section): Likewise.
13394         (Sized_relobj::do_layout): Use separate arrays for output section
13395         and output offset.
13396         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13397         output_sections.
13398         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13399         output_sections and section_offsets.
13400         (Sized_relobj::write_local_symbols): Likewise.
13401         (map_to_kept_section): Compute output address directly.
13402         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13403         output_sections and section_offsets.
13404         (Sized_relobj::write_sections): Likewise.
13405         (Sized_relobj::relocate_sections): Likewise.
13406         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13407         * output.h (class Output_reloc): Update declarations.  Change
13408         u2_.relobj to Sized_relobj*.
13409         (class Output_data_reloc): Change add functions to use
13410         Sized_relobj*.
13411         * output.cc (Output_reloc::Output_reloc): Change relobj to
13412         Sized_relobj*.
13413         (Output_reloc::local_section_offset): Change return type to
13414         Elf_Addr.  Use get_output_section_offset.
13415         (Output_reloc::get_address): Likewise.
13416         (Output_section::is_input_address_mapped): Don't call
13417         is_section_specially_mapped.
13418         (Output_section::output_offset): Likewise.
13419         (Output_section::output_address): Likewise.
13420         (Output_section::starting_output_address): Likewise.
13421         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13422         parameter to Sized_relobj*.
13423         (Copy_relocs::need_copy_reloc): Likewise.
13424         (Copy_relocs::save): Likewise.
13425         * copy-relocs.h (class Copy_relocs): Update declarations.
13426         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13427         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13428         * target-reloc.h (relocate_for_relocatable): Change
13429         offset_in_output_section type to Elf_Addr.  Change code that uses
13430         it as well.
13431         * layout.cc (Layout::layout): Always set *off.
13432         * mapfile.cc (Mapfile::print_input_section): Use
13433         output_section_offset.
13434         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13435         Sized_relobj*.
13436         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13437         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13438         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13439
13440 2008-07-03  Ian Lance Taylor  <iant@google.com>
13441
13442         * layout.cc (Layout::include_section): Do not discard unrecognized
13443         SHT_STRTAB sections.
13444
13445 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13446
13447         * script.cc (Lex::can_continue_name): Make '?' allowable in
13448         version-script names.
13449         * testsuite/version_script.map: Change glob pattern to use '?'
13450
13451 2008-06-30  Manish Singh  <yosh@gimp.org>
13452
13453         PR 6585
13454         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13455         Correct typo.
13456
13457 2008-06-30  Ian Lance Taylor  <iant@google.com>
13458
13459         PR 6660
13460         PR 6682
13461         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13462         versions]: Don't try to read the value in the contents, since we
13463         don't use it.  Use the template endianness when writing.
13464
13465 2008-06-25  Cary Coutant  <ccoutant@google.com>
13466
13467         * fileread.cc (File_read::make_view): Assert on zero-length view.
13468         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13469         symbol table when there are no symbols to read.
13470
13471 2008-06-23  Craig Silverstein  <csilvers@google.com>
13472
13473         * version.cc (version_string): Bump to 1.7
13474
13475 2008-06-18  Craig Silverstein  <csilvers@google.com>
13476
13477         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13478         constant 0xFFFF to type Valtype.
13479         (Powerpc_relocate_functions::rel16_ha): Likewise.
13480
13481 2008-06-17  Ian Lance Taylor  <iant@google.com>
13482
13483         * output.h (Output_section::Input_section): Initialize p2align_ to
13484         zero for Output_section_data constructors.
13485         (Output_section::Input_section::addralign): If not an input
13486         section, return the alignment of the Output_section_data.
13487         * testsuite/copy_test.cc: New file.
13488         * testsuite/copy_test_1.cc: New file.
13489         * testsuite/copy_test_2.cc: New file.
13490         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13491         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13492         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13493         (copy_test_1_pic.o, copy_test_1.so): New targets.
13494         (copy_test_2_pic.o, copy_test_2.so): New targets.
13495         * testsuite/Makefile.in: Rebuild.
13496
13497         * script-sections.cc (Script_sections::place_orphan): Initialize
13498         local variable exact.
13499
13500 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13501
13502         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13503
13504 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13505             David S. Miller  <davem@davemloft.net>
13506
13507         * powerpc.cc: New file.
13508         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13509         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13510         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13511         * Makefile.in: Rebuild.
13512
13513 2008-06-09  Ian Lance Taylor  <iant@google.com>
13514
13515         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13516         <exception>.
13517         (throwing, orig_terminate): New static variables.
13518         (terminate_handler): New static function.
13519         (t2): Set terminate handler.
13520
13521 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13522
13523         PR 6584
13524         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13525         alignment.
13526
13527 2008-05-30  Cary Coutant  <ccoutant@google.com>
13528
13529         * archive.cc (Archive::include_all_members) Correct to step
13530         over symbol table and extended name table in thin archives.
13531
13532 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13533
13534         PR 6407
13535         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13536         calculation.
13537
13538 2008-05-28  Caleb Howe  <cshowe@google.com>
13539
13540         * reduced_debug_output.cc: New file.
13541         * reduced_debug_output.h: New file.
13542         * options.h (class General_options): Add --strip-debug-non-line.
13543         * options.cc (General_options::finalize): Add strip_debug_non_line
13544         to the strip heirarchy.
13545         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13546         fields.
13547         * layout.cc: Include "reduced_debug_output.h".
13548         (Layout::Layout): Initialize new fields.
13549         (line_only_debug_sections): New static array.
13550         (is_lines_only_debug_sections): New static inline function.
13551         (Layout::include_section): Handle --strip-debug-non-line.
13552         (Layout::make_output_section): If --strip-debug-non-line, build
13553         new output sections for .debug_abbrev and .debug_info.
13554         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13555         gold.  Warn about possible overflow.
13556         (read_signed_LEB_128): Likewise.
13557         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13558         (read_signed_LEB_128): Declare.
13559         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13560         (HFILES): Add reduced_debug_output.h.
13561         * Makefile.in: Rebuild.
13562
13563 2008-05-21  Ian Lance Taylor  <iant@google.com>
13564
13565         * mapfile.cc: New file.
13566         * mapfile.h: New file.
13567         * options.h (class General_options): Add -M/--print-map and -Map.
13568         * options.cc (General_options::finalize): Make -M equivalent to
13569         -Map -.
13570         * main.cc: Include <cstdio> and "mapfile.h".
13571         (main): Open mapfile if requested.
13572         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13573         constructor.  Change caller.
13574         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13575         (queue_middle_tasks): Likewise.
13576         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13577         declarations.
13578         * archive.cc: Include "mapfile.h".
13579         (Archive::add_symbols): Add mapfile parameter.  Change all
13580         callers.  Pass mapfile, symbol, and reason to include_member.
13581         (Archive::include_all_members): Add mapfile parameter.  Change all
13582         callers.
13583         (Archive::include_member): Add mapfile, sym, and why parameters.
13584         Change all callers.  Report inclusion to map file.
13585         * archive.h: Include "fileread.h".
13586         (class Archive): Update declarations.
13587         (Archive::file): New const method.
13588         (class Add_archive_symbols): Add mapfile_ field.  Update
13589         constructor.  Change all callers.
13590         * readsyms.h (class Read_symbols): Likewise.
13591         (class Finish_group): Likewise.
13592         (class Read_script): Likewise.
13593         * common.cc: Include "mapfile.h".
13594         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13595         all callers.
13596         (Symbol_table::do_allocate_commons): Likewise.
13597         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13598         symbol allocation to mapfile.
13599         * common.h (class Allocate_commons_task): Add mapfile_ field.
13600         Update constructor.  Change all callers.
13601         * symtab.h (class Symbol_table): Update declarations.
13602         * layout.cc: Include "mapfile.h".
13603         (Layout_task_runner::run): Print information to mapfile.
13604         (Layout::create_gold_note): Change Output_data_fixed_space to
13605         Output_data_zero_fill.
13606         (Layout::create_build_id): Likewise.
13607         (Layout::print_to_mapfile): New function.
13608         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13609         constructor.  Change caller.
13610         (class Layout): Declare print_to_mapfile.
13611         * output.cc (Output_section::Input_section::print_to_mapfile): New
13612         function.
13613         (Output_section::add_input_section): If producing a map, always
13614         add to input_sections_ list.
13615         (Output_section::do_print_to_mapfile): New function.
13616         (Output_segment::print_sections_to_mapfile): New function.
13617         (Output_segment::print_section_list_to_mapfile): New function.
13618         * output.h: Include "mapfile.h".
13619         (Output_data::print_to_mapfile): New function.
13620         (Output_data::do_print_to_mapfile): New virtual function.
13621         (Output_segment_headers::do_print_to_mapfile): New function.
13622         (Output_file_header::do_print_to_mapfile): New function.
13623         (Output_data_const::do_print_to_mapfile): New function.
13624         (class Output_data_const_buffer): Add map_name_ field.  Update
13625         constructor.  Change all callers.  Add do_print_to_mapfile
13626         function.
13627         (class Output_data_fixed_space): Likewise.
13628         (class Output_data_space): Likewise.
13629         (class Output_data_zero_fill): New class.
13630         (Output_data_strtab::do_print_to_mapfile): New function.
13631         (Output_data_reloc_base::do_print_to_mapfile): New function.
13632         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13633         (Output_data_group::do_print_to_mapfile): New function.
13634         (Output_data_got::do_print_to_mapfile): New function.
13635         (Output_data_dynamic::do_print_to_mapfile): New function.
13636         (Output_symtab_xindex::do_print_to_mapfile): New function.
13637         (class Output_section): Declare do_print_to_mapflie.  Declare
13638         print_to_mapfile in Input_section.
13639         (class Output_segment): Declare new functions.
13640         * object.h (Sized_relobj::symbol_count): New function.
13641         * script-sections.cc
13642         (Output_section_element_dot_assignment::set_section_addresses):
13643         Change Output_data_fixed_space to Output_data_zero_fill.
13644         (Output_data_expression::do_print_to_mapfile): New function.
13645         * script.cc (read_input_script): Add mapfile parameter.  Change
13646         all callers.
13647         * script.h (read_input_script): Update declaration.
13648         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13649         (Eh_frame::do_print_to_mapfile): New function.
13650         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13651         (Output_merge_string::do_print_to_mapfile): New function.
13652         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13653         function.
13654         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13655         function.
13656         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13657         function.
13658         * Makefile.am (CCFILES): Add mapfile.cc.
13659         (HFILES): Add mapfile.h.
13660         * Makefile.in: Rebuild.
13661
13662 2008-05-19  Ian Lance Taylor  <iant@google.com>
13663
13664         * options.h (class General_options): Add -z relro.
13665         * layout.cc (Layout::Layout): Initialize relro_segment_.
13666         (Layout::add_output_section_data): Return the output section.
13667         (Layout::make_output_section): Rcognize relro sections and mark
13668         them appropriately.
13669         (Layout::attach_allocated_section_to_segment): Put relro sections
13670         in a PT_GNU_RELRO segment.
13671         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13672         section as relro.
13673         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13674         PT_TLS segments.
13675         (Layout::linkonce_mapping): Map d.rel.ro.local to
13676         .data.rel.ro.local.
13677         (Layout::output_section_name): Us .data.rel.ro.local for any
13678         section which begins with that.
13679         * layout.h (class Layout): Update add_output_section_data
13680         declaration.  Add relro_segment_ field.
13681         * output.cc (Output_section::Output_section): Initialize is_relro_
13682         and is_relro_local_ fields.
13683         (Output_segment::add_output_section): Group relro sections.
13684         (Output_segment::is_first_section_relro): New function.
13685         (Output_segment::maximum_alignment): If there is a relro section,
13686         align the segment to the common page size.
13687         (Output_segment::set_section_addresses): Track whether we are
13688         looking at relro sections.  If the last section is a relro
13689         section, align to the common page size.
13690         (Output_segment::set_section_list_addresses): Add in_relro
13691         parameter.  Change all callers.  Align to the page size when
13692         moving from relro to non-relro section.
13693         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13694         segment.
13695         * output.h (class Output_section): Add is_relro_ and
13696         is_relro_local_ fields.
13697         (Output_section::is_relro): New function.
13698         (Output_section::set_is_relro): New function.
13699         (Output_section::is_relro_local): New function.
13700         (Output_section::set_is_relro_local): New function.
13701         (class Output_segment): Update declarations.
13702         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13703         * sparc.cc (Target_sparc::got_section): Likewise.
13704         * x86_64.cc (Target_x86_64::got_section): Likewise.
13705         * testsuite/relro_test_main.cc: New file.
13706         * testsuite/relro_test.cc: New file.
13707         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13708         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13709         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13710         (relro_test.so, relro_test_pic.o): New targets.
13711         * testsuite/Makefile.in: Rebuild.
13712
13713 2008-05-16  Ian Lance Taylor  <iant@google.com>
13714
13715         * output.cc (Output_segment::add_output_section): Remove front
13716         parameter.
13717         * output.h (class Output_segment): Remove
13718         add_initial_output_section and overloaded add_output_section.
13719         Update declaration of remaining add_output_section.
13720         * layout.cc (Layout::create_interp): Call add_output_section
13721         rather than add_initial_output_section.
13722         (Layout::finish_dynamic_section): Likewise.
13723
13724         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13725         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13726         know the dynamic type.
13727         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13728         field.  Initialize it in constructor.
13729         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13730         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13731         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13732         reloc.
13733
13734         * output.cc (Output_reloc::get_address): Change return type to
13735         Elf_Addr.
13736         * output.h (class Output_reloc): Update get_address declaration.
13737         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13738         for section addresses.
13739
13740 2008-05-09  Ian Lance Taylor  <iant@google.com>
13741
13742         PR 6493
13743         * gold.cc (gold_nomem): Use return value of write.
13744
13745 2008-05-08  Ian Lance Taylor  <iant@google.com>
13746
13747         * symtab.c (Symbol::init_base_output_data): Add version
13748         parameter.  Change all callers.
13749         (Symbol::init_base_output_segment): Likewise.
13750         (Symbol::init_base_constant): Likewise.
13751         (Symbol::init_base_undefined): Likewise.
13752         (Sized_symbol::init_output_data): Likewise.
13753         (Sized_symbol::init_output_segment): Likewise.
13754         (Sized_symbol::init_constant): Likewise.
13755         (Sized_symbol::init_undefined): Likewise.
13756         (Symbol_table::do_define_in_output_data): If the new symbol has a
13757         version, mark it as the default.
13758         (Symbol_table::do_define_in_output_segment): Likewise.
13759         (Symbol_table::do_define_as_constant): Likewise.
13760         * symtab.h (class Symbol): Update declarations.
13761         (class Sized_symbol): Likewise.
13762         * resolve.cc (Symbol::override_version): New function.
13763         (Symbol::override_base): Call override_version.
13764         (Symbol::override_base_with_special): Likewise.
13765         * testsuite/ver_script_8.script: New file.
13766         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13767         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13768         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13769         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13770
13771 2008-05-06  Ian Lance Taylor  <iant@google.com>
13772
13773         PR 6049
13774         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13775         functions.
13776         (class General_options): Remove existing --undefined, and add
13777         --no-undefined instead.  Add new --undefined as synonym for -u.
13778         * archive.cc (Archive::add_symbols): Check whether symbol was
13779         named with -u.
13780         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13781         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13782         all uses.  Add IS_UNDEFINED.  Update declarations to split
13783         different versions of init_base.  Declare init_base_undefined.
13784         (Symbol::is_defined): Handle IS_UNDEFINED.
13785         (Symbol::is_undefined): Likewise.
13786         (Symbol::is_weak_undefined): Call is_undefined.
13787         (Symbol::is_absolute): Handle IS_CONSTANT.
13788         (class Sized_symbol): Update declarations to split different
13789         versions of init.  Declare init_undefined.
13790         (class Symbol_table): Declare new functions.
13791         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13792         Change all callers.
13793         (Symbol::init_base_output_data): Likewise.
13794         (Symbol::init_base_output_segment): Likewise.
13795         (Symbol::init_base_constant): Likewise.
13796         (Symbol::init_base_undefined): New function.
13797         (Sized_symbol::init_object): Rename from init.  Change all
13798         callers.
13799         (Sized_symbol::init_output_data): Likewise.
13800         (Sized_symbol::init_output_segment): Likewise.
13801         (Sized_symbol::init_constant): Likewise.
13802         (Sized_symbol::init_undefined): New function.
13803         (Symbol_table::add_undefined_symbols_from_command_line): New
13804         function.
13805         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13806         function.
13807         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13808         (Symbol::output_section): Likewise.
13809         (Symbol::set_output_section): Likewise.
13810         (Symbol_table::sized_finalize_symbol): Likewise.
13811         (Symbol_table::sized_write_globals): Likewise.
13812         * resolve.cc (Symbol_table::should_override): Likewise.
13813         (Symbol::override_base_with_special): Likewise.
13814
13815         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13816         symbol, change it to have default visibility.
13817         * testsuite/protected_1.cc: New file.
13818         * testsuite/protected_2.cc: New file.
13819         * testsuite/protected_3.cc: New file.
13820         * testsuite/protected_main_1.cc: New file.
13821         * testsuite/protected_main_2.cc: New file.
13822         * testsuite/protected_main_3.cc: New file.
13823         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13824         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13825         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13826         (protected_1.so): New target.
13827         (protected_1_pic.o, protected_2_pic.o): New targets.
13828         (protected_3_pic.o): New target.
13829         (check_PROGRAMS): Add protected_2.
13830         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13831         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13832         * testsuite/Makefile.in: Rebuild.
13833
13834         * options.h (DEFINE_var): Add set_user_set_##varname__.
13835         (DEFINE_bool_alias): New macro.
13836         (class General_options): Define -Bstatic using DEFINE_bool_alias
13837         rather than DEFINE_special.  Add --undefined as an alias for -z
13838         defs.
13839         * options.cc (General_options::parse_Bstatic): Remove.
13840
13841         * options.h (class General_options): Add --fatal-warnings.
13842         * main.cc (main): Implement --fatal-warnings.
13843         * errors.h (Errors::warning_count): New function.
13844
13845         * options.h (class General_options): Add -Bsymbolic-functions.
13846         * symtab.h (Symbol::is_preemptible): Check for
13847         -Bsymbolic-functions.
13848
13849 2008-05-05  Ian Lance Taylor  <iant@google.com>
13850
13851         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13852         as noVARNAME rather than no-VARNAME.
13853         (class General_options): Add option -z combreloc.
13854         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13855         get_address.
13856         (Output_reloc::sort_before) [SHT_REL]: New function.
13857         (Output_reloc::sort_before) [SHT_RELA]: New function.
13858         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13859         Sort_relocs_comparison.
13860         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13861         parameter.  Change all callers.
13862         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13863         sort_relocs parameter.  Change all callers.
13864         * output.cc (Output_reloc::get_address): New function, broken out
13865         of write_rel.
13866         (Output_reloc::write_rel): Call it.
13867         (Output_reloc::compare): New function.
13868         (Output_data_reloc_base::do_write): Optionally sort relocs.
13869
13870         * configure.ac: If targ_extra_obj is set, link it in.
13871         * configure.tgt: Initialize all variables.
13872         (x86_64*): Set targ_extra_obj and targ_extra_size.
13873         * configure: Rebuild.
13874
13875         * object.cc (Sized_relobj::include_section_group): Adjust section
13876         indexes read from group data.  Build vector to pass to
13877         layout_group.
13878         * layout.cc (Layout::layout_group): Add flags and shndxes
13879         parameters.  Remove contents parameter.  Change caller.  Update
13880         explicit instantiations.
13881         * layout.h (class Layout): Update layout_group declaration.
13882         * output.cc (Output_data_group::Output_data_group): Add flags and
13883         input_shndxes parameters.  Remove contents parameter.  Change
13884         caller.
13885         (Output_data_group::do_write): Change input_sections_ to
13886         input_shndxes_.
13887         * output.h (class Output_data_group): Update constructor
13888         declaration.  Rename input_sections_ to input_shndxes_.
13889         * testsuite/many_sections_test.cc: Add template.
13890
13891 2008-04-30  Cary Coutant  <ccoutant@google.com>
13892
13893         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13894
13895         * layout.cc (Layout::include_section): Refactored check for debug
13896         info section.
13897         (Layout::add_comdat): Add new parameters.  Change type
13898         of signature parameter.  Add object and shndx to signatures table.
13899         (Layout::find_kept_object): New function.
13900         * layout.h: Include <cstring>.
13901         (Layout::is_debug_info_section): New function.
13902         (Layout::add_comdat): Add new parameters.
13903         (Layout::find_kept_object): New function.
13904         (Layout::Kept_section): New struct.
13905         (Layout::Signatures): Change type of map range.
13906         * object.cc (Relobj::output_section_address): New function.
13907         (Sized_relobj::include_section_group): Add new parameters.  Change
13908         calls to Layout::add_comdat.  Change to build table of kept comdat
13909         groups and table mapping discarded sections to kept sections.
13910         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13911         (Sized_relobj::do_layout): Change calls to include_section_group and
13912         include_linkonce_section.
13913         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13914         value to zero when section is discarded.
13915         (Sized_relobj::map_to_kept_section): New function.
13916         * object.h (Relobj::output_section_address): New function.
13917         (Relobj::Comdat_group): New type.
13918         (Relobj::find_comdat_group): New function.
13919         (Relobj::Comdat_group_table): New type.
13920         (Relobj::Kept_comdat_section): New type.
13921         (Relobj::Kept_comdat_section_table): New type.
13922         (Relobj::add_comdat_group): New function.
13923         (Relobj::set_kept_comdat_section): New function.
13924         (Relobj::get_kept_comdat_section): New function.
13925         (Relobj::comdat_groups_): New field.
13926         (Relobj::kept_comdat_sections_): New field.
13927         (Symbol_value::input_value): Update comment.
13928         (Sized_relobj::map_to_kept_section) New function.
13929         (Sized_relobj::include_linkonce_section): Add new parameter.
13930         * target-reloc.h (Comdat_behavior): New type.
13931         (get_comdat_behavior): New function.
13932         (relocate_section): Add code to map a discarded section to the
13933         corresponding kept section when applying a relocation.
13934
13935 2008-04-30  Craig Silverstein  <csilvers@google.com>
13936
13937         * dwarf_reader.cc (next_generation_count): New static var.
13938         (Addr2line_cache_entry): New struct.
13939         (addr2line_cache): New static var.
13940         (Dwarf_line_info::one_addr2line): Added caching.
13941         (Dwarf_line_info::clear_addr2line_cache): New function.
13942         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13943         cache-size parameter.
13944         (Dwarf_line_info::one_addr2line_cache): New function.
13945         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13946         new cache-size argument to one_addr2line(), and clear cache.
13947
13948 2008-04-28  Cary Coutant  <ccoutant@google.com>
13949
13950         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13951         R_386_PC8 relocations.
13952
13953 2008-04-23  Ian Lance Taylor  <iant@google.com>
13954
13955         * object.cc (Sized_relobj::include_section_group): Check for
13956         invalid section group.
13957
13958         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13959         header size.
13960
13961         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13962         than read for file header.
13963         * archive.cc (Archive::include_member): Likewise.
13964
13965 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13966
13967         * aclocal.m4: Regenerate.
13968         * configure: Regenerate.
13969
13970 2008-04-19  Ian Lance Taylor  <iant@google.com>
13971
13972         * version.cc (version_string): Bump to 1.6.
13973
13974         * testsuite/Makefile.am (many_sections_r_test): New target.
13975         (many_sections_r_test_SOURCES): Remove.
13976         (many_sections_r_test_DEPENDENCIES): Remove.
13977         (many_sections_r_test_LDFLAGS): Remove.
13978         (many_sections_r_test_LDADD): Remove.
13979
13980         * object.cc (Sized_relobj::do_add_symbols): Always pass
13981         local_symbol_count_ to add_from_relobj.
13982
13983         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13984         every thousand variables.
13985         * testsuite/Makefile.in: Rebuild.
13986
13987         * object.cc (Xindex::initialize_symtab_xindex): New function.
13988         (Xindex::read_symtab_xindex): New function.
13989         (Xindex::sym_xindex_to_shndx): New function.
13990         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13991         available.
13992         (Sized_relobj::do_initialize_xindex): New function.
13993         (Sized_relobj::do_read_symbols): Adjust section links.
13994         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13995         parameter.  Change all callers.
13996         (Sized_relobj::include_section_group): Adjust section links and
13997         symbol section indexes.
13998         (Sized_relobj::do_layout): Adjust section links.
13999         (Sized_relobj::do_count_local_symbols): Adjust section links and
14000         symbol section indexes.
14001         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14002         ordinary and special symbols.
14003         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14004         dynsym_xindex parameters.  Change all callers.  Adjust section
14005         links.  Use SHN_XINDEX when needed.
14006         (Sized_relobj::get_symbol_location_info): Adjust section links.
14007         Don't get fooled by special symbols.
14008         * object.h (class Xindex): Define.
14009         (class Object): Add xindex_ parameter.  Declare virtual functoin
14010         do_initialize_xindex.
14011         (Object::adjust_sym_shndx): New function.
14012         (Object::set_xindex): New protected function.
14013         (class Symbol_value): Add is_ordinary_shndx_ field.
14014         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14015         (Symbol_value::value): Assert ordinary section.
14016         (Symbol_value::initialize_input_to_output_map): Likewise.
14017         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14018         Change all callers.
14019         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14020         all callers.
14021         (class Sized_relobj): Update declarations.
14022         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14023         parameter.  Change all callers.
14024         (Sized_relobj::adjust_shndx): New function.
14025         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14026         field.
14027         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14028         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14029         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14030         (Sized_dynobj::read_dynsym_section): Adjust section links.
14031         (Sized_dynobj::read_dynamic): Likewise.
14032         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14033         section links.
14034         (Sized_dynobj::do_initialize_xindex): New function.
14035         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14036         do_initialize_xindex.
14037         (Sized_dynobj::adjust_shndx): New function.
14038         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14039         dynsym_xindex_ fields.
14040         (Layout::finalize): Add a call to set_section_indexes before
14041         creating the symtab sections.
14042         (Layout::set_section_indexes): Don't do anything if the section
14043         already has a section index.
14044         (Layout::create_symtab_sections): Add shnum parameter.  Change
14045         caller.  Create .symtab_shndx section if needed.
14046         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14047         caller.
14048         (Layout::allocated_output_section_count): New function.
14049         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14050         needed.
14051         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14052         fields.  Update declarations.
14053         (Layout::symtab_xindex): New function.
14054         (Layout::dynsym_xindex): New function.
14055         (class Write_symbols_task): Add layout_ field.
14056         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14057         Change caller.
14058         * output.cc (Output_section_headers::Output_section_headers): Add
14059         shstrtab_section parameter.  Change all callers.
14060         (Output_section_headers::do_sized_write): Store overflow values
14061         for section count and section string table section index in
14062         section header zero.
14063         (Output_file_header::do_sized_write): Check for overflow of
14064         section count and section string table section index.
14065         (Output_symtab_xindex::do_write): New function.
14066         (Output_symtab_xindex::endian_do_write): New function.
14067         * output.h (class Output_section_headers): Add shstrtab_section_.
14068         Update declarations.
14069         (class Output_symtab_xindex): Define.
14070         (Output_section::has_out_shndx): New function.
14071         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14072         field.
14073         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14074         Change all callers.
14075         (Sized_symbol::init): Likewise.
14076         (Symbol::output_section): Check for ordinary symbol.
14077         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14078         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14079         callers.
14080         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14081         Change all callers.  Simplify handling of symbols from sections
14082         not included in the link.
14083         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14084         distinction.
14085         (Weak_alias_sorter::operator()): Assert that symbols are
14086         ordinary.
14087         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14088         distinction.
14089         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14090         parameters.  Change all callers.
14091         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14092         symbol distinction.  Use SHN_XINDEX when needed.
14093         (Symbol_table::write_section_symbol): Add symtab_xindex
14094         parameter.  Change all callers.
14095         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14096         SHN_XINDEX when needed.
14097         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14098         declarations.
14099         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14100         (Symbol::is_defined): Check is_ordinary.
14101         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14102         (Symbol::is_absolute, Symbol::is_common): Likewise.
14103         (class Sized_symbol): Update declarations.
14104         (class Symbol_table): Update declarations.
14105         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14106         parameters.  Change all callers.
14107         (Sized_symbol::override): Likewise.
14108         (Symbol_table::override): Likewise.
14109         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14110         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14111         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14112         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14113         to be in an ordinary section.
14114         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14115         object and is_ordinary parameters.  Change all callers.
14116         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14117         Change all callers.  Don't add undefined or non-ordinary symbols
14118         to reloc_map_.
14119         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14120         Change all callers.
14121         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14122         declarations.
14123         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14124         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14125         (Sized_relobj::relocate_sections): Likewise.
14126         * target-reloc.h (scan_relocs): Adjust section symbol index.
14127         (scan_relocatable_relocs): Likewise.
14128         * i386.cc (Scan::local): Check for ordinary symbols.
14129         * sparc.cc (Scan::local): Likewise.
14130         * x86_64.cc (Scan::local): Likewise.
14131         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14132         to symbol_section_and_value.
14133         * testsuite/many_sections_test.cc: New file.
14134         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14135         (check_PROGRAMS): Add many_sections_test.
14136         (many_sections_test_SOURCES): Define.
14137         (many_sections_test_DEPENDENCIES): Define.
14138         (many_sections_test_LDFLAGS): Define.
14139         (BUILT_SOURCES): Add many_sections_define.h.
14140         (many_sections_define.h): New target.
14141         (BUILT_SOURCES): Add many_sections_check.h.
14142         (many_sections_check.h): New target.
14143         (check_PROGRAMS): Add many_sections_r_test.
14144         (many_sections_r_test_SOURCES): Define.
14145         (many_sections_r_test_DEPENDENCIES): Define.
14146         (many_sections_r_test_LDFLAGS): Define.
14147         (many_sections_r_test_LDADD): Define.
14148         (many_sections_r_test.o): New target.
14149         * testsuite/Makefile.in: Rebuild.
14150
14151 2008-04-17  Cary Coutant  <ccoutant@google.com>
14152
14153         * errors.cc (Errors::info): New function.
14154         (gold_info): New function.
14155         * errors.h (Errors::info): New function.
14156         * gold.h (gold_info): New function.
14157         * object.cc (Input_objects::add_object): Print trace output.
14158         * options.cc (options::parse_set): New function.
14159         (General_options::parse_wrap): Deleted.
14160         (General_options::General_options): Deleted initializer.
14161         * options.h (options::String_set): New typedef.
14162         (options::parse_set): New function.
14163         (DEFINE_set): New macro.
14164         (General_options::wrap): Changed to use DEFINE_set. Changed
14165         callers of any_wrap_symbols and is_wrap_symbol.
14166         (General_options::trace, General_options::trace_symbol):
14167         New options.
14168         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14169         (General_options::wrap_symbols_): Deleted.
14170         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14171
14172 2008-04-17  David S. Miller  <davem@davemloft.net>
14173
14174         * options.cc (General_options::parse_V): New function.
14175         * options.h: Add entries for -V and -Qy.
14176
14177 2008-04-17  Ian Lance Taylor  <iant@google.com>
14178
14179         * common.cc (Symbol_table::allocate_commons): Remove options
14180         parameter.  Change caller.
14181         (Symbol_table::do_allocate_commons): Remove options parameter.
14182         Change caller.  Just call do_allocate_commons_list twice.
14183         (Symbol_table::do_allocate_commons_list): New function, broken out
14184         of do_allocate_commons.
14185         * common.h (class Allocate_commons_task): Remove options_ field.
14186         Update constructor.
14187         * symtab.cc (Symbol_table::Symbol_table): Initialize
14188         tls_commons_.
14189         (Symbol_table::add_from_object): Put TLS common symbols on
14190         tls_commons_ list.
14191         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14192         which are IN_OUTPUT_DATA.
14193         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14194         allocate_commons and do_allocate_commons declarations.  Declare
14195         do_allocate_commons_list.
14196         * gold.cc (queue_middle_tasks): Update creation of
14197         Allocate_commons_task to not pass options.
14198         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14199         (TLS_TEST_C_FLAGS): New variable.
14200         (tls_test_c_pic.o): New target.
14201         (tls_test_shared.so): Link in tls_test_c_pic.o.
14202         (tls_test_c_pic_ie.o): New target.
14203         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14204         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14205         (tls_test_c.o): New target.
14206         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14207         (tls_pic_test_LDADD): Likewise.
14208         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14209         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14210         (tls_test_c_gnu2.o): New target.
14211         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14212         tls_test_c_gnu2.o.
14213         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14214         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14215         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14216         * testsuite/tls_test.cc: Include "config.h".
14217         (t_last): Call t11_last.
14218         * testsuite/tls_test.h (t11, t11_last): Declare.
14219         * testsuite/tls_test_c.c: New file.
14220         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14221         * configure.ac: Check for OpenMP support.
14222         * configure, config.in, Makefile.in: Rebuild.
14223         * testsuite/Makefile.in: Rebuild.
14224
14225 2008-04-16  Cary Coutant  <ccoutant@google.com>
14226
14227         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14228         (Target_i386::tls_base_symbol_defined_): New field.
14229         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14230         (Target_i386::Scan::global): Likewise.
14231         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14232         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14233         (Target_x86_64::tls_base_symbol_defined_): New field.
14234         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14235         (Target_x86_64::Scan::global): Likewise.
14236
14237 2008-04-16  Cary Coutant  <ccoutant@google.com>
14238
14239         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14240         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14241         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14242         building shared libraries.
14243         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14244         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14245         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14246         * testsuite/Makefile.in: Rebuild.
14247         * testsuite/weak_undef.h: New file.
14248         * testsuite/weak_undef_file1.cc: Add extra test cases.
14249         * testsuite/weak_undef_file2.cc: Likewise.
14250         * testsuite/weak_undef_test.cc: Likewise.
14251
14252 2008-04-16  David S. Miller  <davem@davemloft.net>
14253
14254         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14255         Add issued_non_pic_error_ field.  Declare check_non_pic.
14256         (Target_sparc::Scan::check_non_pic): New function.
14257         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14258         (Target_sparc::Scan::global): Likewise.
14259
14260         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14261         * configure: Rebuild.
14262
14263         * options.h (DEFINE_enable): New macro.
14264         (new_dtags): New enable option.
14265         (initfirst, interpose, loadfltr, nodefaultlib,
14266         nodelete, nodlopen, nodump): New -z options.
14267         * layout.cc (Layout:finish_dynamic_section): If new
14268         dtags enabled, emit DT_RUNPATH.  Also, emit a
14269         DT_FLAGS_1 containing any specified -z flags.
14270
14271 2008-04-16  Ian Lance Taylor  <iant@google.com>
14272
14273         * copy-relocs.cc: New file.
14274         * copy-relocs.h: New file.
14275         * reloc.cc: Remove Copy_relocs code.
14276         * reloc.h: Likewise.
14277         * reloc-types.h (struct Reloc_types) [both versions]: Add
14278         get_reloc_addend_noerror.
14279         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14280         variants of add_global which take an addend which must be zero.
14281         * i386.cc: Include "copy-relocs.h".
14282         (class Target_i386): Change type of copy_relocs_ to variable,
14283         update initializer.
14284         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14285         Change all callers.
14286         (Target_i386::do_finalize_sections): Change handling of
14287         copy_relocs_.
14288         * sparc.cc: Include "copy-relocs.h".
14289         (class Target_sparc): Change type of copy_relocs_ to variable,
14290         update initializer.
14291         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14292         Change all callers.
14293         (Target_sparc::do_finalize_sections): Change handling of
14294         copy_relocs_.
14295         * x86_64.cc: Include "copy-relocs.h".
14296         (class Target_x86_64): Change type of copy_relocs_ to variable,
14297         update initializer.
14298         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14299         class.  Change all callers.
14300         (Target_x86_64::do_finalize_sections): Change handling of
14301         copy_relocs_.
14302         * Makefile.am (CCFILES): Add copy-relocs.cc.
14303         (HFILES): Add copy-relocs.h.
14304
14305         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14306
14307         * testsuite/script_test_4.sh: Permit leading zeroes.
14308
14309 2008-04-15  Ian Lance Taylor  <iant@google.com>
14310
14311         * script-sections.cc (Script_sections::create_segments): Use
14312         header_size_adjustment even when there is enough room for the
14313         headers.
14314         * testsuite/script_test_4.sh: New file.
14315         * testsuite/script_test_4.t: New file.
14316         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14317         (check_DATA): Add script_test_4.stdout.
14318         (MOSTLYCLEANFILES): Likewise.
14319         (script_test_4): New target.
14320         (script_test_4.stdout): New target.
14321         * testsuite/Makefile.in: Rebuild.
14322
14323         * sparc.cc: Add definitions for Output_data_plt_sparc class
14324         constants.
14325
14326 2008-04-14  David S. Miller  <davem@davemloft.net>
14327
14328         * sparc.cc: New file.
14329         * Makefile.am (TARGETSOURCES): Add sparc.cc
14330         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14331         * configure.tgt: Document targ_extra_size and
14332         targ_extra_big_endian.  Add entries for sparc-* and
14333         sparc64-*.
14334         * configure.ac: Handle targ_extra_size and
14335         targ_extra_big_endian.
14336         * Makefile.in: Rebuild.
14337         * configure: Likewise.
14338         * po/POTFILES.in: Likewise.
14339         * po/gold.pot: Likewise.
14340
14341 2008-04-14  Ian Lance Taylor  <iant@google.com>
14342
14343         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14344         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14345         in the name/type/flags to section mapping.  Don't call
14346         allocate_output_section.
14347         (Layout::choose_output_section): Change parameter from adjust_name
14348         to is_input_section.  Don't permit input sections after sections
14349         are attached to segments.  Don't call allocate_output_section.
14350         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14351         not write_enable_output_section.
14352         (Layout::make_output_section): Don't push to
14353         unattached_section_list_ nor call attach_to_segment.  Call
14354         attach_section_to_segment if sections are attached.
14355         (Layout::attach_sections_to_segments): New function.
14356         (Layout::attach_section_to_segment): New function.
14357         (Layout::attach_allocated_section_to_segment): Rename from
14358         attach_to_segment.  Remove flags parameter.
14359         (Layout::allocate_output_section): Remove function.
14360         (Layout::write_enable_output_section): Remove function.
14361         * layout.h (class Layout): Update for above changes.  Add new
14362         field sections_are_attached_.
14363         * output.h (Output_section::update_flags_for_input_section): New
14364         function.
14365         * output.cc (Output_section::add_input_section): Call
14366         update_flags_for_input_section.
14367         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14368
14369 2008-04-11  Cary Coutant  <ccoutant@google.com>
14370
14371         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14372         thought unnecessary.
14373         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14374
14375 2008-04-11  Ian Lance Taylor  <iant@google.com>
14376
14377         * output.h (class Output_section_data): Remove inline definition
14378         of set_addralign.
14379         * output.cc (Output_section_data::set_addralign): New function.
14380
14381 2008-04-11  Cary Coutant  <ccoutant@google.com>
14382
14383         Add support for TLS descriptors for i386 and x86_64.
14384         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14385         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14386         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14387         GOT_TYPE_TLS_DESC.
14388         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14389         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14390         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14391         relocations.
14392         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14393         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14394         Fix problem with initial-exec relocations.
14395         (Target_i386::Relocate::relocate_tls): Likewise.
14396         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14397         relaxation.
14398         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14399         support for section-plus-offset dynamic table entries.
14400         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14401         (Output_data_dynamic::Dynamic_entry): Add support for
14402         section-plus-offset dynamic table entries.
14403         (Output_data_dynamic::Classification): Likewise.
14404         (Output_data_dynamic::classification_): Renamed offset_.
14405         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14406         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14407         (Target_x86_64::make_plt_section): New function.
14408         (Target_x86_64::reserve_tlsdesc_entries): New function.
14409         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14410         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14411         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14412         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14413         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14414         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14415         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14416         add extra PLT entry for TLS descriptors.
14417         (Output_data_plt_x86_64::got_): New field.
14418         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14419         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14420         fields.
14421         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14422         descriptors.
14423         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14424         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14425         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14426         R_386_TLS_DESC_CALL relocations.
14427         (Target_x86_64::Scan::global): Likewise.
14428         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14429         for TLS descriptors.
14430         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14431         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14432         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14433         GD-to-IE relaxation.
14434         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14435         and TLS_DESCRIPTORS.
14436         * Makefile.in: Rebuild.
14437         * configure: Rebuild.
14438         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14439         (tls_test_shared2.so): New target.
14440         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14441         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14442         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14443         (tls_shared_gd_to_ie_test_LDADD): New variable.
14444         (tls_shared_gnu2_gd_to_ie_test): New target.
14445         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14446         New targets.
14447         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14448         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14449         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14450         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14451         (tls_shared_gnu2_test): New target.
14452         (tls_test_gnu2_shared.so): New target.
14453         (tls_shared_gnu2_test_SOURCES): New variable.
14454         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14455         (tls_shared_gnu2_test_LDFLAGS): New variable.
14456         (tls_shared_gnu2_test_LDADD): New variable.
14457         * testsuite/Makefile.in: Rebuild.
14458         * testsuite/Makefile.
14459
14460 2008-04-11  Ian Lance Taylor  <iant@google.com>
14461
14462         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14463         justsyms.t.
14464         * testsuite/Makefile.in: Rebuild.
14465
14466         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14467         long.
14468         * testsuite/script_test_2.cc (main): Adjust test.
14469
14470 2008-04-11  David S. Miller  <davem@davemloft.net>
14471             Ian Lance Taylor  <iant@google.com>
14472
14473         * options.h (General_options): Add entries for '-Y' and
14474         '-relax'.
14475         * options.cc (General_options:finalize): If -Y was used, add those
14476         entries to the library path instead of the default "/lib" and
14477         "/usr/lib".
14478
14479 2008-04-11  David S. Miller  <davem@davemloft.net>
14480
14481         * testsuite/justsyms.t: Start at 0x100.
14482         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14483         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14484         long.
14485         * testsuite/script_test_2.cc: Adjust string and section length
14486         checks.
14487
14488 2008-04-09  Ian Lance Taylor  <iant@google.com>
14489
14490         PR gold/5996
14491         * script-sections.cc (Sections_element::allocate_to_segment): Add
14492         orphan parameter.
14493         (Output_section_definition::allocate_to_segment): Likewise.
14494         (Orphan_output_section::allocate_to_segment): Likewise.
14495         (Script_sections::attach_sections_using_phdrs_clause): Don't
14496         propagate non-PT_LOAD segments to orphan sections.
14497         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14498         readelf rather than objdump.
14499         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14500         .interp section and PT_INTERP segment are the same size.
14501         * testsuite/Makefile.in: Rebuild.
14502
14503         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14504         aliases for symbols defined in the same object.
14505         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14506         (weak_alias_test_SOURCES): New variable.
14507         (weak_alias_test_DEPENDENCIES): New variable.
14508         (weak_alias_test_LDFLAGS): New variable.
14509         (weak_alias_test_LDADD): New variable.
14510         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14511         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14512         (weak_alias_test_3.o): New target.
14513         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14514         * testsuite/weak_alias_test_main.cc: New file.
14515         * testsuite/weak_alias_test_1.cc: New file.
14516         * testsuite/weak_alias_test_2.cc: New file.
14517         * testsuite/weak_alias_test_3.cc: New file.
14518
14519 2008-04-08  Ian Lance Taylor  <iant@google.com>
14520
14521         * options.h (class General_options): Add --noinhibit-exec option.
14522         * main.cc (main): Check --noinhibit-exec.
14523
14524         * options.h (class General_options): Define --wrap as a special
14525         option.  Add wrap_symbols_ field.
14526         (General_options::any_wrap_symbols): New function.
14527         (General_options::is_wrap_symbol): New function.
14528         * options.cc (General_options::parse_wrap): New function.
14529         (General_options::General_options): Initialize wrap_symbols_.
14530         * symtab.cc (Symbol_table::wrap_symbol): New function.
14531         (Symbol_table::add_from_object): Handle --wrap.
14532         * symtab.h (class Symbol_table): Declare wrap_symbol.
14533         * target.h (Target::wrap_char): New function.
14534         (Target::Target_info): Add wrap_char field.
14535         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14536         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14537         * testsuite/testfile.cc (Target_test::test_target_info):
14538         Likewise.
14539
14540         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14541         there is one.
14542
14543         * layout.h (class Layout): Add added_eh_frame_data_ field.
14544         * layout.cc (Layout::Layout): Initialize new field.
14545         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14546         output section until we find a section we merged successfully.
14547         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14548         that the size be non-zero.
14549
14550         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14551         qualifier.
14552
14553 2008-04-08  Craig Silverstein  <csilvers@google.com>
14554
14555         * configure.ac: Export new conditional variable HAVE_ZLIB.
14556         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14557         on HAVE_ZLIB.
14558         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14559         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14560
14561 2008-04-07  Ian Lance Taylor  <iant@google.com>
14562
14563         * version.cc (version_string): Set to "1.5".
14564
14565         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14566         Add issued_non_pic_error_ field.  Declare check_non_pic.
14567         (Target_x86_64::Scan::check_non_pic): New function.
14568         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14569         (Target_x86_64::Scan::global): Likewise.
14570
14571         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14572         addend parameter.  Change caller.  Handle merge sections.
14573         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14574         Address to Addend.  Don't add in the result of
14575         local_section_offset, pass down the addend and use the returned
14576         value.
14577         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14578         Update declarations of local_section_offset and symbol_value.
14579         * testsuite/two_file_test_1.cc (t18): New function.
14580         * testsuite/two_file_test_2.cc (f18): New function.
14581         * testsuite/two_file_test_main.cc (main): Call t18.
14582         * testsuite/two_file_test.h (t18, f18): Declare.
14583
14584         * configure.ac: Don't test for objdump, c++filt, or readelf.
14585         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14586         conditionals.
14587         (TEST_READELF): New variable.
14588         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14589         (check_PROGRAMS): Add two_file_strip_test.
14590         (two_file_strip_test): New target.
14591         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14592         (two_file_same_shared_strip_test_SOURCES): New variable.
14593         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14594         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14595         (two_file_same_shared_strip_test_LDADD): New variable.
14596         (two_file_shared_strip.so): New target.
14597         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14598         (ver_test_5.syms, ver_test_7.syms): Likewise.
14599         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14600         (strip_test_3.stdout): Use TEST_OBJDUMP.
14601         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14602
14603 2008-04-04  Cary Coutant  <ccoutant@google.com>
14604
14605         * symtab.h (Symbol::is_weak_undefined): New function.
14606         (Symbol::is_strong_undefined): New function.
14607         (Symbol::is_absolute): New function.
14608         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14609         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14610         absolute symbols.
14611         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14612         (weak_undef_test): New target.
14613         * testsuite/Makefile.in: Rebuild.
14614         * testsuite/weak_undef_file1.cc: New file.
14615         * testsuite/weak_undef_file2.cc: New file.
14616         * testsuite/weak_undef_test.cc: New file.
14617
14618 2008-04-03  Craig Silverstein  <csilvers@google.com>
14619
14620         * compressed_output.h (class Output_compressed_section): Use
14621         unsigned buffer.
14622         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14623         add zlib header.
14624         (zlib_compressed_suffix): Removed.
14625         (Output_compressed_section::set_final_data_size): Use unsigned
14626         buffers.
14627         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14628         Fix linker invocation.
14629         (flagstest_o_specialfile_and_compress_debug_sections):
14630         Likewise.
14631         * testsuite/Makefile.in: Regenerated.
14632
14633 2008-04-02  David S. Miller  <davem@davemloft.net>
14634
14635         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14636         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14637
14638 2008-04-02  Craig Silverstein  <csilvers@google.com>
14639
14640         * TODO: New file.
14641
14642 2008-04-02  Ian Lance Taylor  <iant@google.com>
14643
14644         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14645         parameters.  Update for new key type to views_.  Change all
14646         callers.
14647         (File_read::read): Adjust for byteshift in returned view.
14648         (File_read::add_view): New function, broken out of
14649         find_and_make_view.
14650         (File_read::make_view): New function, broken out of
14651         find_and_make_view.
14652         (File_read::find_or_make_view): Add offset and aligned
14653         parameters.  Rewrite accordingly.  Change all callers.
14654         (File_read::get_view): Add offset and aligned parameters.  Adjust
14655         for byteshift in return value.
14656         (File_read::get_lasting_view): Likewise.
14657         * fileread.h (class File_read): Update declarations.
14658         (class File_read::View): Add byteshift_ field.  Add byteshift to
14659         constructor.  Add byteshift method.
14660         * archive.h (Archive::clear_uncached_views): New function.
14661         (Archive::get_view): Add aligned parameter.  Change all callers.
14662         * object.h (Object::get_view): Add aligned parameter.  Change all
14663         callers.
14664         (Object::get_lasting_view): Likewise.
14665
14666         * fileread.cc (File_read::release): Don't call clear_views if
14667         there are multiple objects.
14668         * fileread.h (File_read::clear_uncached_views): New function.
14669         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14670         on the archive.
14671
14672 2008-03-31  Cary Coutant  <ccoutant@google.com>
14673
14674         Add thin archive support.
14675         * archive.cc (Archive::armagt): New const.
14676         (Archive::setup): Remove task parameter and calls to unlock.
14677         (Archive::unlock_nested_archives): New function.
14678         (Archive::read_header): Add nested_off parameter. Change
14679         all callers.
14680         (Archive::interpret_header): Likewise.
14681         (Archive::include_all_members): Change to handle thin
14682         archives.
14683         (Archive::include_member): Likewise.
14684         * archive.h (Archive::Archive): Add new parameters and
14685         initializers.
14686         (Archive::armagt): New const.
14687         (Archive::setup): Remove task parameter.
14688         (Archive::unlock_nested_archives): New function.
14689         (Archive::read_header): Add nested_off parameter.
14690         (Archive::interpret_header): Likewise.
14691         (Archive::Nested_archive_table): New typedef.
14692         (Archive::is_thin_archive_): New field.
14693         (Archive::nested_archives_): New field.
14694         (Archive::options_): New field.
14695         (Archive::dirpath_): New field.
14696         (Archive::task_): New field.
14697         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14698         for thin archives.  Pass additional parameters to
14699         Archive::Archive.  Unlock the archive file after calling
14700         Archive::setup.
14701
14702 2008-03-29  Ian Lance Taylor  <iant@google.com>
14703
14704         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14705         version symbol to be local.
14706         * testsuite/ver_test_4.sh: New file.
14707         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14708         (check_DATA): Add ver_test_4.syms.
14709         (ver_test_4.syms): New target.
14710         * testsuite/Makefile.in: Rebuild.
14711
14712         * output.cc
14713         (Output_section::Input_section_sort_entry::has_priority): New
14714         function.
14715         (Output_section::Input_section_sort_entry::match_file_name): New
14716         function.
14717         (Output_section::Input_section_sort_entry::match_section_name):
14718         Remove.
14719         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14720         Remove.
14721         (Output_section::Input_section_sort_entry::match_section_file):
14722         Remove.
14723         (Output_section::Input_section_sort_compare::operator()): Rewrite
14724         using new Input_section_sort_entry functions.  Sort crtbegin and
14725         crtend first.  Sort sections with no priority before sections with
14726         a priority.
14727         * testsuite/initpri1.c (d3): Check j != 4.
14728         (cd5): New constructor/destructor function.
14729         (main): Check j != 2.
14730
14731         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14732         new symbol when resolving, don't call set_is_default.
14733         * testsuite/ver_test_7.cc: New file.
14734         * testsuite/ver_test_7.sh: New file.
14735         * testsuite/Makefile.am (ver_test_7.so): New target.
14736         (ver_test_7.o): New target.
14737         (check_SCRIPTS): Add ver_test_7.sh.
14738         (check_DATA): Add ver_test_7.syms.
14739         (ver_test_7.syms): New target.
14740
14741 2008-03-28  Ian Lance Taylor  <iant@google.com>
14742
14743         * layout.cc (Layout::layout): If we see an input section with a
14744         name that needs sorting, set the must_sort flag for the output
14745         section.
14746         (Layout::make_output_section): If the name of the output section
14747         indicates that it might require sorting, set the may_sort flag.
14748         * output.h (Output_section::may_sort_attached_input_sections): New
14749         function.
14750         (Output_section::set_may_sort_attached_input_sections): New
14751         function.
14752         (Output_section::must_sort_attached_input_sections): New
14753         function.
14754         (Output_section::set_must_sort_attached_input_sections): New
14755         function.
14756         (class Output_section): Declare Input_section_sort_entry.  Define
14757         Input_section_sort_compare.  Declare
14758         sort_attached_input_sections.  Add new fields:
14759         may_sort_attached_input_sections_,
14760         must_sort_attached_input_sections_,
14761         attached_input_sections_are_sorted_.
14762         * output.cc (Output_section::Output_section): Initialize new
14763         fields.
14764         (Output_section::add_input_section): Add an entry to
14765         input_sections_ if may_sort or must_sort are true.
14766         (Output_section::set_final_data_size): Call
14767         sort_attached_input_sections if necessary.
14768         (Output_section::Input_section_sort_entry): Define new class.
14769         (Output_section::Input_section_sort_compare::operator()): New
14770         function.
14771         (Output_section::sort_attached_input_sections): New function.
14772         * configure.ac: Check whether the compiler supports constructor
14773         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14774         * testsuite/initpri1.c: New file.
14775         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14776         CONSTRUCTOR_PRIORITY.
14777         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14778         (initpri1_LDFLAGS): New variable.
14779         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14780
14781 2008-03-27  Ian Lance Taylor  <iant@google.com>
14782
14783         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14784         * testsuite/common_test_1.c: New file.
14785         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14786         (common_test_1_SOURCES): New variable.
14787         (common_test_1_DEPENDENCIES): New variable.
14788         (common_test_1_LDFLAGS): New variable.
14789
14790         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14791         and commons_ correctly when NAME/VERSION does not override
14792         NAME/NULL.
14793         * testsuite/ver_test_6.c: New file.
14794         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14795         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14796         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14797
14798 2008-03-26  Ian Lance Taylor  <iant@google.com>
14799
14800         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14801         of an undefined symbol from a version script.
14802         * testsuite/Makefile.am (ver_test_5.so): New target.
14803         (ver_test_5.o): New target.
14804         (check_SCRIPTS): Add ver_test_5.sh.
14805         (check_DATA): Add ver_test_5.syms.
14806         (ver_test_5.syms): New target.
14807         * testsuite/ver_test_5.cc: New file.
14808         * testsuite/ver_test_5.script: New file.
14809         * testsuite/ver_test_5.sh: New file.
14810         * Makefile.in, testsuite/Makefile.in: Rebuild.
14811
14812         PR gold/5986
14813         Fix problems building gold with gcc 4.3.0.
14814         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14815         (gold_error_at_location, gold_warning_at_location): Use it.
14816         * configure.ac: Check whether we can compile and use a template
14817         function with a printf attribute.
14818         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14819         when jumping over bytes.
14820         * object.cc: Instantiate Object::read_section_data.
14821         * debug.h: Include <cstring>
14822         * dwarf_reader.cc: Include <algorithm>
14823         * main.cc: Include <cstring>.
14824         * options.cc: Include <cstring>.
14825         * output.cc: Include <cstring>.
14826         * script.cc: Include <cstring>.
14827         * script.h: Include <string>.
14828         * symtab.cc: Include <cstring> and <algorithm>.
14829         * target-select.cc: Include <cstring>.
14830         * version.cc: Include <string>.
14831         * testsuite/testmain.cc: Include <cstdlib>.
14832         * configure, config.in: Rebuild.
14833
14834 2008-03-25  Ian Lance Taylor  <iant@google.com>
14835
14836         * options.cc: Include "../bfd/bfdver.h".
14837         (options::help): Print bug reporting address.
14838
14839         * version.cc (print_version): Adjust output for current value of
14840         BFD_VERSION_STRING.
14841
14842         * NEWS: New file.
14843
14844         * options.cc (options::help): Print list of supported targets.
14845         * target-select.h: Include <vector>.
14846         (class Target_selector): Make machine_, size_, and is_big_endian_
14847         fields const.  Add bfd_name_ and instantiated_target_ fields.
14848         (Target_selector::Target_selector): Add bfd_name parameter.
14849         (Target_selector::recognize): Make non-virtual, call
14850         do_recognize.
14851         (Target_selector::recognize_by_name): Make non-virtual, call
14852         do_recognize_by_name.
14853         (Target_selector::supported_names): New function.
14854         (Target_selector::bfd_name): New function.
14855         (Target_selector::do_instantiate_target): New pure virtual
14856         function.
14857         (Target_selector::do_recognize): New virtual function.
14858         (Target_selector::do_recognize_by_name): New virtual function.
14859         (Target_selector::instantiate_target): New private function.
14860         (supported_target_names): Declare.
14861         * target-select.cc (Target_selector::Target_selector): Update for
14862         new parameter and fields.
14863         (select_target_by_name): Check that the name matches before
14864         calling recognize_by_name.
14865         (supported_target_names): New function.
14866         * i386.cc (class Target_selector_i386): Update Target_selector
14867         constructor call.  Remove recognize and recognize_by_name.  Add
14868         do_instantiate_target.
14869         * x86_64.cc (class Target_selector_x86_64): Likewise.
14870         * testsuite/testfile.cc (class Target_selector_test): Update for
14871         changes to Target_selector.
14872
14873         * README: Rewrite, with some notes on unsupported features.
14874
14875 2008-03-24  Cary Coutant  <ccoutant@google.com>
14876
14877         * i386.cc (Target_i386::Got_type): New enum declaration.
14878         (Target_i386::Scan::local): Updated callers of Output_data_got
14879         member functions.
14880         (Target_i386::Scan::global): Likewise.
14881         (Target_i386::Relocate::relocate): Likewise.
14882         (Target_i386::Relocate::relocate_tls): Likewise.
14883         * object.h (Got_offset_list): New class.
14884         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14885         (Sized_relobj::local_got_offset): Likewise.
14886         (Sized_relobj::set_local_got_offset): Likewise.
14887         (Sized_relobj::local_has_tls_got_offset): Removed.
14888         (Sized_relobj::local_tls_got_offset): Removed.
14889         (Sized_relobj::set_local_tls_got_offset): Removed.
14890         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14891         * output.cc (Output_data_got::add_global): Added got_type parameter.
14892         (Output_data_got::add_global_with_rel): Likewise.
14893         (Output_data_got::add_global_with_rela): Likewise.
14894         (Output_data_got::add_global_pair_with_rel): New function.
14895         (Output_data_got::add_global_pair_with_rela): New function.
14896         (Output_data_got::add_local): Added got_type parameter.
14897         (Output_data_got::add_local_with_rel): Likewise.
14898         (Output_data_got::add_local_with_rela): Likewise.
14899         (Output_data_got::add_local_pair_with_rel): New function.
14900         (Output_data_got::add_local_pair_with_rela): New function.
14901         (Output_data_got::add_global_tls): Removed.
14902         (Output_data_got::add_global_tls_with_rel): Removed.
14903         (Output_data_got::add_global_tls_with_rela): Removed.
14904         (Output_data_got::add_local_tls): Removed.
14905         (Output_data_got::add_local_tls_with_rel): Removed.
14906         (Output_data_got::add_local_tls_with_rela): Removed.
14907         * output.h (Output_data_got::add_global): Added got_type parameter.
14908         (Output_data_got::add_global_with_rel): Likewise.
14909         (Output_data_got::add_global_with_rela): Likewise.
14910         (Output_data_got::add_global_pair_with_rel): New function.
14911         (Output_data_got::add_global_pair_with_rela): New function.
14912         (Output_data_got::add_local): Added got_type parameter.
14913         (Output_data_got::add_local_with_rel): Likewise.
14914         (Output_data_got::add_local_with_rela): Likewise.
14915         (Output_data_got::add_local_pair_with_rel): New function.
14916         (Output_data_got::add_local_pair_with_rela): New function.
14917         (Output_data_got::add_global_tls): Removed.
14918         (Output_data_got::add_global_tls_with_rel): Removed.
14919         (Output_data_got::add_global_tls_with_rela): Removed.
14920         (Output_data_got::add_local_tls): Removed.
14921         (Output_data_got::add_local_tls_with_rel): Removed.
14922         (Output_data_got::add_local_tls_with_rela): Removed.
14923         * resolve.cc (Symbol::override_base_with_special): Removed
14924         reference to has_got_offset_ field.
14925         * symtab.cc (Symbol::init_fields): Replaced initialization
14926         of got_offset_ with got_offsets_.  Removed initialization
14927         of has_got_offset_
14928         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14929         (Symbol::got_offset): Likewise.
14930         (Symbol::set_got_offset): Likewise.
14931         (Symbol::has_tls_got_offset): Removed.
14932         (Symbol::tls_got_offset): Removed.
14933         (Symbol::set_tls_got_offset): Removed.
14934         (Symbol::got_offset_): Removed.
14935         (Symbol::tls_mod_got_offset_): Removed.
14936         (Symbol::tls_pair_got_offset_): Removed.
14937         (Symbol::got_offsets_): New field.
14938         (Symbol::has_got_offset): Removed.
14939         (Symbol::has_tls_mod_got_offset): Removed.
14940         (Symbol::has_tls_pair_got_offset): Removed.
14941         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14942         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14943         member functions.
14944         (Target_x86_64::Scan::global): Likewise.
14945         (Target_x86_64::Relocate::relocate): Likewise.
14946         (Target_x86_64::Relocate::relocate_tls): Likewise.
14947
14948 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14949
14950         * yyscript.y: Fix spelling error in comment.
14951
14952 2008-03-24  Ian Lance Taylor  <iant@google.com>
14953
14954         * options.h (class General_options): Define build_id option.
14955         * layout.h (class Layout): Declare write_build_id, create_note,
14956         create_build_id.  Add build_id_note_ member.
14957         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14958         "libiberty.h", "md5.h", "sha1.h".
14959         (Layout::Layout): Initialize eh_frame_data_,
14960         eh_frame_hdr_section_, and build_id_note_.
14961         (Layout::finalize): Call create_build_id.
14962         (Layout::create_note): New function, broken out of
14963         Layout::create_gold_note.
14964         (Layout::create_gold_note): Call create_note.
14965         (Layout::create_build_id): New function.
14966         (Layout::write_build_id): New function.
14967         (Close_task_runner::run): Call write_build_id.
14968
14969         * x86_64.cc: Correct license to GPLv3.
14970
14971 2008-03-23  Ian Lance Taylor  <iant@google.com>
14972
14973         * options.cc: Include "demangle.h".
14974         (parse_optional_string): New function.
14975         (parse_long_option): Handle takes_optional_argument.
14976         (parse_short_option): Update dash_z initializer.  Handle
14977         takes_optional_argument.
14978         (General_options::General_options): Initialize do_demangle_.
14979         (General_options::finalize): Set do_demangle_.  Handle demangling
14980         style.
14981         * options.h (parse_optional_string): Declare.
14982         (struct One_option): Add optional_arg field.  Update constructor.
14983         Update call constructor calls.  Add takes_optional_argument
14984         function.
14985         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14986         (DEFINE_optional_string): Define.
14987         (General_options::demangle): Change from DEFINE_bool to
14988         DEFINE_optional_string.
14989         (General_options::no_demangle): New function.
14990         (General_options::do_demangle): New function.
14991         (General_options::set_do_demangle): New function.
14992         (General_options::execstack_status_): Move definition to end of
14993         class definition.
14994         (General_options::static_): Likewise.
14995         (General_options::do_demangle_): New field.
14996         * object.cc (big_endian>::get_symbol_location_info): Call
14997         Options::do_demangle, not Options::demangle.
14998         * symtab.cc (demangle): Likewise.
14999
15000 2008-03-22  Ian Lance Taylor  <iant@google.com>
15001
15002         * gold.h: Include <cstddef> and <sys/types.h>
15003         * options.h: Include <cstring>.
15004
15005 2008-03-21  Ian Lance Taylor  <iant@google.com>
15006
15007         * Added source code to GNU binutils.
15008 \f
15009 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15010
15011 Copying and distribution of this file, with or without modification,
15012 are permitted in any medium without royalty provided the copyright
15013 notice and this notice are preserved.
15014
15015 Local Variables:
15016 mode: change-log
15017 left-margin: 8
15018 fill-column: 74
15019 version-control: never
15020 End: