PR binutils/15834
[external/binutils.git] / gold / ChangeLog
1 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2
3         PR binutils/15834
4         * object.h: Fix typos.
5
6 2013-08-16  Roland McGrath  <mcgrathr@google.com>
7
8         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
9         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
10
11 2013-08-07  Cary Coutant  <ccoutant@google.com>
12
13         Revert support for v2 DWP files:
14
15         2013-03-01  Cary Coutant  <ccoutant@google.com>
16
17             Add dwp support for v2 DWARF package file format.
18             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
19             tu_length parameter.  Adjust all callers.
20             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
21             * dwp.cc: Include dwarf.h.
22             (Section_bounds): New struct type.
23             (Unit_set): New struct type.
24             (Dwo_file::Dwo_file): Initialize new data member.
25             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
26             Combine and rename to...
27             (Dwo_file::read_unit_index): ...this.
28             (Dwo_file::sized_read_compunit_index)
29             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
30             (Dwo_file::sized_read_unit_index): ...this.
31             (Dwo_file::copy_section): Remove section_name, is_str_offsets
32             parameters; add section_id parameter.
33             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
34             (Dwo_file::add_unit_set): ...this.
35             (Dwo_file::shndx_map_): Remove.
36             (Dwo_file::sect_offsets_): New data member.
37             (Dwp_output_file::Dwp_output_file): Initialize new data members.
38             (Dwp_output_file::add_section): Rename to...
39             (Dwp_output_file::add_contribution): ...this.
40             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
41             (Dwp_output_file::add_tu_set): Likewise.
42             (Dwp_output_file::Contribution): New type.
43             (Dwp_output_file::Section::contributions): New data member.
44             (Dwp_output_file::Cu_or_tu_set): Remove.
45             (Dwp_output_file::Section::Section): New ctor.
46             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
47             (Dwp_output_file::Dwp_index::Section_table): New type.
48             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
49             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
50             parameter.
51             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
52             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
53             (Dwp_output_file::Dwp_index::section_table): New member function.
54             (Dwp_output_file::Dwp_index::section_table_end): New member function.
55             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
56             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
57             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
58             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
59             (Dwp_output_file::Dwp_index::section_table_): New data member.
60             (Dwp_output_file::Dwp_index::section_mask_): New data member.
61             (Dwp_output_file::add_output_section): New member function.
62             (Dwp_output_file::write_new_section): New member function.
63             (Dwp_output_file::write_contributions): New member function.
64             (Dwp_output_file::section_id_map_): New data member.
65             (class Dwo_id_info_reader): Remove.
66             (class Unit_reader): New class.
67             (get_dwarf_section_name): New function.
68             (Dwo_file::read_executable): Adjust initializations of class data.
69             (Dwo_file::read): Add support for v2 package file format.
70             (Dwo_file::read_unit_index): Likewise.
71             (Dwo_file::sized_read_unit_index): Likewise.
72             (Dwo_file::copy_section): Likewise.
73             (Dwo_file::add_unit_set): Likewise.
74             (Dwp_output_file::add_output_section): Likewise.
75             (Dwp_output_file::add_contribution): Likewise.
76             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
77             for empty slot.
78             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
79             file format.
80             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
81             slot.
82             (Dwp_output_file::initialize): Remove unused function.
83             (Dwp_output_file::finalize): Add support for v2 package file format.
84             (Dwp_output_file::write_index): Likewise.
85             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
86             function prototype.
87
88 2013-07-31  Cary Coutant  <ccoutant@google.com>
89
90         * object.cc (Sized_relobj::do_output_section_address): New function.
91         (Sized_relobj): Instantiate explicitly.
92         * object.h (Object::output_section_address): New function.
93         (Object::do_output_section_address): New function.
94         (Sized_relobj::do_output_section_address): New function.
95         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
96
97 2013-07-30  Cary Coutant  <ccoutant@google.com>
98             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
99
100         * parameters.cc (Parameters::entry): Return target-specific entry
101         symbol name.
102         * target.h (Target::entry_symbol_name): New function.
103         (Target_info::entry_symbol_name): New data member.
104
105         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
106         * i386.cc (Target_i386::i386_info): Likewise.
107         (Target_i386_nacl::i386_nacl_info): Likewise.
108         * sparc.cc (Target_sparc::sparc_info): Likewise.
109         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
110         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
111         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
112         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
113
114 2013-07-22  Sterling Augustine  <saugustine@google.com>
115
116         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
117         Convert parameter shndx to local variable. Add parameters symtab
118         and symtab_size.  Scan over section names.  Find relocation
119         section corresponding to current section.  Create and initialize
120         reloc_mapper_ and reloc_type_.
121         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
122         unit_length to off_t.  Initialize member unit_length_.  Fill in field
123         cu_offset_.
124         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
125         Initialize new fields unit_length_ and cu_offset_.
126         (Dwarf_pubnames_table::read_section): Update prototype.
127         (Dwarf_pubnames_table::cu_offset): New member function.
128         (Dwarf_pubnames_table::subsection_size): Likewise.
129         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
130         New fields.
131         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
132         member functions public.
133         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
134         Update comment.  Rework logic.  Move repeated parts to...
135         (Gdb_index_info_reader::read_pubtable): ...here. New function.
136         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
137         pubtypes_table_, and stmt_list_offset.
138         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
139         Gdb_index::find_pubtype_offset,
140         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
141         (Gdb_index::pubnames_read): Update prototype and rework logic.
142         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
143         Forward declare.
144         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
145         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
146         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
147         Gdb_index::map_pubtable_to_dies):
148         Declare functions.
149         (Gdb_index::pubnames_read): Update declaration.
150         (Gdb_index::Pubname_offset_map): New type.
151         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
152         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
153         Gdb_index::stmt_list_offset): Declare.
154         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
155         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
156         Gdb_index::pubtypes_offset_): Remove.
157
158 2013-07-19  Roland McGrath  <mcgrathr@google.com>
159
160         * options.h (General_options): Add -Trodata-segment option.
161         * parameters.cc (Parameters::check_rodata_segment): New function.
162         (Parameters::set_target_once): Call it.
163         * parameters.h (Parameters): Declare it (private member function).
164         * layout.cc (load_seg_unusable_for_headers): New function, broken
165         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
166         then validate rodata segment rather than text segment.
167         (relaxation_loop_body): Call that.
168         (is_text_segment): New function.  Don't admit a non-executable
169         segment if TARGET->isolate_execinstr().
170         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
171
172 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
173
174         PR gold/15070
175         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
176         * nacl.h (Sniff_file::View::View): Request aligned view.
177
178 2013-07-11  Cary Coutant  <ccoutant@google.com>
179
180         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
181         correct BRLT entry size.
182
183 2013-07-03  Alan Modra  <amodra@gmail.com>
184
185         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
186         comment.
187
188 2013-07-01  Cary Coutant  <ccoutant@google.com>
189
190         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
191         reloc_type_.
192         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
193         (Dwarf_ranges_table::lookup_reloc): New function.
194         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
195         reloc_type_.
196         (Dwarf_ranges_table::lookup_reloc): New function.
197         (Dwarf_ranges_table::reloc_type_): New data member.
198
199 2013-06-27  Jing Yu  <jingyu@google.com>
200
201         PR gold/15662
202         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
203         function.
204         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
205         (Target_powerpc::do_relax): Call the above.
206
207 2013-06-27  Cary Coutant  <ccoutant@google.com>
208
209         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
210         on garbage collected .opd section.
211
212 2013-06-27  Alan Modra  <amodra@gmail.com>
213
214         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
215         is non-zero.
216         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
217         (Target_powerpc::do_function_location): Likewise for loc->shndx.
218
219 2013-06-14  Cary Coutant  <ccoutant@google.com>
220
221         * resolve.cc (Symbol::override_base): Don't override st_type
222         from plugin placeholder symbols.
223         (Symbol_table::resolve): Likewise.
224         (Symbol_table::should_override): Don't complain about TLS mismatch
225         if the TO symbol is a plugin placeholder.
226         * testsuite/Makefile.am (plugin_test_tls): New test.
227         * testsuite/Makefile.in: Regenerate.
228         * testsuite/plugin_test_tls.sh: New test script.
229         * testsuite/two_file_test_2_tls.cc: New test source.
230         * testsuite/two_file_test_tls.cc: New test source.
231
232 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
233
234         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
235         the maximum segment alignment is larger than the page size.
236         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
237         correctly aligns the symbols with large alignemnt.
238         * testsuite/Makefile.in: Regenerate.
239         * testsuite/large_symbol_alignment.cc: New file.
240
241 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
242             Sriraman Tallam  <tmsriram@google.com>
243
244         * options.h (sort_section): New option.
245         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
246         Rename from Input_section_sort_section_name_special_ordering_compare.
247         (Input_section_sort_section_name_compare): New struct.
248         * output.cc (Output_section::Input_section_sort_section_name_compare::
249         operator()): New function.
250         (Output_section::sort_attached_input_sections): Use new sort function
251         for .text if --sort-section=name is specified.
252         * layout.cc (Layout::make_output_section):
253         Add sorting by name when --sort-section=name is specified.
254         * testsuite/Makefile.am (text_section_grouping): Test option
255         --sort-section=name.
256         * testsuite/Makefile.in: Regenerate.
257         * testsuite/section_sorting_name.cc: New file.
258         * testsuite/section_sorting_name.sh: New file.
259
260 2013-05-21  Cary Coutant  <ccoutant@google.com>
261
262         * symtab.h (Symbol::is_cxx_vtable): New function.
263         * target-reloc.h (relocate_section): Check for vtable symbol.
264         * testsuite/Makefile.am (missing_key_func.sh): New test case.
265         * testsuite/Makefile.in: Regenerate.
266         * testsuite/missing_key_func.cc: New test source.
267         * testsuite/missing_key_func.sh: New test script.
268
269 2013-05-21  Cary Coutant  <ccoutant@google.com>
270
271         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
272         type of enclosing symbol.
273         (Relocate_info::location): Check symbol type when describing symbol.
274         * object.h (Symbol_location_info): Remove unused line_number;
275         add enclosing_symbol_type.
276         * testsuite/debug_msg.sh: Adjust expected output.
277
278 2013-05-13  Cary Coutant  <ccoutant@google.com>
279
280         * configure.ac: Export DEFAULT_TARGET.
281         * configure: Regenerate.
282         * Makefile.in: Regenerate.
283         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
284         * testsuite/Makefile.in: Regenerate.
285         * testsuite/debug_msg.sh: Delete duplicate tests.
286         Don't check undef_int error message match for powerpc where the
287         source file and line number aren't available.
288
289 2013-05-10  Roland McGrath  <mcgrathr@google.com>
290
291         * options.h (General_options): Add --rosegment-gap option.
292         * options.cc (finalize): --rosegment-gap implies --rosegment.
293         * layout.cc (set_segment_offsets): Let user option override
294         target->rosegment_gap().
295
296 2013-05-10  Roland McGrath  <mcgrathr@google.com>
297
298         * options.h (General_options): Remove leading space from help
299         messages for -nostdlib and --rosegment.
300
301 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
302
303         PR ld/15365
304         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
305
306 2013-05-03  Alan Modra  <amodra@gmail.com>
307
308         * merge.cc (Output_merge_string::do_add_input_section): Correct
309         scan for number of strings.  Rename vars to avoid shadowing.
310         Include missing terminator in input_size_.
311
312 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
313
314         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
315         Restore empty string handling.
316
317 2013-05-01  Cary Coutant  <ccoutant@google.com>
318
319         * stringpool.cc (Stringpool_template::new_key_offset): Fix
320         uninitialized warning.
321
322 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
323
324         * output.cc (Output_section::add_merge_input_section): Allow
325         to merge sections if the alignment is more than character size.
326         * merge.h (Output_merge_string::Output_merge_string): Remove
327         assert.
328         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
329         only not-null strings. Check the alignment of strings.
330         * stringpool.h
331         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
332         alignment as the argument.
333         (Stringpool_template<Stringpool_char>::addralign_): New class member.
334         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
335         Align non-zero length strings according to the addralign_.
336         (Stringpool_template<Stringpool_char>::set_string_offsets):
337         Updating offsets according to the given alignment.
338         * testsuite/Makefile.am (text_section_grouping): Test if string
339         literals are getting merged.
340         * testsuite/Makefile.in: Regenerate.
341         * testsuite/merge_string_literals_1.c: New file.
342         * testsuite/merge_string_literals_2.c: Ditto.
343         * testsuite/merge_string_literals.sh: Ditto.
344
345 2013-04-26  Ian Lance Taylor  <iant@google.com>
346
347         * target-reloc.h (relocate_section): If the reloc offset is out of
348         range, pass VIEW as NULL to relocate.relocate.
349         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
350         * i386.cc (Target_i386::Relocate::relocate): Likewise.
351         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
352         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
353         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
354         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
355
356 2013-04-26  Geoff Pike  <gpike@chromium.org>
357
358         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
359         * layout.cc (Hash_task): New class.
360         (Layout::queue_build_id_tasks): New function.
361         (Layout::write_build_id): Handle single-thread portion of build ID
362         computation.  (In some cases, all of it is single-threaded.)  Replace
363         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
364         functionality in fewer lines of code.
365         * layout.h (Layout::queue_build_id_tasks): New function declaration.
366         * options.h (General_options): make "--build-id" default to tree
367         rather than sha1.  Add two new options related to --build-id=tree:
368         --build-id-chunk-size-for-treehash and
369         --build-id-min-file-size-for-treehash.
370         * Makefile.am: add testing of --build-id=tree and related new options
371         (these tests will be invoked by "make check").
372         * Makefile.in: Regenerate.
373
374 2013-04-25  Alan Modra  <amodra@gmail.com>
375
376         * configure.tgt: Add powerpcle and powerpc64le.
377
378 2013-04-22  Alan Modra  <amodra@gmail.com>
379
380         PR gold/15355
381         * layout.cc (Layout::segment_precedes): Allow more than one
382         segment with the same type and flags.
383
384 2013-04-15  Cary Coutant  <ccoutant@google.com>
385
386         * layout.cc (Layout::set_relocatable_section_offsets): Don't
387         allocate space in file for BSS sections.
388
389 2013-04-15  Cary Coutant  <ccoutant@google.com>
390
391         * script-sections.cc (Orphan_output_section): Reset address
392         to zero after each orphaned section for relocatable links.
393
394 2013-04-15  Cary Coutant  <ccoutant@google.com>
395
396         * symtab.cc (Symbol_table::sized_write_globals): Subtract
397         section starting address for relocatable link.
398         * testsuite/Makefile.am (script_test_11): New test.
399         * testsuite/Makefile.in: Regenerate.
400         * testsuite/script_test_11.c: New source file.
401         * testsuite/script_test_11.t: New linker script.
402
403 2013-04-13  Alan Modra  <amodra@gmail.com>
404
405         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
406         owner when sections are not adjacent and exceed group size.
407         (Target_powerpc::group_sections): Handle corner case.
408         (Target_powerpc::Branch_info::make_stub): Handle case where
409         stub table doesn't exist due to branches in non-exec sections.
410         (Target_powerpc::Relocate::relocate): Likewise.
411
412 2013-04-11  Alan Modra  <amodra@gmail.com>
413
414         PR gold/15354
415         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
416         .branch_lt to match bfd ld.  Adjust comments throughout file.
417
418 2013-04-04  Ian Lance Taylor  <iant@google.com>
419
420         GCC PR c++/56840
421         * object.cc (do_layout_deferred_sections): Handle .eh_frame
422         sections before checking whether they are included in the link.
423
424 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
425
426         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
427         object before calling the plugin claim_file handler.  Pass the elf
428         object of the archive to the plugin. Delete the elf object if the
429         plugin claims the file.
430
431 2013-03-21  Alan Modra  <amodra@gmail.com>
432
433         * layout.cc (Layout::set_segment_offsets): Accept writable .text
434         segment when omagic.
435
436 2013-03-21  Alan Modra  <amodra@gmail.com>
437
438         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
439         comparison warning.
440         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
441         uninitialized" warning.
442
443 2013-03-20  Alan Modra  <amodra@gmail.com>
444
445         * symtab.h (Symbol::clear_version): New function.
446         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
447         is_needed by weak references.  Clear version for symbols defined
448         in as-needed objects that are not needed.
449
450 2013-03-15  Alan Modra  <amodra@gmail.com>
451
452         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
453         static and public.  Add report_err param.  Return false for data refs.
454         (Target_powerpc::rela_dyn_section): New overloaded function.
455         (Target_powerpc::plt_, iplt_): Elucidate.
456         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
457         (Output_data_plt_powerpc::do_write): Don't write .iplt.
458         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
459         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
460         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
461         push_branch and make_plt_entry for ifunc syms when
462         reloc_needs_plt_for_ifunc.
463         (Target_powerpc::Relocate::relocate): Don't use plt entry value
464         for ifunc unless reloc_needs_plt_for_ifunc.
465
466 2013-03-15  Alan Modra  <amodra@gmail.com>
467
468         * gc.h (gc_process_relocs): Don't look through function descriptors.
469         * icf.cc (get_section_contents): Do so here instead.
470
471 2013-03-13  Alan Modra  <amodra@gmail.com>
472
473         * powerpc.cc (is_branch_reloc): Forward declare.
474         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
475         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
476         false for 64-bit, true for 32-bit non-branch relocs.
477         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
478         * testsuite/Makefile.am (icf_test): Use linker map file instead of
479         nm output.
480         (icf_safe_test): Generate linker map file as well as nm output.
481         (icf_safe_so_test): Likewise.
482         * testsuite/Makefile.in: Regenerate.
483         * testsuite/icf_test.sh: Parse linker map file to determine
484         section folding.
485         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
486         * testsuite/icf_safe_so_test.sh: Likewise.
487         (X86_32_or_ARM_specific_safe_fold): Merge into..
488         (arch_specific_safe_fold): ..this.
489         (X86_64_specific_safe_fold): Delete unused function.
490
491 2013-03-12  Alan Modra  <amodra@gmail.com>
492
493         * gc.h (gc_process_relocs): Look through function descriptors
494         to determine shndx, symvalue and addend used by ICF.  Tidy
495         variable duplication.
496
497 2013-03-11  Alan Modra  <amodra@gmail.com>
498
499         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
500         * layout.cc (Layout_task_runner::run): ..to here.
501         * symtab.h (struct Symbol_location): Extract from..
502         (class Symbol_table): ..here.
503         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
504         * target.h (class Target): Add function_location and
505         do_function_location functions.
506         (class Sized_target): Add do_function_location.
507         * object.h (class Sized_relobj_file): Move find_shdr..
508         (class Object): ..to here.
509         * object.cc: Likewise.  Update to suit.  Instantiate.
510         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
511         * powerpc.cc (class Powerpc_dynobj): New.
512         (Target_powerpc::do_function_location): New function.
513         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
514         (Powerpc_dynobj::do_read_symbols): New function.
515         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
516
517 2013-03-08  Ian Lance Taylor  <iant@google.com>
518
519         * options.cc (General_options::string_to_object_format): Accept
520         "default".
521
522 2013-03-08  Alan Modra  <amodra@gmail.com>
523
524         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
525         pointer to Post_fde.
526         (struct Post_fde): Move definition to here..
527         * ehframe.cc (struct Post_fde): ..from here.
528         (Cie::write): Don't alloc Post_fde.
529         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
530
531 2013-03-07  Alan Modra  <amodra@gmail.com>
532
533         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
534         relocation referencing .LC0.
535         * testsuite/discard_locals_test.sh: Remove FIXMEs.
536
537 2013-03-07  Alan Modra  <amodra@gmail.com>
538
539         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
540         always_inline.  Add assembly for powerpc to avoid GOT.
541
542 2013-03-07  Alan Modra  <amodra@gmail.com>
543
544         * testsuite/script_test_10.sh: Don't test .bss section
545         header number.
546
547 2013-03-06  Alan Modra  <amodra@gmail.com>
548
549         * powerpc.cc (class Powerpc_relobj): Move some member functions.
550         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
551         all callers.  Handle folded sections.
552         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
553         to Powerpc_relobj.
554         (Global_symbol_visitor_opd::operator()): Likewise.
555
556 2013-03-04  Alan Modra  <amodra@gmail.com>
557
558         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
559         * testsuite/Makefile.in: Regenerate.
560
561 2013-03-01  Cary Coutant  <ccoutant@google.com>
562
563         Add dwp support for v2 DWARF package file format.
564         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
565         tu_length parameter.  Adjust all callers.
566         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
567         * dwp.cc: Include dwarf.h.
568         (Section_bounds): New struct type.
569         (Unit_set): New struct type.
570         (Dwo_file::Dwo_file): Initialize new data member.
571         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
572         Combine and rename to...
573         (Dwo_file::read_unit_index): ...this.
574         (Dwo_file::sized_read_compunit_index)
575         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
576         (Dwo_file::sized_read_unit_index): ...this.
577         (Dwo_file::copy_section): Remove section_name, is_str_offsets
578         parameters; add section_id parameter.
579         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
580         (Dwo_file::add_unit_set): ...this.
581         (Dwo_file::shndx_map_): Remove.
582         (Dwo_file::sect_offsets_): New data member.
583         (Dwp_output_file::Dwp_output_file): Initialize new data members.
584         (Dwp_output_file::add_section): Rename to...
585         (Dwp_output_file::add_contribution): ...this.
586         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
587         (Dwp_output_file::add_tu_set): Likewise.
588         (Dwp_output_file::Contribution): New type.
589         (Dwp_output_file::Section::contributions): New data member.
590         (Dwp_output_file::Cu_or_tu_set): Remove.
591         (Dwp_output_file::Section::Section): New ctor.
592         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
593         (Dwp_output_file::Dwp_index::Section_table): New type.
594         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
595         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
596         parameter.
597         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
598         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
599         (Dwp_output_file::Dwp_index::section_table): New member function.
600         (Dwp_output_file::Dwp_index::section_table_end): New member function.
601         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
602         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
603         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
604         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
605         (Dwp_output_file::Dwp_index::section_table_): New data member.
606         (Dwp_output_file::Dwp_index::section_mask_): New data member.
607         (Dwp_output_file::add_output_section): New member function.
608         (Dwp_output_file::write_new_section): New member function.
609         (Dwp_output_file::write_contributions): New member function.
610         (Dwp_output_file::section_id_map_): New data member.
611         (class Dwo_id_info_reader): Remove.
612         (class Unit_reader): New class.
613         (get_dwarf_section_name): New function.
614         (Dwo_file::read_executable): Adjust initializations of class data.
615         (Dwo_file::read): Add support for v2 package file format.
616         (Dwo_file::read_unit_index): Likewise.
617         (Dwo_file::sized_read_unit_index): Likewise.
618         (Dwo_file::copy_section): Likewise.
619         (Dwo_file::add_unit_set): Likewise.
620         (Dwp_output_file::add_output_section): Likewise.
621         (Dwp_output_file::add_contribution): Likewise.
622         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
623         for empty slot.
624         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
625         file format.
626         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
627         slot.
628         (Dwp_output_file::initialize): Remove unused function.
629         (Dwp_output_file::finalize): Add support for v2 package file format.
630         (Dwp_output_file::write_index): Likewise.
631         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
632         function prototype.
633
634 2013-03-01  Cary Coutant  <ccoutant@google.com>
635
636         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
637         function into class definition in header file.
638         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
639         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
640         New function.
641         (Dwarf_info_reader::check_buffer): Move here from .cc file.
642
643 2013-02-28  Alan Modra  <amodra@gmail.com>
644
645         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
646         * target.cc (Target::do_plt_fde_location): New function.
647         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
648         accessor function, and constructor param.
649         (struct Post_fde, Post_fdes): Declare.
650         (Cie::write): Add post_fdes param.
651         * ehframe.cc (Fde::write): Use plt_fde_location.
652         (struct Post_fde): Define.
653         (Cie::write): Stash FDEs added post merge mapping.
654         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
655         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
656         (Eh_frame::do_sized_write): Arrange to write post map FDES after
657         other FDEs.
658         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
659         (Target_powerpc::has_glink): New function.
660         (Target_powerpc::do_relax): Add eh_frame info for stubs.
661         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
662         glink_eh_frame_fde_32, default_fde): New data.
663         (Stub_table::eh_frame_added_): New var.
664         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
665         Make const.
666         (Stub_table::add_eh_frame): New function.
667         (Output_data_glink::add_eh_frame): New function.
668         (Target_powerpc::make_glink_section): Call add_eh_frame.
669
670 2013-02-15  Ian Lance Taylor  <iant@google.com>
671
672         * options.h (DEFINE_uint64_alias): Define.
673         (class General_options): Add -Ttext-segment as an alias for
674         -Ttext.
675
676 2013-02-15  Alan Modra  <amodra@gmail.com>
677
678         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
679         (Stub_table::do_write): ..here, two places.
680         (Stub_table::plt_call_size): Use it here too.
681
682 2013-02-11  Ian Lance Taylor  <iant@google.com>
683
684         * descriptors.cc (Descriptors::close_all): New function.
685         * descriptors.h (class Descriptors): Declare close_all.
686         (close_all_descriptors): New inline function.
687         * plugin.cc: Include "descriptors.h".
688         (Plugin_manager::cleanup): Call close_all_descriptors.
689
690 2013-02-06  Alan Modra  <amodra@gmail.com>
691
692         * README: Update coding style link.
693
694 2013-01-28  Cary Coutant  <ccoutant@google.com>
695
696         * dwp.cc (File_list): New typedef.
697         (Dwo_name_info_reader): New class.
698         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
699         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
700         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
701         (Dwo_file::read_executable): New function.
702         (Dwo_file::read): Move common setup code to ...
703         (Dwo_file::make_object): ... here.
704         (dwp_options): Add --exec/-e.
705         (usage): Likewise.
706         (main): Likewise.
707
708 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
709
710         * layout.cc (Layout::layout): Check for option text_reorder.
711         (Layout::make_output_section): Ditto.
712         * options.h (text_reorder): New option.
713         * output.cc (Input_section_sort_compare): Remove special ordering
714         of section names.
715         (Output_section::
716          Input_section_sort_section_name_special_ordering_compare::
717          operator()): New function.
718         (Output_section::sort_attached_input_sections): Use new sort function
719         for .text.
720         * output.h (Input_section_sort_section_name_special_ordering_compare):
721         New struct.
722         * testsuite/Makefile.am (text_section_grouping): Test option
723         --no-text-reorder
724         * testsuite/Makefile.in: Regenerate.
725         * testsuite/text_section_grouping.sh: Check order of functions without
726         default text reordering.
727
728 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
729
730         * options.h (General_options): Change default to true for new_dtags.
731
732 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
733
734         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
735         when enable_new_dtags is false.  Only add DT_RUNPATH when
736         enable_new_dtags is true.
737
738 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
739
740         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
741         used in declaration and definition consistent.
742         (Target_powerpc::symval_for_branch): Ditto.
743
744 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
745
746         * testsuite/plugin_final_layout.cc: Fix comment.
747
748 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
749
750         * layout.cc (Layout::layout): Do not do default sorting for
751         text sections when section ordering is specified.
752         (make_output_section): Ditto.
753         * testsuite/plugin_final_layout.cc: Name the function sections
754         to catch reordering issues.
755
756 2013-01-15  Alan Modra  <amodra@gmail.com>
757
758         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
759         plt-thread-safe.
760
761 2013-01-15  Alan Modra  <amodra@gmail.com>
762
763         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
764         * testsuite/Makefile.in: Regenerate.
765
766 2013-01-14  Alan Modra  <amodra@gmail.com>
767
768         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
769         * testsuite/Makefile.in: Regenerate.
770
771 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
772
773         PR bfd/14430
774         Fix mingw gold build with plugins enabled
775         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
776         * configure.ac: Export DLOPEN_LIBS and add headers check.
777         * plugin.cc: Handle non-dlfcn case.
778         * Makefile.in: Regenerate.
779         * config.in: Regenerate.
780         * configure: Regenerate.
781         * testsuite/Makefile.in: Regenerate.
782
783 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
784
785         * output.h (sort_attached_input_sections): Change to be public.
786         * script-sections.cc
787         (Output_section_definition::set_section_addresses): Sort
788         attached input sections according to section order before linker
789         script assigns section addresses.
790         (Orphan_output_section::set_section_addresses): Sort
791         attached input sections according to section order before linker
792         script assigns section addresses.
793         * Makefile.am (final_layout.sh): Use a simple linker script to
794         check if section ordering still works.
795         * Makefile.in: Regenerate.
796
797 2013-01-09  Ben Cheng  <bccheng@google.com>
798
799         * arm.cc (Target_arm::attributes_accept_div): New function.
800         (Target_arm::attributes_forbid_div): New function.
801         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
802         attribute using the same new functions as what bfd/elf32_arm.c
803         does.
804
805 2013-01-07  Cary Coutant  <ccoutant@google.com>
806
807         PR gold/14993
808         * output.cc (Output_section::add_input_section): For incremental
809         updates, don't track input sections that are allocated from patch
810         space.
811
812 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
813             Ian Lance Taylor  <iant@google.com>
814
815         PR gold/14897
816         * configure.ac (--enable-ld): Removed.
817         (install_as_default): Set to yes only for --enable-gold=default
818         or --disable-ld.
819         * configure: Regenerated.
820
821 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
822
823         * options.h (General_options): Add -fuse-ld= for GCC linker
824         option compatibility.
825
826 2013-01-04  Cary Coutant  <ccoutant@google.com>
827
828         * configure.ac: Fix typo restoring CXXFLAGS.
829         * configure: Regenerate.
830
831 2013-01-04  Cary Coutant  <ccoutant@google.com>
832
833         * testsuite/Makefile.am (CXXLINK_S): New macro.
834         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
835         * testsuite/Makefile.in: Regenerate.
836
837 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
838
839         * version.cc (print_version): Update copyright year to 2013.
840
841 2012-12-20  Ian Lance Taylor  <iant@google.com>
842
843         * layout.cc (Layout::special_ordering_of_input_section): New
844         function.
845         (Layout::layout): If input section requires special ordering, must
846         sort input sections.
847         (Layout::make_output_section): May sort .text input sections.
848         (Layout::is_section_name_prefix_grouped): Remove.
849         * layout.h (class Layout): Declare
850         special_ordering_of_input_section.  Don't declare
851         is_section_name_prefix_grouped.
852         * output.cc (Output_section::add_input_section): Revert last
853         change.
854         (Output_section::Input_section_sort::match_file_name): Don't crash
855         if called on output section data.
856         (Output_section::Input_section_sort_compare): Sort based on
857         special ordering.
858         (Output_section::Input_section_sort_section_order_index_compare):
859         Revert last patch.
860         (Output_section::sort_attached_input_sections): Likewise.
861
862 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
863
864         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
865         * layout.h (Layout::is_section_name_prefix_grouped): New function.
866         * output.cc (Output_section::add_input_section): Check if section
867         name contains special prefix.  Keep input sections to sort such
868         sections.
869         (Output_section::Input_section_sort_section_order_index_compare
870          ::operator()): Group sections according to prefixes.
871         (Output_section::sort_attached_input_sections): Add condition to
872         Input_section_entry constructor call.
873         * testsuite/Makefile.am (text_section_grouping): New test.
874         * testsuite/Makefile.in: Regenerate.
875         * testsuite/text_section_grouping.cc: New file.
876         * testsuite/text_section_grouping.sh: New file.
877
878 2012-12-17  Nick Clifton  <nickc@redhat.com>
879
880         * Makefile.am: Add copyright notice.
881         * NEWS: Likewise.
882         * README: Likewise.
883         * configure.ac: Likewise.
884         * ftruncate.c: Likewise.
885         * Makefile.in: Regenerate.
886
887 2012-12-14  Cary Coutant  <ccoutant@google.com>
888
889         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
890         --no-as-needed flag.
891         (exception_separate_shared_12_test): Likewise.
892         (incremental_copy_test): Likewise.
893         * testsuite/Makefile.in: Regenerate.
894
895 2012-12-14  Cary Coutant  <ccoutant@google.com>
896
897         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
898         (Dwp_output_file::Dwp_index::enter_set): Add assert.
899
900 2012-12-12  Alan Modra  <amodra@gmail.com>
901
902         * powerpc.cc (class Track_tls): New.
903         (class Relocate, class Scan): Inherit Track_tls.
904         (Target_powerpc::Scan::local, global): Track tls optimization
905         and avoid creating plt entry for __tls_get_addr if all uses
906         are optimized away.
907         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
908
909 2012-12-12  Alan Modra  <amodra@gmail.com>
910
911         * options.h (General_options): Add --toc-sort/--no-toc-sort.
912         Replace no_toc_optimize with toc_optimize.
913         * output.h (Output_section::input_sections): Provide non-const variant.
914         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
915         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
916         accessors.
917         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
918         (class Sort_toc_sections): New.
919         (Target_powerpc::do_finalize_sections): Sort toc sections.
920         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
921
922 2012-12-10  Roland McGrath  <mcgrathr@google.com>
923
924         * testsuite/binary_unittest.cc (read_all): New function.
925         (Sized_binary_test): Use it instead of ::read.
926         * fileread.cc (do_read): Don't assume pread always reads the whole
927         amount in a single call.
928
929 2012-12-10  Alan Modra  <amodra@gmail.com>
930
931         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
932         Set EM_PPC64 or EM_PPC here.
933         (Target_selector_powerpc::do_recognize): Delete.
934
935 2012-12-10  Alan Modra  <amodra@gmail.com>
936
937         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
938         stub_table_.
939         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
940
941 2012-12-07  Roland McGrath  <mcgrathr@google.com>
942
943         * testsuite/binary_unittest.cc (Sized_binary_test):
944         Use open_descriptor rather than ::open.
945
946 2012-12-07  Alan Modra  <amodra@gmail.com>
947
948         * powerpc.cc (Stub_table::do_write): Delete redundant Address
949         typedef and invalid_address constant.
950         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
951         instantiate constants.
952
953 2012-12-06  Roland McGrath  <mcgrathr@google.com>
954
955         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
956         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
957         * aclocal.m4: Regenerate.
958         * configure: Regenerate.
959         * Makefile.in: Regenerate.
960         * testsuite/Makefile.in: Regenerate.
961
962 2012-12-07  Alan Modra  <amodra@gmail.com>
963
964         * options.h (General_options): Add no_toc_optimize.
965         * powerpc.cc (ok_lo_toc_insn): New function.
966         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
967
968 2012-12-06  Alan Modra  <amodra@gmail.com>
969
970         * options.h (General_options): Add plt_align, plt_static_chain,
971         plt_thread_safe.  Update stub_group_size help text.
972         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
973         for new plt_thread_safe_ var.
974         (use_plt_offset): Correct comments.
975         (Target_powerpc::do_relax): Look for thread creation symbols to
976         determine default plt_thread_safe value.  Clear plt call stubs
977         as well as branch stubs each iteration.
978         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
979         insn constants.
980         (l, hi, ha, write_insn): Move earlier.
981         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
982         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
983         plt stubs too.
984         (Stub_table::update_size): Adjust.
985         (Stub_table::prev_size, set_prev_size): Delete.
986         (Stub_table::stub_align): Let --plt-align affect result.
987         (Stub_table::plt_call_size): Calculate sizes for various stubs.
988         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
989         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
990         (Stub_table::do_write): Support more stub variants.
991
992 2012-12-04  Alan Modra  <amodra@gmail.com>
993
994         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
995         (Target_powerpc::do_define_standard_symbols): New function.
996
997 2012-12-03  Alan Modra  <amodra@gmail.com>
998
999         * output.h: Formatting, whitespace.
1000
1001 2012-12-03  Alan Modra  <amodra@gmail.com>
1002
1003         * layout.h (Layout::get_executable_sections): Declare.
1004         * layout.cc (Layout::get_executable_sections): New function.
1005         * arm.cc (Target_arm::group_sections): Use it.
1006         (Arm_output_section::group_sections): Delete now redundant test.
1007         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1008         param to handle relative relocs.
1009         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1010         (Output_data_reloc::add_absolute): Adjust.
1011         (Output_data_reloc::add_relative): New function.
1012         (Output_data::reset_data_size): New function.
1013         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1014         (Output_section::set_addralign): New function.
1015         (Output_section::checkpoint_set_addralign): New function.
1016         (Output_section::clear_section_offsets_need_adjustment): New function.
1017         (Output_section::input_sections): Make public.
1018         * powerpc.cc (class Output_data_brlt_powerpc): New.
1019         (class Stub_table, class Stub_control): New.
1020         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1021         stub_table_, set_stub_table, stub_table): New vectors and accessor
1022         functions.
1023         (Target_powerpc::do_may_relax, do_relax, push_branch,
1024         new_stub_table, stub_tables, brlt_section, group_sections,
1025         add_branch_lookup_table, find_branch_lookup_table,
1026         write_branch_lookup_table, make_brlt_section): New functions.
1027         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1028         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1029         branch_info_): New vars.
1030         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1031         make call stubs here.
1032         (Output_data_glink): Remove all call stub handling from this class.
1033         (Target_powerpc::Scan::local, global): Save interesting branch
1034         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1035         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1036         functions on final link.
1037         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1038         Handle long branch destinations too.
1039         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1040         do_plt_address_for_local): Adjust lookup of plt call stubs.
1041
1042 2012-11-30  Alan Modra  <amodra@gmail.com>
1043
1044         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1045         relocs against protected symbols when building 32-bit shared libs.
1046
1047 2012-11-30  Alan Modra  <amodra@gmail.com>
1048
1049         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1050         param.  Call got_section() to make .got.  Update all callers
1051         and their callers and so on.
1052
1053 2012-11-30  Alan Modra  <amodra@gmail.com>
1054
1055         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1056         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1057         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1058         value if it already exists.
1059
1060 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1061
1062         PR gold/14858
1063         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1064
1065 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1066
1067         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1068         than bfc instruction for data sandboxing.
1069
1070 2012-11-08  Alan Modra  <amodra@gmail.com>
1071
1072         * po/POTFILES.in: Regenerate.
1073
1074 2012-11-05  Alan Modra  <amodra@gmail.com>
1075
1076         * configure.ac: Apply 2012-09-10 change to config.in here.
1077         * configure: Regenerate.
1078
1079 2012-11-05  Alan Modra  <amodra@gmail.com>
1080
1081         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1082         (struct Opd_ent): Use "Address" rather than "Offset".
1083         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1084         (Target_powerpc::got_section): Make public.
1085         (Target_powerpc::scan_relocs): Move code setting symbols..
1086         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1087         Create _SDA_BASE_ only when referenced.
1088
1089 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1090
1091         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1092         from last change.
1093
1094 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1095
1096         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1097         for offset_in_output_section parameter.
1098         (Sized_target::relocate_special_relocatable): Likewise.
1099         * arm.cc (Target_arm::relocate_relocs): Likewise.
1100         (Target_arm::relocate_special_relocatable): Likewise.
1101         * i386.cc (Target_i386::relocate_relocs): Likewise.
1102         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1103         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1104         * target-reloc.h (relocate_relocs): Likewise.
1105         * testsuite/testfile.cc (Target_test): Likewise.
1106         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1107         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1108
1109         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1110         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1111
1112         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1113         parameter, which is unused in the [!F_SETFD] case.
1114
1115         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1116         SYMNDX to off_t before comparing it to this->data_size().
1117         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1118         * incremental.cc (Output_section_incremental_inputs::do_write):
1119         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1120
1121         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1122
1123 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1124
1125         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1126         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1127         in EABI_VER5.
1128
1129 2012-10-29  Cary Coutant  <ccoutant@google.com>
1130
1131         * dwp.cc (usage): Add file and exit status parameters;
1132         add --help and --version options.
1133         (print_version): New function.
1134         (main): Add --help and --version options.
1135
1136 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1137
1138         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1139         final_layout_sequence.txt.
1140         * testsuite/Makefile.in: Regenerated.
1141
1142 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1143
1144         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1145         COMPILE generated by automake.
1146         (LINK1): Likewise.
1147         (CXXCOMPILE1): Likewise.
1148         (CXXLINK1): Likewise.
1149         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1150         (LINK): Likewise.
1151         (CXXCOMPILE): Likewise.
1152         (CXXLINK): Likewise.
1153         * testsuite/Makefile.in: Regenerated.
1154
1155 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1156
1157         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1158         on bad fwrite return.
1159
1160 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1161
1162         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1163         on val.
1164
1165 2012-10-23  Cary Coutant  <ccoutant@google.com>
1166
1167         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1168         * testsuite/Makefile.in: Regenerate.
1169         * testsuite/dwp_test.h: New source file.
1170         * testsuite/dwp_test_1.cc: New source file.
1171         * testsuite/dwp_test_1.s: New source file.
1172         * testsuite/dwp_test_1.sh: New source file.
1173         * testsuite/dwp_test_1b.cc: New source file.
1174         * testsuite/dwp_test_1b.s: New source file.
1175         * testsuite/dwp_test_2.cc: New source file.
1176         * testsuite/dwp_test_2.s: New source file.
1177         * testsuite/dwp_test_2.sh: New source file.
1178         * testsuite/dwp_test_main.cc: New source file.
1179         * testsuite/dwp_test_main.s: New source file.
1180
1181 2012-10-23  Cary Coutant  <ccoutant@google.com>
1182
1183         * dwp.h: New header file.
1184         * dwp.cc: New source file.
1185         * gold.h: Move shared declarations to system.h.
1186         * system.h: New header file.
1187         * Makefile.am: Add dwp.
1188         * Makefile.in: Regenerate.
1189
1190 2012-10-23  Cary Coutant  <ccoutant@google.com>
1191
1192         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1193         Dwarf_info_reader::read_from_pointer.
1194         (Dwarf_pubnames_table::read_header): Likewise.
1195         (Dwarf_pubnames_table::next_name): Likewise.
1196         (Dwarf_die::read_attributes): Likewise.
1197         (Dwarf_die::skip_attributes): Likewise.
1198         (Dwarf_info_reader::read_from_pointer): New function template.
1199         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1200         (Dwarf_pubnames_table): Likewise.
1201         (Dwarf_info_reader::read_from_pointer): New function template.
1202         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1203         Dwarf_pubnames_table ctor.
1204
1205 2012-10-23  Cary Coutant  <ccoutant@google.com>
1206
1207         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1208         abbrev_shndx.
1209         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1210         abbrev_shndx_.
1211         (Dwarf_info_reader::set_abbrev_shndx): New method.
1212         (Dwarf_info_reader::abbrev_shndx_): New data member.
1213
1214 2012-10-23  Cary Coutant  <ccoutant@google.com>
1215
1216         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1217         from object, not parameters.
1218         (Dwarf_info_reader::parse): Likewise.
1219         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1220         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1221         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1222         methods.
1223
1224 2012-10-23  Cary Coutant  <ccoutant@google.com>
1225
1226         * fileread.cc (Input_file::Input_file): New constructor.
1227         * fileread.h (class Input_file): Add new constructor.
1228
1229 2012-10-18  Alan Modra  <amodra@gmail.com>
1230
1231         PR gold/14727
1232         * object.cc (Relobj::is_section_name_included): Also match
1233         .sdata personality section.
1234
1235 2012-10-18  Alan Modra  <amodra@gmail.com>
1236
1237         * target-reloc.h (class Default_comdat_behavior): New, package up..
1238         (get_comdat_behaviour): ..this.
1239         (relocate_section): Add Relocate_comdat_behavior template arg,
1240         adjust code to suit.
1241         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1242         (Target_arm::scan_reloc_section): Likewise.
1243         * i386.cc (Target_i386::relocate_section): Likewise.
1244         * sparc.cc (Target_sparc::relocate_section): Likewise.
1245         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1246         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1247         * powerpc.cc (class Relocate_comdat_behavior): New.
1248         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1249         gold::relocate_section with new template arg.
1250
1251 2012-10-18  Alan Modra  <amodra@gmail.com>
1252
1253         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1254         dynamic relocs for GOT_TPREL got entries, without symbol if
1255         resolving locally.
1256         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1257         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1258         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1259
1260 2012-10-17  Alan Modra  <amodra@gmail.com>
1261
1262         PR gold/14726
1263         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1264
1265 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1266
1267         * layout.cc (Layout::include_section): Keep sections marked
1268         SHF_EXCLUDE when doing relocatable links.
1269
1270 2012-10-16  Alan Modra  <amodra@gmail.com>
1271
1272         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1273         (Target_powerpc::do_finalize_sections): Call it.
1274         (Output_data_save_res): New class and supporting functions.
1275         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1276         normal symbols defined in object files.
1277
1278 2012-10-12  Alan Modra  <amodra@gmail.com>
1279
1280         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1281         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1282         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1283         section if scan_opd_relocs not yet called.
1284         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1285
1286 2012-10-12  Alan Modra  <amodra@gmail.com>
1287
1288         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1289         add_local_ifunc_entry): Revert last change.
1290         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1291
1292 2012-10-05  Alan Modra  <amodra@gmail.com>
1293
1294         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1295         do_plt_address_for_global): New functions.
1296         (Output_data_got_powerpc::do_write): Don't segfault when linking
1297         statically.
1298         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1299         add_local_ifunc_entry): Return true on adding entry..
1300         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1301         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1302         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1303         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1304         set up symbols here.
1305         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1306         syms here.  Do so even when no .iplt.  Don't segfault when linking
1307         statically.
1308         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1309         new variants without reloc param.
1310         (Glink_sym_ent::Glink_sym_ent): Likewise.
1311         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1312         reloc when refs will resolve to plt call stub.
1313         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1314         R_PPC_PLTREL24 to resolve locally.
1315         (Target_powerpc::Scan::global): Correct ifunc handling.
1316         (Target_powerpc::Relocate::relocate): Correct local sym glink
1317         lookup.  Don't destroy "value" when we have a plt call stub,
1318         and when checking plt call validity.
1319         (Target_powerpc::do_dynsym_value): Simplify.
1320
1321 2012-10-05  Alan Modra  <amodra@gmail.com>
1322
1323         * i386.cc (Output_data_plt_i386::address_for_global,
1324         address_for_local): Add plt offset to returned value.  Adjust uses.
1325         * sparc.cc (Output_data_plt_sparc::address_for_global,
1326         address_for_local): Likewise.
1327         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1328         address_for_local): Likewise.
1329         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1330         address_for_local): Likewise.
1331         * target.h (Target::plt_address_for_global, plt_address_for_local):
1332         Update comment.
1333         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1334         (Output_data_got::Got_entry::write): Nor here.
1335         * output.h: Comment fix.
1336
1337 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1338
1339         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1340         global_offset_table_ value for larget got.
1341         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1342
1343 2012-09-29  Alan Modra  <amodra@gmail.com>
1344
1345         * powerpc.cc (Target_powerpc::iplt_): New output section.
1346         (Target_powerpc::iplt_section, make_iplt_section,
1347         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1348         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1349         Target_powerpc::plt_entry_count): Count iplt entries too.
1350         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1351         reloc section in constructor.  New params.
1352         (Target_powerpc::make_plt_section): Create reloc section here instead.
1353         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1354         functions.
1355         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1356         (Output_data_glink::add_entry, find_entry): New functions to
1357         deal with local syms.
1358         (Glink_sym_ent): Add support for local syms.
1359         (Output_data_glink::do_write): Handle ifunc plt entries.
1360         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1361         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1362         (Target_powerpc::Relocate::relocate): Likewise.
1363         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1364
1365 2012-09-25  Alan Modra  <amodra@gmail.com>
1366
1367         * object.h (Sized_relobj_file::adjust_local_symbol,
1368         do_adjust_local_symbol): New functions.
1369         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1370         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1371         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1372         and irregular opd entry spacing.
1373         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1374         (Global_symbol_visitor_opd): New functor.
1375         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1376         on deleted opd entries.
1377
1378 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1379
1380         * tilegx.cc: New file.
1381         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1382         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1383         * configure.tgt: Add entries for tilegx*.
1384         * configure.ac: Likewise.
1385         * Makefile.in: Rebuild.
1386         * configure: Likewise.
1387         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1388         tilegx.
1389
1390 2012-09-13  Alan Modra  <amodra@gmail.com>
1391
1392         * target-reloc.h (scan_relocs): Call scan.local for relocs
1393         against symbols in discarded sections.  Pass is_discarded
1394         param.
1395         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1396         Add is_discarded param.
1397         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1398         is_discarded to flag opd entry as discarded.  Don't emit dyn
1399         relocs on such entries.
1400         (Target_powerpc::Scan::global): Similarly detect and handle
1401         such opd entries.
1402         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1403         opd_ent_.  Update all uses.
1404         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1405         (Target_powerpc::relocate_section): Zero out discarded opd
1406         entry relocs.
1407
1408 2012-09-12  Ian Lance Taylor  <iant@google.com>
1409
1410         PR gold/14570
1411         * output.cc: Rename Output_data_got template parameter from size
1412         to got_size for all functions.  Compile all variants of
1413         Output_data_got.
1414         (Output_data_got::Got_entry::write): Correct use of size for
1415         symbol value.  Use local_is_tls rather than casting to
1416         Sized_relobj_file.
1417         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1418         (class Sized_relobj_file): Add do_local_is_tls.
1419         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1420
1421 2012-09-11  Alan Modra  <amodra@gmail.com>
1422
1423         PR gold/14566
1424         * layout.cc (Layout::set_segment_offsets): When using
1425         common-page-size alignment, ensure we are on a new max-page-size
1426         page.
1427         * output.cc (Output_segment::set_section_addresses): Use
1428         abi_pagesize, not common_pagesize for relro boundary.
1429         (Output_segment::set_offset): Likewise.
1430
1431 2012-09-11  Alan Modra  <amodra@gmail.com>
1432
1433         * output.h (Output_data_got::add_global_tls, add_local_tls,
1434         add_local_tls_pair): New functions.
1435         (Output_data_got::add_local_pair_with_rel): Remove second
1436         reloc param.  Expand comment.
1437         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1438         use_plt_or_tls_offset_, similarly for constructor param.
1439         (Output_data_got::Got_entry::write): Add got_index param.
1440         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1441         add_local_tls_pair): New functions.
1442         (Output_data_got::Got_entry::write): Handle tls symbols
1443         with use_plt_or_tls_offset_ set specially.
1444         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1445         (Output_data_got::do_write): Replace iterator with index, pass
1446         index to entry write function.
1447         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1448         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1449         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1450         call.
1451         * i386.cc (Target_i386::Scan::local): Likewise.
1452         * sparc.cc (Target_sparc::Scan::local): Likewise.
1453         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1454         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1455         do_tls_offset_for_global): New functions.
1456         (Target_powerpc::Scan::local): Correct TLS relocations and got
1457         entry values.
1458         (Target_powerpc::Scan::global): Don't emit unnecessary
1459         dynamic relocations on TLS GOT entries.
1460
1461 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1462
1463         * config.in: Disable sanity check for kfreebsd.
1464
1465 2012-09-10  Sterling Augustine  <saugustine@google.com>
1466
1467         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1468         (Gdb_index::pubtypes_read): New parameter.
1469         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1470         to calls.
1471         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1472         pubtypes_object_.
1473
1474 2012-09-09  Alan Modra  <amodra@gmail.com>
1475
1476         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1477         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1478         * gc.h (gc_process_relocs): Call target gc_add_reference.
1479         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1480         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1481         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1482         unnecessary cast.
1483         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1484         to cater for when we don't need code offset.  Update use.
1485         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1486         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1487         set_opd_valid): New functions.
1488         (Target_powerpc::do_gc_add_reference): New function.
1489         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1490         stashed refs.
1491         (Target_powerpc::do_gc_mark_symbol): New function.
1492
1493 2012-09-06  Cary Coutant  <ccoutant@google.com>
1494
1495         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1496         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1497         (Dwarf_die::skip_attributes): Likewise.
1498         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1499         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1500         (main): Call it.
1501         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1502
1503 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1504
1505         * testsuite/script_test_3.t: Add .got.plt output section
1506         statement.
1507         * testsuite/script_test_4.t: Likewise.
1508
1509 2012-09-05  Alan Modra  <amodra@gmail.com>
1510
1511         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1512         update all uses and lose "enum" when using type.
1513
1514 2012-09-05  Alan Modra  <amodra@gmail.com>
1515
1516         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1517         * configure: Regenerate.
1518         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1519         (plugin_final_layout.stdout): Likewise.
1520         (memory_test): Set page sizes to 0x1000.
1521         * testsuite/Makefile.in: Regenerate.
1522         * testsuite/discard_locals_test.sh: Add FIXME comment.
1523         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1524         * testsuite/pr14265.t: Add .got output section statement.
1525         * testsuite/script_test_2.t: Likewise.
1526         * testsuite/script_test_3.t: Likewise.
1527         * testsuite/script_test_4.t: Likewise.
1528         * testsuite/script_test_5.t: Likewise.
1529         * testsuite/script_test_6.t: Likewise.
1530         * testsuite/script_test_7.t: Likewise.
1531         * testsuite/script_test_9.t: Likewise.
1532
1533 2012-09-05  Alan Modra  <amodra@gmail.com>
1534
1535         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1536         (Powerpc_relocate_functions::Status): New typedef.
1537         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1538         (Target_powerpc::Scan::local): Handle REL64.
1539         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1540         for REL32 and REL64.
1541         (Target_powerpc::symval_for_branch): New function, extracted from..
1542         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1543         checks.  Report overflow errors.
1544
1545 2012-09-05  Alan Modra  <amodra@gmail.com>
1546
1547         * object.h (Sized_relobj_file::emit_relocs): Delete.
1548         (Sized_relobj_file::emit_relocs_reltype): Delete.
1549         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1550         relocate_relocs for --emit-relocs.
1551         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1552         * output.h: Update comment.
1553         (Output_segment::first_section): New function.
1554         (Output_segment::first_section_load_address): Use first_section.
1555         * output.cc (Output_segment::first_section): New function extracted..
1556         (Output_segment::first_section_load_address): ..from here.  Delete.
1557         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1558         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1559         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1560         adjust call to target.h function.
1561         * i386.cc (Target_i386): Likewise.
1562         * sparc.cc (Target_sparc): Likewise.
1563         * x86_64.cc (Target_x86_64): Likewise.
1564         * powerpc.cc (Target_powerpc): Likewise.
1565         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1566         first tls section has section symbol for optimised local dynamic
1567         output relocs.
1568         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1569         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1570         optimised tls code.
1571         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1572         Rename to relocate_relocs.  Update error message.
1573
1574 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1575
1576         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1577         --just-symbols.
1578
1579 2012-08-31  Alan Modra  <amodra@gmail.com>
1580
1581         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1582         (Powerpc_relobj::toc_base_offset): New stub function.
1583         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1584         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1585         (Target_powerpc::Relocate::enum skip_tls): New.
1586         (Target_powerpc::call_tls_get_addr_): New var.
1587         (Target_powerpc::is_branch_reloc): Move to file scope.
1588         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1589         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1590         New functions.
1591         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1592         (powerpc_info): Correct common_pagesize for ppc64.
1593         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1594         (Powerpc_relocate_functions): Add overflow check enums and functions.
1595         Add non-shift version of rela, rela_ua.  Delete all rel public
1596         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1597         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1598         addr16_ha3, addr14 functions.
1599         (Output_data_got_powerpc::add_constant_pair): New function.
1600         (Output_data_got_powerpc::got_base_offset): Likewise.
1601         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1602         (instruction constants): Sort, add some more.
1603         (Output_data_glink::do_write): Add and use Address typedef.  Use
1604         object->toc_base_offset() stub for 64-bit.
1605         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1606         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1607         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1608         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1609         Always treat .opd relocs as against locally defined symbol.
1610         Correct condition for RELATIVE relocs.
1611         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1612         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1613         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1614         calculations.  Handle TLS relocs, and more.  Add overflow
1615         checking and adjust for Powerpc_relocate_functions changes.
1616         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1617         Reinstate --emit-relocs code with FIXME.
1618
1619 2012-08-30  Alan Modra  <amodra@gmail.com>
1620
1621         * layout.cc (Layout::set_segment_offsets): Set p_align to
1622         abi_pagesize, not common_pagesize.
1623         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1624         to determine whether file header can go in segment.
1625
1626 2012-08-30  Alan Modra  <amodra@gmail.com>
1627
1628         * output.h (Output_reloc::Output_reloc <output section>): Add
1629         is_relative param.  Adjust calls.
1630         (Output_reloc::add_output_section_relative): New functions.
1631         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1632         is_relative.
1633         (Output_reloc::symbol_value): Handle SECTION_CODE.
1634
1635 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1636
1637         * gold.cc (queue_middle_tasks): Call layout again when unique
1638         segments for sections is desired.
1639         * layout.cc (Layout::Layout): Initialize new members.
1640         (Layout::get_output_section_flags): New function.
1641         (Layout::choose_output_section): Call get_output_section_flags.
1642         (Layout::layout): Make output section for mapping to a unique segment.
1643         (Layout::insert_section_segment_map): New function.
1644         (Layout::attach_allocated_section_to_segment): Make unique segment for
1645         output sections marked so.
1646         (Layout::segment_precedes): Check for unique segments when sorting.
1647         * layout.h (Layout::Unique_segment_info): New struct.
1648         (Layout::Section_segment_map): New typedef.
1649         (Layout::insert_section_segment_map): New function.
1650         (Layout::get_output_section_flags): New function.
1651         (Layout::is_unique_segment_for_sections_specified): New function.
1652         (Layout::set_unique_segment_for_sections_specified): New function.
1653         (Layout::unique_segment_for_sections_specified_): New member.
1654         (Layout::section_segment_map_): New member.
1655         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1656         Rename is_gc_pass_one to is_pass_one.
1657         Rename is_gc_pass_two to is_pass_two.
1658         Rename is_gc_or_icf to is_two_pass.
1659         Check for which pass based on whether symbols data is present.
1660         Make it two pass when unique segments for sections is desired.
1661         * output.cc (Output_section::Output_section): Initialize new
1662         members.
1663         * output.h (Output_section::is_unique_segment): New function.
1664         (Output_section::set_is_unique_segment): New function.
1665         (Output_section::is_unique_segment_): New member.
1666         (Output_section::extra_segment_flags): New function.
1667         (Output_section::set_extra_segment_flags): New function.
1668         (Output_section::extra_segment_flags_): New member.
1669         (Output_section::segment_alignment): New function.
1670         (Output_section::set_segment_alignment): New function.
1671         (Output_section::segment_alignment_): New member.
1672         (Output_segment::Output_segment): Initialize is_unique_segment_.
1673         (Output_segment::is_unique_segment): New function.
1674         (Output_segment::set_is_unique_segment): New function.
1675         (Output_segment::is_unique_segment_): New member.
1676         * plugin.cc (allow_unique_segment_for_sections): New function.
1677         (unique_segment_for_sections): New function.
1678         (Plugin::load): Add new functions to transfer vector.
1679         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1680         * Makefile.in: Regenerate.
1681         * testsuite/plugin_final_layout.sh: Check if unique segment
1682         functionality works.
1683         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1684         are available.
1685         (allow_unique_segment_for_sections): New global.
1686         (unique_segment_for_sections): New global.
1687         (claim_file_hook): Call allow_unique_segment_for_sections.
1688         (all_symbols_read_hook): Call unique_segment_for_sections.
1689
1690 2012-08-22  Cary Coutant  <ccoutant@google.com>
1691
1692         * layout.cc (Layout::include_section): Don't assert on GROUP
1693         sections with --emit-relocs.
1694
1695 2012-08-21  Cary Coutant  <ccoutant@google.com>
1696
1697         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1698         if --export-dynamic-symbol names an undef symbol.
1699
1700 2012-08-18  Alan Modra  <amodra@gmail.com>
1701
1702         * powerpc.cc: Formatting and white space.
1703         (Powerpc_relobj): Rename got2_section_ to special_.
1704         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1705         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1706         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1707         (Target_powerpc): Add Address typedef and invalid_address.  Use
1708         throughout.
1709         (Target_powerpc::is_branch_reloc): New function.
1710         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1711         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1712         for dst_mask, value and addend.
1713         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1714         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1715         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1716         uint16_t for 24-bit offset.  Use get_output_section_offset and
1717         check return.
1718         (Target_powerpc::Scan::local): Handle more relocs.
1719         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1720         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1721         Plug in toc restoring insn after plt calls.  Translate branches
1722         to function descriptor symbols to corresponding entry point.
1723         (Target_powerpc::relocate_for_relocatable): Check return from
1724         get_output_section_offset.
1725         * symtab.h: Comment typo.
1726
1727 2012-08-14  Ian Lance Taylor  <iant@google.com>
1728
1729         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1730         unsupported_relocal_local to call unsupported_reloc_global.
1731
1732 2012-08-14  Nick Clifton  <nickc@redhat.com>
1733
1734         PR ld/14265
1735         * script-sections.cc (Sections_element::output_section_name): Add
1736         keep return parameter.
1737         (Output_section_element::match_name): Add keep return parameter.
1738         Return the value of the keep_ member.
1739         * script-sections.h (class Output_section): Update
1740         output_section_name prototype.
1741         * layout.cc (Layout::keep_input_section): New public member
1742         function.
1743         (Layout::choose_output_section): Pass keep parameter to
1744         output_section_name.
1745         * layout.h (class Layout): Add keep_input_section.
1746         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1747         sections.
1748         * testsuite/Makefile.am: Add a test.
1749         * testsuite/Makefile.in: Regenerate.
1750         * testsuite/pr14265.c: Source file for the test.
1751         * testsuite/pr14265.t: Linker script for the test.
1752         * testsuite/pr14265.sh: Shell script for the test.
1753
1754 2012-08-14  Alan Modra  <amodra@gmail.com>
1755
1756         * target.h (Target::output_section_name): New function.
1757         (Target::do_output_section_name): New function.
1758         * layout.cc (Layout::choose_output_section): Call the above.
1759         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1760
1761 2012-08-14  Alan Modra  <amodra@gmail.com>
1762
1763         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1764         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1765         for replace_constant call.
1766         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1767         (Output_data_glink::do_print_to_mapfile): New function.
1768         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1769         (Target_powerpc::Relocate::relocate): Likewise.
1770
1771 2012-08-14  Alan Modra  <amodra@gmail.com>
1772
1773         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1774         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1775         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1776         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1777         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1778         here.
1779         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1780         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1781         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1782         here.
1783         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1784         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1785
1786 2012-08-12  Alan Modra  <amodra@gmail.com>
1787
1788         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1789         (glink insn constants): Use uint32_t.
1790         (Output_data_glink::add_entry): Use insert, not [] operator.
1791
1792 2012-08-11  Alan Modra  <amodra@gmail.com>
1793
1794         * object.h (Sized_relobj_file::find_shdr): New function.
1795         (Sized_relobj_file::find_special_sections): New function.
1796         * object.cc (Sized_relobj_file::find_shdr): New function.
1797         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1798         (Sized_relobj_file::find_special_sections): New function, split out..
1799         (Sized_relobj_file::do_read_symbols): ..from here.
1800         * output.h (Output_data_got::replace_constant): New function.
1801         (Output_data_got::num_entries): New function.
1802         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1803         (Output_data_got::got_offset): Protected rather than private.
1804         (Output_data_got::replace_got_entry): New function.
1805         * output.cc (Output_data_got::replace_got_entry): New function.
1806         * powerpc.cc (class Powerpc_relobj): New.
1807         (class Powerpc_relocate_functions): Delete all psymval variants or
1808         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1809         Implement _ha functions using corresponding _hi function.
1810         (Powerpc_relobj::find_special_sections): New function.
1811         (Target_powerpc::do_make_elf_object): New function.
1812         (class Output_data_got_powerpc): New.
1813         (class Output_data_glink): New.
1814         (class Powerpc_scan_relocatable_reloc): New.
1815         Many more changes througout file.
1816
1817 2012-08-09  Nick Clifton  <nickc@redhat.com>
1818
1819         * po/vi.po: Updated Vietnamese translation.
1820
1821 2012-08-07  Ian Lance Taylor  <iant@google.com>
1822
1823         * layout.cc (Layout::add_target_dynamic_tags): If
1824         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1825         plt_rel.
1826
1827 2012-07-30  Nick Clifton  <nickc@redhat.com>
1828
1829         * po/gold.pot: Updated template.
1830         * po/es.po: Updated Spanish translation.
1831
1832 2012-07-18  Cary Coutant  <ccoutant@google.com>
1833
1834         PR gold/14344
1835         * configure.ac: Add check for -gpubnames support.
1836         * configure: Regenerate.
1837         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1838         support; force -gno-pubnames.
1839         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1840         support.
1841         (gdb_index_test_4): New test.
1842         * testsuite/Makefile.in: Regenerate.
1843         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1844         * testsuite/gdb_index_test_2.sh: Likewise.
1845         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1846         * testsuite/gdb_index_test_4.sh: New script.
1847         * testsuite/gdb_index_test_comm.sh: New script with common code;
1848         don't look for space after colon.
1849
1850 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1851
1852         * gold.cc (queue_middle_tasks): Update function order only after
1853         deferred objects due to plugins are processed.
1854
1855 2012-07-11  Ian Lance Taylor  <iant@google.com>
1856
1857         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1858         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1859         (Target_arm::scan_reloc_for_stub): Likewise.
1860         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1861         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1862         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1863         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1864         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1865
1866 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1867             Ian Lance Taylor  <iant@google.com>
1868
1869         PR gold/14309
1870         * configure.ac: Test whether std::tr1::hash<off_t> works.
1871         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1872         needed.
1873         * output.h (class Output_fill): Add virtual destructor.
1874         * configure, config.in: Rebuild.
1875
1876 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1877
1878         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1879
1880 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1881
1882         * plugin.cc (Plugin::load): Handle position independent executables.
1883
1884 2012-06-06  Cary Coutant  <ccoutant@google.com>
1885
1886         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1887         add .debug_macro.
1888         (lines_only_debug_sections): Likewise.
1889         (gdb_fast_lookup_sections): New static array.
1890         (is_gdb_debug_section): Rename formal parameter.
1891         (is_lines_only_debug_section): Likewise.
1892         (is_gdb_fast_lookup_section): New function.
1893         (Layout::include_section): Check for ".zdebug_" prefix; pass
1894         section name suffix to is_gdb_debug_section, et al.; check for
1895         fast-lookup sections when building .gdb_index.
1896         * options.h (--strip-debug-gdb): Update GDB version number.
1897
1898 2012-06-06  Cary Coutant  <ccoutant@google.com>
1899
1900         * configure.ac: Add check for fallocate.
1901         * configure: Regenerate.
1902         * config.in: Regenerate.
1903
1904         * options.h (class General_options): Add --mmap-output-file and
1905         --posix-fallocate options.
1906         * output.cc: (posix_fallocate): Remove; replace with...
1907         (gold_fallocate): New function.
1908         (Output_file::map_no_anonymous): Call gold_fallocate.
1909         (Output_file::map): Check --mmap-output-file option.
1910
1911 2012-06-05  Jing Yu  <jingyu@google.com>
1912
1913         * gold.h (textdomain): Add do {} to empty while(0).
1914         (bindtextdomain): Likewise.
1915
1916 2012-06-04  Cary Coutant  <ccoutant@google.com>
1917
1918         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1919         has_dynsym_index.
1920
1921 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1922
1923         * symtab.cc (Symbol_table::define_special_symbol):
1924         Initialize *poldsym to prevent uninitialized variable errors.
1925
1926 2012-05-23  Cary Coutant  <ccoutant@google.com>
1927
1928         * layout.cc (Layout::section_name_mapping): Add rules to handle
1929         exact match on .data.rel.ro.local or .data.rel.ro.
1930         (Layout::output_section_name): Check for exact matches.
1931
1932 2012-05-23  Cary Coutant  <ccoutant@google.com>
1933
1934         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1935         more carefully.
1936
1937 2012-05-22  Cary Coutant  <ccoutant@google.com>
1938
1939         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1940         object before exporting symbol.
1941
1942 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1943
1944         * testsuite/tls_test.cc: Include "config.h" first.
1945         * testsuite/tls_test_c.c: Likewise.
1946
1947 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1948             Nick Clifton  <nickc@redhat.com>
1949
1950         PR 14072
1951         * configure.in: Add check that sysdep.h has been included before
1952         any system header files.
1953         * configure: Regenerate.
1954         * config.in: Regenerate.
1955
1956 2012-05-14  Cary Coutant  <ccoutant@google.com>
1957
1958         * layout.cc (Layout::make_output_section): Mark .tdata section
1959         as RELRO.
1960         * testsuite/relro_test.cc: Add a TLS variable.
1961
1962 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1963
1964         PR gold/14091
1965         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1966         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1967         R_X86_64_64.
1968
1969 2012-05-08  Cary Coutant  <ccoutant@google.com>
1970
1971         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1972         (lines_only_debug_sections): Likewise.
1973
1974 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1975
1976         * nacl.cc: New file.
1977         * nacl.h: New file.
1978         * Makefile.am (CCFILES, HFILES): Add them.
1979         * Makefile.in: Regenerate.
1980         * i386.cc (Output_data_plt_i386_nacl): New class.
1981         (Output_data_plt_i386_nacl_exec): New class.
1982         (Output_data_plt_i386_nacl_dyn): New class.
1983         (Target_i386_nacl): New class.
1984         (Target_selector_i386_nacl): New class.
1985         (target_selector_i386): Use it instead of Target_selector_i386.
1986         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1987         (Target_x86_64_nacl): New class.
1988         (Target_selector_x86_64_nacl): New class.
1989         (target_selector_x86_64, target_selector_x32): Use it instead of
1990         Target_selector_x86_64.
1991         * arm.cc (Output_data_plt_arm_nacl): New class.
1992         (Target_arm_nacl): New class.
1993         (Target_selector_arm_nacl): New class.
1994         (target_selector_arm, target_selector_armbe): Use it instead of
1995         Target_selector_arm.
1996
1997         * target-select.cc (select_target): Take new Input_file* and off_t
1998         arguments, pass them on to recognize method of selector.
1999         * object.cc (make_elf_sized_object): Update caller.
2000         * parameters.cc (parameters_force_valid_target): Likewise.
2001         * incremental.cc (make_sized_incremental_binary): Likewise.
2002         * target-select.h: Update decl.
2003         (Target_selector::recognize): Take new Input_file* argument,
2004         pass it on to do_recognize.
2005         (Target_selector::do_recognize): Take new Input_file* argument.
2006         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2007         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2008         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2009         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2010
2011         * target.h (Target::Target_info): New members isolate_execinstr
2012         and rosegment_gap.
2013         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2014         * arm.cc (Target_arm::arm_info): Update initializer.
2015         * i386.cc (Target_i386::i386_info): Likewise.
2016         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2017         * sparc.cc (Target_sparc::sparc_info): Likewise.
2018         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2019         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2020         * layout.cc (Layout::attach_allocated_section_to_segment):
2021         Take new const Target* argument.  If target->isolate_execinstr(), act
2022         like --rosegment.
2023         (Layout::find_first_load_seg): Take new const Target* argument;
2024         if target->isolate_execinstr(), reject PF_X segments.
2025         (Layout::relaxation_loop_body): Update caller.
2026         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2027         reset file offset to zero when we hit LOAD_SEG, and then do a second
2028         loop over the segments before LOAD_SEG to reassign offsets after
2029         addresses have been determined.  Handle target->rosegment_gap().
2030         (Layout::attach_section_to_segment): Take new const Target* argument;
2031         pass it to attach_allocated_section_to_segment.
2032         (Layout::make_output_section): Update caller.
2033         (Layout::attach_sections_to_segments): Take new const Target* argument;
2034         pass it to attach_section_to_segment.
2035         * gold.cc (queue_middle_tasks): Update caller.
2036         * layout.h (Layout): Update method decls with new arguments.
2037
2038         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2039         Target_info pointer to use.
2040         (Target_arm::do_make_data_plt): New virtual method.
2041         (Target_arm::make_data_plt): New method that calls it.
2042         (Target_arm::make_plt_entry): Use it.
2043         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2044         for the section alignment.
2045         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2046         method.
2047         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2048         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2049         method.
2050         (Output_data_plt_arm::get_plt_entry_size): Call it.
2051         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2052         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2053         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2054         method.
2055         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2056         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2057         method instead of sizeof(plt_entry).
2058         (Output_data_plt_arm::add_entry): Likewise.
2059         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2060         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2061         than static method.
2062         (Target_arm::plt_entry_size): Likewise.
2063         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2064         Move to ...
2065         (Output_data_plt_arm_standard): ... here, new class.
2066         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2067         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2068         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2069
2070         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2071         Take additional argument for the PLT entry size.
2072         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2073         Use get_plt_entry_size method rather than plt_entry_size variable.
2074         (Output_data_plt_x86_64::reserve_slot): Likewise.
2075         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2076         (Output_data_plt_x86_64::add_entry): Likewise.
2077         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2078         (Output_data_plt_x86_64::address_for_global): Likewise.
2079         (Output_data_plt_x86_64::address_for_local): Likewise.
2080         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2081         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2082         Make method non-static.
2083         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2084         method.
2085         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2086         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2087         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2088         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2089         virtual method.
2090         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2091         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2092         virtual method.
2093         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2094         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2095         virtual method.
2096         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2097         (Output_data_plt_x86_64::plt_entry_size)
2098         (Output_data_plt_x86_64::first_plt_entry)
2099         (Output_data_plt_x86_64::plt_entry)
2100         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2101         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2102         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2103         (Output_data_plt_x86_64_standard): ... here, new class.
2104         (Target_x86_64::Target_x86_64): Take optional argument for the
2105         Target_info pointer to use.
2106         (Target_x86_64::do_make_data_plt): New virtual method.
2107         (Target_x86_64::make_data_plt): New method to call it.
2108         (Target_x86_64::init_got_plt_for_update): Use that.
2109         Call this->plt_->add_eh_frame method here.
2110         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2111         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2112         rather than static method.
2113         (Target_x86_64::plt_entry_size): Likewise.
2114         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2115         rather than plt_entry_size variable.  Move guts of PLT filling to...
2116         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2117         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2118         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2119
2120         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2121         additional argument for the section alignment.
2122         Don't do add_eh_frame_for_plt here.
2123         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2124         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2125         variable.
2126         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2127         method.
2128         (Output_data_plt_i386::get_plt_entry_size): Call it.
2129         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2130         (Output_data_plt_i386::add_eh_frame): New method to call it.
2131         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2132         method.
2133         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2134         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2135         method.
2136         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2137         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2138         method instead of plt_entry_size.
2139         (Output_data_plt_i386::plt_entry_size)
2140         (Output_data_plt_i386::plt_eh_frame_fde_size)
2141         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2142         (Output_data_plt_i386_standard): ... here, new class.
2143         (Output_data_plt_i386_exec): New class.
2144         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2145         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2146         (Output_data_plt_i386::exec_plt_entry): Move to ...
2147         (Output_data_plt_i386_exec::plt_entry): ... here.
2148         (Output_data_plt_i386_dyn): New class.
2149         (Output_data_plt_i386::first_plt_entry): Move to ...
2150         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2151         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2152         (Output_data_plt_i386_dyn::plt_entry): ... here.
2153         (Target_i386::Target_i386): Take optional argument for the Target_info
2154         pointer to use.
2155         (Target_i386::do_make_data_plt): New virtual method.
2156         (Target_i386::make_data_plt): New method to call it.
2157         (Target_i386::make_plt_section): Use that.
2158         Call this->plt_->add_eh_frame method here.
2159         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2160         rather than plt_entry_size variable.
2161         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2162         (Output_data_plt_i386::address_for_local): Likewise.
2163         (Output_data_plt_i386::do_write): Likewise.
2164         Move guts of PLT filling to...
2165         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2166         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2167         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2168         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2169
2170 2012-05-01  Cary Coutant  <ccoutant@google.com>
2171
2172         * dwarf_reader.cc (Dwarf_die::read_attributes)
2173         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2174         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2175         * reduced_debug_output.cc
2176         (Output_reduced_debug_info_section::get_die_end): Remove
2177         DW_FORM_GNU_ref_index.  Add default case.
2178
2179 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2180
2181         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2182         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2183         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2184         DW_AT_high_pc as offset from DW_AT_low_pc.
2185
2186         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2187         * testsuite/Makefile.in: Regenerate.
2188         * testsuite/gdb_index_test_3.c: New test source file.
2189         * testsuite/gdb_index_test_3.sh: New test source file.
2190
2191 2012-04-25  Ian Lance Taylor  <iant@google.com>
2192
2193         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2194         pointer.
2195         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2196         as a class, not a struct.
2197         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2198         (Target_arm::apply_cortex_a8_workaround): Likewise.
2199         * gc.h: Declare Reloc_types as a struct, not a class.
2200         * object.h: Declare Symbols_data as a struct.
2201         * reloc.h: Declare Read_relocs_data as a struct.
2202         * target.h: Declare Relocate_info as a struct.
2203
2204 2012-04-24  David S. Miller  <davem@davemloft.net>
2205
2206         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2207         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2208         and R_SPARC_WPLT30.
2209
2210 2012-04-24  Cary Coutant  <ccoutant@google.com>
2211
2212         * incremental-dump.cc (find_input_containing_global): Replace
2213         magic number with symbolic constant.
2214         (dump_incremental_inputs): Update version number.
2215         * incremental.cc (Output_section_incremental_inputs): Update version
2216         number; import symbolic constants from Incremental_inputs_reader.
2217         (Incremental_inputs::create_data_sections): Align relocations
2218         section correctly for 64-bit targets.
2219         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2220         constants; add padding.
2221         (Output_section_incremental_inputs::write_header): Add assert for
2222         header_size.
2223         (Output_section_incremental_inputs::write_input_files): Add assert
2224         for input_entry_size.
2225         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2226         add assert for object_info_size, input_section_entry_size,
2227         global_sym_entry_size.
2228         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2229         for data structure sizes; use them.
2230         (Incremental_input_entry_reader): Import symbolic constants from
2231         Incremental_inputs_reader; use them.
2232
2233 2012-04-23  David S. Miller  <davem@davemloft.net>
2234
2235         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2236         and elf_flags_set_.
2237         (Target_sparc::Target_sparc): Initialize new fields.
2238         (Target_sparc::do_make_elf_object): New function.
2239         (Target_sparc::do_adjust_elf_header): New function.
2240
2241 2012-04-23  Cary Coutant  <ccoutant@google.com>
2242
2243         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2244         CU range table of gdb index.
2245
2246 2012-04-20  David S. Miller  <davem@davemloft.net>
2247
2248         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2249         instead of false.
2250
2251 2012-04-16  David S. Miller  <davem@davemloft.net>
2252
2253         * sparc.cc (Target_sparc::got_address): New function.
2254         (Sparc_relocate_functions::gdop_hix22): New function.
2255         (Sparc_relocate_functions::gdop_lox10): New function.
2256         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2257         relocs.
2258         (Target_sparc::Scan::local): Likewise if the global symbol is not
2259         preemptible and is not IFUNC.
2260         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2261         transformations for local and non-preemptible non-IFUNC global
2262         symbols.
2263
2264         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2265         writing out 64-bit part of ranges.
2266
2267         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2268         -fpic and -fpie respectively.
2269         * Makefile.in: Regenerate.
2270
2271         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2272         (Target_sparc::Target_sparc): Initialize new field.
2273         (Target_sparc::do_plt_section_for_global): New function.
2274         (Target_sparc::do_plt_section_for_local): New function.
2275         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2276         (Target_sparc::make_plt_section): New function, broken out of
2277         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2278         (Target_sparc::make_plt_entry): Call make_plt_section.
2279         (Target_sparc::make_local_ifunc_plt_entry): New function.
2280         (Target_sparc::rela_ifunc_section): New function.
2281         (Target_sparc::plt_section): Remove const.
2282         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2283         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2284         and ifunc_count_ fields.
2285         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2286         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2287         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2288         (Output_data_plt_sparc::rela_ifunc): New function.
2289         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2290         (Output_data_plt_sparc::has_ifunc_section): New function.
2291         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2292         (Output_data_plt_sparc::address_for_global): New function.
2293         (Output_data_plt_sparc::address_for_local): New function.
2294         (Output_data_plt_sparc::plt_index_to_offset): New function.
2295         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2296         and entry_count.
2297         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2298         entry_count.
2299         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2300         R_SPARC_JMP_IREL to switch.
2301         (Target_sparc::Scan::check_non_pic): Likewise.
2302         (Target_sparc::Scan::local): Handle IFUNC symbols.
2303         (Target_sparc::Scan::local): Likewise.
2304         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2305         and plt_address_for_local.
2306         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2307         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2308
2309         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2310         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2311         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2312         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2313         global relocs too.
2314         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2315         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2316         calls.
2317         * sparc.cc (Target_sparc::Scan::global): Likewise.
2318         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2319
2320 2012-04-16  Cary Coutant  <ccoutant@google.com>
2321
2322         * archive.cc (Library_base::should_include_member): Check for
2323         --export-dynamic-symbol.
2324         * options.h (class General_options): Add --export-dynamic-symbol.
2325         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2326         --export-dynamic-symbol.
2327         (Symbol_table::gc_mark_undef_symbols): Likewise.
2328         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2329
2330 2012-04-12  David S. Miller  <davem@davemloft.net>
2331
2332         * sparc.cc (Reloc::wdisp10): New relocation method.
2333         (Reloc::h34): Likewise.
2334         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2335         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2336         R_SPARC_WDISP10.
2337         (Target_sparc::Scan::local): Likewise.
2338         (Target_sparc::Scan::global): Likewise.
2339         (Target_sparc::Relocate::relocate): Likewise.
2340
2341 2012-04-09  Cary Coutant  <ccoutant@google.com>
2342
2343         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2344         low_pc == 0.
2345
2346 2012-04-06  Ian Lance Taylor  <iant@google.com>
2347
2348         * timer.cc: #include <unistd.h>.
2349
2350 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2351
2352         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2353         * config.in: Regenerate.
2354         * configure: Regenerate.
2355
2356 2012-04-05  Nick Clifton  <nickc@redhat.com>
2357
2358         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2359         (AM_LC_MESSAGES): Add.
2360         * aclocal.m4: Regenerate.
2361         * config.in: Regenerate.
2362         * configure: Regenerate.
2363
2364 2012-03-21  Cary Coutant  <ccoutant@google.com>
2365
2366         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2367         * Makefile.in: Regenerate.
2368         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2369         (Sized_elf_reloc_mapper::symbol_section): New function.
2370         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2371         (make_elf_reloc_mapper): New function.
2372         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2373         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2374         (Dwarf_abbrev_table::do_get_abbrev): New function.
2375         (Dwarf_ranges_table::read_ranges_table): New function.
2376         (Dwarf_ranges_table::read_range_list): New function.
2377         (Dwarf_pubnames_table::read_section): New function.
2378         (Dwarf_pubnames_table::read_header): New function.
2379         (Dwarf_pubnames_table::next_name): New function.
2380         (Dwarf_die::Dwarf_die): New function.
2381         (Dwarf_die::read_attributes): New function.
2382         (Dwarf_die::skip_attributes): New function.
2383         (Dwarf_die::set_name): New function.
2384         (Dwarf_die::set_linkage_name): New function.
2385         (Dwarf_die::attribute): New function.
2386         (Dwarf_die::string_attribute): New function.
2387         (Dwarf_die::int_attribute): New function.
2388         (Dwarf_die::uint_attribute): New function.
2389         (Dwarf_die::ref_attribute): New function.
2390         (Dwarf_die::child_offset): New function.
2391         (Dwarf_die::sibling_offset): New function.
2392         (Dwarf_info_reader::check_buffer): New function.
2393         (Dwarf_info_reader::parse): New function.
2394         (Dwarf_info_reader::do_parse): New function.
2395         (Dwarf_info_reader::do_read_string_table): New function.
2396         (Dwarf_info_reader::lookup_reloc): New function.
2397         (Dwarf_info_reader::get_string): New function.
2398         (Dwarf_info_reader::visit_compilation_unit): New function.
2399         (Dwarf_info_reader::visit_type_unit): New function.
2400         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2401         Sized_elf_reloc_mapper.
2402         (Sized_dwarf_line_info::symbol_section): Remove function.
2403         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2404         (Sized_dwarf_line_info::read_line_mappings): Remove object
2405         parameter, adjust callers.
2406         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2407         * dwarf_reader.h: Include <sys/types.h>.
2408         (class Track_relocs): Remove forward declaration.
2409         (class Elf_reloc_mapper): New class.
2410         (class Sized_elf_reloc_mapper): New class.
2411         (class Dwarf_abbrev_table): New class.
2412         (class Dwarf_range_list): New class.
2413         (class Dwarf_ranges_table): New class.
2414         (class Dwarf_pubnames_table): New class.
2415         (class Dwarf_die): New class.
2416         (class Dwarf_info_reader): New class.
2417         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2418         (Sized_dwarf_line_info::symbol_section): Remove member function.
2419         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2420         base class.
2421         * gdb-index.cc: New source file.
2422         * gdb-index.h: New source file.
2423         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2424         and .debug_types sections, call Layout::add_to_gdb_index.
2425         (Sized_relobj_incr::do_section_name): Implement.
2426         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2427         return type; Implement.
2428         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2429         return type.
2430         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2431         parameter list and return type.
2432         (Sized_incr_dynobj::do_section_contents): Likewise.
2433         * layout.cc: Include gdb-index.h.
2434         (Layout::Layout): Initialize gdb_index_data_.
2435         (Layout::init_fixed_output_section): Check for .gdb_index section.
2436         (Layout::add_to_gdb_index): New function. Instantiate.
2437         * layout.h: Add forward declaration for class Gdb_index.
2438         (Layout::add_to_gdb_index): New member function.
2439         (Layout::gdb_index_data_): New data member.
2440         * main.cc: Include gdb-index.h.
2441         (main): Print statistics for gdb index.
2442         * object.cc (Object::section_contents): Move code into
2443         do_section_contents.
2444         (need_decompressed_section): Check for sections needed when building
2445         gdb index.
2446         (build_compressed_section_map): Likewise.
2447         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2448         gdb index.
2449         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2450         sections; call Layout::add_to_gdb_index.
2451         (Sized_relobj_file::do_decompressed_section_contents): Call
2452         do_section_contents directly.
2453         * object.h (Object::do_section_contents): Adjust parameter list and
2454         return type.
2455         (Object::do_decompressed_section_contents): Call do_section_contents
2456         directly.
2457         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2458         return type.
2459         * options.h (class General_options): Add --gdb-index option.
2460         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2461         list and return type.
2462         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2463         * reloc.h (Track_relocs::checkpoint): New function.
2464         (Track_relocs::reset): New function.
2465
2466         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2467         New test cases.
2468         * testsuite/Makefile.in: Regenerate.
2469         * testsuite/gdb_index_test.cc: New test source file.
2470         * testsuite/gdb_index_test_1.sh: New test source file.
2471         * testsuite/gdb_index_test_2.sh: New test source file.
2472
2473 2012-03-19  Doug Kwan  <dougkwan@google.com>
2474
2475         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2476         (Target_arm::do_finalize_sections): Remove code which defines
2477         __exidx_start and __exidx_end.  Make symbol table parameter
2478         anonymous as it is not used.
2479         * gold.cc (queue_middle_tasks): Call target hook to define any
2480         target-specific symbols.
2481         * target.h (Target::define_standard_symbols): New method.
2482         (Target::do_define_standard_symbols): Same.
2483         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2484         * testsuite/Makefile.in: Regenerate.
2485         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2486         and __exidx_end.
2487         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2488         relocations are generated for __exidx_start and __exidx_end.
2489
2490 2012-03-16  Doug Kwan  <dougkwan@google.com>
2491
2492         * testsuite/Makefile.am: Disable test initpri3b.
2493         * testsuite/Makefile.in: Regenerate.
2494
2495 2012-03-15  Doug Kwan  <dougkwan@google.com>
2496
2497         * arm.cc (Target_arm::got_section): Make .got section read-only
2498         if -z now is given.
2499
2500 2012-03-15  Ian Lance Taylor  <iant@google.com>
2501
2502         PR gold/13850
2503         * layout.cc (Layout::make_output_section): Correctly mark
2504         SHT_INIT_ARRAY, et. al., as relro.
2505
2506 2012-03-14  Doug Kwan  <dougkwan@google.com>
2507
2508         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2509         dynamic relocations for protected symbols in shared objects.
2510
2511 2012-03-13  Ian Lance Taylor  <iant@google.com>
2512
2513         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2514         keep the larger alignment.
2515
2516 2012-03-12  Cary Coutant  <ccoutant@google.com>
2517
2518         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2519         handling of DW_LNE_define_file.
2520
2521 2012-03-12  Cary Coutant  <ccoutant@google.com>
2522
2523         * reduced_debug_output.cc
2524         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2525         codes to switch.
2526
2527 2012-02-29  Cary Coutant  <ccoutant@google.com>
2528
2529         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2530
2531 2012-02-29  Cary Coutant  <ccoutant@google.com>
2532
2533         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2534         Call Object::decompressed_section_contents.
2535         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2536         New dtor.
2537         (Sized_dwarf_line_info::buffer_start_): New data member.
2538         * merge.cc (Output_merge_data::do_add_input_section): Call
2539         Object::decompressed_section_contents.
2540         (Output_merge_string::do_add_input_section): Likewise.
2541         * object.cc (need_decompressed_section): New function.
2542         (build_compressed_section_map): Decompress sections needed later.
2543         (Sized_relobj_file::do_decompressed_section_contents): New function.
2544         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2545         * object.h (Object::decompressed_section_contents): New function.
2546         (Object::discard_decompressed_sections): New function.
2547         (Object::do_decompressed_section_contents): New function.
2548         (Object::do_discard_decompressed_sections): New function.
2549         (Compressed_section_info): New type.
2550         (Compressed_section_map): Include decompressed section contents.
2551         (Sized_relobj_file::do_decompressed_section_contents): New function.
2552         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2553
2554 2012-02-16  Cary Coutant  <ccoutant@google.com>
2555
2556         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2557         * testsuite/Makefile.in: Regenerate.
2558
2559 2012-02-14  Cary Coutant  <ccoutant@google.com>
2560
2561         * options.cc (General_options::finalize): Disallow -pie and -static.
2562
2563 2012-02-03  Doug Kwan  <dougkwan@google.com>
2564
2565         * arm.cc (Arm_relocate_functions::abs8,
2566         Arm_relocate_functions::abs16): Use
2567         Bits::has_signed_unsigned_overflow32.
2568         (Arm_relocate_functions::thm_abs8): Correct range of
2569         overflow check.
2570         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2571         in assertions.
2572
2573 2012-02-02  Doug Kwan  <dougkwan@google.com>
2574
2575         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2576         position independent outputs, not just shared objects.
2577
2578 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2579
2580         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2581         * configure: Regenerated.
2582
2583 2012-01-27  Ian Lance Taylor  <iant@google.com>
2584
2585         * reloc.h (Bits): New class with static functions, copied from
2586         namespace utils in arm.cc.
2587         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2588         instead.
2589
2590 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2591
2592         * incremental.cc (write_info_blocks): Correct relocation offset.
2593
2594 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2595
2596         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2597         (Relocate::tls_gd_to_le): Likewise.
2598
2599 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2600
2601         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2602
2603 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2604
2605         * configure.ac: Check if -mcmodel=medium works.
2606         * configure: Regenerated.
2607
2608 2012-01-24  Cary Coutant  <ccoutant@google.com>
2609
2610         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2611         definition and ...
2612         (read_unsigned_LEB_128_x): ... this new function.
2613         (read_signed_LEB_128): Replaced with inline definition and ...
2614         (read_signed_LEB_128_x): ... this new function.
2615         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2616         (read_unsigned_LEB_128): Add inline definition.
2617         (read_signed_LEB_128_x): New function.
2618         (read_signed_LEB_128): Add inline definition.
2619         * testsuite/Makefile.am (leb128_unittest): New unit test.
2620         * testsuite/Makefile.in: Regenerate.
2621         * testsuite/leb128_unittest.cc: New unit test.
2622
2623 2012-01-23  Ian Lance Taylor  <iant@google.com>
2624
2625         PR gold/13617
2626         * i386.cc (Target_i386::do_code_fill): When using a jmp
2627         instruction, pad with nop instructions.
2628         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2629
2630 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2631
2632         * x86_64.cc (gc_process_relocs): Add typename on types used in
2633         template.
2634         (scan_relocs): Likewise.
2635         (relocate_section): Likewise.
2636         (apply_relocation): Likewise.
2637
2638 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2639
2640         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2641         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2642         under x32.
2643
2644 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2645
2646         * x86_64.cc: Initial support for x32.
2647
2648 2012-01-03  Cary Coutant  <ccoutant@google.com>
2649
2650         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2651         Use abstract base class for GOT.
2652         * gold/output.h (class Output_data_got_base): New abstract base class.
2653         (class Output_data_got): Derive from new base class, adjust ctors.
2654         (Output_data_got::reserve_slot): Make virtual; rename to
2655         do_reserve_slot; Adjust callers.
2656         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2657         pointer to abstract base class.
2658         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2659
2660 2011-12-18  Ian Lance Taylor  <iant@google.com>
2661
2662         * object.h (Relobj::local_symbol_value): New function.
2663         (Relobj::local_plt_offset): New function.
2664         (Relobj::local_has_got_offset): New function.
2665         (Relobj::local_got_offset): New function.
2666         (Relobj::set_local_got_offset): New function.
2667         (Relobj::do_local_symbol_value): New pure virtual function.
2668         (Relobj::do_local_plt_offset): Likewise.
2669         (Relobj::do_local_has_got_offset): Likewise.
2670         (Relobj::do_local_got_offset): Likewise.
2671         (Relobj::do_set_local_got_offset): Likewise.
2672         (Sized_relobj::do_local_has_got_offset): Rename from
2673         local_has_got_offset.
2674         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2675         (Sized_relobj::do_set_local_got_offset): Rename from
2676         set_local_got_offset.
2677         (Sized_relobj_file::do_local_plt_offset): Rename from
2678         local_plt_offset.
2679         (Sized_relobj_file::do_local_symbol_value): New function.
2680         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2681         local_plt_offset.
2682         * output.cc (Output_data_got::Got_entry::write): Change object to
2683         Relobj.  Use local_symbol_value.
2684         (Output_data_got::add_global_with_rel): Change rel_dyn to
2685         Output_data_reloc_generic*.  Use add_global_generic.
2686         (Output_data_got::add_global_with_rela): Remove.  Change all
2687         callers to use add_global_with_rel.
2688         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2689         Output_data_reloc_generic*.  Use add_global_generic.
2690         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2691         callers to use add_global_pair_with_rel.
2692         (Output_data_got::add_local): Change object to Relobj*.
2693         (Output_data_got::add_local_plt): Likewise.
2694         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2695         change rel_dyn to Output_data_reloc_generic*.  Use
2696         add_local_generic.
2697         (Output_data_got::add_local_with_rela): Remove.  Change all
2698         callers to use all_local_with_rel.
2699         (Output_data_got::add_local_pair_with_rel): Change object to
2700         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2701         add_output_section_generic.
2702         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2703         callers to use add_local_pair_with_rel.
2704         (Output_data_got::reserve_local): Change object to Relobj*.
2705         * output.h: (class Output_data_reloc_generic): Add pure virtual
2706         declarations for add_global_generic, add_local_generic,
2707         add_output_section_generic.
2708         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2709         functions for Output_data_reloc_generic.  Update declarations for
2710         changes listed in output.cc.
2711         (class Output_data_got): Change template parameter to got_size.
2712         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2713         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2714         function.
2715         (Sized_relobj_incr::do_local_plt_offset): New function.
2716         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2717         add_global_generic.
2718
2719 2011-12-17  Cary Coutant  <ccoutant@google.com>
2720
2721         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2722         * resolve.cc (Symbol_table::resolve): Likewise.
2723         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2724         arrays.
2725         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2726
2727 2011-12-16  Ian Lance Taylor  <iant@google.com>
2728
2729         * output.h (Output_data_reloc_generic::add): Only call
2730         add_dynamic_reloc if this is a dynamic reloc section.
2731
2732 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2733
2734         PR gold/13505
2735         * target-reloc.h (apply_relocation): Replace <64, false> with
2736         <size, big_endian>.
2737
2738 2011-11-25  Nick Clifton  <nickc@redhat.com>
2739
2740         * po/it.po: New Italian translation.
2741
2742 2011-11-17  Sterling Augustine  <saugustine@google.com>
2743
2744         * script.cc (script_include_directive): Implement.
2745         (read_script_file): New local variables name and search_path. Update
2746         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2747         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2748         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2749
2750 2011-11-11  Sterling Augustine  <saugustine@google.com>
2751
2752         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2753         (file_or_sections_cmd): Likewise.
2754
2755 2011-11-11  Doug Kwan  <dougkwan@google.com>
2756
2757         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2758         if --just-symbols is given.
2759
2760 2011-11-10  Doug Kwan  <dougkwan@google.com>
2761
2762         PR gold/13362
2763         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2764         when processing data relocs.
2765         * reloc.h (Relocate_functions::rel_unaligned): New method.
2766         (Relocate_functions::pcrel_unaligned): Ditto.
2767         (Relocate_functions::rel32_unaligned): Ditto.
2768         (Relocate_functions::pcrel32_unaligned): Ditto.
2769
2770 2011-11-09  Doug Kwan  <dougkwan@google.com>
2771
2772         PR gold/13362
2773         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2774         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2775         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2776         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2777         (Relocate_functions::rel_unaligned): New.
2778         (Relocate_functions::rel32_unaligned): New.
2779         * target-reloc.h (relocate_for_relocatable): Add code to handle
2780         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2781         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2782         arm_unaligned_reloc_r): New targets.
2783         * testsuite/Makefile.in: Regenerate.
2784         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2785         linking.
2786
2787 2011-11-02  Ian Lance Taylor  <iant@google.com>
2788
2789         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2790         NATIVE_LINKER.
2791         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2792         * options.cc (General_options::finalize): Use library search path
2793         from configure script if specified.  If not native and no sysroot,
2794         only search TOOLLIBDIR.
2795         * options.h (Search_directory::Search_directory): Change name to
2796         const std::string&.
2797         (General_options::add_to_library_path_with_sysroot): Change arg to
2798         const std::string&.
2799         * configure, Makefile.in, config.in: Rebuild.
2800
2801 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2802
2803         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2804         we are working around the ARM1176 Erratum.
2805         * options.h (General_options::fix_arm1176): Add option.
2806         * testsuite/Makefile.am: Add testcases, and keep current ones
2807         working.
2808         * testsuite/Makefile.in: Regenerate.
2809         * testsuite/arm_fix_1176.s: New file.
2810         * testsuite/arm_fix_1176.sh: Likewise.
2811
2812 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2813
2814         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2815         may_use_blx_.
2816         (Target_arm::may_use_blx): Remove method.
2817         (Target_arm::set_may_use_blx): Likewise.
2818         (Target_arm::may_use_v4t_interworking): New method.
2819         (Target_arm::may_use_v5t_interworking): Likewise.
2820         (Target_arm::may_use_blx_): Remove member variable.
2821         (Arm_relocate_functions::arm_branch_common): Check for v5T
2822         interworking.
2823         (Arm_relocate_functions::thumb_branch_common): Likewise.
2824         (Reloc_stub::stub_type_for_reloc): Likewise.
2825         (Target_arm::do_finalize_sections): Correct interworking checks.
2826         * testsuite/Makefile.am: Add new tests.
2827         * testsuite/Makefile.in: Regenerate.
2828         * testsuite/arm_farcall_arm_arm.s: New test.
2829         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2830         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2831         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2832         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2833         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2834         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2835         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2836
2837 2011-10-31  Cary Coutant  <ccoutant@google.com>
2838
2839         PR gold/13023
2840         * expression.cc (Expression::eval_with_dot): Add
2841         is_section_dot_assignment parameter.
2842         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2843         absolute and assigning to dot within a section.
2844         * script-sections.cc
2845         (Output_section_element_assignment::set_section_addresses): Pass
2846         dot_section to set_if_absolute.
2847         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2848         as is_section_dot_assignment flag to eval_with_dot.
2849         (Output_section_element_dot_assignment::set_section_addresses):
2850         Likewise.
2851         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2852         parameter.  Also set value if relative to dot_section; set the
2853         symbol's output_section.
2854         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2855         parameter.  Adjust all callers.
2856         (Expression::eval_maybe_dot): Likewise.
2857         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2858         Adjust all callers.
2859         * testsuite/script_test_2.t: Test assignment of an absolute value
2860         to dot within an output section element.
2861
2862 2011-10-31  Cary Coutant  <ccoutant@google.com>
2863
2864         * options.h (class General_options): Add --[no-]gnu-unique options.
2865         * symtab.cc (Symbol_table::sized_write_globals): Convert
2866         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2867
2868 2011-10-31  Cary Coutant  <ccoutant@google.com>
2869
2870         PR gold/13359
2871         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2872         unnecessary assertion.
2873         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2874
2875 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2876
2877         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2878         gc_mark_symbol.
2879         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2880         gc_mark_symbol.
2881         Change to just keep the section associated with symbol.
2882         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2883         they are externally visible and --export-dynamic is turned on.
2884         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2885
2886 2011-10-19  Ian Lance Taylor  <iant@google.com>
2887
2888         PR gold/13163
2889         * script-sections.cc
2890         (Output_section_element_dot_assignment::needs_output_section): New
2891         function.
2892
2893 2011-10-19  Ian Lance Taylor  <iant@google.com>
2894
2895         PR gold/13204
2896         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2897         --section-start option was seen.
2898         * options.h (General_options::any_section_start): New function.
2899
2900 2011-10-18  David S. Miller  <davem@davemloft.net>
2901
2902         PR binutils/13301
2903         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2904         member to track relocation locations that have moved during TLS
2905         reloc optimizations.
2906         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2907         (Target_sparc::Relocate::relocate): Adjust view down by 4
2908         bytes if it matches reloc_adjust_addr_.
2909         (Target_sparc::Relocate::relocate_tls): Always move the
2910         __tls_get_addr call delay slot instruction forward 4 bytes when
2911         performing relaxation.
2912
2913 2011-10-18  Cary Coutant  <ccoutant@google.com>
2914
2915         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2916         (Output_file::map_no_anonymous): Check for non-zero
2917         return code from posix_fallocate.
2918
2919 2011-10-17  Cary Coutant  <ccoutant@google.com>
2920
2921         PR gold/13245
2922         * plugin.cc (is_visible_from_outside): Check for symbols
2923         referenced from dynamic objects.
2924         * resolve.cc (Symbol_table::resolve): Don't count references
2925         from dynamic objects as references from real ELF files.
2926         * testsuite/plugin_test_2.sh: Adjust expected result.
2927
2928 2011-10-17  Cary Coutant  <ccoutant@google.com>
2929
2930         * gold.cc: Include timer.h.
2931         (queue_middle_tasks): Stamp time.
2932         (queue_final_tasks): Likewise.
2933         * main.cc (main): Store timer in parameters.  Print timers
2934         for each pass.
2935         * parameters.cc (Parameters::Parameters): Initialize timer_.
2936         (Parameters::set_timer): New function.
2937         (set_parameters_timer): New function.
2938         * parameters.h (Parameters::set_timer): New function.
2939         (Parameters::timer): New function.
2940         (Parameters::timer_): New data member.
2941         (set_parameters_timer): New function.
2942         * timer.cc (Timer::stamp): New function.
2943         (Timer::get_pass_time): New function.
2944         * timer.h (Timer::stamp): New function.
2945         (Timer::get_pass_time): New function.
2946         (Timer::pass_times_): New data member.
2947
2948 2011-10-17  Cary Coutant  <ccoutant@google.com>
2949
2950         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2951         task for members of lib groups.
2952
2953 2011-10-17  Cary Coutant  <ccoutant@google.com>
2954
2955         PR gold/13288
2956         * fileread.cc (File_read::find_view): Add assert.
2957         (File_read::make_view): Move bounds check (replace with assert)...
2958         (File_read::find_or_make_view): ... to here.
2959
2960 2011-10-12  Cary Coutant  <ccoutant@google.com>
2961
2962         * output.cc (Output_file::open_base_file): Handle case where
2963         ::read returns less than requested size.
2964
2965 2011-10-10  Cary Coutant  <ccoutant@google.com>
2966
2967         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2968         Initialize defined_count_.
2969         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2970         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2971         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2972         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2973         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2974         * incremental.h (Sized_relobj_incr::defined_count_): New data
2975         member.
2976         (Sized_incr_dynobj::defined_count_): New data member.
2977         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2978         Return zeroes instead of internal error.
2979
2980 2011-10-10  Cary Coutant  <ccoutant@google.com>
2981
2982         PR gold/13249
2983         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2984         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2985         * output.h (class Output_reloc): Add use_plt_offset flag.
2986         (Output_reloc::type_): Adjust size of bit field.
2987         (Output_reloc::use_plt_offset_): New bit field.
2988         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2989         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2990         flag.  Adjust all callers.
2991         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2992         creating RELATIVE relocations.
2993
2994 2011-10-10  Nick Clifton  <nickc@redhat.com>
2995
2996         * po/es.po: Updated Spanish translation.
2997         * po/fi.po: Updated Finnish translation.
2998
2999 2011-10-03   Diego Novillo  <dnovillo@google.com>
3000
3001         * options.cc (parse_uint): Fix dereference of RETVAL.
3002
3003 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3004
3005         * layout.h (section_order_map_): New member.
3006         (get_section_order_map): New member function.
3007         * output.cc (Output_section::add_input_section): Check for patterns
3008         only when --section-ordering-file is specified.
3009         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3010         output_sections have been formed.
3011         * layout.cc (Layout_Layout): Initialize section_order_map_.
3012         * plugin.cc (update_section_order): Store order in order_map. Do not
3013         update the order.
3014         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3015         * testsuite/Makefile.in: Regenerate.
3016         * testsuite/plugin_section_order.c: New file.
3017         * testsuite/plugin_final_layout.cc: New file.
3018         * testsuite/plugin_final_layout.sh: New file.
3019
3020 2011-09-29  Cary Coutant  <ccoutant@google.com>
3021
3022         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3023         Check for NULL.
3024         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3025         symbols during incremental update.
3026         (Symbol_table::add_from_dynobj): Likewise.
3027
3028 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3029             Ian Lance Taylor  <iant@google.com>
3030
3031         * symtab.cc (Symbol_table::define_special_symbol): Always
3032         canonicalize version string.
3033
3034 2011-09-26  Cary Coutant  <ccoutant@google.com>
3035
3036         * gold.cc (queue_initial_tasks): Move option checks ...
3037         * options.cc (General_options::finalize): ... to here. Disable
3038         some options; make others fatal.
3039
3040 2011-09-26  Cary Coutant  <ccoutant@google.com>
3041
3042         gcc PR lto/47247
3043         * plugin.cc (get_symbols_v2): New function.
3044         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3045         (is_referenced_from_outside): New function.
3046         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3047         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3048         (get_symbols): Pass version parameter.
3049         (get_symbols_v2): New function.
3050         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3051         parameter.
3052         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3053         (onload): Add LDPT_GET_SYMBOLS_V2.
3054         (all_symbols_read_hook): Use get_symbols_v2; check for
3055         LDPR_PREVAILING_DEF_IRONLY_EXP.
3056         * testsuite/plugin_test_3.sh: Update expected results.
3057
3058 2011-09-23  Simon Baldwin  <simonb@google.com>
3059
3060         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3061         configuration options.
3062         * configure: Regenerate.
3063         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3064         * Makefile.in: Regenerate.
3065         * testsuite/Makefile.in: Regenerate.
3066
3067 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3068
3069         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3070
3071 2011-09-19  Cary Coutant  <ccoutant@google.com>
3072
3073         * incremental.cc (can_incremental_update): Fix typo in comment.
3074         * incremental.h (can_incremental_update): Likewise.
3075
3076 2011-09-18  Cary Coutant  <ccoutant@google.com>
3077
3078         * incremental.cc (can_incremental_update): New function.
3079         * incremental.h (can_incremental_update): New function.
3080         * layout.cc (Layout::init_fixed_output_section): Call it.
3081         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3082         * object.cc (Sized_relobj_file::do_layout): Call
3083         can_incremental_update.
3084
3085 2011-09-13  Cary Coutant  <ccoutant@google.com>
3086
3087         * configure.ac: Check for glibc support for gnu_indirect_function
3088         support with static linking, setting automake conditional
3089         IFUNC_STATIC.
3090         * Makefile.in: Regenerate.
3091         * configure: Regenerate.
3092
3093         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3094         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3095         for IFUNC_STATIC.
3096         * testsuite/Makefile.in: Regenerate.
3097
3098 2011-09-13  Cary Coutant  <ccoutant@google.com>
3099
3100         * incremental.cc (Sized_relobj_incr::do_layout): Call
3101         report_comdat_group for kept comdat sections.
3102         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3103         * testsuite/Makefile.in: Regenerate.
3104         * testsuite/incr_comdat_test_1.cc: New source file.
3105         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3106         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3107         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3108
3109 2011-09-13  Ian Lance Taylor  <iant@google.com>
3110
3111         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3112         variable external_symbols_offset.
3113
3114 2011-09-12  Ian Lance Taylor  <iant@google.com>
3115
3116         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3117         triggered if object has no symbols.
3118
3119 2011-09-09  David S. Miller  <davem@davemloft.net>
3120
3121         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3122         (Output_fill_debug_line::do_write): Likewise.
3123
3124 2011-08-29  Cary Coutant  <ccoutant@google.com>
3125
3126         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3127         casts to match formatting specs.
3128         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3129
3130 2011-08-26  Cary Coutant  <ccoutant@google.com>
3131
3132         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3133         remaining hole size when allocating.
3134         (Layout::make_output_section): Set fill methods for debug sections.
3135         * layout.h (Free_list::Free_list_node): Move from private to
3136         public.
3137         (Free_list::set_min_hole_size): New function.
3138         (Free_list::begin, Free_list::end): New functions.
3139         (Free_list::min_hole_): New data member.
3140         * output.cc: Include dwarf.h.
3141         (Output_fill_debug_info::do_minimum_hole_size): New function.
3142         (Output_fill_debug_info::do_write): New function.
3143         (Output_fill_debug_line::do_minimum_hole_size): New function.
3144         (Output_fill_debug_line::do_write): New function.
3145         (Output_section::Output_section): Initialize new data member.
3146         (Output_section::set_final_data_size): Ensure patch space is larger
3147         than minimum hole size.
3148         (Output_section::do_write): Fill holes in debug sections.
3149         * output.h (Output_fill): New class.
3150         (Output_fill_debug_info): New class.
3151         (Output_fill_debug_line): New class.
3152         (Output_section::set_free_space_fill): New function.
3153         (Output_section::free_space_fill_): New data member.
3154         * testsuite/Makefile.am (incremental_test_3): Add
3155         --incremental-patch option.
3156         (incremental_test_4): Likewise.
3157         (incremental_test_5): Likewise.
3158         (incremental_test_6): Likewise.
3159         (incremental_copy_test): Likewise.
3160         (incremental_common_test_1): Likewise.
3161         * testsuite/Makefile.in: Regenerate.
3162
3163 2011-08-26  Nick Clifton  <nickc@redhat.com>
3164
3165         * po/es.po: Updated Spanish translation.
3166
3167 2011-08-01  Cary Coutant  <ccoutant@google.com>
3168
3169         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3170         * gold/testsuite/Makefile.in: Regenerate.
3171         * gold/testsuite/justsyms_exec.c: New source file.
3172         * gold/testsuite/justsyms_lib.c: New source file.
3173
3174 2011-08-01  Cary Coutant  <ccoutant@google.com>
3175
3176         * layout.cc (Layout::set_segment_offsets): Don't realign text
3177         segment if -Ttext was specified.
3178         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3179         file type.
3180         * object.h (Sized_relobj_file::e_type): New function.
3181         (Sized_relobj_file::e_type_): New data member.
3182         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3183         base address for ET_EXEC files.
3184         * target.cc (Target::do_make_elf_object_implementation): Allow
3185         ET_EXEC files with --just-symbols option.
3186
3187 2011-07-28  Cary Coutant  <ccoutant@google.com>
3188
3189         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3190         Add thread_number parameter.
3191         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3192         * workqueue-threads.cc
3193         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3194         current thread if its thread number is greater than desired thread
3195         count.
3196         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3197         Add thread_number parameter.
3198         (Workqueue::should_cancel_thread): Likewise.
3199         (Workqueue::find_runnable_or_wait): Pass thread_number to
3200         should_cancel_thread.
3201         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3202         parameter.
3203
3204 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3205
3206         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3207         only after checking if it cannot be forced local.
3208         * symtab.h (is_externally_visible): Check if the symbol is not forced
3209         local.
3210
3211 2011-07-15  Ian Lance Taylor  <iant@google.com>
3212
3213         * options.h (class General_options): Add --print-output-format.
3214         Move -EL next to -EB, for  better --help output.
3215         * target-select.cc: Include <cstdio>, "options.h", and
3216         "parameters.h".
3217         (Target_selector::do_target_bfd_name): New function.
3218         (print_output_format): New function.
3219         * target-select.h (class Target_selector): Update declarations.
3220         (Target_selector::target_bfd_name): New function.
3221         (print_output_format): Declare.
3222         * main.cc: Include "target-select.h".
3223         (main): Handle --print-output-format.
3224         * gold.cc: Include "target-select.h".
3225         (queue_initial_tasks): Handle --print-output-format when there are
3226         no input files.
3227         * parameters.cc (parameters_force_valid_target): Give a better
3228         error message if -EB/-EL does not match target.
3229         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3230         function.
3231
3232 2011-07-15  Ian Lance Taylor  <iant@google.com>
3233
3234         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3235         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3236         (Output_data_plt_i386::do_write): Write address of .dynamic
3237         section to first entry in .got.plt section.
3238         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3239         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3240         Initialize layout_.
3241         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3242         section to first entry in .got.plt section.
3243         * layout.h (Layout::dynamic_section): New function.
3244
3245 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3246
3247         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3248         to claim_file call.
3249         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3250         input_section_position_, and input_section_glob_.
3251         (read_layout_from_file): Call function section_ordering_specified.
3252         * layout.h (is_section_ordering_specified): New function.
3253         (section_ordering_specified): New function.
3254         (section_ordering_specified_): New boolean member.
3255         * main.cc(main): Call load_plugins after layout object is defined.
3256         * output.cc (Output_section::add_input_section): Use
3257         function section_ordering_specified to check if section ordering is
3258         needed.
3259         * output.cc (Output_section::add_relaxed_input_section): Use
3260         function section_ordering_specified to check if section ordering is
3261         needed.
3262         (Output_section::update_section_layout): New function.
3263         (Output_section::sort_attached_input_sections): Check if input section
3264         must be reordered.
3265         * output.h (Output_section::update_section_layout): New function.
3266         * plugin.cc (get_section_count): New function.
3267         (get_section_type): New function.
3268         (get_section_name): New function.
3269         (get_section_contents): New function.
3270         (update_section_order): New function.
3271         (allow_section_ordering): New function.
3272         (Plugin::load): Add the new interfaces to the transfer vector.
3273         (Plugin_manager::load_plugins): New parameter.
3274         (Plugin_manager::all_symbols_read): New parameter.
3275         (Plugin_manager::claim_file): New parameter. Save the elf object for
3276         unclaimed objects.
3277         (Plugin_manager::get_elf_object): New function.
3278         (Plugin_manager::get_view): Change to directly use the bool to check
3279         if get_view is called from claim_file_hook.
3280         * plugin.h (input_objects): New function
3281         (Plugin__manager::load_plugins): New parameter.
3282         (Plugin_manager::claim_file): New parameter.
3283         (Plugin_manager::get_elf_object): New function.
3284         (Plugin_manager::in_claim_file_handler): New function.
3285         (Plugin_manager::in_claim_file_handler_): New member.
3286         (layout): New function.
3287         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3288         handler with an extra parameter. Make the elf object before calling
3289         claim_file handler.
3290         * testsuite/plugin_test.c (get_section_count): New function pointer.
3291         (get_section_type): New function pointer.
3292         (get_section_name): New function pointer.
3293         (get_section_contents): New function pointer.
3294         (update_section_order): New function pointer.
3295         (allow_section_ordering): New function pointer.
3296         (onload): Check if the new interfaces exist.
3297
3298 2011-07-13  Ian Lance Taylor  <iant@google.com>
3299
3300         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3301         relro section.
3302         * x86_64.cc (Target_x86_64::got_section): Likewise.
3303         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3304         (relro_now_test_SOURCES): New variable.
3305         (relro_now_test_DEPENDENCIES): New variable.
3306         (relro_now_test_LDFLAGS): New variable.
3307         (relro_now_test_LDADD): New variable.
3308         (relro_now_test.so): New target.
3309         * testsuite/Makefile.in: Rebuild.
3310
3311 2011-07-12  Ian Lance Taylor  <iant@google.com>
3312
3313         PR gold/12980
3314         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3315         GLOB_DAT relocation rather than a RELATIVE relocation for a
3316         protected symbol when creating a shared library.
3317         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3318         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3319         * testsuite/protected_main_1.cc (main): Test that protected
3320         function has same address.
3321
3322 2011-07-11  Ian Lance Taylor  <iant@google.com>
3323
3324         PR gold/12979
3325         * options.h (class General_options): Add -Bgroup.
3326         * options.cc (General_options::finalize): If -Bgroup is set,
3327         default to --unresolved-symbols=report-all.
3328         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3329         * target-reloc.h (issue_undefined_symbol_error): Handle
3330         --unresolved-symbols=report-all.
3331
3332 2011-07-08  Ian Lance Taylor  <iant@google.com>
3333
3334         PR gold/11985
3335         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3336         if linker script discards key sections.
3337         (Layout::create_dynamic_symtab): Likewise.
3338         (Layout::assign_local_dynsym_offsets): Likewise.
3339         (Layout::sized_create_version_sections): Likewise.
3340         (Layout::create_interp): Likewise.
3341         (Layout::finish_dynamic_section): Likewise.
3342         (Layout::set_dynamic_symbol_size): Likewise.
3343
3344 2011-07-08  Ian Lance Taylor  <iant@google.com>
3345
3346         PR gold/12386
3347         * options.h (class General_options): Add --unresolved-symbols.
3348         * target-reloc.h (issue_undefined_symbol_error): Check
3349         --unresolved-symbols.  Add comments.
3350
3351 2011-07-08  Ian Lance Taylor  <iant@google.com>
3352
3353         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3354         expression more complex.
3355
3356 2011-07-08  Ian Lance Taylor  <iant@google.com>
3357
3358         PR gold/11317
3359         * target-reloc.h (issue_undefined_symbol_error): New inline
3360         function, broken out of relocate_section.
3361         (relocate_section): Call issue_undefined_symbol_error.
3362         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3363         there is no TLS segment if we are about to issue an undefined
3364         symbol error.
3365         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3366
3367 2011-07-08  Ian Lance Taylor  <iant@google.com>
3368
3369         PR gold/12279
3370         * resolve.cc (Symbol_table::should_override): Add fromtype
3371         parameter.  Change all callers.  Give error when linking together
3372         TLS and non-TLS symbol.
3373         (Symbol_table::should_override_with_special): Add fromtype
3374         parameter.  Change all callers.
3375         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3376         there is no TLS segment if we have reported some errors.
3377         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3378
3379 2011-07-08  Ian Lance Taylor  <iant@google.com>
3380
3381         PR gold/12372
3382         * target.h (Target::plt_address_for_global): New function.
3383         (Target::plt_address_for_local): New function.
3384         (Target::plt_section_for_global): Remove.
3385         (Target::plt_section_for_local): Remove.
3386         (Target::do_plt_address_for_global): New virtual function.
3387         (Target::do_plt_address_for_local): New virtual function.
3388         (Target::do_plt_section_for_global): Remove.
3389         (Target::do_plt_section_for_local): Remove.
3390         (Target::register_global_plt_entry): Add Symbol_table and Layout
3391         parameters.
3392         * output.cc (Output_data_got::Got_entry::write): Use
3393         plt_address_for_global and plt_address_for_local.
3394         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3395         address of output section.
3396         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3397         got_irelative_, and irelative_count_ fields.  Update
3398         declarations.
3399         (Output_data_plt_i386::has_irelative_section): New function.
3400         (Output_data_plt_i386::entry_count): Add irelative_count_.
3401         (Output_data_plt_i386::set_final_data_size): Likewise.
3402         (class Target_i386): Add got_irelative_ and rel_irelative_
3403         fields.  Update declarations.
3404         (Target_i386::Target_i386): Initialize new fields.
3405         (Target_i386::do_plt_address_for_global): New function replacing
3406         do_plt_section_for_global.
3407         (Target_i386::do_plt_address_for_local): New function replacing
3408         do_plt_section_for_local.
3409         (Target_i386::got_section): Create got_irelative_.
3410         (Target_i386::rel_irelative_section): New function.
3411         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3412         fields.  Don't define __rel_iplt_{start,end}.
3413         (Output_data_plt_i386::add_entry): Add symtab and layout
3414         parameters.  Change all callers.  Use different PLT and GOT for
3415         IFUNC symbols.
3416         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3417         layout parameters.  Change all callers.  Use different PLT and
3418         GOT.
3419         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3420         (Output_data_plt_i386::rel_irelative): New function.
3421         (Output_data_plt_i386::address_for_global): New function.
3422         (Output_data_plt_i386::address_for_local): New function.
3423         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3424         IRELATIVE GOT when changing IFUNC GOT entries.
3425         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3426         reloc.
3427         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3428         if we didn't create an IRELATIVE GOT.
3429         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3430         plt_address_for_local.
3431         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3432         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3433         got_irelative_, and irelative_count_ fields.  Update
3434         declarations.
3435         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3436         Initialize new fields.  Remove symtab parameter.  Change all
3437         callers.
3438         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3439         irelative_count_.
3440         (Output_data_plt_x86_64::has_irelative_section): New function.
3441         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3442         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3443         fields.  Update declarations.
3444         (Target_x86_64::Target_x86_64): Initialize new fields.
3445         (Target_x86_64::do_plt_address_for_global): New function replacing
3446         do_plt_section_for_global.
3447         (Target_x86_64::do_plt_address_for_local): New function replacing
3448         do_plt_section_for_local.
3449         (Target_x86_64::got_section): Create got_irelative_.
3450         (Target_x86_64::rela_irelative_section): New function.
3451         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3452         all callers.  Don't create __rel_iplt_{start,end}.
3453         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3454         parameters.  Change all callers.  Use different PLT and GOT for
3455         IFUNC symbols.
3456         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3457         layout parameters.  Change all callers.  Use different PLT and
3458         GOT.
3459         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3460         parameters.  Change all callers.  Use different PLT and GOT for
3461         IFUNC symbols.
3462         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3463         (Output_data_plt_x86_64::rela_irelative): New function.
3464         (Output_data_plt_x86_64::address_for_global): New function.
3465         (Output_data_plt_x86_64::address_for_local): New function.
3466         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3467         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3468         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3469         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3470         parameters.
3471         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3472         reloc.
3473         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3474         symbols if we didn't create an IRELATIVE GOT.
3475         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3476         plt_address_for_local.
3477         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3478         * testsuite/ifuncvar1.c: New test file.
3479         * testsuite/ifuncvar2.c: New test file.
3480         * testsuite/ifuncvar3.c: New test file.
3481         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3482         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3483         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3484         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3485         * testsuite/Makefile.in: Rebuild.
3486
3487 2011-07-07  Cary Coutant  <ccoutant@google.com>
3488
3489         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3490         (two_file_test_1_ndebug.o): Likewise.
3491         (two_file_test_1b_ndebug.o): Likewise.
3492         (two_file_test_2_ndebug.o): Likewise.
3493         (two_file_test_main_ndebug.o): Likewise.
3494         (incremental_test_2): Link with no-debug versions.
3495
3496 2011-07-06  Cary Coutant  <ccoutant@google.com>
3497
3498         * gold/incremental.cc
3499         (Output_section_incremental_inputs::write_info_blocks): Check for
3500         hidden and internal symbols.
3501
3502 2011-07-06  Cary Coutant  <ccoutant@google.com>
3503
3504         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3505         Check disposition for startup file.
3506         (Incremental_inputs::report_command_line): Ignore
3507         --incremental-startup-unchanged option.
3508         * options.cc (General_options::parse_incremental_startup_unchanged):
3509         New function.
3510         (General_options::General_options): Initialize new data member.
3511         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3512         (General_options): Add --incremental-startup-unchanged option.
3513         (General_options::incremental_startup_disposition): New function.
3514         (General_options::incremental_startup_disposition_): New data member.
3515
3516 2011-07-06  Cary Coutant  <ccoutant@google.com>
3517
3518         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3519         input file index to Script_info ctor.
3520         (Sized_incremental_binary::do_file_has_changed): Find the
3521         command-line argument for files named in scripts.
3522         * incremental.h (Script_info::Script_info): New ctor
3523         with input file index.
3524         (Script_info::input_file_index): New function.
3525         (Script_info::input_file_index_): New data member.
3526         (Incremental_binary::get_library): Add const.
3527         (Incremental_binary::get_script_info): Add const.
3528         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3529         * testsuite/Makefile.am (incremental_test_5): New test case.
3530         (incremental_test_6): New test case.
3531         * testsuite/Makefile.in: Regenerate.
3532
3533 2011-07-06  Cary Coutant  <ccoutant@google.com>
3534
3535         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3536         debug output when command lines differ.
3537
3538 2011-07-06  Cary Coutant  <ccoutant@google.com>
3539
3540         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3541         --incremental-patch option.
3542         * layout.cc (Free_list::allocate): Extend allocation beyond original
3543         end if enabled.
3544         (Layout::make_output_section): Mark sections that should get
3545         patch space.
3546         * options.cc (parse_percent): New function.
3547         * options.h (parse_percent): New function.
3548         (DEFINE_percent): New macro.
3549         (General_options): Add --incremental-patch option.
3550         * output.cc (Output_section::Output_section): Initialize new data
3551         members.
3552         (Output_section::add_input_section): Print section name when out
3553         of patch space.
3554         (Output_section::add_output_section_data): Likewise.
3555         (Output_section::set_final_data_size): Add patch space when
3556         doing --incremental-full.
3557         (Output_section::do_reset_address_and_file_offset): Remove patch
3558         space.
3559         (Output_segment::set_section_list_addresses): Print debug output
3560         only if --incremental-update.
3561         * output.h (Output_section::set_is_patch_space_allowed): New function.
3562         (Output_section::is_patch_space_allowed_): New data member.
3563         (Output_section::patch_space_): New data member.
3564         * parameters.cc (Parameters::incremental_full): New function.
3565         * parameters.h (Parameters::incremental_full): New function
3566         * testsuite/Makefile.am (incremental_test_2): Add test for
3567         --incremental-patch option.
3568         * testsuite/Makefile.in: Regenerate.
3569         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3570         (t18): Remove function body.
3571
3572 2011-07-05  Doug Kwan  <dougkwan@google.com>
3573
3574         PR gold/12771
3575         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3576         Arm_Address type for relocation result.
3577         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3578         overflow check.
3579         (Arm_relocate_functions::abs32): Use unaligned access.
3580         (Arm_relocate_functions::rel32): Ditto.
3581         (Arm_relocate_functions::prel31): Ditto.
3582         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3583         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3584         static data relocations.
3585         * testsuite/Makefile.in: Regnerate.
3586         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3587
3588 2011-07-05  Ian Lance Taylor  <iant@google.com>
3589
3590         PR gold/12392
3591         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3592         symbols if necessary.
3593         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3594
3595 2011-07-05  Ian Lance Taylor  <iant@google.com>
3596
3597         PR gold/12952
3598         * resolve.cc (Symbol::override_base_with_special): Simply override
3599         version with special symbol version, ignoring previous version.
3600
3601 2011-07-05  Ian Lance Taylor  <iant@google.com>
3602
3603         * object.cc (Sized_relobj_file::include_section_group): Add
3604         information to comment about signature location.
3605
3606 2011-07-02  Ian Lance Taylor  <iant@google.com>
3607
3608         PR gold/12957
3609         * options.h (class General_options): Add -f and -F.
3610         * options.cc (General_options::finalize): Fatal error if -f/-F
3611         are used without -shared.
3612         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3613
3614 2011-07-02  Ian Lance Taylor  <iant@google.com>
3615
3616         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3617
3618 2011-07-01  Ian Lance Taylor  <iant@google.com>
3619
3620         PR gold/12525
3621         PR gold/12952
3622         * resolve.cc (Symbol::override_base_with_special): Don't override
3623         the version if the overriding symbol has a different name.
3624         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3625         all callers.  If we give an error about an undefined version,
3626         define the base version if necessary.
3627         * dynobj.h (class Versions): Update declaration.
3628         * testsuite/weak_alias_test_5.cc: New file.
3629         * testsuite/weak_alias_test.script: New file.
3630         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3631         and versioned_alias have the right value, and call t2.
3632         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3633         weak_alias_test_5.so.
3634         (weak_alias_test_LDADD): Likewise.
3635         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3636         * testsuite/Makefile.in: Rebuild.
3637
3638 2011-07-01  Ian Lance Taylor  <iant@google.com>
3639
3640         PR gold/12525
3641         * options.h (class General_options): Support -z notext.
3642         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3643         -Wl,-z,notext.
3644         (two_file_shared_nonpic.so): Likewise.
3645         (two_file_shared_mixed.so): Likewise.
3646         (two_file_shared_mixed_1.so): Likewise.
3647         (weak_undef_lib_nonpic.so): Likewise.
3648         (alt/weak_undef_lib_nonpic.so): Likewise.
3649         (tls_test_shared_nonpic.so): Likewise.
3650         * testsuite/Makefile.in: Rebuild.
3651
3652 2011-07-01  Ian Lance Taylor  <iant@google.com>
3653
3654         PR gold/12525
3655         * configure.ac: Test whether static linking works, setting
3656         the automake conditional HAVE_STATIC.
3657         * testsuite/Makefile.am: Disable tests using -static if
3658         HAVE_STATIC is not true.
3659         * configure, testsuite/Makefile.in: Rebuild.
3660
3661 2011-07-01  Ian Lance Taylor  <iant@google.com>
3662
3663         PR gold/12525
3664         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3665         Assert if we see DW_EH_PE_indirect.
3666         * target.h (Target::ehframe_datarel_base): New function.
3667         (Target::do_ehframe_datarel_base): New target function.
3668         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3669         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3670         function.
3671
3672 2011-07-01  Ian Lance Taylor  <iant@google.com>
3673
3674         PR gold/12571
3675         * options.h (class General_options): Add
3676         --ld-generated-unwind-info.
3677         * ehframe.cc (Fde::write): Add address parameter.  Change all
3678         callers.  If associated with PLT, fill in address and size.
3679         (Cie::set_output_offset): Only add merge mapping if there is an
3680         object.
3681         (Cie::write): Add address parameter.  Change all callers.
3682         (Eh_frame::add_ehframe_for_plt): New function.
3683         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3684         input_offset_ fields into union u_, with new plt field.
3685         (Fde::Fde): Adjust for new union field.
3686         (Fde::Fde) [Output_data version]: New constructor.
3687         (Fde::add_mapping): Only add merge mapping if there is an object.
3688         (class Cie): Update declarations.
3689         (class Eh_frame): Declare add_ehframe_for_plt.
3690         * layout.cc (Layout::layout_eh_frame): Break out code into
3691         make_eh_frame_section, and call it.
3692         (Layout::make_eh_frame_section): New function.
3693         (Layout::add_eh_frame_for_plt): New function.
3694         * layout.h (class Layout): Update declarations.
3695         * merge.cc (Merge_map::add_mapping): Add assertion.
3696         * i386.cc: Include "dwarf.h".
3697         (class Output_data_plt_i386): Make first_plt_entry,
3698         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3699         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3700         and plt_eh_frame_fde.
3701         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3702         boundary.  Call add_eh_frame_for_plt if appropriate.
3703         * x86_64.cc: Include "dwarf.h".
3704         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3705         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3706         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3707         and plt_eh_frame_fde.
3708         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3709         appropriate.
3710
3711 2011-06-29  Ian Lance Taylor  <iant@google.com>
3712
3713         PR gold/12629
3714         * object.cc (Sized_relobj_file::layout_section): Change shdr
3715         parameter to be const.
3716         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3717         out of do_layout.
3718         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3719         appropriate.  Call layout_eh_frame_section.
3720         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3721         sections.
3722         * object.h (class Sized_relobj_file): Update declarations.
3723
3724 2011-06-29  Ian Lance Taylor  <iant@google.com>
3725
3726         PR gold/12652
3727         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3728         modifier.
3729         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3730
3731 2011-06-29  Ian Lance Taylor  <iant@google.com>
3732
3733         PR gold/12675
3734         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3735         SHT_X86_64_UNWIND.
3736         * layout.cc (Layout::layout_eh_frame): Likewise.
3737
3738 2011-06-29  Ian Lance Taylor  <iant@google.com>
3739
3740         PR gold/12695
3741         * layout.cc (Layout::symtab_section_shndx): New function.
3742         * layout.h (class Layout): Declare symtab_section_shndx.
3743         * output.cc (Output_section::write_header): Call it.
3744
3745 2011-06-29  Ian Lance Taylor  <iant@google.com>
3746
3747         PR gold/12818
3748         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3749         symbols which are not used in a relocation.
3750
3751 2011-06-28  Ian Lance Taylor  <iant@google.com>
3752
3753         PR gold/12898
3754         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3755         script create indistinguishable segments.
3756         (Layout::set_segment_offsets): Use stable_sort when sorting
3757         segments.  Pass this to Compare_segments constructor.
3758         * layout.h (class Layout): Make segment_precedes non-static.
3759         (class Compare_segments): Change from struct to class.  Add
3760         layout_ field.  Add constructor.
3761         * script-sections.cc
3762         (Script_sections::attach_sections_using_phdrs_clause): Rename
3763         local orphan to is_orphan.  Don't report failure to put empty
3764         section in segment.  On attachment failure, report name of
3765         section, and attach to first PT_LOAD segment.
3766
3767 2011-06-28  Ian Lance Taylor  <iant@google.com>
3768
3769         PR gold/12934
3770         * target-select.cc (Target_selector::Target_selector): Add
3771         emulation parameter.  Change all callers.
3772         (select_target_by_bfd_name): Rename from select_target_by_name.
3773         Change all callers.
3774         (select_target_by_emulation): New function.
3775         (supported_emulation_names): New function.
3776         * target-select.h (class Target_selector): Add emulation_ field.
3777         Update declarations.
3778         (Target_selector::recognize_by_bfd_name): Rename from
3779         recognize_by_name.  Change all callers.
3780         (Target_selector::supported_bfd_names): Rename from
3781         supported_names.  Change all callers.
3782         (Target_selector::recognize_by_emulation): New function.
3783         (Target_selector::supported_emulations): New function.
3784         (Target_selector::emulation): New function.
3785         (Target_selector::do_recognize_by_bfd_name): Rename from
3786         do_recognize_by_name.  Change all callers.
3787         (Target_selector::do_supported_bfd_names): Rename from
3788         do_supported_names.  Change all callers.
3789         (Target_selector::do_recognize_by_emulation): New function.
3790         (Target_selector::do_supported_emulations): New function.
3791         (select_target_by_bfd_name): Change name in declaration.
3792         (select_target_by_emulation): Declare.
3793         (supported_emulation_names): Declare.
3794         * parameters.cc (parameters_force_valid_target): Try to find
3795         target based on emulation from -m option.
3796         * options.h (class General_options): Change doc string for -m.
3797         * options.cc (help): Print emulations.
3798         (General_options::parse_V): Likewise.
3799         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3800         Add emulation parameter.  Change all callers.
3801
3802 2011-06-28  Ian Lance Taylor  <iant@google.com>
3803
3804         * target.h (class Target): Add osabi_ field.
3805         (Target::osabi): New function.
3806         (Target::set_osabi): New function.
3807         (Target::Target): Initialize osabi_.
3808         (Target::do_adjust_elf_header): Make pure virtual.
3809         (Sized_target::do_adjust_elf_header): Declare.
3810         * target.cc (Sized_target::do_adjust_elf_header): New function.
3811         (class Sized_target): Instantiate all versions.
3812         * freebsd.h (class Target_freebsd): Remove.
3813         (Target_selector_freebsd::do_recognize): Call set_osabi on
3814         Target.
3815         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3816         (Target_selector_freebsd::set_osabi): Remove.
3817         * i386.cc (class Target_i386): Inherit from Sized_target rather
3818         than Target_freebsd.
3819         * x86_64.cc (class Target_x86_64): Likewise.
3820
3821 2011-06-28  Ian Lance Taylor  <iant@google.com>
3822
3823         * target.h (Target::can_check_for_function_pointers): Rewrite.
3824         Make non-virtual.
3825         (Target::can_icf_inline_merge_sections): Likewise.
3826         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3827         (Target::Target_info): Add can_icf_inline_merge_sections field.
3828         (Target::do_can_check_for_function_pointers): New virtual
3829         function.
3830         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3831         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3832         from can_check_for_function_pointers, move in file.
3833         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3834         section_may_have_icf_unsafe_poineters, move in file.
3835         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3836         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3837         Rename from can_check_for_function_pointers, move in file.
3838         (Target_i386::can_icf_inline_merge_sections): Remove.
3839         (Target_i386::i386_info): Initialize
3840         can_icf_inline_merge_sections.
3841         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3842         Initialize can_icf_inline_merge_sections.
3843         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3844         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3845         Rename from can_check_for_function_pointers, move in file.
3846         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3847         (Target_x86_64::x86_64_info): Initialize
3848         can_icf_inline_merge_sections.
3849         * testsuite/testfile.cc (Target_test::test_target_info):
3850         Likewise.
3851         * icf.cc (get_section_contents): Correct formatting.
3852
3853 2011-06-27  Ian Lance Taylor  <iant@google.com>
3854
3855         * symtab.cc (Symbol::versioned_name): New function.
3856         (Symbol_table::add_to_final_symtab): Use versioned_name when
3857         appropriate.
3858         (Symbol_table::sized_write_symbol): Likewise.
3859         * symtab.h (class Symbol): Declare versioned_name.
3860         * stringpool.h (class Stringpool_template): Add variant of add
3861         which takes a std::basic_string.
3862         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3863         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3864         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3865         (ver_test_12.o): New target.
3866         * testsuite/Makefile.in: Rebuild.
3867
3868 2011-06-27  Doug Kwan  <dougkwan@google.com>
3869
3870         * arm.cc (Arm_relocate_functions::thm_jump8,
3871         Arm_relocate_functions::thm_jump11): Use a wider signed
3872         type to compute offset.
3873         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3874         arm_thm_jump8.
3875         * testsuite/Makefile.in: Regenerate.
3876         * testsuite/arm_branch_in_range.sh: Check test results of
3877         arm_thm_jump11 and arm_thm_jump8.
3878         * testsuite/arm_thm_jump11.s: New test source file.
3879         * testsuite/arm_thm_jump11.t: New linker script.
3880         * testsuite/arm_thm_jump8.s: New test source file.
3881         * testsuite/arm_thm_jump8.t: New linker script.
3882
3883 2011-06-24  Ian Lance Taylor  <iant@google.com>
3884
3885         * layout.cc: Include "object.h".
3886         (ctors_sections_in_init_array): New static variable.
3887         (Layout::is_ctors_in_init_array): New function.
3888         (Layout::layout): Add entry to ctors_sections_in_init_array if
3889         appropriate.
3890         * layout.h (class Layout): Declare is_ctors_in_init_array.
3891         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3892         is_ctors_reverse_view is set.
3893         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3894         all callers.  Set is_ctors_reverse_view field of View_size.
3895         (Sized_relobj_file::reverse_words): New function.
3896         * object.h (Sized_relobj_file::View_size): Add
3897         is_ctors_reverse_view field.
3898         (class Sized_relobj_file): Update declarations.
3899         * testsuite/initpri3.c: New test.
3900         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3901         initpri3b.
3902         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3903         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3904         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3905         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3906         * testsuite/Makefile.in: Rebuild.
3907
3908 2011-06-24  Cary Coutant  <ccoutant@google.com>
3909
3910         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3911         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3912         (debug_msg_cdebug.err): New targets.
3913         * testsuite/Makefile.in: Regenerate.
3914         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3915         Fix checks for link with shared library.
3916
3917 2011-06-24  Doug Kwan  <dougkwan@google.com>
3918
3919         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3920         skip empty text sections.
3921         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3922
3923 2011-06-22  Ian Lance Taylor  <iant@google.com>
3924
3925         PR gold/12910
3926         * options.h (class General_options): Add --ctors-in-init-array.
3927         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3928         friends as SHT_PROGBITS for merging sections.
3929         (Layout::layout): Remove special handling of .init_array and
3930         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3931         and .dtors if ctors_in_init_array.
3932         (Layout::make_output_section): Force correct section types for
3933         .init_array and friends.  Don't sort if doing relocatable link,
3934         Don't sort .ctors and .dtors if ctors_in_init_array.
3935         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3936         (Layout::output_section_name): Add relobj parameter.  Change all
3937         callers.  Handle .ctors. and .dtors. in code rather than table.
3938         Handle .ctors and .dtors if ctors_in_init_array.
3939         (Layout::match_file_name): New function, moved from output.cc.
3940         * layout.h (class Layout): Update declarations.
3941         * output.cc: Include "layout.h".
3942         (Input_section_sort_entry::get_priority): New function.
3943         (Input_section_sort_entry::match_file_name): Just call
3944         Layout::match_file_name.
3945         (Output_section::Input_section_sort_init_fini_compare::operator()):
3946         Handle .ctors and .dtors.  Sort by explicit priority rather than
3947         by name.
3948         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3949         * testsuite/initpri2.c: New test.
3950         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3951         (check_PROGRAMS): Add initpri2.
3952         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3953         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3954         * configure, testsuite/Makefile.in: Rebuild.
3955
3956 2011-06-19  Ian Lance Taylor  <iant@google.com>
3957
3958         PR gold/12880
3959         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3960         .interp section to a PT_INTERP segment even if we have seen a
3961         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3962         clause in a linker script.
3963         (Layout::finalize): Don't create a .interp section if we've
3964         already create a PT_INTERP segment.
3965         (Layout::create_interp): Always call choose_output_section (revert
3966         patch of 2011-06-17).  Don't create PT_INTERP segment.
3967         * script-sections.cc
3968         (Script_sections::create_note_and_tls_segments): Add a .interp
3969         section to a PT_INTERP segment even if we have seen a
3970         --dynamic-linker option.
3971
3972 2011-06-18  Ian Lance Taylor  <iant@google.com>
3973
3974         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3975         merely because a non-PT_LOAD segment has a dynamic reloc.
3976
3977 2011-06-18  Ian Lance Taylor  <iant@google.com>
3978
3979         * layout.cc (Layout::finish_dynamic_section): Don't create
3980         DT_FLAGS entry if not needed.
3981
3982 2011-06-18  Ian Lance Taylor  <iant@google.com>
3983
3984         PR gold/12745
3985         * layout.cc (Layout::layout_eh_frame): Correct handling of
3986         writable .eh_frame section.
3987
3988 2011-06-17  Ian Lance Taylor  <iant@google.com>
3989
3990         PR gold/12893
3991         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3992         symbol is redefined with the exact same object and value.
3993
3994 2011-06-17  Ian Lance Taylor  <iant@google.com>
3995
3996         PR gold/12880
3997         * layout.h (class Layout): Add interp_segment_ field.
3998         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3999         (Layout::attach_allocated_section_to_segment): If making shared
4000         library, put .interp section in PT_INTERP segment.
4001         (Layout::finalize): Also call create_interp if -dynamic-linker
4002         option was used.
4003         (Layout::create_interp): Assert that there is no PT_INTERP
4004         segment.  If not using a SECTIONS clause, use make_output_section.
4005         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4006         * script-sections.cc
4007         (Script_sections::create_note_and_tls_segments): If making shared
4008         library, put .interp section in PT_INTERP segment.
4009
4010 2011-06-17  Ian Lance Taylor  <iant@google.com>
4011
4012         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4013         when making a shared library.
4014
4015 2011-06-17  Ian Lance Taylor  <iant@google.com>
4016
4017         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4018         parameter.  Change all callers.  Don't issue warning about PC32
4019         against locally defined symbol.
4020
4021 2011-06-16  Ian Lance Taylor  <iant@google.com>
4022
4023         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4024         occurs in same object.
4025
4026 2011-06-14  Alan Modra  <amodra@gmail.com>
4027
4028         * po/POTFILES.in: Regenerate.
4029
4030 2011-06-09  Ian Lance Taylor  <iant@google.com>
4031
4032         * script-sections.cc
4033         (Orphan_output_section::set_section_addresses): For a relocatable
4034         link set address to 0.
4035
4036 2011-06-09  Cary Coutant  <ccoutant@google.com>
4037
4038         PR gold/12804
4039         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4040         used with --compress-debug-sections.
4041         * gold/object.cc (Sized_relobj_file::do_layout): Report
4042         uncompressed size of compressed input sections.
4043
4044 2011-06-08  Cary Coutant  <ccoutant@google.com>
4045
4046         PR gold/12804
4047         * testsuite/two_file_test_2_v1.cc: Change initialization of
4048         v2 to keep it in .data.
4049
4050 2011-06-07  Cary Coutant  <ccoutant@google.com>
4051
4052         * common.cc (Symbol_table::do_allocate_commons_list): Call
4053         gold_fallback.
4054         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4055         (Errors::fallback): New function.
4056         (gold_fallback): New function.
4057         * errors.h (Errors::fallback): New function.
4058         * gold.cc (gold_exit): Change status parameter to enum; adjust
4059         all callers.
4060         (queue_initial_tasks): Call gold_fallback.
4061         * gold.h: Include cstdlib.
4062         (Exit_status): New enum type.
4063         (gold_exit): Change status parameter to enum.
4064         (gold_fallback): New function.
4065         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4066         (Layout::create_symtab_sections): Likewise.
4067         (Layout::create_shdrs): Likewise.
4068         * main.cc (main): Adjust call to gold_exit.
4069         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4070         (Output_data_got::add_got_entry_pair): Likewise.
4071         (Output_section::add_input_section): Likewise.
4072         (Output_section::add_output_section_data): Likewise.
4073         (Output_segment::set_section_list_addresses): Likewise.
4074         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4075
4076 2011-06-07  Cary Coutant  <ccoutant@google.com>
4077
4078         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4079         for incremental links.
4080         * output.cc (Output_segment::set_section_list_addresses): Remove
4081         FIXME and test for TLS or BSS.
4082
4083 2011-06-07  Cary Coutant  <ccoutant@google.com>
4084
4085         * testsuite/Makefile.am: Add incremental_copy_test,
4086         incremental_common_test_1.
4087         * testsuite/Makefile.in: Regenerate.
4088         * testsuite/common_test_1_v1.c: New source file.
4089         * testsuite/common_test_1_v2.c: New source file.
4090         * testsuite/copy_test_v1.cc: New source file.
4091
4092 2011-06-07  Cary Coutant  <ccoutant@google.com>
4093
4094         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4095         update, allocate common from bss section's free list.
4096         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4097         linker-defined symbols.
4098         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4099         Skip GOT and PLT entries that are no longer referenced.
4100         (Output_section_incremental_inputs::write_info_blocks): Mark
4101         linker-defined symbols.
4102         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4103         * output.cc (Output_section::allocate): New function.
4104         * output.h (Output_section::allocate): New function.
4105         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4106         linker-defined symbols.
4107         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4108         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4109         (Symbol::init_base_output_data): Likewise.
4110         (Symbol::init_base_output_segment): Likewise.
4111         (Symbol::init_base_constant): Likewise.
4112         (Sized_symbol::init_output_data): Likewise.
4113         (Sized_symbol::init_output_segment): Likewise.
4114         (Sized_symbol::init_constant): Likewise.
4115         (Symbol_table::do_define_in_output_data): Likewise.
4116         (Symbol_table::do_define_in_output_segment): Likewise.
4117         (Symbol_table::do_define_as_constant): Likewise.
4118         * symtab.h (Symbol::is_predefined): New function.
4119         (Symbol::init_base_output_data): Add is_predefined parameter.
4120         (Symbol::init_base_output_segment): Likewise.
4121         (Symbol::init_base_constant): Likewise.
4122         (Symbol::is_predefined_): New data member.
4123         (Sized_symbol::init_output_data): Add is_predefined parameter.
4124         (Sized_symbol::init_output_segment): Likewise.
4125         (Sized_symbol::init_constant): Likewise.
4126         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4127
4128 2011-06-07  Cary Coutant  <ccoutant@google.com>
4129
4130         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4131         instead of emit_copy_reloc.
4132         (Copy_relocs::emit_copy_reloc): Refactor.
4133         (Copy_relocs::make_copy_reloc): New function.
4134         (Copy_relocs::add_copy_reloc): Remove.
4135         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4136         section.
4137         (Copy_relocs::make_copy_reloc): New function.
4138         (Copy_relocs::add_copy_reloc): Remove.
4139         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4140         unchanged input files.
4141         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4142         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4143         Reserve BSS space for COPY relocations.
4144         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4145         (Output_section_incremental_inputs::write_info_blocks): Record
4146         whether a symbol is copied from a shared object.
4147         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4148         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4149         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4150         (Incremental_input_entry_reader::get_output_symbol_index): Add
4151         is_copy parameter.
4152         (Incremental_binary::emit_copy_relocs): New function.
4153         (Incremental_binary::do_emit_copy_relocs): New function.
4154         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4155         new data member.
4156         (Sized_incremental_binary::add_copy_reloc): New function.
4157         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4158         (Sized_incremental_binary::Copy_reloc): New struct.
4159         (Sized_incremental_binary::Copy_relocs): New typedef.
4160         (Sized_incremental_binary::copy_relocs_): New data member.
4161         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4162         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4163         * target.h (Sized_target::emit_copy_reloc): New function.
4164         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4165
4166 2011-06-02  Cary Coutant  <ccoutant@google.com>
4167
4168         PR gold/12163
4169         * gold/archive.cc (Archive::Archive): Initialize new data member.
4170         (Archive::include_all_members): Return if archive has already been
4171         included.
4172         * gold/archive.h (Archive::include_all_members_): New data member.
4173
4174 2011-06-02  Nick Clifton  <nickc@redhat.com>
4175
4176         * dynobj.h: Fix spelling mistake in comment.
4177         * output.cc: Likewise.
4178
4179 2011-05-31  Doug Kwan  <dougkwan@google.com>
4180             Asier Llano
4181
4182         PR gold/12826
4183         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4184         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4185         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4186         redundant arm_exidx_test.so.
4187         * testsuite/Makefile.in: Regenerate.
4188         (check_SCRIPTS): Add pr12826.sh
4189         (check_DATA): Add pr12826.stdout
4190         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4191         * testsuite/pr12826.sh: New file.
4192         * testsuite/pr12826_1.s: Ditto.
4193         * testsuite/pr12826_1.s: Ditto.
4194
4195 2011-05-30  Ian Lance Taylor  <iant@google.com>
4196
4197         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4198         sections.
4199
4200 2011-05-29  Ian Lance Taylor  <iant@google.com>
4201
4202         PR gold/12804
4203         * testsuite/Makefile.am: Use different file name for two_file_test
4204         temporary file for each incremental test.
4205         * testsuite/Makefile.in: Rebuild.
4206
4207 2011-05-29  Ian Lance Taylor  <iant@google.com>
4208
4209         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4210         binary input file is empty.
4211
4212 2011-05-27  Ian Lance Taylor  <iant@google.com>
4213
4214         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4215         (ver_test_9.so): Likewise.
4216         * testsuite/Makefile.in: Rebuild.
4217
4218 2011-05-26 Cary Coutant  <ccoutant@google.com>
4219
4220         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4221         * incremental.cc (Incremental_inputs::report_input_section): Fix
4222         comment, indentation.
4223         (Incremental_inputs::report_comdat_group): New function.
4224         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4225         of data for incremental input file entry.
4226         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4227         group count, COMDAT group signatures.
4228         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4229         an unchanged input file.
4230         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4231         Initialize new data member.
4232         (Incremental_object_entry::add_comdat_group): New function.
4233         (Incremental_object_entry::get_comdat_group_count): New function.
4234         (Incremental_object_entry::get_comdat_signature_key): New function.
4235         (Incremental_object_entry::groups_): New data member.
4236         (Incremental_inputs::report_comdat_group): New function.
4237         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4238         data for incremental input file entry.
4239         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4240         (Incremental_input_entry_reader::get_input_section): Adjust size of
4241         data for incremental input file entry.
4242         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4243         (Incremental_input_entry_reader::get_comdat_group_signature): New
4244         function.
4245         * object.cc (Sized_relobj::include_section_group): Report kept
4246         COMDAT groups for incremental links.
4247
4248 2011-05-24  David Meyer  <pdox@google.com>
4249
4250         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4251         with name parameter.  Add found_name parameter.
4252         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4253         * dirsearch.h (class Dirsearch): Update declaration.
4254
4255 2011-05-24  Ian Lance Taylor  <iant@google.com>
4256
4257         * archive.cc (Library_base::should_include_member): Pull in object
4258         from archive if it defines the entry symbol.
4259         * parameters.cc (Parameters::entry): New function.
4260         * parameters.h (class Parameters): Declare entry.
4261         * output.h (class Output_file_header): Remove entry_ field.
4262         * output.cc (Output_file_header::Output_file_header): Remove entry
4263         parameter.  Change all callers.
4264         (Output_file_header::entry): Use parameters->entry.
4265         * gold.cc (queue_middle_tasks): Likewise.
4266         * plugin.cc (Plugin_hook::run): Likewise.
4267
4268 2011-05-24 Cary Coutant  <ccoutant@google.com>
4269
4270         * gold.cc (queue_initial_tasks): Pass incremental base filename
4271         to Output_file::open_base_file; don't print error message.
4272         * incremental-dump.cc (main): Adjust call to
4273         Output_file::open_for_modification.
4274         * incremental-dump.cc (main): Likewise.
4275         * incremental.cc (Incremental_inputs::report_command_line):
4276         Ignore --incremental-base option when comparing command lines.
4277         Ignore parameter when given as separate argument.
4278         * options.h (class General_options): Add --incremental-base.
4279         * output.cc (Output_file::Output_file):
4280         (Output_file::open_base_file): Add base_name and writable parameters;
4281         read base file into new file; print error message here.
4282         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4283         callers.
4284         * output.h (Output_file::open_for_modification): Rename to...
4285         (Output_file::open_base_file): ...this; add base_name and
4286         writable parameters; adjust all callers.
4287         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4288         callers.
4289         * testsuite/Makefile.am (incremental_test_4): Test
4290         --incremental-base.
4291         * testsuite/Makefile.in: Regenerate.
4292
4293 2011-05-24 Cary Coutant  <ccoutant@google.com>
4294
4295         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4296         incremental_test_4.
4297         * testsuite/Makefile.in: Regenerate.
4298         * testsuite/two_file_test_1_v1.cc: New test source file.
4299         * testsuite/two_file_test_1b_v1.cc: New test source file.
4300         * testsuite/two_file_test_2_v1.cc: New test source file.
4301
4302 2011-05-24 Cary Coutant  <ccoutant@google.com>
4303
4304         * dynobj.h (Dynobj::do_dynobj): New function.
4305         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4306         flag and soname for shared objects.
4307         * incremental.cc (Incremental_inputs::report_object): Make
4308         either Incremental_object_entry or Incremental_dynobj_entry; add
4309         soname to string table.
4310         (Incremental_inputs::report_input_section): Add assertion.
4311         (Output_section_incremental_inputs::set_final_data_size): Adjust
4312         type of input file entry for shared libraries; adjust size of
4313         shared library info entry.
4314         (Output_section_incremental_inputs::write_input_files): Write
4315         as_needed flag for shared libraries.
4316         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4317         of input file entry for shared libraries; write soname.
4318         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4319         soname from incremental info.
4320         * incremental.h (enum Incremental_input_flags): Add
4321         INCREMENTAL_INPUT_AS_NEEDED.
4322         (Incremental_input_entry::Incremental_input_entry): Initialize new
4323         data member.
4324         (Incremental_input_entry::set_as_needed): New function.
4325         (Incremental_input_entry::as_needed): New function.
4326         (Incremental_input_entry::do_dynobj_entry): New function.
4327         (Incremental_input_entry::as_needed_): New data member.
4328         (Incremental_object_entry::Incremental_object_entry): Don't check
4329         for shared library.
4330         (Incremental_object_entry::do_type): Likewise.
4331         (class Incremental_dynobj_entry): New class.
4332         (Incremental_input_entry_reader::as_needed): New function.
4333         (Incremental_input_entry_reader::get_soname): New function.
4334         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4335         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4336         size of shared library info entry.
4337         * layout.cc (Layout::finish_dynamic_section): Don't test for
4338         incremental link when adding DT_NEEDED entries.
4339         * object.h (Object::Object): Initialize new data member.
4340         (Object::dynobj): New function.
4341         (Object::set_as_needed): New function.
4342         (Object::as_needed): New function.
4343         (Object::do_dynobj): New function.
4344         (Object::as_needed_): New data member.
4345
4346 2011-05-24 Cary Coutant  <ccoutant@google.com>
4347
4348         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4349         info; adjust display of GOT entries.
4350         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4351         vector of input objects; remove file_status_.
4352         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4353         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4354         got_plt reader; call target hooks to reserve GOT entries.
4355         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4356         of input file info header and GOT info entry.
4357         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4358         relocation info.
4359         (Got_plt_view_info::got_descriptor): Remove.
4360         (Got_plt_view_info::sym_index): New data member.
4361         (Got_plt_view_info::input_index): New data member.
4362         (Local_got_offset_visitor::visit): Write input file index.
4363         (Global_got_offset_visitor::visit): Write 0 for input file index.
4364         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4365         with sym_index and input_index.
4366         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4367         incremental info GOT entry; replace got_descriptor with input_index.
4368         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4369         map from input file index to object.
4370         (Sized_relobj_incr::do_layout): Replace direct data member reference
4371         with accessor function.
4372         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4373         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4374         Adjust size of input file info header.
4375         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4376         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4377         (Incremental_input_entry_reader::get_input_section): Adjust size of
4378         input file info header.
4379         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4380         of incremental info GOT entry.
4381         (Incremental_got_plt_reader::get_got_desc): Remove.
4382         (Incremental_got_plt_reader::get_got_symndx): New function.
4383         (Incremental_got_plt_reader::get_got_input_index): New function.
4384         (Sized_incremental_binary::Sized_incremental_binary): Remove
4385         file_status_; add input_objects_.
4386         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4387         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4388         (Sized_incremental_binary::file_is_unchanged): Remove.
4389         (Sized_incremental_binary::set_input_object): New function.
4390         (Sized_incremental_binary::input_object): New function.
4391         (Sized_incremental_binary::file_status_): Remove.
4392         (Sized_incremental_binary::input_objects_): New data member.
4393         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4394         references.
4395         (Sized_relobj_incr::invalid_address): Move to base class.
4396         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4397         class.
4398         (Sized_relobj_incr::do_output_section_offset): Likewise.
4399         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4400         (Sized_relobj_incr::section_offsets_): Likewise.
4401         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4402         function.
4403         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4404         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4405         with accessor function.
4406         (Sized_relobj_file::do_layout): Likewise.
4407         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4408         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4409         (Sized_relobj_file::compute_final_local_value): Replace refs to
4410         section_offsets_ with accessor function.
4411         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4412         * object.h (Relobj::Relobj): Initialize new data members.
4413         (Relobj::add_dyn_reloc): New function.
4414         (Relobj::first_dyn_reloc): New function.
4415         (Relobj::dyn_reloc_count): New function.
4416         (Relobj::first_dyn_reloc_): New data member.
4417         (Relobj::dyn_reloc_count_): New data member.
4418         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4419         references.
4420         (Sized_relobj::Address): New typedef.
4421         (Sized_relobj::invalid_address): Move here from child class.
4422         (Sized_relobj::Sized_relobj): Initialize new data members.
4423         (Sized_relobj::sized_relobj): New function.
4424         (Sized_relobj::is_output_section_offset_invalid): Move here from
4425         child class.
4426         (Sized_relobj::get_output_section_offset): Likewise.
4427         (Sized_relobj::local_has_got_offset): Likewise.
4428         (Sized_relobj::local_got_offset): Likewise.
4429         (Sized_relobj::set_local_got_offset): Likewise.
4430         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4431         (Sized_relobj::clear_got_offsets): New function.
4432         (Sized_relobj::section_offsets): Move here from child class.
4433         (Sized_relobj::do_output_section_offset): Likewise.
4434         (Sized_relobj::do_set_section_offset): Likewise.
4435         (Sized_relobj::Local_got_offsets): Likewise.
4436         (Sized_relobj::local_got_offsets_): Likewise.
4437         (Sized_relobj::section_offsets_): Likewise.
4438         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4439         references.
4440         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4441         class.
4442         (Sized_relobj_file::sized_relobj): New function
4443         (Sized_relobj_file::local_has_got_offset): Move to base class.
4444         (Sized_relobj_file::local_got_offset): Likewise.
4445         (Sized_relobj_file::set_local_got_offset): Likewise.
4446         (Sized_relobj_file::get_output_section_offset): Likewise.
4447         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4448         (Sized_relobj_file::do_output_section_offset): Likewise.
4449         (Sized_relobj_file::do_set_section_offset): Likewise.
4450         (Sized_relobj_file::Local_got_offsets): Likewise.
4451         (Sized_relobj_file::local_got_offsets_): Likewise.
4452         (Sized_relobj_file::section_offsets_): Likewise.
4453         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4454         (all constructors).
4455         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4456         (Output_reloc::get_symbol_index): Likewise.
4457         (Output_reloc::local_section_offset): Likewise.
4458         (Output_reloc::get_address): Likewise.
4459         (Output_reloc::symbol_value): Likewise.
4460         (Output_data_got::reserve_slot): Move to class definition.
4461         (Output_data_got::reserve_local): New function.
4462         (Output_data_got::reserve_slot_for_global): Remove.
4463         (Output_data_got::reserve_global): New function.
4464         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4465         (all constructors, two instantiations).
4466         (Output_reloc::get_relobj): New function (two instantiations).
4467         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4468         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4469         (Output_data_reloc::add_global): Adjust type of relobj.
4470         (Output_data_reloc::add_global_relative): Likewise.
4471         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4472         (Output_data_reloc::add_local): Likewise.
4473         (Output_data_reloc::add_local_relative): Likewise.
4474         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4475         (Output_data_reloc::add_local_section): Likewise.
4476         (Output_data_reloc::add_output_section): Likewise.
4477         (Output_data_reloc::add_absolute): Likewise.
4478         (Output_data_reloc::add_target_specific): Likewise.
4479         (Output_data_got::reserve_slot): Move definition here.
4480         (Output_data_got::reserve_local): New function.
4481         (Output_data_got::reserve_global): New function.
4482         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4483         section_offsets_ with accessor function.
4484         (Sized_relobj_file::write_sections): Likewise.
4485         (Sized_relobj_file::do_relocate_sections): Likewise.
4486         * target.h (Sized_target::reserve_local_got_entry): New function.
4487         (Sized_target::reserve_global_got_entry): New function.
4488         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4489         (Target_x86_64::reserve_global_got_entry): New function.
4490         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4491
4492 2011-05-23 Cary Coutant  <ccoutant@google.com>
4493
4494         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4495         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4496         bit when checking got_type.
4497         * incremental.cc (Sized_incremental_binary::setup_readers):
4498         Store symbol table and string table locations; initialize bit vector
4499         of file status flags.
4500         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4501         unchanged files.
4502         (Sized_incremental_binary::do_process_got_plt): New function.
4503         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4504         (Output_section_incremental_inputs::set_final_data_size): Record
4505         file index for each input file.
4506         (Output_section_incremental_inputs::write_got_plt): Store file index
4507         instead of input entry offset for each GOT entry.
4508         * incremental.h
4509         (Incremental_input_entry::Incremental_input_entry): Initialize new
4510         data member.
4511         (Incremental_input_entry::set_offset): Store file index.
4512         (Incremental_input_entry::get_file_index): New function.
4513         (Incremental_input_entry::file_index_): New data member.
4514         (Incremental_binary::process_got_plt): New function.
4515         (Incremental_binary::do_process_got_plt): New function.
4516         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4517         data members.
4518         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4519         (Sized_incremental_binary::set_file_is_unchanged): New function.
4520         (Sized_incremental_binary::file_is_unchanged): New function.
4521         (Sized_incremental_binary::do_process_got_plt): New function.
4522         (Sized_incremental_binary::file_status_): New data member.
4523         (Sized_incremental_binary::main_symtab_loc_): New data member.
4524         (Sized_incremental_binary::main_strtab_loc_): New data member.
4525         * output.cc (Output_data_got::Got_entry::write): Add case
4526         RESERVED_CODE.
4527         (Output_data_got::add_global): Call add_got_entry.
4528         (Output_data_got::add_global_plt): Likewise.
4529         (Output_data_got::add_global_with_rel): Likewise.
4530         (Output_data_got::add_global_with_rela): Likewise.
4531         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4532         (Output_data_got::add_global_pair_with_rela): Likewise.
4533         (Output_data_got::add_local): Call add_got_entry.
4534         (Output_data_got::add_local_plt): Likewise.
4535         (Output_data_got::add_local_with_rel): Likewise.
4536         (Output_data_got::add_local_with_rela): Likewise.
4537         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4538         (Output_data_got::add_local_pair_with_rela): Likewise.
4539         (Output_data_got::reserve_slot): New function.
4540         (Output_data_got::reserve_slot_for_global): New function.
4541         (Output_data_got::add_got_entry): New function.
4542         (Output_data_got::add_got_entry_pair): New function.
4543         (Output_section::add_output_section_data): Edit FIXME.
4544         * output.h
4545         (Output_section_data_build::Output_section_data_build): New
4546         constructor with size parameter.
4547         (Output_data_space::Output_data_space): Likewise.
4548         (Output_data_got::Output_data_got): Initialize new data member; new
4549         constructor with size parameter.
4550         (Output_data_got::add_constant): Call add_got_entry.
4551         (Output_data_got::reserve_slot): New function.
4552         (Output_data_got::reserve_slot_for_global): New function.
4553         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4554         (Output_data_got::add_got_entry): New function.
4555         (Output_data_got::add_got_entry_pair): New function.
4556         (Output_data_got::free_list_): New data member.
4557         * target.h (Sized_target::init_got_plt_for_update): New function.
4558         (Sized_target::register_global_plt_entry): New function.
4559         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4560         Initialize new data member; call init; add constructor with PLT count.
4561         (Output_data_plt_x86_64::init): New function.
4562         (Output_data_plt_x86_64::add_relocation): New function.
4563         (Output_data_plt_x86_64::reserve_slot): New function.
4564         (Output_data_plt_x86_64::free_list_): New data member.
4565         (Target_x86_64::init_got_plt_for_update): New function.
4566         (Target_x86_64::register_global_plt_entry): New function.
4567         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4568         incremental updates.
4569         (Output_data_plt_x86_64::add_relocation): New function.
4570         * testsuite/object_unittest.cc (Object_test): Set default options.
4571
4572 2011-05-16  Ian Lance Taylor  <iant@google.com>
4573
4574         * options.h (class General_options): Make -i a synonym for -r.
4575
4576 2011-05-16  Ian Lance Taylor  <iant@google.com>
4577
4578         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4579
4580 2011-05-10 Cary Coutant  <ccoutant@google.com>
4581
4582         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4583         strip_all (-s).
4584
4585 2011-05-06  Ian Lance Taylor  <iant@google.com>
4586
4587         * layout.cc (Layout::layout): If the output section flags change,
4588         update the ordering.
4589
4590 2011-04-25 Cary Coutant  <ccoutant@google.com>
4591
4592         * incremental-dump.cc (dump_incremental_inputs): Print local
4593         symbol info for each input file.
4594         * incremental.cc
4595         (Output_section_incremental_inputs::set_final_data_size): Add local
4596         symbol info to input file entries in incremental info.
4597         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4598         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4599         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4600         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4601         implementation.
4602         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4603         (Sized_incr_relobj::do_relocate): Write the local symbols.
4604         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4605         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4606         Adjust size of input file header.
4607         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4608         (Incremental_inputs_reader::get_local_symbol_count): New function.
4609         (Incremental_inputs_reader::get_input_section): Adjust size of input
4610         file header.
4611         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4612         (Sized_incr_relobj::This): New typedef.
4613         (Sized_incr_relobj::sym_size): New const data member.
4614         (Sized_incr_relobj::Local_symbol): New struct.
4615         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4616         (Sized_incr_relobj::do_local_symbol_offset): New function.
4617         (Sized_incr_relobj::local_symbol_count_): New data member.
4618         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4619         (Sized_incr_relobj::local_symbol_index_): New data member.
4620         (Sized_incr_relobj::local_symbol_offset_): New data member.
4621         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4622         (Sized_incr_relobj::local_symbols_): New data member.
4623         * object.h (Relobj::output_local_symbol_count): New function.
4624         (Relobj::local_symbol_offset): New function.
4625         (Relobj::do_output_local_symbol_count): New function.
4626         (Relobj::do_local_symbol_offset): New function.
4627         (Sized_relobj::do_output_local_symbol_count): New function.
4628         (Sized_relobj::do_local_symbol_offset): New function.
4629
4630 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4631
4632         * descriptors.cc (set_close_on_exec): New function.
4633         (Descriptors::open): Use set_close_on_exec.
4634         * output.cc (S_ISLNK): Define if not defined.
4635
4636 2011-04-22 Cary Coutant  <ccoutant@google.com>
4637
4638         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4639         global symbol map.
4640         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4641         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4642         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4643         relocations.
4644         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4645         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4646         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4647         * incremental.h
4648         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4649         function.
4650         (Incremental_binary::apply_incremental_relocs): New function.
4651         (Incremental_binary::do_apply_incremental_relocs): New function.
4652         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4653         data member.
4654         (Sized_incremental_binary::add_global_symbol): New function.
4655         (Sized_incremental_binary::global_symbol): New function.
4656         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4657         (Sized_incremental_binary::symbol_map_): New data member.
4658         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4659         * target.h (Sized_target::apply_relocation): New function.
4660         * target-reloc.h (apply_relocation): New function.
4661         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4662
4663 2011-04-22  Doug Kwan  <dougkwan@google.com>
4664
4665         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4666         flag of a SHT_ARM_EXIDX section.
4667         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4668         * testsuite/Makefile.in: Regenerate.
4669         * testsuite/arm_exidx_test.s: New file.
4670         * testsuite/arm_exidx_test.sh: Same.
4671
4672 2011-04-20 Cary Coutant  <ccoutant@google.com>
4673
4674         PR gold/12689
4675         * archive.h (Incremental_archive_entry::Archive_member):
4676         Initialize arg_serial_ (second constructor).
4677
4678 2011-04-17  Ian Lance Taylor  <iant@google.com>
4679
4680         * object.cc (Relocate_info::location): Simplify location string.
4681         * errors.cc (Errors::error_at_location): Don't print program
4682         name.
4683         (Errors::warning_at_location): Likewise.
4684         (Errors::undefined_symbol): Likewise.
4685         * testsuite/debug_msg.sh: Update accordingly.
4686
4687 2011-04-14 Cary Coutant  <ccoutant@google.com>
4688
4689         * gold/layout.cc (Layout::symtab_section_offset): New function.
4690         * gold/layout.h (Layout::symtab_section_offset): New function.
4691         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4692
4693 2011-04-12  Ian Lance Taylor  <iant@google.com>
4694
4695         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4696         with MREMAP_MAYMOVE.
4697         * output.h (class Output_file): Add map_is_allocated_ field.
4698         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4699         not available, provide stubs.  If mremap is not available, #define
4700         it to gold_mremap.
4701         (MREMAP_MAYMOVE): Define if not defined.
4702         (Output_file::Output_file): Initialize map_is_allocated_.
4703         (Output_file::resize): Check map_is_allocated_.
4704         (Output_file::map_anonymous): If mmap fails, use malloc.
4705         (Output_file::unmap): Don't do anything for an anonymous map.
4706         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4707         is not available, provide stubs.
4708         (File_read::View::~View): Use free rather than delete[].
4709         (File_read::make_view): Use malloc rather than new[].  If mmap
4710         fails, use malloc.
4711         (File_read::find_or_make_view): Use malloc rather than new[].
4712         * gold.h: Remove HAVE_REMAP code.
4713         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4714         exists.  Rename mremap to gold_mremap.  If mmap is not available
4715         don't do anything.
4716         * configure, config.in: Rebuild.
4717
4718 2011-04-11  Ian Lance Taylor  <iant@google.com>
4719
4720         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4721         initialize local variable v.
4722
4723 2011-04-11  Cary Coutant  <ccoutant@google.com>
4724
4725         * archive.cc (Archive::include_member): Adjust call to
4726         report_object.
4727         (Add_archive_symbols::run): Track argument serial numbers.
4728         (Lib_group::include_member): Likewise.
4729         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4730         * archive.h (Incremental_archive_entry::Archive_member):
4731         Initialize arg_serial_.
4732         (Archive_member::arg_serial_): New data member.
4733         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4734         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4735         incremental link.
4736         (Sized_dynobj::do_for_all_local_got_entries): New function.
4737         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4738         function.
4739         * fileread.cc (get_mtime): New function.
4740         * fileread.h (get_mtime): New function.
4741         * gold.cc (queue_initial_tasks): Check for incremental update.
4742         (process_incremental_input): New function.
4743         (queue_middle_tasks): Don't force valid target for incremental
4744         update.
4745         * incremental-dump.cc (find_input_containing_global): Adjust
4746         size of symbol info entry.
4747         (dump_incremental_inputs): Dump argument serial number and
4748         in_system_directory flag; bias shndx by 1; print symbol names
4749         when dumping per-file symbol lists; use new symbol info readers.
4750         * incremental.cc
4751         (Output_section_incremental_inputs:update_data_size): New function.
4752         (Sized_incremental_binary::setup_readers): Setup input readers
4753         for each input file; build maps for files added from libraries
4754         and scripts.
4755         (Sized_incremental_binary::check_input_args): New function.
4756         (Sized_incremental_binary::do_check_inputs): Build map of argument
4757         serial numbers to input arguments.
4758         (Sized_incremental_binary::do_file_has_changed): Rename
4759         do_file_is_unchanged to this; compare file modification times.
4760         (Sized_incremental_binary::do_init_layout): New function.
4761         (Sized_incremental_binary::do_reserve_layout): New function.
4762         (Sized_incremental_binary::do_get_input_reader): Remove.
4763         (Sized_incremental_binary::get_symtab_view): New function.
4764         (Incremental_checker::can_incrementally_link_output_file): Remove.
4765         (Incremental_inputs::report_command_line): Exclude --debug options.
4766         (Incremental_inputs::report_archive_begin): Add parameter; track
4767         argument serial numbers; don't put input file entry for archive
4768         before archive members.
4769         (Incremental_inputs::report_archive_end): Put input file entry
4770         for archive after archive members.
4771         (Incremental_inputs::report_object): Add parameter; track argument
4772         serial numbers and in_system_directory flag.
4773         (Incremental_inputs::report_script): Add parameter; track argument
4774         serial numbers.
4775         (Output_section_incremental_inputs::set_final_data_size): Adjust
4776         size of symbol info entry; check for forwarding symbols.
4777         (Output_section_incremental_inputs::write_input_files): Write
4778         in_system_directory flag and argument serial number.
4779         (Output_section_incremental_inputs::write_info_blocks): Map section
4780         indices between incremental info and original input file; store
4781         input section index for each symbol.
4782         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4783         change operator() to visit().
4784         (class Global_got_offset_visitor): Likewise.
4785         (class Global_symbol_visitor_got_plt):
4786         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4787         classes.
4788         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4789         (Sized_incr_relobj::do_read_symbols): New function.
4790         (Sized_incr_relobj::do_layout): New function.
4791         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4792         (Sized_incr_relobj::do_add_symbols): New function.
4793         (Sized_incr_relobj::do_should_include_member): New function.
4794         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4795         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4796         (Sized_incr_relobj::do_section_size): New function.
4797         (Sized_incr_relobj::do_section_name): New function.
4798         (Sized_incr_relobj::do_section_contents): New function.
4799         (Sized_incr_relobj::do_section_flags): New function.
4800         (Sized_incr_relobj::do_section_entsize): New function.
4801         (Sized_incr_relobj::do_section_address): New function.
4802         (Sized_incr_relobj::do_section_type): New function.
4803         (Sized_incr_relobj::do_section_link): New function.
4804         (Sized_incr_relobj::do_section_info): New function.
4805         (Sized_incr_relobj::do_section_addralign): New function.
4806         (Sized_incr_relobj::do_initialize_xindex): New function.
4807         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4808         (Sized_incr_relobj::do_read_relocs): New function.
4809         (Sized_incr_relobj::do_gc_process_relocs): New function.
4810         (Sized_incr_relobj::do_scan_relocs): New function.
4811         (Sized_incr_relobj::do_count_local_symbols): New function.
4812         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4813         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4814         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4815         (Sized_incr_relobj::do_relocate): New function.
4816         (Sized_incr_relobj::do_set_section_offset): New function.
4817         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4818         (Sized_incr_dynobj::do_read_symbols): New function.
4819         (Sized_incr_dynobj::do_layout): New function.
4820         (Sized_incr_dynobj::do_add_symbols): New function.
4821         (Sized_incr_dynobj::do_should_include_member): New function.
4822         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4823         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4824         (Sized_incr_dynobj::do_section_size): New function.
4825         (Sized_incr_dynobj::do_section_name): New function.
4826         (Sized_incr_dynobj::do_section_contents): New function.
4827         (Sized_incr_dynobj::do_section_flags): New function.
4828         (Sized_incr_dynobj::do_section_entsize): New function.
4829         (Sized_incr_dynobj::do_section_address): New function.
4830         (Sized_incr_dynobj::do_section_type): New function.
4831         (Sized_incr_dynobj::do_section_link): New function.
4832         (Sized_incr_dynobj::do_section_info): New function.
4833         (Sized_incr_dynobj::do_section_addralign): New function.
4834         (Sized_incr_dynobj::do_initialize_xindex): New function.
4835         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4836         (make_sized_incremental_object): New function.
4837         (Incremental_library::copy_unused_symbols): New function.
4838         (Incremental_library::do_for_all_unused_symbols): New function.
4839         * incremental.h (enum Incremental_input_flags): New type.
4840         (class Incremental_checker): Remove.
4841         (Incremental_input_entry::Incremental_input_entry): Add argument
4842         serial number.
4843         (Incremental_input_entry::arg_serial): New function.
4844         (Incremental_input_entry::set_is_in_system_directory): New function.
4845         (Incremental_input_entry::is_in_system_directory): New function.
4846         (Incremental_input_entry::arg_serial_): New data member.
4847         (Incremental_input_entry::is_in_system_directory_): New data member.
4848         (class Script_info): Move here from script.h.
4849         (Script_info::Script_info): Add filename parameter.
4850         (Script_info::filename): New function.
4851         (Script_info::filename_): New data member.
4852         (Incremental_script_entry::Incremental_script_entry): Add argument
4853         serial number.
4854         (Incremental_object_entry::Incremental_object_entry): Likewise.
4855         (Incremental_object_entry::add_input_section): Build list of input
4856         sections with map to original shndx.
4857         (Incremental_object_entry::get_input_section_index): New function.
4858         (Incremental_object_entry::shndx_): New data member.
4859         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4860         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4861         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4862         serial number.
4863         (Incremental_inputs::report_archive_begin): Likewise.
4864         (Incremental_inputs::report_object): Likewise.
4865         (Incremental_inputs::report_script): Likewise.
4866         (class Incremental_global_symbol_reader): New class.
4867         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4868         and store flags and input file type.
4869         (Incremental_input_entry_reader::arg_serial): New function.
4870         (Incremental_input_entry_reader::type): Extract type from flags.
4871         (Incremental_input_entry_reader::is_in_system_directory): New function.
4872         (Incremental_input_entry_reader::get_input_section_count): Call
4873         accessor function for type.
4874         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4875         function for type; adjust size of global symbol entry.
4876         (Incremental_input_entry_reader::get_global_symbol_count): Call
4877         accessor function for type.
4878         (Incremental_input_entry_reader::get_object_count): Likewise.
4879         (Incremental_input_entry_reader::get_object_offset): Likewise.
4880         (Incremental_input_entry_reader::get_member_count): Likewise.
4881         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4882         (Incremental_input_entry_reader::get_member_offset): Likewise.
4883         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4884         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4885         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4886         (Incremental_input_entry_reader::get_global_symbol_reader): New
4887         function.
4888         (Incremental_input_entry_reader::get_output_symbol_index): New
4889         function.
4890         (Incremental_input_entry_reader::type_): Remove.
4891         (Incremental_input_entry_reader::flags_): New data member.
4892         (Incremental_inputs_reader::input_file_offset): New function.
4893         (Incremental_inputs_reader::input_file_index): New function.
4894         (Incremental_inputs_reader::input_file): Call input_file_offset.
4895         (Incremental_inputs_reader::input_file_at_offset): New function.
4896         (Incremental_relocs_reader::get_r_type): Reformat.
4897         (Incremental_relocs_reader::get_r_shndx): Reformat.
4898         (Incremental_relocs_reader::get_r_offset): Reformat.
4899         (Incremental_relocs_reader::data): New function.
4900         (Incremental_binary::Incremental_binary): Initialize new data members.
4901         (Incremental_binary::check_inputs): Add cmdline parameter.
4902         (Incremental_binary::file_is_unchanged): Remove.
4903         (Input_reader::arg_serial): New function.
4904         (Input_reader::get_unused_symbol_count): New function.
4905         (Input_reader::get_unused_symbol): New function.
4906         (Input_reader::do_arg_serial): New function.
4907         (Input_reader::do_get_unused_symbol_count): New function.
4908         (Input_reader::do_get_unused_symbol): New function.
4909         (Incremental_binary::input_file_count): New function.
4910         (Incremental_binary::get_input_reader): Change signature to use
4911         index instead of filename.
4912         (Incremental_binary::file_has_changed): New function.
4913         (Incremental_binary::get_input_argument): New function.
4914         (Incremental_binary::get_library): New function.
4915         (Incremental_binary::get_script_info): New function.
4916         (Incremental_binary::init_layout): New function.
4917         (Incremental_binary::reserve_layout): New function.
4918         (Incremental_binary::output_file): New function.
4919         (Incremental_binary::do_check_inputs): New function.
4920         (Incremental_binary::do_file_is_unchanged): Remove.
4921         (Incremental_binary::do_file_has_changed): New function.
4922         (Incremental_binary::do_init_layout): New function.
4923         (Incremental_binary::do_reserve_layout): New function.
4924         (Incremental_binary::do_input_file_count): New function.
4925         (Incremental_binary::do_get_input_reader): Change signature.
4926         (Incremental_binary::input_args_map_): New data member.
4927         (Incremental_binary::library_map_): New data member.
4928         (Incremental_binary::script_map_): New data member.
4929         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4930         new data members.
4931         (Sized_incremental_binary::output_section): New function.
4932         (Sized_incremental_binary::inputs_reader): Add const.
4933         (Sized_incremental_binary::symtab_reader): Add const.
4934         (Sized_incremental_binary::relocs_reader): Add const.
4935         (Sized_incremental_binary::got_plt_reader): Add const.
4936         (Sized_incremental_binary::get_symtab_view): New function.
4937         (Sized_incremental_binary::Inputs_reader): New typedef.
4938         (Sized_incremental_binary::Input_entry_reader): New typedef.
4939         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4940         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4941         (Sized_incremental_binary::do_file_has_changed): New function.
4942         (Sized_incremental_binary::do_init_layout): New function.
4943         (Sized_incremental_binary::do_reserve_layout): New function.
4944         (Sized_input_reader::Inputs_reader): Remove.
4945         (Sized_input_reader::Input_entry_reader): Remove.
4946         (Sized_input_reader::do_arg_serial): New function.
4947         (Sized_input_reader::do_get_unused_symbol_count): New function.
4948         (Sized_input_reader::do_get_unused_symbol): New function.
4949         (Sized_incremental_binary::do_input_file_count): New function.
4950         (Sized_incremental_binary::do_get_input_reader): Change signature;
4951         use index instead of filename.
4952         (Sized_incremental_binary::section_map_): New data member.
4953         (Sized_incremental_binary::input_entry_readers_): New data member.
4954         (class Sized_incr_relobj): New class.
4955         (class Sized_incr_dynobj): New class.
4956         (make_sized_incremental_object): New function.
4957         (class Incremental_library): New class.
4958         * layout.cc (Free_list::num_lists): New static data member.
4959         (Free_list::num_nodes): New static data member.
4960         (Free_list::num_removes): New static data member.
4961         (Free_list::num_remove_visits): New static data member.
4962         (Free_list::num_allocates): New static data member.
4963         (Free_list::num_allocate_visits): New static data member.
4964         (Free_list::init): New function.
4965         (Free_list::remove): New function.
4966         (Free_list::allocate): New function.
4967         (Free_list::dump): New function.
4968         (Free_list::print_stats): New function.
4969         (Layout_task_runner::run): Resize output file for incremental updates.
4970         (Layout::Layout): Initialize new data members.
4971         (Layout::set_incremental_base): New function.
4972         (Layout::init_fixed_output_section): New function.
4973         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4974         incremental updates.
4975         (Layout::create_gold_note): Do not create gold note section for
4976         incremental updates.
4977         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4978         for incremental updates.
4979         (Layout::set_section_offsets): For incremental updates, allocate space
4980         from free list.
4981         (Layout::create_symtab_sections): Layout with offsets relative to
4982         start of section; for incremental updates, allocate space from free
4983         list.
4984         (Layout::create_shdrs): For incremental updates, allocate space from
4985         free list.
4986         (Layout::finish_dynamic_section): For incremental updates, do not
4987         check --as-needed (fixed in subsequent patch).
4988         * layout.h (class Free_list): New class.
4989         (Layout::set_incremental_base): New function.
4990         (Layout::incremental_base): New function.
4991         (Layout::init_fixed_output_section): New function.
4992         (Layout::allocate): New function.
4993         (Layout::incremental_base_): New data member.
4994         (Layout::free_list_): New data member.
4995         * main.cc (main): Print Free_list statistics.
4996         * object.cc (Relobj::finalize_incremental_relocs): Add
4997         clear_counts parameter; clear counts only when clear_counts is set.
4998         (Sized_relobj::Sized_relobj): Initialize new base class.
4999         (Sized_relobj::do_layout): Don't report special sections.
5000         (Sized_relobj::do_for_all_local_got_entries): New function.
5001         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5002         symtab_off to all symbol table offsets.
5003         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5004         * object.h (class Got_offset_list): Move to top of file.
5005         (Object::Object): Allow case where input_file == NULL.
5006         (Object::~Object): Likewise.
5007         (Object::input_file): Assert that input_file != NULL.
5008         (Object::lock): Allow case where input_file == NULL.
5009         (Object::unlock): Likewise.
5010         (Object::is_locked): Likewise.
5011         (Object::token): Likewise.
5012         (Object::release): Likewise.
5013         (Object::is_incremental): New function.
5014         (Object::get_mtime): New function.
5015         (Object::for_all_local_got_entries): New function.
5016         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5017         (Object::set_is_in_system_directory): New function.
5018         (Object::is_in_system_directory): New function.
5019         (Object::do_is_incremental): New function.
5020         (Object::do_get_mtime): New function.
5021         (Object::do_for_all_local_got_entries): New function.
5022         (Object::is_in_system_directory_): New data member.
5023         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5024         (class Sized_relobj_base): New class.
5025         (class Sized_relobj): Derive from Sized_relobj_base.
5026         (class Sized_relobj::Symbols): Redeclare from base class.
5027         (class Sized_relobj::local_got_offset_list): Remove.
5028         (class Sized_relobj::Output_sections): Redeclare from base class.
5029         (class Sized_relobj::do_for_all_local_got_entries): New function.
5030         (class Sized_relobj::write_local_symbols): Add offset parameter.
5031         (class Sized_relobj::local_symbol_offset_): Update comment.
5032         (class Sized_relobj::local_dynsym_offset_): Update comment.
5033         * options.cc (Input_arguments::add_file): Remove const.
5034         * options.h (Input_file_argument::Input_file_argument):
5035         Initialize arg_serial_ (all constructors).
5036         (Input_file_argument::set_arg_serial): New function.
5037         (Input_file_argument::arg_serial): New function.
5038         (Input_file_argument::arg_serial_): New data member.
5039         (Input_arguments::Input_arguments): Initialize file_count_.
5040         (Input_arguments::add_file): Remove const.
5041         (Input_arguments::number_of_input_files): New function.
5042         (Input_arguments::file_count_): New data member.
5043         (Command_line::number_of_input_files): Call
5044         Input_arguments::number_of_input_files.
5045         * output.cc (Output_segment_headers::Output_segment_headers):
5046         Set current size.
5047         (Output_section::Input_section::current_data_size): New function.
5048         (Output_section::Output_section): Initialize new data members.
5049         (Output_section::add_input_section): Don't do merge sections for
5050         an incremental link; allocate space from free list for an
5051         incremental update.
5052         (Output_section::add_output_section_data): Allocate space from
5053         free list for an incremental update.
5054         (Output_section::update_data_size): New function.
5055         (Output_section::set_fixed_layout): New function.
5056         (Output_section::reserve): New function.
5057         (Output_segment::set_section_addresses): Remove const.
5058         (Output_segment::set_section_list_addresses): Remove const; allocate
5059         space from free list for an incremental update.
5060         (Output_segment::set_offset): Adjust size of RELRO segment for an
5061         incremental update.
5062         * output.h (Output_data::current_data_size): Move here from
5063         child classes.
5064         (Output_data::pre_finalize_data_size): New function.
5065         (Output_data::update_data_size): New function.
5066         (Output_section_headers::update_data_size): new function.
5067         (Output_section_data_build::current_data_size): Move to Output_data.
5068         (Output_data_strtab::update_data_size): New function.
5069         (Output_section::current_data_size): Move to Output_data.
5070         (Output_section::set_fixed_layout): New function.
5071         (Output_section::has_fixed_layout): New function.
5072         (Output_section::reserve): New function.
5073         (Output_section::update_data_size): New function.
5074         (Output_section::has_fixed_layout_): New data member.
5075         (Output_section::free_list_): New data member.
5076         (Output_segment::set_section_addresses): Remove const.
5077         (Output_segment::set_section_list_addresses): Remove const.
5078         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5079         New function.
5080         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5081         New function.
5082         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5083         parameter when calling Add_symbols constructor; store argument
5084         serial number for members of a lib group.
5085         (Add_symbols::locks): Allow case where token == NULL.
5086         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5087         (Read_member::~Read_member): New function.
5088         (Read_member::is_runnable): New function.
5089         (Read_member::locks): New function.
5090         (Read_member::run): New function.
5091         (Check_script::~Check_script): New function.
5092         (Check_script::is_runnable): New function.
5093         (Check_script::locks): New function.
5094         (Check_script::run): New function.
5095         (Check_library::~Check_library): New function.
5096         (Check_library::is_runnable): New function.
5097         (Check_library::locks): New function.
5098         (Check_library::run): New function.
5099         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5100         (Add_symbols::library_): New data member.
5101         (class Read_member): New class.
5102         (class Check_script): New class.
5103         (class Check_library): New class.
5104         * reloc.cc (Read_relocs::is_runnable): Allow case where
5105         token == NULL.
5106         (Read_relocs::locks): Likewise.
5107         (Scan_relocs::locks): Likewise.
5108         (Relocate_task::locks): Likewise.
5109         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5110         to clear counters.
5111         (Sized_relobj::incremental_relocs_scan): Fix comment.
5112         (Sized_relobj::do_relocate): Pass output file offset to
5113         write_local_symbols.
5114         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5115         from class declaration.
5116         * script.cc (read_input_script): Allocate Script_info; pass
5117         argument serial number to report_script.
5118         * script.h (class Script_info): Move to incremental.h.
5119         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5120         * symtab.h (Symbol_table::add_from_incrobj): New function.
5121         (Symbol_table::set_file_offset): New function.
5122
5123 2011-04-05  Cary Coutant  <ccoutant@google.com>
5124
5125         * incremental-dump.cc (dump_incremental_inputs): Change signature
5126         to take a Sized_incremental_binary; change caller.  Use readers
5127         in Sized_incremental_binary.
5128         * incremental.cc
5129         (Sized_incremental_binary::find_incremental_inputs_sections):
5130         Rename do_find_incremental_inputs_sections to this.
5131         (Sized_incremental_binary::setup_readers): New function.
5132         (Sized_incremental_binary::do_check_inputs): Check
5133         has_incremental_info_ flag; move setup code to setup_readers;
5134         use input readers.
5135         (Sized_incremental_binary::do_file_is_unchanged): New function.
5136         (Sized_incremental_binary::do_get_input_reader): New function.
5137         * incremental.h (class Incremental_binary): Move to end of file.
5138         (Incremental_binary::file_is_unchanged): New function.
5139         (Incremental_binary::do_file_is_unchanged): New function.
5140         (Incremental_binary::Input_reader): New class.
5141         (Incremental_binary::get_input_reader): New function.
5142         (class Sized_incremental_binary): Move to end of file.
5143         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5144         input section reader classes.
5145         (Sized_incremental_binary::has_incremental_info): New function.
5146         (Sized_incremental_binary::inputs_reader): New function.
5147         (Sized_incremental_binary::symtab_reader): New function.
5148         (Sized_incremental_binary::relocs_reader): New function.
5149         (Sized_incremental_binary::got_plt_reader): New function.
5150         (Sized_incremental_binary::do_file_is_unchanged): New function.
5151         (Sized_incremental_binary::Sized_input_reader): New class.
5152         (Sized_incremental_binary::get_input_reader): New function.
5153         (Sized_incremental_binary::find_incremental_inputs_sections):
5154         Rename do_find_incremental_inputs_sections to this.
5155         (Sized_incremental_binary::setup_readers): New function.
5156         (Sized_incremental_binary::has_incremental_info_): New data member.
5157         (Sized_incremental_binary::inputs_reader_): New data member.
5158         (Sized_incremental_binary::symtab_reader_): New data member.
5159         (Sized_incremental_binary::relocs_reader_): New data member.
5160         (Sized_incremental_binary::got_plt_reader_): New data member.
5161         (Sized_incremental_binary::current_input_file_): New data member.
5162
5163 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5164
5165         PR gold/12640
5166         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5167         violation.
5168
5169 2011-03-30  Cary Coutant  <ccoutant@google.com>
5170
5171         * archive.cc (Archive::include_member): Adjust call to report_object.
5172         (Add_archive_symbols::run): Add script_info to call to
5173         report_archive_begin.
5174         (Lib_group::include_member): Adjust call to report_object.
5175         (Add_lib_group_symbols::run): Adjust call to report_object.
5176         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5177         blocks.  Add object count for script input files.
5178         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5179         script_info parameter; change all callers.
5180         (Incremental_inputs::report_object): Add script_info parameter;
5181         change all callers.
5182         (Incremental_inputs::report_script): Store backpointer to
5183         incremental info entry.
5184         (Output_section_incremental_inputs::set_final_data_size): Record
5185         additional information for scripts.
5186         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5187         * incremental.h (Incremental_script_entry::add_object): New function.
5188         (Incremental_script_entry::get_object_count): New function.
5189         (Incremental_script_entry::get_object): New function.
5190         (Incremental_script_entry::objects_): New data member; adjust
5191         constructor.
5192         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5193         (Incremental_inputs::report_object): Add script_info parameter.
5194         (Incremental_inputs_reader::get_object_count): New function.
5195         (Incremental_inputs_reader::get_object_offset): New function.
5196         * options.cc (Input_arguments::add_file): Return reference to
5197         new input argument.
5198         * options.h (Input_argument::set_script_info): New function.
5199         (Input_argument::script_info): New function.
5200         (Input_argument::script_info_): New data member; adjust all
5201         constructors.
5202         (Input_file_group::add_file): Return reference to new input argument.
5203         (Input_file_lib::add_file): Likewise.
5204         (Input_arguments::add_file): Likewise.
5205         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5206         * script.cc (Parser_closure::Parser_closure): Add script_info
5207         parameter; adjust all callers.
5208         (Parser_closure::script_info): New function.
5209         (Parser_closure::script_info_): New data member.
5210         (read_input_script): Report scripts earlier to incremental info.
5211         (script_add_file): Set script_info in Input_argument.
5212         (script_add_library): Likewise.
5213         * script.h (Script_options::Script_info): Rewrite class.
5214
5215 2011-03-29  Cary Coutant  <ccoutant@google.com>
5216
5217         * archive.cc (Library_base::should_include_member): Move
5218         method here from class Archive.
5219         (Archive::Archive): Initialize base class.
5220         (Archive::should_include_member): Move to base class.
5221         (Archive::do_for_all_unused_symbols): New function.
5222         (Add_archive_symbols::run): Remove redundant access to
5223         incremental_inputs.
5224         (Lib_group::Lib_group): Initialize base class.
5225         (Lib_group::do_filename): New function.
5226         (Lib_group::include_member): Pass pointer to Lib_group to
5227         report_object.
5228         (Lib_group::do_for_all_unused_symbols): New function.
5229         (Add_lib_group_symbols::run): Report archive information for
5230         incremental links.
5231         * archive.h (class Library_base): New base class.
5232         (class Archive): Derive from Library_base.
5233         (Archive::filename): Move to base class.
5234         (Archive::set_incremental_info): Likewise.
5235         (Archive::incremental_info): Likewise.
5236         (Archive::Should_include): Likewise.
5237         (Archive::should_include_member): Likewise.
5238         (Archive::Armap_entry): Remove.
5239         (Archive::Unused_symbol_iterator): Remove.
5240         (Archive::unused_symbols_begin): Remove.
5241         (Archive::unused_symbols_end): Remove.
5242         (Archive::do_filename): New function.
5243         (Archive::do_get_mtime): New function.
5244         (Archive::do_for_all_unused_symbols): New function.
5245         (Archive::task_): Move to base class.
5246         (Archive::incremental_info_): Likewise.
5247         (class Lib_group): Derive from Library_base.
5248         (Lib_group::do_filename): New function.
5249         (Lib_group::do_get_mtime): New function.
5250         (Lib_group::do_for_all_unused_symbols): New function.
5251         (Lib_group::task_): Move to base class.
5252         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5253         function.
5254         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5255         function.
5256         * incremental.cc (Incremental_inputs::report_archive_begin):
5257         Use Library_base; call library's get_mtime; add incremental inputs
5258         entry before members.
5259         (class Unused_symbol_visitor): New class.
5260         (Incremental_inputs::report_archive_end): Use Library_base; use
5261         visitor class to record unused symbols; don't add incremental inputs
5262         entry after members.
5263         (Incremental_inputs::report_object): Use Library_base.
5264         * incremental.h
5265         (Incremental_archive_entry::Incremental_archive_entry): Remove
5266         unused Archive parameter.
5267         (Incremental_inputs::report_archive_begin): Use Library_base.
5268         (Incremental_inputs::report_archive_end): Likewise.
5269         (Incremental_inputs::report_object): Likewise.
5270         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5271         function.
5272         * object.h (Object::for_all_global_symbols): New function.
5273         (Object::do_for_all_global_symbols): New function.
5274         (Sized_relobj::do_for_all_global_symbols): New function.
5275         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5276         function.
5277         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5278         function.
5279
5280 2011-03-27  Ian Lance Taylor  <iant@google.com>
5281
5282         * archive.cc (Archive::interpret_header): Return -1 if something
5283         goes wrong.  Change callers accordingly.
5284
5285 2011-03-25  Cary Coutant  <ccoutant@google.com>
5286
5287         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5288         * testsuite/Makefile.in: Regenerate.
5289
5290 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5291
5292         * plugin.cc (get_view): New.
5293         (Plugin::load): Pass get_view to the plugin.
5294         (Plugin_manager::get_view): New.
5295
5296 2011-03-21  Ian Lance Taylor  <iant@google.com>
5297
5298         * testsuite/final_layout.sh: Rewrite to not use dc.
5299         * testsuite/relro_test.sh: Fail if dc is not present.
5300
5301 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5302
5303         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5304         Change == to -eq.
5305         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5306         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5307         Change == to -eq.
5308         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5309         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5310
5311 2011-03-14  Ian Lance Taylor  <iant@google.com>
5312
5313         * script-sections.cc (Sort_output_sections::script_compare):
5314         Rename from is_before, change return type.
5315         (Sort_output_sections::operator()): Adjust accordingly.
5316
5317 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5318
5319         PR gold/12572
5320         * testsuite/odr_violation2.cc: Add comment to make all error line
5321         numbers double digits.
5322         * testsuite/debug_msg.sh: Adjust expected errors.
5323
5324 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5325
5326         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5327         but mark earlier ones as non-canonical
5328         (offset_to_iterator): Update search target and example
5329         (do_addr2line): Return extra lines in a vector*
5330         (format_file_lineno): Extract from do_addr2line
5331         (one_addr2line): Add vector* out-param
5332         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5333         when a lineno entry appeared last for its instruction
5334         (Dwarf_line_info): Add vector* out-param
5335         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5336         * symtab.cc (Odr_violation_compare): Include the lineno in the
5337         comparison again.
5338         (linenos_from_loc): New. Combine the canonical line for an
5339         address with its other lines.
5340         (True_if_intersect): New. Helper functor to make
5341         std::set_intersection a query.
5342         (detect_odr_violations): Compare sets of lines instead of just
5343         one line for each function. This became less deterministic, but
5344         has fewer false positives.
5345         * symtab.h: Declarations.
5346         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5347         mix an optimized and non-optimized object in the same binary
5348         (odr_violation2.so): Same.
5349         * testsuite/Makefile.in: Regenerate from Makefile.am.
5350         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5351         * testsuite/debug_msg.sh: Update line numbers and add
5352         assertions.
5353         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5354         non-optimized context.
5355         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5356         isn't inlined, and use OdrDerived in an optimized context.
5357         * testsuite/odr_header1.h: Defines OdrDerived, where
5358         optimization will change the
5359         first-instruction-in-the-destructor's file and line number.
5360         * testsuite/odr_header2.h: Defines OdrBase.
5361
5362 2011-03-09  Ian Lance Taylor  <iant@google.com>
5363
5364         * fileread.cc (File_read::clear_views): Don't delete the whole
5365         file view.
5366
5367 2011-03-08  Ian Lance Taylor  <iant@google.com>
5368
5369         PR gold/12525
5370         * fileread.cc: #include <climits>.
5371         (GOLD_IOV_MAX): Define.
5372         (File_read::read_multiple): Limit number of entries by iov_max.
5373         * fileread.h (class File_read): Always set max_readv_entries to
5374         128.
5375
5376 2011-03-07  Ian Lance Taylor  <iant@google.com>
5377
5378         PR gold/12525
5379         * options.h (class General_options): Add -dy and -dn.
5380
5381 2011-03-02  Cary Coutant  <ccoutant@google.com>
5382
5383         * testsuite/script_test_9.t: Add TLS segment.
5384
5385 2011-03-02  Simon Baldwin  <simonb@google.com>
5386
5387         * configure.ac: Add check for gnu_indirect_function support in
5388         the toolchain building binutils.
5389         * configure: Rebuild.
5390
5391 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5392
5393         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5394         plugin only symbols.
5395         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5396         in plugin files as not needed in the symbol table.
5397
5398 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5399
5400         * output.cc (Output_section::add_input_section): Delay fill
5401         generation for section ordering.
5402
5403 2011-02-09  Ian Lance Taylor  <iant@google.com>
5404
5405         PR gold/12316
5406         * object.h (class Sized_relobj): Remove clear_local_symbols.
5407         * reloc.cc (Sized_relobj::do_relocate): Don't call
5408         clear_local_symbols.
5409
5410 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5411
5412         * plugin.cc (is_visible_from_outside): Return true for symbols
5413         in the -u option.
5414
5415 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5416
5417         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5418         filename.
5419
5420 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5421
5422         * icf.h (is_section_foldable_candidate): Change type of parameter
5423         to std::string.
5424         * icf.cc (Icf::find_identical_sections): Change type of local variable
5425         section_name to be std::string.
5426         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5427
5428 2011-01-25  Ian Lance Taylor  <iant@google.com>
5429
5430         * script.cc (script_add_extern): Rewrite to use
5431         add_symbol_reference.
5432
5433 2011-01-25  Doug Kwan  <dougkwan@google.com>
5434
5435         * icf.cc (get_section_contents): Always lock section's object.
5436
5437 2011-01-24  Ian Lance Taylor  <iant@google.com>
5438
5439         * options.h (class General_options): Accept
5440         --no-detect-odr-violations.
5441
5442 2011-01-24  Ian Lance Taylor  <iant@google.com>
5443
5444         * version.cc (version_string): Bump to 1.11.
5445
5446 2011-01-24  Ian Lance Taylor  <iant@google.com>
5447
5448         * plugin.cc (class Plugin_rescan): Define new class.
5449         (Plugin_manager::claim_file): Set any_claimed_.
5450         (Plugin_manager::save_archive): New function.
5451         (Plugin_manager::save_input_group): New function.
5452         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5453         necessary.
5454         (Plugin_manager::new_undefined_symbol): New function.
5455         (Plugin_manager::rescan): New function.
5456         (Plugin_manager::rescannable_defines): New function.
5457         (Plugin_manager::add_input_file): Set any_added_.
5458         * plugin.h (class Plugin_manager): define new fields rescannable_,
5459         undefined_symbols_, any_claimed_, and any_added_.  Declare
5460         Plugin_rescan as friend.  Declare new functions.
5461         (Plugin_manager::Rescannable): Define type.
5462         (Plugin_manager::Rescannable_list): Define type.
5463         (Plugin_manager::Undefined_symbol_list): Define type.
5464         (Plugin_manager::Plugin_manager): Initialize new fields.
5465         * archive.cc (Archive::defines_symbol): New function.
5466         (Add_archive_symbols::run): Pass archive to plugins if any.
5467         * archive.h (class Archive): Declare defines_symbol.
5468         * readsyms.cc (Input_group::~Input_group): New function.
5469         (Finish_group::run): Pass input_group to plugins if any.
5470         * readsyms.h (class Input_group): Declare destructor.
5471         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5472         any.
5473
5474 2011-01-10  Ian Lance Taylor  <iant@google.com>
5475
5476         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5477         section as relro.
5478         (Layout::set_segment_offsets): Reset increase_relro before calling
5479         set_section_addresses a second time.
5480
5481 2011-01-04  Cary Coutant  <ccoutant@google.com>
5482
5483         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5484         sections before NOBITS sections.
5485
5486 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5487
5488         * version.cc (print_version): Update copyright to 2011.
5489
5490 2010-12-23  Cary Coutant  <ccoutant@google.com>
5491
5492         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5493         of OS to this->add.  Add OD parameter to second form of the function.
5494
5495 2010-12-20  Ian Lance Taylor  <iant@google.com>
5496
5497         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5498         second of two consecutive entries with same offset.
5499
5500 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5501
5502         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5503         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5504         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5505         to avoid unneeded links against $(LDADD).
5506         * testsuite/Makefile.in: Regenerate.
5507
5508 2010-12-15  Ian Lance Taylor  <iant@google.com>
5509
5510         PR gold/12324
5511         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5512         for R_X86_64_32 and R_X86_64_PC32.
5513         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5514         ver_matching_def_pic.o.
5515         (ver_matching_def_pic.o): New target.
5516
5517 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5518
5519         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5520         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5521         Move definition before File_read::View member definitions.
5522         (File_read::View::~View): Initialize and hold lock before
5523         updating current_mapped_bytes.
5524
5525 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5526
5527         * dwarf_reader.cc: Remove outdated comment.
5528         * gold-threads.cc: Fix typo in error message.
5529         * archive.cc: Fix typos in comments.
5530         * archive.h: Likewise.
5531         * arm-reloc-property.cc: Likewise.
5532         * arm-reloc-property.h: Likewise.
5533         * arm-reloc.def: Likewise.
5534         * arm.cc: Likewise.
5535         * attributes.h: Likewise.
5536         * cref.cc: Likewise.
5537         * ehframe.cc: Likewise.
5538         * fileread.h: Likewise.
5539         * gold.h: Likewise.
5540         * i386.cc: Likewise.
5541         * icf.cc: Likewise.
5542         * incremental.h: Likewise.
5543         * int_encoding.cc: Likewise.
5544         * layout.h: Likewise.
5545         * main.cc: Likewise.
5546         * merge.h: Likewise.
5547         * object.cc: Likewise.
5548         * object.h: Likewise.
5549         * options.cc: Likewise.
5550         * readsyms.cc: Likewise.
5551         * reduced_debug_output.cc: Likewise.
5552         * reloc.cc: Likewise.
5553         * script-sections.cc: Likewise.
5554         * sparc.cc: Likewise.
5555         * symtab.h: Likewise.
5556         * target-reloc.h: Likewise.
5557         * target.cc: Likewise.
5558         * target.h: Likewise.
5559         * timer.cc: Likewise.
5560         * timer.h: Likewise.
5561         * x86_64.cc: Likewise.
5562
5563 2010-12-09  Cary Coutant  <ccoutant@google.com>
5564
5565         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5566         stack.
5567         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5568         parameter; change all callers.
5569         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5570         * options.h (warn_execstack): New option.
5571
5572 2010-12-07  Doug Kwan  <dougkwan@google.com>
5573
5574         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5575         like function call relocations.
5576
5577 2010-12-07  Ian Lance Taylor  <iant@google.com>
5578
5579         * archive.cc (Archive::get_elf_object_for_member): Permit
5580         punconfigured to be NULL.
5581         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5582         (Archive::include_member): Pass NULL to get_elf_object_for_member
5583         if we searched for the archive and this is the first included
5584         object.
5585
5586 2010-12-01  Ian Lance Taylor  <iant@google.com>
5587
5588         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5589         track_relocs_type_ field.
5590         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5591         Set track_relocs_type_.
5592         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5593         contents when using RELA relocs.
5594         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5595         reloc_map_.
5596         * reloc.cc (Track_relocs::next_addend): New function.
5597         * reloc.h (class Track_relocs): Declare next_addend.
5598
5599 2010-12-01  Ian Lance Taylor  <iant@google.com>
5600
5601         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5602         virtual destructor.
5603
5604 2010-12-01  Ian Lance Taylor  <iant@google.com>
5605
5606         * README: Update compilers known to work and fail.
5607
5608 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5609
5610         * configure.in: For --enable-gold, handle value `default' instead of
5611         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5612         not the default.
5613         * configure: Regenerate.
5614
5615 2010-11-18  Doug Kwan  <dougkwan@google.com>
5616
5617         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5618         and right_alignment to be zero.  Store result alignment only if it is
5619         greater than existing alignment.
5620
5621 2010-11-16  Cary Coutant  <ccoutant@google.com>
5622
5623         PR gold/12220
5624         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5625         Check for ".zdebug_line".
5626
5627 2010-11-16  Doug Kwan  <dougkwan@google.com>
5628             Cary Coutant  <ccoutant@google.com>
5629
5630         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5631         by reference; adjust all callers.
5632         * output.cc (Output_segment::set_section_addresses): Adjust references
5633         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5634         list is empty.
5635         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5636         end at page boundary.
5637
5638 2010-11-16  Cary Coutant  <ccoutant@google.com>
5639
5640         PR gold/12220
5641         * layout.cc (Layout::choose_output_section): Transform names of
5642         compressed sections even when using a script with a SECTIONS clause.
5643         (Layout::output_section_name): Remove code to transform
5644         compressed debug section names.
5645         * output.cc (Output_section::add_input_section): Use uncompressed
5646         section size when tracking input sections.
5647
5648 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5649
5650         * symtab.h (Symbol::NON_PIC_REF): Remove.
5651         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5652         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5653         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5654         (Symbol::use_plt_offset): Take a flags argument and pass it
5655         directly to needs_dynamic_reloc.  Restrict check for undefined
5656         weak symbols to function calls.
5657         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5658         (Target_arm::Scan::global): Use it.
5659         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5660         (Target_arm::Relocate::relocate): Likewise.
5661         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5662         parameter with an r_type parameter.  Use get_reference_flags
5663         to get the flags.
5664         (Target_arm::Relocate::relocate): Update accordingly.
5665         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5666         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5667         (Target_i386::Scan::global): Likewise.
5668         (Target_i386::Relocate::relocate): Likewise.
5669         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5670         parameter with an r_type parameter.  Use get_reference_flags
5671         to get the flags.
5672         (Target_i386::Relocate::relocate): Update accordingly.
5673         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5674         (Target_powerpc::Scan::global): Use it.
5675         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5676         (Target_powerpc::Relocate::relocate): Likewise.
5677         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5678         (Target_sparc::Scan::global): Use it.
5679         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5680         (Target_sparc::Relocate::relocate): Likewise.
5681         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5682         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5683         (Target_x86_64::Scan::global): Likewise.
5684         (Target_x86_64::Relocate::relocate): Likewise.
5685
5686 2010-11-08  Doug Kwan  <dougkwan@google.com>
5687             Cary Coutant  <ccoutant@google.com>
5688
5689         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5690         (Arm_exidx_merge_section::section_contents_): New data member.
5691         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5692         (Arm_input_section::~Arm_input_section): De-allocate memory.
5693         (Arm_input_section::original_contents_): New data member.
5694         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5695         in parameters instead of calling Object::section_contents without
5696         locking.
5697         (Arm_output_section::group_section): New parameter TASK.  Pass it
5698         to callees that need locking objects.
5699         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5700         to lock EXIDX input sections.  Fix a formatting issue.  Call
5701         Arm_exidx_merged_section::build_contents to create merged section
5702         contents.
5703         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5704         to lock object of stub table owner.
5705         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5706         TEXT_SIZE to initialize data member TEXT_SIZE_.
5707         (Arm_exidx_input_section::addralign): Fix typo in comment.
5708         (Arm_exidx_input_section::text_size): New method.
5709         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5710         that require locking objects.  Lock objects before scanning for stubs
5711         and updating local symbols.
5712         (Arm_input_section<big_endian>::init): Copy contents of original
5713         input section.
5714         (Arm_input_section<big_endian>::do_write): Use saved contents of
5715         original input section instead of calling Object::section_contents
5716         without locking.
5717         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5718         size without calling Object::section_size().
5719         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5720         for size.  Allocate a buffer for merged EXIDX entries.
5721         (Arm_exidx_merged_section::build_contents): New method.
5722         (Arm_exidx_merged_section::do_write): Move merge section contents
5723         building code to Arm_exidx_merged_section::build_contetns.  Write
5724         out contetns in buffer instead of building it on the fly.
5725         (Arm_relobj::make_exidx_input_section): Also pass text section size
5726         to Arm_exidx_input_section constructor.
5727         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5728         (Arm_dynobj::do_read_symbols): Fix memory leak.
5729         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5730         * target.h: (class Task): Add forward declaration.
5731         (Target::relax): Add new parameter TASK and pass it to
5732         Target::do_relax().
5733         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5734
5735 2010-11-05  Cary Coutant  <ccoutant@google.com>
5736
5737         PR gold/10708
5738         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5739         object when reading from the file.
5740         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5741         second layout pass.
5742         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5743         when reading section contents.
5744         (get_section_contents): Likewise.
5745         (icf::find_identical_sections): Likewise.
5746         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5747         object when reading from the file.
5748         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5749         the object when doing deferred section layout.
5750
5751 2010-11-03  Nick Clifton  <nickc@redhat.com>
5752
5753         PR gold/12001
5754         * script.h (class Symbol_assignment: name): New member.  Returns
5755         the name of the symbol.
5756         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5757         Returns true if the given symbol name is on the list of
5758         assignments wating to be processed.
5759         * archive.cc (should_incldue_member): If the symbol is undefined,
5760         check to see if it is on the list of symbols pending assignment.
5761
5762 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5763
5764         * script-sections.cc (Script_sections::find_memory_region): Check
5765         for a NULL output section pointer.
5766
5767 2010-10-29  Doug Kwan  <dougkwan@google.com>
5768
5769         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5770         Output_section::add_relaxed_input_section.
5771         * output.cc (Output_section::add_relaxed_input_section): Add new
5772         arguments LAYOUT and NAME.  Set section order index.
5773         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5774         Copy section order index.
5775         * output.h (Output_section::add_relaxed_input_section): Add new
5776         arguments LAYOUT and NAME.
5777
5778 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5779
5780         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5781         NATIVE_OR_CROSS_LINKER.
5782         * testsuite/Makefile.in: Regenerate.
5783
5784 2010-10-20  Doug Kwan  <dougkwan@google.com>
5785
5786         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5787         without SHF_LINK_ORDER flags.
5788         * layout.cc (Layout::choose_output_section): Do not filter
5789         SHF_LINK_ORDER flag in a relocatable link.
5790
5791 2010-10-17  Cary Coutant  <ccoutant@google.com>
5792
5793         * output.h (Output_segment::set_section_addresses): Change function
5794         signature.  Update all callers.
5795         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5796         sections.
5797         (Output_segment::set_section_addresses): Align after last TLS
5798         section.  Add padding before last relro section instead of after.
5799
5800 2010-10-17  Doug Kwan  <dougkwan@google.com>
5801
5802         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5803         GOT output section to be writable.
5804
5805 2010-10-14  Cary Coutant  <ccoutant@google.com>
5806
5807         * debug.h (DEBUG_INCREMENTAL): New flag.
5808         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5809         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5810         mode.
5811         * incremental.cc (report_command_line): Ignore all forms of
5812         --incremental.
5813         * layout.cc (Layout::Layout): Check parameters for incremental link
5814         mode.
5815         * options.cc (General_options::parse_incremental): New function.
5816         (General_options::parse_no_incremental): New function.
5817         (General_options::parse_incremental_full): New function.
5818         (General_options::parse_incremental_update): New function.
5819         (General_options::incremental_mode_): New data member.
5820         (General_options::finalize): Check incremental_mode_.
5821         * options.h (General_options): Update help text for --incremental.
5822         Add --no-incremental, --incremental-full, --incremental-update.
5823         (General_options::Incremental_mode): New enum type.
5824         (General_options::incremental_mode): New function.
5825         (General_options::incremental_mode_): New data member.
5826         * parameters.cc (Parameters::incremental_mode_): New data member.
5827         (Parameters::set_options): Set incremental_mode_.
5828         (Parameters::set_incremental_full): New function.
5829         (Parameters::incremental): New function.
5830         (Parameters::incremental_update): New function.
5831         (set_parameters_incremental_full): New function.
5832         * parameters.h (Parameters::set_incremental_full): New function.
5833         (Parameters::incremental): New function.
5834         (Parameters::incremental_update): New function.
5835         (Parameters::incremental_mode_): New data member.
5836         (set_parameters_incremental_full): New function.
5837         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5838         incremental link mode.
5839         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5840         (Sized_relobj::do_relocate_sections): Likewise.
5841         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5842         option.
5843         * testsuite/Makefile.in: Regenerate.
5844         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5845
5846 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5847
5848         * script-sections.h (class Script_sections): Make
5849         Sections_elements typedef public.
5850         * script-sections.cc (class Sort_output_sections): Add elements_
5851         field.  Add constructor which sets it; change all callers.
5852         (Sort_output_sections::is_before): New function.
5853         (Sort_output_sections::operator()): Call is_before.
5854         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5855         conditional.
5856         * testsuite/script_test_10.sh: New test. Test script section
5857         order.
5858         * testsuite/script_test_10.t: Likewise.
5859         * testsuite/script_test_10.s: Likewise.
5860         * testsuite/Makefile.am: Wrap the cross linker tests and the
5861         common tests into NATIVE_OR_CROSS_LINKER.
5862         (check_SCRIPTS): Add script_test_10.sh.
5863         (check_DATA): Add script_test_10.stdout.
5864         (script_test_10.o, script_test_10): New targets.
5865         (script_test_10.stdout): New target.
5866         * configure, testsuite/Makefile.in: Regenerate.
5867
5868 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5869
5870         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5871         error for the deprecated relocations.
5872         (Target_arm::Scan::global): Likewise.
5873         (Target_arm::Relocate::relocate): Likewise.
5874
5875 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5876
5877         * fileread.cc (Input_file::find_file): Initialize *found_name
5878         and *namep when using the fallback search for case 4.
5879
5880 2010-10-11  Cary Coutant  <ccoutant@google.com>
5881
5882         * options.h (class General_options): Redefine -z lazy as an alias for
5883         the negation of -z now.
5884
5885 2010-10-11  Ian Lance Taylor  <iant@google.com>
5886
5887         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5888         binding.
5889
5890 2010-10-06  Nick Clifton  <nickc@redhat.com>
5891
5892         * script-sections.cc(class Memory_region): Remove
5893         current_lma_offset_ field.  Rename current_vma_offset_ to
5894         current_offset_.  Add last_section_ field.
5895         (Memory_region::get_current_vma_address): Rename to
5896         get_current_address.
5897         (Memory_region::get_current_lma_address): Delete.
5898         (Memory_region::increment_vma_offset): Rename to
5899         increment_offset.
5900         (Memory_region::increment_lma_offset): Delete.
5901         (Memory_region::attributes_compatible): New method.  Returns
5902         true if the provided section is compatible with the region.
5903         (Memory_region::get_last_section): New method.  Returns the last
5904         section to use the region.
5905         (Memory_region::set_last_section): New method.  Stores the last
5906         section to use the region.
5907         (Script_sections::block_in_region): New method.  Returns true if
5908         a block of memory is contained within a region.
5909         (Script_sections::find_memory_region): New method.  Locates a
5910         memory region to be used to set a VMA or LMA address.
5911         (Output_section_definition::set_section_addresses): Add code to
5912         check for addresses set by memory regions.
5913         (Output_segment::set_section_addresses): Remove memory region
5914         walking code.
5915         (Script_sections::create_segment): Add a warning if a header
5916         segment is created outside of any region.
5917         * script-sections.h (class Script_sections): Add prototypes for
5918         find_memory_region and block_in_region methods.
5919         * testsuite/memory_test.s: Use .long instead of .word.
5920         * testsuite/memory_test.t: Add some more output sections.
5921         * testsuite/memory_test.sh: Update expected output.
5922
5923 2010-10-02  Doug Kwan  <dougkwan@google.com>
5924
5925         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5926         defintion to symtab.h
5927         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5928         declaration to defintion.
5929
5930 2010-10-01  Nick Clifton  <nickc@redhat.com>
5931
5932         * expression.cc (eval): Replace dummy argument with NULL.
5933         (eval_maybe_dot): Check for a NULL result section pointer.
5934         (Symbol_expression::value): Likewise.
5935         (Dot_expression::value): Likewise.
5936         (BINARY_EXPRESSION): Likewise.
5937         (Max_expression::value): Likewise.
5938         (Min_expression::value): Likewise.
5939         (Absolute_expression::value): Likewise.
5940         (Addr_expression::value_from_output_section): Likewise.
5941         (Loaddddr_expression::value_from_output_section): Likewise.
5942         (Segment_start_expression::value): Likewise.
5943         * script-sections.cc
5944         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5945         argument with NULL.
5946         (Sections_elememt_dot_assignment::set_section_addresses):
5947         Likewise.
5948         (Output_data_expression::do_write_to_buffer): Likewise.
5949         (Output_section_definition::finalize_symbols): Likewise.
5950         (Output_section_definition::set_section_addresses): Likewise.
5951
5952 2010-09-30  Doug Kwan  <dougkwan@google.com>
5953
5954         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5955
5956 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5957
5958         * target.h (Target::can_icf_inline_merge_sections): New virtual
5959         function.
5960         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5961         virtual function.
5962         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5963         virtual function.
5964         * icf.cc (get_section_contents): Inline merge sections only when
5965         target allows it.
5966
5967 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5968
5969         * configure: Regenerate.
5970
5971 2010-09-17  Ian Lance Taylor  <iant@google.com>
5972
5973         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5974         * testsuite/Makefile.am (memory_test.o): New target.
5975         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5976         memory_test.t.
5977         * testsuite/Makefile.in: Rebuild.
5978
5979 2010-09-17  Doug Kwan  <dougkwan@google.com>
5980
5981         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5982         defintion if relocation uses GOT entries of the symbol.
5983         * testsuite/icf_safe_test.sh: Fix test.
5984         * testsuite/icf_safe_so_test.sh: Fix test.
5985
5986 2010-09-16  Cary Coutant  <ccoutant@google.com>
5987
5988         * script_sections.cc (class Memory_region): Remove "NULL" from
5989         vector initializations.
5990
5991 2010-09-15  Cary Coutant  <ccoutant@google.com>
5992
5993         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5994         Resolve forwarding symbols.
5995
5996 2010-09-15  Doug Kwan  <dougkwan@google.com>
5997
5998         * gold/testsuite/script_test_3.t: Add ARM special sections.
5999         * gold/testsuite/script_test_4.t: Same.
6000         * gold/testsuite/script_test_5.t: Same.
6001         * gold/testsuite/script_test_6.t: Same.
6002         * gold/testsuite/script_test_7.t: Same.
6003         * gold/testsuite/script_test_7.t: Same.
6004         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6005
6006 2010-09-14  Cary Coutant  <ccoutant@google.com>
6007
6008         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6009         (Target_x86_64::Relocate::relocate_tls): Replace check for
6010         saw_tls_block_reloc_ with test for executable section.
6011
6012 2010-09-12  Cary Coutant  <ccoutant@google.com>
6013
6014         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6015         position-independent executables to shared libraries need dynamic
6016         relocations.
6017         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6018         position-independent executables.
6019         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6020         * testsuite/Makefile.in: Regenerate.
6021
6022 2010-09-10  Nick Clifton  <nickc@redhat.com>
6023
6024         PR gold/11997
6025         * testsuite/memory_test.t: Discard any sections that are not
6026         needed.
6027
6028 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6029
6030         PR gold/11996
6031         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6032         "This::" to work around a bug in gcc 4.2.
6033
6034         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6035
6036 2010-09-09  Rafael Espindola  <espindola@google.com>
6037
6038         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6039         sections with different PF_X flags in the same segment.
6040         (Layout::find_first_load_seg): Search all segments to find the first
6041         one.
6042         * options.h (rosegment): New.
6043
6044 2010-09-08  Rafael Espindola  <espindola@google.com>
6045
6046         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6047
6048 2010-09-08  Doug Kwan  <dougkwan@google.com>
6049
6050         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6051         (Arm_relobj::do_relocate_sections): Add new parameter for output
6052         file to match the parent.
6053         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6054         of local symbols instead of input values.  Update code to track
6055         changes in gold::relocate_section.
6056         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6057         (Sized_relobj::compute_final_local_value_internal): New methods.
6058         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6059         body into private version of Sized_relobj::compute_final_local_value.
6060         Call the inline method.
6061         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6062         merged symbol value if there is one.
6063         (Symbol_value::has_output_value): New method defintiion.
6064         (Sized_relobj::Compute_final_local_value_status): New enum type.
6065         (Sized_relobj::compute_final_local_value): New methods.
6066         (Sized_relobj::compute_final_local_value_internal): New methods.
6067         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6068         and arm_cortex_a8.sh.
6069         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6070         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6071         New tests.
6072         * Makefile.in: Regenerate.
6073         * testsuite/arm_bl_out_of_range.s: Update test.
6074         * testsuite/thumb_bl_out_of_range.s: Ditto.
6075         * testsuite/thumb_blx_out_of_range.s: Ditto.
6076         * testsuite/arm_branch_out_of_range.sh: New file.
6077         * testsuite/arm_cortex_a8.sh: Ditto.
6078         * testsuite/arm_cortex_a8_b.s: Ditto.
6079         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6080         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6081         * testsuite/arm_cortex_a8_bl.s: Ditto.
6082         * testsuite/arm_cortex_a8_blx.s: Ditto.
6083         * testsuite/arm_cortex_a8_local.s: Ditto.
6084         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6085         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6086
6087 2010-09-08  Rafael Espindola  <espindola@google.com>
6088
6089         * Makefile.am (memory_test.stdout): Run readelf with -W.
6090         * Makefile.in: Regenerate.
6091         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6092         64 bit output.
6093
6094 2010-09-08  Rafael Espindola  <espindola@google.com>
6095
6096         * script-sections.cc (Script_sections::add_memory_region): Convert
6097         field precision to int.
6098         * script.cc (script_set_section_region, script_set_section_region):
6099         Convert field precision to int.
6100
6101 2010-09-08  Rafael Espindola  <espindola@google.com>
6102
6103         * arm.cc (do_finalize_sections): Create the __exidx_start and
6104         __exdix_end symbols even when the section is missing.
6105
6106 2010-09-08  Nick Clifton  <nickc@redhat.com>
6107
6108         * README: Remove claim that MEMORY is not supported.
6109         * expression.cc (script_exp_function_origin)
6110         (script_exp_function_length): Move from here to ...
6111         * script.cc: ... here.
6112         (script_set_section_region, script_add_memory)
6113         (script_parse_memory_attr, script_include_directive): New
6114         functions.
6115         * script-sections.cc
6116         (class Memory_region): New class.
6117         (class Output_section_definition): Add set_memory_region,
6118         set_section_vma, set_section_lma and get_section_name methods.
6119         (class Script_Sections): Add add_memory_region,
6120         find_memory_region, find_memory_region_origin,
6121         find_memory_region_length and set_memory_region methods.
6122         Have set_section_addresses method walk the list of set memory
6123         regions.
6124         Extend the print methos to display memory regions.
6125         * script-sections.h: Add prototypes for new methods.
6126         Add enum for MEMORY region attributes.
6127         * yyscript.y: Add support for parsing MEMORY regions.
6128         * script-c.h: Add prototypes for new functions.
6129         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6130         * testsuite/Makefile.in: Regenerate.
6131         * testsuite/memory_test.sh: New script.
6132         * testsuite/memory_test.s: New assembler source file.
6133         * testsuite/memory_test.t: New linker script.
6134
6135 2010-08-27  Doug Kwan  <dougkwan@google.com>
6136
6137         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6138         reference override an existing dynamic weak reference.
6139         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6140         * testsuite/Makefile.in: Regenerate.
6141         * testsuite/dyn_weak_ref.sh: New file.
6142         * testsuite/dyn_weak_ref_1.c: Ditto.
6143         * testsuite/dyn_weak_ref_2.c: Ditto.
6144
6145 2010-08-27  Ian Lance Taylor  <iant@google.com>
6146
6147         * incremental.h (class Incremental_input_entry): Add virtual
6148         destructor.
6149
6150 2010-08-27  Ian Lance Taylor  <iant@google.com>
6151
6152         * testsuite/start_lib_test_3.c: Mark t3 as used.
6153
6154 2010-08-27  Nick Clifton  <nickc@redhat.com>
6155
6156         * options.cc (version_script): Fix small typo in previous
6157         whitespace tidyup.
6158
6159 2010-08-25  Nick Clifton  <nickc@redhat.com>
6160
6161         * archive.cc: Formatting fixes: Remove whitespace between
6162         typename and following asterisk.  Remove whitespace between
6163         function name and opening parenthesis.
6164         * archive.h: Likewise.
6165         * arm.cc: Likewise.
6166         * attributes.cc: Likewise.
6167         * attributes.h: Likewise.
6168         * common.cc: Likewise.
6169         * copy-relocs.cc: Likewise.
6170         * dirsearch.h: Likewise.
6171         * dynobj.cc: Likewise.
6172         * ehframe.cc: Likewise.
6173         * ehframe.h: Likewise.
6174         * expression.cc: Likewise.
6175         * fileread.cc: Likewise.
6176         * fileread.h: Likewise.
6177         * gc.h: Likewise.
6178         * gold-threads.cc: Likewise.
6179         * gold.cc: Likewise.
6180         * i386.cc: Likewise.
6181         * icf.h: Likewise.
6182         * incremental-dump.cc: Likewise.
6183         * incremental.cc: Likewise.
6184         * layout.cc: Likewise.
6185         * layout.h: Likewise.
6186         * main.cc: Likewise.
6187         * merge.cc: Likewise.
6188         * merge.h: Likewise.
6189         * object.cc: Likewise.
6190         * object.h: Likewise.
6191         * options.cc: Likewise.
6192         * options.h: Likewise.
6193         * output.cc: Likewise.
6194         * output.h: Likewise.
6195         * plugin.cc: Likewise.
6196         * plugin.h: Likewise.
6197         * powerpc.cc: Likewise.
6198         * reloc.cc: Likewise.
6199         * script-c.h: Likewise.
6200         * script-sections.cc: Likewise.
6201         * script.cc: Likewise.
6202         * stringpool.cc: Likewise.
6203         * symtab.cc: Likewise.
6204         * symtab.h: Likewise.
6205         * target.cc: Likewise.
6206         * timer.cc: Likewise.
6207         * timer.h: Likewise.
6208         * version.cc: Likewise.
6209         * x86_64.cc: Likewise.
6210
6211 2010-08-24  Nick Clifton  <nickc@redhat.com>
6212
6213         PR 11899
6214         * layout.cc (segment_precedes): Sort segments by their physical
6215         addresses, if they have been set.
6216
6217 2010-08-23  Cary Coutant  <ccoutant@google.com>
6218
6219         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6220         symbols data.
6221         (Lib_group::include_member): Unlock object after deleting its
6222         symbols data.
6223         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6224         the bug fixed here.
6225
6226 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6227             Cary Coutant  <ccoutant@google.com>
6228
6229         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6230         constructor, and set_blocker.
6231         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6232         readsyms_blocker_.
6233         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6234         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6235         * testsuite/Makefile.am (start_lib_test): New test case.
6236         * testsuite/Makefile.in: Regenerate.
6237         * testsuite/start_lib_test_main.c: New file.
6238         * testsuite/start_lib_test_1.c: New file.
6239         * testsuite/start_lib_test_2.c: New file.
6240         * testsuite/start_lib_test_3.c: New file.
6241
6242 2010-08-19  Ian Lance Taylor  <iant@google.com>
6243
6244         * Makefile.in: Rebuild with automake 1.11.1.
6245         * aclocal.m4: Likewise.
6246         * testsuite/Makefile.in: Likewise.
6247
6248 2010-08-19  Ian Lance Taylor  <iant@google.com>
6249
6250         PR 10893
6251         * i386.cc (class Output_data_plt_i386): Update declarations.
6252         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6253         local_ifuncs_ fields.
6254         (Target_i386::do_plt_section_for_global): New function.
6255         (Target_i386::do_plt_section_for_local): New function.
6256         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6257         parameter; change all callers.  Initialize global_ifuncs_ and
6258         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6259         __rel_iplt_end.
6260         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6261         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6262         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6263         symbols.
6264         (Target_i386::make_plt_section): New function, broken out of
6265         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6266         (Target_i386::make_plt_entry): Call make_plt_section.
6267         (Target_i386::make_local_ifunc_plt_entry): New function.
6268         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6269         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6270         R_386_IRELATIVE to switch.
6271         (Target_i386::Scan::global): Likewise.
6272         (Target_i386::Relocate::relocate): Likewise.
6273         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6274         switch.
6275         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6276         (Target_x86_64::do_plt_section_for_global): New function.
6277         (Target_x86_64::do_plt_section_for_local): New function.
6278         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6279         parameter; change all callers.  If doing a static link define
6280         __rela_iplt_start and __rela_iplt_end.
6281         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6282         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6283         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6284         to point to .plt.
6285         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6286         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6287         switch.
6288         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6289         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6290         R_X86_64_IRELATIVE to switch.
6291         (Target_x86_64::Scan::global): Likewise.
6292         (Target_x86_64::Relocate::relocate): Likewise.
6293         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6294         switch.
6295         * target.h (class Target): Add plt_section_for_global and
6296         plt_section_for_local functions.  Add do_plt_section_for_global
6297         and do_plt_section_for_local virtual functions.
6298         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6299         clarifying comments.
6300         (Symbol::use_plt_offset): Handle IFUNC symbol.
6301         * object.cc (Sized_relobj::Sized_relobj): Initialize
6302         local_plt_offsets_.
6303         (Sized_relobj::local_has_plt_offset): New function.
6304         (Sized_relobj::local_plt_offset): New function.
6305         (Sized_relobj::set_local_plt_offset): New function.
6306         (Sized_relobj::do_count): Handle IFUNC symbol.
6307         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6308         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6309         is_ifunc_symbol functions.
6310         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6311         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6312         local_plt_offsets_ field.
6313         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6314         * output.h (class Output_section_data): Add non-const
6315         output_section function.
6316         (class Output_data_got): Update declarations.
6317         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6318         Add use_plt_offset parameter to global and local constructors.
6319         Change all callers.  Change local_sym_index_ field to 31 bits.
6320         Change GSYM_CODE and CONSTANT_CODE accordingly.
6321         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6322         doing a static link don't set sh_link field.
6323         (Output_data_got::Got_entry::write): Use PLT offset if
6324         appropriate.
6325         (Output_data_got::add_global_plt): New function.
6326         (Output_data_got::add_local_plt): New function.
6327         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6328         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6329         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6330         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6331         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6332         IFUNC conditional.
6333         * testsuite/ifunc-sel.h: New file.
6334         * testsuite/ifuncmain1.c: New file.
6335         * testsuite/ifuncmain1vis.c: New file.
6336         * testsuite/ifuncmod1.c: New file.
6337         * testsuite/ifuncdep2.c: New file.
6338         * testsuite/ifuncmain2.c: New file.
6339         * testsuite/ifuncmain3.c: New file.
6340         * testsuite/ifuncmod3.c: New file.
6341         * testsuite/ifuncmain4.c: New file.
6342         * testsuite/ifuncmain5.c: New file.
6343         * testsuite/ifuncmod5.c: New file.
6344         * testsuite/ifuncmain6pie.c: New file.
6345         * testsuite/ifuncmod6.c: New file.
6346         * testsuite/ifuncmain7.c: New file.
6347         * configure, testsuite/Makefile.in: Rebuild.
6348
6349 2010-08-18  Ian Lance Taylor  <iant@google.com>
6350
6351         * incremental.cc
6352         (Output_section_incremental_inputs::write_input_files): Add cast
6353         to avoid signed/unsigned comparison warning.
6354         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6355
6356 2010-08-12  Cary Coutant  <ccoutant@google.com>
6357
6358         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6359
6360 2010-08-13  Ian Lance Taylor  <iant@google.com>
6361
6362         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6363
6364 2010-08-12  Cary Coutant  <ccoutant@google.com>
6365             Doug Kwan  <dougkwan@google.com>
6366
6367         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6368         defintion overrides non-weak undef, remember that the original undef
6369         is not weak.
6370         * symtab.cc (Symbol_table::sized_write_global): For undef without
6371         an original weak binding, set binding to global in output.
6372         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6373         * testsuite/Makefile.in: Regenerate.
6374         * testsuite/strong_ref_weak_def.sh: New file.
6375         * testsuite/strong_ref_weak_def_1.c: Ditto.
6376         * testsuite/strong_ref_weak_def_2.c: Ditto.
6377
6378 2010-08-12  Cary Coutant  <ccoutant@google.com>
6379
6380         * testsuite/incremental_test.sh: Rewrite.
6381         * testsuite/incremental_test_1.c: Rewrite.
6382         * testsuite/incremental_test_2.c: Rewrite.
6383
6384 2010-08-12  Cary Coutant  <ccoutant@google.com>
6385
6386         * arm.cc (Target_arm::got_size): Add const.
6387         (Target_arm::got_entry_count): New function.
6388         (Target_arm::plt_entry_count): New function.
6389         (Target_arm::first_plt_entry_offset): New function.
6390         (Target_arm::plt_entry_size): New function.
6391         (Output_data_plt_arm::entry_count): New function.
6392         (Output_data_plt_arm::first_plt_entry_offset): New function.
6393         (Output_data_plt_arm::get_plt_entry_size): New function.
6394         * i386.cc (Target_i386::got_size): Add const.
6395         (Target_i386::got_entry_count): New function.
6396         (Target_i386::plt_entry_count): New function.
6397         (Target_i386::first_plt_entry_offset): New function.
6398         (Target_i386::plt_entry_size): New function.
6399         (Output_data_plt_i386::entry_count): New function.
6400         (Output_data_plt_i386::first_plt_entry_offset): New function.
6401         (Output_data_plt_i386::get_plt_entry_size): New function.
6402         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6403         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6404         * incremental.cc: Include target.h.
6405         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6406         parameter.  Adjust all callers.  Find incremental_got_plt section.
6407         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6408         section.
6409         (Output_section_incremental_inputs::set_final_data_size): Calculate
6410         size of incremental_got_plt section.
6411         (Output_section_incremental_inputs::do_write): Write the
6412         incremental_got_plt section.
6413         (Got_plt_view_info): New struct.
6414         (Local_got_offset_visitor): New class.
6415         (Global_got_offset_visitor): New class.
6416         (Global_symbol_visitor_got_plt): New class.
6417         (Output_section_incremental_inputs::write_got_plt): New function.
6418         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6419         Add parameter.  Adjust all callers.
6420         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6421         (Incremental_inputs::got_plt_section): New function.
6422         (Incremental_inputs::got_plt_section_): New data member.
6423         (Incremental_got_plt_reader): New class.
6424         * layout.cc (Layout::create_incremental_info_sections): Add the
6425         incremental_got_plt section.
6426         * object.h (Got_offset_list::get_list): New function.
6427         (Got offset_list::for_all_got_offsets): New function.
6428         (Sized_relobj::local_got_offset_list): New function.
6429         * powerpc.cc (Target_powerpc::got_size): Add const.
6430         (Target_powerpc::got_entry_count): New function.
6431         (Target_powerpc::plt_entry_count): New function.
6432         (Target_powerpc::first_plt_entry_offset): New function.
6433         (Target_powerpc::plt_entry_size): New function.
6434         (Output_data_plt_powerpc::entry_count): New function.
6435         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6436         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6437         * sparc.cc (Target_sparc::got_size): Add const.
6438         (Target_sparc::got_entry_count): New function.
6439         (Target_sparc::plt_entry_count): New function.
6440         (Target_sparc::first_plt_entry_offset): New function.
6441         (Target_sparc::plt_entry_size): New function.
6442         (Output_data_plt_sparc::entry_count): New function.
6443         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6444         (Output_data_plt_sparc::get_plt_entry_size): New function.
6445         * symtab.h (Symbol::got_offset_list): New function.
6446         (Symbol_table::for_all_symbols): New function.
6447         * target.h (Sized_target::got_entry_count): New function.
6448         (Sized_target::plt_entry_count): New function.
6449         (Sized_target::plt_entry_size): New function.
6450         * x86_64.cc (Target_x86_64::got_size): Add const.
6451         (Target_x86_64::got_entry_count): New function.
6452         (Target_x86_64::plt_entry_count): New function.
6453         (Target_x86_64::first_plt_entry_offset): New function.
6454         (Target_x86_64::plt_entry_size): New function.
6455         (Output_data_plt_x86_64::entry_count): New function.
6456         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6457         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6458
6459 2010-08-12  Cary Coutant  <ccoutant@google.com>
6460
6461         * archive.cc: Include incremental.h.
6462         (Archive::Archive): Initialize incremental_info_.
6463         (Archive::include_member): Record archive members in incremental info.
6464         (Add_archive_symbols::run): Record begin and end of an archive in
6465         incremental info.
6466         (Lib_group::include_member): Record objects in incremental info.
6467         * archive.h (Incremental_archive_entry): Forward declaration.
6468         (Archive::set_incremental_info): New member function.
6469         (Archive::incremental_info): New member function.
6470         (Archive::Unused_symbol_iterator): New class.
6471         (Archive::unused_symbols_begin): New member function.
6472         (Archive::unused_symbols_end): New member function.
6473         (Archive::incremental_info_): New data member.
6474         * incremental-dump.cc (find_input_containing_global): New function.
6475         (dump_incremental_inputs): Dump new incremental info sections.
6476         * incremental.cc: Include symtab.h.
6477         (Output_section_incremental_inputs): New class.
6478         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6479         new incremental info sections.
6480         (Sized_incremental_binary::do_check_inputs): Likewise.
6481         (Incremental_inputs::report_archive): Remove.
6482         (Incremental_inputs::report_archive_begin): New function.
6483         (Incremental_inputs::report_archive_end): New function.
6484         (Incremental_inputs::report_object): New function.
6485         (Incremental_inputs::finalize_inputs): Remove.
6486         (Incremental_inputs::report_input_section): New function.
6487         (Incremental_inputs::report_script): Rewrite.
6488         (Incremental_inputs::finalize): Do nothing but finalize string table.
6489         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6490         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6491         (Incremental_inputs::create_data_sections): New function.
6492         (Incremental_inputs::relocs_entsize): New function.
6493         (Output_section_incremental_inputs::set_final_data_size): New function.
6494         (Output_section_incremental_inputs::do_write): New function.
6495         (Output_section_incremental_inputs::write_header): New function.
6496         (Output_section_incremental_inputs::write_input_files): New function.
6497         (Output_section_incremental_inputs::write_info_blocks): New function.
6498         (Output_section_incremental_inputs::write_symtab): New function.
6499         * incremental.h (Incremental_script_entry): Forward declaration.
6500         (Incremental_object_entry): Forward declaration.
6501         (Incremental_archive_entry): Forward declaration.
6502         (Incremental_inputs): Forward declaration.
6503         (Incremental_inputs_header_data): Remove.
6504         (Incremental_inputs_header): Remove.
6505         (Incremental_inputs_header_write): Remove.
6506         (Incremental_inputs_entry_data): Remove.
6507         (Incremental_inputs_entry): Remove.
6508         (Incremental_inputs_entry_write): Remove.
6509         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6510         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6511         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6512         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6513         Likewise.
6514         (Incremental_input_entry): New class.
6515         (Incremental_script_entry): New class.
6516         (Incremental_object_entry): New class.
6517         (Incremental_archive_entry): New class.
6518         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6519         (Incremental_inputs::report_inputs): Remove.
6520         (Incremental_inputs::report_archive): Remove.
6521         (Incremental_inputs::report_archive_begin): New function.
6522         (Incremental_inputs::report_archive_end): New function.
6523         (Incremental_inputs::report_object): Change prototype.
6524         (Incremental_inputs::report_input_section): New function.
6525         (Incremental_inputs::report_script): Change prototype.
6526         (Incremental_inputs::get_reloc_count): New function.
6527         (Incremental_inputs::set_reloc_count): New function.
6528         (Incremental_inputs::create_data_sections): New function.
6529         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6530         (Incremental_inputs::inputs_section): New function.
6531         (Incremental_inputs::symtab_section): New function.
6532         (Incremental_inputs::relocs_section): New function.
6533         (Incremental_inputs::get_stringpool): Add const.
6534         (Incremental_inputs::command_line): Add const.
6535         (Incremental_inputs::inputs): Remove.
6536         (Incremental_inputs::command_line_key): New function.
6537         (Incremental_inputs::input_file_count): New function.
6538         (Incremental_inputs::input_files): New function.
6539         (Incremental_inputs::relocs_entsize): New function.
6540         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6541         (Incremental_inputs::finalize_inputs): Remove.
6542         (Incremental_inputs::Input_info): Remove.
6543         (Incremental_inputs::lock_): Remove.
6544         (Incremental_inputs::inputs_): Change type.
6545         (Incremental_inputs::inputs_map_): Remove.
6546         (Incremental_inputs::current_object_entry_): New data member.
6547         (Incremental_inputs::inputs_section_): New data member.
6548         (Incremental_inputs::symtab_section_): New data member.
6549         (Incremental_inputs::relocs_section_): New data member.
6550         (Incremental_inputs::reloc_count_): New data member.
6551         (Incremental_inputs_reader): New class.
6552         (Incremental_symtab_reader): New class.
6553         (Incremental_relocs_reader): New class.
6554         * layout.cc (Layout::finalize): Move finalization of incremental info
6555         and creation of incremental info sections to follow finalization of
6556         symbol table.  Set offsets for postprocessing sections.
6557         (Layout::create_incremental_info_sections): Call
6558         Incremental_inputs::create_data_sections.  Add incremental symtab
6559         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6560         sections to layout after input sections.
6561         * layout.h (struct Timespec): Forward declaration.
6562         (Layout::incremental_inputs): Add const.
6563         (Layout::create_incremental_info_sections): Add parameter.
6564         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6565         * object.cc: Include incremental.h.
6566         (Relobj::finalize_incremental_relocs): New function.
6567         (Sized_relobj::do_layout): Record input sections in incremental info.
6568         * object.h (Object::output_section): New function.
6569         (Object::output_section_offset): Moved from Relobj.
6570         (Object::get_incremental_reloc_base): New function.
6571         (Object::get_incremental_reloc_count): New function.
6572         (Object::do_output_section): New function.
6573         (Object::do_output_section_offset): Moved from Relobj.
6574         (Object::do_get_incremental_reloc_base): New function.
6575         (Object::do_get_incremental_reloc_count): New function.
6576         (Object::Object): Initialize new data members.
6577         (Relobj::output_section): Renamed do_output_section and moved to
6578         protected.
6579         (Relobj::output_section_offset): Moved to Object.
6580         (Relobj::do_get_incremental_reloc_base): New function.
6581         (Relobj::do_get_incremental_reloc_count): New function.
6582         (Relobj::allocate_incremental_reloc_counts): New function.
6583         (Relobj::count_incremental_reloc): New function.
6584         (Relobj::finalize_incremental_relocs): New function.
6585         (Relobj::next_incremental_reloc_index): New function.
6586         (Relobj::reloc_counts_): New data member.
6587         (Relobj::reloc_bases_): New data member.
6588         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6589         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6590         (Sized_relobj::incremental_relocs_scan): New function.
6591         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6592         (Sized_relobj::incremental_relocs_write): New function.
6593         (Sized_relobj::incremental_relocs_write_reltype): New function.
6594         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6595         incremental link.
6596         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6597         archives and object files elsewhere.
6598         (Add_symbols::run): Report object files here.
6599         (Finish_group::run): Report end of archive at end of group.
6600         * reloc.cc: Include layout.h, incremental.h.
6601         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6602         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6603         (Sized_relobj::incremental_relocs_scan): New function.
6604         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6605         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6606         (Sized_relobj::incremental_relocs_write): New function.
6607         (Sized_relobj::incremental_relocs_write_reltype): New function.
6608         * script.cc (read_input_script): Rewrite test for incremental link.
6609         Change call to Incremental_inputs::report_script.
6610         * symtab.h (Symbol_table::first_global_index): New function.
6611         (Symbol_table::output_count): New function.
6612
6613 2010-08-12  Doug Kwan  <dougkwan@google.com>
6614
6615         * arm.cc (Target_arm::merge_object_attributes): Check command line
6616         options --no-wchar-size-warning and --no-enum-size-warning.
6617         * options.h (General_options): Add ld-compatible options
6618         --no-enum-size-warning and --no-wchar-size-warning.
6619
6620 2010-08-04  Ian Lance Taylor  <iant@google.com>
6621
6622         * x86_64.cc (Target_x86_64::Scan::local): Use
6623         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6624         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6625         (Target_x86_64::Scan::global): Likewise.
6626         (Target_x86_64::Relocate::relocate): Likewise.
6627         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6628         Likewise.
6629
6630 2010-08-03  Cary Coutant  <ccoutant@google.com>
6631
6632         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6633         to reserve space in merged_strings vector. Keep total input size
6634         for stats.
6635         (Output_merge_string::do_print_merge_stats): Print total input size.
6636         * merge.h (Output_merge_string): Add input_size_ field.
6637         * stringpool.cc (Stringpool_template::string_length): Move
6638         implementations out of Stringpool_template class and place in
6639         stringpool.h.
6640         * stringpool.h (string_length): Move out of Stringpool_template.
6641
6642 2010-08-03  Ian Lance Taylor  <iant@google.com>
6643
6644         PR 11712
6645         * layout.cc (relaxation_loop_body): If address of load segment is
6646         set, adjust address to include headers if possible.
6647
6648 2010-08-03  Ian Lance Taylor  <iant@google.com>
6649
6650         * version.cc (version_string): Bump to 1.10.
6651
6652 2010-08-03  Ian Lance Taylor  <iant@google.com>
6653
6654         PR 11805
6655         * layout.h (enum Output_section_order): Define.
6656         (class Layout): Update declarations.
6657         * layout.cc (Layout::get_output_section): Add order parameter.
6658         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6659         is_first_non_relro parameters.  Change all callers.
6660         (Layout::choose_output_section): Likewise.
6661         (Layout::add_output_section_data): Likewise.
6662         (Layout::make_output_section): Likewise.  Set order.
6663         (Layout::default_section_order): New function.
6664         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6665         * output.cc (Output_section::Output_section): Initialize order_.
6666         Don't initialize deleted fields.
6667         (Output_segment::Output_segment): Don't initialize deleted
6668         fields.
6669         (Output_segment::add_output_section_to_load): New function
6670         replacing add_output_section.  Change all callers to call this or
6671         add_output_section_to_nonload.
6672         (Output_segment::add_output_section_to_nonload): New function.
6673         (Output_segment::remove_output_section): Rewrite.
6674         (Output_segment::add_initial_output_data): Likewise.
6675         (Output_segment::has_any_data_sections): Likewise.
6676         (Output_segment::is_first_section_relro): Likewise.
6677         (Output_segment::maximum_alignment): Likewise.
6678         (Output_segment::has_dynamic_reloc): New function replacing
6679         dynamic_reloc_count.  Change all callers.
6680         (Output_segment::has_dynamic_reloc_list): New function replacing
6681         dynamic_reloc_count_list.  Change all callers.
6682         (Output_segment::set_section_addresses): Rewrite.
6683         (Output_segment::set_offset): Rewrite.
6684         (Output_segment::find_first_and_last_list): Remove.
6685         (Output_segment::set_tls_offsets): Rewrite.
6686         (Output_segment::first_section_load_address): Likewise.
6687         (Output_segment::output_section_count): Likewise.
6688         (Output_segment::section_with_lowest_load_address): Likewise.
6689         (Output_segment::write_section_headers): Likewise.
6690         (Output_segment::print_sections_to_map): Likewise.
6691         * output.h (class Output_data): Remove dynamic_reloc_count_
6692         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6693         (Output_data::add_dynamic_reloc): Rewrite.
6694         (Output_data::has_dynamic_reloc): New function.
6695         (Output_data::dynamic_reloc_count): Remove.
6696         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6697         is_last_relro_, is_first_non_relro_, is_interp_,
6698         is_dynamic_linker_section_ fields.  Add order and set_order
6699         functions.  Remove is_relro_local, set_is_relro_local,
6700         is_last_relro, set_is_last_relro, is_first_non_relro,
6701         set_is_first_non_relro functions, is_interp, set_is_interp,
6702         is_dynamic_linker_section, and set_is_dynamic_linker_section
6703         functions.
6704         (class Output_segment): Change Output_data_list from std::list to
6705         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6706         output_bss_ fields.  Update declarations.
6707
6708 2010-08-02  Ian Lance Taylor  <iant@google.com>
6709
6710         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6711         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6712         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6713
6714 2010-08-02  Ian Lance Taylor  <iant@google.com>
6715
6716         PR 11855
6717         * script.cc (Script_options::Script_options): Initialize
6718         symbol_definitions_ and symbol_references_.
6719         (Script_options::add_symbol_assignment): Update
6720         symbol_definitions_ and symbol_references_.
6721         (Script_options::add_symbol_reference): New function.
6722         (script_symbol): New function.
6723         * script.h (class Script_options): Add symbol_definitions_ and
6724         symbol_references_ fields.
6725         (Script_options::referenced_const_iterator): New type.
6726         (Script_options::referenced_begin): New function.
6727         (Script_options::referenced_end): New function.
6728         (Script_options::is_referenced): New function.
6729         (Script_options::any_unreferenced): New function.
6730         * script-c.h (script_symbol): Declare.
6731         * yyscript.y (exp): Call script_symbol.
6732         * symtab.cc: Include "script.h".
6733         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6734         Change all callers.  Check symbols referenced by scripts.
6735         (Symbol_table::add_undefined_symbols_from_command_line): Add
6736         layout parameter.  Change all callers.
6737         (Symbol_table::do_add_undefined_symbols_from_command_line):
6738         Likewise.  Break out loop body.  Check symbols referenced by
6739         scripts.
6740         (Symbol_table::add_undefined_symbol_from_command_line): New
6741         function broken out of
6742         do_add_undefined_symbols_from_command_line.
6743         * symtab.h (class Symbol_table): Update declarations.
6744         * archive.cc: Include "layout.h".
6745         (Archive::should_include_member): Add layout parameter.  Change
6746         all callers.  Check for symbol mentioned in expression.
6747         * archive.h (class Archive): Update declaration.
6748         * object.cc (Sized_relobj::do_should_include_member): Add layout
6749         parameter.
6750         * object.h (Object::should_include_member): Add layout parameter.
6751         Change all callers.
6752         (Object::do_should_include_member): Add layout parameter.
6753         (class Sized_relobj): Update declaration.
6754         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6755         parameter.
6756         * dynobj.h (class Sized_dynobj): Update declaration.
6757         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6758         layout parameter.
6759         * plugin.h (class Sized_pluginobj): Update declaration.
6760
6761 2010-08-02  Ian Lance Taylor  <iant@google.com>
6762
6763         PR 11866
6764         * output.cc (Output_segment::set_offset): Search for the first and
6765         last sections rather than assuming that the list is in order.
6766         (Output_segment::find_first_and_last_list): New function.
6767         * output.h (class Output_segment): Update declarations.
6768         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6769         (relro_strip_test_SOURCES): New variable.
6770         (relro_strip_test_DEPENDENCIES): New variable.
6771         (relro_strip_test_LDFLAGS): New variable.
6772         (relro_strip_test_LDADD): New variable.
6773         (relro_strip_test.so): New target.
6774
6775 2010-08-02  Ian Lance Taylor  <iant@google.com>
6776
6777         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6778         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6779         (Target_i386::got_tlsdesc_section): New function.
6780         (Target_i386::got_section): Create space for GOT entries for
6781         TLSDESC relocations.
6782         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6783         R_386_TLS_GOTDESC.
6784         (Target_i386::Scan::global): Likewise.
6785         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6786         using TLSDESC GOT.
6787         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6788         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6789         (Target_x86_64::got_tlsdesc_section): New function.
6790         (Target_x86_64::got_section): Create space for GOT entries for
6791         TLSDESC relocations.
6792         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6793         R_386_TLS_GOTDESC.
6794         (Target_x86_64::Scan::global): Likewise.
6795         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6796         using TLSDESC GOT.
6797
6798 2010-08-02  Ian Lance Taylor  <iant@google.com>
6799
6800         * testsuite/final_layout.sh: Use dc to convert from hex to
6801         decimal.
6802
6803 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6804
6805         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6806         paramter to the call to gold::gc_process_relocs.
6807         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6808         paramter to the call to gold::gc_process_relocs.
6809         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6810         parameter to the call to gold::gc_process_relocs.
6811         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6812         template parameter to the call to gold::gc_process_relocs.
6813         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6814         paramter to the call to gold::gc_process_relocs.
6815         * gc.h (get_embedded_addend_size): New function.
6816         (gc_process_relocs): Save the size of the reloc for use by ICF.
6817         * icf.cc (get_section_contents): Get the addend from the text section
6818         for SHT_REL relocation sections.
6819         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6820         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6821         * int_encoding.h (read_from_pointer): New overloaded function.
6822         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6823         * testsuite/icf_sht_rel_addend_test.sh: New file.
6824         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6825         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6826
6827 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6828
6829         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6830         * Makefile.in: Regenerate.
6831         * testsuite/Makefile.in: Regenerate.
6832
6833 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6834
6835         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6836         * gold/testsuite/debug_msg.cc: Likewise.
6837         * gold/testsuite/odr_violation1.cc
6838         * gold/testsuite/odr_violation2.cc
6839
6840 2010-07-21  Cary Coutant  <ccoutant@google.com>
6841
6842         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6843         string, and length fields.
6844         (Output_merge_string::Merged_strings_list): New type.
6845         (Output_merge_string::Merged_strings_lists): New typedef.
6846         (Output_merge_string): Replace merged_strings_ with
6847         merged_strings_lists_.
6848         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6849         Merged_strings_list per input object and section.  Don't store pointer
6850         to the string.  Don't store length with each merged string entry.
6851         (Output_merge_string::finalize_merged_data): Loop over list of merged
6852         strings lists.  Recompute length of each merged string.
6853
6854 2010-07-15  Cary Coutant  <ccoutant@google.com>
6855
6856         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6857         here.
6858
6859 2010-07-14  Ian Lance Taylor  <iant@google.com>
6860
6861         * descriptors.cc (Descriptors::open): Report correct name in error
6862         message.
6863
6864 2010-07-13  Doug Kwan  <dougkwan@google.com>
6865
6866         * arm.cc (Arm_input_section::Arm_input_section): For a
6867         SHT_ARM_EXIDX section, always keeps the input sections.
6868         (Arm_input_section::set_exidx_section_link): New method.
6869         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6870         has_errors_ to false.
6871         (Arm_exidx_input_section::has_errors,
6872         Arm_exidx_input_section::set_has_errors): New methods.
6873         (Arm_exidx_input_section::has_errors_): New data member.
6874         (Arm_relobj::get_exidx_shndx_list): New method.
6875         (Arm_output_section::append_text_sections_to_list): Do not skip
6876         section without SHF_EXECINSTR.
6877         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6878         errors.
6879         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6880         section header.  Make error messages more verbose.  Check for
6881         a non-executable section linked to an EXIDX section.
6882         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6883         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6884         check that there is no deferred EXIDX section if we exit early.
6885         Instead of not making an EXIDX section in case of an error, make one
6886         and set the has_errors flag of it.
6887         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6888         in a relocatable link.
6889         (Target_arm::do_relax): Look for the EXIDX output section instead of
6890         assuming that it is called .ARM.exidx.
6891         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6892         section list.  Do not check for SHF_EXECINSTR section flags but
6893         skip any input section with errors.
6894         * output.cc (Output_section::Output_section): Initialize
6895         always_keeps_input_sections_ to false.
6896         (Output_section::add_input_section): Check for
6897         always_keeps_input_sections_.
6898         *  output.h (Output_section::always_keeps_input_sections,
6899         Output_section::set_always_keeps_input_sections): New methods.
6900         (Output_section::always_keeps_input_sections): New data member.
6901
6902 2010-07-13  Rafael Espindola  <espindola@google.com>
6903
6904         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6905         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6906
6907 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6908             Ian Lance Taylor  <iant@google.com>
6909
6910         * output.h (Output_section_lookup_maps::add_merge_section):
6911         Correct check of whether value was inserted.
6912         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6913         (Output_section_lookup_maps::add_relaxed_input_section):
6914         Likewise.
6915         * arm.cc (Target_arm::got_section): Remove used local os.
6916         * i386.cc (Target_i386::got_section): Likewise.
6917         * x86_64.cc (Target_x86_64::got_section): Likewise.
6918         * sparc.cc (Target_sparc::got_section): Likewise.
6919         (Target_sparc::relocate): Remove unused local have_got_offset.
6920         * powerpc.cc (Target_powerpc::relocate): Likewise.
6921
6922 2010-07-13  Ian Lance Taylor  <iant@google.com>
6923
6924         * compressed_output.cc (zlib_decompress): Fix signature in
6925         !HAVE_ZLIB_H case.
6926
6927         * archive.cc (Archive::include_member): Unlock an external member
6928         of a thin archive.  Don't bother to delete an object we know is
6929         NULL.
6930
6931 2010-07-12  Cary Coutant  <ccoutant@google.com>
6932
6933         * compressed_output.cc (zlib_decompress): New function.
6934         (get_uncompressed_size): New function.
6935         (decompress_input_section): New function.
6936         * compressed_output.h (get_uncompressed_size): New function.
6937         (decompress_input_section): New function.
6938         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6939         Handle compressed debug sections.
6940         * layout.cc (is_compressed_debug_section): New function.
6941         (Layout::output_section_name): Map compressed section names to
6942         canonical names.
6943         * layout.h (is_compressed_debug_section): New function.
6944         (is_debug_info_section): Recognize compressed debug sections.
6945         * merge.cc: Include compressed_output.h.
6946         (Output_merge_data::do_add_input_section): Handle compressed
6947         debug sections.
6948         (Output_merge_string::do_add_input_section): Handle compressed
6949         debug sections.
6950         * object.cc: Include compressed_output.h.
6951         (Sized_relobj::Sized_relobj): Initialize new data members.
6952         (build_compressed_section_map): New function.
6953         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6954         * object.h (Object::section_is_compressed): New method.
6955         (Object::do_section_is_compressed): New method.
6956         (Sized_relobj::Compressed_section_map): New type.
6957         (Sized_relobj::do_section_is_compressed): New method.
6958         (Sized_relobj::compressed_sections_): New data member.
6959         * output.cc (Output_section::add_input_section): Handle compressed
6960         debug sections.
6961         * reloc.cc: Include compressed_output.h.
6962         (Sized_relobj::write_sections): Handle compressed debug sections.
6963
6964 2010-07-08  Cary Coutant  <ccoutant@google.com>
6965
6966         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6967         weak when resolving to a dynamic def.
6968         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6969         for weak undef/dynamic def cases. Adjust callers.
6970         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6971         undef_binding_weak_.
6972         (Symbol_table::sized_write_globals): Adjust symbol binding.
6973         (Symbol_table::sized_write_symbol): Add binding parameter.
6974         * symtab.h (Symbol::set_undef_binding): New method.
6975         (Symbol::is_undef_binding_weak): New method.
6976         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6977         (Symbol_table::should_override): Add new parameter.
6978         (Symbol_table::sized_write_symbol): Add new parameter.
6979
6980         * testsuite/weak_undef_file1.cc: Add new test case.
6981         * testsuite/weak_undef_file2.cc: Fix header comment.
6982         * testsuite/weak_undef_test.cc: Add new test case.
6983
6984 2010-06-29  Doug Kwan  <dougkwan@google.com>
6985
6986         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6987         Initialize USE_SYMBOL_.
6988         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6989         definition.
6990         (Arm_reloc_property::uses_symbol_): New data member declaration.
6991         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6992         uses symbol value and symbol is undefined but not weakly undefined.
6993
6994 2010-06-28  Rafael Espindola  <espindola@google.com>
6995
6996         * plugin.cc (Plugin::load): Use dlerror.
6997
6998 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6999
7000         * symtab.cc (detect_odr_violations): When reporting an ODR
7001         violation, report an object where the symbol is defined.
7002
7003 2010-06-25  Doug Kwan  <dougkwan@google.com>
7004
7005         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7006         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7007         definition.
7008         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7009         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7010         target hook to detect function points.
7011         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7012         * icf.h (Icf::check_section_for_function_pointers): Change type of
7013         parameter SECTION_NAME to const reference to std::string.  Use
7014         target hook to determine if section may have unsafe pointers.
7015         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7016         method definition.
7017
7018 2010-06-21  Rafael Espindola  <espindola@google.com>
7019
7020         * fileread.cc (Input_file::find_fie): New
7021         (Input_file::open): Use Input_file::find_fie.
7022         * fileread.h (Input_file::find_fie): New
7023         * plugin.cc (set_extra_library_path): New.
7024         (Plugin::load): Add set_extra_library_path to the transfer vector.
7025         (Plugin_manager::set_extra_library_path): New.
7026         (Plugin_manager::add_input_file): Use the extra search path if set.
7027         (set_extra_library_path(): New.
7028         * plugin.h (Plugin_manager): Add set_extra_library_path and
7029         extra_search_path_.
7030
7031 2010-06-19  Cary Coutant  <ccoutant@google.com>
7032
7033         * layout.cc (gdb_sections): Add .debug_types.
7034         (lines_only_debug_sections): Likewise.
7035
7036 2010-06-18  Rafael Espindola  <espindola@google.com>
7037
7038         * plugin.cc (add_input_file,add_input_library)
7039         (Plugin_manager::add_input_file): Make filename arguments const.
7040         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7041         const.
7042
7043 2010-06-16  Doug Kwan  <dougkwan@google.com>
7044
7045         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7046         .ARM.attributes section if we have not merged any input
7047         attributes sections.
7048
7049 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7050
7051         * arm.cc: Allow combining objects with no EABI version
7052         information.
7053
7054 2010-06-15  Rafael Espindola  <espindola@google.com>
7055
7056         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7057
7058 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7059
7060         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7061         (struct iovec): Correct !HAVE_READV definition.
7062
7063 2010-06-10  Cary Coutant  <ccoutant@google.com>
7064
7065         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7066         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7067         reloc sections.
7068         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7069
7070         PR 11683
7071         * symtab.h (Symbol::is_placeholder): New member function.
7072         * target-reloc.h (relocate_section): Check for placeholder symbols.
7073
7074         * testsuite/Makefile.am (plugin_test_8): New test.
7075         (plugin_test_9): New test.
7076         * testsuite/Makefile.in: Regenerate.
7077
7078 2010-06-09  Nick Clifton  <nickc@redhat.com>
7079
7080         * yyscript.y (input_list_element): Allow strings prefixed with
7081         the '-' character.  Treat these as libraries.
7082         * script.cc (script_add_library): New function.  Adds a library
7083         specified by "-l<name>" found in an input script.
7084         * script-c.h: Add prototype for script_add_library.
7085
7086 2010-06-07  Doug Kwan  <dougkwan@google.com>
7087
7088         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7089         Restrict stub-group size to be within long conditional branch
7090         range when working around cortex-A8 erratum.
7091
7092 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7093
7094         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7095         #ifdef typo.
7096
7097 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7098
7099         PR gold/11658
7100         * output.cc
7101         (Output_section::Input_section_sort_entry::compare_section_ordering):
7102         Change to return non-zero correctly.
7103         (Output_section::Input_section_sort_section_order_index_compare
7104         ::operator()): Change to fix ambiguity in comparisons.
7105
7106 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7107
7108         * gold.h (is_wildcard_string): New function.
7109         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7110         (Layout::layout_eh_frame): Ditto.
7111         (Layout::find_section_order_index): New method.
7112         (Layout::read_layout_from_file): New method.
7113         * layout.h (Layout::find_section_order_index): New method.
7114         (Layout::read_layout_from_file): New method.
7115         (Layout::input_section_position_): New private member.
7116         (Layout::input_section_glob_): New private member.
7117         * main.cc (main): Call read_layout_from_file here.
7118         * options.h (--section-ordering-file): New option.
7119         * output.cc (Output_section::input_section_order_specified_): New
7120         member.
7121         (Output_section::Output_section): Initialize new member.
7122         (Output_section::add_input_section): Add new parameter.
7123         Keep input sections when --section-ordering-file is used.
7124         (Output_section::set_final_data_size): Sort input sections when
7125         section ordering file is specified.
7126         (Output_section::Input_section_sort_entry): Add new parameter.
7127         Check sorting type.
7128         (Output_section::Input_section_sort_entry::compare_section_ordering):
7129         New method.
7130         (Output_section::Input_section_sort_compare::operator()): Change to
7131         consider section_order_index.
7132         (Output_section::Input_section_sort_init_fini_compare::operator()):
7133         Change to consider section_order_index.
7134         (Output_section::Input_section_sort_section_order_index_compare
7135         ::operator()): New method.
7136         (Output_section::sort_attached_input_sections): Change to sort
7137         according to section order when specified.
7138         (Output_section::add_input_section<32, true>): Add new parameter.
7139         (Output_section::add_input_section<64, true>): Add new parameter.
7140         (Output_section::add_input_section<32, false>): Add new parameter.
7141         (Output_section::add_input_section<64, false>): Add new parameter.
7142         * output.h (Output_section::add_input_section): Add new parameter.
7143         (Output_section::input_section_order_specified): New
7144         method.
7145         (Output_section::set_input_section_order_specified): New method.
7146         (Input_section::Input_section): Initialize section_order_index_.
7147         (Input_section::section_order_index): New method.
7148         (Input_section::set_section_order_index): New method.
7149         (Input_section::section_order_index_): New member.
7150         (Input_section::Input_section_sort_section_order_index_compare): New
7151         struct.
7152         (Output_section::input_section_order_specified_): New member.
7153         * script-sections.cc (is_wildcard_string): Delete and move modified
7154         method to gold.h.
7155         (Output_section_element_input::Output_section_element_input): Modify
7156         call to is_wildcard_string.
7157         (Output_section_element_input::Input_section_pattern
7158         ::Input_section_pattern): Ditto.
7159         (Output_section_element_input::Output_section_element_input): Ditto.
7160         * testsuite/Makefile.am (final_layout): New test case.
7161         * testsuite/Makefile.in: Regenerate.
7162         * testsuite/final_layout.cc: New file.
7163         * testsuite/final_layout.sh: New file.
7164
7165 2010-06-01  Rafael Espindola  <espindola@google.com>
7166
7167         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7168
7169 2010-06-01  Rafael Espindola  <espindola@google.com>
7170
7171         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7172         visibility of symbols.
7173
7174 2010-05-27  Doug Kwan  <dougkwan@google.com>
7175
7176         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7177         from start of output section instead of address for a local symbol
7178         in a merged or relaxed section when doing a relocatable link.
7179
7180 2010-05-26  Rafael Espindola  <espindola@google.com>
7181
7182         PR 11604
7183         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7184         adding sections the garbage collector removed.
7185         * gold/testsuite/Makefile.am: Add test.
7186         * gold/testsuite/Makefile.in: Regenerate.
7187         * gold/testsuite/plugin_test_7.sh: New.
7188         * gold/testsuite/plugin_test_7_1.c: New.
7189         * gold/testsuite/plugin_test_7_2.c: New.
7190
7191 2010-05-26  Rafael Espindola  <espindola@google.com>
7192
7193         * script-sections.cc (Output_section_definition::set_section_addresses):
7194         Check for --section-start.
7195
7196 2010-05-26  Doug Kwan  <dougkwan@google.com>
7197
7198         * arm.cc (Arm_scan_relocatable_relocs): New class.
7199         (Target_arm::relocate_special_relocatable): New method.
7200         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7201         (Arm_relocate_functions::thumb_branch_common): Same.
7202         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7203         instead of Default_scan_relocatable_relocs.
7204         * target-reloc.h (relocate_for_relocatable): Let target handle
7205         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7206         * target.h (Sized_target::relocate_special_relocatable): New method.
7207
7208 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7209
7210         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7211
7212 2010-05-23  Doug Kwan  <dougkwan@google.com>
7213
7214         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7215         instead of a cast.
7216         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7217         with a direct branch, not a conditional branch, to a stub.
7218         * merge.cc (Output_merge_base::record_input_section): New method
7219         defintion.
7220         (Output_merge_data::do_add_input_section): Record input section if
7221         keeps-input-sections flag is set.
7222         (Output_merge_string::do_add_input_section): Ditto.
7223         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7224         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7225         INPUT_SECTIONS_.
7226         (Output_merge_base::keeps_input_sections,
7227         Output_merge_base::set_keeps_input_sections,
7228         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7229         method definitions.
7230         (Output_merge_base::Input_sections): New type declaration.
7231         (Output_merge_base::input_sections_begin,
7232         Output_merge_base::input_sections_end,
7233         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7234         (Output_merge_base::bool keeps_input_sections_,
7235         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7236         Output_merge_base::input_sections_): New data members.
7237         (Output_merge_data::do_set_keeps_input_sections): New method
7238         defintion.
7239         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7240         * output.cc (Output_section::Input_section::relobj): Move method
7241         defintion from class declaration to here and handle merge sections.
7242         (Output_section::Input_section::shndx): Ditto.
7243         (Output_section::Output_section): Remove initializations of removed
7244         data members and initialize new data member LOOKUP_MAPS_.
7245         (Output_section::add_input_section): Set keeps-input-sections flag
7246         for a newly created merge output section as appropriate.  Adjust code
7247         to use Output_section_lookup_maps class.
7248         (Output_section::add_relaxed_input_section): Adjst code for lookup
7249         maps code refactoring.
7250         (Output_section::add_merge_input_section): Add a new parameter
7251         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7252         class.  If adding input section to a newly created merge output
7253         section fails, remove the new merge section.
7254         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7255         Adjust code for use of the Output_section_lookup_maps class.
7256         (Output_section::find_merge_section): Ditto.
7257         (Output_section::build_lookup_maps): New method defintion.
7258         (Output_section::find_relaxed_input_section): Adjust code to use
7259         Output_section_lookup_maps class.
7260         (Output_section::get_input_sections): Export merge sections.  Adjust
7261         code to use Output_section_lookup_maps class.
7262         (Output_section:::add_script_input_section): Adjust code to use
7263         Output_section_lookup_maps class.  Update lookup maps for merge
7264         sections also.
7265         (Output_section::discard_states): Use Output_section_lookup_maps.
7266         (Output_section::restore_states): Same.
7267         * output.h (Merge_section_properties): Move class defintion out of
7268         Output_section.
7269         (Output_section_lookup_maps): New class.
7270         (Output_section::Input_section::is_merge_section): New method
7271         defintion.
7272         (Output_section::Input_section::relobj): Move defintion out of class
7273         defintion.  Declare method only.
7274         (Output_section::Input_section::shndx): Ditto.
7275         (Output_section::Input_section::output_merge_base): New method defintion.
7276         (Output_section::Input_section::u2_.pomb): New union field.
7277         (Output_section::Merge_section_by_properties_map,
7278         Output_section::Output_section_data_by_input_section_map,
7279         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7280         Remove types.
7281         (Output_section::add_merge_input_section): Add new parameter
7282         KEEPS_INPUT_SECTIONS.
7283         (Output_section::build_lookup_maps): New method declaration.
7284         (Output_section::merge_section_map_,
7285         Output_section::merge_section_by_properties_map_,
7286         Output_section::relaxed_input_section_map_,
7287         Output_section::is_relaxed_input_section_map_valid_): Remove data
7288         members.
7289         (Output_section::lookup_maps_): New data member.
7290
7291 2010-05-21  Doug Kwan  <dougkwan@google.com>
7292
7293         PR gold/11619
7294         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7295         avoid a compilation error.
7296
7297 2010-05-19  Rafael Espindola  <espindola@google.com>
7298
7299         * script-sections.cc (Output_section_definition::allocate_to_segment):
7300         Update the phdrs_list even when the output section is NULL.
7301         * testsuite/Makefile.am: Add test.
7302         * testsuite/Makefile.in: Regenerate.
7303         * testsuite/script_test_9.cc: New.
7304         * testsuite/script_test_9.sh: New.
7305         * testsuite/script_test_9.t: New.
7306
7307 2010-05-19  Doug Kwan  <dougkwan@google.com>
7308
7309         * arm.cc (Arm_input_section::original_size): New method.
7310         (Arm_input_section::do_addralign): Add a cast.
7311         (Arm_input_section::do_output_offset): Remove static cast.
7312         (Arm_input_section::original_addralign,
7313          Arm_input_section::original_size_): Change type to uint32_t.
7314         (Arm_input_section::init): Add safe casts for section alignment
7315         and size.
7316         (Arm_input_section::set_final_data_size): Do not set address and
7317         offset of stub table.
7318         (Arm_output_section::fix_exidx_coverage): Change use of of
7319         Output_section::Simple_input_section to that of
7320         Output_section::Input_section.
7321         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7322         except for the first pass.
7323         * output.cc (Output_section::get_input_sections): Change type of
7324         input_sections to std::list<Input_section>.
7325         (Output_section::add_script_input_section): Rename from
7326         Output_section::add_simple_input_section.  Change type of SIS
7327         parameter from Simple_input_section to Input_section.
7328         * output.h (Output_section::Simple_input_section): Remove class.
7329         (Output_section::Input_section): Change class visibility to public.
7330         (Output_section::Input_section::addralign): Use stored alignments
7331         for special input sections if set.
7332         (Output_section::Input_section::set_addralign): New method.
7333         (Output_section::get_input_sections): Change parameter type from
7334         list of Simple_input_section to list of Input_section.
7335         (Output_section::add_script_input_section): Rename from
7336         Output_section::add_simple_input_section. Change first parameter's
7337         type from Simple_input_section to Input_section and remove the
7338         second and third parameters.
7339         * script-sections.cc (Input_section::Input_section_list): Change
7340         type to list of Output_section::Input_section/
7341         (Input_section_info::Input_section_info): Change parameter type of
7342         INPUT_SECTION to Output_section::Input_section.
7343         (Input_section_info::input_section): Change return type.
7344         (Input_section_info::input_section_): Change type to
7345         Output_section::Input_section.
7346         (Output_section_element_input::set_section_addresses): Adjust code
7347         to use Output_section::Input_section instead of
7348         Output_section::Simple_input_section.  Adjust code for renaming
7349         of Output_section::add_simple_input_section.
7350         (Orphan_output_section::set_section_addresses): Ditto.
7351
7352 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7353
7354         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7355         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7356
7357 2010-05-18  Rafael Espindola  <espindola@google.com>
7358
7359         * options.cc (General_options::finalize): Handle -nostdlib.
7360         * options.h (nostdlib): New option.
7361         * script.cc (script_add_search_dir): Handle -nostdlib.
7362
7363 2010-05-12  Doug Kwan  <dougkwan@google.com>
7364
7365         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7366         attributes section only if there no attributes section after merging.
7367         (Target_arm::merge_object_attributes): Move value of
7368         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7369         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7370         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7371         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7372         and arm_attr_merge_7.stdout.
7373         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7374         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7375         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7376         arm_attr_merge_7b.o): New rules.
7377         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7378         arm_attr_merge_7
7379         * testsuite/Makefile.in: Regenerate.
7380         * testsuite/arm_attr_merge.sh: New file.
7381         * testsuite/arm_attr_merge_[67][ab].s: Same.
7382
7383 2010-05-05  Nick Clifton  <nickc@redhat.com>
7384
7385         * po/es.po: Updated Spanish translation.
7386
7387 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7388
7389         * Makefile.am (install-exec-local): Properly install gold as
7390         default cross linker.
7391         * Makefile.in: Regenerated.
7392
7393 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7394             Nick Clifton  <nickc@redhat.com>
7395
7396         * configure.ac (install_as_default): Define and set to false
7397         unless --enable-gold or --enable-gold=both/gold has been
7398         specified.
7399         * configure: Regenerate.
7400
7401         * Makefile.am (install-exec-local): Install the executable as
7402         'ld.gold'.  If install_as_default is true then also install it as
7403         'ld'.
7404         * Makefile.in: Regenerated.
7405
7406 2010-04-24  Ian Lance Taylor  <iant@google.com>
7407
7408         * layout.cc (Layout::layout_reloc): In relocatable link don't
7409         combine reloc sections for grouped sections.
7410
7411 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7412
7413         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7414         sections that are not ordinary to icf.
7415         * icf.cc (get_section_contents): Handle relocation pointing to section
7416         with no object or shndx information.
7417         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7418         * testsuite/Makefile.in: Regenerate.
7419         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7420         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7421
7422 2010-04-22  Ian Lance Taylor  <iant@google.com>
7423
7424         * expression.cc (Expression::Expression_eval_info): Add
7425         result_alignment_pointer field.
7426         (Expression::eval_with_dot): Add result_alignment_pointer
7427         parameter.  Change all callers.
7428         (Expression::eval_maybe_dot): Likewise.
7429         (class Binary_expression): Add alignment_pointer parameter to
7430         left_value and right_value.  Change all callers.
7431         (BINARY_EXPRESSION): Set result alignment.
7432         (class Trinary_expression): Add alignment_pointer parameter to
7433         arg2_value and arg3_value.  Change all callers.
7434         (Trinary_cond::value): Set result alignment.
7435         (Max_expression::value, Min_expression::value): Likewise.
7436         (Align_expression::value): Likewise.
7437         * script-sections.cc (class Sections_element): Add dot_alignment
7438         parameter to set_section_addresses virtual function.  Update
7439         instantiations.
7440         (class Output_section_element): Likewise.
7441         (Script_sections::create_segments): Add dot_alignment parameter.
7442         Change all callers.
7443         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7444         (Script_sections::set_phdrs_clause_addresses): Likewise.
7445         * script-sections.h: Update declarations.
7446         * script.h: Update declarations.
7447         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7448         min_p_align.
7449         * testsuite/script_test_3.t: Set large alignment.
7450         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7451         segment has expected alignment.
7452
7453 2010-04-22  Nick Clifton  <nickc@redhat.com>
7454
7455         * po/gold.pot: Updated by the Translation project.
7456         * po/vi.po: Updated Vietnamese translation.
7457
7458 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7459
7460         * testsuite/Makefile.am (check_PROGRAMS): Add
7461         icf_virtual_function_folding_test.
7462         * testsuite/Makefile.in: Regenerated.
7463
7464 2010-04-15  Andrew Haley  <aph@redhat.com>
7465
7466         * options.h (merge_exidx_entries): New option.
7467         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7468         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7469         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7470         (Target_arm::merge_exidx_entries): New function.
7471         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7472         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7473         to Arm_exidx_fixup constructor.
7474         Add new arg, merge_exidx_entries.
7475         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7476         Arm_output_section::fix_exidx_coverage.
7477
7478 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7479
7480         * icf.cc (get_section_contents): Check for preemptible functions.
7481         Ignore addend when appropriate.
7482         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7483         section folded.
7484         (add_from_relobj): Check for section folded.
7485         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7486         * symtab.h (should_add_dynsym_entry): Add new parameter.
7487         * target-reloc.h (scan_relocs): Check for section folded.
7488         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7489         Check reloc types for function pointers in shared objects.
7490         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7491         case.
7492         (icf_preemptible_functions_test): New test case.
7493         (icf_string_merge_test): New test case.
7494         * testsuite.Makefile.in: Regenerate.
7495         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7496         bar_glob.  Refactor code.
7497         * testsuite/icf_preemptible_functions_test.cc: New file.
7498         * testsuite/icf_preemptible_functions_test.sh: New file.
7499         * testsuite/icf_string_merge_test.cc: New file.
7500         * testsuite/icf_string_merge_test.sh: New file.
7501         * testsuite/icf_virtual_function_folding_test.cc: New file.
7502         * testsuite/icf_virtual_function_folding_test.sh: New file.
7503
7504 2010-04-14  Doug Kwan  <dougkwan@google.com>
7505
7506         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7507         for local symbol recounting if we remove a section due to ICF.
7508         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7509         there are no regular objects in input.
7510
7511 2010-04-13  Doug Kwan  <dougkwan@google.com>
7512
7513         * arm.cc (Arm_input_section::set_final_data_size): Compute
7514         accurate final data size instead of using current data size.
7515
7516 2010-04-09  Doug Kwan  <dougkwan@google.com>
7517
7518         * layout.cc (Layout::choose_output_section): Handle script section
7519         types.
7520         (Layout::make_output_section_for_script): Add section type parameter.
7521         Handle script section types.
7522         * layout.h (Layout::make_output_section_for_script): Add section
7523         type parameter.
7524         * output.cc (Output_section::Output_section): Initialize data member
7525         is_noload_.
7526         (Output_section::do_reset_address_and_file_offset): Do not set address
7527         to 0 if section is a NOLOAD section.
7528         * output.h (Output_section::is_noload): New method.
7529         (Output_section::set_is_noload): Ditto.
7530         (Output_section::is_noload_): New data member.
7531         * script-c.h (Script_section_type): New enum type.
7532         (struct Parser_output_section_header): Add new file section_type.
7533         * script-sections.cc (Sections_element::output_section_name): Add
7534         parameter for returning script section type.
7535         (Output_section_definition::output_section_name): Ditto.
7536         (Output_section_definition::section_type)P; New method.
7537         (Output_section_definiton::script_section_type_name): Ditto.
7538         (Output_section_definition::script_section_type_): New data member.
7539         (Output_section_definition::Output_section_definition): Initialize
7540         data member Output_section_definition::script_section_type_.
7541         (Output_section_definition::create_sections): Pass script section type
7542         to Layout::make_output_section_for_script.
7543         (Output_section_definition::output_section_name): Return script
7544         section type to caller.
7545         (Output_section_definition::set_section_address): Do not advance
7546         dot value and load address if section type is NOLOAD.  Set address
7547         of NOLOAD sections regardless of section flags.
7548         (Output_section_definition::print): Print section type if it is
7549         not SCRIPT_SECTION_TYPE_NONE.
7550         (Output_section_definition::section_type): New method.
7551         (Output_section_definition::script_section_type_name): Ditto.
7552         (Script_sections::output_section_name): Add new parameter
7553         PSECTION_TYPE for returning script section type.  Pass it to
7554         section elements.  Handle discard sections.
7555         (Sort_output_sections::operator()): Handle NOLOAD sections.
7556         * script-sections.h (Script_sections::Section_type): New enum type.
7557         (Script_sections::output_section_name): Add a new parameter for
7558         returning script section type.
7559         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7560         INFO and NOLOAD.
7561         * yyscript.y (union): Add new field SECTION_TYPE.
7562         (COPY, DSECT, INFO, NOLOAD): New tokens.
7563         (opt_address_and_section_type): Change type to output_section_header.
7564         (section_type): New non-terminal
7565         (section_header): Handle section type.
7566         (opt_address_and_section_type): Return section type value.
7567
7568 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7569
7570         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7571         * testsuite/plugin_common_test_2.c (foo): Likewise.
7572
7573 2010-04-08  Doug Kwan  <dougkwan@google.com>
7574
7575         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7576         Output_merge_data.
7577         * output.cc (Output_section::add_merge_input_section): Simplify
7578         code and return status of Output_merge_base::add_input_section.
7579         Update merge section map only if Output_merge_base::add_input_section
7580         returns true.
7581
7582 2010-04-07  Doug Kwan  <dougkwan@google.com>
7583
7584         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7585         if section is marked as containing instructions but has no mapping
7586         symbols.
7587         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7588         correct section index.
7589         (Arm_relobj::find_linked_text_section): Ditto.
7590
7591 2010-04-07  Cary Coutant  <ccoutant@google.com>
7592
7593         * archive.cc (include_member): Destroy Read_symbols_data object before
7594         releasing file.
7595         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7596         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7597         (Read_symbols_data::~Read_symbols_data) New destructor.
7598         (Section_relocs::Section_relocs) New constructor.
7599         (Section_relocs::~Section_relocs) New destructor.
7600         (Read_relocs_data::Read_relocs_data) New constructor.
7601         (Read_relocs_data::~Read_relocs_data) New destructor.
7602         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7603         pointers to NULL after deleting.
7604
7605 2010-04-07  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc: Replace "endianity" with "endianness" in comments.
7608         (Arm_exidx_cantunwind): Ditto.
7609         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7610         (Arm_relobj::merge_flags_and_attributes): New method.
7611         (Arm_relobj::merge_flags_and_attributes_): New data member.
7612         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7613         (Arm_relobj::scan_sections_for_stubs): Ditto.
7614         (Arm_relobj::do_read_symbols): Check to see if we really want to
7615         merge processor-specific flags and attributes.  Exit early if
7616         an object is empty except for section names and the undefined symbol.
7617         (Target_arm::do_finalize_sections): Move check for ELF format to
7618         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7619         attributes from a regular object only when we have determined that
7620         it is aapropriate.  Do not create an .ARM.attributes section in
7621         output if there is no regular input object.
7622         (Target_arm::merge_processor_specific_flags): Check
7623         --warn-mismatch before printing any error.
7624         (Target_arm::merge_object_attributes): Ditto.
7625         * gold.cc (queue_middle_tasks): Handle the case in which there is
7626         no regular object in input.
7627         * options.cc (General_options::parse_EB): New method.
7628         (General_options::parse_EL): Same.
7629         (General_options::General_options): Initialize endianness_.
7630         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7631         New options.
7632         (General_options::Endianness): New enum.
7633         (General_options::endianness): New method.
7634         (General_options::endianness_): New data member.
7635         * parameters.cc (Parameters::set_options): Check target endianness.
7636         (Parameters::set_target_once): Ditto.
7637         (Parameters::check_target_endianness): New method.
7638         (parameters_force_valid_target): If either -EL or -EB is specified,
7639         use it to define endianness of default target.
7640         * parameters.h (Parameters::check_target_endianness): New method
7641         declaration.
7642         * target.h (class Target): Change "endianity" to "endianness"
7643         in comments.
7644
7645 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7646
7647         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7648         * configure: Regenerate.
7649         * Makefile.in: Regenerate.
7650         * testsuite/Makefile.in: Regenerate.
7651
7652 2010-04-06  Cary Coutant  <ccoutant@google.com>
7653
7654         gcc PR lto/42757
7655         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7656         prevailing definitions of common symbols.
7657         * testsuite/plugin_test_6.sh: New test case.
7658         * testsuite/plugin_common_test_1.c: New test case.
7659         * testsuite/plugin_common_test_2.c: New test case.
7660         * testsuite/Makefile.am (plugin_test_6): New test case.
7661         * testsuite/Makefile.in: Regenerate.
7662
7663 2010-04-06  Nick Clifton  <nickc@redhat.com>
7664
7665         * po/vi.po: New Vietnamese translation.
7666
7667 2010-03-30  Doug Kwan  <dougkwan@google.com>
7668
7669         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7670
7671 2010-03-25  Doug Kwan  <dougkwan@google.com>
7672
7673         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7674         to avoid a conversion warning on a 32-bit host.
7675
7676 2010-03-24  Ian Lance Taylor  <iant@google.com>
7677
7678         * testsuite/script_test_3.t: Add a TLS segment.
7679         * testsuite/Makefile.am (check_PROGRAMS): Add
7680         tls_phdrs_script_test.
7681         (tls_phdrs_script_test_SOURCES): Define.
7682         (tls_phdrs_script_test_DEPENDENCIES): Define.
7683         (tls_phdrs_script_test_LDFLAGS): Define.
7684         (tls_phdrs_script_test_LDADD): Define.
7685         * testsuite/Makefile.in: Rebuild.
7686
7687 2010-03-23  Cary Coutant  <ccoutant@google.com>
7688
7689         * fileread.cc (find_or_make_view): Fix comment.
7690
7691 2010-03-23  Ian Lance Taylor  <iant@google.com>
7692
7693         * script-sections.cc (class Orphan_section_placement): Define
7694         PLACE_TLS and PLACE_TLS_BSS.
7695         (Orphan_section_placement::Orphan_section_placement): Initialize
7696         new places.
7697         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7698         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7699         (tls_script_test_SOURCES): Define.
7700         (tls_script_test_DEPENDENCIES): Define.
7701         (tls_script_test_LDFLAGS): Define.
7702         (tls_script_test_LDADD): Define.
7703         * testsuite/Makefile.in: Rebuild.
7704
7705 2010-03-22  Doug Kwan  <dougkwan@google.com>
7706
7707         * arm.cc (Arm_relocate_functions::abs8,
7708         Arm_relocate_functions::abs16): Use correct check for overflow
7709         specified in the ARM ELF specs.
7710         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7711         target of a BLX instruction specially.
7712         (Reloc_stub::stub_type_for_reloc): Ditto.
7713         (Relocate::relocate): Use symbolic names instead of numeric relocation
7714         codes to report error.
7715         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7716         workaround.
7717         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7718         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7719         thumb2_blx_out_of_range.stdout
7720         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7721         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7722         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7723         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7724         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7725         thumb2_blx_in_range, thumb2_blx_in_range.o,
7726         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7727         thumb2_blx_out_of_range.o): New rules.
7728         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7729         thumb2_blx_in_range and thumb2_blx_out_of_range.
7730         * testsuite/Makefile.in: Regenerate.
7731         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7732         * testsuite/thumb_blx_in_range.s: New file.
7733         * testsuite/thumb_blx_out_of_range.s: New file.
7734
7735 2010-03-22  Rafael Espindola  <espindola@google.com>
7736
7737         * archive.cc (Should_include): Move to archive.h.
7738         (should_include_member): Make it a member of Archive.
7739         (Lib_group): New.
7740         (Add_lib_group_symbols): New.
7741         * archive.h: Include options.h.
7742         (Archive_member): Moved from Archive.
7743         (Should_include): Moved from archive.cc.
7744         (Lib_group): New.
7745         (Add_lib_group_symbols): New.
7746         * dynobj.cc (do_should_include_member): New.
7747         * dynobj.h (do_should_include_member): New.
7748         * gold.cc (queue_initial_tasks): Update call to queue.
7749         * main.cc (main): Print lib group stats.
7750         * object.cc (do_should_include_member): New.
7751         * object.h: Include archive.h.
7752         (Object::should_include_member): New.
7753         (Object::do_should_include_member): New.
7754         (Sized_relobj::do_should_include_member): New.
7755         * options.cc (General_options::parse_start_lib): New.
7756         (General_options::parse_end_lib): New.
7757         (Input_arguments::add_file): Handle lib groups.
7758         (Input_arguments::start_group): Check we are not in a lib.
7759         (Input_arguments::start_lib): New.
7760         (Input_arguments::end_lib): New.
7761         * options.h (General_options): Add start_lib and end_lib.
7762         (Input_argument::lib_): New.
7763         (Input_argument::lib): New.
7764         (Input_argument::is_lib): New.
7765         (Input_file_lib): New.
7766         (Input_arguments::in_lib_): New.
7767         (Input_arguments::in_lib): New.
7768         (Input_arguments::start_lib): New.
7769         (Input_arguments::end_lib_): New.
7770         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7771         in unused members as preempted.
7772         (Sized_pluginobj::do_should_include_member): New.
7773         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7774         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7775         return the blocker.
7776         (Read_symbols::do_whole_lib_group): New.
7777         (Read_symbols::do_lib_group): New.
7778         (Read_symbols::do_read_symbols): Handle lib groups.
7779         (Read_symbols::get_name): Handle lib groups.
7780         * readsyms.h (Read_symbols): Add an archive member pointer.
7781         (Read_symbols::do_whole_lib_group): New.
7782         (Read_symbols::do_lib_group): New.
7783         (Read_symbols::member_): New.
7784         * script.cc (read_input_script): Update call to queue_soon.
7785
7786 2010-03-19  Doug Kwan  <dougkwan@google.com>
7787
7788         * arm.cc (Stub_table::Stub_table): Initialize new data members
7789         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7790         (Stub_table::add_reloc_stub): Assign stub offset and update
7791         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7792         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7793         New data members.
7794         (Stub_table::update_data_size_and_addralign): Use
7795         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7796         instead of going over all reloc stubs.
7797         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7798         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7799         Stringpool_template::offset_ to size of Stringpool_char.
7800         (Stringpool_template::new_key_offset): Remove code to initialize
7801         Stringpool_template::offset_.
7802         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7803         Stringpool_template::offset_ to zero.
7804
7805 2010-03-15  Doug Kwan  <dougkwan@google.com>
7806
7807         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7808         offset_.
7809         (Stringpool_template::new_key_offset): New method.
7810         (Stringpool_template::add_string): Assign offsets when adding new
7811         strings.
7812         (Stringpool_template::set_string_offsets): Do not set string offsets
7813         when not optimizing.
7814         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7815         member size_.
7816         (Chunked_vector::clear): Clear size_.
7817         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7818         (Chunked_vector::size): Return size_.
7819         (Chunked_vector::push_back): Use size_ to find insert position.
7820         (Chunked_vector::size_): New data member.
7821         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7822         (Stringpool_template::new_key_offset): New method declaration.
7823         (Stringpool_template::offset_): New data member.
7824
7825 2010-03-15   Rafael Espindola  <espindola@google.com>
7826
7827         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7828         Add_symbols' constructor.
7829         * readsyms.h (Add_symbols): Remove the input_group member.
7830
7831 2010-03-10  Ian Lance Taylor  <iant@google.com>
7832
7833         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7834         target to ask whether a reference to a symbol requires a stack
7835         split.
7836         * target.h (Target::is_call_to_non_split): New function.
7837         (Target::do_is_call_to_non_split): Declare virtual function.
7838         * target.cc: Include "symtab.h".
7839         (Target::do_is_call_to_non_split): New function.
7840         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7841
7842 2010-03-10  Cary Coutant  <ccoutant@google.com>
7843
7844         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7845         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7846         (File_read::open[2]): Add whole_file_view_ to list of views.
7847         (File_read::make_view): Remove test of whole_file_view_.
7848         (File_read::find_or_make_view): Create whole_file_view_ if
7849         necessary.
7850         (File_read::clear_views): Replace bool parameter with enum;
7851         adjust all callers.  Don't delete views with permanent data;
7852         do delete cached views and views from archives if
7853         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7854         if clearing the corresponding view.
7855         * fileread.h (File_read::Clear_views_mode): New enum.
7856         (File_read::View::is_permanent_view): New method.
7857         (File_read::clear_views): Replace bool parameter
7858         with enum; adjust all callers.
7859         * options.h (General_options): Change keep_files_mapped option;
7860         add map_whole_files.
7861         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7862         releasing the file.
7863         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7864         the file.
7865
7866 2010-03-10  David S. Miller  <davem@davemloft.net>
7867
7868         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7869
7870 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7871
7872         * icf.cc (get_section_contents): Add '@' marker after processing the
7873         merge reloc.
7874
7875 2010-03-08  Doug Kwan  <dougkwan@google.com>
7876
7877         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7878         due to a conversion warning.
7879         (Arm_relobj::update_output_local_symbol_count): Check for local
7880         symbol with unset output index.
7881
7882 2010-03-05  Ian Lance Taylor  <iant@google.com>
7883
7884         * options.h (class General_options): Add --spare-dynamic-tags.
7885         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7886         --spare-dynamic-tags.
7887
7888 2010-03-05  Ian Lance Taylor  <iant@google.com>
7889
7890         * incremental.cc: Include "libiberty.h".
7891
7892 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7893
7894         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7895         function, is_info_ member.
7896         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7897         (Versions::Versions): Update caller.
7898         (Versions::define_base_version): Likewise.
7899         (Versions::add_def): Likewise.
7900
7901 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7902
7903         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7904         (Scan::possible_function_pointer_reloc): New function.
7905         (Scan::local_reloc_may_be_function_pointer): Change to call
7906         possible_function_pointer_reloc.
7907         (Scan::global_reloc_may_be_function_pointer): Ditto.
7908         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7909         relocations in ".data.rel.ro._ZTV" section.
7910         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7911         * testsuite/icf_safe_so_test.cc: Ditto.
7912         * testsuite/icf_safe_test.cc: Ditto.
7913         * testsuite/icf_safe_test.sh: Ditto.
7914
7915 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7916             Ian Lance Taylor  <iant@google.com>
7917
7918         * target-reloc.h (relocate_section): Check the symbol table index
7919         for -1U before setting the local symbol index.
7920         (scan_relocatable_relocs): If copying the relocation, record that
7921         the local symbol is required.
7922         * object.h (Symbol_value::is_output_symtab_index_set): New
7923         function.
7924         (Symbol_value::may_be_discarded_from_output_symtab): New
7925         function.
7926         (Symbol_value::has_output_symtab_entry): New function.
7927         (Symbol_value::needs_output_symtab_entry): Remove.
7928         (Symbol_value::output_symtab_index): Make sure the symbol index is
7929         set.
7930         (Symbol_value::set_output_symtab_index): Make sure the symbol
7931         index is not set.  Make sure the new index is valid.
7932         (Symbol_value::set_must_have_output_symtab_entry): New function.
7933         (Symbol_value::has_output_dynsym_entry): New function.
7934         (Symbol_value::set_output_dynsym_index): Make sure the new index
7935         is valid.
7936         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7937         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7938         local symbol if permitted.
7939         (Sized_relobj::do_finalize_local_symbols): Call
7940         is_output_symtab_index_set rather than needs_output_symtab_entry.
7941         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7942         rather than needs_output_symtab_entry.  Call
7943         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7944         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7945         is_output_symtab_index_set rather than needs_output_symtab_entry.
7946         * testsuite/discard_locals_relocatable_test.c: New file.
7947         * testsuite/discard_locals_test.sh: Test -r.
7948         * testsuite/Makefile.am (check_DATA): Add
7949         discard_locals_relocatable_test1.syms,
7950         discard_local_relocatable_test2.syms.
7951         (MOSTLYCLEANFILES): Likewise.  Also add
7952         discard_locals_relocatable_test1.lout and
7953         discard_locals_relocatable_test2.out.
7954         (discard_locals_relocatable_test1.syms): New target.
7955         (discard_locals_relocatable_test.o): New target.
7956         (discard_locals_relocatable_test1.out): New target.
7957         (discard_locals_relocatable_test2.syms): New target.
7958         (discard_locals_relocatable_test2.out): New target.
7959         (various): Add missing ../ld-new dependencies.
7960         * testsuite/Makefile.in: Rebuild.
7961
7962 2010-03-03  Nick Clifton  <nickc@redhat.com>
7963
7964         * po/fi.po: New Finnish translation.
7965
7966 2010-03-01  Doug Kwan  <dougkwan@google.com>
7967
7968         * layout.cc (Layout::Layout): Force section types of .init_array*,
7969         .preinit_array* and .fini_array* sections.
7970         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7971         Fix check of return value of std::string::find.().
7972         (Output_section::Input_section_sort_compare::operator()): Remove
7973         comment about .init_array.
7974         (Output_section::Input_section_sort_init_fini_compare::operator()):
7975         New method.
7976         (Output_section::sort_attached_input_sections): Handle .init_array
7977         and .fini_array specially.
7978         * output.h (Output_section::Inut_section_sort_compare): Update
7979         comment.
7980         (Output_section::Input_section_sort_init_fini_compare): New struct.
7981
7982 2010-02-26  Doug Kwan  <dougkwan@google.com>
7983
7984         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7985         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7986         * testsuite/debug_msg.sh: Avoid matching source line number for
7987         use of global variable undef_int.
7988
7989 2010-02-26  Doug Kwan  <dougkwan@google.com>
7990
7991         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7992         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7993         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7994         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7995         * options.cc (General_options::General_options): Initialize member
7996         fix_v4bx_.
7997         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7998         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7999         and rm_no_fix_v4bx.stdout
8000         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8001         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8002         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8003         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8004         and arm_no_fix_v4bx.
8005         * Makefile.in: Regenerate.
8006         * testsuite/arm_fix_v4bx.s: New file.
8007         * testsuite/arm_fix_v4bx.sh: Ditto.
8008
8009 2010-02-24  Doug Kwan  <dougkwan@google.com>
8010
8011         * arm.cc (Target_arm::got_section): Make the .got section the first
8012         non RELRO section in the data segment.
8013         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8014         suffixes of section names.
8015
8016 2010-02-24  Doug Kwan  <dougkwan@google.com>
8017
8018         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8019         flags and attributes merging if an input file is a binary file.
8020         * fileread.cc (Input_file::open): Record format of original file.
8021         * fileread.h (Input_file::Format): New enum type.
8022         (Input_file::Input_file): Initialize data member format_.
8023         (Input_file::format): New method definition.
8024         (Input_file::format_):: New data member.
8025
8026 2010-02-24  Doug Kwan  <dougkwan@google.com>
8027
8028         * arm.cc (Arm_output_data_got): New class.
8029         (ARM_TCB_SIZE): New constant
8030         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8031         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8032         If user uses a script with a SECTIONS clause, issue only a warning
8033         for a misplaced EXIDX input section.  Otherwise, issue an error.
8034         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8035         garbage collection.
8036         (Target_arm::got_mode_index_entry): Handle static linking.
8037         (Target_arm::Scan::local): Ditto.
8038         (Target_arm::Scan::global): Ditto.
8039         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8040         all incorrectly implemented relocations.
8041         (Target_arm::fix_exidx_coverage): Pass layout to
8042         Arm_output_section::fix_exidx_coverage.
8043         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8044         from ".ARM.exidx." and ".ARM.extab.".
8045
8046 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8047
8048         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8049         section if it does not already exist.
8050         * attributes.cc (Attributes_section_data::Attributes_section_data):
8051         Don't crash if size is zero.
8052
8053 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8054             Ian Lance Taylor  <iant@google.com>
8055
8056         * gold.cc (queue_middle_tasks): If no input files were opened,
8057         exit.
8058         * workqueue.h (Task_function::Task_function): Assert that there is
8059         a blocker.
8060
8061 2010-02-22  Doug Kwan  <dougkwan@google.com>
8062
8063         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8064         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8065         types to avoid warnings due to different uint64_t implementations
8066         on different hosts.
8067
8068 2010-02-21  Doug Kwan  <dougkwan@google.com>
8069
8070         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8071         handling of the maximum backward branch offset.
8072         (Arm_relocate_functions::thumb_branch_common): Ditto.
8073         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8074         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8075         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8076         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8077         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8078         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8079         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8080         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8081         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8082         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8083         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8084         thumb2_bl_out_of_range.o): New rules.
8085         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8086         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8087         thumb2_bl_out_of_range
8088         * testsuite/Makefile.in: Regenerate.
8089         * testsuite/arm_bl_in_range.s: New file.
8090         * testsuite/arm_bl_out_of_range.s: Ditto.
8091         * testsuite/arm_branch_in_range.sh: Ditto.
8092         * testsuite/arm_branch_range.t: Ditto.
8093         * testsuite/thumb2_branch_range.t: Ditto.
8094         * testsuite/thumb_bl_in_range.s: Ditto.
8095         * testsuite/thumb_bl_out_of_range.s: Ditto.
8096         * testsuite/thumb_branch_range.t: Ditto.
8097
8098 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8099
8100         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8101         Add reloc offset information.
8102         * icf.cc (get_section_contents): Change iterators to point to the new
8103         vectors. Add reloc offset information to the contents.
8104         * icf.h (Icf::Sections_reachable_info): New typedef.
8105         (Icf::Sections_reachable_list): New typedef.
8106         (Icf::Offset_info): New typedef.
8107         (Icf::Reloc_info): New struct typedef.
8108         (Icf::Reloc_info_list): New typedef.
8109         (Icf::symbol_reloc_list): Delete method.
8110         (Icf::addend_reloc_list): Delete method.
8111         (Icf::section_reloc_list): Delete method.
8112         (Icf::reloc_info_list): New method.
8113         (Icf::reloc_info_list_): New member.
8114
8115 2010-02-19  Doug Kwan  <dougkwan@google.com>
8116
8117         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8118         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8119         * arm.cc (Arm_relocation_functions): New forward declaration.
8120         (Target_arm::Target_arm): Initialize new data members
8121         got_mod_index_offset_ and tls_base_symbol_defined_.
8122         (Target_arm::Relocate::relocate_tls): New method.
8123         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8124          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8125         New methods.
8126         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8127         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8128         (Target_arm::got_mod_index_offset_,
8129         Target_arm::tls_base_symbol_defined_): New data members.
8130         (Target_arm::Scan::local, Target::Scan::global,
8131         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8132         relocations.
8133
8134 2010-02-18  Doug Kwan  <dougkwan@google.com>
8135
8136         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8137         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8138         text section as a parameter becuase some broken tools may not set
8139         the link in section header.
8140         (Target_arm::has_got_section): New method.
8141         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8142         without any mapping symbol as data only.  Remove warning.
8143         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8144         link in its section header, try to discover the link by inspecting the
8145         REL31 relocation at the beginning of the section.
8146         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8147         in error message.
8148         (Target_arm::Scan::global): Treat any reference to the symbol
8149         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8150
8151 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8152
8153         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8154         (Scan::global_reloc_may_be_function_pointer): New function.
8155         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8156         (Scan::global_reloc_may_be_function_pointer): New function.
8157         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8158         (Scan::global_reloc_may_be_function_pointer): New function.
8159         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8160         (Scan::global_reloc_may_be_function_pointer): New function.
8161         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8162         (Scan::global_reloc_may_be_function_pointer): New function.
8163         (Scan::possible_function_pointer_reloc): New function.
8164         (Target_x86_64::can_check_for_function_pointers): New function.
8165         * gc.h (gc_process_relocs): Scan relocation types to determine if
8166         function pointers were taken for targets that support it.
8167         * icf.cc (Icf::find_identical_sections): Include functions for
8168         folding in safe ICF whose pointer is not taken.
8169         * icf.h (Secn_fptr_taken_set): New typedef.
8170         (fptr_section_id_): New member.
8171         (section_has_function_pointers): New function.
8172         (set_section_has_function_pointers): New function.
8173         (check_section_for_function_pointers): New function.
8174         * options.h: Fix comment for safe ICF option.
8175         * target.h (can_check_for_function_pointers): New function.
8176         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8177         Modify icf_safe_test for X86-64.
8178         * testsuite/Makefile.in: Regenerate.
8179         * testsuite/icf_safe_so_test.cc: New file.
8180         * testsuite/icf_safe_so_test.sh: New file.
8181         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8182         (main): Change to take pointer to function kept_func_3.
8183         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8184         folding is done correctly for X86-64.
8185
8186 2010-02-12  David S. Miller  <davem@davemloft.net>
8187
8188         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8189         is_symbolless parameter.
8190         (Output_reloc<SHT_REL>::is_symbolless): New.
8191         (Output_reloc<SHT_REL>::is_symbolless_): New.
8192         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8193         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8194         (Output_reloc<SHT_RELA>::is_symbolless): New.
8195         (Output_data_reloc::add_global): Handle is_symbolless.
8196         (Output_data_reloc::add_global_relative): Likewise.
8197         (Output_data_reloc::add_local): Likewise.
8198         (Output_data_reloc::add_local_relative): Likewise.
8199         (Output_data_reloc::add_symbolless_global_addend): New.
8200         (Output_data_reloc::add_symbolless_local_addend): New.
8201         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8202         is_symbolless.
8203         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8204         instead of ->is_relative_
8205         (Output_reloc::write): Likewise.
8206         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8207         (Output_reloc::write_rel): Simplify.
8208
8209         * sparc.cc (Target_sparc::Scan::local): Use
8210         ->add_symbolless_local_addend as needed.
8211         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8212         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8213         based upon relocation offset.
8214
8215 2010-02-11  Doug Kwan  <dougkwan@google.com>
8216
8217         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8218         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8219         beginning of function.
8220         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8221         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8222         parameter is_32bit in calls to should_apply_static_reloc.
8223         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8224         (check_DATA): Add arm_abs_global.stdout.
8225         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8226         arm_abs_global.stdout): New rules.
8227         (MOSTLLYCLEANFILES): Add arm_abs_global
8228         * Makefile.in: Regenerate.
8229         * testsuite/arm_abs_global.s: New file.
8230         * testsuite/arm_abs_global.sh: Ditto.
8231         * testsuite/arm_abs_lib.s: Ditto.
8232
8233 2010-02-11  Ian Lance Taylor  <iant@google.com>
8234
8235         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8236         Read_relocs task.
8237         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8238         Allocate_commons_task first.
8239         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8240         task, rather than symtab_lock_.
8241         (Gc_process_relocs::~Gc_process_relocs): New function.
8242         (Gc_process_relocs::is_runnable): Check this_blocker_.
8243         (Gc_process_relocs::locks): Use next_blocker_ rather than
8244         blocker_.
8245         (Scan_relocs::~Scan_relocs): New function.
8246         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8247         symtab_lock_.
8248         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8249         next_blocker_.
8250         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8251         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8252         constructor accordingly.
8253         (class Gc_process_relocs): Likewise.
8254         (class Scan_relocs): Likewise.
8255         * common.h (class Allocate_commons_task): Remove symtab_lock_
8256         field, and corresponding constructor parameter.
8257         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8258         symtab_lock_.
8259         (Allocate_commons_task::locks): Likewise.
8260
8261 2010-02-11  Ian Lance Taylor  <iant@google.com>
8262
8263         * gold-threads.h (class Once): Define.
8264         (class Initialize_lock): Rewrite as child of Once.
8265         * gold-threads.cc (class Once_initialize): Define.
8266         (once_pointer_control): New static variable.
8267         (once_pointer, once_arg): New static variables.
8268         (c_run_once): New static function.
8269         (Once::Once, Once::run_once, Once::internal_run): New functions.
8270         (class Initialize_lock_once): Remove.
8271         (initialize_lock_control): Remove.
8272         (initialize_lock_pointer): Remove.
8273         (initialize_lock_once): Remove.
8274         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8275         (Initialize_lock::initialize): Rewrite.
8276         (Initialize_lock::do_run_once): New function.
8277         * archive.cc (Archive::interpret_header): Only clear name if it is
8278         not already empty.
8279         * fileread.cc: Include "gold-threads.h"
8280         (file_counts_lock): New static variable.
8281         (file_counts_initialize_lock): Likewise.
8282         (File_read::release): Only increment counts when using --stats.
8283         Use a lock around the increment.
8284         * parameters.cc (class Set_parameters_target_once): Define.
8285         (set_parameters_target_once): New static variable.
8286         (Parameters::Parameters): Move here from parameters.h.
8287         (Parameters::set_target): Rewrite.
8288         (Parameters::set_target_once): New function.
8289         (Parameters::clear_target): Move here and rewrite.
8290         * parameters.h (class Parameters): Update declarations.  Add
8291         set_parameters_target_once_ field.
8292         (Parameters::Parameters): Move to parameters.cc.
8293         (Parameters::clear_target): Likewise.
8294         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8295         task.
8296         (Start_group::~Start_group): New function.
8297         (Start_group::is_runnable): New function.
8298         (Start_group::locks, Start_group::run): New functions.
8299         (Finish_group::run): Change saw_undefined to size_t.
8300         * readsyms.h (class Start_group): Define.
8301         (class Finish_group): Change saw_undefined_ field to size_t.
8302         (Finish_group::Finish_group): Remove saw_undefined and
8303         this_blocker parameters.  Change all callers.
8304         (Finish_group::set_saw_undefined): New function.
8305         (Finish_group::set_blocker): New function.
8306         * symtab.h (class Symbol_table): Change saw_undefined to return
8307         size_t.  Change saw_undefined_ field to size_t.
8308         * target-select.cc (Set_target_once::do_run_once): New function.
8309         (Target_selector::Target_selector): Initialize set_target_once_
8310         field.  Don't initialize lock_ and initialize_lock_ fields.
8311         (Target_selector::instantiate_target): Rewrite.
8312         (Target_selector::set_target): New function.
8313         * target-select.h (class Set_target_once): Define.
8314         (class Target_selector): Update declarations.  Make
8315         Set_target_once a friend.  Remove lock_ and initialize_lock_
8316         fields.  Add set_target_once_ field.
8317
8318 2010-02-10  Ian Lance Taylor  <iant@google.com>
8319
8320         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8321         queueing any tasks.
8322         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8323         (queue_middle_tasks): Add all blockers before queueing any tasks.
8324         (queue_final_tasks): Likewise.
8325         * token.h (Task_token::add_blockers): New function.
8326         * object.h (Input_objects::number_of_relobjs): New function.
8327
8328 2010-02-10  Ian Lance Taylor  <iant@google.com>
8329
8330         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8331         shared, not if not position independent.
8332         * x86_64.cc (Relocate::relocate_tls): Likewise.
8333         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8334         (tls_pie_pic_test): New target.
8335         * testsuite/Makefile.in: Rebuild.
8336
8337         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8338         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8339         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8340         * testsuite/Makefile.in: Rebuild.
8341
8342 2010-02-09  David S. Miller  <davem@davemloft.net>
8343
8344         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8345         R_SPARC_RELATIVE using ->add_local_relative().
8346         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8347
8348         * output.h (Output_data_dynamic::add_section_size): New method
8349         that takes two Output_data objects.
8350         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8351         entry param.  Handle it in initializers.
8352         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8353         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8354         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8355         arg.
8356         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8357         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8358         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8359         for dynrel_includes_plt.
8360         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8361         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8362         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8363         before .rela.plt
8364         (Target_sparc::do_finalize_sections): Update to pass true for
8365         dynrel_includes_plt.
8366         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8367         output before .rela.plt
8368         (Target_powerpc::do_finalize_sections): Update to pass true for
8369         dynrel_includes_plt when 32-bit.
8370
8371 2010-02-08  Doug Kwan  <dougkwan@google.com>
8372
8373         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8374         method.
8375         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8376         Arm_relobj::scan_section_for_cortex_a8_stubs,
8377         Arm_relobj::do_relocation_section): Instead of calling
8378         Output_section::output_address, use faster
8379         Arm_relobj::simple_input_section_output_address.
8380
8381 2010-02-08  David S. Miller  <davem@davemloft.net>
8382
8383         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8384         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8385         relocation helper function.
8386
8387         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8388         just like R_SPARC_GOT{10,13,22}.
8389         (Target_sparc::Scan::local): Likewise.
8390         (Target_sparc::Relocate:relocate): Likewise.
8391
8392 2010-02-06  Ian Lance Taylor  <iant@google.com>
8393
8394         * configure.ac: Rewrite targetobjs duplicate removal code to use
8395         only shell constructs.
8396         * configure: Rebuild.
8397
8398 2010-02-05  Doug Kwan  <dougkwan@google.com>
8399
8400         PR 11247
8401         * arm.cc (Arm_relobj::section_is_scannable): New method.
8402         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8403         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8404
8405 2010-02-04  Doug Kwan  <dougkwan@google.com>
8406
8407         PR 11247
8408         * arm-reloc-property.cc (cstdio): Include.
8409         * configure.ac (targetobjs): Remove duplicates.
8410         * configure: Regenerate.
8411         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8412         big and little endian version for a given address size.
8413
8414 2010-02-03  Doug Kwan  <dougkwan@google.com>
8415
8416         * arm-reloc-property.cc
8417         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8418         definition.
8419         * arm-reloc-property.h
8420         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8421         New method definition.
8422         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8423         declaration.
8424         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8425         overflow to N.
8426         (GOT_PREL): Change implemented to Y.
8427         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8428         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8429         (Arm_relocate_functions::movw_abs_nc): Remove method.
8430         (Arm_relocate_functions::movt_abs): Ditto.
8431         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8432         (Arm_relocate_functions::thm_movt_abs): Ditto.
8433         (Arm_relocate_functions::movw_rel_nc): Ditto.
8434         (Arm_relocate_functions::movw_rel): Ditto.
8435         (Arm_relocate_functions::movt_rel): Ditto.
8436         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8437         (Arm_relocate_functions:thm_movw_rel): Ditto.
8438         (Arm_relocate_functions:thm_movt_rel): Ditto.
8439         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8440         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8441         New method definitions.
8442         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8443         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8444         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8445         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8446         (Target_arm::Relocate::relocate): Check for non-static or
8447         unimplemented relocation code and exit early.  Change calls to
8448         Target_arm::reloc_uses_thumb_bit and
8449         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8450         instead.  Refactor code to handle similar relocations to increase
8451         code sharing.  Remove check for unsupported relocation code in switch
8452         statement.
8453         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8454         relocation property table to find out size.  Change error message to
8455         print out the name of a relocation code instead of the numeric value.
8456         (Target_arm::scan_reloc_for_stub): Use relocation property table
8457         instead of calling Target_arm::reloc_uses_thumb_bit().
8458
8459 2010-02-02  Doug Kwan  <dougkwan@google.com>
8460
8461         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8462         types of relaxed input section.
8463
8464 2010-02-02  Doug Kwan  <dougkwan@google.com>
8465
8466         * Makefile.am (HFILES): Add arm-reloc-property.h.
8467         (DEFFILES): New.
8468         (TARGETSOURCES): Add arm-reloc-property.cc
8469         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8470         (libgold_a_SOURCES): $(DEFFILES)
8471         * Makefile.in: Regenerate.
8472         * arm-reloc-property.cc: New file.
8473         * arm-reloc-property.h: New file.
8474         * arm-reloc.def: New file.
8475         * arm.cc: Update comments.
8476         (arm-reloc-property.h): New included header.
8477         (arm_reloc_property_table): New global variable.
8478         (Target_arm::do_select_as_default_target): New method definition.
8479         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8480         arm-reloc-property to targ_extra_obj.
8481         * parameters.cc (set_parameters_target): Call
8482         Target::select_as_default_target().
8483         * target.h (Target::select_as_default_target): New method definition.
8484         (Target::do_select_as_default_target): Same.
8485
8486 2010-02-01  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8489         first_output_text_section_.
8490         (Arm_exidx_fixup::first_output_text_section): New method definition.
8491         (Arm_exidx_fixup::first_output_text_section_): New data member.
8492         (Arm_exidx_fixup::process_exidx_section): Record the first text
8493         output section seen.
8494         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8495         and entsize in output section header.
8496
8497 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8498
8499         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8500         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8501         (Arm_relocate_functions::thm_alu11): New Method.
8502         (Arm_relocate_functions::thm_pc8): New Method.
8503         (Arm_relocate_functions::thm_pc12): New Method.
8504         (Target_arm::Scan::local): Handle the relocations.
8505         (Target_arm::Scan::global): Likewise.
8506         (Target_arm::Relocate::relocate): Likewise.
8507         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8508
8509 2010-01-29  Doug Kwan  <dougkwan@google.com>
8510
8511         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8512         of relocation types as ld.
8513
8514 2010-01-29  Doug Kwan  <dougkwan@google.com>
8515
8516         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8517         to public.
8518         (Arm_relocate_functions::thumb_branch_common): Ditto.
8519         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8520         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8521         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8522         Arm_relocate_functions::jump24): Remove.
8523         (Target_arm::Relocate::relocate): Adjust code to call
8524         Arm_relocation_functions::arm_branch_common and
8525         Arm_relocation_functions::thumb_branch_common instead of their removed
8526         wrappers.  Merge switch-cases together to reduce source code size.
8527
8528 2010-01-29  Doug Kwan  <dougkwan@google.com>
8529
8530         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8531         output_local_symbol_count_needs_update_.
8532         (Arm_relobj::output_local_symbol_count_needs_update,
8533          Arm_relobj::set_output_local_symbol_count_needs_update,
8534          Arm_relobj::update_output_local_symbol_count): New methods.
8535         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8536         member.
8537         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8538         of pointed function as in a R_ARM_PREL31 relocation.
8539         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8540         for output local symbol count updating.
8541         (Target_arm::do_relax): Update output local symbol counts in objects
8542         if necessary.
8543         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8544
8545 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8546
8547         * arm.cc: Added support for the ARM relocations:
8548         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8549         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8550         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8551         movw_prel_nc).
8552         (Arm_relocate_functions::movw_rel): New method.
8553         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8554         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8555         thm_movw_prel_nc).
8556         (Arm_relocate_functions::thm_movw_rel): New method.
8557         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8558         thm_movt_prel).
8559         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8560         relocations.
8561         (Target_arm::Scan::global): Likewise.
8562         (Target_arm::Relocate::relocate): Likewise.
8563         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8564         Likewise.
8565
8566 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8567
8568         * arm.cc: Added support for ARM group relocations.
8569         (Target_arm::reloc_needs_sym_origin): New method.
8570         (Arm_relocate_functions::calc_grp_kn): New method.
8571         (Arm_relocate_functions::calc_grp_residual): New method.
8572         (Arm_relocate_functions::calc_grp_gn): New method.
8573         (Arm_relocate_functions::arm_grp_alu): New Method.
8574         (Arm_relocate_functions::arm_grp_ldr): New Method.
8575         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8576         (Arm_relocate_functions::arm_grp_ldc): New Method.
8577         (Target_arm::Scan::local): Handle the ARM group relocations.
8578         (Target_arm::Scan::global): Likewise.
8579         (Target_arm::Relocate::relocate): Likewise.
8580         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8581         Likewise.
8582
8583 2010-01-26  Doug Kwan  <dougkwan@google.com>
8584
8585         * arm.cc (set): Include.
8586         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8587         pointer type.
8588         (Arm_output_section::Text_section_list): New type.
8589         (Arm_output_section::append_text_sections_to_list): New method.
8590         (Arm_output_section::fix_exidx_coverage): Ditto.
8591         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8592         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8593         Relobj::set_section_offset() instead of
8594         Sized_relobj::invalidate_section_offset().
8595         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8596         parameter for section headers. Ignore relocation sections for
8597         unallocated sections and EXIDX sections.
8598         (Target_arm::fix_exidx_coverage): New method.
8599         (Target_arm::output_section_address_less_than): New type.
8600         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8601         linked text section instead of the EXIDX section.
8602         (Arm_output_section::create_stub_group): Add an assertion to check
8603         that this is not an EXIDX output section.
8604         (Arm_output_section::append_text_sections_to_list): New method.
8605         (Arm_output_section::fix_exidx_coverage): Ditto.
8606         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8607         Arm_relobj::section_needs_reloc_stub_scanning.
8608         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8609         first pass.
8610         (Target_arm::fix_exidx_coverage): New method.
8611         * object.h (Relobj::set_output_section): New method.
8612         (Sized_relobj::invalidate_section_offset): Remove method.
8613         (Sized_relobj::do_invalidate_section_offset): Remove method.
8614         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8615
8616 2010-01-25  Doug Kwan  <dougkwan@google.com>
8617
8618         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8619         Fix warning due to signed and unsigned comparison on a 32-bit host.
8620
8621 2010-01-22  Doug Kwan  <dougkwan@google.com>
8622
8623         * arm.cc (Target_arm::do_relax): Record an output section for section
8624         offset adjustment it contains any stub table that has changed.
8625         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8626         offsets in an output section if necessary.
8627         * output.cc (Output_section::Output_section): Initialize
8628         section_offsets_need_adjustments_.
8629         (Output_section::add_input_section_for_script): Renamed to
8630         Output_section::add_simple_input_section.
8631         (Output_section::save_states): Add a comment.
8632         (Output_section::discard_states): New method defintion.
8633         (Output_section::adjust_section_offsets): Same.
8634         * output.h (Output_section::add_input_section_for_script): Renamed to
8635         Output_section::add_simple_input_section.
8636         (Output_section::discard_states): New method declaration.
8637         (Output_section::adjust_section_offsets): Same.
8638         (Output_section::section_offsets_need_adjustment,
8639         Output_section::set_section_offsets_need_adjustment): New method
8640         definitions.
8641         (Output_section::section_offsets_need_adjustment_): New data member.
8642         * script-sections.cc
8643         (Output_section_element_input::set_section_address): Adjust code for
8644         renaming of Output_section::add_input_section_for_script.
8645         (Orphan_output_section::set_section_address): Same.
8646
8647 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8648
8649         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8650         Fix_v4bx enum values .
8651         * gold/options.h (General_options): New option definitions.
8652         (General_options::fix_v4bx): New method.
8653         (General_options::Fix_v4bx): New enum.
8654         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8655         (General_options::parse_fix_v4bx_interworking): New method.
8656
8657 2010-01-22  Doug Kwan  <dougkwan@google.com>
8658
8659         * arm.cc (Arm_exidx_fixup): New class.
8660
8661 2010-01-21  Doug Kwan  <dougkwan@google.com>
8662
8663         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8664         classes.
8665         (Arm_exidx_section_offset_map): New type.
8666
8667 2010-01-21  Doug Kwan  <dougkwan@google.com>
8668
8669         * arm.cc (Arm_exidx_input_section): New class.
8670         (Arm_relobj::exidx_input_section_by_link,
8671         Arm_relobj::exidx_input_section_by_shndx,
8672         Arm_relobj::make_exidx_input_section): New methods.
8673         (read_arm_attributes_section): Remove.
8674         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8675         information about them.
8676         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8677         to here.
8678
8679 2010-01-20  Doug Kwan  <dougkwan@google.com>
8680
8681         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8682         Input_section_specifier to Section_id.
8683         (Target_arm::new_arm_input_section: Adjust code for change of key
8684         type.
8685         (Target_arm::find_arm_input_section): Ditto.
8686         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8687         (Section_id): Remove.
8688         (Garbage_collection::Section_id_hash): Remove.
8689         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8690         (Section_id): Remove.
8691         (Icf::Section_id_hash): Remove.
8692         * object.h (Section_id, Const_section_id, Section_id_hash,
8693         Const_section_id_hash): New type definitions.
8694         * output.cc (Output_section::add_relaxed_input_section): Change to
8695         use Const_section_id instead of Input_section_specifier as key type.
8696         (Output_section::add_merge_input_section): Ditto.
8697         (Output_section::build_relaxation_map): Change to use Section_id
8698         instead of Input_section_specifier as key type.
8699         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8700         Ditto.
8701         (Output_section::convert_input_sections_to_relaxed_sections): Change
8702         to use Const_section_id instead of Input_section_specifier as key type.
8703         (Output_section::find_merge_section): Ditto.
8704         (Output_section::find_relaxed_input_section): Ditto.
8705         * output.h (Input_section_specifier): Remove class.
8706         (Output_section::Output_section_data_by_input_section_map): Change
8707         key type to Const_section_id.
8708         (Output_section::Output_relaxed_input_section_by_input_section_map):
8709         Ditto.
8710         (Output_section::Relaxation_map): Change key type to Section_id.
8711
8712 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8713
8714         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8715         (class Arm_v4bx_stub): New class.
8716         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8717         (Stub_factory::make_arm_v4bx_stub): New method.
8718         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8719         (Stub_table::empty): Handle v4bx stubs.
8720         (Stub_table::add_arm_v4bx_stub): New method.
8721         (Stub_table::find_arm_v4bx_stub): New method.
8722         (Arm_relocate_functions::v4bx): New method.
8723         (Target_arm::fix_v4bx): New method.
8724         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8725         (Stub_table::relocate_stubs): Likewise.
8726         (Stub_table::do_write): Likewise.
8727         (Stub_table::update_data_size_and_addralign): Likewise.
8728         (Stub_table::finalize_stubs):  Likewise.
8729         (Target_arm::Scan::local): Likewise.
8730         (Target_arm::Scan::global): Likewise.
8731         (Target_arm::do_finalize_sections): Likewise.
8732         (Target_arm::Relocate::relocate): Likewise.
8733         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8734         Likewise.
8735         (Target_arm::scan_reloc_for_stub): Likewise.
8736         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8737
8738 2010-01-19  Ian Lance Taylor  <iant@google.com>
8739
8740         * output.cc (Output_section_headers::do_sized_write): Write large
8741         segment count to sh_info field.
8742         (Output_file_header::do_sized_write): For large segment count,
8743         write PN_XNUM to e_phnum field.
8744
8745 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8746
8747         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8748         (Arm_relocate_functions::thm_jump8): New function.
8749         (Arm_relocate_functions::thm_jump11): New function.
8750         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8751         R_ARM_THM_JUMP11.
8752         (Target_arm::Scan::global): Likewise.
8753         (Target_arm::Relocate::relocate): Likewise.
8754         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8755         Likewise.
8756
8757 2010-01-14  Doug Kwan  <dougkwan@google.com>
8758
8759         * arm.cc (map, utility): Include headers.
8760         (Target_arm::apply_cortex_a8_workaround): New method.
8761         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8762         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8763         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8764         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8765         the --[no-]fix-cortex-a8 command line options.
8766         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8767         (Target_arm::relocate_stub): Use addend in instruction template.
8768         * options.h (DEFINE_bool): Set the user-set flag.
8769         (General_options): Add --[no-]-fix-cortex options.
8770         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8771         : Update fast look-up map after conversion.
8772
8773 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8774
8775         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8776         in the first pass of do_layout.
8777
8778 2010-01-13  Doug Kwan  <dougkwan@google.com>
8779
8780         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8781         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8782         apparent compiler problem of not folding static constant integral
8783         data members of elfcpp::Elf_sizes<32>.
8784
8785 2010-01-13  Doug Kwan  <dougkwan@google.com>
8786
8787         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8788         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8789         Arm_relobj::scan_section_for_cortex_a8_erratum,
8790         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8791         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8792         sections to scan for relocation stubs into a new method
8793         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8794         relocation and Cortex-A8 stub scanning.
8795         (Target_arm::do_relax): Force stubs to be after stubbed sections
8796         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8797         the beginning of a new relaxation pass.  Update a comment.
8798         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8799
8800 2010-01-12  Ian Lance Taylor  <iant@google.com>
8801
8802         * target-reloc.h (visibility_error): New inline function.
8803         (relocate_section): Call visibility_error.
8804         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8805         (MOSTLYCLEANFILES): Likewise.
8806         (protected_4_pic.o, protected_3.err): New targets.
8807         * testsuite/protected_4.cc: New file.
8808
8809 2010-01-12  Doug Kwan  <dougkwan@google.com>
8810
8811         * arm.cc (Cortex_a8_reloc): New class.
8812         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8813         and cortex_a8_relocs_info_.
8814         (Target_arm::fix_cortex_a8): New method definition.
8815         (Target_arm::Cortex_a8_relocs_info): New type.
8816         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8817         New data member declarations.
8818         (Target_arm::scan_reloc_for_stub): Record information about
8819         relocations for THUMB branches that might be exempted from the
8820         Cortex-A8 workaround.
8821         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8822         at the beginning of a relaxation pass.
8823
8824 2010-01-12  Doug Kwan  <dougkwan@google.com>
8825
8826         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8827         (Arm_relobj::Mapping_symbol_position,
8828          Arm_reloj::Mapping_symbol_position_less,
8829          Arm_relobj::Mapping_symbols_info): New types.
8830         (Target_arm::is_mapping_symbol_name): New method definition.
8831         (Arm_relobj::do_count_local_symbols): Save information about mapping
8832         symbols.
8833
8834 2010-01-11  Doug Kwan  <dougkwan@google.com>
8835
8836         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8837         Arm_relocate_functions::thumb32_branch_upper,
8838         Arm_relocate_functions::thumb32_branch_lower,
8839         Arm_relocate_functions::thumb32_cond_branch_offset,
8840         Arm_relocate_functions::thumb32_cond_branch_upper,
8841         Arm_relocate_functions::thumb32_cond_branch_lower,
8842         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8843         branch offset encoding.
8844         (Arm_relocate_functions::thumb_branch_common): Use new branch
8845         offset encoding methods to avoid code duplication.
8846         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8847         (Stub_addend_reader::operator()): Use new branch encoding method
8848         to avoid code duplication.
8849
8850 2010-01-11  Doug Kwan  <dougkwan@google.com>
8851
8852         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8853         (Target_arm::do_finalize_sections): Define special EXIDX section
8854         symbols only if referenced.
8855         * gc.h (Garbage_collection::add_reference): New method.
8856         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8857         code duplication.
8858
8859 2010-01-11  Ian Lance Taylor  <iant@google.com>
8860
8861         * script.cc (Version_script_info::build_expression_list_lookup):
8862         Change complaing about duplicate wildcard match from error to
8863         warning.
8864
8865         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8866         of 2009-12-30.
8867         (Version_script_info::Version_script_info): Initialize globs_,
8868         default_version_, default_is_global_, and exact_.  Don't
8869         initialize globals_ or locals_.
8870         (Version_script_info::build_lookup_tables): Build local symbols
8871         first.
8872         (Version_script_info::unquote): New function.
8873         (Version_script_info::add_exact_match): New function.
8874         (Version_script_info::build_expression_list_lookup): Remove lookup
8875         parameter.  Add is_global parameter.  Change all callers.  Handle
8876         wildcard pattern specially.  Unquote pattern.  Call
8877         add_exact_match.
8878         (Version_script_info::get_name_to_match): New function.
8879         (Version_script_info::get_symbol_version): New function.
8880         (Version_script_info::get_symbol_version_helper): Remove.
8881         (Version_script_info::check_unmatched_names): Call unquote.
8882         * script.h (class Version_script_info): Change get_symbol_version
8883         to be non-inline and add is_global parameter; change all callers.
8884         Rewrite symbol_is_local.  Update declarations.  Define struct
8885         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8886         Remove globals_ and locals_ members.  Add exact_, globs_,
8887         default_version_, is_global_.
8888         (Version_script_info::Glob): Remove pattern, add expression and
8889         is_global.  Update constructor.  Change all callers.
8890         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8891         default version.
8892         (Versions::symbol_section_contents): If a symbol is undefined, or
8893         defined in a dynamic object, set the version index to
8894         VER_NDX_LOCAL.
8895         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8896         symbol_is_local.
8897         (Symbol_table::add_from_pluginobj): Likewise.
8898         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8899
8900 2010-01-11  Doug Kwan  <dougkwan@google.com>
8901
8902         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8903         (incremental_dump_LDADD): Add linking option for libintl.
8904         * Makefile.in: Regenerate.
8905
8906 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8907
8908         PR gold/11144
8909         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8910         instead of -Ds.
8911         * testsuite/Makefile.in: Regenerated.
8912
8913 2010-01-10  Doug Kwan  <dougkwan@google.com>
8914
8915         * options.h (DEFINE_var): Use parentheses around argument varname__
8916         in macro body to avoid any unintended subsequent substitutions.
8917
8918 2010-01-10  Ian Lance Taylor  <iant@google.com>
8919
8920         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8921         candidates before doing symbol resolution.
8922
8923         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8924         ODR candidates if only one is weak.
8925
8926 2010-01-08  Ian Lance Taylor  <iant@google.com>
8927
8928         * script.cc (Version_script_info::build_expression_list_lookup):
8929         Don't warn about ambiguous version, just record the ambiguity.
8930         (Version_script_info::get_symbol_version_helper): Give error if
8931         version is ambiguous.
8932
8933 2010-01-08  Doug Kwan  <dougkwan@google.com>
8934
8935         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8936         prev_data_size_ and prev_addralign_.  Remove initializer for
8937         deleted data member has_been_changed_.
8938         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8939         to determine if the table is empty.
8940         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8941         Remove.
8942         (Stub_table::add_reloc_stub): Define method in class definition
8943         instead of just declaring it there.
8944         (Stub_table::add_cortex_a8_stub): New method definition.
8945         (Stub_table::update_data_size_and_addralign): Ditto.
8946         (Stub_table::finalize_stubs): Ditto.
8947         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8948         (Stub_table::do_addralign_): Return address alignment in the
8949         (Stub_table::do_reset_address_and_file_offset): Define method in
8950         class definition instead of declaring it there.  Set current data
8951         size to be the data size of the previous pass.
8952         (Stub_table::set_final_data_size): Use current data size as the
8953         final data size.
8954         (Stub_table::relocate_stub): Change parameter type of stub from
8955         Reloc_stub pointer to Stub pointer.
8956         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8957         (Stub_table::Cortex_a8_stub_list): New typedef.
8958         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8959          Stub_table::prev_addralign_): New data member.
8960         (Arm_relobj::Arm_relobj): Initialize data member
8961         section_has_cortex_a8_workaround_.
8962         (Arm_relobj::section_has_cortex_a8_workaround,
8963          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8964          definitions.
8965         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8966         declarations.
8967         (Target_arm::relocate_stub): Change parameter type of stub from
8968         Reloc_stub pointer to Stub pointer.
8969         (Insn_template::size, Insn_template::alignment): Handle
8970         THUMB16_SPECIAL_TYPE.
8971         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8972          Stub_table::update_data_size_and_addralign,
8973          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8974         definitions.
8975         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8976         (Stub_table::do_write): Ditto.
8977         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8978
8979 2010-01-08  Ian Lance Taylor  <iant@google.com>
8980
8981         PR 11108
8982         * symtab.h (class Symbol): Remove fields is_target_special_ and
8983         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8984         (Symbol::is_defined_in_discarded_section): New function.
8985         (Symbol::set_is_defined_in_discarded_section): New function.
8986         (Symbol::has_plt_offset): Rewrite.
8987         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8988         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8989         Don't initialize is_target_special_ or has_plt_offset_.
8990         Initialize is_defined_in_discarded_section_.
8991         (Symbol_table::add_from_relobj): If appropriate, set
8992         is_defined_in_discarded_section.
8993         * resolve.cc (Symbol::override_base_with_special): Don't test
8994         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8995         * target-reloc.h (relocate_section): Do special handling for
8996         symbols defined in discarded sections for global symbols as well
8997         as local symbols.
8998
8999 2010-01-08  Ian Lance Taylor  <iant@google.com>
9000
9001         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9002         the SHT_SYMTAB case.
9003
9004 2010-01-08  Ian Lance Taylor  <iant@google.com>
9005
9006         * object.cc (Sized_relobj::do_layout): Don't get confused if
9007         layout_eh_frame returns NULL.
9008
9009 2010-01-08  Ian Lance Taylor  <iant@google.com>
9010
9011         PR 11084
9012         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9013         dynamic symbol table, use the normal symbol table.
9014         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9015         symbol table.
9016
9017 2010-01-08  Ian Lance Taylor  <iant@google.com>
9018
9019         PR 11072
9020         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9021         sections.
9022
9023 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9024
9025         * version.cc (print_version): Change to "Copyright 2010".
9026
9027 2010-01-08  Ian Lance Taylor  <iant@google.com>
9028
9029         PR 10287
9030         PR 11063
9031         * i386.cc (class Target_i386): Change return type of plt_section
9032         to be non-const.
9033         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9034         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9035         tls_desc_rel_ field.
9036         (Output_data_plt_i386::rel_tls_desc): New function.
9037         (Target_i386::rel_tls_desc_section): New function.
9038         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9039         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9040         R_386_TLS_DESC reloc in rel_tls_desc_section.
9041         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9042         Define struct Tlsdesc_info.
9043         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9044         (Target_x86_64::do_reloc_symbol_index): New function.
9045         (Target_x86_64::add_tlsdesc_info): New function.
9046         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9047         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9048         tlsdesc_rel_ field.
9049         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9050         all callers.
9051         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9052         (Target_x86_64::rela_tlsdesc_section): New function.
9053         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9054         handling.
9055         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9056         (Target_x86_64::do_reloc_addend): New function.
9057         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9058         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9059         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9060         (Output_reloc::type): New function.
9061         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9062         (Output_reloc::is_target_specific): New function.
9063         (Output_reloc::target_arg): New function.
9064         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9065         absolute relocs and target specific relocs.
9066         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9067         add_target_specific.
9068         (class Output_data_reloc) [SHT_RELA]: Likewise.
9069         * output.cc (Output_reloc::Output_reloc): Add four new versions
9070         for absolute relocs and target specific relocs.
9071         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9072         (Output_reloc::get_symbol_index): Likewise.
9073         (Output_reloc::local_section_offset): Check that local_sym_index_
9074         is not TARGET_CODE or 0.
9075         (Output_reloc::symbol_value): Likewise.
9076         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9077         reloc.
9078         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9079         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9080         functions.
9081         * layout.cc (add_target_dynamic_tags): Use output section for
9082         DT_PLTRELSZ and DT_JMPREL.
9083
9084 2010-01-07  Ian Lance Taylor  <iant@google.com>
9085
9086         PR 11061
9087         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9088         function.
9089         (class Output_data_reloc_generic): Define.
9090         (class Output_data_reloc_base): Change base class to
9091         Output_data_reloc_generic.  Change add() method to call
9092         bump_relative_reloc_count for a relative reloc.  Remove
9093         sort_relocs_ field.
9094         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9095         to sort_relocs().
9096         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9097         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9098         appropriate.
9099         * layout.h (class Layout): Update declaration.
9100
9101 2010-01-07  Ian Lance Taylor  <iant@google.com>
9102
9103         * output.h (class Output_data): Add const version of
9104         output_section and do_output_section.
9105         (class Output_section_data): Add const version of
9106         do_output_section.
9107         (class Output_section): Likewise.
9108         * layout.cc (Layout::add_target_dynamic_tags): New function.
9109         * layout.h (class Layout): Update declarations.
9110         * arm.cc (Target_arm::do_finalize_sections): Use
9111         add_target_dynamic_tags.
9112         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9113         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9114         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9115         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9116
9117 2010-01-07  Ian Lance Taylor  <iant@google.com>
9118
9119         PR 11042
9120         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9121         object as needed.
9122
9123 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9124             Ian Lance Taylor  <iant@google.com>
9125
9126         PR 11019
9127         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9128         Xindex::read_symtab_xindex.
9129
9130 2010-01-07  Doug Kwan  <dougkwan@google.com>
9131
9132         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9133         (Insn_template::thumb16_bcond_insn): New method declaration.
9134         (Insn_template): Fix spelling.
9135         (Stub::thumb16_special): New method declaration.
9136         (Stub::do_write): Define virtual method which was previously pure
9137         virtual.
9138         (Stub::do_thumb16_special): New method declaration.
9139         (Stub::do_fixed_endian_write): New template member.
9140         (Reloc_stub::do_write): Remove.
9141         (Reloc_stub::do_fixed_endian_write): Remove.
9142         (Cortex_a8_stub): New class definition.
9143         (Stub_factory::make_cortex_a8_stub): New method definition.
9144         (Stub_factory::Stub_factory): Add missing static storage class
9145         qualifier for elf32_arm_stub_a8_veneer_blx.
9146
9147 2010-01-07  Ian Lance Taylor  <iant@google.com>
9148
9149         PR 10980
9150         * options.h (class General_options): Add --warn-unresolved-symbols
9151         and --error-unresolved-symbols.
9152         * errors.cc (Errors::undefined_symbol): Implement
9153         --warn-unresolved-symbols.
9154
9155         * options.h (class General_options): Add -z text and -z textoff.
9156         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9157
9158 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9159
9160         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9161         (Garbage_collection::cident_sections): New function.
9162         (Garbage_collection::add_cident_section): New function.
9163         (Garbage_collection::cident_sections_): New member.
9164         (gc_process_relocs): Add references to sections whose names are C
9165         identifiers.
9166         * gold.h (cident_section_start_prefix): New constant.
9167         (cident_section_stop_prefix): New constant.
9168         (is_cident): New function.
9169         * layout.cc (Layout::define_section_symbols): Replace string constants
9170         with the newly defined constants.
9171         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9172         C identifiers.
9173         * testsuite/Makefile.am: Add gc_orphan_section_test.
9174         * testsuite/Makefile.in: Regenerate.
9175         * testsuite/gc_orphan_section_test.cc: New file.
9176         * testsuite/gc_orphan_section_test.sh: New file.
9177
9178 2010-01-06  Ian Lance Taylor  <iant@google.com>
9179
9180         PR 10980
9181         * options.h (class General_options): Add --warn-shared-textrel.
9182         * layout.cc (Layout::finish_dynamic_section): Implement
9183         --warn-shared-textrel.
9184
9185         PR 10980
9186         * options.h (class General_options): Add --warn-multiple-gp.
9187
9188 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9189
9190         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9191         $(THREADSLIB) and $(LIBDL).
9192         * Makefile.in: Rebuild.
9193
9194 2010-01-06  Ian Lance Taylor  <iant@google.com>
9195
9196         PR 10980
9197         * options.cc (General_options::parse_section_start): New function.
9198         (General_options::section_start): New function.
9199         (General_options::General_options): Initialize all members.
9200         * options.h: Include <map>
9201         (class General_options): Add --section-start.  Add section_starts_
9202         member.
9203         * layout.cc (Layout::attach_allocated_section_to_segment): If
9204         --section-start was used, set the address of the segment.  Remove
9205         local sort_sections.
9206         (Layout::relaxation_loop_body): If the address of the load segment
9207         has been set by --section-start, don't use it.
9208         * output.h (Output_segment::update_flags_for_output_section): New
9209         function.
9210         * output.cc (Output_segment::add_output_section): Call
9211         update_flags_for_output_section.
9212
9213 2010-01-05  Ian Lance Taylor  <iant@google.com>
9214
9215         PR 10980
9216         * options.h (class General_options): Add --undefined-version.
9217         * script.cc (struct Version_expression): Add was_matched_by_symbol
9218         field.
9219         (Version_script_info::matched_symbol): New function.
9220         (Version_script_info::get_symbol_version_helper): Call
9221         matched_symbol.
9222         (Version_script_info::check_unmatched_names): New function.
9223         * script.h (class Version_script_info): Update declarations.
9224         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9225
9226         * options.h (class General_options): Use DEFINE_bool_alias for
9227         allow_multiple_definition.
9228         * resolve.cc (Symbol_table::should_override): Don't test
9229         allow_multiple_definition.
9230
9231         PR 10980
9232         * options.h (class General_options): Add --cref.
9233         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9234         until after printing cref table.
9235         * cref.cc: Include "symtab.h".
9236         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9237         (Cref_table_compare::operator()): New function.
9238         (Cref_inputs::gather_cref): New function.
9239         (filecol): New static const.
9240         (Cref_inputs::print_cref): New function.
9241         (Cref::print_cref): New function.
9242         * cref.h: Include <cstdio>.
9243         (class Cref): Update declarations.
9244         * mapfile.h (Mapfile::file): New function.
9245         * object.h (class Object): Define Symbols.  Declare virtual
9246         do_get_global_symbols.
9247         (Object::get_global_symbols): New function.
9248         * object.cc (Input_objects::add_object): Pass object to cref_ if
9249         --cref.
9250         (Input_objects::archive_start): Likewise.
9251         (Input_objects::archive_stop): Likewise.
9252         (Input_objects::print_cref): New function.
9253         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9254         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9255         --cref.
9256         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9257         function.
9258         * plugin.h (class Sized_pluginobj): Update declarations.
9259
9260 2010-01-05  Ian Lance Taylor  <iant@google.com>
9261
9262         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9263         to is_default_version.  Rename insdef to insdefault.
9264         (Symbol_table::add_from_relobj): Rename def to is_default_version
9265         and local to is_forced_local.
9266         (Symbol_table::add_from_pluginobj): Likewise.
9267         (Symbol_table::add_from_dynobj): Likewise.
9268         (Symbol_table::define_special_symbol): Rename insdef to
9269         insdefault.
9270
9271 2010-01-04  Ian Lance Taylor  <iant@google.com>
9272
9273         PR 10980
9274         * options.h (class General_options): Add
9275         --allow-multiple-definition and -z muldefs.
9276         * resolve.cc (Symbol_table::should_override): Don't warn about a
9277         multiple symbol definition if --allow-multiple-definition or -z
9278         muldefs.
9279
9280         PR 10980
9281         * options.h (class General_options): Add --add-needed and
9282         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9283         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9284         error if --copy-dt-needed-entries aka --add-needed is used and
9285         would cause a change in behaviour.
9286
9287         PR 10980
9288         * options.h (class General_options): Add -G as a short version of
9289         --shared.  Add no-op options -assert, -g, and -i.
9290
9291 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9292
9293         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9294         check for .text or .gnu.linkonce.t sections.
9295         * icf.cc (Icf::find_identical_sections): Ditto.
9296         Change the detection for mangled function name within the section
9297         name.
9298         * icf.h (is_section_foldable_candidate): New function.
9299
9300 2009-12-30  Ian Lance Taylor  <iant@google.com>
9301
9302         PR 10980
9303         * options.h (class General_options): Permit two dashes with
9304         --retain-symbols-file.
9305
9306 2009-12-30  Ian Lance Taylor  <iant@google.com>
9307
9308         PR 10979
9309         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9310         don't put the file header and segment headers in the text
9311         segment.
9312
9313         PR 10979
9314         * common.cc (Sort_commons::operator()): Stabilize sort when both
9315         entries are NULL.
9316         (Symbol_table::do_allocate_commons_list): When allocating common
9317         symbols, skip a symbol which is no longer common.
9318         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9319         an object before checking its type.
9320         * testsuite/common_test_2.c: New file.
9321         * testsuite/common_test_3.c: New file.
9322         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9323         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9324         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9325         (common_test_2_pic.o, common_test_2.so): New targets.
9326         (common_test_3_pic.o, common_test_3.so): New targets.
9327         * testsuite/Makefile.in: Rebuild.
9328
9329         PR 10979
9330         * script.cc (read_input_script): If we see a new SECTIONS clause,
9331         and we have added an input section, give an error.
9332         * layout.h (class Layout): Add have_added_input_section function.
9333         Add have_added_input_section_ field.
9334         * layout.cc (Layout::Layout): Initialize
9335         have_added_input_section_.
9336         (Layout::layout): Set have_added_input_section_.
9337         (Layout::layout_eh_frame): Likewise.
9338
9339 2009-12-30  Ian Lance Taylor  <iant@google.com>
9340
9341         PR 10931
9342         * options.h (class General_options): Add --sort-common option.
9343         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9344         * common.cc (Sort_common): Add sort_order parameter to
9345         constructor.  Add sort_order_ field.
9346         (Sort_commons::operator): Check sort_order_.
9347         (Symbol_table::allocate_commons): Determine the sort order.
9348         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9349         Change all callers.
9350         (Symbol_table::do_allocate_commons_list): Likewise.
9351
9352 2009-12-30  Ian Lance Taylor  <iant@google.com>
9353
9354         PR 10916
9355         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9356         symbols from this object, don't change the visibility of an
9357         undefined symbol.
9358         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9359
9360 2009-12-30  Ian Lance Taylor  <iant@google.com>
9361
9362         PR 10861
9363         * script.h (class Version_script_info): Define Language enum.
9364         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9365         new fields globals_, locals_, and is_finalized_.
9366         * script.cc: Various formatting fixes.
9367         (class Parser_closure): Change language_stack_ from a vector of
9368         std::string to one of Version_script_info::Language.  Adjust all
9369         uses accordingly.
9370         (class Lazy_demangler): Remove.
9371         (struct Version_expression): Change language from std::string to
9372         Version_script_info::Language.
9373         (Version_script_info::Version_script_info): New function.
9374         (Version_script_info::~Version_script_info): Don't call clear.
9375         (Version_script_info::finalize): New function.
9376         (Version_script_info::build_lookup_tables): New function.
9377         (Version_script_info::build_expression_list_lookup): New
9378         function.
9379         (Version_script_info::get_symbol_version_helper): Rewrite to use
9380         lookup tables.
9381         (Version_script_info::print_expression_list): Adjust to use
9382         Version_script_info::Language.
9383         (script_push_lex_into_version_mode): Check that the version script
9384         has not been finalized.
9385         (version_script_push_lang): Change language string to
9386         Version_script_info::Language.
9387         * options.cc (Command_line::version_script): New function.
9388         * options.h (class General_options): Add finalize_dynamic_list
9389         function.  Change version_script from declaration to definition.
9390         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9391         * testsuite/version_script.map: Remove duplicate def of foo.
9392         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9393         version_script.map.
9394         * testsuite/Makefile.in: Rebuild.
9395
9396 2009-12-30  Ian Lance Taylor  <iant@google.com>
9397
9398         PR 10843
9399         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9400         if the input symbol index is 0, make the output symbol index 0.
9401
9402 2009-12-30  Ian Lance Taylor  <iant@google.com>
9403
9404         PR 10670
9405         * options.h (class General_options): Add -x/--discard-all.
9406         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9407         --discard-all.  If the local symbol needs a dynamic entry, check
9408         that before handling --discard-locals.
9409
9410 2009-12-30  Ian Lance Taylor  <iant@google.com>
9411
9412         PR 10450
9413         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9414         flags to PF_R.
9415         (Output_segment::add_output_section): Don't change the flags if
9416         the type is PT_TLS.
9417
9418         PR 10450
9419         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9420         GNU hash table if they need a dynamic value.  Otherwise, don't add
9421         them if they are defined in a dynamic object or are forced local.
9422
9423 2009-12-29  Ian Lance Taylor  <iant@google.com>
9424
9425         PR 10450
9426         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9427         .gnu.hash table for a 32-bit target.
9428
9429         PR 10450
9430         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9431         regular and a dynamic object only needs a dynamic symbol table
9432         entry if it is externally visible.
9433
9434         PR 10450
9435         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9436         constructor.  Add global_offset_table_ field.
9437         (Target_i386::got_section): Set global_offset_table_.
9438         (Target_i386::do_finalize_sections): Set global_offset_table_
9439         size.
9440         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9441         in constructor.  Add global_offset_table_ field.
9442         (Target_x86_64::got_section): Set global_offset_table_.
9443         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9444         size.
9445
9446         * layout.cc (Layout::Layout): Initialize increase_relro_.
9447         (Layout::get_output_section): Add is_relro, is_last_relro, and
9448         is_first_non_relro parameters.  Change all callers.
9449         (Layout::choose_output_section): Likewise.
9450         (Layout::add_output_section_data): Likewise.
9451         (Layout::make_output_section): Likewise.
9452         (Layout::set_segment_offsets): Clear increase_relro when using a
9453         linker script.
9454         * layout.h (class Layout): Add increase_relro method.  Add
9455         increase_relro_ field.  Update declarations.
9456         * output.cc (Output_section::Output_section): Initialize
9457         is_last_relro_ and is_first_non_relro_.
9458         (Output_segment::add_output_section): Group relro sections is
9459         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9460         (Output_segment::maximum_alignment): Remove relro handling.
9461         (Output_segment::set_section_addresses): Add increase_relro
9462         parameter.  Change all callers.  Add initial alignment to align
9463         relro sections on separate page.  Remove old relro handling.
9464         (Output_segment::set_section_list_addresses): Remove in_relro
9465         parameter.  Change all callers.
9466         (Output_segment::set_offset): Add increase parameter.  Change all
9467         callers.  Remove old relro handling.
9468         * output.h (class Output_section): Add new methods: is_last_relro,
9469         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9470         Add is_last_relro_ and is_first_non_relro_ fields.
9471         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9472         Create separate .got.plt section.  Call increase_relro.
9473         * x86_64.cc (Target_x86_64::got_section): Likewise.
9474         * testsuite/relro_script_test.t: Add .got.plt.
9475
9476         PR 10450
9477         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9478         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9479         (Layout::finalize): Call set_dynamic_symbol_size.
9480         (Layout::set_dynamic_symbol_size): New function.
9481         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9482         set_dynamic_symbol_size.
9483
9484         PR 10450
9485         * output.h (class Output_section): Add is_entsize_zero_ field.
9486         * output.cc (Output_section::Output_section): Initialize
9487         is_entsize_zero_.
9488         (Output_section::set_entsize): If two different entsizes are
9489         requested, force it to zero.
9490         (Output_section::add_input_section): Set flags for .debug_str
9491         before updating section flags.  Set entsize.
9492         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9493         and SHF_STRING if all input sections have those flags.
9494
9495 2009-12-29   Rafael Espindola  <espindola@google.com>
9496
9497         * main.cc (main): Fix the sys time reporting.
9498         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9499         reporting.
9500
9501 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9502
9503         * options.cc (General_options::parse_version): Allow -v to exit
9504         without an error if there is nothing to link.
9505
9506 2009-12-29  Ian Lance Taylor  <iant@google.com>
9507
9508         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9509         using a version of gcc before 4.1.
9510         * configure: Rebuild.
9511
9512 2009-12-28  Chris Demetriou  <cgd@google.com>
9513
9514         * attributes.cc (Output_attributes_section_data::do_write): Use
9515         std::vector::front rather than std::vector::data.
9516
9517 2009-12-28  Ian Lance Taylor  <iant@google.com>
9518
9519         * symtab.h (class Symbol_table): Add enum Defined.
9520         * resolve.cc (Symbol_table::should_override): Add defined
9521         parameter.  Change all callers.  Test whether object is NULL
9522         before calling a method on it.
9523         (Symbol_table::report_resolve_problem): Add defined parameter.
9524         Change all callers.
9525         (Symbol_table::should_override_with_special): Likewise.
9526         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9527         parameter.  Change all callers.
9528         (Symbol_table::do_define_in_output_data): Likewise.
9529         (Symbol_table::define_in_output_segment): Likewise.
9530         (Symbol_table::do_define_in_output_segment): Likewise.
9531         (Symbol_table::define_as_constant): Likewise.
9532         (Symbol_table::do_define_as_constant): Likewise.
9533         * script.h (class Symbol_assignment): Add is_defsym parameter to
9534         constructor; change all callers.
9535         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9536         parameter.  Change all callers.  Add is_defsym_ field.
9537         (class Parser_closure): Add parsing_defsym parameter to
9538         constructor; change all callers.  Add parsing_defsym accessor
9539         function.  Add parsing_defsym_ field.
9540
9541 2009-12-28  Ian Lance Taylor  <iant@google.com>
9542
9543         * gold.cc (queue_middle_tasks): Fix formatting.
9544         * object.cc (Relobj::is_section_name_included): Likewise.
9545
9546 2009-12-23  Ian Lance Taylor  <iant@google.com>
9547
9548         * i386.cc (Target_i386::do_calls_non_split): Recognize
9549         -fsplit-stack prologue for a function with a static chain.
9550         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9551         -fsplit-stack prologue when using %r11.
9552
9553 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9554
9555         * options.cc (General_options::parse_version): Make -v continue and do
9556         the link like GNU ld does.
9557
9558 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9559
9560         * Makefile.am (CCFILES): Add timer.cc.
9561         (HFILES): Add timer.h.
9562         * configure.ac: Check for sysconf and times.
9563         * main.cc: include timer.h.
9564         (main): Use Timer instead of get_run_time.
9565         * timer.cc: New.
9566         * timer.h: New.
9567         * workqueue.cc: include timer.h.
9568         (Workqueue::find_and_run_task):
9569         Report user, sys and wall time.
9570         * Makefile.in: Regenerate.
9571         * config.in: Regenerate.
9572         * configure: Regenerate.
9573
9574 2009-12-16  Doug Kwan  <dougkwan@google.com>
9575
9576         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9577         sections.
9578         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9579         relaxed input sections.
9580         * output.cc (Output_section::find_relaxed_input_section): Change
9581         return type to Output_relaxed_input_section pointer.  Adjust code
9582         for new type of relaxed_input_section_map_.
9583         * output.h (Output_section::find_relaxed_input_section): Change
9584         return type to Output_relaxed_input_section pointer.
9585         (Output_section::Output_relaxed_input_section_by_input_section_map):
9586         New type.
9587         (Output_section::relaxed_input_section_map_): Change type to
9588         Output_section::Output_relaxed_input_section_by_input_section_map.
9589         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9590         input section.
9591
9592 2009-12-15  Ian Lance Taylor  <iant@google.com>
9593
9594         * layout.cc (Layout::create_shstrtab): Only write out after input
9595         sections if we are compressing debug sections.
9596
9597 2009-12-15  Ian Lance Taylor  <iant@google.com>
9598
9599         * archive.cc (Archive::add_symbols): Only look up a symbol without
9600         a version if there is, in fact, a version.
9601
9602 2009-12-14  Ian Lance Taylor  <iant@google.com>
9603
9604         Revert -Wshadow changes, all changes from:
9605         2009-12-11  Doug Kwan  <dougkwan@google.com>
9606         2009-12-11  Nick Clifton  <nickc@redhat.com>
9607         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9608
9609 2009-12-11  Doug Kwan  <dougkwan@google.com>
9610
9611         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9612         due to -Wshadow.
9613         * attributes.cc (Object_attribute::size): Ditto.
9614         (Attributes_section_data::size): Ditto.
9615         (Attributes_section_data::Attributes_section_data): Ditto.
9616         (Output_attributes_section_data::do_write): Ditto.
9617         * attributes.h (Object_attribute::set_type): Ditto.
9618         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9619
9620 2009-12-11  Nick Clifton  <nickc@redhat.com>
9621
9622         * archive.cc: Fix shadowed variable warnings.
9623         * arm.cc: Likewise.
9624         * compressed_output.cc: Likewise.
9625         * compressed_output.h: Likewise.
9626         * configure: Likewise.
9627         * dwarf_reader.cc: Likewise.
9628         * dynobj.cc: Likewise.
9629         * dynobj.h: Likewise.
9630         * ehframe.cc: Likewise.
9631         * ehframe.h: Likewise.
9632         * errors.cc: Likewise.
9633         * expression.cc: Likewise.
9634         * fileread.cc: Likewise.
9635         * fileread.h: Likewise.
9636         * freebsd.h: Likewise.
9637         * i386.cc: Likewise.
9638         * icf.cc: Likewise.
9639         * incremental.h: Likewise.
9640         * layout.cc: Likewise.
9641         * layout.h: Likewise.
9642         * mapfile.cc: Likewise.
9643         * merge.cc: Likewise.
9644         * merge.h: Likewise.
9645         * object.cc: Likewise.
9646         * object.h: Likewise.
9647         * options.h: Likewise.
9648         * output.cc: Likewise.
9649         * output.h: Likewise.
9650         * parameters.cc: Likewise.
9651         * plugin.cc: Likewise.
9652         * powerpc.cc: Likewise.
9653         * reduced_debug_output.cc: Likewise.
9654         * reduced_debug_output.h: Likewise.
9655         * reloc.cc: Likewise.
9656         * reloc.h: Likewise.
9657         * resolve.cc: Likewise.
9658         * script-sections.cc: Likewise.
9659         * script.cc: Likewise.
9660         * script.h: Likewise.
9661         * sparc.cc: Likewise.
9662         * symtab.cc: Likewise.
9663         * symtab.h: Likewise.
9664         * target-select.cc: Likewise.
9665         * target-select.h: Likewise.
9666         * token.h: Likewise.
9667         * workqueue.cc: Likewise.
9668         * workqueue.h: Likewise.
9669         * x86_64.cc: Likewise.
9670
9671 2009-12-10  Doug Kwan  <dougkwan@google.com>
9672
9673         * arm.cc (attributes.h): New include.
9674         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9675         (Arm_relobj::~Arm_relobj): Delete object pointed by
9676         attributes_section_data_.
9677         (Arm_relobj::attributes_section_data): New method definition.
9678         (Arm_relobj::attributes_section_data_): New data member declaration.
9679         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9680         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9681         attributes_section_data_.
9682         (Arm_dynobj::attributes_section_data): New method definition.
9683         (Arm_dynobj::attributes_section_data_): New data member declaration.
9684         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9685         initialization value of may_use_blx_ to false.
9686         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9687         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9688         object attributes to compute results instead of hard-coding.
9689         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9690         Target_arm::get_secondary_compatible_arch,
9691         Target_arm::set_secondary_compatible_arch
9692         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9693         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9694         New method declarations.
9695         (Target_arm::get_aeabi_object_attribute): New method definition.
9696         (Target_arm::attributes_section_data_): New data member declaration.
9697         (read_arm_attributes_section): New template definition.
9698         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9699         (Arm_dynobj::do_read_symbols): Ditto.
9700         (Target_arm::do_finalize_sections): Merge attributes sections from
9701         input.  Check for BLX use after attributes section merging.
9702         Fix __exidx_start and __exidx_end visibility.  Create an
9703         .ARM.attributes section if necessary.
9704         (Target_arm::get_secondary_compatible_arch,
9705         Target_arm::set_secondary_compatible_arch,
9706         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9707         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9708         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9709         New method definitions.
9710
9711 2009-12-09  Ian Lance Taylor  <iant@google.com>
9712
9713         * plugin.cc (Plugin::load): Don't cast from void* to a function
9714         pointer.
9715
9716 2009-12-09  Ian Lance Taylor  <iant@google.com>
9717
9718         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9719         information fields.
9720
9721 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9722
9723         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9724         Replace two_file_shared_1.so with two_file_shared_2.so.
9725         * testsuite/Makefile.in: Regenerated.
9726
9727 2009-12-08  Doug Kwan  <dougkwan@google.com>
9728
9729         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9730         (HFILES): Add attributes.h and int_encoding.h.
9731         * Makefile.in: Regenerate.
9732         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9733         function definitions to int_encoding.cc
9734         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9735         prototypes to int_encoding.h
9736         * reduced_debug_output.cc (int_encoding.h): New include.
9737         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9738         function definitions to int_encoding.cc
9739         (insert_into_vector, read_from_pointer): Move template definitions to
9740         int_encoding.h
9741         * attributes.cc: New file.
9742         * attributes.h: New file.
9743         * int_encoding.cc: New file.
9744         * int_encoding.h: New file.
9745
9746 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9747
9748         PR gold/11055
9749         * incremental-dump.cc (dump_incremental_inputs): New.
9750         (main): Use dump_incremental_inputs.
9751
9752 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9753
9754         PR gold/10893
9755         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9756         checking elfcpp::STT_FUNC.
9757         (Target_i386::Relocate::relocate): Likewise.
9758         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9759
9760         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9761         symbols from shared libraries into normal FUNC symbols.
9762
9763         * symtab.h (Symbol): Add is_func and use it.
9764
9765 2009-12-05  Doug Kwan  <dougkwan@google.com>
9766
9767         * arm.cc (Target_arm::arm_info): Initialize new fields
9768         attributes_section and attributes_vendor.
9769         * i386.cc (Target_i386::i386_info): Same.
9770         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9771         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9772         fields attributes_section and attributes_vendor.
9773         * sparc.cc (Target_sparc::sparc_info): Same.
9774         * target.h (Target::attributes_section, Target::attributes_vendor,
9775         Target::is_attributes_section, Target::attribute_arg_type,
9776         Target::attributes_order): New method definitions.
9777         (Target::Target_info::attributes_section,
9778         Target::Target_info::attributes_vendor): New fields.
9779         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9780         virtual method definitions.
9781         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9782         attributes_section and attributes_vendor.
9783         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9784
9785 2009-12-05  Doug Kwan  <dougkwan@google.com>
9786
9787         * arm.cc: Update comments about interworking and stub generation.
9788         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9789         considered as non-PIC.
9790         (Arm_relocate_functions::base_abs): Fix formatting.
9791         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9792         of function to use GOT entry address instead of offset.
9793         (Target_arm::Scan::global): Issue an error if a symbol would need a
9794         PLT does not get one because it is untyped.  Remove code to create
9795         dynamic symbols for relative branches.
9796         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9797         takes unsigned integer instead of boolean.
9798
9799 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9800
9801         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9802         (two_file_test_LDADD): Likewise.
9803         (common_test_1_LDADD): Likewise.
9804         (exception_test_LDADD) Likewise.
9805         (weak_test_LDADD): Likewise.
9806         (many_sections_test_LDADD): Likewise.
9807         (initpri1_LDADD): Likewise.
9808         (script_test_1_LDADD): Likewise.
9809         (script_test_2_LDADD): Likewise.
9810         (justsyms_LDADD): Likewise.
9811         (binary_test_LDADD): Likewise.
9812         (large_LDADD): Likewise.
9813         * testsuite/Makefile.in: Regenerated.
9814
9815 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9816
9817         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9818         (Symbol_table::override_with_special): Likewise.
9819         (Symbol_table::add_from_object): Likewise.
9820
9821 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9822
9823         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9824         Don't set the data_offset twice.
9825
9826 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9827
9828         * testsuite/Makefile.in: Regenerate.
9829
9830 2009-12-03  Doug Kwan  <dougkwan@google.com>
9831
9832         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9833         (Target_arm::do_finalize_sections): Add parameter for symbol table
9834         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9835         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9836         parameter for symbol table pointer.
9837         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9838         an additional parameter for a pointer to symbol table.
9839         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9840         parameter for a symbol table pointer.
9841         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9842         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9843         Ditto.
9844         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9845         parameter for a symbol table pointer.
9846
9847 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9848
9849         * incremental.cc (Incremental_inputs_header)
9850         (Incremental_inputs_header_write, Incremental_inputs_entry)
9851         (Incremental_inputs_entry_write): Move ...
9852         * incremental.h (Incremental_inputs_header)
9853         (Incremental_inputs_header_write, Incremental_inputs_entry)
9854         (Incremental_inputs_entry_write): here.
9855
9856 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9857
9858         * incremental.cc (make_sized_incremental_binary): Set the target.
9859         Error if it is incompatible.
9860         * output.h (Output_file): Add filename method.
9861
9862 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9863
9864         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9865         from the get_* methods.
9866
9867 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9868
9869         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9870         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9871         Write 0 for the data_offset of scripts.
9872
9873 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9874
9875         * testsuite/Makefile.am: Add the incremental_test.sh test.
9876         * testsuite/incremental_test.sh: New.
9877         * testsuite/incremental_test_1.c: New.
9878         * testsuite/incremental_test_2.c: New.
9879
9880 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9881
9882         * incremental-dump.cc (main): Fix typos.
9883
9884 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9885
9886         PR gold/11025
9887         * incremental-dump.cc (main): Use llu to print 64 bit values.
9888
9889 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9890             H.J. Lu  <hongjiu.lu@intel.com>
9891
9892         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9893         $(LIBDL).
9894         (incremental_dump_LDADD): Likewise.
9895         * Makefile.in: Regenerated.
9896
9897 2009-11-25  Doug Kwan  <dougkwan@google.com>
9898
9899         Revert:
9900
9901         2009-11-25  Doug Kwan  <dougkwan@google.com>
9902
9903                 * arm.cc (Target_arm::Target_arm): Move method definition
9904                 outside of class definition.  Add code to handle
9905                 --target1-rel, --target1-abs and --target2= options.
9906                 (Target_arm::get_reloc_reloc_type): Change method to be
9907                 non-static and const.
9908                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9909                 New data member declaration.
9910                 (Target_arm::Scan::local, Target_arm::Scan::global,
9911                 Target_arm::Relocate::relocate,
9912                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9913                 Adjust call to Target_arm::get_real_reloc_type.
9914                 (Target_arm::get_real_reloc_type): Use command line options
9915                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9916                 * options.h (--target1-rel, --target1-abs, --target2): New
9917                 ARM-only options.
9918
9919 2009-11-25  Doug Kwan  <dougkwan@google.com>
9920
9921         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9922         class definition.  Add code to handle --target1-rel, --target1-abs
9923         and --target2= options.
9924         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9925         and const.
9926         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9927         member declaration.
9928         (Target_arm::Scan::local, Target_arm::Scan::global,
9929         Target_arm::Relocate::relocate,
9930         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9931         call to Target_arm::get_real_reloc_type.
9932         (Target_arm::get_real_reloc_type): Use command line options to
9933         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9934         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9935         options.
9936
9937 2009-11-25  Doug Kwan  <dougkwan@google.com>
9938
9939         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9940         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9941         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9942         formatting.
9943         (Arm_relocate_functions::thm_call): Replace body with a call to
9944         Arm_relocate_functions::thumb_branch_common.
9945         (Arm_relocate_functions::thm_jump24,
9946         Arm_relocate_functions::thm_xpc22): New method definitions.
9947         (Arm_relocate_functions::thumb_branch_common): New method definition.
9948         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9949         operator.
9950         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9951         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9952
9953 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9954
9955         * Makefile.am: Build incremental-dump
9956         * Makefile.in: Regenerate.
9957         * incremental-dump.cc: New.
9958         * incremental.cc (Incremental_inputs_header_data,
9959         Incremental_inputs_entry_data): Move to incremental.h
9960         * incremental.h: (Incremental_inputs_header_data,
9961         Incremental_inputs_entry_data): Move from incremental.cc
9962
9963 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9964
9965         * incremental.cc (Incremental_inputs_header,
9966         Incremental_inputs_header_write, Incremental_inputs_entry,
9967         Incremental_inputs_entry_write): Add a typedef with the data type.
9968
9969 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9970
9971         * incremental.cc (Incremental_inputs_header,
9972         Incremental_inputs_header_write, Incremental_inputs_entry,
9973         Incremental_inputs_entry_write): Update comment about which
9974         type has the filed descriptions.
9975
9976 2009-11-15  Doug Kwan  <dougkwan@google.com>
9977
9978         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9979         (Arm_relocate_functions::arm_branch_common): Change method defintion
9980         in class definition to a method declaration and update list of formal
9981         parameters.
9982         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9983         Arm_relocation_functions::jump24): Adjust call to
9984         Arm_relocate_functions::arm_branch_common.  Update list of formal
9985         parameters.
9986         (Arm_relocate_functions::xpc25): New method definition.
9987         (Arm_relocate_functions::arm_branch_common): Move method defintion
9988         out from class definition.  Use stubs for mode-switching and extending
9989         branch ranges.
9990         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9991         specially.  Change code to enable use of stubs in ARM branches.
9992
9993 2009-11-10  Doug Kwan  <dougkwan@google.com>
9994
9995         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9996         in method declaration.
9997         (Target_arm::relocate_stub): New method declaration.
9998         (Target_arm::default_target): Change to return a pointer instead of
9999         a const reference.
10000         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10001         Target_arm::default_target.
10002         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10003         method definition.
10004         (Target_arm::relocate_section): Adjust view.
10005         (Target_arm::relocate_stub): New method definition.
10006
10007 2009-11-10  Doug Kwan  <dougkwan@google.com>
10008
10009         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10010         a format warning.
10011         * incremental.cc (open_incremental_binary): Initialized local
10012         variables to avoid warnings.
10013         * object.cc (make_elf_object): Ditto.
10014         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10015         a format warning.
10016
10017 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10018
10019         PR gold/10930
10020         * testsuite/plugin_test.c: Include "config.h".
10021
10022 2009-11-09  Doug Kwan  <dougkwan@google.com>
10023
10024         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10025         (arm_symbol_value): Remove.
10026         (Arm_relocate_functions::arm_branch_common,
10027         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10028         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10029         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10030         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10031         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10032         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10033         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10034         Arm_relocate_functions::thm_mobw_abs_nc,
10035         Arm_relocate_functions::thm_mov_abs,
10036         Arm_relocate_functions::movw_prel_nc,
10037         Arm_relocate_functions::thm_movt_abs,
10038         Arm_relocate_functions::movt_prel,
10039         Arm_relocate_functions::thm_movw_prel_nc,
10040         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10041         (Target_arm::Relocate::relocate): Only decompose address into two
10042         parts if relocation type uses the thumb-bit and pass the actual
10043         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10044         calls to methods in Arm_relocate_functions for this change.
10045
10046 2009-11-08  Ian Lance Taylor  <iant@google.com>
10047
10048         PR 10925
10049         * reloc.cc: Instantiate
10050         Sized_relobj::initialize_input_to_output_maps and
10051         Sized_relobj:free_input_to_output_maps.
10052
10053 2009-11-06  Ian Lance Taylor  <iant@google.com>
10054
10055         PR 10876
10056         * defstd.cc (in_segment): Set only_if_ref true for "end".
10057
10058 2009-11-06  Doug Kwan  <dougkwan@google.com>
10059
10060         * arm.cc (class Reloc_stub): Correct a comment.
10061         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10062         (Target_arm::scan_section_for_stubs): New method declaration.
10063         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10064         Change methods from private to protected.
10065         (Target_arm::do_may_relax): New method definition.
10066         (Target_arm::do_relax, Target_arm::group_sections,
10067         Target_arm::scan_reloc_for_stub,
10068         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10069         (Target_arm::arm_input_section_map_): New data member declaration.
10070         (Target_arm::scan_reloc_for_stub,
10071         Target_arm::scan_reloc_section_for_stubs,
10072         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10073         Target_arm::do_relax): New method definitions.
10074
10075 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10076
10077         * configure.ac: Check for (struct stat)::st_mtim
10078         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10079         * config.in: Regenerate.
10080         * configure: Regenerate.
10081
10082 2009-11-05  Ian Lance Taylor  <iant@google.com>
10083
10084         PR 10910
10085         * output.cc (Output_segment::add_output_section): Add missing
10086         return statement.
10087
10088 2009-11-04  Ian Lance Taylor  <iant@google.com>
10089
10090         PR 10880
10091         * object.h (class Object): Add is_needed and set_is_needed
10092         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10093         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10094         defined in a dynamic object and referenced by a regular object,
10095         set is_needed for the dynamic object.
10096         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10097         if the file is marked with as_needed and it is not needed.
10098
10099 2009-11-04  Ian Lance Taylor  <iant@google.com>
10100
10101         PR 10887
10102         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10103         tags if data is discarded by linker script.
10104         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10105         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10106         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10107         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10108
10109 2009-11-04  Ian Lance Taylor  <iant@google.com>
10110
10111         * layout.cc (Layout::get_output_section): Add is_interp and
10112         is_dynamic_linker_section parameters.  Change all callers.
10113         (Layout::choose_output_section): Likewise.
10114         (Layout::make_output_section): Likewise.
10115         (Layout::add_output_section_data): Add is_dynamic_linker_section
10116         parameter.  Change all callers.
10117         * layout.h (class Layout): Update declarations.
10118         * output.h (class Output_section): Add is_interp, set_is_interp,
10119         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10120         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10121         generate_code_fills_at_write_ to a bitfield.
10122         * output.cc (Output_section::Output_sections): Initialize new
10123         fields.
10124         (Output_segment::add_output_section): Add do_sort parameter.
10125         Change all callers.
10126
10127 2009-11-03  Ian Lance Taylor  <iant@google.com>
10128
10129         PR 10860
10130         * options.h (class General_options): Add --warn-common.
10131         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10132         merging two common symbols.
10133         (Symbol_table::should_override): Handle --warn-common when merging
10134         a common symbol with a defined symbol.  Use report_resolve_problem
10135         for multiple definitions.
10136         (Symbol_table::report_resolve_problem): New function.
10137         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10138
10139 2009-11-03  Doug Kwan  <dougkwan@google.com>
10140
10141         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10142         stub_factory_.
10143         (Target_arm::stub_factory): New method definition.
10144         (Target_arm::new_arm_input_section,
10145         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10146         Target_arm::reloc_uses_thumb_bit): New method declarations.
10147         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10148         New type definitions.
10149         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10150         member declarations.
10151         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10152         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10153         New method definitions.
10154
10155 2009-11-03  Ian Lance Taylor  <iant@google.com>
10156
10157         * options.h (class General_options): Add --warn_constructors.
10158
10159 2009-11-03  Ian Lance Taylor  <iant@google.com>
10160
10161         PR 10893
10162         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10163         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10164
10165 2009-11-03  Ian Lance Taylor  <iant@google.com>
10166
10167         PR 10895
10168         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10169         --msgid-bugs-address.
10170         (install-pdf): New target.
10171         (install-data_yes): Look up one directory to find mkinstalldirs.
10172
10173 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10174
10175         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10176         tree.
10177
10178 2009-10-30  Doug Kwan  <dougkwan@google.com>
10179
10180         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10181
10182 2009-10-30  Doug Kwan  <dougkwan@google.com>
10183
10184         * arm.cc (Stub_addend_reader): New struct template definition
10185         and partial specializations.
10186         (Stub_addend_reader::operator()): New method definition for a
10187         partially specialized template.
10188
10189 2009-10-30  Doug Kwan  <dougkwan@google.com>
10190
10191         * arm.cc (Arm_relobj::processor_specific_flags): New method
10192         definition.
10193         (Arm_relobj::do_read_symbols): New method declaration.
10194         (Arm_relobj::processor_specific_flags_): New data member declaration.
10195         (Arm_dynobj): New class definition.
10196         (Target_arm::do_finalize_sections): Add input_objects parameter.
10197         (Target_arm::do_adjust_elf_header): New method declaration.
10198         (Target_arm::are_eabi_versions_compatible,
10199         (Target_arm::merge_processor_specific_flags): New method declaration.
10200         (Target_arm::do_make_elf_object): New overloaded method definitions
10201         and declaration.
10202         (Arm_relobj::do_read_symbols): New method definition.
10203         (Arm_dynobj::do_read_symbols): Ditto.
10204         (Target_arm::do_finalize_sections): Add input_objects parameters.
10205         Merge processor-specific flags from all input objects.
10206         (Target_arm::are_eabi_versions_compatible,
10207         Target_arm::merge_processor_specific_flags,
10208         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10209         New method definitions.
10210         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10211         Input_objects pointer type parameter.
10212         * layout.cc (Layout::finalize): Pass input objects to target's.
10213         finalize_sections function.
10214         * output.cc (Output_file_header::do_sized_write): Set ELF file
10215         header's processor-specific flags.
10216         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10217         Input_objects pointer type parameter.
10218         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10219         * target.h (Input_objects): New forward class declaration.
10220         (Target::processor_specific_flags,
10221         Target::are_processor_specific_flags_sect): New method definitions.
10222         (Target::finalize_sections): Add input_objects parameter.
10223         (Target::Target): Initialize processor_specific_flags_ and
10224         are_processor_specific_flags_set_.
10225         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10226         parameter.
10227         (Target::set_processor_specific_flags): New method definition.
10228         (Target::processor_specific_flags_,
10229         Target::are_processor_specific_flags_set_): New data member
10230         declarations.
10231         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10232         Input_objects pointer type parameter.
10233
10234 2009-10-30  Doug Kwan  <dougkwan@google.com>
10235
10236         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10237
10238 2009-10-28  Ian Lance Taylor  <iant@google.com>
10239
10240         * object.h (class Relobj): Drop options parameter from
10241         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10242         do_scan_relocs, do_relocate.  Change all callers.
10243         (class Sized_relobj): Drop options parameters from
10244         do_gc_process_relocs, do_scan_relocs, do_relocate,
10245         do_relocate_sections, relocate_sections, emit_relocs_scan,
10246         emit_relocs_scan_reltype.  Change all callers.
10247         (struct Relocate_info): Remove options field and all references to
10248         it.
10249         * reloc.h (class Read_relocs): Remove options constructor
10250         parameter and options_ field.  Change all callers.
10251         (class Gc_process_relocs, class Scan_relocs): Likewise.
10252         (class Relocate_task): Likewise.
10253         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10254         all callers.
10255         (scan_relocatable_relocs): Likewise.
10256         * target.h (class Sized_target): Remove options parameter from
10257         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10258         all callers.
10259         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10260         callers.
10261         * arm.cc: Update functions to remove options parameters.
10262         * i386.cc: Likewise.
10263         * powerpc.cc: Likewise.
10264         * sparc.cc: Likewise.
10265         * x86_64.cc: Likewise.
10266         * testsuite/testfile.cc: Likewise.
10267
10268 2009-10-28  Doug Kwan  <dougkwan@google.com>
10269
10270         * arm.cc (Arm_relobj): New class definition.
10271         (Arm_relobj::scan_sections_for_stubs,
10272         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10273         New method definitions.
10274
10275 2009-10-28  Cary Coutant  <ccoutant@google.com>
10276
10277         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10278         (Plugin::cleanup_done_): New member.
10279         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10280         (Plugin_manager::cleanup_done_): Remove.
10281         (Plugin_manager::add_input_file): Edit error message.
10282         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10283         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10284
10285 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10286
10287         * fileread.cc: (File_read::View::~View): Use the new
10288         data_ownership_ filed.
10289         (File_read::~File_read): Dispose the new whole_file_view_.
10290         (File_read::open): Mmap the whole file if needed.
10291         (File_read::open): Use whole_file_view_ instead of contents_.
10292         (File_read::find_view): Use whole_file_view_ if applicable.
10293         (File_read::do_read): Use whole_file_view_ instead of contents_.
10294         (File_read::make_view): Use whole_file_view_ instead of contents_,
10295         update File_read::View::View call.
10296         (File_read::find_or_make_view): Update File_read::View::View
10297         call.
10298         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10299         remove contents_
10300         (File_read::View::Data_ownership): New enum.
10301         (File_read::View::View): Replace bool mapped_ with Data_ownership
10302         argument.
10303         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10304         (File_read::View::data_ownership_): New field.
10305         (File_read::contents_): Remove (replaced by whole_file_view_).
10306         (File_read::whole_file_view_): New field.
10307         * options.h (class General_options): Add --keep-files-mapped.
10308
10309 2009-10-27  Cary Coutant  <ccoutant@google.com>
10310
10311         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10312         * testsuite/Makefile.am (plugin_test_5): New test case.
10313         * testsuite/Makefile.in: Regenerate.
10314
10315 2009-10-25  Doug Kwan  <dougkwan@google.com>
10316
10317         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10318         from private to protected to allow access by child class.
10319         (Sized_relobj::do_relocate_sections): New method declaration.
10320         (Sized_relobj::relocate_sections): Virtualize.
10321         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10322         Sized_relobj::relocate_sections.  Instantiate template explicitly
10323         for different target sizes and endianity.
10324
10325 2009-10-24  Doug Kwan  <dougkwan@google.com>
10326
10327         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10328         (Arm_input_section::as_arm_input_section): New method.
10329         (Arm_output_section): New class definition.
10330         (Arm_output_section::create_stub_group,
10331         Arm_output_section::group_sections): New method definitions.
10332
10333 2009-10-22  Doug Kwan  <dougkwan@google.com>
10334
10335         * arm.cc (Arm_input_section): New class definition.
10336         (Arm_input_section::init, Arm_input_section:do_write,
10337         Arm_input_section::set_final_data_size,
10338         Arm_input_section::do_reset_address_and_file_offset): New method
10339         definitions.
10340
10341 2009-10-21  Doug Kwan  <dougkwan@google.com>
10342
10343         * arm.cc (Stub_table, Arm_input_section): New forward class
10344         declarations.
10345         (Stub_table): New class defintion.
10346         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10347         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10348         New method definition.
10349
10350 2009-10-21  Doug Kwan  <dougkwan@google.com>
10351
10352         * arm.cc: Update copyright comments.
10353         (Target_arm): New forward class template declaration.
10354         (Arm_address): New type.
10355         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10356         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10357         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10358         constants.
10359         (Insn_template): Same.
10360         (DEF_STUBS): New macro.
10361         (Stub_type): New enum type.
10362         (Stub_template): New class definition.
10363         (Stub): Same.
10364         (Reloc_stub): Same.
10365         (Stub_factory): Same.
10366         (Target_arm::Target_arm): Initialize may_use_blx_ and
10367         should_force_pic_veneer_.
10368         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10369         Target_arm::should_force_pic_veneer,
10370         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10371         Target_arm::using_thumb_only, Target_arm:;default_target): New
10372         method defintions.
10373         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10374         New data member declarations.
10375         (Insn_template::size, Insn_template::alignment): New method defintions.
10376         (Stub_template::Stub_template): New method definition.
10377         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10378         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10379         (Stub_factory::Stub_factory): New method definition.
10380         * gold.h (string_hash): New template.
10381         * output.h (Input_section_specifier::hash_value): Use
10382         gold::string_hash.
10383         (Input_section_specifier::string_hash): Remove.
10384         * stringpool.cc (Stringpool_template::string_hash): Use
10385         gold::string_hash.
10386
10387 2009-10-20  Doug Kwan  <dougkwan@google.com>
10388
10389         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10390         symbols of relaxed input sections.
10391         * output.h (Output_section::find_relaxed_input_section): Make
10392         method public.
10393
10394 2009-10-16  Doug Kwan  <dougkwan@google.com>
10395
10396         * dynobj.cc (Versions::Versions): Initialize version_script_.
10397         Only insert base version symbol definition for a shared object
10398         if version script defines any version versions.
10399         (Versions::define_base_version): New method definition.
10400         (Versions::add_def): Check that base version is not needed.
10401         (Versions::add_need): Define base version lazily.
10402         * dynobj.h (Versions::define_base_version): New method declaration.
10403         (Versions::needs_base_version_): New data member declaration.
10404         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10405         (check_DATA): Add no_version_test.stdout.
10406         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10407         New make rules.
10408         * testsuite/Makefile.in: Regenerate.
10409         * testsuite/no_version_test.c: New file.
10410         * testsuite/no_version_test.sh: Ditto.
10411
10412 2009-10-16  Doug Kwan  <dougkwan@google.com>
10413
10414         * expression.cc (class Segment_start_expression): New class definition.
10415         (Segment_start_expression::value): New method definition.
10416         (script_exp_function_segment_start): Return a new
10417         Segment_start_expression.
10418         * gold/script-c.h (script_saw_segment_start_expression): New function
10419         prototype.
10420         * script-sections.cc (Script_sections::Script_sections): Initialize
10421         SAW_SEGMENT_START_EXPRESSION_ to false.
10422         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10423         and -Tbbs options to specify section addresses if given in
10424         command line and no SEGMENT_START expression is seen in a script.
10425         * script-sections.h (Script_sections::saw_segment_start_expression,
10426         Script_sections::set_saw_segment_start_expression): New method
10427         definition.
10428         (Script_sections::saw_segment_start_expression_): New data member
10429         declaration.
10430         * script.cc (script_saw_segment_start_expression): New function.
10431         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10432         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10433         script_test_7.sh and script_test_8.sh.
10434         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10435         script_test_8.stdout.
10436         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10437         (script_test_6, script_test_6.stdout, script_test_7,
10438         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10439         * Makefile.in: Regenerate.
10440         * testsuite/script_test_6.sh: New file.
10441         * testsuite/script_test_6.t: Same.
10442         * testsuite/script_test_7.sh: Same.
10443         * testsuite/script_test_7.t: Same.
10444         * testsuite/script_test_8.sh: Same.
10445
10446 2009-10-16  Doug Kwan  <dougkwan@google.com>
10447
10448         * output.cc (Output_segment::set_section_list_address): Cast
10449         expressions to unsigned long long type to avoid format warnings.
10450
10451 2009-10-15  Ian Lance Taylor  <iant@google.com>
10452
10453         * script.cc (Script_options::add_symbol_assignment): Always add a
10454         dot assignment to script_sections_.
10455         * script-sections.cc (Script_sections::add_dot_assignment):
10456         Initialize if necessary.
10457
10458         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10459         program headers with no load segment if there is a linker script.
10460
10461         * layout.cc (Layout::set_segment_offsets): Align the file offset
10462         to the segment aligment for -N or -n with no load segment.
10463         * output.cc (Output_segment::add_output_section): Don't crash if
10464         the first section is a TLS section.
10465         (Output_segment::set_section_list_addresses): Print an error
10466         message if the address moves backward in a linker script.
10467         * script-sections.cc
10468         (Output_section_element_input::set_section_addresses): Don't
10469         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10470         (Orphan_output_section::set_section_addresses): Likewise.
10471
10472 2009-10-15  Doug Kwan  <dougkwan@google.com>
10473
10474         * layout.cc (Layout::finish_dynamic_section): Generate tags
10475         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10476         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10477         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10478
10479 2009-10-14  Ian Lance Taylor  <iant@google.com>
10480
10481         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10482         fields.
10483         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10484         data_shdr fields of relinfo.
10485         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10486         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10487         R_386_TLS_LDO_32, adjust based on section flags.
10488         (Target_i386::Relocate::fix_up_ldo): Remove.
10489
10490 2009-10-13  Ian Lance Taylor  <iant@google.com>
10491
10492         Add support for -pie.
10493         * options.h (class General_options): Add -pie and
10494         --pic-executable.
10495         (General_options::output_is_position_independent): Test -pie.
10496         (General_options::output_is_executable): Return true if not shared
10497         and not relocatable.
10498         (General_options::output_is_pie): Remove.
10499         * options.cc (General_options::finalize): Reject incompatible uses
10500         of -pie.
10501         * gold.cc (queue_middle_tasks): A -pie link is not static.
10502         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10503         * symtab.cc (Symbol::final_value_is_known): Return false if
10504         output_is_position_independent.
10505         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10506         output_is_position_independent.
10507         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10508         output_is_position_independent.
10509         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10510         output_is_position_independent.
10511         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10512         two_file_pie_test.
10513         (basic_pie_test.o, basic_pie_test): New targets.
10514         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10515         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10516         (two_file_pie_test): New target.
10517         * testsuite/Makefile.in: Rebuild.
10518         * README: Remove note saying that -pie is not supported.
10519
10520 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10521
10522         * options.h (class General_options): Add -init and -fini.
10523         * layout.cc (Layout::finish_dynamic_section): Emit
10524         given init and fini functions.
10525
10526 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10527
10528         * gc.h (gc_process_relocs): Check if icf is enabled using new
10529         function.
10530         * gold.cc (queue_initial_tasks): Likewise.
10531         (queue_middle_tasks): Likewise.
10532         * object.cc (do_layout): Likewise.
10533         * symtab.cc (is_section_folded): Likewise.
10534         * main.cc (main): Likewise.
10535         * reloc.cc (Read_relocs::run): Likewise.
10536         (Sized_relobj::do_scan_relocs): Likewise.
10537         * icf.cc (is_function_ctor_or_dtor): New function.
10538         (Icf::find_identical_sections): Check if function is ctor or dtor when
10539         safe icf is chosen.
10540         * options.h (General_options::icf): Change option to be an enum.
10541         (Icf_status): New enum.
10542         (icf_enabled): New method.
10543         (icf_safe_folding): New method.
10544         (set_icf_status): New method.
10545         (icf_status_): New variable.
10546         * (options.cc) (General_options::finalize): Set icf_status_.
10547         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10548         icf_test and icf_keep_unique_test to use the --icf enum flag.
10549         * testsuite/icf_safe_test.sh: New file.
10550         * testsuite/icf_safe_test.cc: New file.
10551
10552 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10553
10554         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10555         includes to gc.h and icf.h.
10556         * arm.cc: Include gc.h.
10557         * gold.cc: Likewise.
10558         * i386.cc: Likewise.
10559         * powerpc.cc: Likewise.
10560         * sparc.cc: Likewise.
10561         * x86_64.cc: Likewise.
10562         * gc.h: Include icf.h.
10563
10564 2009-10-11  Ian Lance Taylor  <iant@google.com>
10565
10566         * plugin.cc: Include "gold.h" before other header files.
10567
10568 2009-10-10  Chris Demetriou  <cgd@google.com>
10569
10570         * options.h (Input_file_argument::Input_file_type): New enum.
10571         (Input_file_argument::is_lib_): Replace with...
10572         (Input_file_argument::type_): New member.
10573         (Input_file_argument::Input_file_argument): Take Input_file_type
10574         'type' rather than boolean 'is_lib' as second argument.
10575         (Input_file_argument::is_lib): Use type_.
10576         (Input_file_argument::is_searched_file): New function.
10577         (Input_file_argument::may_need_search): Handle is_searched_file.
10578         * options.cc (General_options::parse_library): Support -l:filename.
10579         (General_options::parse_just_symbols): Update for Input_file_argument
10580         changes.
10581         (Command_line::process): Likewise.
10582         * archive.cc (Archive::get_file_and_offset): Likewise.
10583         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10584         * script.cc (read_script_file, script_add_file): Likewise.
10585         * fileread.cc (Input_file::Input_file): Likewise.
10586         (Input_file::will_search_for): Handle is_searched_file.
10587         (Input_file::open): Likewise.
10588         * readsyms.cc (Read_symbols::get_name): Likewise.
10589         * testsuite/Makefile.am (searched_file_test): New test.
10590         * testsuite/Makefile.in: Regenerate.
10591         * testsuite/searched_file_test.cc: New file.
10592         * testsuite/searched_file_test_lib.cc: New file.
10593
10594 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10595             Ian Lance Taylor  <iant@google.com>
10596
10597         * descriptor.cc: Include <cstdio> and "binary-io.h".
10598         (Descriptors::open): Open the files in binary mode always.
10599         * script.cc (Lex::get_token): Treat \r as whitespace.
10600
10601 2009-10-09  Ian Lance Taylor  <iant@google.com>
10602
10603         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10604
10605 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10606             Ian Lance Taylor  <iant@google.com>
10607
10608         * configure.ac: Check for readv function also.
10609         * fileread.cc (readv): Define if not HAVE_READV.
10610         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10611         does not exist.
10612         * config.in: Regenerate.
10613         * configure: Regenerate.
10614
10615 2009-10-09  Doug Kwan  <dougkwan@google.com>
10616
10617         * layout.cc (Layout::make_output_section): Call target hook to make
10618         ordinary output section.
10619         (Layout::finalize): Adjust parameter list of call the
10620         Target::may_relax().
10621         * layout.h (class Layout::section_list): New method.
10622         * merge.h (Output_merge_base::entsize): Change visibility to public.
10623         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10624         New methods.
10625         (Output_merge_string::do_is_string): New method.
10626         * object.cc (Sized_relobj::do_setup): renamed from
10627         Sized_relobj::set_up.
10628         * object.h (Sized_relobj::adjust_shndx,
10629         Sized_relobj::initializ_input_to_output_maps,
10630         Sized_relobj::free_input_to_output_maps): Change visibilities to
10631         protected.
10632         (Sized_relobj::setup): Virtualize.
10633         (Sized_relobj::do_setup): New method declaration.
10634         (Sized_relobj::invalidate_section_offset,
10635         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10636         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10637         * options.cc (parse_int): New function.
10638         * options.h (parse_int): New declaration.
10639         (DEFINE_int): New macro.
10640         (stub_group_size): New option.
10641         * output.cc (Output_section::Output_section): Initialize memebers
10642         merge_section_map_, merge_section_by_properties_map_,
10643         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10644         (Output_section::add_input_section): Handled deferred code-fill
10645         generation and remove an old comment.
10646         (Output_section::add_relaxed_input_section): New method definition.
10647         (Output_section::add_merge_input_section): Use merge section by
10648         properties map to speed to search.  Update merge section maps
10649         as appropriate.
10650         (Output_section::build_relaxation_map): New method definition.
10651         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10652         Same.
10653         (Output_section::relax_input_section): Renamed to
10654         Output_section::convert_input_sections_to_relaxed_sections and change
10655         interface to take a vector of pointers to relaxed sections.
10656         (Output_section::find_merge_section,
10657         Output_section::find_relaxed_input_section): New method definitions.
10658         (Output_section::is_input_address_mapped,
10659         Output_section::output_offset, Output_section::output_address):
10660         Use output section data maps to speed up searching.
10661         (Output_section::find_starting_output_address): Add comments.
10662         (Output_section::do_write,
10663         Output_section::write_to_postprocessing_buffer): Do code-fill
10664         generation as appropriate.
10665         (Output_section::get_input_sections): Invalidate relaxed input section
10666         map.
10667         (Output_section::restore_states): Adjust type of checkpoint .
10668         Invalidate relaxed input section map.
10669         * output.h (Output_merge_base): New class declaration.
10670         (Input_section_specifier): New class defintion.
10671         (class Output_relaxed_input_section) Change base class to
10672         Output_section_data_build.
10673         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10674         base class initializer.
10675         (Output_section::add_relaxed_input_section): New method declaration.
10676         (Output_section::Input_section): Change visibility to protected.
10677         (Output_section::Input_section::relobj,
10678         Output_section::Input_section::shndx): Handle relaxed input sections.
10679         Output_section::input_sections) Change visibility to protected.  Also
10680         define overload to return a non-const pointer.
10681         (Output_section::Merge_section_properties): New class defintion.
10682         (Output_section::Merge_section_by_properties_map,
10683         Output_section::Output_section_data_by_input_section_map,
10684         Output_section::Relaxation_map): New types.
10685         (Output_section::relax_input_section): Rename method to
10686         Output_section::convert_input_sections_to_relaxed_sections and change
10687         interface to take a vector of relaxed section pointers.
10688         (Output_section::find_merge_section,
10689         Output_section::find_relaxed_input_section,
10690         Output_section::build_relaxation_map,
10691         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10692         New method declarations.
10693         (Output_section::merge_section_map_
10694         Output_section::merge_section_by_properties_map_,
10695         Output_section::relaxed_input_section_map_,
10696         Output_section::is_relaxed_input_section_map_valid_,
10697         Output_section::generate_code_fills_at_write_): New data members.
10698         * script-sections.cc
10699         (Output_section_element_input::set_section_addresses): Call
10700         current_data_size and addralign methods of relaxed input sections.
10701         (Orphan_output_section::set_section_addresses): Call current_data_size
10702         and addralign methods of relaxed input sections.
10703         * symtab.cc (Symbol_table::compute_final_value): Extract template
10704         from the body of Symbol_table::sized_finalize_symbol.
10705         (Symbol_table::sized_finalized_symbol): Call
10706         Symbol_table::compute_final_value.
10707         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10708         (Symbol_table::compute_final_value): New templated method declaration.
10709         * target.cc (Target::do_make_output_section): New method defintion.
10710         * target.h (Target::make_output_section): New method declaration.
10711         (Target::relax): Add more parameters for input objects, symbol table
10712         and layout.  Adjust call to do_relax.
10713         (Target::do_make_output_section): New method declaration.
10714         (Target::do_relax): Add parameters for input objects, symbol table
10715         and layout.
10716
10717 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10718
10719         * pread.c: Include stdio.h.
10720
10721 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10722
10723         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10724         defined.
10725
10726 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10727
10728         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10729         Change read_shndx type to unsigned int.
10730         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10731         int.
10732         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10733         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10734         Change read_shndx type to unsigned int.
10735         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10736         int.
10737         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10738         * layout.cc (Layout::create_symtab_sections): Cast the result of
10739         local_symcount * symsize to off_t in the gold_assert.
10740
10741 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10742
10743         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10744         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10745         R_ARM_BASE_ABS.
10746         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10747         (Arm_relocate_functions::thm_abs5): New function.
10748         (Arm_relocate_functions::abs12): New function.
10749         (Arm_relocate_functions::abs16): New function.
10750         (Arm_relocate_functions::base_abs): New function.
10751         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10752         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10753         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10754         R_ARM_BASE_ABS.
10755         (Scan::global): Likewise.
10756         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10757         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10758         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10759         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10760         R_ARM_BASE_ABS.
10761
10762 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10763
10764         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10765         (Arm_relocate_functions::movt_prel): New function.
10766         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10767         (Arm_relocate_functions::thm_movt_prel): New function.
10768         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10769         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10770         (Scan::global, Relocate::relocate): Likewise.
10771         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10772
10773 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10774
10775         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10776         Incremental_checker.
10777         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10778         unsigned int.
10779         (class Incremental_inputs_header): New class.
10780         (Incremental_inputs_header_writer): Edit comment.
10781         (Incremental_inputs_entry): New class.
10782         (Incremental_inputs_entry_writer): Edit comment.
10783         (Sized_incremental_binary::do_find_incremental_inputs_section):
10784         Add *strtab_shndx parameter, fill it.
10785         (Sized_incremental_binary::do_check_inputs): New method.
10786         (Incremental_checker::can_incrementally_link_output_file): Use
10787         Sized_incremental_binary::check_inputs.
10788         (Incremental_inputs::report_command_line): Save command line in
10789         command_line_.
10790         * incremental.h:
10791         (Incremental_binary::find_incremental_inputs_section): New
10792         method.
10793         (Incremental_binary::do_find_incremental_inputs_section): Add
10794         strtab_shndx parameter.
10795         (Incremental_binary::do_check_inputs): New pure virtual method.
10796         (Sized_incremental_binary::do_check_inputs): Declare.
10797         (Incremental_checker::Incremental_checker): Add incremental_inputs
10798         parameter, use it to initialize incremental_inputs_.
10799         (Incremental_checker::incremental_inputs_): New field.
10800         (Incremental_checker::command_line): New method.
10801         (Incremental_checker::inputs): New method.
10802         (Incremental_checker::command_line_): New field.
10803
10804 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10805
10806         * incremental.cc: Include <cstdarg> and "target-select.h".
10807         (vexplain_no_incremental): New function.
10808         (explain_no_incremental): New function.
10809         (Incremental_binary::error): New method.
10810         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10811         method.
10812         (make_sized_incremental_binary): New function.
10813         (open_incremental_binary): New function.
10814         (can_incrementally_link_file): Add checks if output is ELF and has
10815         inputs section.
10816         * incremental.h: Include "elfcpp_file.h" and "output.h".
10817         (Incremental_binary): New class.
10818         (Sized_incremental_binary): New class.
10819         (open_incremental_binary): Declare.
10820         * object.cc (is_elf_object): Use
10821         elfcpp::Elf_recognizer::is_elf_file.
10822         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10823         * output.h (Output_file::filesize): New method.
10824
10825 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10826
10827         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10828         New function.
10829         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10830         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10831         function.
10832         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10833         function.
10834         (Arm_relocate_functions::movw_abs_nc): New function.
10835         (Arm_relocate_functions::movt_abs): New function.
10836         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10837         (Arm_relocate_functions::thm_movt_abs): New function.
10838         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10839         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10840         (Scan::global): Likewise.
10841         (Relocate::relocate): Likewise.
10842         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10843
10844 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10845
10846         * arm.cc (Arm_relocate_functions::got_prel) New function.
10847         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10848         (Relocate::relocate): Likewise.
10849         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10850
10851 2009-10-06  Ian Lance Taylor  <iant@google.com>
10852
10853         * options.h (class General_options): Define
10854         split_stack_adjust_size parameter.
10855         * object.h (class Object): Add uses_split_stack_ and
10856         has_no_split_stack_ fields.  Add uses_split_stack and
10857         has_no_split_stack accessor functions.  Declare
10858         handle_split_stack_section.
10859         (class Reloc_symbol_changes): Define.
10860         (class Sized_relobj): Define Function_offsets.  Declare
10861         split_stack_adjust, split_stack_adjust_reltype, and
10862         find_functions.
10863         * object.cc (Object::handle_split_stack_section): New function.
10864         (Sized_relobj::do_layout): Call handle_split_stack_section.
10865         * dynobj.cc (Sized_dynobj::do_layout): Call
10866         handle_split_stack_section.
10867         * reloc.cc (Sized_relobj::relocate_sections): Call
10868         split_stack_adjust for executable sections in split_stack
10869         objects.  Pass reloc_map to relocate_section.
10870         (Sized_relobj::split_stack_adjust): New function.
10871         (Sized_relobj::split_stack_adjust_reltype): New function.
10872         (Sized_relobj::find_functions): New function.
10873         * target-reloc.h: Include "object.h".
10874         (relocate_section): Add reloc_symbol_changes parameter.  Change
10875         all callers.
10876         * target.h (class Target): Add calls_non_split method.  Declare
10877         do_calls_non_split virtual method.  Declare match_view and
10878         set_view_to_nop.
10879         * target.cc: Include "elfcpp.h".
10880         (Target::do_calls_non_split): New function.
10881         (Target::match_view): New function.
10882         (Target::set_view_to_nop): New function.
10883         * gold.cc (queue_middle_tasks): Give an error if mixing
10884         split-stack and non-split-stack objects with -r.
10885         * i386.cc (Target_i386::relocate_section): Add
10886         reloc_symbol_changes parameter.
10887         (Target_i386::do_calls_non_split): New function.
10888         * x86_64.cc (Target_x86_64::relocate_section): Add
10889         reloc_symbol_changes parameter.
10890         (Target_x86_64::do_calls_non_split): New function.
10891         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10892         parameter.
10893         * powerpc.cc (Target_powerpc::relocate_section): Add
10894         reloc_symbol_changes parameter.
10895         * sparc.cc (Target_sparc::relocate_section): Add
10896         reloc_symbol_changes parameter.
10897         * configure.ac: Call AM_CONDITIONAL for the default target.
10898         * configure: Rebuild.
10899         * testsuite/Makefile.am (TEST_AS): New variable.
10900         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10901         (check_DATA): Add split_i386 and split_x86_64 files.
10902         (SPLIT_DEFSYMS): Define.
10903         (split_i386_[1234n].o): New targets.
10904         (split_i386_[124]): New targets.
10905         (split_i386_[1234r].stdout): New targets.
10906         (split_x86_64_[1234n].o): New targets.
10907         (split_x86_64_[124]): New targets.
10908         (split_x86_64_[1234r].stdout): New targets.
10909         (MOSTLYCLEANFILES): Add new executables.
10910         * testsuite/split_i386.sh: New file.
10911         * testsuite/split_x86_64.sh: New file.
10912         * testsuite/split_i386_1.s: New file.
10913         * testsuite/split_i386_2.s: New file.
10914         * testsuite/split_i386_3.s: New file.
10915         * testsuite/split_i386_4.s: New file.
10916         * testsuite/split_i386_n.s: New file.
10917         * testsuite/split_x86_64_1.s: New file.
10918         * testsuite/split_x86_64_2.s: New file.
10919         * testsuite/split_x86_64_3.s: New file.
10920         * testsuite/split_x86_64_4.s: New file.
10921         * testsuite/split_x86_64_n.s: New file.
10922         * testsuite/testfile.cc (Target_test): Update relocation_section
10923         function.
10924         * testsuite/Makefile.in: Rebuild.
10925
10926 2009-10-06  Ian Lance Taylor  <iant@google.com>
10927
10928         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10929         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10930         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10931         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10932         the address on ldo_addrs_.
10933         (Target_i386::Relocate::fix_up_ldo): New function.
10934
10935 2009-10-06   Rafael Espindola  <espindola@google.com>
10936
10937         * plugin.cc (add_input_library): New.
10938         (Plugin::load): Add add_input_library to tv.
10939         (Plugin_manager::add_input_file): Add the is_lib argument.
10940         (add_input_file): Update call to Plugin_manager::add_input_file.
10941         (add_input_library): New.
10942         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10943
10944 2009-09-30  Doug Kwan  <dougkwan@google.com>
10945
10946         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10947         symbol and call Symbol::may_need_copy_reloc to determine if
10948         a copy reloc is needed.
10949         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10950         nocopyreloc is given in command line.
10951         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10952         given in command line.
10953         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10954         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10955         of the removed Target_i386::may_need_copy_reloc.
10956         * options.h (copyreloc): New option with default value false.
10957         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10958         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10959         instead of the removed Target_powerpc::may_need_copy_reloc.
10960         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10961         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10962         instead of the removed Target_sparc::may_need_copy_reloc.
10963         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10964         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10965         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10966         instead of the removed Target_x86_64::may_need_copy_reloc.
10967
10968 2009-09-30  Ian Lance Taylor  <iant@google.com>
10969
10970         * object.h (class Object): Remove target_ field, and target,
10971         sized_target, and set_target methods.
10972         (Object::sized_target): Remove.
10973         (class Sized_relobj): Update declarations.  Remove sized_target.
10974         * object.cc (Sized_relobj::setup): Remove target parameter.
10975         Change all callers.
10976         (Input_objects::add_object): Don't do anything with the target.
10977         (make_elf_sized_object): Add punconfigured parameter.  Change all
10978         callers.  Set or test parameter target.
10979         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10980         Change all callers.
10981         * parameters.cc (Parameters::set_target): Change parameter type to
10982         be non-const.
10983         (Parameters::default_target): Remove.
10984         (set_parameters_target): Change parameter type to be non-const.
10985         (parameters_force_valid_target): New function.
10986         (parameters_clear_target): New function.
10987         * parameters.h (class Parameters): Update declarations.  Remove
10988         default_target method.  Add sized_target and clear_target
10989         methods.  Change target_ to be non-const.
10990         (set_parameters_target): Update declaration.
10991         (parameters_force_valid_target): Declare.
10992         (parameters_clear_target): Declare.
10993         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10994         as NULL if we aren't searching.
10995         (Add_symbols::run): Don't check for compatible target.
10996         * fileread.cc (Input_file::open_binary): Call
10997         parameters_force_valid_target.
10998         * gold.cc (queue_middle_tasks): Likewise.
10999         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11000         set_target on object.
11001         * dynobj.h (class Sized_dynobj): Update declarations.
11002         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11003         make_elf_object returns NULL.
11004         (Archive::include_member): Don't check whether object target is
11005         compatible.
11006         * output.cc (Output_section::add_input_section): Get target from
11007         parameters.
11008         (Output_section::relax_input_section): Likewise.
11009         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11010         parameters.
11011         (Sized_relobj::do_scan_relocs): Likewise.
11012         (Sized_relobj::relocate_sections): Likewise.
11013         * resolve.cc (Symbol_table::resolve): Likewise.
11014         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11015         parameter.  Change all callers.
11016         (Symbol_table::add_from_object): Get target from parameters.
11017         (Symbol_table::add_from_relobj): Don't check object target.
11018         (Symbol_table::add_from_dynobj): Likewise.
11019         (Symbol_table::define_special_symbol): Get target from
11020         parameters.
11021         * symtab.h (class Symbol_table): Update declaration.
11022         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11023         parameter.  Change all callers.  Clear parameter target.
11024         (Binary_test): Test target here.
11025         * testsuite/object_unittest.cc (gold_testsuite): Remove
11026         target_test_pointer parameter.  Change all callers.
11027         (Object_test): Test target here.
11028
11029 2009-09-26  Ian Lance Taylor  <iant@google.com>
11030
11031         * testsuite/initpri1.c: Don't try to use constructor priorities if
11032         compiling with gcc before 4.3.
11033
11034 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11035
11036         * testsuite/retain_symbols_file_test.sh (check_present): Change
11037         output file name to retain_symbols_file_test.stdout.
11038         (check_absent): Likewise.
11039
11040 2009-09-18  Craig Silverstein  <csilvers@google.com>
11041
11042         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11043         * options.cc: Include <cerrno> and <fstream>.
11044         (General_options::finalize): Parse -retain-symbols-file tag.
11045         * options.h: New flag.
11046         (General_options): New method should_retain_symbol, new
11047         variable symbols_to_retain.
11048         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11049         should_retain_symbol map.
11050         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11051         * testsuite/Makefile.in: Regenerate.
11052         * testsuite/retain_symbols_file_test.sh: New file.
11053
11054 2009-09-18  Nick Clifton  <nickc@redhat.com>
11055
11056         * po/es.po: Updated Spanish translation.
11057
11058 2009-09-17  Doug Kwan  <dougkwan@google.com>
11059
11060         * debug.h (DEBUG_RELAXATION): New constant.
11061         (DEBUG_ALL): Add DEBUG_RELAXATION.
11062         (debug_string_to_enum): Add relaxation debug option.
11063         * layout.cc
11064         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11065         Layout::Relaxation_debug_check::read_sections,
11066         Layout::Relaxation_debug_check::read_sections): New method definitions.
11067         (Layout::Layout): Initialize data members
11068         record_output_section_data_from_scrips_,
11069         script_output_section_data_list_ and relaxation_debug_check_.
11070         (Layout::save_segments, Layout::restore_segments,
11071         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11072         Layout::relaxation_loop_body): New method definitions.
11073         (Layout::finalize): Support relaxation.  Move section layout code to
11074         Layout::relaxation_loop_body.
11075         (Layout::set_asection_address_from_script): Move code for orphan
11076         section placement out.
11077         (Layout::place_orphan_sections_in_script): New method definition.
11078         * layout.h (Output_segment_headers, Output_file_header):
11079         New forward class declarations.
11080         (Layout::~Layout): Define.
11081         (Layout::new_output_section_data_from_script): New method definition.
11082         (Layout::place_orphan_sections_in_script): New method declaration.
11083         (Layout::Segment_states): New type declaration.
11084         (Layout::save_segments, Layout::restore_segments,
11085         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11086         Layout::relaxation_loop_body): New method declarations.
11087         (Layout::Output_section_data_list): New type declaration.
11088         (Layout::Relaxation_debug_check): New class definition.
11089         (Layout::record_output_section_data_from_script_,
11090         Layout::script_output_section_data_list_, Layout::segment_states_,
11091         Layout::relaxation_debug_check_): New data members.
11092         * output.cc: (Output_section_headers::do_size): New method definition.
11093         (Output_section_headers::Output_section_headers): Move size
11094         computation to Output_section_headers::do_size.
11095         (Output_segment_headers::do_size): New method definition.
11096         (Output_file_header::Output_file_header): Move size computation to
11097         Output_file_header::do_size and call it.
11098         (Output_file_header::do_size): New method definition.
11099         (Output_data_group::Output_data_group): Adjust call to
11100         Output_section_data.
11101         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11102         (Output_symtab_xindex::do_write): Add array bound check.
11103         (Output_section::Input_section::print_to_mapfile): Handle
11104         RELAXED_INPUT_SECTION_CODE.
11105         (Output_section::Output_section): Initialize data member checkpoint_.
11106         (Output_section::~Output_section): Delete checkpoint object pointed
11107         by checkpoint_.
11108         (Output_section::add_input_section): Always add an Input_section if
11109         relaxing.
11110         (Output_section::add_merge_input_section): Add assert.
11111         (Output_section::relax_input_section): New method definition.
11112         (Output_section::set_final_data_size): Set load address to zero for
11113         an unallocated section.
11114         (Output_section::do_address_and_file_offset_have_reset_values):
11115         New method definition.
11116         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11117         Handle relaxed input section.
11118         (Output_section::sort_attached_input_sections): Checkpoint input
11119         section list lazily.
11120         (Output_section::get_input_sections): Change type of input_sections to
11121         list of Simple_input_section pointers.  Checkpoint input section list
11122         lazily.  Also handle relaxed input sections.
11123         (Output_section::add_input_section_for_script): Take a reference to
11124         a Simple_input_section object instead of Relobj pointer and section
11125         index as parameter.  Handle relaxed input sections.
11126         (Output_section::save_states, Output_section::restore_states): New
11127         method definitions.
11128         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11129         (Output_data::is_data_size_fixed): New method definition.
11130         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11131         if it is fixed.
11132         (Output_data::address_and_file_offset_have_reset_values): New method
11133         definition.
11134         (Output_data::do_address_and_file_offset_have_reset_values): New method
11135         definition.
11136         (Output_data::set_data_size): Check that data size is not fixed.
11137         (Output_data::fix_data_size): New method definition.
11138         (Output_data::is_data_size_fixed_): New data member.
11139         (Output_section_headers::set_final_data_size): New method definition.
11140         (Output_section_headers::do_size): New method declaration.
11141         (Output_segment_headers::set_final_data_size): New method definition.
11142         (Output_segment_headers::do_size): New method declaration.
11143         (Output_file_header::set_final_data_size)::New method definition.
11144         (Output_file_header::do_size)::New method declaration.
11145         (Output_section_data::Output_section_data): Add new parameter
11146         is_data_size_fixed and use it to fix data size.
11147         (Output_data_const::Output_data_const): Adjust call to base class
11148         constructor and fix data size.
11149         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11150         base class constructor and fix data size.
11151         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11152         base class constructor and fix data size.
11153         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11154         class constructor and fix data size.
11155         (Output_data_group::set_final_data_size): New method definition.
11156         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11157         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11158         class constructor and fix data size.
11159         (Output_relaxed_input_section): New class definition.
11160         (Output_section::Simple_input_section): New class definition.
11161         (Output_section::get_input_sections): Adjust parameter list.
11162         (Output_section::add_input_section_for_script): Same.
11163         (Output_section::save_states, Output_section::restore_states,
11164         Output_section::do_address_and_file_offset_have_reset_values,
11165         (Output_section::Input_section::Input_section): Handle
11166         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11167         Output_relaxed_input_section.
11168         (Output_section::Input_section::is_input_section,
11169         Output_section::Input_section::set_output_section): Handle relaxed
11170         input section.
11171         (Output_section::Input_section::is_relaxed_input_section,
11172         Output_section::Input_section::output_section_data,
11173         Output_section::Input_section::relaxed_input_section): New method
11174         definitions.
11175         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11176         value.
11177         (Output_section::Input_section::u1_): Update comments.
11178         (Output_section::Input_section::u2_): Add new union member poris.
11179         (Output_section::Checkpoint_output_section): New classs definition.
11180         (Output_section::relax_input_section): New method declaration.
11181         (Output_section::checkpoint_): New data member.
11182         (Output_segment): Update comments.
11183         (Output_segment::Output_segment): Un-privatize copy constructor.
11184         (Output_segment::operator=): Un-privatize.
11185         * script-sections.cc (Output_section_element::Input_section_list):
11186         Change element type to Output_section::Simple_input_section.
11187         (Output_section_element_dot_assignment::set_section_addresses):
11188         Register output section data for relaxation clean up.
11189         (Output_data_exression::Output_data_expression): Adjust call to base
11190         constructor to fix data size.
11191         (Output_section_element_data::set_section_addresses): Register
11192         Output_data_expression object for relaxation clean up.
11193         (struct Input_section_info): Replace Relobj pointer and section index
11194         pair with Output_section::Simple_input_section and Convert struct to a
11195         class.
11196         (Input_section_sorter::operator()): Adjust access to
11197         Input_section_info data member to use accessors.
11198         (Output_section_element_input::set_section_addresses): Use layout
11199         parameter.  Adjust code to use Output_section::Simple_input_section
11200         and Input_secction_info classes.  Register filler for relaxation
11201         clean up.
11202         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11203         and section index pair with Output_section::Simple_input_section
11204         class.  Adjust code accordingly.
11205         (Phdrs_element::release_segment): New method definition.
11206         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11207         segment list.
11208         (Script_sections::release_segments): New method definition.
11209         * gold/script-sections.h (Script_sections::release_segments): New
11210         method declaration.
11211         * gold/target.h (Target::may_relax, Target::relax,
11212         Target::do_may_relax, Target::do_relax): New method definitions.
11213
11214 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11215
11216         * arm.cc (has_signed_unsigned_overflow): New function.
11217         (Arm_relocate_functions::abs8): New function.
11218         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11219         (Target_arm::Scan::global): Likewise.
11220         (Target_arm::relocate::relocate): Likewise.
11221         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11222         Likewise.
11223
11224 2009-09-16  Cary Coutant  <ccoutant@google.com>
11225
11226         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11227         * testsuite/Makefile.in: Regenerate.
11228
11229 2009-09-11  Nick Clifton  <nickc@redhat.com>
11230
11231         * po/gold.pot: Updated by the Translation project.
11232
11233 2009-09-08  Cary Coutant  <ccoutant@google.com>
11234
11235         * output.cc (Output_file::open): Add execute permission to empty file.
11236         * testsuite/Makefile.am (permission_test): New test.
11237         * testsuite/Makefile.in: Regenerate.
11238
11239 2009-09-02  Ian Lance Taylor  <iant@google.com>
11240
11241         * output.cc (Output_file::resize): Call map_no_anonymous rather
11242         than map.
11243
11244 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11245
11246         * gold.cc: Include "incremental.h".
11247         (queue_initial_tasks): Call Incremental_checker methods.
11248         * incremental.cc: Include "output.h".
11249         (Incremental_checker::can_incrementally_link_output_file): New
11250         method.
11251         * incremental.h (Incremental_checker): New class.
11252
11253         * output.cc (Output_file::open_for_modification): New method.
11254         (Output_file::map_anonymous): Changed return type to bool.  Record
11255         map in base_ field.
11256         (Output_file::map_no_anonymous): New method, broken out of map.
11257         (Output_file::map): Use map_no_anonymous and map_anonymous.
11258         * output.h (class Output_file): Update declarations.
11259
11260 2009-08-24  Cary Coutant  <ccoutant@google.com>
11261
11262         * options.h (Command_line::Pre_options): New class.
11263         (Command_line::pre_options): New member.
11264         * options.cc (gold::options::ready_to_register): New variable.
11265         (One_option::register_option): Do nothing if not registering options.
11266         Assert if same short option registered twice.
11267         (General_options::General_options): Turn off option registration when
11268         done constructing.
11269         (Command_line::Pre_options::Pre_options): New constructor.
11270
11271 2009-08-24  Cary Coutant  <ccoutant@google.com>
11272
11273         * options.h (General_options::no_keep_memory): Remove incorrect
11274         short option.
11275
11276 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11277
11278         * Makefile.am (am__skiplex, am__skipyacc): New.
11279         * Makefile.in: Regenerate.
11280
11281 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11282
11283         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11284         (INCLUDES): ... this.
11285         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11286         (AM_CPPFLAGS): Renamed from ...
11287         (INCLUDE): ... this.
11288         * Makefile.in, testsuite/Makefile.in: Regenerate.
11289
11290         * Makefile.in: Regenerate.
11291         * aclocal.m4: Likewise.
11292         * config.in: Likewise.
11293         * configure: Likewise.
11294         * testsuite/Makefile.in: Likewise.
11295
11296         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11297         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11298         * Makefile.in: Regenerate.
11299         * testsuite/Makefile.in: Regenerate.
11300
11301 2009-08-19  Cary Coutant  <ccoutant@google.com>
11302
11303         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11304         symbols in shared libraries overridden by hidden or internal symbols
11305         in the main program.
11306
11307 2009-08-19  Chris Demetriou  <cgd@google.com>
11308
11309         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11310         checking source file names in error messages.
11311
11312 2009-08-18  Doug Kwan  <dougkwan@google.com>
11313
11314         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11315         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11316         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11317         an elfcpp::Ehdr as parameter.
11318         * object.cc (Object::set_target): Remove the version that looks up
11319         a target and sets it.
11320         (Sized_relobj::setup): Take a Target object instead of
11321         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11322         (make_elf_sized_object): Find target and ask target to
11323         make an ELF object.
11324         * object.h: (Object::set_target): Remove the version that looks up
11325         a target and sets it.
11326         (Sized_relobj::setup): Take a Target object instead of
11327         an elfcpp:Ehdr as parameter.
11328         * target.cc: Include dynobj.h.
11329         (Target::do_make_elf_object_implementation): New.
11330         (Target::do_make_elf_object): New.
11331         * target.h (Target::make_elf_object): New template declaration.
11332         (Target::do_make_elf_object): New method declarations.
11333         (Target::do_make_elf_object_implementation): New template declaration.
11334
11335 2009-08-14  Ian Lance Taylor  <iant@google.com>
11336
11337         * gold.h (FUNCTION_NAME): Define.
11338         (gold_unreachable): Use FUNCTION_NAME.
11339
11340 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11341
11342         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11343         symbol in the --keep-unique list is not found.
11344
11345 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11346
11347         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11348         been maked as --keep-unique.
11349         (Icf::unfold_section): New function.
11350         * icf.h (Icf::unfold_section): New function.
11351         * options.h (General_options::keep_unique): New option.
11352         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11353         * testsuite/Makefile.in: Regenerate.
11354         * testsuite/icf_keep_unique_test.sh: New file.
11355         * testsuite/icf_keep_unique_test.cc: New file.
11356
11357 2009-08-12  Cary Coutant  <ccoutant@google.com>
11358
11359         PR 10471
11360         * resolve.cc (Symbol_table::resolve): Check for references from
11361         dynamic objects to hidden and internal symbols.
11362         * testsuite/Makefile.am (hidden_test.sh): New test.
11363         * testsuite/Makefile.in: Regenerate.
11364         * testsuite/hidden_test.sh: New script.
11365         * testsuite/hidden_test_1.c: New test source.
11366         * testsuite/hidden_test_main.c: New test source.
11367
11368 2009-08-11  Doug Kwan  <dougkwan@google.com>
11369
11370         * arm.cc: Update comments.
11371         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11372         segment to locate the .ARM.exidx section if present.
11373
11374 2009-08-09  Doug Kwan  <dougkwan@google.com>
11375
11376         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11377         patch.
11378
11379 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11380         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11381         compiler warnings.
11382
11383 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11384
11385         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11386         valid tls_segment only for non-debug-section relocations.
11387         * testsuite/Makefile.am: Add gc_tls_test.
11388         * testsuite/Makefile.in: Regenerate.
11389         * testsuite/gc_tls_test.cc: New file.
11390         * testsuite/gc_tls_test.sh: New file.
11391
11392 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11393
11394         * icf.cc: New file.
11395         * icf.h: New file.
11396         * Makefile.am (CCFILES): Add icf.cc.
11397         (HFILES): Add icf.h
11398         * Makefile.in: Regenerate.
11399         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11400         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11401         section, symbol and addend information for the relocs.
11402         * gold.cc (queue_middle_tasks): Call identical code folding.
11403         * gold.h: Add defines for multimap.
11404         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11405         to the call of finalize_local_symbols.
11406         * main.cc (main): Create object of class Icf.
11407         * object.cc (Sized_relobj::do_layout): Allow this function to be
11408         called twice during icf.
11409         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11410         to sections marked as identical by icf.
11411         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11412         when available.
11413         (Sized_relobj::do_section_entsize): New function.
11414         * object.h (Object::section_entsize): New function.
11415         (Object::do_section_entsize): New pure virtual function.
11416         (Relobj::finalize_local_symbols): Add new parameter.
11417         (Relobj::do_section_entsize): New function.
11418         * options.h (General_options::icf): New option.
11419         (General_options::icf_iterations): New option.
11420         (General_options::print_icf_sections): New option.
11421         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11422         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11423         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11424         icf.
11425         * symtab.cc (Symbol_table::is_section_folded): New function.
11426         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11427         to sections marked as identical by icf.
11428         * symtab.h (Symbol_table::set_icf): New function.
11429         (Symbol_table::icf): New function.
11430         (Symbol_table::is_section_folded): New function.
11431         (Symbol_table::icf_): New data member.
11432         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11433         * testsuite/Makefile.am: Add commands to build icf_test.
11434         * testsuite/Makefile.in: Regenerate.
11435         * testsuite/icf_test.sh: New file.
11436         * testsuite/icf_test.cc: New file.
11437
11438 2009-07-24  Chris Demetriou  <cgd@google.com>
11439
11440         * layout.cc (is_compressible_debug_section): Fix incorrect
11441         comment about compressed section names.
11442
11443 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11444
11445         PR 10419
11446         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11447
11448 2009-07-16  Ian Lance Taylor  <iant@google.com>
11449
11450         PR 10400
11451         * layout.h: #include <map>.
11452         (class Kept_section): Change from struct to class.  Add accessors
11453         and setters.  Add section size to Comdat_group mapping.  Change
11454         Comdat_group to std::map.  Add is_comdat_ field.  Add
11455         linkonce_size field in union.
11456         (class Layout): Update declaration of find_or_add_kept_section.
11457         Don't declare find_kept_object.
11458         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11459         parameter.  Add object, shndx, is_comdat, and is_group_name
11460         parameters.  Change all callers.  Adjust for new Kept_section.
11461         (Layout::find_kept_object): Remove.
11462         * object.cc (Sized_relobj::include_section_group): Update use of
11463         Kept_section.  Rename secnum to shndx.  Only record
11464         Kept_comdat_section if sections are the same size.
11465         (Sized_relobj::include_linkonce_section): Update use of
11466         Kept_section.  Only record Kept_comdat_section if sections are the
11467         same size.  Set size of linkonce section.
11468         (Sized_relobj::map_to_kept_section): Update call to
11469         get_kept_comdat_section.
11470         * object.h (class Sized_relobj): Rename fields in
11471         Kept_comdat_section to drop trailing underscores; change object
11472         field to Relobj*.  Change Kept_comdat_section_table to store
11473         struct rather than pointer.
11474         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11475         Add kept_object and kept_shndx parameters.  Change all callers.
11476         (Sized_relobj::get_kept_comdat_section): Change return type to
11477         bool.  Add kept_object and kept_shndx parameters.  Change all
11478         callers.
11479         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11480         Layout::find_or_add_kept_section.
11481
11482 2009-07-09  Ian Lance Taylor  <iant@google.com>
11483
11484         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11485         Reserve space in the hash table.
11486
11487 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11488
11489         * fileread.cc (File_read::get_mtime): New method.
11490         * fileread.h (Timespec): New structure.
11491         (File_read::get_mtime): New method.
11492         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11493         Renamed from timestamp_nsec.
11494         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11495         Elf_Xword.
11496         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11497         timestamp_nsec.
11498         (Incremental_inputs::report_archive): Save mtime; style fix.
11499         (Incremental_inputs::report_obejct): Save mtime; style fix.
11500         (Incremental_inputs::report_script): Save mtime; style fix.
11501         (Incremental_inputs::finalize_inputs): Style fix.
11502         (Incremental_inputs::finalize): Style fix.
11503         (Incremental_inputs::create_input_section_data): Store inputs
11504         mtime.
11505         * incremental.h (Incremental_inputs::report_script): Add mtime
11506         argument.
11507         (Incremental_inputs::Input_info::Input_info): Intialize only one
11508         union member.
11509         (Incremental_inputs::Input_info::archive): Move to nameless
11510         union.
11511         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11512         (Incremental_inputs::Input_info::script): Move to nameless union.
11513         (Incremental_inputs::mtime): New field.
11514         * script.cc (read_input_script): Pass file mtime to
11515         Incremental_input.
11516         * script.h (Script_info::inputs): Style fix.
11517
11518 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11519
11520         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11521         instead of 32.
11522
11523 2009-06-24  Ian Lance Taylor  <iant@google.com>
11524
11525         PR 10156
11526         * layout.cc (Layout::choose_output_section): If we find an
11527         existing section, update the flags.
11528         (Layout::create_notes): New function, broken out of
11529         Layout::finalize.
11530         (Layout::finalize): Don't create note sections.
11531         (Layout::create_note): Don't crash if linker script discards
11532         section.
11533         (Layout::create_gold_note): Likewise.
11534         (Layout::create_build_id): Likewise.  Don't set
11535         after_input_sections on the section.
11536         (Layout::create_executable_stack_info): Remove target parameter.
11537         Change caller.
11538         * layout.h (class Layout): Declare create_notes.  Update
11539         declaration of create_executable_stack_info.
11540         * gold.cc (queue_middle_tasks): Call create_notes.
11541         * output.cc (Output_section::update_flags_for_input_section): Move
11542         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11543         invalid.
11544         * output.h (Output_data::mark_address_invalid): New function.
11545         (class Output_section): Only declare, not define,
11546         update_flags_for_input_section.  Remove set_flags.
11547
11548 2009-06-24  Ian Lance Taylor  <iant@google.com>
11549
11550         * script-sections.cc (Output_section_definition::
11551         set_section_addresses): Rename shadowing local load_address to
11552         laddr.
11553
11554 2009-06-24  Ian Lance Taylor  <iant@google.com>
11555
11556         PR 10244
11557         * reloc.cc (relocate_sections): Skip empty relocation sections.
11558
11559 2009-06-23  Ian Lance Taylor  <iant@google.com>
11560
11561         PR 10156
11562         * layout.cc (Layout::create_note): Use choose_output_section
11563         rather than make_output_section.
11564
11565 2009-06-23  Ian Lance Taylor  <iant@google.com>
11566
11567         PR 10237
11568         * options.cc (General_options::parse_V): Set printed_version_.
11569         (General_options::General_options): Initialize printed_version_.
11570         * options.h (class General_options): Add printed_version_ field.
11571         * gold.cc (queue_initial_tasks): If there are no input files,
11572         don't give a fatal error if we printed the version information.
11573         (queue_middle_tasks): If using -r with a shared object, give a
11574         fatal error rather than an ordinary error.
11575
11576 2009-06-23  Ian Lance Taylor  <iant@google.com>
11577
11578         PR 10219
11579         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11580         (Layout::make_output_section): Set have_stabstr_section_ if we see
11581         a .stab*str section.
11582         (Layout::finalize): Call link_stabs_sections.
11583         (Layout::link_stabs_sections): New file.
11584         * layout.h (class Layout): Add have_stabstr_section_ field.
11585         Declare link_stabs_sections.
11586
11587 2009-06-23  Doug Kwan  <dougkwan@google.com>
11588
11589         * Makefile.am (libgold_a_LIBADD): New.
11590         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11591         * Makefile.in: Regenerate.
11592         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11593         * configure: Regenerate.
11594         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11595         * fileread.cc: Include sys/state.h
11596         * gold.h: Declare memmem and strndup if found missing.
11597         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11598
11599 2009-06-23  Ian Lance Taylor  <iant@google.com>
11600
11601         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11602         * configure: Rebuild.
11603
11604 2009-06-23  Ian Lance Taylor  <iant@google.com>
11605
11606         PR 10147
11607         * object.cc (Object::section_contents): Don't try to get a view if
11608         the section has length zero.
11609         (Object::handle_gnu_warning_section): If the section is empty, use
11610         the name of the section as the warning.
11611
11612 2009-06-23  Ian Lance Taylor  <iant@google.com>
11613
11614         PR 10133
11615         * stringpool.h (class Stringpool_template): Add optimize_ field.
11616         (Stringpool_template::set_optimize): New function.
11617         * stringpool.cc (Stringpool_template::Stringpool_template):
11618         Initialize optimize_ field.
11619         (Stringpool_template::set_string_offsets): Test local optimize
11620         fild rather than parameter.
11621         * layout.cc (Layout::Layout): Call set_optimize on the section
11622         name stringpool.
11623
11624 2009-06-22  Ian Lance Taylor  <iant@google.com>
11625
11626         PR 10030
11627         * yyscript.y: Parse TARGET.
11628         * script.cc (script_set_target): New function.
11629         * script-c.h (script_set_target): Declare.
11630         * options.cc (General_options::string_to_object_format): Rename
11631         from string_to_object_format in anonymous namespace.  Change
11632         callers.
11633         * options.h (class General_options): Declare
11634         string_to_object_format.
11635
11636 2009-06-22  Ian Lance Taylor  <iant@google.com>
11637
11638         * script-sections.cc (Script_sections::create_segments): Don't put
11639         program headers in a PT_LOAD segment if -n or -N.
11640
11641 2009-06-22  Ian Lance Taylor  <iant@google.com>
11642
11643         PR 10141
11644         * options.h (class General_options): Add -z lazy and -z now.  Sort
11645         -z options into alphabetical order.
11646         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11647
11648 2009-06-21  Ian Lance Taylor  <iant@google.com>
11649
11650         * layout.cc (Layout::make_output_section): Call
11651         Target::new_output_section.
11652         (Layout::attach_allocated_section_to_segment): Put large section
11653         sections in a separate load segment with the large segment flag
11654         set.
11655         (Layout::segment_precedes): Sort large data segments after other
11656         load segments.
11657         (align_file_offset): New static function.
11658         (Layout::set_segment_offsets): Use align_file_offset.
11659         * output.h (class Output_section): Add is_small_section_ and
11660         is_large_section_ fields.
11661         (Output_section::is_small_section): New function.
11662         (Output_section::set_is_small_section):  New function.
11663         (Output_section::is_large_section): New function.
11664         (Output_section::set_is_large_section): New function.
11665         (Output_section::is_large_data_section): New function.
11666         (class Output_segment): Add is_large_data_segment_ field.
11667         (Output_segment::is_large_data_segment): New function.
11668         (Output_segment::set_is_large_data_segment): New function.
11669         * output.cc (Output_section::Output_section): Initialize new
11670         fields.
11671         (Output_segment::Output_segment): Likewise.
11672         (Output_segment::add_output_section): Add assertion that large
11673         data sections always go in large data segments.  Force small data
11674         sections to the end of the list of data sections.  Force small BSS
11675         sections to the start of the list of BSS sections.  For large BSS
11676         sections to the end of the list of BSS sections.
11677         * symtab.h (class Symbol): Declare is_common_shndx.
11678         (Symbol::is_defined): Check Symbol::is_common_shndx.
11679         (Symbol::is_common): Likewise.
11680         (class Symbol_table): Define enum Commons_section_type.  Update
11681         declarations.  Add small_commons_ and large_commons_ fields.
11682         * symtab.cc (Symbol::is_common_shndx): New function.
11683         (Symbol_table::Symbol_table): Initialize new fields.
11684         (Symbol_table::add_from_object): Put small and large common
11685         symbols in the right list.
11686         (Symbol_table::sized_finalized_symbol): Check
11687         Symbol::is_common_shndx.
11688         (Symbol_table::sized_write_globals): Likewise.
11689         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11690         common symbol lists.  Don't call do_allocate_commons_list if the
11691         list is empty.
11692         (Symbol_table::do_allocate_commons_list): Remove is_tls
11693         parameter.  Add comons_section_type parameter.  Change all
11694         callers.  Handle small and large common symbols.
11695         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11696         Symbol::is_common_shndx.
11697         * resolve.cc (symbol_to_bits): Likewise.
11698         * target.h (Target::small_common_shndx): New function.
11699         (Target::small_common_section_flags): New function.
11700         (Target::large_common_shndx): New function.
11701         (Target::large_common_section_flags): New function.
11702         (Target::new_output_section): New function.
11703         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11704         small_common_section_flags, and large_common_section_flags
11705         fields.
11706         (Target::do_new_output_section): New virtual function.
11707         * arm.cc (Target_arm::arm_info): Initialize new fields.
11708         * i386.cc (Target_i386::i386_info): Likewise.
11709         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11710         Likewise.
11711         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11712         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11713         (Target_x86_64::do_new_output_section): New function.
11714         * configure.ac: Define conditional MCMODEL_MEDIUM.
11715         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11716         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11717         (large_LDFLAGS): Define.
11718         * testsuite/large.c: New file.
11719         * testsuite/testfile.cc (Target_test::test_target_info):
11720         Initialize new fields.
11721         * configure, testsuite/Makefile.in: Rebuild.
11722
11723 2009-06-05  Doug Kwan  <dougkwan@google.com>
11724
11725         * Makefile.am (CCFILES): Add target.cc.
11726         * Makefile.in: Regenerate.
11727         * i386.cc (class Target_i386): Define new virtual method to
11728         override do_is_local_label_name in parent.
11729         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11730         local symbols if --discard-locals or -X is given.
11731         * options.h (class General_options): Declare new options
11732         '--discard-locals' and '-X' for discarding locals.
11733         * target.h (class Target): Define new methods is_local_label_name.
11734         Declare new virtual method do_is_local_label_name.
11735         * target.cc: New file.
11736         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11737         (check_SCRIPTS): Add discard_locals_test.sh.
11738         (check_DATA): Add discard_local_tests.syms.
11739         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11740         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11741         * testsuite/Makefile.in: Regenerate.
11742         * testsuite/discard_locals_test.c: New file.
11743         * testsuite/discard_locals_test.sh: Same.
11744
11745 2009-06-05  Doug Kwan  <dougkwan@google.com>
11746
11747         * object.cc (Sized_relobj::Sized_relobj): Initialize
11748         discarded_eh_frame_shndx_ to -1U.
11749         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11750         section.
11751         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11752         a discarded .eh_frame section.
11753         (Sized_relobj::do_finalize_local_symbols): Ditto.
11754         * object.h (class Sized_relobj): Declare new member
11755         discarded_eh_frame_shndx_.
11756         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11757         (local_labels_test.o, local_labels_test): New rules.
11758         * testsuite/Makefile.in: Regenerate.
11759
11760 2009-06-04  Doug Kwan  <dougkwan@google.com>
11761
11762         * layout.cc (Layout::section_name_mapping): Add mapping for
11763         special ARM sections.
11764
11765 2009-06-03  Doug Kwan  <dougkwan@google.com>
11766
11767         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11768         (utils::has_overflow): Same.
11769
11770 2009-06-03  Ian Lance Taylor  <iant@google.com>
11771
11772         * layout.cc (Layout::section_name_mapping): New array, replacing
11773         Layout::linkonce_mapping.
11774         (Layout::section_name_mapping_count): New variable, replacing
11775         Layout::linkonce_mapping_count.
11776         (Layout::linkonce_output_name): Remove.
11777         (Layout::output_section_name): Rewrite.
11778         * layout.h (class Layout): Rename Linkonce_mapping to
11779         Section_name_mapping, linkonce_mapping to section_name_mapping,
11780         linkonce_mapping_count to section_name_mapping_count.  Don't
11781         declare linkonce_output_name.
11782
11783 2009-06-03  Doug Kwan  <dougkwan@google.com>
11784
11785         * gold/arm.cc (namespace utils): New.
11786         (Target_arm::reloc_is_non_pic): Define new method.
11787         (class Arm_relocate_functions): New.
11788         (Target_arm::Relocate::relocate): Handle relocation types used by
11789         Android.
11790
11791 2009-06-03  Ian Lance Taylor  <iant@google.com>
11792
11793         * arm.cc (Target_arm::scan::global): Use || instead of |.
11794
11795 2009-06-02  Doug Kwan  <dougkwan@google.com>
11796
11797         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11798         issued_non_pic_error_.
11799         (class Target_arm::Scan): Declare new method check_non_pic.
11800         Define new method symbol_needs_plt_entry.
11801         Declare new data member issued_non_pic_error_.
11802         (class Target_arm::Relocate): Declare new method
11803         should_apply_static_reloc.
11804         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11805         (Target_arm::Scan::check_non_pic): Define new method.
11806         (Target_arm::Scan::local): Handle a small subset of reloc types used
11807         by Android.
11808         (Target_arm::Scan::local): Same.
11809         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11810
11811 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11812
11813         * incremental.cc (Incremental_inputs::report_command_line): Filter
11814         out --incremental-* options.
11815
11816 2009-05-29  Doug Kwan  <dougkwan@google.com>
11817
11818         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11819         template class.
11820         (class Target_arm): Update comment.
11821         (Target_arm::Target_arm): Initialize new data members GOT_,
11822         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11823         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11824         and Target_arm::rel_dyn_section.
11825         Declare new_enum Target_arm::Got_type.
11826         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11827         and DYNBSS_.
11828         Update commments for member do_dynsym_value.
11829         (Target_arm::got_size, Target_arm::plt_section,
11830         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11831         new methods inside class defintion.
11832         (Target_arm::got_section): Define new method.
11833         (Target_arm::rel_dyn_section): Same.
11834         (Output_data_plt_arm): New template class.
11835         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11836         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11837         (Output_data_plt_arm::add_entry): Same.
11838         (Output_data_plt_arm::first_plt_entry): Define new
11839         static data member for PLT instruction template.
11840         (Output_data_plt_arm::plt_entry): Same.
11841         (Output_data_plt_arm::do_write): Define new method.
11842         (Target_arm::make_plt_entry): Same.
11843         (Target_arm::do_finalize_sections): Same.
11844         (Target_arm::do_dynsym_value): Same.
11845
11846 2009-05-28  Doug Kwan  <dougkwan@google.com>
11847
11848         * Makefile.am (TARGETSOURCES): Add arm.cc.
11849         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11850         * Makefile.in: Regenerate.
11851         * arm.cc: New file.
11852         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11853
11854 2009-05-26  Doug Kwan  <dougkwan@google.com>
11855
11856         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11857         (General_options::check_excluded_libs): Strip off directories in
11858         archive name before matching like GNU ld does.
11859         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11860         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11861         (exclude_libs_test_LDFLAGS): Add linker option
11862         -Wl,--exclude-libs,libexclude_libs_test_3
11863         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11864         an explicit archive without using -l.
11865         (alt/libexclude_libs_test_3.a): New make rule.
11866         * testsuite/Makefile.in: Regenerate.
11867         * testsuite/exclude_libs_test.c : Declare lib3_default().
11868         (main): Call it.
11869         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11870         * exclude_libs_test_3.c: New file.
11871
11872 2009-05-26  Nick Clifton  <nickc@redhat.com>
11873
11874         * po/id.po: New Indonesian translation.
11875         * po/gold.pot: Updated template file.
11876
11877 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11878
11879         * testsuite/Makefile.am: Add -ffunction-sections to compile
11880         gc_comdat_test files.  Add -Wl,--gc-sections to build
11881         gc_comdat_test.
11882         * testsuite/Makefile.in: Regenerate.
11883         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11884
11885 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11886
11887         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11888         kept comdat section was garbage collected.
11889         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11890         * testsuite/Makefile.in: Regenerate.
11891         * testsuite/gc_comdat_test.sh: New file.
11892         * testsuite/gc_comdat_test_1.cc: New file.
11893         * testsuite/gc_comdat_test_2.cc: New file.
11894
11895 2009-05-19  Doug Kwan  <dougkwan@google.com>
11896
11897         * archive.cc (Archive::Archive): Move constructor from archive.h
11898         to here.  Initialize no_export_.
11899         (Archive::get_elf_object_for_member): Set no_export flag of object.
11900         * archive.h (Archive::Archive): Move constructor body to
11901         archive.cc.
11902         (Archive::no_export): New method.
11903         (Archive::no_export_): New field.
11904         * object.h (Object::Object): Initialize no_export_ to false.
11905         (Object::no_export, Object::set_no_export): New methods.
11906         (Object::no_export_): New field.
11907         * options.cc (General_options::parse_exclude_libs): New method.
11908         (General_options::check_excluded_libs) Same.
11909         * options.h (exclude_libs): New option.
11910         (General_options::check_excluded_libs): New method declaration.
11911         (General_options::excluded_libs_): New field.
11912         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11913         default or protected visibility if an object has no-export flag set.
11914         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11915         (check_SCRIPTS): Add exclude_libs_test.sh.
11916         (check_DATA): Add exclude_libs_test.syms.
11917         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11918         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11919         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11920         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11921         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11922         libexclude_libs_test_2.a): New rules.
11923         * testsuite/Makefile.in: Regenerate.
11924         * testsuite/exclude_libs_test.c: New file.
11925         * testsuite/exclude_libs_test.sh: Ditto.
11926         * testsuite/exclude_libs_test_1.c: Ditto.
11927         * testsuite/exclude_libs_test_2.c: Ditto.
11928
11929 2009-05-15  Ian Lance Taylor  <iant@google.com>
11930
11931         * configure.ac: Check for declarations for cases where libiberty.h
11932         checks HAVE_DECL_xxx.
11933         * configure, config.in: Rebuild.
11934
11935 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11936
11937         * gold.h (Incremental_argument_list): Remove (invalid) forward
11938         declaration.
11939         * incremental.cc (Incremental_inputs::report_achive): New method.
11940         (Incremental_inputs::report_object): New method.
11941         (Incremental_inputs::report_script): New method.
11942         (Incremental_inputs::finalize_inputs): New method.
11943         (Incremental_inputs::finalize): Call finalize_inputs().
11944         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11945         Create inputs entries.
11946         * incremental.h (Incremental_input_type): New enum.
11947         (Incremental_inputs::Incremental_input): Initialize new fields.
11948         (Incremental_inputs::report_inputs): New method.
11949         (Incremental_inputs::report_achive): New method.
11950         (Incremental_inputs::report_object): New method.
11951         (Incremental_inputs::report_script): New method.
11952         (Incremental_inputs::finalize_inputs): New method.
11953         (Incremental_inputs::Input_info): New struct.
11954         (Incremental_inputs::Input_info_map): New typedef.
11955         (Incremental_inputs::lock_): New field.
11956         (Incremental_inputs::Inputs_): New field.
11957         (Incremental_inputs::Inputs_map): New field.
11958         * main.cc (main): Call Incremental_input::report_inputs.
11959         * options.h (Input_argument_list): Typedef moved from
11960         Input_arguments.
11961         (Input_file_group::Files): Remove, use ::Input_argument_list.
11962         (Input_file_group::Input_argument_list): Remove, use
11963         ::Input_argument_list.
11964         * plugin.cc (Plugin_manager::add_input_file): Add error in
11965         incremental build.
11966         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11967         functions.
11968         * script.cc (read_input_script): Call
11969         Incremental_input::report_script.
11970         * script.h (Script_info): New class.
11971
11972 2009-04-27  Ian Lance Taylor  <iant@google.com>
11973
11974         * x86_64.cc (do_adjust_output_section): Set entsize to
11975         plt_entry_size.
11976
11977 2009-04-23  Elliott Hughes  <enh@google.com>
11978
11979         * output.cc (Output_file::close): After short writes, continue
11980         writing from the correct offset in the buffer being written.
11981
11982 2009-04-23  Chris Demetriou  <cgd@google.com>
11983
11984         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11985         * configure: Regenerate.
11986         * config.in: Regenerate.
11987         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11988         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11989
11990 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11991
11992         * incremental.cc (Incremental_inputs_header_data): Renamed from
11993         Incremental_input_header_data.
11994         (Incremental_inputs_header_data::data_size): New field.
11995         (Incremental_inputs_header_data::put_input_file_count): Renamed
11996         from input_file_count.
11997         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11998         from command_line_offset.
11999         (Incremental_inputs_header_data::put_reserved): Renamed from
12000         put_reserved.
12001         (Incremental_inputs_entry_data): Renamed from
12002         Incremental_input_entry_data.
12003         (Incremental_inputs_entry_data::data_size): New field.
12004         (Incremental_inputs::report_command_line): New method.
12005         (Incremental_inputs::finalize): New method.
12006         (Incremental_inputs::create_incremental_inputs_data): New method.
12007         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12008         * incremental.h: New file.
12009         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12010         (Layout::finalize): Create incremental inputs section in
12011         incremental builds.
12012         (Layout::create_incremental_info_sections): New method.
12013         * layout.h (Layout::incremental_inputs): New method.
12014         (Layout::create_incremental_info_sections): New method.
12015         (Layout::incremental_inputs_): New field.
12016         * main.cc (main): Notify Incremental_input of the command line.
12017
12018 2009-04-01  Ian Lance Taylor  <iant@google.com>
12019             Mikolaj Zalewski  <mikolajz@google.com>
12020
12021         * gold.h (reserve_unordered_map): Define, three versions, one for
12022         each version of Unordered_map.
12023         * layout.cc (Layout::Layout): Remove options parameter.  Add
12024         number_of_input_files parameter.  Don't initialize options_.
12025         Initialize number_of_input_files_ and resized_signatures_.  Move
12026         sections_are_attached_.
12027         (Layout::layout_group): Reserve space for group_signatures_.
12028         (Layout::find_or_add_kept_section): Change name parameter to be a
12029         reference.  Resize signatures_ map when it gets large enough.
12030         (Layout::layout_eh_frame): Use parameters->options() instead of
12031         this->options_.
12032         (Layout::make_output_section): Likewise.
12033         (Layout::attach_allocated_section_to_segment): Likewise.
12034         (Layout::finalize, Layout::create_executable_stack): Likewise.
12035         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12036         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12037         * layout.h (class Layout): Update declarations.  Remove options_
12038         field.  Add number_of_input_files_ and resized_signatures_
12039         fields.  Move sections_are_attached_ field.
12040         * main.cc (main): Pass number of input files to Layout
12041         constructor.  Don't pass options.
12042
12043 2009-03-30  Ian Lance Taylor  <iant@google.com>
12044
12045         * ffsll.c (ffsll): Correct implementation.
12046
12047 2009-03-27  Ian Lance Taylor  <iant@google.com>
12048
12049         * ffsll.c: New file.
12050         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12051         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12052         * ftruncate.c (ftruncate): Declare before definition.
12053         * mremap.c (mremap): Likewise.
12054         * pread.c (pread): Likewise.
12055         * configure, Makefile.in, config.in: Rebuild.
12056
12057         * mremap.c: New file.
12058         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12059         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12060         (mremap): Declare if HAVE_MREMAP is not defined.
12061         * configure, Makefile.in, config.in: Rebuild.
12062
12063 2009-03-27  Cary Coutant  <ccoutant@google.com>
12064
12065         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12066         position independent.
12067         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12068         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12069
12070 2009-03-24  Cary Coutant  <ccoutant@google.com>
12071
12072         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12073         an executable.
12074         (needs_dynamic_reloc): Likewise.
12075
12076 2009-03-24  Ian Lance Taylor  <iant@google.com>
12077
12078         * yyscript.y (file_cmd): Recognize EXTERN.
12079         (extern_name_list, extern_name_list_body): New nonterminals.
12080         * script.cc (script_add_extern): Define.
12081         * script-c.h (script_add_extern): Declare.
12082
12083 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12084
12085         * object.cc (is_elf_object): Define.
12086         * object.h (is_elf_object): Declare.
12087         * archive.cc (Archive::get_elf_object_for_member): Call
12088         is_elf_object.
12089         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12090
12091 2009-03-24  Elliott Hughes  <enh@google.com>
12092
12093         * output.cc (Output_file::map_anonymous): Define.
12094         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12095         try an anonymous one.  Report the size if the mmap fails.
12096         * output.h (class Output_file): Declare map_anonymous.
12097
12098 2009-03-24  Ian Lance Taylor  <iant@google.com>
12099
12100         * target-select.cc (instantiate_target): Don't acquire the lock if
12101         the instantiated_target_ field has already been set.
12102
12103 2009-03-23  Ian Lance Taylor  <iant@google.com>
12104
12105         * gold-threads.h (class Initialize_lock): Define.
12106         * gold-threads.cc (class Initialize_lock_once): Define.
12107         (initialize_lock_control): New static variable.
12108         (initialize_lock_pointer): New static variable.
12109         (initialize_lock_once): New static function.
12110         (Initialize_lock::Initialize_lock): Define.
12111         (Initialize_lock::initialize): Define.
12112         * target-select.h: Include "gold-threads.h".
12113         (class Target_selector): Add lock_ and initialize_lock_ fields.
12114         Don't define instantiate_target, just declare it.
12115         * target-select.cc (Target_selector::Target_selector): Initialize
12116         new fields.
12117         (Target_selector::instantiate_target): Define.
12118         * descriptors.h: Include "gold-threads.h".
12119         (class Descriptors): Add initialize_lock_ field.
12120         * descriptors.cc (Descriptors::Descriptors): Initialize new
12121         field.
12122         (Descriptors::open): Use initialize_lock_ field
12123         * errors.h (class Errors): Add initialize_lock_ field.
12124         * errors.cc (Errors::Errors): Initialize new field.
12125         (Errors::initialize_lock): Use initialize_lock_ field.
12126         * powerpc.cc (class Target_selector_powerpc): Remove
12127         instantiated_target_ field.  In do_recognize call
12128         instantiate_target rather than do_instantiate_target.  In
12129         do_instantiate_target just allocate a new target.
12130         * sparc.cc (class Target_selector_sparc): Likewise.
12131
12132         * freebsd.h: New file.
12133         * i386.cc: Include "freebsd.h".
12134         (Target_i386): Derive from Target_freebsd rather than
12135         Sized_target.
12136         (Target_selector_i386): Derive from Target_selector_freebsd rather
12137         than Target_selector.
12138         * x86_64.cc: Include "freebsd.h".
12139         (Target_x86_64): Derive from Target_freebsd rather than
12140         Sized_target.
12141         (Target_selector_x86_64): Derive from Target_selector_freebsd
12142         rather than Target_selector.
12143         * target.h (class Target): Add adjust_elf_header and
12144         do_adjust_elf_header.
12145         * output.cc (Output_file_header:: do_sized_write): Call target
12146         adjust_elf_header routine.
12147         * configure.tgt: Set targ_osabi.
12148         * configure.ac: Define GOLD_DEFAULT_OSABI.
12149         * parameters.cc (Parameters::default_target): Pass
12150         GOLD_DEFAULT_OSABI to select_target.
12151         * target-select.h (class Target_selector): Make instantiate_target
12152         protected rather than private.
12153         * Makefile.am (HFILES): Add freebsd.h.
12154         * configure, Makefile.in, config.in: Rebuild.
12155
12156         * merge.cc (do_add_input_section): Correct pend value.  Change
12157         message about last entry not being null terminated from error to
12158         warning.
12159
12160 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12161
12162         * incremental.cc: New file.
12163         * Makefile.am (CCFILES): Add incremental.cc.
12164         * Makefile.in: Rebuild.
12165
12166 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12167
12168         * layout.cc (Layout::output_section_name): Preserve names
12169         of '.note.' sections.
12170
12171 2009-03-19  Ian Lance Taylor  <iant@google.com>
12172
12173         * descriptors.cc (Descriptors::open): Check that the options are
12174         valid before using them.
12175
12176 2009-03-18  Ian Lance Taylor  <iant@google.com>
12177
12178         * script-sections.h: Include <list>.
12179         (class Script_sections): Change Sections_elements from std::vector
12180         to std::list.  Typedef public Elements_iterator.  Add
12181         orphan_section_placement_, data_segment_align_start_, and
12182         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12183         field.
12184         * script-sections.cc (class Orphan_section_placement): New class.
12185         (class Sections_element): Add virtual functions is_relro and
12186         orphan_section_init.  Remove virtual function place_orphan_here.
12187         (class Output_section_definition): Add is_relro and
12188         orphan_section_init.  Remove place_orphan_here.
12189         (class Orphan_output_section): Likewise.
12190         (Script_sections::Script_sections): Update for field changes.
12191         (Script_sections::data_segment_align): Set saw_data_segment_align_
12192         and data_segment_align_start_, not data_segment_align_index.
12193         (Script_sections::data_segment_relro_end): Check
12194         saw_data_segment_align_.  Use data_segment_align_start_ rather
12195         than data_segment_align_index_.
12196         (Script_sections::place_orphan): Rewrite to use
12197         Orphan_section_placement.
12198
12199 2009-03-17  Ian Lance Taylor  <iant@google.com>
12200
12201         * archive.cc (Archive::add_symbols): Check for a version attached
12202         to the symbol name in the archive map.
12203         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12204         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12205         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12206         (ver_test_11.a): New target.
12207         * testsuite/Makefile.in: Rebuild.
12208
12209         * configure.ac: Check for chsize and posix_fallocate.  Replace
12210         ftruncate.
12211         * ftruncate.c: New file, from gnulib.
12212         * output.cc (posix_fallocate): Define dummy version if not
12213         HAVE_POSIX_FALLOCATE.
12214         (Output_file::map): Call posix_fallocate rather than lseek and
12215         write.
12216         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12217         * configure, Makefile.in, config.in: Rebuild.
12218
12219 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12220
12221         * layout.h (Layout::create_note): Add section_name parameter.
12222         * layout.cc (Layout::create_note): Likewise.
12223         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12224
12225 2009-03-17  Ian Lance Taylor  <iant@google.com>
12226
12227         * descriptors.cc: Include "options.h".
12228         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12229         (Descriptors::open): Always use O_CLOEXEC when opening a new
12230         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12231         then set FD_CLOEXEC.
12232
12233         * sparc.cc (class Target_sparc): Add has_got_section.
12234         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12235         make sure we have a GOT section.
12236
12237         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12238         (Target_sparc::Scan::local): Likewise.
12239         (Target_sparc::Scan::global): Likewise.
12240         (Target_sparc::Relocate::relocate): Likewise.
12241         (Target_sparc::Relocate::relocate_tls): Likewise.
12242
12243         * symtab.cc (Symbol_table::define_default_version): New function,
12244         broken out of add_from_object.
12245         (Symbol_table::add_from_object): Call define_default_version.
12246         (Symbol_table::define_special_symbol): Add resolve_oldsym
12247         parameter.  Change all callers.  If the version for a symbol comes
12248         from a version script, resolve it with the symbol with the same
12249         name with no version.  Also add the symbol without a version if
12250         appropriate.
12251         (do_define_in_output_data): If resolving with oldsym, don't delete
12252         sym.
12253         (do_define_in_output_segment): Likewise.
12254         (do_define_as_constant): Likewise.
12255         * symtab.h (class Symbol_table): Update declarations.
12256
12257 2009-03-13  Ian Lance Taylor  <iant@google.com>
12258
12259         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12260         (Read_symbols::requeue): New function.
12261         (Read_symbols::do_read_symbols): If make_elf_object fails because
12262         the target type is not configured, and the file was searched for,
12263         issue a warning and retry with the next directory.
12264         (Add_symbols::run): If the file has an incompatible format, and
12265         it was searched for, requeue the Read_symbols task.  On error,
12266         release the object.
12267         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12268         dirindex parameter to constructor.  Change all callers.  Declare
12269         incompatible_warning and requeue.
12270         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12271         input_argument_ and input_group_ fields.  Add them to
12272         constructor.  Change all callers.
12273         (class Read_script): Add dirindex_ field.  Add it to constructor.
12274         Change all callers.
12275         * archive.cc (Archive::setup): Remove input_objects parameter.
12276         Change all callers.
12277         (Archive::get_file_and_offset): Likewise.
12278         (Archive::read_all_symbols): Likewise.
12279         (Archive::read_symbols): Likewise.
12280         (Archive::get_elf_object_for_member): Remove input_objects
12281         parameter.  Add punconfigured parameter.  Change all callers.
12282         (Archive::add_symbols): Change return type to bool.  Check return
12283         value of include_member.
12284         (Archive::include_all_members): Likewise.
12285         (Archive::include_member): Change return type to bool.  Return
12286         false if first included object has incompatible target.  Set
12287         included_member_ field.
12288         (Add_archive_symbols::run): If add_symbols returns false, requeue
12289         Read_symbols task.
12290         * archive.h (class Archive): Add included_member_ field.
12291         Initialize it in constructor.  Add input_file and searched_for
12292         methods.  Update declarations.
12293         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12294         input_argument_ fields.  Add them to constructor.  Change all
12295         callers.
12296         * script.cc: Include "target-select.h".
12297         (class Parser_closure): Add skip_on_incompatible_target_ and
12298         found_incompatible_target_ fields.  Add
12299         skip_on_incompatible_target parameter to constructor.  Change all
12300         callers.  Add methods skip_on_incompatible_target,
12301         clear_skip_on_incompatible_target, found_incompatible_target, and
12302         set_found_incompatible_target.
12303         (read_input_script): Add dirindex parameter.  Change all callers.
12304         If parser finds an incompatible target, requeue Read_symbols
12305         task.
12306         (script_set_symbol): Clear skip_on_incompatible_target in
12307         closure.
12308         (script_add_assertion, script_parse_option): Likewise.
12309         (script_start_sections, script_add_phdr): Likewise.
12310         (script_check_output_format): New function.
12311         * script.h (read_input_script): Update declaration.
12312         * script-c.h (script_check_output_format): Declare.
12313         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12314         (ignore_cmd): Remove OUTPUT_FORMAT.
12315         * fileread.cc (Input_file::Input_file): Add explicit this.
12316         (Input_file::will_search_for): New function.
12317         (Input_file::open): Add pindex parameter.  Change all callers.
12318         * fileread.h (class Input_file): Add input_file_argument method.
12319         Declare will_search_for.  Update declarations.
12320         * object.cc (make_elf_object): Add punconfigured parameter.
12321         Change all callers.
12322         * object.h (class Object): Make input_file public.  Add
12323         searched_for method.
12324         (make_elf_object): Update declaration.
12325         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12326         restart search.
12327         * dirsearch.h (class Dirsearch): Update declaration.
12328         * options.h (class General_options): Add --warn-search-mismatch.
12329         * parameters.cc (Parameters::is_compatible_target): New function.
12330         * parameters.h (class Parameters): Declare is_compatible_target.
12331         * workqueue.cc (Workqueue::add_blocker): New function.
12332         * workqueue.h (class Workqueue): Declare add_blocker.
12333
12334         * fileread.cc (Input_file::open): Remove options parameter.
12335         Change all callers.
12336         (Input_file::open_binary): Likewise.
12337         * script.cc (read_input_script): Likewise.
12338         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12339         options parameter from constructor.  Change all callers.
12340         (class Read_script): Likewise.
12341         * fileread.h (class Input_file): Update declarations.
12342         * script.h (read_input_script): Update declaration.
12343
12344 2009-03-10  Nick Clifton  <nickc@redhat.com>
12345
12346         * po/es.po: New Spanish translation.
12347
12348 2009-03-06  Cary Coutant  <ccoutant@google.com>
12349
12350         * options.cc (parse_short_option): Keep dash_z from registering itself.
12351
12352 2009-03-03  Ian Lance Taylor  <iant@google.com>
12353
12354         PR 9918
12355         * target-reloc.h (relocate_section): Pass output_section to
12356         relocate.
12357         * i386.cc (Target_i386::should_apply_static_reloc): Add
12358         output_section parameter.  Change all callers.
12359         (Target_i386::Relocate::relocate): Add output_section parameter.
12360         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12361         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12362         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12363         * testsuite/two_file_shared.sh: New script.
12364         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12365         (check_DATA): Add two_file_shared.dbg.
12366         (two_file_shared.dbg): New target.
12367         * testsuite/Makefile.in: Rebuild.
12368
12369 2009-03-01  Ian Lance Taylor  <iant@google.com>
12370
12371         * configure.ac: Check for byteswap.h.
12372         * configure: Rebuild.
12373         * config.in: Rebuild.
12374
12375 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12376
12377         * layout.cc (Layout::find_or_add_kept_section): New function.
12378         (Layout::add_comdat): Removed.
12379         * layout.h (struct Kept_section): Move out of class Layout.
12380         Remove trailing underscores from field names.  Add group_sections
12381         field.  Rename group_ field to is_group.  Change all uses.
12382         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12383         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12384         comdat_groups_ field.
12385         (Sized_relobj::include_section_group): Use
12386         find_or_add_kept_section and Kept_section::group_sections.
12387         (Sized_relobj::include_linkonce_section): Likewise.
12388         * object.cc (class Sized_relobj): Don't define Comdat_group or
12389         Comdat_group_table.  Remove find_comdat_group and
12390         add_comdat_group.  Remove comdat_groups_ field.
12391         * plugin.cc (include_comdat_group): Use
12392         Layout::find_or_add_kept_section.
12393
12394 2009-02-28  Ian Lance Taylor  <iant@google.com>
12395
12396         * README: --gc-sections and map files are now supported.  Document
12397         some build requirements.
12398
12399         PR 6992
12400         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12401         relocatable link set the value of the section symbol to zero.
12402         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12403         relocatable link don't include the section address in the local
12404         symbol value.
12405
12406 2009-02-27  Ian Lance Taylor  <iant@google.com>
12407
12408         PR 6811
12409         * options.h (class Search_directory): Add is_system_directory.
12410         (class General_options): Declare is_in_system_directory.
12411         * options.cc (get_relative_sysroot): Make static.
12412         (get_default_sysroot): Make static.
12413         (General_optoins::is_in_system_directory): New function.
12414         * fileread.cc (Input_file::is_in_system_directory): New function.
12415         * fileread.h (class Input_file): Declare is_in_system_directory.
12416         * object.h (class Object): Add is_in_system_directory.
12417         (class Input_objects): Remove system_library_directory_ field.
12418         * object.cc (Input_objects::add_object): Don't set
12419         system_library_directory_.
12420         (input_objects::found_in_system_library_directory): Remove.
12421         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12422         parameter.  Change all callers.
12423         (Symbol_table::sized_write_globals): Likewise.
12424         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12425         Call Object::is_in_system_directory.
12426         * symtab.h (class Symbol_table): Update declarations.
12427
12428         PR 5990
12429         * descriptors.h (Open_descriptor): Add is_on_stack field.
12430         * descriptors.cc (Descriptors::open): If the descriptor is on the
12431         top of the stack, remove it.  Initialize is_on_stack field.
12432         (Descriptors::release): Only add pod to stack if it is not on the
12433         stack already.
12434         (Descriptors::close_some_descriptor): Clear stack_next and
12435         is_on_stack fields.
12436
12437         PR 7091
12438         * output.cc (Output_section::find_starting_output_address): Rename
12439         from starting_output_address; add PADDR parameter; change return
12440         type.
12441         * output.h (class Output_section): Declare
12442         find_starting_output_address instead of starting_output_address.
12443         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12444         section symbol for which we can't find a merge section.
12445
12446         PR 9836
12447         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12448         hidden or internal, force the symbol to be local.
12449         * resolve.cc (Symbol::override_visibility): Define.
12450         (Symbol::override_base): Use override_visibility.
12451         (Symbol_table::resolve): Likewise.
12452         (Symbol::override_base_with_special): Likewise.
12453         (Symbol_table::override_with_special): If the visibility is hidden
12454         or internal, force the symbol to be local.
12455         * symtab.h (class Symbol): Add set_visibility and
12456         override_visibility.
12457         * testsuite/ver_test_1.sh: New file.
12458         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12459         (check_DATA): Add ver_test_1.syms.
12460         (ver_test_1.syms): New target.
12461         * testsuite/Makefile.in: Rebuild.
12462
12463 2009-02-25  Cary Coutant  <ccoutant@google.com>
12464
12465         * layout.cc (Layout::choose_output_section): Don't rename sections
12466         when using a linker script that has a SECTIONS clause.
12467         * Makefile.in: Regenerate.
12468
12469         * testsuite/Makefile.am (script_test_5.sh): New test case.
12470         * testsuite/Makefile.in: Regenerate.
12471         * testsuite/script_test_5.cc: New file.
12472         * testsuite/script_test_5.sh: New file.
12473         * testsuite/script_test_5.t: New file.
12474
12475 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12476
12477         * archive.cc (Archive::include_member): Update calls to add_symbols.
12478         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12479         the Layout argument.
12480         * dynobj.h (do_add_symbols): Add the Layout argument.
12481         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12482         Layout argument.
12483         * object.h (Object::add_symbols): Add the Layout argument.
12484         (Object::do_add_symbols): Add the Layout argument.
12485         (Sized_relobj::do_add_symbols): Add the Layout argument.
12486         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12487         Unify the two versions.
12488         (Add_plugin_symbols): Remove.
12489         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12490         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12491         (Add_plugin_symbols): Remove.
12492         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12493         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12494         (Add_symbols::run): Make it work with Pulginobj.
12495
12496 2009-02-06  Ian Lance Taylor  <iant@google.com>
12497
12498         * object.cc (Sized_relobj::do_layout): Make info message start
12499         with lower case letter.
12500
12501 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12502
12503         * binary.cc: Fix file comment.
12504
12505         * options.h (enum Incremental_disposition): Define.
12506         (class General_options): Add new options: --incremental,
12507         --incremental_changed, --incremental_unchanged,
12508         --incremental_unknown.  Add incremental_disposition_ and
12509         implicit_incremental_ fields.
12510         (General_options::incremental_disposition): New function.
12511         (class Position_dependent_options): Add incremental_disposition
12512         option.
12513         (Position_dependent_options::copy_from_options): Set incremental
12514         dispositions.
12515         * options.cc (General_options::parse_incremental_changed): New
12516         function.
12517         (General_options::parse_incremental_unchanged): New function.
12518         (General_options::parse_incremental_unknown): New function.
12519         (General_options::General_options): Initialize new fields
12520         incremental_disposition_ and implicit_incremental_.
12521         (General_options::finalize): Check for uasge of --incremental-*
12522         without --incremental.
12523
12524 2009-02-06  Chris Demetriou  <cgd@google.com>
12525
12526         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12527         pointer and to report location as the file name associated with
12528         the symbol.
12529         (gold_undefined_symbol_at_location): New function to replace the
12530         old gold_undefined_symbol functionality.
12531         * target-reloc.h (relocate_section): Update to use
12532         gold_undefined_symbol_at_location.
12533         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12534         Call gold_undefined_symbol function rather than gold_error.
12535         * errors.h (Errors::undefined_symbol): Take location as a
12536         string, rather than calculating it from a relocation.
12537         * errors.cc (Errors::fatal): Print "fatal error:" before the
12538         formatted message.
12539         (Errors::error, Errors::error_at_location): Print "error: "
12540         before the formatted message.
12541         (Errors::undefined_symbol): Take location as a string, rather
12542         than calculating it from a relocation.
12543         (gold_undefined_symbol_at_location): New function akin to
12544         old gold_undefined_symbol, calculates location from relocation.
12545         (gold_undefined_symbol): Change to take only a Symbol pointer
12546         and to report location as the file name associated with the symbol.
12547         * testsuite/debug_msg.sh: Update for changed error messages.
12548         * testsuite/undef_symbol.sh: Likewise.
12549
12550 2009-02-04  Duncan Sands  <baldrick@free.fr>
12551
12552         PR 9812
12553         * reduced_debug_output.h
12554         (Output_reduced_debug_abbrev_section::failed): Use format for
12555         gold_warning.
12556         (Output_reduced_debug_info_section::faild): Likewise.
12557
12558 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12559
12560         * script.cc (Lazy_demangler): New class.
12561         (Version_script_info::get_symbol_version_helper): Demangle a
12562         symbol only once.
12563
12564 2009-01-29  Cary Coutant  <ccoutant@google.com>
12565
12566         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12567         to __tls_get_addr.
12568         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12569
12570 2009-01-28  Ian Lance Taylor  <iant@google.com>
12571
12572         * version.cc (version_string): Bump to 1.9.
12573
12574         * gold.h: Include <cstring> and <stdint.h>.
12575         * version.cc: Include <cstdio>.
12576         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12577         warning.
12578         * reduced_debug_output.cc (insert_into_vector): Rename from
12579         Insert_into_vector; change all callers.  Use Swap_unaligned to
12580         avoid aliasing issue; remove union since it is unnecessary.
12581
12582 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12583
12584         * Makefile.am (CCFILES): Add gc.cc.
12585         (HFILES): Add gc.h.
12586         * Makefile.in: Regenerate.
12587         * gold.cc (Gc_runner): New class.
12588         (queue_initial_tasks): Call garbage collection related tasks
12589         when corresponding options are invoked.
12590         (queue_middle_gc_tasks): New function.
12591         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12592         processed early before laying out sections during garbage collection.
12593         * gold.h (queue_middle_gc_tasks): New function.
12594         (is_prefix_of): Move from "layout.cc".
12595         * i386.cc (Target_i386::gc_process_relocs): New function.
12596         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12597         * main.cc (main): Create object of class "Garbage_collection".
12598         * object.cc (Relobj::copy_symbols_data): New function.
12599         (Relobj::is_section_name_included): New function.
12600         (Sized_relobj::do_layout): Allow this function to be called twice
12601         during garbage collection and defer layout of section during the
12602         first call.
12603         * object.h (Relobj::get_symbols_data): New function.
12604         (Relobj::is_section_name_included): New function.
12605         (Relobj::copy_symbols_data): New function.
12606         (Relobj::set_symbols_data): New function.
12607         (Relobj::get_relocs_data): New function.
12608         (Relobj::set_relocs_data): New function.
12609         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12610         (Relobj::gc_process_relocs): New function.
12611         (Relobj::do_gc_process_relocs): New pure virtual function.
12612         (Relobj::sd_): New data member.
12613         (Sized_relobj::is_output_section_offset_invalid): New function.
12614         (Sized_relobj::do_gc_process_relocs): New function.
12615         * options.h (General_options::gc_sections): Modify to not be a no-op.
12616         (General_options::print_gc_sections): New option.
12617         * plugin.cc (Plugin_finish::run): Remove function call to
12618         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12619         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12620         * reloc.cc (Read_relocs::run): Add task to process relocs and
12621         determine unreferenced sections when doing garbage collection.
12622         (Gc_process_relocs): New class.
12623         (Sized_relobj::do_gc_process_relocs): New function.
12624         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12625         sections that are garbage collected.
12626         * reloc.h (Gc_process_relocs): New class.
12627         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12628         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12629         symbols whose corresponding sections are garbage collected.
12630         (Symbol_table::Symbol_table): Add new parameter for the garbage
12631         collection object.
12632         (Symbol_table::gc_mark_undef_symbols): New function.
12633         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12634         (Symbol_table::gc_mark_dyn_syms): New function.
12635         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12636         as garbage.
12637         (Symbol_table::add_from_object): Likewise.
12638         (Symbol_table::add_from_relobj): When building shared objects, do not
12639         treat externally visible symbols as garbage.
12640         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12641         table information for static and relocatable links.
12642         * symtab.h (Symbol_table::set_gc): New function.
12643         (Symbol_table::gc): New function.
12644         (Symbol_table::gc_mark_undef_symbols): New function.
12645         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12646         (Symbol_table::gc_mark_dyn_syms): New function.
12647         (Symbol_table::gc_): New data member.
12648         * target.h (Sized_target::gc_process_relocs): New pure virtual
12649         function.
12650         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12651         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12652
12653 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12654
12655         * options.h (General_options::gc_sections): Define as a no-op for now.
12656         (General_options::no_keep_memory): Ditto.
12657         (General_options::Bshareable): Define.
12658         * options.cc (General_options::finalize): Honor -Bshareable.
12659
12660 2009-01-20  Andreas Schwab  <schwab@suse.de>
12661
12662         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12663         read the value in the contents, since we don't use it.  Use the
12664         template endianness when writing.
12665         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12666
12667 2009-01-19  Andreas Schwab  <schwab@suse.de>
12668
12669         * configure.tgt (powerpc64-*): Fix targ_obj.
12670
12671 2009-01-15  Ian Lance Taylor  <iant@google.com>
12672
12673         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12674         local symbols when stripping all symbols.
12675
12676 2009-01-14  Cary Coutant  <ccoutant@google.com>
12677
12678         * output.cc (Output_reloc): Add explicit instantiations.
12679
12680 2009-01-14  Cary Coutant  <ccoutant@google.com>
12681
12682         * archive.cc (Archive::get_elf_object_for_member): Remove call
12683         to File_read::claim_for_plugin.
12684         * descriptors.cc (Descriptors::open): Remove reference to
12685         is_claimed.
12686         (Descriptors::claim_for_plugin): Remove.
12687         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12688         (Descriptors::is_claimed): Remove.
12689         (claim_descriptor_for_plugin): Remove.
12690         * fileread.cc (File_read::claim_for_plugin): Remove.
12691         * fileread.h (File_read::claim_for_plugin): Remove.
12692         (File_read::descriptor): Reopen descriptor if necessary.
12693         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12694         (Plugin_manager::all_symbols_read): Add task parameter. Change
12695         all callers.
12696         (Plugin_manager::get_input_file): New function.
12697         (Plugin_manager::release_input_file): New function.
12698         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12699         corresponding data member.
12700         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12701         and pass to base constructor. Change all callers.
12702         (get_input_file, release_input_file): New functions.
12703         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12704         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12705         (Plugin_manager::all_symbols_read): Add task parameter.
12706         (Plugin_manager::get_input_file): New function.
12707         (Plugin_manager::release_input_file): New function.
12708         (Plugin_manager::task_): New data member.
12709         (Pluginobj::Pluginobj): Add filesize parameter.
12710         (Pluginobj::filename): New function.
12711         (Pluginobj::descriptor): New function.
12712         (Pluginobj::filesize): New function.
12713         (Pluginobj::filesize_): New data member.
12714         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12715         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12716         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12717
12718         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12719         with archive libraries.
12720         * testsuite/Makefile.in: Regenerate.
12721         * testsuite/plugin_test.c (struct sym_info): New type.
12722         (get_input_file, release_input_file): New static variables.
12723         (onload): Capture new transfer vector entries.
12724         (claim_file_hook): Stop reading at end of file according to filesize.
12725         Factor out parsing of readelf output into separate function.
12726         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12727         APIs and get the source file name from the symbol table.  Convert
12728         source file name to corresponding object file name.  Print info
12729         message when adding new input files.
12730         (parse_readelf_line): New function.
12731         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12732         * testsuite/plugin_test_2.sh: Likewise.
12733         * testsuite/plugin_test_3.sh: Likewise.
12734         * testsuite/plugin_test_4.sh: New test case.
12735
12736 2009-01-07  Ian Lance Taylor  <iant@google.com>
12737
12738         * version.cc (version_string): Bump to 1.8.
12739
12740 2008-12-23  Cary Coutant  <ccoutant@google.com>
12741
12742         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12743         * plugin.cc (Plugin_manager::finish): Rename as
12744         layout_deferred_objects.  Move cleanup to separate function.
12745         (Plugin_manager::cleanup): New function.
12746         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12747         separately.
12748         * plugin.h (Plugin_manager::finish): Rename as
12749         layout_deferred_objects.
12750         (Plugin_manager::cleanup): New function.
12751         (Plugin_manager::cleanup_done): New field.
12752
12753 2008-12-23  Cary Coutant  <ccoutant@google.com>
12754
12755         * plugin.cc (is_visible_from_outside): New function.
12756         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12757         so we don't return "IR only" status for exported symbols or -r links.
12758
12759         * testsuite/Makefile.am (plugin_test_3): New test case.
12760         * testsuite/Makefile.in: Regenerate.
12761         * testsuite/plugin_test_3.sh: New file.
12762
12763 2008-12-22  Cary Coutant  <ccoutant@google.com>
12764
12765         * object.cc (Sized_relobj::layout_section): New function.
12766         (Sized_relobj::do_layout): Defer layout of input sections until after
12767         plugin has provided replacement files.
12768         (Sized_relobj::do_layout_deferred_sections): New function.
12769         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12770         (Relobj::layout_deferred_sections): New function.
12771         (Relobj::do_layout_deferred_sections): New function.
12772         (Sized_relobj::do_layout_deferred_sections): New function.
12773         (Sized_relobj::layout_section): New function.
12774         (Sized_relobj::Deferred_layout): New structure.
12775         (Sized_relobj::deferred_layout_): New field.
12776         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12777         Change all callers.  Layout deferred sections.
12778         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12779         references.
12780         (Plugin_hook::run): Move code from do_plugin_hook inline.
12781         (Plugin_hook::do_plugin_hook): Remove.
12782         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12783         (Plugin_manager::finish): Renamed, was cleanup.
12784         (Plugin_manager::should_defer_layout): New function.
12785         (Plugin_manager::add_deferred_layout_object): New function.
12786         (Plugin_manager::Deferred_layout_list): New type.
12787         (Plugin_manager::deferred_layout_objects_): New field.
12788         (Plugin_hook::do_plugin_hook): Remove.
12789
12790 2008-12-17  Ian Lance Taylor  <iant@google.com>
12791
12792         * options.h (class General_options): Add --no case for
12793         --export-dynamic.
12794
12795 2008-12-16  Cary Coutant  <ccoutant@google.com>
12796
12797         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12798         vector.
12799         (Plugin_manager::claim_file): Create plugin object even if
12800         plugin did not call the add_symbols callback.
12801         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12802         asking for more symbols than were added.
12803         * testsuite/Makefile.am (plugin_test_1): Add test case with
12804         no global symbols.
12805         (empty.syms): New target.
12806         * testsuite/Makefile.in: Regenerate.
12807         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12808         message. Don't call add_symbols if no globals.
12809         (all_symbols_read_hook): Don't provide replacement for empty
12810         claimed file.
12811
12812 2008-12-12  Ian Lance Taylor  <iant@google.com>
12813
12814         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12815         r_type == 0 for a local symbol with r_sym == 0.
12816         (scan_relocatable_relocs): Pass r_sym to
12817         local_non_section_strategy.
12818         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12819         r_sym parameter.
12820
12821         * configure.ac: Update test for TLS descriptors: they are
12822         supported as of glibc 2.9.
12823         * configure: Rebuild.
12824
12825 2008-12-11  Ian Lance Taylor  <iant@google.com>
12826
12827         PR 7091
12828         * target-reloc.h (Default_scan_relocatable_relocs): For each
12829         function, map r_type == 0 to RELOC_DISCARD.
12830
12831 2008-12-10  Cary Coutant  <ccoutant@google.com>
12832
12833         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12834         object to override a kept COMDAT group from a plugin object.
12835
12836 2008-12-09  Ian Lance Taylor  <iant@google.com>
12837
12838         PR 7088
12839         * yyscript.y (file_cmd): Handle INPUT.
12840
12841         * testsuite/initpri1.c: Change all declarations to be full
12842         prototypes by adding void, to avoid compiler warnings.
12843
12844 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12845
12846         * options.cc (General_options::parse_plugin_opt): New.
12847         (General_options::add_plugin): The argument now is just the filename.
12848         (General_options::add_plugin_option): New.
12849         * options.h (plugin_opt): New.
12850         (add_plugin): Change argument name.
12851         (add_plugin_option): New.
12852         * plugin.cc (Plugin::load): Don't parse the plugin option.
12853         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12854         (Plugin::add_option): New.
12855         (Plugin::args_): Change type.
12856         (Plugin::filename_): New.
12857         (Plugin_manager::add_plugin_option): New.
12858         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12859         * testsuite/Makefile.in: Regenerate.
12860
12861 2008-12-05  Cary Coutant  <ccoutant@google.com>
12862
12863         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12864         Handle --strip-lto-sections option.
12865         * options.h (strip_lto_sections): New option.
12866
12867 2008-12-01  Cary Coutant  <ccoutant@google.com>
12868
12869         * plugin.cc (ld_plugin_message): Change format parameter to const.
12870         Fix mismatch between new[] and delete.
12871
12872 2008-11-14  Cary Coutant  <ccoutant@google.com>
12873
12874         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12875         instead of -1U.
12876
12877 2008-11-05  Craig Silverstein  <csilvers@google.com>
12878
12879         * options.cc (General_options::parse_dynamic_list): New function.
12880         * options.h (General_options): New flags dynamic_list,
12881         dynamic_list_data, dynamic_list_cpp_new, and
12882         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12883         (General_options::in_dynamic_list): New function.
12884         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12885         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12886         (Lex::can_continue_name): Likewise.
12887         (yylex): Likewise.
12888         (read_script_file): New parameter script_options.
12889         (read_dynamic_list): New function.
12890         (Script_options::define_dynamic_list): New function.
12891         (dynamic_list_keyword_parsecodes): New variable.
12892         (dynamic_list_keywords): New variable.
12893         * script.h (Script_options::define_dynamic_list): New function
12894         prototype.
12895         (read_dynamic_list): New function prototype.
12896         * symtab.cc (strprefix): New macro.
12897         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12898         dynamic_list_data, dynamic_list_cpp_new, and
12899         dynamic_list_cpp_typeinfo.
12900         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12901         (dynamic_list_expr): New rule.
12902         (dynamic_list_nodes): Likewise.
12903         (dynamic_list_node): Likewise.
12904         * testsuite/Makefile.am (dynamic_list): New test.
12905         * testsuite/Makefile.in: Regenerated.
12906         * testsuite/dynamic_list.t: New file.
12907         * testsuite/dynamic_list.sh: New file.
12908
12909 2008-11-05  Craig Silverstein  <csilvers@google.com>
12910
12911         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12912         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12913         (t11_last): Likewise.
12914         * testsuite/ver_test_6.c (main): Likewise.
12915
12916 2008-10-07  Cary Coutant  <ccoutant@google.com>
12917
12918         * options.c (General_options::finalize): Add check for -static and
12919         -shared.
12920         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12921         is not empty.
12922
12923 2008-10-02  Cary Coutant  <ccoutant@google.com>
12924
12925         * plugin.cc (make_sized_plugin_object): Fix conditional
12926         compilation to work when not all targets are enabled.
12927
12928 2008-09-29  Cary Coutant  <ccoutant@google.com>
12929
12930         * archive.cc (Archive::get_file_and_offset): Use filename instead
12931         of name to get library path.
12932         (Archive::include_member): Unlock external member of a thin archive.
12933
12934         * testsuite/Makefile.am (TEST_AR): New variable.
12935         (thin_archive_test_1): New test.
12936         (thin_archive_test_2): New test.
12937         * testsuite/Makefile.in: Regenerate.
12938         * testsuite/thin_archive_main.cc: New file.
12939         * testsuite/thin_archive_test_1.cc: New file.
12940         * testsuite/thin_archive_test_2.cc: New file.
12941         * testsuite/thin_archive_test_3.cc: New file.
12942         * testsuite/thin_archive_test_4.cc: New file.
12943
12944 2008-09-29  Cary Coutant  <ccoutant@google.com>
12945
12946         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12947         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12948         instead of -1U.
12949         (Sized_relobj::do_finalize_local_symbols): Likewise.
12950         (Sized_relobj::map_to_kept_section): Likewise.
12951         * object.h (Sized_relobj::invalid_address): New constant.
12952         (Sized_relobj::do_output_section_offset): Check for invalid_address
12953         and return -1ULL.
12954         * output.cc (Output_reloc::local_section_offset): Use constant
12955         invalid_address instead of -1U.
12956         (Output_reloc::get_address): Likewise.
12957         (Output_section::output_address): Change -1U to -1ULL.
12958         * output.h (Output_reloc::invalid_address): New constant.
12959         * reloc.cc (Sized_relobj::write_sections): Use constant
12960         invalid_address instead of -1U.
12961         (Sized_relobj::relocate_sections): Likewise.
12962         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12963         values for merge sections.
12964         * target-reloc.h (relocate_for_relocatable): Use constant
12965         invalid_address instead of -1U.
12966
12967 2008-09-19  Cary Coutant  <ccoutant@google.com>
12968
12969         Add plugin functionality for link-time optimization (LTO).
12970         * configure.ac (plugins): Add --enable-plugins option.
12971         * configure: Regenerate.
12972         * config.in: Regenerate.
12973         * Makefile.am (LIBDL): New variable.
12974         (CCFILES): Add plugin.cc.
12975         (HFILES): Add plugin.h.
12976         (ldadd_var): Add LIBDL.
12977         * Makefile.in: Regenerate.
12978
12979         * archive.cc: Include "plugin.h".
12980         (Archive::setup): Don't preread archive symbols when using a plugin.
12981         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12982         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12983         files.
12984         (Archive::include_member): Add symbols from plugin objects.
12985         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12986         * descriptors.cc (Descriptors::open): Check for file descriptors
12987         abandoned by plugins.
12988         (Descriptors::claim_for_plugin): New function.
12989         * descriptors.h (Descriptors::claim_for_plugin): New function.
12990         (Open_descriptor::is_claimed): New field.
12991         (claim_descriptor_for_plugin): New function.
12992         * fileread.cc (File_read::claim_for_plugin): New function.
12993         * fileread.h (File_read::claim_for_plugin): New function.
12994         (File_read::descriptor): New function.
12995         * gold.cc: Include "plugin.h".
12996         (queue_initial_tasks): Add task to call plugin hooks for generating
12997         new object files.
12998         * main.cc: Include "plugin.h".
12999         (main): Load plugin libraries.
13000         * object.h (Pluginobj): Declare.
13001         (Object::pluginobj): New function.
13002         (Object::do_pluginobj): New function.
13003         (Object::set_target): New function.
13004         * options.cc: Include "plugin.h".
13005         (General_options::parse_plugin): New function.
13006         (General_options::General_options): Initialize plugins_ field.
13007         (General_options::add_plugin): New function.
13008         * options.h (Plugin_manager): Declare.
13009         (General_options): Add --plugin option.
13010         (General_options::has_plugins): New function.
13011         (General_options::plugins): New function.
13012         (General_options::add_plugin): New function.
13013         (General_options::plugins_): New field.
13014         * plugin.cc: New file.
13015         * plugin.h: New file.
13016         * readsyms.cc: Include "plugin.h".
13017         (Read_symbols::do_read_symbols): Check for archive before checking
13018         for ELF file.  Call plugin hooks to claim files.
13019         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13020         from a real object file; force override when processing replacement
13021         files.
13022         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13023         (Symbol::init_base_object): Likewise.
13024         (Symbol::init_base_output_data): Likewise.
13025         (Symbol::init_base_output_segment): Likewise.
13026         (Symbol::init_base_constant): Likewise.
13027         (Symbol::init_base_undefined): Likewise.
13028         (Symbol::output_section): Assert that object is not a plugin.
13029         (Symbol_table::add_from_pluginobj): New function.
13030         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13031         undefined.
13032         (Symbol_table::sized_write_globals): Likewise.
13033         (Symbol_table::add_from_pluginobj): Instantiate template.
13034         * symtab.h (Sized_pluginobj): Declare.
13035         (Symbol::in_real_elf): New function.
13036         (Symbol::set_in_real_elf): New function.
13037         (Symbol::in_real_elf_): New field.
13038         (Symbol_table::add_from_pluginobj): New function.
13039
13040         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13041         (LIBDL): New variable.
13042         (LDADD): Add LIBDL.
13043         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13044         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13045         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13046         (MOSTLYCLEANFILES): Likewise.
13047         * testsuite/Makefile.in: Regenerate.
13048         * testsuite/plugin_test.c: New file.
13049         * testsuite/plugin_test_1.sh: New file.
13050         * testsuite/plugin_test_2.sh: New file.
13051
13052 2008-09-16  Ian Lance Taylor  <iant@google.com>
13053
13054         * target-reloc.h (relocate_section): Check whether a symbol is
13055         defined by the ABI before reporting an undefined symbol error.
13056         * target.h (Target::is_defined_by_abi): Make parameter const.
13057         (Target::do_is_defined_by_abi): Likewise.
13058         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13059         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13060         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13061         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13062         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13063         * testsuite/Makefile.in: Rebuild.
13064
13065         * fileread.cc (make_view): Add casts to avoid warning.
13066
13067 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13068
13069         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13070         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13071
13072 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13073
13074         * options.h (General_options::output_is_executable): New.
13075         (General_options::output_is_pie): New.
13076         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13077         for shared libraries.
13078         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13079
13080 2008-09-11  Chris Demetriou  <cgd@google.com>
13081
13082         * options.h (origin): New -z option.
13083         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13084         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13085         in DT_FLAGS_1.
13086
13087 2008-09-05  Cary Coutant  <ccoutant@google.com>
13088
13089         * fileread.cc (File_read::make_view): Add check for attempt to map
13090         beyond end of file.
13091
13092 2008-09-05  Cary Coutant  <ccoutant@google.com>
13093
13094         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13095         explicit instantiations.
13096
13097 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13098
13099         PR gold/6858
13100         * options.cc (General_options::finalize): Allow undefined symbols
13101         in shlibs if linking -shared.
13102
13103         PR gold/6859
13104         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13105         symbols as not needing a dynsym entry.
13106
13107 2008-08-20  Craig Silverstein  <csilvers@google.com>
13108
13109         * fileread.cc (File_read::open): Do not lock the file unless it
13110         was successfully opened.
13111
13112 2008-08-14  Cary Coutant  <ccoutant@google.com>
13113
13114         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13115         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13116         * testsuite/tls_test.cc (struct int128): 128-bit struct
13117         for testing TLS relocs with non-zero addend.
13118         (v12): New TLS variable.
13119         (t12): New test.
13120         (t_last): Add check for v12.
13121         * testsuite/tls_test.h (t12): New function.
13122         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13123
13124 2008-08-13  Ian Lance Taylor  <iant@google.com>
13125
13126         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13127         set tls_segment_ or relro_segment_.
13128         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13129         when appropriate.
13130         * output.h (Output_section::clear_is_relro): New function.
13131         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13132         sections specially even when output_data_ is empty.
13133         (Output_segment::maximum_alignment): When first section is relro,
13134         only force alignment for PT_LOAD segments.
13135         * script.cc (script_data_segment_align): New function.
13136         (script_data_segment_relro_end): New function.
13137         * script-c.h (script_data_segment_align): Declare.
13138         (script_data_segment_relro_end): Declare.
13139         * script-sections.h (class Script_sections): Declare
13140         data_segment_align and data_segment_relro_end.  Add fields
13141         segment_align_index_ and saw_relro_end_.
13142         * script-sections.cc (class Sections_element): Add set_is_relro
13143         virtual function.  Add new bool* parameter to place_orphan_here.
13144         Add get_output_section virtual function.
13145         (class Output_section_definition): Add set_is_relro.  Add new
13146         bool* parameter to place_orphan_here.  Add get_output_section.
13147         Add is_relro_ field.
13148         (Output_section_definition::Output_section_definition): Initialize
13149         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13150         and is_relro_ fields.
13151         (Output_section_definition::place_orphan_here): Add is_relro
13152         parameter.
13153         (Output_section_definition::set_section_addresses): Set relro for
13154         output section.
13155         (Output_section_definition::alternate_constraint): Likewise.
13156         (class Orphan_output_section): Add new bool* parameter to
13157         place_orphan_here.  Add get_output_section.
13158         (Orphan_output_section::place_orphan_here): Add is_relro
13159         parameter.
13160         (Script_sections::Script_sections): Initialize
13161         data_segment_align_index_ and saw_relro_end_.
13162         (Script_sections::data_segment_align): New function.
13163         (Script_sections::data_segment_relro_end): New function.
13164         (Script_sections::place_orphan): Set or clear is_relro.
13165         (Script_sections::set_section_addresses): Force alignment of first
13166         TLS section.
13167         * yyscript.y (exp): Call script_data_segment_align and
13168         script_data_segment_relro_end.
13169         * testsuite/relro_script_test.t: New file.
13170         * testsuite/relro_test.cc (using_script): Declare.
13171         (t1, t2): Test using_script.
13172         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13173         (relro_script_test_SOURCES): Define.
13174         (relro_script_test_DEPENDENCIES): Define.
13175         (relro_script_test_LDFLAGS): Define.
13176         (relro_script_test_LDADD): Define.
13177         (relro_script_test.so): New target.
13178         * testsuite/Makefile.in: Rebuild.
13179
13180 2008-08-06  Cary Coutant <ccoutant@google.com>
13181
13182         * archive.cc (Archive::total_archives, Archive::total_members)
13183         (Archive::total_members_loaded): New variables.
13184         (Archive::setup): Add parameter.  Add option to preread
13185         archive symbols.
13186         (Archive::read_armap): Add counter.
13187         (Archive::get_file_and_offset): New function.
13188         (Archive::get_elf_object_for_member): New function.
13189         (Archive::read_all_symbols): New function.
13190         (Archive::read_symbols): New function.
13191         (Archive::add_symbols): Add counters.
13192         (Archive::include_all_members): Use armap to find members if it's
13193         already built.
13194         (Archive::include_member): Skip reading symbols if already read.
13195         Factored code into Archive::get_file_and_offset and
13196         Archive::get_elf_object_for_member.  Changed call to
13197         Mapfile::report_include_archive_member.
13198         (Archive::print_stats): New function.
13199         * archive.h: Declare Object and Read_symbols_data classes.
13200         (Archive::Archive): Add initializers for new members.
13201         (Archive::setup): Add parameter.
13202         (Archive::print_stats): New function.
13203         (Archive::total_archives, Archive::total_members)
13204         (Archive::total_members_loaded): New variables.
13205         (Archive::get_file_and_offset): New function.
13206         (Archive::get_elf_object_for_member): New function.
13207         (Archive::read_all_symbols): New function.
13208         (Archive::read_symbols): New function.
13209         (Archive::Archive_member): New class.
13210         (Archive::members_): New member.
13211         (Archive::num_members_): New member.
13212         * main.cc: Include archive.h.
13213         (main): Call Archive::print_stats.
13214         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13215         archive parameter; member_name is now the fully-decorated name.
13216         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13217         * options.h: (General_options): Add --preread-archive-symbols option.
13218         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13219         Archive::setup.
13220
13221 2008-08-04  Ian Lance Taylor  <iant@google.com>
13222
13223         * symtab.h (Symbol::use_plt_offset): New function.
13224         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13225         * powerpc.cc (Relocate::relocate): Likewise.
13226         * sparc.cc (Relocate::relocate): Likewise.
13227         * x86_64.cc (Relocate::relocate): Likewise.
13228         * testsuite/weak_plt.sh: New test.
13229         * testsuite/weak_plt_main.cc: New test.
13230         * testsuite/weak_plt_shared.cc: New test.
13231         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13232         (check_PROGRAMS): Add weak_plt.
13233         (check_DATA): Add weak_plt_shared.so.
13234         (weak_plt_main_pic.o, weak_plt): New targets.
13235         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13236         * testsuite/Makefile.in: Rebuild.
13237
13238         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13239         gcctestdir/ld.
13240         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13241         * testsuite/Makefile.in: Rebuild.
13242
13243 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13244
13245         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13246         * Makefile.in: Regenerate.
13247         * po/POTFILES.in: Regenerate.
13248
13249 2008-07-29  Ian Lance Taylor  <iant@google.com>
13250
13251         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13252         symbols before other symbols.
13253         * testsuite/script_test_2.cc (test_addr): Declare.
13254         (test_addr_alias): Declare.
13255         (main): Check that test_addr and test_addr_alias have the right
13256         values.
13257         * testsuite/script_test_2.t: Define test_addr_alias and
13258         test_addr.
13259
13260 2008-07-24  Ian Lance Taylor  <iant@google.com>
13261
13262         PR 5990
13263         * descriptors.cc: New file.
13264         * descriptors.h: New file.
13265         * gold-threads.h (class Hold_optional_lock): New class.
13266         * fileread.cc: Include "descriptors.h".
13267         (File_read::~File_read): Release descriptor rather than closing
13268         it.
13269         (File_read::open) [file]: Call open_descriptor rather than open.
13270         Set is_descriptor_opened_.
13271         (File_read::open) [memory]: Assert that descriptor is not open.
13272         (File_read::reopen_descriptor): New function.
13273         (File_read::release): Release descriptor.
13274         (File_read::do_read): Make non-const.  Reopen descriptor.
13275         (File_read::read): Make non-const.
13276         (File_read::make_view): Reopen descriptor.
13277         (File_read::do_readv): Likewise.
13278         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13279         Update declarations.
13280         * layout.cc: Include "descriptors.h".
13281         (Layout::create_build_id): Use open_descriptor rather than open.
13282         * output.cc: Include "descriptors.h".
13283         (Output_file::open): Use open_descriptor rather than open.
13284         * archive.cc (Archive::const_iterator): Change Archive to be
13285         non-const.
13286         (Archive::begin, Archive::end): Make non-const.
13287         (Archive::count_members): Likewise.
13288         * archive.h (class Archive): Update declarations.
13289         * object.h (Object::read): Make non-const.
13290         * Makefile.am (CCFILES): Add descriptors.cc.
13291         (HFILES): Add descriptors.h.
13292         * Makefile.in: Rebuild.
13293
13294         PR 6716
13295         * gold.h: Always include <clocale>.  Add Solaris workarounds
13296         following code in binutils/sysdep.h.
13297
13298         PR 6048
13299         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13300         this->eh_frame_hdr_ is NULL before using it.
13301
13302         * dynobj.cc (Versions::Versions): Update comment.
13303
13304         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13305         the base version name.
13306
13307         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13308         array size plus one.
13309         (Stringpool_template::set_string_offsets): Subtract one from key
13310         before using it as an array index.
13311         (Stringpool_template::get_offset_with_length): Likewise.
13312         (Stringpool_template::write_to_buffer): Likewise.
13313         * stringpool.h (Stringpool_template::get_offset_from_key):
13314         Likewise.
13315
13316 2008-07-23  Ian Lance Taylor  <iant@google.com>
13317
13318         PR 6658
13319         * object.h (Merged_symbol_value::value): Do our best to handle a
13320         negative addend.
13321
13322         PR 6647
13323         * script.cc (Version_script_info::get_versions): Don't add empty
13324         version tag to return value.
13325         (Version_script_info::get_symbol_version_helper): Change return
13326         type to bool.  Add pversion parameter.  Change all callers.
13327         (script_register_vers_node): Don't require a non-NULL tag.
13328         * script.h (class Version_script_info): Update declarations.
13329         (Version_script_info::get_symbol_version): Change return type to
13330         bool.  Add version parameter.  Change all callers.
13331         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13332         handling.  Handle an empty version from a version script.
13333         (Symbol_table::define_special_symbol): Likewise.
13334         * testsuite/ver_test_10.script: New file.
13335         * testsuite/ver_test_10.sh: New file.
13336         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13337         (check_DATA): Add ver_test_10.syms.
13338         (ver_test_10.syms, ver_test_10.so): New target.
13339         * testsuite/Makefile.in: Rebuild.
13340
13341 2008-07-23  Simon Baldwin  <simonb@google.com>
13342
13343         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13344         to zero for undefined symbols from dynamic libraries.
13345
13346 2008-07-23  Ian Lance Taylor  <iant@google.com>
13347
13348         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13349         Change all callers.
13350         * symtab.h (class Symbol_table): Update declaration.
13351         * testsuite/ver_test_9.cc: New file.
13352         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13353         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13354         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13355         (ver_test_9.so, ver_test_9.o): New targets.
13356         * testsuite/Makefile.in: Rebuild.
13357
13358 2008-07-22  Ian Lance Taylor  <iant@google.com>
13359
13360         * options.h (class General_options): Define --check-sections.
13361         * layout.cc (Layout::set_segment_offsets): Handle
13362         --check-sections.
13363
13364         * options.h (class General_options): Define -n/--nmagic and
13365         -N/--omagic.
13366         * options.cc (General_options::finalize): For -n/--nmagic or
13367         -N/--omagic, set -static.
13368         * layout.cc (Layout::attach_allocated_section_to_segment): If
13369         -N/--omagic, don't put read-only and read-write sections in
13370         different segments.
13371         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13372         finding a read-only segment.
13373         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13374         don't set the minimum segment alignment to the common page size,
13375         and don't set the file offset to the address modulo the page size.
13376         * script-sections.cc (Script_sections::create_segments): If
13377         -n/--omagic, don't put read-only and read-write sections in
13378         different segments.
13379
13380         * cref.cc: New file.
13381         * cref.h: New file.
13382         * options.h (class General_options): Add --print-symbol-counts.
13383         * main.cc (main): Issue defined symbol report if requested.
13384         * archive.cc (Archive::interpret_header): Make into a const member
13385         function.
13386         (Archive::add_symbols): Call Input_objects::archive_start and
13387         archive_stop.
13388         (Archive::const_iterator): Define new class.
13389         (Archive::begin, Archive::end): New functions.
13390         (Archive::include_all_members): Rewrite to use iterator.
13391         (Archive::count_members): New function.
13392         * archive.h (class Archive): Update declarations.
13393         (Archive::filename): New function.
13394         * object.cc: Include "cref.h".
13395         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13396         (Sized_relobj::do_get_global_symbol_counts): New function.
13397         (Input_objects::add_object): Add object to cross-referencer.
13398         (Input_objects::archive_start): New function.
13399         (Input_objects::archive_stop): New function.
13400         (Input_objects::print_symbol_counts): New function.
13401         * object.h: Declare Cref and Archive.
13402         (Object::get_global_symbol_counts): New function.
13403         (Object::do_get_global_symbol_counts): New pure virtual function.
13404         (class Sized_relobj): Add defined_count_ field.  Update
13405         declarations.
13406         (class Input_objects): Add cref_ field.  Update constructor.
13407         Update declarations.
13408         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13409         defined_count_.
13410         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13411         symbol counts.
13412         (Sized_dynobj::do_get_global_symbol_counts): New function.
13413         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13414         defined_count_.  Update declarations.  Define Symbols typedef.
13415         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13416         parameter.  Change all callers.
13417         (Symbol_table::add_from_dynobj): Add sympointers and defined
13418         parameters.  Change all callers.
13419         * symtab.h (class Symbol_table): Update declarations.
13420         * Makefile.am (CCFILES): Add cref.cc.
13421         (HFILES): Add cref.h.
13422         * Makefile.in: Rebuild.
13423
13424 2008-07-22  Simon Baldwin  <simonb@google.com>
13425
13426         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13427         to zero when writing undefined symbols.
13428
13429 2008-07-22  Ian Lance Taylor  <iant@google.com>
13430
13431         * output.cc (Output_section::add_input_section): Don't try to
13432         merge empty merge sections.
13433
13434 2008-07-21  Craig Silverstein  <csilvers@google.com>
13435
13436         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13437         Include symbol version in error message.
13438
13439 2008-07-20  Chris Demetriou  <cgd@google.com>
13440
13441         * configure.ac (gold_cv_c_random_seed): New configured variable.
13442         (RANDOM_SEED_CFLAGS): New substituted variable.
13443         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13444         * configure: Rebuild.
13445         * Makefile.in: Likewise.
13446         * testsuite/Makefile.in: Likewise.
13447
13448 2008-07-18  Ian Lance Taylor  <iant@google.com>
13449
13450         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13451         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13452         * testsuite/ver_test_main.cc (main): Call t4.
13453         (t4, t4_2a): Define.
13454         * testsuite/ver_test_2.cc (t4_2): Define.
13455         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13456         * testsuite/ver_test_4.cc (t4_2a): Define.
13457         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13458         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13459
13460 2008-07-17  Ian Lance Taylor  <iant@google.com>
13461
13462         * dynobj.cc (Versions::add_def): If we give an error about a
13463         missing version, go ahead and create the version anyhow.
13464
13465 2008-07-10  Ian Lance Taylor  <iant@google.com>
13466
13467         Handle output sections with more than 0x7fffffff bytes.
13468         * object.h (class Relobj): Change map_to_output_ to
13469         output_sections_, and just keep a section pointer.  Change all
13470         uses.  Move comdat group support to Sized_relobj.
13471         (Relobj::is_section_specially_mapped): Remove.
13472         (Relobj::output_section): Remove poff parameter.  Change all
13473         callers.
13474         (Relobj::output_section_offset): New function.
13475         (Relobj::set_section_offset): Rewrite.
13476         (Relobj::map_to_output): Remove.
13477         (Relobj::output_sections): New function.
13478         (Relobj::do_output_section_offset): New pure virtual function.
13479         (Relobj::do_set_section_offset): Likewise.
13480         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13481         group support from Relobj.  Update declarations.
13482         (Sized_relobj::get_output_section_offset): New function.
13483         (Sized_relobj::do_output_section_offset): New function.
13484         (Sized_relobj::do_set_section_offset): New function.
13485         * object.cc (Relobj::output_section_address): Remove.
13486         (Sized_relobj::Sized_relobj): Initialize new fields.
13487         (Sized_relobj::include_section_group): Cast find_kept_object to
13488         Sized_relobj.
13489         (Sized_relobj::include_linkonce_section): Likewise.
13490         (Sized_relobj::do_layout): Use separate arrays for output section
13491         and output offset.
13492         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13493         output_sections.
13494         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13495         output_sections and section_offsets.
13496         (Sized_relobj::write_local_symbols): Likewise.
13497         (map_to_kept_section): Compute output address directly.
13498         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13499         output_sections and section_offsets.
13500         (Sized_relobj::write_sections): Likewise.
13501         (Sized_relobj::relocate_sections): Likewise.
13502         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13503         * output.h (class Output_reloc): Update declarations.  Change
13504         u2_.relobj to Sized_relobj*.
13505         (class Output_data_reloc): Change add functions to use
13506         Sized_relobj*.
13507         * output.cc (Output_reloc::Output_reloc): Change relobj to
13508         Sized_relobj*.
13509         (Output_reloc::local_section_offset): Change return type to
13510         Elf_Addr.  Use get_output_section_offset.
13511         (Output_reloc::get_address): Likewise.
13512         (Output_section::is_input_address_mapped): Don't call
13513         is_section_specially_mapped.
13514         (Output_section::output_offset): Likewise.
13515         (Output_section::output_address): Likewise.
13516         (Output_section::starting_output_address): Likewise.
13517         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13518         parameter to Sized_relobj*.
13519         (Copy_relocs::need_copy_reloc): Likewise.
13520         (Copy_relocs::save): Likewise.
13521         * copy-relocs.h (class Copy_relocs): Update declarations.
13522         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13523         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13524         * target-reloc.h (relocate_for_relocatable): Change
13525         offset_in_output_section type to Elf_Addr.  Change code that uses
13526         it as well.
13527         * layout.cc (Layout::layout): Always set *off.
13528         * mapfile.cc (Mapfile::print_input_section): Use
13529         output_section_offset.
13530         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13531         Sized_relobj*.
13532         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13533         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13534         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13535
13536 2008-07-03  Ian Lance Taylor  <iant@google.com>
13537
13538         * layout.cc (Layout::include_section): Do not discard unrecognized
13539         SHT_STRTAB sections.
13540
13541 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13542
13543         * script.cc (Lex::can_continue_name): Make '?' allowable in
13544         version-script names.
13545         * testsuite/version_script.map: Change glob pattern to use '?'
13546
13547 2008-06-30  Manish Singh  <yosh@gimp.org>
13548
13549         PR 6585
13550         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13551         Correct typo.
13552
13553 2008-06-30  Ian Lance Taylor  <iant@google.com>
13554
13555         PR 6660
13556         PR 6682
13557         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13558         versions]: Don't try to read the value in the contents, since we
13559         don't use it.  Use the template endianness when writing.
13560
13561 2008-06-25  Cary Coutant  <ccoutant@google.com>
13562
13563         * fileread.cc (File_read::make_view): Assert on zero-length view.
13564         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13565         symbol table when there are no symbols to read.
13566
13567 2008-06-23  Craig Silverstein  <csilvers@google.com>
13568
13569         * version.cc (version_string): Bump to 1.7
13570
13571 2008-06-18  Craig Silverstein  <csilvers@google.com>
13572
13573         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13574         constant 0xFFFF to type Valtype.
13575         (Powerpc_relocate_functions::rel16_ha): Likewise.
13576
13577 2008-06-17  Ian Lance Taylor  <iant@google.com>
13578
13579         * output.h (Output_section::Input_section): Initialize p2align_ to
13580         zero for Output_section_data constructors.
13581         (Output_section::Input_section::addralign): If not an input
13582         section, return the alignment of the Output_section_data.
13583         * testsuite/copy_test.cc: New file.
13584         * testsuite/copy_test_1.cc: New file.
13585         * testsuite/copy_test_2.cc: New file.
13586         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13587         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13588         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13589         (copy_test_1_pic.o, copy_test_1.so): New targets.
13590         (copy_test_2_pic.o, copy_test_2.so): New targets.
13591         * testsuite/Makefile.in: Rebuild.
13592
13593         * script-sections.cc (Script_sections::place_orphan): Initialize
13594         local variable exact.
13595
13596 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13597
13598         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13599
13600 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13601             David S. Miller  <davem@davemloft.net>
13602
13603         * powerpc.cc: New file.
13604         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13605         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13606         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13607         * Makefile.in: Rebuild.
13608
13609 2008-06-09  Ian Lance Taylor  <iant@google.com>
13610
13611         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13612         <exception>.
13613         (throwing, orig_terminate): New static variables.
13614         (terminate_handler): New static function.
13615         (t2): Set terminate handler.
13616
13617 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13618
13619         PR 6584
13620         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13621         alignment.
13622
13623 2008-05-30  Cary Coutant  <ccoutant@google.com>
13624
13625         * archive.cc (Archive::include_all_members) Correct to step
13626         over symbol table and extended name table in thin archives.
13627
13628 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13629
13630         PR 6407
13631         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13632         calculation.
13633
13634 2008-05-28  Caleb Howe  <cshowe@google.com>
13635
13636         * reduced_debug_output.cc: New file.
13637         * reduced_debug_output.h: New file.
13638         * options.h (class General_options): Add --strip-debug-non-line.
13639         * options.cc (General_options::finalize): Add strip_debug_non_line
13640         to the strip heirarchy.
13641         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13642         fields.
13643         * layout.cc: Include "reduced_debug_output.h".
13644         (Layout::Layout): Initialize new fields.
13645         (line_only_debug_sections): New static array.
13646         (is_lines_only_debug_sections): New static inline function.
13647         (Layout::include_section): Handle --strip-debug-non-line.
13648         (Layout::make_output_section): If --strip-debug-non-line, build
13649         new output sections for .debug_abbrev and .debug_info.
13650         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13651         gold.  Warn about possible overflow.
13652         (read_signed_LEB_128): Likewise.
13653         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13654         (read_signed_LEB_128): Declare.
13655         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13656         (HFILES): Add reduced_debug_output.h.
13657         * Makefile.in: Rebuild.
13658
13659 2008-05-21  Ian Lance Taylor  <iant@google.com>
13660
13661         * mapfile.cc: New file.
13662         * mapfile.h: New file.
13663         * options.h (class General_options): Add -M/--print-map and -Map.
13664         * options.cc (General_options::finalize): Make -M equivalent to
13665         -Map -.
13666         * main.cc: Include <cstdio> and "mapfile.h".
13667         (main): Open mapfile if requested.
13668         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13669         constructor.  Change caller.
13670         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13671         (queue_middle_tasks): Likewise.
13672         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13673         declarations.
13674         * archive.cc: Include "mapfile.h".
13675         (Archive::add_symbols): Add mapfile parameter.  Change all
13676         callers.  Pass mapfile, symbol, and reason to include_member.
13677         (Archive::include_all_members): Add mapfile parameter.  Change all
13678         callers.
13679         (Archive::include_member): Add mapfile, sym, and why parameters.
13680         Change all callers.  Report inclusion to map file.
13681         * archive.h: Include "fileread.h".
13682         (class Archive): Update declarations.
13683         (Archive::file): New const method.
13684         (class Add_archive_symbols): Add mapfile_ field.  Update
13685         constructor.  Change all callers.
13686         * readsyms.h (class Read_symbols): Likewise.
13687         (class Finish_group): Likewise.
13688         (class Read_script): Likewise.
13689         * common.cc: Include "mapfile.h".
13690         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13691         all callers.
13692         (Symbol_table::do_allocate_commons): Likewise.
13693         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13694         symbol allocation to mapfile.
13695         * common.h (class Allocate_commons_task): Add mapfile_ field.
13696         Update constructor.  Change all callers.
13697         * symtab.h (class Symbol_table): Update declarations.
13698         * layout.cc: Include "mapfile.h".
13699         (Layout_task_runner::run): Print information to mapfile.
13700         (Layout::create_gold_note): Change Output_data_fixed_space to
13701         Output_data_zero_fill.
13702         (Layout::create_build_id): Likewise.
13703         (Layout::print_to_mapfile): New function.
13704         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13705         constructor.  Change caller.
13706         (class Layout): Declare print_to_mapfile.
13707         * output.cc (Output_section::Input_section::print_to_mapfile): New
13708         function.
13709         (Output_section::add_input_section): If producing a map, always
13710         add to input_sections_ list.
13711         (Output_section::do_print_to_mapfile): New function.
13712         (Output_segment::print_sections_to_mapfile): New function.
13713         (Output_segment::print_section_list_to_mapfile): New function.
13714         * output.h: Include "mapfile.h".
13715         (Output_data::print_to_mapfile): New function.
13716         (Output_data::do_print_to_mapfile): New virtual function.
13717         (Output_segment_headers::do_print_to_mapfile): New function.
13718         (Output_file_header::do_print_to_mapfile): New function.
13719         (Output_data_const::do_print_to_mapfile): New function.
13720         (class Output_data_const_buffer): Add map_name_ field.  Update
13721         constructor.  Change all callers.  Add do_print_to_mapfile
13722         function.
13723         (class Output_data_fixed_space): Likewise.
13724         (class Output_data_space): Likewise.
13725         (class Output_data_zero_fill): New class.
13726         (Output_data_strtab::do_print_to_mapfile): New function.
13727         (Output_data_reloc_base::do_print_to_mapfile): New function.
13728         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13729         (Output_data_group::do_print_to_mapfile): New function.
13730         (Output_data_got::do_print_to_mapfile): New function.
13731         (Output_data_dynamic::do_print_to_mapfile): New function.
13732         (Output_symtab_xindex::do_print_to_mapfile): New function.
13733         (class Output_section): Declare do_print_to_mapflie.  Declare
13734         print_to_mapfile in Input_section.
13735         (class Output_segment): Declare new functions.
13736         * object.h (Sized_relobj::symbol_count): New function.
13737         * script-sections.cc
13738         (Output_section_element_dot_assignment::set_section_addresses):
13739         Change Output_data_fixed_space to Output_data_zero_fill.
13740         (Output_data_expression::do_print_to_mapfile): New function.
13741         * script.cc (read_input_script): Add mapfile parameter.  Change
13742         all callers.
13743         * script.h (read_input_script): Update declaration.
13744         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13745         (Eh_frame::do_print_to_mapfile): New function.
13746         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13747         (Output_merge_string::do_print_to_mapfile): New function.
13748         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13749         function.
13750         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13751         function.
13752         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13753         function.
13754         * Makefile.am (CCFILES): Add mapfile.cc.
13755         (HFILES): Add mapfile.h.
13756         * Makefile.in: Rebuild.
13757
13758 2008-05-19  Ian Lance Taylor  <iant@google.com>
13759
13760         * options.h (class General_options): Add -z relro.
13761         * layout.cc (Layout::Layout): Initialize relro_segment_.
13762         (Layout::add_output_section_data): Return the output section.
13763         (Layout::make_output_section): Rcognize relro sections and mark
13764         them appropriately.
13765         (Layout::attach_allocated_section_to_segment): Put relro sections
13766         in a PT_GNU_RELRO segment.
13767         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13768         section as relro.
13769         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13770         PT_TLS segments.
13771         (Layout::linkonce_mapping): Map d.rel.ro.local to
13772         .data.rel.ro.local.
13773         (Layout::output_section_name): Us .data.rel.ro.local for any
13774         section which begins with that.
13775         * layout.h (class Layout): Update add_output_section_data
13776         declaration.  Add relro_segment_ field.
13777         * output.cc (Output_section::Output_section): Initialize is_relro_
13778         and is_relro_local_ fields.
13779         (Output_segment::add_output_section): Group relro sections.
13780         (Output_segment::is_first_section_relro): New function.
13781         (Output_segment::maximum_alignment): If there is a relro section,
13782         align the segment to the common page size.
13783         (Output_segment::set_section_addresses): Track whether we are
13784         looking at relro sections.  If the last section is a relro
13785         section, align to the common page size.
13786         (Output_segment::set_section_list_addresses): Add in_relro
13787         parameter.  Change all callers.  Align to the page size when
13788         moving from relro to non-relro section.
13789         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13790         segment.
13791         * output.h (class Output_section): Add is_relro_ and
13792         is_relro_local_ fields.
13793         (Output_section::is_relro): New function.
13794         (Output_section::set_is_relro): New function.
13795         (Output_section::is_relro_local): New function.
13796         (Output_section::set_is_relro_local): New function.
13797         (class Output_segment): Update declarations.
13798         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13799         * sparc.cc (Target_sparc::got_section): Likewise.
13800         * x86_64.cc (Target_x86_64::got_section): Likewise.
13801         * testsuite/relro_test_main.cc: New file.
13802         * testsuite/relro_test.cc: New file.
13803         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13804         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13805         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13806         (relro_test.so, relro_test_pic.o): New targets.
13807         * testsuite/Makefile.in: Rebuild.
13808
13809 2008-05-16  Ian Lance Taylor  <iant@google.com>
13810
13811         * output.cc (Output_segment::add_output_section): Remove front
13812         parameter.
13813         * output.h (class Output_segment): Remove
13814         add_initial_output_section and overloaded add_output_section.
13815         Update declaration of remaining add_output_section.
13816         * layout.cc (Layout::create_interp): Call add_output_section
13817         rather than add_initial_output_section.
13818         (Layout::finish_dynamic_section): Likewise.
13819
13820         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13821         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13822         know the dynamic type.
13823         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13824         field.  Initialize it in constructor.
13825         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13826         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13827         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13828         reloc.
13829
13830         * output.cc (Output_reloc::get_address): Change return type to
13831         Elf_Addr.
13832         * output.h (class Output_reloc): Update get_address declaration.
13833         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13834         for section addresses.
13835
13836 2008-05-09  Ian Lance Taylor  <iant@google.com>
13837
13838         PR 6493
13839         * gold.cc (gold_nomem): Use return value of write.
13840
13841 2008-05-08  Ian Lance Taylor  <iant@google.com>
13842
13843         * symtab.c (Symbol::init_base_output_data): Add version
13844         parameter.  Change all callers.
13845         (Symbol::init_base_output_segment): Likewise.
13846         (Symbol::init_base_constant): Likewise.
13847         (Symbol::init_base_undefined): Likewise.
13848         (Sized_symbol::init_output_data): Likewise.
13849         (Sized_symbol::init_output_segment): Likewise.
13850         (Sized_symbol::init_constant): Likewise.
13851         (Sized_symbol::init_undefined): Likewise.
13852         (Symbol_table::do_define_in_output_data): If the new symbol has a
13853         version, mark it as the default.
13854         (Symbol_table::do_define_in_output_segment): Likewise.
13855         (Symbol_table::do_define_as_constant): Likewise.
13856         * symtab.h (class Symbol): Update declarations.
13857         (class Sized_symbol): Likewise.
13858         * resolve.cc (Symbol::override_version): New function.
13859         (Symbol::override_base): Call override_version.
13860         (Symbol::override_base_with_special): Likewise.
13861         * testsuite/ver_script_8.script: New file.
13862         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13863         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13864         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13865         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13866
13867 2008-05-06  Ian Lance Taylor  <iant@google.com>
13868
13869         PR 6049
13870         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13871         functions.
13872         (class General_options): Remove existing --undefined, and add
13873         --no-undefined instead.  Add new --undefined as synonym for -u.
13874         * archive.cc (Archive::add_symbols): Check whether symbol was
13875         named with -u.
13876         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13877         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13878         all uses.  Add IS_UNDEFINED.  Update declarations to split
13879         different versions of init_base.  Declare init_base_undefined.
13880         (Symbol::is_defined): Handle IS_UNDEFINED.
13881         (Symbol::is_undefined): Likewise.
13882         (Symbol::is_weak_undefined): Call is_undefined.
13883         (Symbol::is_absolute): Handle IS_CONSTANT.
13884         (class Sized_symbol): Update declarations to split different
13885         versions of init.  Declare init_undefined.
13886         (class Symbol_table): Declare new functions.
13887         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13888         Change all callers.
13889         (Symbol::init_base_output_data): Likewise.
13890         (Symbol::init_base_output_segment): Likewise.
13891         (Symbol::init_base_constant): Likewise.
13892         (Symbol::init_base_undefined): New function.
13893         (Sized_symbol::init_object): Rename from init.  Change all
13894         callers.
13895         (Sized_symbol::init_output_data): Likewise.
13896         (Sized_symbol::init_output_segment): Likewise.
13897         (Sized_symbol::init_constant): Likewise.
13898         (Sized_symbol::init_undefined): New function.
13899         (Symbol_table::add_undefined_symbols_from_command_line): New
13900         function.
13901         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13902         function.
13903         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13904         (Symbol::output_section): Likewise.
13905         (Symbol::set_output_section): Likewise.
13906         (Symbol_table::sized_finalize_symbol): Likewise.
13907         (Symbol_table::sized_write_globals): Likewise.
13908         * resolve.cc (Symbol_table::should_override): Likewise.
13909         (Symbol::override_base_with_special): Likewise.
13910
13911         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13912         symbol, change it to have default visibility.
13913         * testsuite/protected_1.cc: New file.
13914         * testsuite/protected_2.cc: New file.
13915         * testsuite/protected_3.cc: New file.
13916         * testsuite/protected_main_1.cc: New file.
13917         * testsuite/protected_main_2.cc: New file.
13918         * testsuite/protected_main_3.cc: New file.
13919         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13920         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13921         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13922         (protected_1.so): New target.
13923         (protected_1_pic.o, protected_2_pic.o): New targets.
13924         (protected_3_pic.o): New target.
13925         (check_PROGRAMS): Add protected_2.
13926         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13927         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13928         * testsuite/Makefile.in: Rebuild.
13929
13930         * options.h (DEFINE_var): Add set_user_set_##varname__.
13931         (DEFINE_bool_alias): New macro.
13932         (class General_options): Define -Bstatic using DEFINE_bool_alias
13933         rather than DEFINE_special.  Add --undefined as an alias for -z
13934         defs.
13935         * options.cc (General_options::parse_Bstatic): Remove.
13936
13937         * options.h (class General_options): Add --fatal-warnings.
13938         * main.cc (main): Implement --fatal-warnings.
13939         * errors.h (Errors::warning_count): New function.
13940
13941         * options.h (class General_options): Add -Bsymbolic-functions.
13942         * symtab.h (Symbol::is_preemptible): Check for
13943         -Bsymbolic-functions.
13944
13945 2008-05-05  Ian Lance Taylor  <iant@google.com>
13946
13947         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13948         as noVARNAME rather than no-VARNAME.
13949         (class General_options): Add option -z combreloc.
13950         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13951         get_address.
13952         (Output_reloc::sort_before) [SHT_REL]: New function.
13953         (Output_reloc::sort_before) [SHT_RELA]: New function.
13954         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13955         Sort_relocs_comparison.
13956         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13957         parameter.  Change all callers.
13958         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13959         sort_relocs parameter.  Change all callers.
13960         * output.cc (Output_reloc::get_address): New function, broken out
13961         of write_rel.
13962         (Output_reloc::write_rel): Call it.
13963         (Output_reloc::compare): New function.
13964         (Output_data_reloc_base::do_write): Optionally sort relocs.
13965
13966         * configure.ac: If targ_extra_obj is set, link it in.
13967         * configure.tgt: Initialize all variables.
13968         (x86_64*): Set targ_extra_obj and targ_extra_size.
13969         * configure: Rebuild.
13970
13971         * object.cc (Sized_relobj::include_section_group): Adjust section
13972         indexes read from group data.  Build vector to pass to
13973         layout_group.
13974         * layout.cc (Layout::layout_group): Add flags and shndxes
13975         parameters.  Remove contents parameter.  Change caller.  Update
13976         explicit instantiations.
13977         * layout.h (class Layout): Update layout_group declaration.
13978         * output.cc (Output_data_group::Output_data_group): Add flags and
13979         input_shndxes parameters.  Remove contents parameter.  Change
13980         caller.
13981         (Output_data_group::do_write): Change input_sections_ to
13982         input_shndxes_.
13983         * output.h (class Output_data_group): Update constructor
13984         declaration.  Rename input_sections_ to input_shndxes_.
13985         * testsuite/many_sections_test.cc: Add template.
13986
13987 2008-04-30  Cary Coutant  <ccoutant@google.com>
13988
13989         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13990
13991         * layout.cc (Layout::include_section): Refactored check for debug
13992         info section.
13993         (Layout::add_comdat): Add new parameters.  Change type
13994         of signature parameter.  Add object and shndx to signatures table.
13995         (Layout::find_kept_object): New function.
13996         * layout.h: Include <cstring>.
13997         (Layout::is_debug_info_section): New function.
13998         (Layout::add_comdat): Add new parameters.
13999         (Layout::find_kept_object): New function.
14000         (Layout::Kept_section): New struct.
14001         (Layout::Signatures): Change type of map range.
14002         * object.cc (Relobj::output_section_address): New function.
14003         (Sized_relobj::include_section_group): Add new parameters.  Change
14004         calls to Layout::add_comdat.  Change to build table of kept comdat
14005         groups and table mapping discarded sections to kept sections.
14006         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14007         (Sized_relobj::do_layout): Change calls to include_section_group and
14008         include_linkonce_section.
14009         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14010         value to zero when section is discarded.
14011         (Sized_relobj::map_to_kept_section): New function.
14012         * object.h (Relobj::output_section_address): New function.
14013         (Relobj::Comdat_group): New type.
14014         (Relobj::find_comdat_group): New function.
14015         (Relobj::Comdat_group_table): New type.
14016         (Relobj::Kept_comdat_section): New type.
14017         (Relobj::Kept_comdat_section_table): New type.
14018         (Relobj::add_comdat_group): New function.
14019         (Relobj::set_kept_comdat_section): New function.
14020         (Relobj::get_kept_comdat_section): New function.
14021         (Relobj::comdat_groups_): New field.
14022         (Relobj::kept_comdat_sections_): New field.
14023         (Symbol_value::input_value): Update comment.
14024         (Sized_relobj::map_to_kept_section) New function.
14025         (Sized_relobj::include_linkonce_section): Add new parameter.
14026         * target-reloc.h (Comdat_behavior): New type.
14027         (get_comdat_behavior): New function.
14028         (relocate_section): Add code to map a discarded section to the
14029         corresponding kept section when applying a relocation.
14030
14031 2008-04-30  Craig Silverstein  <csilvers@google.com>
14032
14033         * dwarf_reader.cc (next_generation_count): New static var.
14034         (Addr2line_cache_entry): New struct.
14035         (addr2line_cache): New static var.
14036         (Dwarf_line_info::one_addr2line): Added caching.
14037         (Dwarf_line_info::clear_addr2line_cache): New function.
14038         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14039         cache-size parameter.
14040         (Dwarf_line_info::one_addr2line_cache): New function.
14041         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14042         new cache-size argument to one_addr2line(), and clear cache.
14043
14044 2008-04-28  Cary Coutant  <ccoutant@google.com>
14045
14046         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14047         R_386_PC8 relocations.
14048
14049 2008-04-23  Ian Lance Taylor  <iant@google.com>
14050
14051         * object.cc (Sized_relobj::include_section_group): Check for
14052         invalid section group.
14053
14054         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14055         header size.
14056
14057         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14058         than read for file header.
14059         * archive.cc (Archive::include_member): Likewise.
14060
14061 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14062
14063         * aclocal.m4: Regenerate.
14064         * configure: Regenerate.
14065
14066 2008-04-19  Ian Lance Taylor  <iant@google.com>
14067
14068         * version.cc (version_string): Bump to 1.6.
14069
14070         * testsuite/Makefile.am (many_sections_r_test): New target.
14071         (many_sections_r_test_SOURCES): Remove.
14072         (many_sections_r_test_DEPENDENCIES): Remove.
14073         (many_sections_r_test_LDFLAGS): Remove.
14074         (many_sections_r_test_LDADD): Remove.
14075
14076         * object.cc (Sized_relobj::do_add_symbols): Always pass
14077         local_symbol_count_ to add_from_relobj.
14078
14079         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14080         every thousand variables.
14081         * testsuite/Makefile.in: Rebuild.
14082
14083         * object.cc (Xindex::initialize_symtab_xindex): New function.
14084         (Xindex::read_symtab_xindex): New function.
14085         (Xindex::sym_xindex_to_shndx): New function.
14086         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14087         available.
14088         (Sized_relobj::do_initialize_xindex): New function.
14089         (Sized_relobj::do_read_symbols): Adjust section links.
14090         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14091         parameter.  Change all callers.
14092         (Sized_relobj::include_section_group): Adjust section links and
14093         symbol section indexes.
14094         (Sized_relobj::do_layout): Adjust section links.
14095         (Sized_relobj::do_count_local_symbols): Adjust section links and
14096         symbol section indexes.
14097         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14098         ordinary and special symbols.
14099         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14100         dynsym_xindex parameters.  Change all callers.  Adjust section
14101         links.  Use SHN_XINDEX when needed.
14102         (Sized_relobj::get_symbol_location_info): Adjust section links.
14103         Don't get fooled by special symbols.
14104         * object.h (class Xindex): Define.
14105         (class Object): Add xindex_ parameter.  Declare virtual functoin
14106         do_initialize_xindex.
14107         (Object::adjust_sym_shndx): New function.
14108         (Object::set_xindex): New protected function.
14109         (class Symbol_value): Add is_ordinary_shndx_ field.
14110         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14111         (Symbol_value::value): Assert ordinary section.
14112         (Symbol_value::initialize_input_to_output_map): Likewise.
14113         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14114         Change all callers.
14115         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14116         all callers.
14117         (class Sized_relobj): Update declarations.
14118         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14119         parameter.  Change all callers.
14120         (Sized_relobj::adjust_shndx): New function.
14121         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14122         field.
14123         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14124         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14125         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14126         (Sized_dynobj::read_dynsym_section): Adjust section links.
14127         (Sized_dynobj::read_dynamic): Likewise.
14128         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14129         section links.
14130         (Sized_dynobj::do_initialize_xindex): New function.
14131         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14132         do_initialize_xindex.
14133         (Sized_dynobj::adjust_shndx): New function.
14134         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14135         dynsym_xindex_ fields.
14136         (Layout::finalize): Add a call to set_section_indexes before
14137         creating the symtab sections.
14138         (Layout::set_section_indexes): Don't do anything if the section
14139         already has a section index.
14140         (Layout::create_symtab_sections): Add shnum parameter.  Change
14141         caller.  Create .symtab_shndx section if needed.
14142         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14143         caller.
14144         (Layout::allocated_output_section_count): New function.
14145         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14146         needed.
14147         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14148         fields.  Update declarations.
14149         (Layout::symtab_xindex): New function.
14150         (Layout::dynsym_xindex): New function.
14151         (class Write_symbols_task): Add layout_ field.
14152         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14153         Change caller.
14154         * output.cc (Output_section_headers::Output_section_headers): Add
14155         shstrtab_section parameter.  Change all callers.
14156         (Output_section_headers::do_sized_write): Store overflow values
14157         for section count and section string table section index in
14158         section header zero.
14159         (Output_file_header::do_sized_write): Check for overflow of
14160         section count and section string table section index.
14161         (Output_symtab_xindex::do_write): New function.
14162         (Output_symtab_xindex::endian_do_write): New function.
14163         * output.h (class Output_section_headers): Add shstrtab_section_.
14164         Update declarations.
14165         (class Output_symtab_xindex): Define.
14166         (Output_section::has_out_shndx): New function.
14167         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14168         field.
14169         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14170         Change all callers.
14171         (Sized_symbol::init): Likewise.
14172         (Symbol::output_section): Check for ordinary symbol.
14173         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14174         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14175         callers.
14176         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14177         Change all callers.  Simplify handling of symbols from sections
14178         not included in the link.
14179         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14180         distinction.
14181         (Weak_alias_sorter::operator()): Assert that symbols are
14182         ordinary.
14183         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14184         distinction.
14185         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14186         parameters.  Change all callers.
14187         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14188         symbol distinction.  Use SHN_XINDEX when needed.
14189         (Symbol_table::write_section_symbol): Add symtab_xindex
14190         parameter.  Change all callers.
14191         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14192         SHN_XINDEX when needed.
14193         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14194         declarations.
14195         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14196         (Symbol::is_defined): Check is_ordinary.
14197         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14198         (Symbol::is_absolute, Symbol::is_common): Likewise.
14199         (class Sized_symbol): Update declarations.
14200         (class Symbol_table): Update declarations.
14201         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14202         parameters.  Change all callers.
14203         (Sized_symbol::override): Likewise.
14204         (Symbol_table::override): Likewise.
14205         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14206         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14207         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14208         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14209         to be in an ordinary section.
14210         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14211         object and is_ordinary parameters.  Change all callers.
14212         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14213         Change all callers.  Don't add undefined or non-ordinary symbols
14214         to reloc_map_.
14215         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14216         Change all callers.
14217         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14218         declarations.
14219         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14220         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14221         (Sized_relobj::relocate_sections): Likewise.
14222         * target-reloc.h (scan_relocs): Adjust section symbol index.
14223         (scan_relocatable_relocs): Likewise.
14224         * i386.cc (Scan::local): Check for ordinary symbols.
14225         * sparc.cc (Scan::local): Likewise.
14226         * x86_64.cc (Scan::local): Likewise.
14227         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14228         to symbol_section_and_value.
14229         * testsuite/many_sections_test.cc: New file.
14230         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14231         (check_PROGRAMS): Add many_sections_test.
14232         (many_sections_test_SOURCES): Define.
14233         (many_sections_test_DEPENDENCIES): Define.
14234         (many_sections_test_LDFLAGS): Define.
14235         (BUILT_SOURCES): Add many_sections_define.h.
14236         (many_sections_define.h): New target.
14237         (BUILT_SOURCES): Add many_sections_check.h.
14238         (many_sections_check.h): New target.
14239         (check_PROGRAMS): Add many_sections_r_test.
14240         (many_sections_r_test_SOURCES): Define.
14241         (many_sections_r_test_DEPENDENCIES): Define.
14242         (many_sections_r_test_LDFLAGS): Define.
14243         (many_sections_r_test_LDADD): Define.
14244         (many_sections_r_test.o): New target.
14245         * testsuite/Makefile.in: Rebuild.
14246
14247 2008-04-17  Cary Coutant  <ccoutant@google.com>
14248
14249         * errors.cc (Errors::info): New function.
14250         (gold_info): New function.
14251         * errors.h (Errors::info): New function.
14252         * gold.h (gold_info): New function.
14253         * object.cc (Input_objects::add_object): Print trace output.
14254         * options.cc (options::parse_set): New function.
14255         (General_options::parse_wrap): Deleted.
14256         (General_options::General_options): Deleted initializer.
14257         * options.h (options::String_set): New typedef.
14258         (options::parse_set): New function.
14259         (DEFINE_set): New macro.
14260         (General_options::wrap): Changed to use DEFINE_set. Changed
14261         callers of any_wrap_symbols and is_wrap_symbol.
14262         (General_options::trace, General_options::trace_symbol):
14263         New options.
14264         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14265         (General_options::wrap_symbols_): Deleted.
14266         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14267
14268 2008-04-17  David S. Miller  <davem@davemloft.net>
14269
14270         * options.cc (General_options::parse_V): New function.
14271         * options.h: Add entries for -V and -Qy.
14272
14273 2008-04-17  Ian Lance Taylor  <iant@google.com>
14274
14275         * common.cc (Symbol_table::allocate_commons): Remove options
14276         parameter.  Change caller.
14277         (Symbol_table::do_allocate_commons): Remove options parameter.
14278         Change caller.  Just call do_allocate_commons_list twice.
14279         (Symbol_table::do_allocate_commons_list): New function, broken out
14280         of do_allocate_commons.
14281         * common.h (class Allocate_commons_task): Remove options_ field.
14282         Update constructor.
14283         * symtab.cc (Symbol_table::Symbol_table): Initialize
14284         tls_commons_.
14285         (Symbol_table::add_from_object): Put TLS common symbols on
14286         tls_commons_ list.
14287         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14288         which are IN_OUTPUT_DATA.
14289         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14290         allocate_commons and do_allocate_commons declarations.  Declare
14291         do_allocate_commons_list.
14292         * gold.cc (queue_middle_tasks): Update creation of
14293         Allocate_commons_task to not pass options.
14294         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14295         (TLS_TEST_C_FLAGS): New variable.
14296         (tls_test_c_pic.o): New target.
14297         (tls_test_shared.so): Link in tls_test_c_pic.o.
14298         (tls_test_c_pic_ie.o): New target.
14299         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14300         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14301         (tls_test_c.o): New target.
14302         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14303         (tls_pic_test_LDADD): Likewise.
14304         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14305         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14306         (tls_test_c_gnu2.o): New target.
14307         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14308         tls_test_c_gnu2.o.
14309         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14310         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14311         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14312         * testsuite/tls_test.cc: Include "config.h".
14313         (t_last): Call t11_last.
14314         * testsuite/tls_test.h (t11, t11_last): Declare.
14315         * testsuite/tls_test_c.c: New file.
14316         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14317         * configure.ac: Check for OpenMP support.
14318         * configure, config.in, Makefile.in: Rebuild.
14319         * testsuite/Makefile.in: Rebuild.
14320
14321 2008-04-16  Cary Coutant  <ccoutant@google.com>
14322
14323         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14324         (Target_i386::tls_base_symbol_defined_): New field.
14325         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14326         (Target_i386::Scan::global): Likewise.
14327         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14328         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14329         (Target_x86_64::tls_base_symbol_defined_): New field.
14330         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14331         (Target_x86_64::Scan::global): Likewise.
14332
14333 2008-04-16  Cary Coutant  <ccoutant@google.com>
14334
14335         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14336         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14337         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14338         building shared libraries.
14339         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14340         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14341         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14342         * testsuite/Makefile.in: Rebuild.
14343         * testsuite/weak_undef.h: New file.
14344         * testsuite/weak_undef_file1.cc: Add extra test cases.
14345         * testsuite/weak_undef_file2.cc: Likewise.
14346         * testsuite/weak_undef_test.cc: Likewise.
14347
14348 2008-04-16  David S. Miller  <davem@davemloft.net>
14349
14350         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14351         Add issued_non_pic_error_ field.  Declare check_non_pic.
14352         (Target_sparc::Scan::check_non_pic): New function.
14353         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14354         (Target_sparc::Scan::global): Likewise.
14355
14356         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14357         * configure: Rebuild.
14358
14359         * options.h (DEFINE_enable): New macro.
14360         (new_dtags): New enable option.
14361         (initfirst, interpose, loadfltr, nodefaultlib,
14362         nodelete, nodlopen, nodump): New -z options.
14363         * layout.cc (Layout:finish_dynamic_section): If new
14364         dtags enabled, emit DT_RUNPATH.  Also, emit a
14365         DT_FLAGS_1 containing any specified -z flags.
14366
14367 2008-04-16  Ian Lance Taylor  <iant@google.com>
14368
14369         * copy-relocs.cc: New file.
14370         * copy-relocs.h: New file.
14371         * reloc.cc: Remove Copy_relocs code.
14372         * reloc.h: Likewise.
14373         * reloc-types.h (struct Reloc_types) [both versions]: Add
14374         get_reloc_addend_noerror.
14375         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14376         variants of add_global which take an addend which must be zero.
14377         * i386.cc: Include "copy-relocs.h".
14378         (class Target_i386): Change type of copy_relocs_ to variable,
14379         update initializer.
14380         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14381         Change all callers.
14382         (Target_i386::do_finalize_sections): Change handling of
14383         copy_relocs_.
14384         * sparc.cc: Include "copy-relocs.h".
14385         (class Target_sparc): Change type of copy_relocs_ to variable,
14386         update initializer.
14387         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14388         Change all callers.
14389         (Target_sparc::do_finalize_sections): Change handling of
14390         copy_relocs_.
14391         * x86_64.cc: Include "copy-relocs.h".
14392         (class Target_x86_64): Change type of copy_relocs_ to variable,
14393         update initializer.
14394         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14395         class.  Change all callers.
14396         (Target_x86_64::do_finalize_sections): Change handling of
14397         copy_relocs_.
14398         * Makefile.am (CCFILES): Add copy-relocs.cc.
14399         (HFILES): Add copy-relocs.h.
14400
14401         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14402
14403         * testsuite/script_test_4.sh: Permit leading zeroes.
14404
14405 2008-04-15  Ian Lance Taylor  <iant@google.com>
14406
14407         * script-sections.cc (Script_sections::create_segments): Use
14408         header_size_adjustment even when there is enough room for the
14409         headers.
14410         * testsuite/script_test_4.sh: New file.
14411         * testsuite/script_test_4.t: New file.
14412         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14413         (check_DATA): Add script_test_4.stdout.
14414         (MOSTLYCLEANFILES): Likewise.
14415         (script_test_4): New target.
14416         (script_test_4.stdout): New target.
14417         * testsuite/Makefile.in: Rebuild.
14418
14419         * sparc.cc: Add definitions for Output_data_plt_sparc class
14420         constants.
14421
14422 2008-04-14  David S. Miller  <davem@davemloft.net>
14423
14424         * sparc.cc: New file.
14425         * Makefile.am (TARGETSOURCES): Add sparc.cc
14426         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14427         * configure.tgt: Document targ_extra_size and
14428         targ_extra_big_endian.  Add entries for sparc-* and
14429         sparc64-*.
14430         * configure.ac: Handle targ_extra_size and
14431         targ_extra_big_endian.
14432         * Makefile.in: Rebuild.
14433         * configure: Likewise.
14434         * po/POTFILES.in: Likewise.
14435         * po/gold.pot: Likewise.
14436
14437 2008-04-14  Ian Lance Taylor  <iant@google.com>
14438
14439         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14440         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14441         in the name/type/flags to section mapping.  Don't call
14442         allocate_output_section.
14443         (Layout::choose_output_section): Change parameter from adjust_name
14444         to is_input_section.  Don't permit input sections after sections
14445         are attached to segments.  Don't call allocate_output_section.
14446         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14447         not write_enable_output_section.
14448         (Layout::make_output_section): Don't push to
14449         unattached_section_list_ nor call attach_to_segment.  Call
14450         attach_section_to_segment if sections are attached.
14451         (Layout::attach_sections_to_segments): New function.
14452         (Layout::attach_section_to_segment): New function.
14453         (Layout::attach_allocated_section_to_segment): Rename from
14454         attach_to_segment.  Remove flags parameter.
14455         (Layout::allocate_output_section): Remove function.
14456         (Layout::write_enable_output_section): Remove function.
14457         * layout.h (class Layout): Update for above changes.  Add new
14458         field sections_are_attached_.
14459         * output.h (Output_section::update_flags_for_input_section): New
14460         function.
14461         * output.cc (Output_section::add_input_section): Call
14462         update_flags_for_input_section.
14463         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14464
14465 2008-04-11  Cary Coutant  <ccoutant@google.com>
14466
14467         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14468         thought unnecessary.
14469         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14470
14471 2008-04-11  Ian Lance Taylor  <iant@google.com>
14472
14473         * output.h (class Output_section_data): Remove inline definition
14474         of set_addralign.
14475         * output.cc (Output_section_data::set_addralign): New function.
14476
14477 2008-04-11  Cary Coutant  <ccoutant@google.com>
14478
14479         Add support for TLS descriptors for i386 and x86_64.
14480         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14481         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14482         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14483         GOT_TYPE_TLS_DESC.
14484         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14485         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14486         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14487         relocations.
14488         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14489         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14490         Fix problem with initial-exec relocations.
14491         (Target_i386::Relocate::relocate_tls): Likewise.
14492         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14493         relaxation.
14494         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14495         support for section-plus-offset dynamic table entries.
14496         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14497         (Output_data_dynamic::Dynamic_entry): Add support for
14498         section-plus-offset dynamic table entries.
14499         (Output_data_dynamic::Classification): Likewise.
14500         (Output_data_dynamic::classification_): Renamed offset_.
14501         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14502         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14503         (Target_x86_64::make_plt_section): New function.
14504         (Target_x86_64::reserve_tlsdesc_entries): New function.
14505         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14506         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14507         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14508         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14509         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14510         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14511         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14512         add extra PLT entry for TLS descriptors.
14513         (Output_data_plt_x86_64::got_): New field.
14514         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14515         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14516         fields.
14517         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14518         descriptors.
14519         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14520         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14521         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14522         R_386_TLS_DESC_CALL relocations.
14523         (Target_x86_64::Scan::global): Likewise.
14524         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14525         for TLS descriptors.
14526         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14527         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14528         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14529         GD-to-IE relaxation.
14530         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14531         and TLS_DESCRIPTORS.
14532         * Makefile.in: Rebuild.
14533         * configure: Rebuild.
14534         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14535         (tls_test_shared2.so): New target.
14536         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14537         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14538         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14539         (tls_shared_gd_to_ie_test_LDADD): New variable.
14540         (tls_shared_gnu2_gd_to_ie_test): New target.
14541         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14542         New targets.
14543         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14544         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14545         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14546         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14547         (tls_shared_gnu2_test): New target.
14548         (tls_test_gnu2_shared.so): New target.
14549         (tls_shared_gnu2_test_SOURCES): New variable.
14550         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14551         (tls_shared_gnu2_test_LDFLAGS): New variable.
14552         (tls_shared_gnu2_test_LDADD): New variable.
14553         * testsuite/Makefile.in: Rebuild.
14554         * testsuite/Makefile.
14555
14556 2008-04-11  Ian Lance Taylor  <iant@google.com>
14557
14558         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14559         justsyms.t.
14560         * testsuite/Makefile.in: Rebuild.
14561
14562         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14563         long.
14564         * testsuite/script_test_2.cc (main): Adjust test.
14565
14566 2008-04-11  David S. Miller  <davem@davemloft.net>
14567             Ian Lance Taylor  <iant@google.com>
14568
14569         * options.h (General_options): Add entries for '-Y' and
14570         '-relax'.
14571         * options.cc (General_options:finalize): If -Y was used, add those
14572         entries to the library path instead of the default "/lib" and
14573         "/usr/lib".
14574
14575 2008-04-11  David S. Miller  <davem@davemloft.net>
14576
14577         * testsuite/justsyms.t: Start at 0x100.
14578         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14579         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14580         long.
14581         * testsuite/script_test_2.cc: Adjust string and section length
14582         checks.
14583
14584 2008-04-09  Ian Lance Taylor  <iant@google.com>
14585
14586         PR gold/5996
14587         * script-sections.cc (Sections_element::allocate_to_segment): Add
14588         orphan parameter.
14589         (Output_section_definition::allocate_to_segment): Likewise.
14590         (Orphan_output_section::allocate_to_segment): Likewise.
14591         (Script_sections::attach_sections_using_phdrs_clause): Don't
14592         propagate non-PT_LOAD segments to orphan sections.
14593         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14594         readelf rather than objdump.
14595         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14596         .interp section and PT_INTERP segment are the same size.
14597         * testsuite/Makefile.in: Rebuild.
14598
14599         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14600         aliases for symbols defined in the same object.
14601         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14602         (weak_alias_test_SOURCES): New variable.
14603         (weak_alias_test_DEPENDENCIES): New variable.
14604         (weak_alias_test_LDFLAGS): New variable.
14605         (weak_alias_test_LDADD): New variable.
14606         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14607         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14608         (weak_alias_test_3.o): New target.
14609         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14610         * testsuite/weak_alias_test_main.cc: New file.
14611         * testsuite/weak_alias_test_1.cc: New file.
14612         * testsuite/weak_alias_test_2.cc: New file.
14613         * testsuite/weak_alias_test_3.cc: New file.
14614
14615 2008-04-08  Ian Lance Taylor  <iant@google.com>
14616
14617         * options.h (class General_options): Add --noinhibit-exec option.
14618         * main.cc (main): Check --noinhibit-exec.
14619
14620         * options.h (class General_options): Define --wrap as a special
14621         option.  Add wrap_symbols_ field.
14622         (General_options::any_wrap_symbols): New function.
14623         (General_options::is_wrap_symbol): New function.
14624         * options.cc (General_options::parse_wrap): New function.
14625         (General_options::General_options): Initialize wrap_symbols_.
14626         * symtab.cc (Symbol_table::wrap_symbol): New function.
14627         (Symbol_table::add_from_object): Handle --wrap.
14628         * symtab.h (class Symbol_table): Declare wrap_symbol.
14629         * target.h (Target::wrap_char): New function.
14630         (Target::Target_info): Add wrap_char field.
14631         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14632         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14633         * testsuite/testfile.cc (Target_test::test_target_info):
14634         Likewise.
14635
14636         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14637         there is one.
14638
14639         * layout.h (class Layout): Add added_eh_frame_data_ field.
14640         * layout.cc (Layout::Layout): Initialize new field.
14641         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14642         output section until we find a section we merged successfully.
14643         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14644         that the size be non-zero.
14645
14646         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14647         qualifier.
14648
14649 2008-04-08  Craig Silverstein  <csilvers@google.com>
14650
14651         * configure.ac: Export new conditional variable HAVE_ZLIB.
14652         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14653         on HAVE_ZLIB.
14654         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14655         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14656
14657 2008-04-07  Ian Lance Taylor  <iant@google.com>
14658
14659         * version.cc (version_string): Set to "1.5".
14660
14661         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14662         Add issued_non_pic_error_ field.  Declare check_non_pic.
14663         (Target_x86_64::Scan::check_non_pic): New function.
14664         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14665         (Target_x86_64::Scan::global): Likewise.
14666
14667         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14668         addend parameter.  Change caller.  Handle merge sections.
14669         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14670         Address to Addend.  Don't add in the result of
14671         local_section_offset, pass down the addend and use the returned
14672         value.
14673         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14674         Update declarations of local_section_offset and symbol_value.
14675         * testsuite/two_file_test_1.cc (t18): New function.
14676         * testsuite/two_file_test_2.cc (f18): New function.
14677         * testsuite/two_file_test_main.cc (main): Call t18.
14678         * testsuite/two_file_test.h (t18, f18): Declare.
14679
14680         * configure.ac: Don't test for objdump, c++filt, or readelf.
14681         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14682         conditionals.
14683         (TEST_READELF): New variable.
14684         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14685         (check_PROGRAMS): Add two_file_strip_test.
14686         (two_file_strip_test): New target.
14687         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14688         (two_file_same_shared_strip_test_SOURCES): New variable.
14689         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14690         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14691         (two_file_same_shared_strip_test_LDADD): New variable.
14692         (two_file_shared_strip.so): New target.
14693         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14694         (ver_test_5.syms, ver_test_7.syms): Likewise.
14695         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14696         (strip_test_3.stdout): Use TEST_OBJDUMP.
14697         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14698
14699 2008-04-04  Cary Coutant  <ccoutant@google.com>
14700
14701         * symtab.h (Symbol::is_weak_undefined): New function.
14702         (Symbol::is_strong_undefined): New function.
14703         (Symbol::is_absolute): New function.
14704         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14705         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14706         absolute symbols.
14707         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14708         (weak_undef_test): New target.
14709         * testsuite/Makefile.in: Rebuild.
14710         * testsuite/weak_undef_file1.cc: New file.
14711         * testsuite/weak_undef_file2.cc: New file.
14712         * testsuite/weak_undef_test.cc: New file.
14713
14714 2008-04-03  Craig Silverstein  <csilvers@google.com>
14715
14716         * compressed_output.h (class Output_compressed_section): Use
14717         unsigned buffer.
14718         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14719         add zlib header.
14720         (zlib_compressed_suffix): Removed.
14721         (Output_compressed_section::set_final_data_size): Use unsigned
14722         buffers.
14723         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14724         Fix linker invocation.
14725         (flagstest_o_specialfile_and_compress_debug_sections):
14726         Likewise.
14727         * testsuite/Makefile.in: Regenerated.
14728
14729 2008-04-02  David S. Miller  <davem@davemloft.net>
14730
14731         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14732         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14733
14734 2008-04-02  Craig Silverstein  <csilvers@google.com>
14735
14736         * TODO: New file.
14737
14738 2008-04-02  Ian Lance Taylor  <iant@google.com>
14739
14740         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14741         parameters.  Update for new key type to views_.  Change all
14742         callers.
14743         (File_read::read): Adjust for byteshift in returned view.
14744         (File_read::add_view): New function, broken out of
14745         find_and_make_view.
14746         (File_read::make_view): New function, broken out of
14747         find_and_make_view.
14748         (File_read::find_or_make_view): Add offset and aligned
14749         parameters.  Rewrite accordingly.  Change all callers.
14750         (File_read::get_view): Add offset and aligned parameters.  Adjust
14751         for byteshift in return value.
14752         (File_read::get_lasting_view): Likewise.
14753         * fileread.h (class File_read): Update declarations.
14754         (class File_read::View): Add byteshift_ field.  Add byteshift to
14755         constructor.  Add byteshift method.
14756         * archive.h (Archive::clear_uncached_views): New function.
14757         (Archive::get_view): Add aligned parameter.  Change all callers.
14758         * object.h (Object::get_view): Add aligned parameter.  Change all
14759         callers.
14760         (Object::get_lasting_view): Likewise.
14761
14762         * fileread.cc (File_read::release): Don't call clear_views if
14763         there are multiple objects.
14764         * fileread.h (File_read::clear_uncached_views): New function.
14765         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14766         on the archive.
14767
14768 2008-03-31  Cary Coutant  <ccoutant@google.com>
14769
14770         Add thin archive support.
14771         * archive.cc (Archive::armagt): New const.
14772         (Archive::setup): Remove task parameter and calls to unlock.
14773         (Archive::unlock_nested_archives): New function.
14774         (Archive::read_header): Add nested_off parameter. Change
14775         all callers.
14776         (Archive::interpret_header): Likewise.
14777         (Archive::include_all_members): Change to handle thin
14778         archives.
14779         (Archive::include_member): Likewise.
14780         * archive.h (Archive::Archive): Add new parameters and
14781         initializers.
14782         (Archive::armagt): New const.
14783         (Archive::setup): Remove task parameter.
14784         (Archive::unlock_nested_archives): New function.
14785         (Archive::read_header): Add nested_off parameter.
14786         (Archive::interpret_header): Likewise.
14787         (Archive::Nested_archive_table): New typedef.
14788         (Archive::is_thin_archive_): New field.
14789         (Archive::nested_archives_): New field.
14790         (Archive::options_): New field.
14791         (Archive::dirpath_): New field.
14792         (Archive::task_): New field.
14793         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14794         for thin archives.  Pass additional parameters to
14795         Archive::Archive.  Unlock the archive file after calling
14796         Archive::setup.
14797
14798 2008-03-29  Ian Lance Taylor  <iant@google.com>
14799
14800         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14801         version symbol to be local.
14802         * testsuite/ver_test_4.sh: New file.
14803         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14804         (check_DATA): Add ver_test_4.syms.
14805         (ver_test_4.syms): New target.
14806         * testsuite/Makefile.in: Rebuild.
14807
14808         * output.cc
14809         (Output_section::Input_section_sort_entry::has_priority): New
14810         function.
14811         (Output_section::Input_section_sort_entry::match_file_name): New
14812         function.
14813         (Output_section::Input_section_sort_entry::match_section_name):
14814         Remove.
14815         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14816         Remove.
14817         (Output_section::Input_section_sort_entry::match_section_file):
14818         Remove.
14819         (Output_section::Input_section_sort_compare::operator()): Rewrite
14820         using new Input_section_sort_entry functions.  Sort crtbegin and
14821         crtend first.  Sort sections with no priority before sections with
14822         a priority.
14823         * testsuite/initpri1.c (d3): Check j != 4.
14824         (cd5): New constructor/destructor function.
14825         (main): Check j != 2.
14826
14827         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14828         new symbol when resolving, don't call set_is_default.
14829         * testsuite/ver_test_7.cc: New file.
14830         * testsuite/ver_test_7.sh: New file.
14831         * testsuite/Makefile.am (ver_test_7.so): New target.
14832         (ver_test_7.o): New target.
14833         (check_SCRIPTS): Add ver_test_7.sh.
14834         (check_DATA): Add ver_test_7.syms.
14835         (ver_test_7.syms): New target.
14836
14837 2008-03-28  Ian Lance Taylor  <iant@google.com>
14838
14839         * layout.cc (Layout::layout): If we see an input section with a
14840         name that needs sorting, set the must_sort flag for the output
14841         section.
14842         (Layout::make_output_section): If the name of the output section
14843         indicates that it might require sorting, set the may_sort flag.
14844         * output.h (Output_section::may_sort_attached_input_sections): New
14845         function.
14846         (Output_section::set_may_sort_attached_input_sections): New
14847         function.
14848         (Output_section::must_sort_attached_input_sections): New
14849         function.
14850         (Output_section::set_must_sort_attached_input_sections): New
14851         function.
14852         (class Output_section): Declare Input_section_sort_entry.  Define
14853         Input_section_sort_compare.  Declare
14854         sort_attached_input_sections.  Add new fields:
14855         may_sort_attached_input_sections_,
14856         must_sort_attached_input_sections_,
14857         attached_input_sections_are_sorted_.
14858         * output.cc (Output_section::Output_section): Initialize new
14859         fields.
14860         (Output_section::add_input_section): Add an entry to
14861         input_sections_ if may_sort or must_sort are true.
14862         (Output_section::set_final_data_size): Call
14863         sort_attached_input_sections if necessary.
14864         (Output_section::Input_section_sort_entry): Define new class.
14865         (Output_section::Input_section_sort_compare::operator()): New
14866         function.
14867         (Output_section::sort_attached_input_sections): New function.
14868         * configure.ac: Check whether the compiler supports constructor
14869         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14870         * testsuite/initpri1.c: New file.
14871         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14872         CONSTRUCTOR_PRIORITY.
14873         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14874         (initpri1_LDFLAGS): New variable.
14875         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14876
14877 2008-03-27  Ian Lance Taylor  <iant@google.com>
14878
14879         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14880         * testsuite/common_test_1.c: New file.
14881         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14882         (common_test_1_SOURCES): New variable.
14883         (common_test_1_DEPENDENCIES): New variable.
14884         (common_test_1_LDFLAGS): New variable.
14885
14886         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14887         and commons_ correctly when NAME/VERSION does not override
14888         NAME/NULL.
14889         * testsuite/ver_test_6.c: New file.
14890         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14891         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14892         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14893
14894 2008-03-26  Ian Lance Taylor  <iant@google.com>
14895
14896         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14897         of an undefined symbol from a version script.
14898         * testsuite/Makefile.am (ver_test_5.so): New target.
14899         (ver_test_5.o): New target.
14900         (check_SCRIPTS): Add ver_test_5.sh.
14901         (check_DATA): Add ver_test_5.syms.
14902         (ver_test_5.syms): New target.
14903         * testsuite/ver_test_5.cc: New file.
14904         * testsuite/ver_test_5.script: New file.
14905         * testsuite/ver_test_5.sh: New file.
14906         * Makefile.in, testsuite/Makefile.in: Rebuild.
14907
14908         PR gold/5986
14909         Fix problems building gold with gcc 4.3.0.
14910         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14911         (gold_error_at_location, gold_warning_at_location): Use it.
14912         * configure.ac: Check whether we can compile and use a template
14913         function with a printf attribute.
14914         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14915         when jumping over bytes.
14916         * object.cc: Instantiate Object::read_section_data.
14917         * debug.h: Include <cstring>
14918         * dwarf_reader.cc: Include <algorithm>
14919         * main.cc: Include <cstring>.
14920         * options.cc: Include <cstring>.
14921         * output.cc: Include <cstring>.
14922         * script.cc: Include <cstring>.
14923         * script.h: Include <string>.
14924         * symtab.cc: Include <cstring> and <algorithm>.
14925         * target-select.cc: Include <cstring>.
14926         * version.cc: Include <string>.
14927         * testsuite/testmain.cc: Include <cstdlib>.
14928         * configure, config.in: Rebuild.
14929
14930 2008-03-25  Ian Lance Taylor  <iant@google.com>
14931
14932         * options.cc: Include "../bfd/bfdver.h".
14933         (options::help): Print bug reporting address.
14934
14935         * version.cc (print_version): Adjust output for current value of
14936         BFD_VERSION_STRING.
14937
14938         * NEWS: New file.
14939
14940         * options.cc (options::help): Print list of supported targets.
14941         * target-select.h: Include <vector>.
14942         (class Target_selector): Make machine_, size_, and is_big_endian_
14943         fields const.  Add bfd_name_ and instantiated_target_ fields.
14944         (Target_selector::Target_selector): Add bfd_name parameter.
14945         (Target_selector::recognize): Make non-virtual, call
14946         do_recognize.
14947         (Target_selector::recognize_by_name): Make non-virtual, call
14948         do_recognize_by_name.
14949         (Target_selector::supported_names): New function.
14950         (Target_selector::bfd_name): New function.
14951         (Target_selector::do_instantiate_target): New pure virtual
14952         function.
14953         (Target_selector::do_recognize): New virtual function.
14954         (Target_selector::do_recognize_by_name): New virtual function.
14955         (Target_selector::instantiate_target): New private function.
14956         (supported_target_names): Declare.
14957         * target-select.cc (Target_selector::Target_selector): Update for
14958         new parameter and fields.
14959         (select_target_by_name): Check that the name matches before
14960         calling recognize_by_name.
14961         (supported_target_names): New function.
14962         * i386.cc (class Target_selector_i386): Update Target_selector
14963         constructor call.  Remove recognize and recognize_by_name.  Add
14964         do_instantiate_target.
14965         * x86_64.cc (class Target_selector_x86_64): Likewise.
14966         * testsuite/testfile.cc (class Target_selector_test): Update for
14967         changes to Target_selector.
14968
14969         * README: Rewrite, with some notes on unsupported features.
14970
14971 2008-03-24  Cary Coutant  <ccoutant@google.com>
14972
14973         * i386.cc (Target_i386::Got_type): New enum declaration.
14974         (Target_i386::Scan::local): Updated callers of Output_data_got
14975         member functions.
14976         (Target_i386::Scan::global): Likewise.
14977         (Target_i386::Relocate::relocate): Likewise.
14978         (Target_i386::Relocate::relocate_tls): Likewise.
14979         * object.h (Got_offset_list): New class.
14980         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14981         (Sized_relobj::local_got_offset): Likewise.
14982         (Sized_relobj::set_local_got_offset): Likewise.
14983         (Sized_relobj::local_has_tls_got_offset): Removed.
14984         (Sized_relobj::local_tls_got_offset): Removed.
14985         (Sized_relobj::set_local_tls_got_offset): Removed.
14986         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14987         * output.cc (Output_data_got::add_global): Added got_type parameter.
14988         (Output_data_got::add_global_with_rel): Likewise.
14989         (Output_data_got::add_global_with_rela): Likewise.
14990         (Output_data_got::add_global_pair_with_rel): New function.
14991         (Output_data_got::add_global_pair_with_rela): New function.
14992         (Output_data_got::add_local): Added got_type parameter.
14993         (Output_data_got::add_local_with_rel): Likewise.
14994         (Output_data_got::add_local_with_rela): Likewise.
14995         (Output_data_got::add_local_pair_with_rel): New function.
14996         (Output_data_got::add_local_pair_with_rela): New function.
14997         (Output_data_got::add_global_tls): Removed.
14998         (Output_data_got::add_global_tls_with_rel): Removed.
14999         (Output_data_got::add_global_tls_with_rela): Removed.
15000         (Output_data_got::add_local_tls): Removed.
15001         (Output_data_got::add_local_tls_with_rel): Removed.
15002         (Output_data_got::add_local_tls_with_rela): Removed.
15003         * output.h (Output_data_got::add_global): Added got_type parameter.
15004         (Output_data_got::add_global_with_rel): Likewise.
15005         (Output_data_got::add_global_with_rela): Likewise.
15006         (Output_data_got::add_global_pair_with_rel): New function.
15007         (Output_data_got::add_global_pair_with_rela): New function.
15008         (Output_data_got::add_local): Added got_type parameter.
15009         (Output_data_got::add_local_with_rel): Likewise.
15010         (Output_data_got::add_local_with_rela): Likewise.
15011         (Output_data_got::add_local_pair_with_rel): New function.
15012         (Output_data_got::add_local_pair_with_rela): New function.
15013         (Output_data_got::add_global_tls): Removed.
15014         (Output_data_got::add_global_tls_with_rel): Removed.
15015         (Output_data_got::add_global_tls_with_rela): Removed.
15016         (Output_data_got::add_local_tls): Removed.
15017         (Output_data_got::add_local_tls_with_rel): Removed.
15018         (Output_data_got::add_local_tls_with_rela): Removed.
15019         * resolve.cc (Symbol::override_base_with_special): Removed
15020         reference to has_got_offset_ field.
15021         * symtab.cc (Symbol::init_fields): Replaced initialization
15022         of got_offset_ with got_offsets_.  Removed initialization
15023         of has_got_offset_
15024         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15025         (Symbol::got_offset): Likewise.
15026         (Symbol::set_got_offset): Likewise.
15027         (Symbol::has_tls_got_offset): Removed.
15028         (Symbol::tls_got_offset): Removed.
15029         (Symbol::set_tls_got_offset): Removed.
15030         (Symbol::got_offset_): Removed.
15031         (Symbol::tls_mod_got_offset_): Removed.
15032         (Symbol::tls_pair_got_offset_): Removed.
15033         (Symbol::got_offsets_): New field.
15034         (Symbol::has_got_offset): Removed.
15035         (Symbol::has_tls_mod_got_offset): Removed.
15036         (Symbol::has_tls_pair_got_offset): Removed.
15037         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15038         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15039         member functions.
15040         (Target_x86_64::Scan::global): Likewise.
15041         (Target_x86_64::Relocate::relocate): Likewise.
15042         (Target_x86_64::Relocate::relocate_tls): Likewise.
15043
15044 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15045
15046         * yyscript.y: Fix spelling error in comment.
15047
15048 2008-03-24  Ian Lance Taylor  <iant@google.com>
15049
15050         * options.h (class General_options): Define build_id option.
15051         * layout.h (class Layout): Declare write_build_id, create_note,
15052         create_build_id.  Add build_id_note_ member.
15053         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15054         "libiberty.h", "md5.h", "sha1.h".
15055         (Layout::Layout): Initialize eh_frame_data_,
15056         eh_frame_hdr_section_, and build_id_note_.
15057         (Layout::finalize): Call create_build_id.
15058         (Layout::create_note): New function, broken out of
15059         Layout::create_gold_note.
15060         (Layout::create_gold_note): Call create_note.
15061         (Layout::create_build_id): New function.
15062         (Layout::write_build_id): New function.
15063         (Close_task_runner::run): Call write_build_id.
15064
15065         * x86_64.cc: Correct license to GPLv3.
15066
15067 2008-03-23  Ian Lance Taylor  <iant@google.com>
15068
15069         * options.cc: Include "demangle.h".
15070         (parse_optional_string): New function.
15071         (parse_long_option): Handle takes_optional_argument.
15072         (parse_short_option): Update dash_z initializer.  Handle
15073         takes_optional_argument.
15074         (General_options::General_options): Initialize do_demangle_.
15075         (General_options::finalize): Set do_demangle_.  Handle demangling
15076         style.
15077         * options.h (parse_optional_string): Declare.
15078         (struct One_option): Add optional_arg field.  Update constructor.
15079         Update call constructor calls.  Add takes_optional_argument
15080         function.
15081         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15082         (DEFINE_optional_string): Define.
15083         (General_options::demangle): Change from DEFINE_bool to
15084         DEFINE_optional_string.
15085         (General_options::no_demangle): New function.
15086         (General_options::do_demangle): New function.
15087         (General_options::set_do_demangle): New function.
15088         (General_options::execstack_status_): Move definition to end of
15089         class definition.
15090         (General_options::static_): Likewise.
15091         (General_options::do_demangle_): New field.
15092         * object.cc (big_endian>::get_symbol_location_info): Call
15093         Options::do_demangle, not Options::demangle.
15094         * symtab.cc (demangle): Likewise.
15095
15096 2008-03-22  Ian Lance Taylor  <iant@google.com>
15097
15098         * gold.h: Include <cstddef> and <sys/types.h>
15099         * options.h: Include <cstring>.
15100
15101 2008-03-21  Ian Lance Taylor  <iant@google.com>
15102
15103         * Added source code to GNU binutils.
15104 \f
15105 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15106
15107 Copying and distribution of this file, with or without modification,
15108 are permitted in any medium without royalty provided the copyright
15109 notice and this notice are preserved.
15110
15111 Local Variables:
15112 mode: change-log
15113 left-margin: 8
15114 fill-column: 74
15115 version-control: never
15116 End: